datocms-plugin-record-comments 1.0.4 → 1.0.9

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.
@@ -0,0 +1,181 @@
1
+ (function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const o of i)if(o.type==="childList")for(const l of o.addedNodes)l.tagName==="LINK"&&l.rel==="modulepreload"&&r(l)}).observe(document,{childList:!0,subtree:!0});function n(i){const o={};return i.integrity&&(o.integrity=i.integrity),i.referrerPolicy&&(o.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?o.credentials="include":i.crossOrigin==="anonymous"?o.credentials="omit":o.credentials="same-origin",o}function r(i){if(i.ep)return;i.ep=!0;const o=n(i);fetch(i.href,o)}})();function Ea(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var fm={exports:{}},gl={};var OS;function aR(){if(OS)return gl;OS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.fragment");function n(r,i,o){var l=null;if(o!==void 0&&(l=""+o),i.key!==void 0&&(l=""+i.key),"key"in i){o={};for(var c in i)c!=="key"&&(o[c]=i[c])}else o=i;return i=o.ref,{$$typeof:t,type:r,key:l,ref:i!==void 0?i:null,props:o}}return gl.Fragment=e,gl.jsx=n,gl.jsxs=n,gl}var NS;function lR(){return NS||(NS=1,fm.exports=aR()),fm.exports}var E=lR(),Vc={exports:{}},Qt={},RS;function Ag(){if(RS)return Qt;RS=1,Object.defineProperty(Qt,"__esModule",{value:!0}),Qt.DATA_CLONE_ERROR=Qt.MESSAGE=Qt.REJECTED=Qt.FULFILLED=Qt.REPLY=Qt.CALL=Qt.HANDSHAKE_REPLY=Qt.HANDSHAKE=void 0;const t="handshake";Qt.HANDSHAKE=t;const e="handshake-reply";Qt.HANDSHAKE_REPLY=e;const n="call";Qt.CALL=n;const r="reply";Qt.REPLY=r;const i="fulfilled";Qt.FULFILLED=i;const o="rejected";Qt.REJECTED=o;const l="message";Qt.MESSAGE=l;const c="DataCloneError";return Qt.DATA_CLONE_ERROR=c,Qt}var gr={},DS;function NE(){if(DS)return gr;DS=1,Object.defineProperty(gr,"__esModule",{value:!0}),gr.ERR_NO_IFRAME_SRC=gr.ERR_NOT_IN_IFRAME=gr.ERR_CONNECTION_TIMEOUT=gr.ERR_CONNECTION_DESTROYED=void 0;const t="ConnectionDestroyed";gr.ERR_CONNECTION_DESTROYED=t;const e="ConnectionTimeout";gr.ERR_CONNECTION_TIMEOUT=e;const n="NotInIframe";gr.ERR_NOT_IN_IFRAME=n;const r="NoIframeSrc";return gr.ERR_NO_IFRAME_SRC=r,gr}var Kc={exports:{}},IS;function uR(){return IS||(IS=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=()=>{const r=[];let i=!1;return{destroy(){i=!0,r.forEach(o=>{o()})},onDestroy(o){i?o():r.push(o)}}};e.default=n,t.exports=e.default})(Kc,Kc.exports)),Kc.exports}var Gc={exports:{}},As={},LS;function RE(){if(LS)return As;LS=1,Object.defineProperty(As,"__esModule",{value:!0}),As.deserializeError=As.serializeError=void 0;const t=n=>{let r=n.name,i=n.message,o=n.stack;return{name:r,message:i,stack:o}};As.serializeError=t;const e=n=>{const r=new Error;return Object.keys(n).forEach(i=>r[i]=n[i]),r};return As.deserializeError=e,As}var jS;function cR(){return jS||(jS=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=Ag(),r=RE(),i=(o,l,c)=>{const d=o.localName,f=o.local,p=o.remote,m=o.originForSending,y=o.originForReceiving;let b=!1;c(`${d}: Connecting call receiver`);const S=w=>{if(w.source!==p||w.data.penpal!==n.CALL)return;if(w.origin!==y){c(`${d} received message from origin ${w.origin} which did not match expected origin ${y}`);return}const T=w.data,M=T.methodName,k=T.args,j=T.id;c(`${d}: Received ${M}() call`);const I=O=>P=>{if(c(`${d}: Sending ${M}() reply`),b){c(`${d}: Unable to send ${M}() reply due to destroyed connection`);return}const A={penpal:n.REPLY,id:j,resolution:O,returnValue:P};O===n.REJECTED&&P instanceof Error&&(A.returnValue=(0,r.serializeError)(P),A.returnValueIsError=!0);try{p.postMessage(A,m)}catch(U){throw U.name===n.DATA_CLONE_ERROR&&p.postMessage({penpal:n.REPLY,id:j,resolution:n.REJECTED,returnValue:(0,r.serializeError)(U),returnValueIsError:!0},m),U}};new Promise(O=>O(l[M].apply(l,k))).then(I(n.FULFILLED),I(n.REJECTED))};return f.addEventListener(n.MESSAGE,S),()=>{b=!0,f.removeEventListener(n.MESSAGE,S)}};e.default=i,t.exports=e.default})(Gc,Gc.exports)),Gc.exports}var Yc={exports:{}},Qc={exports:{}},BS;function dR(){return BS||(BS=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;let n=0;var r=()=>++n;e.default=r,t.exports=e.default})(Qc,Qc.exports)),Qc.exports}var zS;function fR(){return zS||(zS=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=Ag(),r=NE(),i=l(dR()),o=RE();function l(d){return d&&d.__esModule?d:{default:d}}var c=(d,f,p,m,y)=>{const b=f.localName,S=f.local,w=f.remote,T=f.originForSending,M=f.originForReceiving;let k=!1;y(`${b}: Connecting call sender`);const j=I=>function(){for(var O=arguments.length,P=new Array(O),A=0;A<O;A++)P[A]=arguments[A];y(`${b}: Sending ${I}() call`);let U;try{w.closed&&(U=!0)}catch{U=!0}if(U&&m(),k){const H=new Error(`Unable to send ${I}() call due to destroyed connection`);throw H.code=r.ERR_CONNECTION_DESTROYED,H}return new Promise((H,se)=>{const re=(0,i.default)(),te=Z=>{if(Z.source!==w||Z.data.penpal!==n.REPLY||Z.data.id!==re)return;if(Z.origin!==M){y(`${b} received message from origin ${Z.origin} which did not match expected origin ${M}`);return}y(`${b}: Received ${I}() reply`),S.removeEventListener(n.MESSAGE,te);let G=Z.data.returnValue;Z.data.returnValueIsError&&(G=(0,o.deserializeError)(G)),(Z.data.resolution===n.FULFILLED?H:se)(G)};S.addEventListener(n.MESSAGE,te),w.postMessage({penpal:n.CALL,id:re,methodName:I,args:P},T)})};return p.reduce((I,O)=>(I[O]=j(O),I),d),()=>{k=!0}};e.default=c,t.exports=e.default})(Yc,Yc.exports)),Yc.exports}var Xc={exports:{}},PS;function hR(){return PS||(PS=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=r=>function(){if(r){for(var i=arguments.length,o=new Array(i),l=0;l<i;l++)o[l]=arguments[l];console.log("[Penpal]",...o)}};e.default=n,t.exports=e.default})(Xc,Xc.exports)),Xc.exports}var US;function pR(){return US||(US=1,(function(t,e){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var n=Ag(),r=NE(),i=d(uR()),o=d(cR()),l=d(fR()),c=d(hR());function d(p){return p&&p.__esModule?p:{default:p}}var f=function(){let m=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},y=m.parentOrigin,b=y===void 0?"*":y,S=m.methods,w=S===void 0?{}:S,T=m.timeout,M=m.debug;const k=(0,c.default)(M);if(window===window.top){const H=new Error("connectToParent() must be called within an iframe");throw H.code=r.ERR_NOT_IN_IFRAME,H}const j=(0,i.default)(),I=j.destroy,O=j.onDestroy,P=window,A=P.parent;return{promise:new Promise((H,se)=>{let re;T!==void 0&&(re=setTimeout(()=>{const Z=new Error(`Connection to parent timed out after ${T}ms`);Z.code=r.ERR_CONNECTION_TIMEOUT,se(Z),I()},T));const te=Z=>{try{clearTimeout()}catch{return}if(Z.source!==A||Z.data.penpal!==n.HANDSHAKE_REPLY)return;if(b!=="*"&&b!==Z.origin){k(`Child received handshake reply from origin ${Z.origin} which did not match expected origin ${b}`);return}k("Child: Received handshake reply"),P.removeEventListener(n.MESSAGE,te);const G={localName:"Child",local:P,remote:A,originForSending:Z.origin==="null"?"*":Z.origin,originForReceiving:Z.origin},fe={},R=(0,o.default)(G,w,k);O(R);const $=(0,l.default)(fe,G,Z.data.methodNames,I,k);O($),clearTimeout(re),H(fe)};P.addEventListener(n.MESSAGE,te),O(()=>{P.removeEventListener(n.MESSAGE,te);const Z=new Error("Connection destroyed");Z.code=r.ERR_CONNECTION_DESTROYED,se(Z)}),k("Child: Sending handshake"),A.postMessage({penpal:n.HANDSHAKE,methodNames:Object.keys(w)},b)}),destroy:I}};e.default=f,t.exports=e.default})(Vc,Vc.exports)),Vc.exports}var mR=pR();const yR=Ea(mR);var Rr=function(){return Rr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Rr.apply(this,arguments)};function qS(t,e){for(var n=Rr({},t),r=0,i=e;r<i.length;r++){var o=i[r];delete n[o]}return n}function hm(t){return function(e,n){if(t){for(var r={},i=0,o=e;i<o.length;i++){var l=o[i],c=n.itemTypes[l.relationships.item_type.data.id];r[l.id]=t(l,Rr(Rr({},n),{itemType:c}))}return r}}}function hi(t,e){var n=function(r,i,o){if(o.mode===t){var l=bR(i),c=function(d){e(r,Rr(Rr(Rr({},i),d),l))};return c(o),c}};return n.mode=t,n}function wu(t,e){var n=function(r,i,o){if(o.mode===t){var l=function(c){e(r,Rr(Rr({},i),c))};return l(o),l}};return n.mode=t,n}function gR(){for(var t=document.querySelectorAll("body *"),e=0,n=0;n<t.length;n++)e=Math.max(t[n].getBoundingClientRect().bottom,e);return e}var bR=function(t){var e=null,n=function(f){var p=f===void 0?Math.max(document.body.scrollHeight,document.body.offsetHeight,document.documentElement.getBoundingClientRect().height,gR()):f;p!==e&&(t.setHeight(p),e=p)},r=null,i=null,o=function(){return n()},l=function(){n(),r||(r=new ResizeObserver(o),r.observe(document.documentElement)),i||(i=new MutationObserver(o),i.observe(window.document.body,{attributes:!0,childList:!0,subtree:!0,characterData:!0}))},c=function(){r&&(r.disconnect(),r=null),i&&(i.disconnect(),i=null)},d=function(){return!!r};return{updateHeight:n,startAutoResizer:l,stopAutoResizer:c,isAutoResizerActive:d}},vR=hi("renderAssetSource",function(t,e){t.renderAssetSource&&t.renderAssetSource(e.assetSourceId,e)}),SR=hi("renderConfigScreen",function(t,e){t.renderConfigScreen&&t.renderConfigScreen(e)}),wR=hi("renderFieldExtension",function(t,e){t.renderFieldExtension&&t.renderFieldExtension(e.fieldExtensionId,e)}),_R=wu("renderInspector",function(t,e){t.renderInspector&&t.renderInspector(e.inspectorId,e)}),TR=wu("renderInspectorPanel",function(t,e){t.renderInspectorPanel&&t.renderInspectorPanel(e.panelId,e)}),ER=hi("renderItemCollectionOutlet",function(t,e){t.renderItemCollectionOutlet&&t.renderItemCollectionOutlet(e.itemCollectionOutletId,e)}),MR=hi("renderItemFormOutlet",function(t,e){t.renderItemFormOutlet&&t.renderItemFormOutlet(e.itemFormOutletId,e)}),xR=wu("renderItemFormSidebar",function(t,e){t.renderItemFormSidebar&&t.renderItemFormSidebar(e.sidebarId,e)}),CR=hi("renderItemFormSidebarPanel",function(t,e){t.renderItemFormSidebarPanel&&t.renderItemFormSidebarPanel(e.sidebarPaneId,e)}),kR=hi("renderManualFieldExtensionConfigScreen",function(t,e){t.renderManualFieldExtensionConfigScreen&&t.renderManualFieldExtensionConfigScreen(e.fieldExtensionId,e)}),AR=hi("renderModal",function(t,e){t.renderModal&&t.renderModal(e.modalId,e)}),OR=wu("renderPage",function(t,e){t.renderPage&&t.renderPage(e.pageId,e)}),NR=wu("renderUploadSidebar",function(t,e){t.renderUploadSidebar&&t.renderUploadSidebar(e.sidebarId,e)}),RR=hi("renderUploadSidebarPanel",function(t,e){t.renderUploadSidebarPanel&&t.renderUploadSidebarPanel(e.sidebarPaneId,e)}),rr=function(){return rr=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},rr.apply(this,arguments)},DR=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})},IR=function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,l=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function c(f){return function(p){return d([f,p])}}function d(f){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(o=f[0]&2?i.return:f[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,f[1])).done)return o;switch(i=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){n.label=f[1];break}if(f[0]===6&&n.label<o[1]){n.label=o[1],o=f;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(f);break}o[2]&&n.ops.pop(),n.trys.pop();continue}f=e.call(t,n)}catch(p){f=[6,p],i=0}finally{r=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},$S=function(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))};function LR(){return DR(this,arguments,void 0,function(t){var e,n,r,i,o,l,c,d,f,p,m,y;return t===void 0&&(t={}),IR(this,function(b){switch(b.label){case 0:return e=null,n=null,r=rr(rr({},t),{overrideFieldExtensions:hm(t.overrideFieldExtensions),customMarksForStructuredTextField:hm(t.customMarksForStructuredTextField),customBlockStylesForStructuredTextField:hm(t.customBlockStylesForStructuredTextField)}),i=yR({methods:rr(rr({sdkVersion:function(){return"0.3.0"},implementedHooks:function(){return Object.fromEntries(Object.keys(t).map(function(S){return[S,!0]}))}},Object.fromEntries(Object.entries(r).filter(function(S){var w=S[0];return!w.startsWith("render")}))),{onChange:function(S){e&&e(S)},callMethodMergingBootCtx:function(S,w,T,M,k){return n?n(S,w,T,M,k):null}})}),[4,i.promise];case 1:return o=b.sent(),[4,o.getSettings()];case 2:for(l=b.sent(),l.mode==="onBoot"&&(c=l,e=function(S){c=S},n=function(S,w,T,M,k){var j;if(S in r)return(j=r)[S].apply(j,$S($S([],w,!1),[rr(rr(rr(rr({},qS(o,["getSettings","setHeight"])),qS(c,["mode","bodyPadding"])),Object.fromEntries(M.map(function(I){return[I,function(){for(var P=[],A=0;A<arguments.length;A++)P[A]=arguments[A];return o.callAdditionalCtxMethod(k,I,P)}]}))),T)],!1))},r.onBoot&&r.onBoot(rr(rr({},o),c))),d={renderAssetSource:vR,renderConfigScreen:SR,renderFieldExtension:wR,renderItemCollectionOutlet:ER,renderItemFormOutlet:MR,renderItemFormSidebar:xR,renderItemFormSidebarPanel:CR,renderManualFieldExtensionConfigScreen:kR,renderModal:AR,renderPage:OR,renderInspector:_R,renderInspectorPanel:TR,renderUploadSidebar:NR,renderUploadSidebarPanel:RR},f=0,p=Object.values(d);f<p.length;f++)if(m=p[f],y=m(r,o,l),y){e=y;break}return[2]}})})}var pm={exports:{}},Ue={};var FS;function jR(){if(FS)return Ue;FS=1;var t=Symbol.for("react.transitional.element"),e=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),r=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),o=Symbol.for("react.consumer"),l=Symbol.for("react.context"),c=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.memo"),p=Symbol.for("react.lazy"),m=Symbol.for("react.activity"),y=Symbol.iterator;function b(N){return N===null||typeof N!="object"?null:(N=y&&N[y]||N["@@iterator"],typeof N=="function"?N:null)}var S={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},w=Object.assign,T={};function M(N,Q,ce){this.props=N,this.context=Q,this.refs=T,this.updater=ce||S}M.prototype.isReactComponent={},M.prototype.setState=function(N,Q){if(typeof N!="object"&&typeof N!="function"&&N!=null)throw Error("takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,N,Q,"setState")},M.prototype.forceUpdate=function(N){this.updater.enqueueForceUpdate(this,N,"forceUpdate")};function k(){}k.prototype=M.prototype;function j(N,Q,ce){this.props=N,this.context=Q,this.refs=T,this.updater=ce||S}var I=j.prototype=new k;I.constructor=j,w(I,M.prototype),I.isPureReactComponent=!0;var O=Array.isArray;function P(){}var A={H:null,A:null,T:null,S:null},U=Object.prototype.hasOwnProperty;function H(N,Q,ce){var le=ce.ref;return{$$typeof:t,type:N,key:Q,ref:le!==void 0?le:null,props:ce}}function se(N,Q){return H(N.type,Q,N.props)}function re(N){return typeof N=="object"&&N!==null&&N.$$typeof===t}function te(N){var Q={"=":"=0",":":"=2"};return"$"+N.replace(/[=:]/g,function(ce){return Q[ce]})}var Z=/\/+/g;function G(N,Q){return typeof N=="object"&&N!==null&&N.key!=null?te(""+N.key):Q.toString(36)}function fe(N){switch(N.status){case"fulfilled":return N.value;case"rejected":throw N.reason;default:switch(typeof N.status=="string"?N.then(P,P):(N.status="pending",N.then(function(Q){N.status==="pending"&&(N.status="fulfilled",N.value=Q)},function(Q){N.status==="pending"&&(N.status="rejected",N.reason=Q)})),N.status){case"fulfilled":return N.value;case"rejected":throw N.reason}}throw N}function R(N,Q,ce,le,we){var ve=typeof N;(ve==="undefined"||ve==="boolean")&&(N=null);var je=!1;if(N===null)je=!0;else switch(ve){case"bigint":case"string":case"number":je=!0;break;case"object":switch(N.$$typeof){case t:case e:je=!0;break;case p:return je=N._init,R(je(N._payload),Q,ce,le,we)}}if(je)return we=we(N),je=le===""?"."+G(N,0):le,O(we)?(ce="",je!=null&&(ce=je.replace(Z,"$&/")+"/"),R(we,Q,ce,"",function(Me){return Me})):we!=null&&(re(we)&&(we=se(we,ce+(we.key==null||N&&N.key===we.key?"":(""+we.key).replace(Z,"$&/")+"/")+je)),Q.push(we)),1;je=0;var nt=le===""?".":le+":";if(O(N))for(var pe=0;pe<N.length;pe++)le=N[pe],ve=nt+G(le,pe),je+=R(le,Q,ce,ve,we);else if(pe=b(N),typeof pe=="function")for(N=pe.call(N),pe=0;!(le=N.next()).done;)le=le.value,ve=nt+G(le,pe++),je+=R(le,Q,ce,ve,we);else if(ve==="object"){if(typeof N.then=="function")return R(fe(N),Q,ce,le,we);throw Q=String(N),Error("Objects are not valid as a React child (found: "+(Q==="[object Object]"?"object with keys {"+Object.keys(N).join(", ")+"}":Q)+"). If you meant to render a collection of children, use an array instead.")}return je}function $(N,Q,ce){if(N==null)return N;var le=[],we=0;return R(N,le,"","",function(ve){return Q.call(ce,ve,we++)}),le}function ie(N){if(N._status===-1){var Q=N._result;Q=Q(),Q.then(function(ce){(N._status===0||N._status===-1)&&(N._status=1,N._result=ce)},function(ce){(N._status===0||N._status===-1)&&(N._status=2,N._result=ce)}),N._status===-1&&(N._status=0,N._result=Q)}if(N._status===1)return N._result.default;throw N._result}var me=typeof reportError=="function"?reportError:function(N){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var Q=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof N=="object"&&N!==null&&typeof N.message=="string"?String(N.message):String(N),error:N});if(!window.dispatchEvent(Q))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",N);return}console.error(N)},ye={map:$,forEach:function(N,Q,ce){$(N,function(){Q.apply(this,arguments)},ce)},count:function(N){var Q=0;return $(N,function(){Q++}),Q},toArray:function(N){return $(N,function(Q){return Q})||[]},only:function(N){if(!re(N))throw Error("React.Children.only expected to receive a single React element child.");return N}};return Ue.Activity=m,Ue.Children=ye,Ue.Component=M,Ue.Fragment=n,Ue.Profiler=i,Ue.PureComponent=j,Ue.StrictMode=r,Ue.Suspense=d,Ue.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=A,Ue.__COMPILER_RUNTIME={__proto__:null,c:function(N){return A.H.useMemoCache(N)}},Ue.cache=function(N){return function(){return N.apply(null,arguments)}},Ue.cacheSignal=function(){return null},Ue.cloneElement=function(N,Q,ce){if(N==null)throw Error("The argument must be a React element, but you passed "+N+".");var le=w({},N.props),we=N.key;if(Q!=null)for(ve in Q.key!==void 0&&(we=""+Q.key),Q)!U.call(Q,ve)||ve==="key"||ve==="__self"||ve==="__source"||ve==="ref"&&Q.ref===void 0||(le[ve]=Q[ve]);var ve=arguments.length-2;if(ve===1)le.children=ce;else if(1<ve){for(var je=Array(ve),nt=0;nt<ve;nt++)je[nt]=arguments[nt+2];le.children=je}return H(N.type,we,le)},Ue.createContext=function(N){return N={$$typeof:l,_currentValue:N,_currentValue2:N,_threadCount:0,Provider:null,Consumer:null},N.Provider=N,N.Consumer={$$typeof:o,_context:N},N},Ue.createElement=function(N,Q,ce){var le,we={},ve=null;if(Q!=null)for(le in Q.key!==void 0&&(ve=""+Q.key),Q)U.call(Q,le)&&le!=="key"&&le!=="__self"&&le!=="__source"&&(we[le]=Q[le]);var je=arguments.length-2;if(je===1)we.children=ce;else if(1<je){for(var nt=Array(je),pe=0;pe<je;pe++)nt[pe]=arguments[pe+2];we.children=nt}if(N&&N.defaultProps)for(le in je=N.defaultProps,je)we[le]===void 0&&(we[le]=je[le]);return H(N,ve,we)},Ue.createRef=function(){return{current:null}},Ue.forwardRef=function(N){return{$$typeof:c,render:N}},Ue.isValidElement=re,Ue.lazy=function(N){return{$$typeof:p,_payload:{_status:-1,_result:N},_init:ie}},Ue.memo=function(N,Q){return{$$typeof:f,type:N,compare:Q===void 0?null:Q}},Ue.startTransition=function(N){var Q=A.T,ce={};A.T=ce;try{var le=N(),we=A.S;we!==null&&we(ce,le),typeof le=="object"&&le!==null&&typeof le.then=="function"&&le.then(P,me)}catch(ve){me(ve)}finally{Q!==null&&ce.types!==null&&(Q.types=ce.types),A.T=Q}},Ue.unstable_useCacheRefresh=function(){return A.H.useCacheRefresh()},Ue.use=function(N){return A.H.use(N)},Ue.useActionState=function(N,Q,ce){return A.H.useActionState(N,Q,ce)},Ue.useCallback=function(N,Q){return A.H.useCallback(N,Q)},Ue.useContext=function(N){return A.H.useContext(N)},Ue.useDebugValue=function(){},Ue.useDeferredValue=function(N,Q){return A.H.useDeferredValue(N,Q)},Ue.useEffect=function(N,Q){return A.H.useEffect(N,Q)},Ue.useEffectEvent=function(N){return A.H.useEffectEvent(N)},Ue.useId=function(){return A.H.useId()},Ue.useImperativeHandle=function(N,Q,ce){return A.H.useImperativeHandle(N,Q,ce)},Ue.useInsertionEffect=function(N,Q){return A.H.useInsertionEffect(N,Q)},Ue.useLayoutEffect=function(N,Q){return A.H.useLayoutEffect(N,Q)},Ue.useMemo=function(N,Q){return A.H.useMemo(N,Q)},Ue.useOptimistic=function(N,Q){return A.H.useOptimistic(N,Q)},Ue.useReducer=function(N,Q,ce){return A.H.useReducer(N,Q,ce)},Ue.useRef=function(N){return A.H.useRef(N)},Ue.useState=function(N){return A.H.useState(N)},Ue.useSyncExternalStore=function(N,Q,ce){return A.H.useSyncExternalStore(N,Q,ce)},Ue.useTransition=function(){return A.H.useTransition()},Ue.version="19.2.4",Ue}var HS;function _u(){return HS||(HS=1,pm.exports=jR()),pm.exports}var C=_u();const Le=Ea(C);var mm={exports:{}},bl={},ym={exports:{}},gm={};var VS;function BR(){return VS||(VS=1,(function(t){function e(R,$){var ie=R.length;R.push($);e:for(;0<ie;){var me=ie-1>>>1,ye=R[me];if(0<i(ye,$))R[me]=$,R[ie]=ye,ie=me;else break e}}function n(R){return R.length===0?null:R[0]}function r(R){if(R.length===0)return null;var $=R[0],ie=R.pop();if(ie!==$){R[0]=ie;e:for(var me=0,ye=R.length,N=ye>>>1;me<N;){var Q=2*(me+1)-1,ce=R[Q],le=Q+1,we=R[le];if(0>i(ce,ie))le<ye&&0>i(we,ce)?(R[me]=we,R[le]=ie,me=le):(R[me]=ce,R[Q]=ie,me=Q);else if(le<ye&&0>i(we,ie))R[me]=we,R[le]=ie,me=le;else break e}}return $}function i(R,$){var ie=R.sortIndex-$.sortIndex;return ie!==0?ie:R.id-$.id}if(t.unstable_now=void 0,typeof performance=="object"&&typeof performance.now=="function"){var o=performance;t.unstable_now=function(){return o.now()}}else{var l=Date,c=l.now();t.unstable_now=function(){return l.now()-c}}var d=[],f=[],p=1,m=null,y=3,b=!1,S=!1,w=!1,T=!1,M=typeof setTimeout=="function"?setTimeout:null,k=typeof clearTimeout=="function"?clearTimeout:null,j=typeof setImmediate<"u"?setImmediate:null;function I(R){for(var $=n(f);$!==null;){if($.callback===null)r(f);else if($.startTime<=R)r(f),$.sortIndex=$.expirationTime,e(d,$);else break;$=n(f)}}function O(R){if(w=!1,I(R),!S)if(n(d)!==null)S=!0,P||(P=!0,te());else{var $=n(f);$!==null&&fe(O,$.startTime-R)}}var P=!1,A=-1,U=5,H=-1;function se(){return T?!0:!(t.unstable_now()-H<U)}function re(){if(T=!1,P){var R=t.unstable_now();H=R;var $=!0;try{e:{S=!1,w&&(w=!1,k(A),A=-1),b=!0;var ie=y;try{t:{for(I(R),m=n(d);m!==null&&!(m.expirationTime>R&&se());){var me=m.callback;if(typeof me=="function"){m.callback=null,y=m.priorityLevel;var ye=me(m.expirationTime<=R);if(R=t.unstable_now(),typeof ye=="function"){m.callback=ye,I(R),$=!0;break t}m===n(d)&&r(d),I(R)}else r(d);m=n(d)}if(m!==null)$=!0;else{var N=n(f);N!==null&&fe(O,N.startTime-R),$=!1}}break e}finally{m=null,y=ie,b=!1}$=void 0}}finally{$?te():P=!1}}}var te;if(typeof j=="function")te=function(){j(re)};else if(typeof MessageChannel<"u"){var Z=new MessageChannel,G=Z.port2;Z.port1.onmessage=re,te=function(){G.postMessage(null)}}else te=function(){M(re,0)};function fe(R,$){A=M(function(){R(t.unstable_now())},$)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(R){R.callback=null},t.unstable_forceFrameRate=function(R){0>R||125<R?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):U=0<R?Math.floor(1e3/R):5},t.unstable_getCurrentPriorityLevel=function(){return y},t.unstable_next=function(R){switch(y){case 1:case 2:case 3:var $=3;break;default:$=y}var ie=y;y=$;try{return R()}finally{y=ie}},t.unstable_requestPaint=function(){T=!0},t.unstable_runWithPriority=function(R,$){switch(R){case 1:case 2:case 3:case 4:case 5:break;default:R=3}var ie=y;y=R;try{return $()}finally{y=ie}},t.unstable_scheduleCallback=function(R,$,ie){var me=t.unstable_now();switch(typeof ie=="object"&&ie!==null?(ie=ie.delay,ie=typeof ie=="number"&&0<ie?me+ie:me):ie=me,R){case 1:var ye=-1;break;case 2:ye=250;break;case 5:ye=1073741823;break;case 4:ye=1e4;break;default:ye=5e3}return ye=ie+ye,R={id:p++,callback:$,priorityLevel:R,startTime:ie,expirationTime:ye,sortIndex:-1},ie>me?(R.sortIndex=ie,e(f,R),n(d)===null&&R===n(f)&&(w?(k(A),A=-1):w=!0,fe(O,ie-me))):(R.sortIndex=ye,e(d,R),S||b||(S=!0,P||(P=!0,te()))),R},t.unstable_shouldYield=se,t.unstable_wrapCallback=function(R){var $=y;return function(){var ie=y;y=$;try{return R.apply(this,arguments)}finally{y=ie}}}})(gm)),gm}var KS;function zR(){return KS||(KS=1,ym.exports=BR()),ym.exports}var bm={exports:{}},fn={};var GS;function PR(){if(GS)return fn;GS=1;var t=_u();function e(d){var f="https://react.dev/errors/"+d;if(1<arguments.length){f+="?args[]="+encodeURIComponent(arguments[1]);for(var p=2;p<arguments.length;p++)f+="&args[]="+encodeURIComponent(arguments[p])}return"Minified React error #"+d+"; visit "+f+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function n(){}var r={d:{f:n,r:function(){throw Error(e(522))},D:n,C:n,L:n,m:n,X:n,S:n,M:n},p:0,findDOMNode:null},i=Symbol.for("react.portal");function o(d,f,p){var m=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:i,key:m==null?null:""+m,children:d,containerInfo:f,implementation:p}}var l=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function c(d,f){if(d==="font")return"";if(typeof f=="string")return f==="use-credentials"?f:""}return fn.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=r,fn.createPortal=function(d,f){var p=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!f||f.nodeType!==1&&f.nodeType!==9&&f.nodeType!==11)throw Error(e(299));return o(d,f,null,p)},fn.flushSync=function(d){var f=l.T,p=r.p;try{if(l.T=null,r.p=2,d)return d()}finally{l.T=f,r.p=p,r.d.f()}},fn.preconnect=function(d,f){typeof d=="string"&&(f?(f=f.crossOrigin,f=typeof f=="string"?f==="use-credentials"?f:"":void 0):f=null,r.d.C(d,f))},fn.prefetchDNS=function(d){typeof d=="string"&&r.d.D(d)},fn.preinit=function(d,f){if(typeof d=="string"&&f&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin),y=typeof f.integrity=="string"?f.integrity:void 0,b=typeof f.fetchPriority=="string"?f.fetchPriority:void 0;p==="style"?r.d.S(d,typeof f.precedence=="string"?f.precedence:void 0,{crossOrigin:m,integrity:y,fetchPriority:b}):p==="script"&&r.d.X(d,{crossOrigin:m,integrity:y,fetchPriority:b,nonce:typeof f.nonce=="string"?f.nonce:void 0})}},fn.preinitModule=function(d,f){if(typeof d=="string")if(typeof f=="object"&&f!==null){if(f.as==null||f.as==="script"){var p=c(f.as,f.crossOrigin);r.d.M(d,{crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0})}}else f==null&&r.d.M(d)},fn.preload=function(d,f){if(typeof d=="string"&&typeof f=="object"&&f!==null&&typeof f.as=="string"){var p=f.as,m=c(p,f.crossOrigin);r.d.L(d,p,{crossOrigin:m,integrity:typeof f.integrity=="string"?f.integrity:void 0,nonce:typeof f.nonce=="string"?f.nonce:void 0,type:typeof f.type=="string"?f.type:void 0,fetchPriority:typeof f.fetchPriority=="string"?f.fetchPriority:void 0,referrerPolicy:typeof f.referrerPolicy=="string"?f.referrerPolicy:void 0,imageSrcSet:typeof f.imageSrcSet=="string"?f.imageSrcSet:void 0,imageSizes:typeof f.imageSizes=="string"?f.imageSizes:void 0,media:typeof f.media=="string"?f.media:void 0})}},fn.preloadModule=function(d,f){if(typeof d=="string")if(f){var p=c(f.as,f.crossOrigin);r.d.m(d,{as:typeof f.as=="string"&&f.as!=="script"?f.as:void 0,crossOrigin:p,integrity:typeof f.integrity=="string"?f.integrity:void 0})}else r.d.m(d)},fn.requestFormReset=function(d){r.d.r(d)},fn.unstable_batchedUpdates=function(d,f){return d(f)},fn.useFormState=function(d,f,p){return l.H.useFormState(d,f,p)},fn.useFormStatus=function(){return l.H.useHostTransitionStatus()},fn.version="19.2.4",fn}var YS;function DE(){if(YS)return bm.exports;YS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),bm.exports=PR(),bm.exports}var QS;function UR(){if(QS)return bl;QS=1;var t=zR(),e=_u(),n=DE();function r(s){var a="https://react.dev/errors/"+s;if(1<arguments.length){a+="?args[]="+encodeURIComponent(arguments[1]);for(var u=2;u<arguments.length;u++)a+="&args[]="+encodeURIComponent(arguments[u])}return"Minified React error #"+s+"; visit "+a+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function i(s){return!(!s||s.nodeType!==1&&s.nodeType!==9&&s.nodeType!==11)}function o(s){var a=s,u=s;if(s.alternate)for(;a.return;)a=a.return;else{s=a;do a=s,(a.flags&4098)!==0&&(u=a.return),s=a.return;while(s)}return a.tag===3?u:null}function l(s){if(s.tag===13){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function c(s){if(s.tag===31){var a=s.memoizedState;if(a===null&&(s=s.alternate,s!==null&&(a=s.memoizedState)),a!==null)return a.dehydrated}return null}function d(s){if(o(s)!==s)throw Error(r(188))}function f(s){var a=s.alternate;if(!a){if(a=o(s),a===null)throw Error(r(188));return a!==s?null:s}for(var u=s,h=a;;){var g=u.return;if(g===null)break;var v=g.alternate;if(v===null){if(h=g.return,h!==null){u=h;continue}break}if(g.child===v.child){for(v=g.child;v;){if(v===u)return d(g),s;if(v===h)return d(g),a;v=v.sibling}throw Error(r(188))}if(u.return!==h.return)u=g,h=v;else{for(var _=!1,x=g.child;x;){if(x===u){_=!0,u=g,h=v;break}if(x===h){_=!0,h=g,u=v;break}x=x.sibling}if(!_){for(x=v.child;x;){if(x===u){_=!0,u=v,h=g;break}if(x===h){_=!0,h=v,u=g;break}x=x.sibling}if(!_)throw Error(r(189))}}if(u.alternate!==h)throw Error(r(190))}if(u.tag!==3)throw Error(r(188));return u.stateNode.current===u?s:a}function p(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s;for(s=s.child;s!==null;){if(a=p(s),a!==null)return a;s=s.sibling}return null}var m=Object.assign,y=Symbol.for("react.element"),b=Symbol.for("react.transitional.element"),S=Symbol.for("react.portal"),w=Symbol.for("react.fragment"),T=Symbol.for("react.strict_mode"),M=Symbol.for("react.profiler"),k=Symbol.for("react.consumer"),j=Symbol.for("react.context"),I=Symbol.for("react.forward_ref"),O=Symbol.for("react.suspense"),P=Symbol.for("react.suspense_list"),A=Symbol.for("react.memo"),U=Symbol.for("react.lazy"),H=Symbol.for("react.activity"),se=Symbol.for("react.memo_cache_sentinel"),re=Symbol.iterator;function te(s){return s===null||typeof s!="object"?null:(s=re&&s[re]||s["@@iterator"],typeof s=="function"?s:null)}var Z=Symbol.for("react.client.reference");function G(s){if(s==null)return null;if(typeof s=="function")return s.$$typeof===Z?null:s.displayName||s.name||null;if(typeof s=="string")return s;switch(s){case w:return"Fragment";case M:return"Profiler";case T:return"StrictMode";case O:return"Suspense";case P:return"SuspenseList";case H:return"Activity"}if(typeof s=="object")switch(s.$$typeof){case S:return"Portal";case j:return s.displayName||"Context";case k:return(s._context.displayName||"Context")+".Consumer";case I:var a=s.render;return s=s.displayName,s||(s=a.displayName||a.name||"",s=s!==""?"ForwardRef("+s+")":"ForwardRef"),s;case A:return a=s.displayName||null,a!==null?a:G(s.type)||"Memo";case U:a=s._payload,s=s._init;try{return G(s(a))}catch{}}return null}var fe=Array.isArray,R=e.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,$=n.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,ie={pending:!1,data:null,method:null,action:null},me=[],ye=-1;function N(s){return{current:s}}function Q(s){0>ye||(s.current=me[ye],me[ye]=null,ye--)}function ce(s,a){ye++,me[ye]=s.current,s.current=a}var le=N(null),we=N(null),ve=N(null),je=N(null);function nt(s,a){switch(ce(ve,a),ce(we,s),ce(le,null),a.nodeType){case 9:case 11:s=(s=a.documentElement)&&(s=s.namespaceURI)?Z1(s):0;break;default:if(s=a.tagName,a=a.namespaceURI)a=Z1(a),s=eS(a,s);else switch(s){case"svg":s=1;break;case"math":s=2;break;default:s=0}}Q(le),ce(le,s)}function pe(){Q(le),Q(we),Q(ve)}function Me(s){s.memoizedState!==null&&ce(je,s);var a=le.current,u=eS(a,s.type);a!==u&&(ce(we,s),ce(le,u))}function wt(s){we.current===s&&(Q(le),Q(we)),je.current===s&&(Q(je),hl._currentValue=ie)}var Ne,Re;function De(s){if(Ne===void 0)try{throw Error()}catch(u){var a=u.stack.trim().match(/\n( *(at )?)/);Ne=a&&a[1]||"",Re=-1<u.stack.indexOf(`
2
+ at`)?" (<anonymous>)":-1<u.stack.indexOf("@")?"@unknown:0:0":""}return`
3
+ `+Ne+s+Re}var pt=!1;function it(s,a){if(!s||pt)return"";pt=!0;var u=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var h={DetermineComponentFrameRoot:function(){try{if(a){var ne=function(){throw Error()};if(Object.defineProperty(ne.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(ne,[])}catch(X){var Y=X}Reflect.construct(s,[],ne)}else{try{ne.call()}catch(X){Y=X}s.call(ne.prototype)}}else{try{throw Error()}catch(X){Y=X}(ne=s())&&typeof ne.catch=="function"&&ne.catch(function(){})}}catch(X){if(X&&Y&&typeof X.stack=="string")return[X.stack,Y.stack]}return[null,null]}};h.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var g=Object.getOwnPropertyDescriptor(h.DetermineComponentFrameRoot,"name");g&&g.configurable&&Object.defineProperty(h.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var v=h.DetermineComponentFrameRoot(),_=v[0],x=v[1];if(_&&x){var D=_.split(`
4
+ `),K=x.split(`
5
+ `);for(g=h=0;h<D.length&&!D[h].includes("DetermineComponentFrameRoot");)h++;for(;g<K.length&&!K[g].includes("DetermineComponentFrameRoot");)g++;if(h===D.length||g===K.length)for(h=D.length-1,g=K.length-1;1<=h&&0<=g&&D[h]!==K[g];)g--;for(;1<=h&&0<=g;h--,g--)if(D[h]!==K[g]){if(h!==1||g!==1)do if(h--,g--,0>g||D[h]!==K[g]){var W=`
6
+ `+D[h].replace(" at new "," at ");return s.displayName&&W.includes("<anonymous>")&&(W=W.replace("<anonymous>",s.displayName)),W}while(1<=h&&0<=g);break}}}finally{pt=!1,Error.prepareStackTrace=u}return(u=s?s.displayName||s.name:"")?De(u):""}function lt(s,a){switch(s.tag){case 26:case 27:case 5:return De(s.type);case 16:return De("Lazy");case 13:return s.child!==a&&a!==null?De("Suspense Fallback"):De("Suspense");case 19:return De("SuspenseList");case 0:case 15:return it(s.type,!1);case 11:return it(s.type.render,!1);case 1:return it(s.type,!0);case 31:return De("Activity");default:return""}}function ft(s){try{var a="",u=null;do a+=lt(s,u),u=s,s=s.return;while(s);return a}catch(h){return`
7
+ Error generating stack: `+h.message+`
8
+ `+h.stack}}var st=Object.prototype.hasOwnProperty,xe=t.unstable_scheduleCallback,bn=t.unstable_cancelCallback,hr=t.unstable_shouldYield,_r=t.unstable_requestPaint,Qe=t.unstable_now,Vn=t.unstable_getCurrentPriorityLevel,Tr=t.unstable_ImmediatePriority,Lr=t.unstable_UserBlockingPriority,ue=t.unstable_NormalPriority,ae=t.unstable_LowPriority,be=t.unstable_IdlePriority,he=t.log,Ce=t.unstable_setDisableYieldValue,Ve=null,rt=null;function Gt(s){if(typeof he=="function"&&Ce(s),rt&&typeof rt.setStrictMode=="function")try{rt.setStrictMode(Ve,s)}catch{}}var Ke=Math.clz32?Math.clz32:GA,ku=Math.log,Zf=Math.LN2;function GA(s){return s>>>=0,s===0?32:31-(ku(s)/Zf|0)|0}var Au=256,Ou=262144,Nu=4194304;function ds(s){var a=s&42;if(a!==0)return a;switch(s&-s){case 1:return 1;case 2:return 2;case 4:return 4;case 8:return 8;case 16:return 16;case 32:return 32;case 64:return 64;case 128:return 128;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:return s&261888;case 262144:case 524288:case 1048576:case 2097152:return s&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return s&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return s}}function Ru(s,a,u){var h=s.pendingLanes;if(h===0)return 0;var g=0,v=s.suspendedLanes,_=s.pingedLanes;s=s.warmLanes;var x=h&134217727;return x!==0?(h=x&~v,h!==0?g=ds(h):(_&=x,_!==0?g=ds(_):u||(u=x&~s,u!==0&&(g=ds(u))))):(x=h&~v,x!==0?g=ds(x):_!==0?g=ds(_):u||(u=h&~s,u!==0&&(g=ds(u)))),g===0?0:a!==0&&a!==g&&(a&v)===0&&(v=g&-g,u=a&-a,v>=u||v===32&&(u&4194048)!==0)?a:g}function xa(s,a){return(s.pendingLanes&~(s.suspendedLanes&~s.pingedLanes)&a)===0}function YA(s,a){switch(s){case 1:case 2:case 4:case 8:case 64:return a+250;case 16:case 32:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a+5e3;case 4194304:case 8388608:case 16777216:case 33554432:return-1;case 67108864:case 134217728:case 268435456:case 536870912:case 1073741824:return-1;default:return-1}}function I0(){var s=Nu;return Nu<<=1,(Nu&62914560)===0&&(Nu=4194304),s}function eh(s){for(var a=[],u=0;31>u;u++)a.push(s);return a}function Ca(s,a){s.pendingLanes|=a,a!==268435456&&(s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0)}function QA(s,a,u,h,g,v){var _=s.pendingLanes;s.pendingLanes=u,s.suspendedLanes=0,s.pingedLanes=0,s.warmLanes=0,s.expiredLanes&=u,s.entangledLanes&=u,s.errorRecoveryDisabledLanes&=u,s.shellSuspendCounter=0;var x=s.entanglements,D=s.expirationTimes,K=s.hiddenUpdates;for(u=_&~u;0<u;){var W=31-Ke(u),ne=1<<W;x[W]=0,D[W]=-1;var Y=K[W];if(Y!==null)for(K[W]=null,W=0;W<Y.length;W++){var X=Y[W];X!==null&&(X.lane&=-536870913)}u&=~ne}h!==0&&L0(s,h,0),v!==0&&g===0&&s.tag!==0&&(s.suspendedLanes|=v&~(_&~a))}function L0(s,a,u){s.pendingLanes|=a,s.suspendedLanes&=~a;var h=31-Ke(a);s.entangledLanes|=a,s.entanglements[h]=s.entanglements[h]|1073741824|u&261930}function j0(s,a){var u=s.entangledLanes|=a;for(s=s.entanglements;u;){var h=31-Ke(u),g=1<<h;g&a|s[h]&a&&(s[h]|=a),u&=~g}}function B0(s,a){var u=a&-a;return u=(u&42)!==0?1:th(u),(u&(s.suspendedLanes|a))!==0?0:u}function th(s){switch(s){case 2:s=1;break;case 8:s=4;break;case 32:s=16;break;case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:case 4194304:case 8388608:case 16777216:case 33554432:s=128;break;case 268435456:s=134217728;break;default:s=0}return s}function nh(s){return s&=-s,2<s?8<s?(s&134217727)!==0?32:268435456:8:2}function z0(){var s=$.p;return s!==0?s:(s=window.event,s===void 0?32:TS(s.type))}function P0(s,a){var u=$.p;try{return $.p=s,a()}finally{$.p=u}}var gi=Math.random().toString(36).slice(2),nn="__reactFiber$"+gi,Tn="__reactProps$"+gi,io="__reactContainer$"+gi,rh="__reactEvents$"+gi,XA="__reactListeners$"+gi,JA="__reactHandles$"+gi,U0="__reactResources$"+gi,ka="__reactMarker$"+gi;function ih(s){delete s[nn],delete s[Tn],delete s[rh],delete s[XA],delete s[JA]}function so(s){var a=s[nn];if(a)return a;for(var u=s.parentNode;u;){if(a=u[io]||u[nn]){if(u=a.alternate,a.child!==null||u!==null&&u.child!==null)for(s=aS(s);s!==null;){if(u=s[nn])return u;s=aS(s)}return a}s=u,u=s.parentNode}return null}function oo(s){if(s=s[nn]||s[io]){var a=s.tag;if(a===5||a===6||a===13||a===31||a===26||a===27||a===3)return s}return null}function Aa(s){var a=s.tag;if(a===5||a===26||a===27||a===6)return s.stateNode;throw Error(r(33))}function ao(s){var a=s[U0];return a||(a=s[U0]={hoistableStyles:new Map,hoistableScripts:new Map}),a}function Xt(s){s[ka]=!0}var q0=new Set,$0={};function fs(s,a){lo(s,a),lo(s+"Capture",a)}function lo(s,a){for($0[s]=a,s=0;s<a.length;s++)q0.add(a[s])}var WA=RegExp("^[:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Z_a-z\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.0-9\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$"),F0={},H0={};function ZA(s){return st.call(H0,s)?!0:st.call(F0,s)?!1:WA.test(s)?H0[s]=!0:(F0[s]=!0,!1)}function Du(s,a,u){if(ZA(a))if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":s.removeAttribute(a);return;case"boolean":var h=a.toLowerCase().slice(0,5);if(h!=="data-"&&h!=="aria-"){s.removeAttribute(a);return}}s.setAttribute(a,""+u)}}function Iu(s,a,u){if(u===null)s.removeAttribute(a);else{switch(typeof u){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(a);return}s.setAttribute(a,""+u)}}function jr(s,a,u,h){if(h===null)s.removeAttribute(u);else{switch(typeof h){case"undefined":case"function":case"symbol":case"boolean":s.removeAttribute(u);return}s.setAttributeNS(a,u,""+h)}}function Kn(s){switch(typeof s){case"bigint":case"boolean":case"number":case"string":case"undefined":return s;case"object":return s;default:return""}}function V0(s){var a=s.type;return(s=s.nodeName)&&s.toLowerCase()==="input"&&(a==="checkbox"||a==="radio")}function eO(s,a,u){var h=Object.getOwnPropertyDescriptor(s.constructor.prototype,a);if(!s.hasOwnProperty(a)&&typeof h<"u"&&typeof h.get=="function"&&typeof h.set=="function"){var g=h.get,v=h.set;return Object.defineProperty(s,a,{configurable:!0,get:function(){return g.call(this)},set:function(_){u=""+_,v.call(this,_)}}),Object.defineProperty(s,a,{enumerable:h.enumerable}),{getValue:function(){return u},setValue:function(_){u=""+_},stopTracking:function(){s._valueTracker=null,delete s[a]}}}}function sh(s){if(!s._valueTracker){var a=V0(s)?"checked":"value";s._valueTracker=eO(s,a,""+s[a])}}function K0(s){if(!s)return!1;var a=s._valueTracker;if(!a)return!0;var u=a.getValue(),h="";return s&&(h=V0(s)?s.checked?"true":"false":s.value),s=h,s!==u?(a.setValue(s),!0):!1}function Lu(s){if(s=s||(typeof document<"u"?document:void 0),typeof s>"u")return null;try{return s.activeElement||s.body}catch{return s.body}}var tO=/[\n"\\]/g;function Gn(s){return s.replace(tO,function(a){return"\\"+a.charCodeAt(0).toString(16)+" "})}function oh(s,a,u,h,g,v,_,x){s.name="",_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"?s.type=_:s.removeAttribute("type"),a!=null?_==="number"?(a===0&&s.value===""||s.value!=a)&&(s.value=""+Kn(a)):s.value!==""+Kn(a)&&(s.value=""+Kn(a)):_!=="submit"&&_!=="reset"||s.removeAttribute("value"),a!=null?ah(s,_,Kn(a)):u!=null?ah(s,_,Kn(u)):h!=null&&s.removeAttribute("value"),g==null&&v!=null&&(s.defaultChecked=!!v),g!=null&&(s.checked=g&&typeof g!="function"&&typeof g!="symbol"),x!=null&&typeof x!="function"&&typeof x!="symbol"&&typeof x!="boolean"?s.name=""+Kn(x):s.removeAttribute("name")}function G0(s,a,u,h,g,v,_,x){if(v!=null&&typeof v!="function"&&typeof v!="symbol"&&typeof v!="boolean"&&(s.type=v),a!=null||u!=null){if(!(v!=="submit"&&v!=="reset"||a!=null)){sh(s);return}u=u!=null?""+Kn(u):"",a=a!=null?""+Kn(a):u,x||a===s.value||(s.value=a),s.defaultValue=a}h=h??g,h=typeof h!="function"&&typeof h!="symbol"&&!!h,s.checked=x?s.checked:!!h,s.defaultChecked=!!h,_!=null&&typeof _!="function"&&typeof _!="symbol"&&typeof _!="boolean"&&(s.name=_),sh(s)}function ah(s,a,u){a==="number"&&Lu(s.ownerDocument)===s||s.defaultValue===""+u||(s.defaultValue=""+u)}function uo(s,a,u,h){if(s=s.options,a){a={};for(var g=0;g<u.length;g++)a["$"+u[g]]=!0;for(u=0;u<s.length;u++)g=a.hasOwnProperty("$"+s[u].value),s[u].selected!==g&&(s[u].selected=g),g&&h&&(s[u].defaultSelected=!0)}else{for(u=""+Kn(u),a=null,g=0;g<s.length;g++){if(s[g].value===u){s[g].selected=!0,h&&(s[g].defaultSelected=!0);return}a!==null||s[g].disabled||(a=s[g])}a!==null&&(a.selected=!0)}}function Y0(s,a,u){if(a!=null&&(a=""+Kn(a),a!==s.value&&(s.value=a),u==null)){s.defaultValue!==a&&(s.defaultValue=a);return}s.defaultValue=u!=null?""+Kn(u):""}function Q0(s,a,u,h){if(a==null){if(h!=null){if(u!=null)throw Error(r(92));if(fe(h)){if(1<h.length)throw Error(r(93));h=h[0]}u=h}u==null&&(u=""),a=u}u=Kn(a),s.defaultValue=u,h=s.textContent,h===u&&h!==""&&h!==null&&(s.value=h),sh(s)}function co(s,a){if(a){var u=s.firstChild;if(u&&u===s.lastChild&&u.nodeType===3){u.nodeValue=a;return}}s.textContent=a}var nO=new Set("animationIterationCount aspectRatio borderImageOutset borderImageSlice borderImageWidth boxFlex boxFlexGroup boxOrdinalGroup columnCount columns flex flexGrow flexPositive flexShrink flexNegative flexOrder gridArea gridRow gridRowEnd gridRowSpan gridRowStart gridColumn gridColumnEnd gridColumnSpan gridColumnStart fontWeight lineClamp lineHeight opacity order orphans scale tabSize widows zIndex zoom fillOpacity floodOpacity stopOpacity strokeDasharray strokeDashoffset strokeMiterlimit strokeOpacity strokeWidth MozAnimationIterationCount MozBoxFlex MozBoxFlexGroup MozLineClamp msAnimationIterationCount msFlex msZoom msFlexGrow msFlexNegative msFlexOrder msFlexPositive msFlexShrink msGridColumn msGridColumnSpan msGridRow msGridRowSpan WebkitAnimationIterationCount WebkitBoxFlex WebKitBoxFlexGroup WebkitBoxOrdinalGroup WebkitColumnCount WebkitColumns WebkitFlex WebkitFlexGrow WebkitFlexPositive WebkitFlexShrink WebkitLineClamp".split(" "));function X0(s,a,u){var h=a.indexOf("--")===0;u==null||typeof u=="boolean"||u===""?h?s.setProperty(a,""):a==="float"?s.cssFloat="":s[a]="":h?s.setProperty(a,u):typeof u!="number"||u===0||nO.has(a)?a==="float"?s.cssFloat=u:s[a]=(""+u).trim():s[a]=u+"px"}function J0(s,a,u){if(a!=null&&typeof a!="object")throw Error(r(62));if(s=s.style,u!=null){for(var h in u)!u.hasOwnProperty(h)||a!=null&&a.hasOwnProperty(h)||(h.indexOf("--")===0?s.setProperty(h,""):h==="float"?s.cssFloat="":s[h]="");for(var g in a)h=a[g],a.hasOwnProperty(g)&&u[g]!==h&&X0(s,g,h)}else for(var v in a)a.hasOwnProperty(v)&&X0(s,v,a[v])}function lh(s){if(s.indexOf("-")===-1)return!1;switch(s){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var rO=new Map([["acceptCharset","accept-charset"],["htmlFor","for"],["httpEquiv","http-equiv"],["crossOrigin","crossorigin"],["accentHeight","accent-height"],["alignmentBaseline","alignment-baseline"],["arabicForm","arabic-form"],["baselineShift","baseline-shift"],["capHeight","cap-height"],["clipPath","clip-path"],["clipRule","clip-rule"],["colorInterpolation","color-interpolation"],["colorInterpolationFilters","color-interpolation-filters"],["colorProfile","color-profile"],["colorRendering","color-rendering"],["dominantBaseline","dominant-baseline"],["enableBackground","enable-background"],["fillOpacity","fill-opacity"],["fillRule","fill-rule"],["floodColor","flood-color"],["floodOpacity","flood-opacity"],["fontFamily","font-family"],["fontSize","font-size"],["fontSizeAdjust","font-size-adjust"],["fontStretch","font-stretch"],["fontStyle","font-style"],["fontVariant","font-variant"],["fontWeight","font-weight"],["glyphName","glyph-name"],["glyphOrientationHorizontal","glyph-orientation-horizontal"],["glyphOrientationVertical","glyph-orientation-vertical"],["horizAdvX","horiz-adv-x"],["horizOriginX","horiz-origin-x"],["imageRendering","image-rendering"],["letterSpacing","letter-spacing"],["lightingColor","lighting-color"],["markerEnd","marker-end"],["markerMid","marker-mid"],["markerStart","marker-start"],["overlinePosition","overline-position"],["overlineThickness","overline-thickness"],["paintOrder","paint-order"],["panose-1","panose-1"],["pointerEvents","pointer-events"],["renderingIntent","rendering-intent"],["shapeRendering","shape-rendering"],["stopColor","stop-color"],["stopOpacity","stop-opacity"],["strikethroughPosition","strikethrough-position"],["strikethroughThickness","strikethrough-thickness"],["strokeDasharray","stroke-dasharray"],["strokeDashoffset","stroke-dashoffset"],["strokeLinecap","stroke-linecap"],["strokeLinejoin","stroke-linejoin"],["strokeMiterlimit","stroke-miterlimit"],["strokeOpacity","stroke-opacity"],["strokeWidth","stroke-width"],["textAnchor","text-anchor"],["textDecoration","text-decoration"],["textRendering","text-rendering"],["transformOrigin","transform-origin"],["underlinePosition","underline-position"],["underlineThickness","underline-thickness"],["unicodeBidi","unicode-bidi"],["unicodeRange","unicode-range"],["unitsPerEm","units-per-em"],["vAlphabetic","v-alphabetic"],["vHanging","v-hanging"],["vIdeographic","v-ideographic"],["vMathematical","v-mathematical"],["vectorEffect","vector-effect"],["vertAdvY","vert-adv-y"],["vertOriginX","vert-origin-x"],["vertOriginY","vert-origin-y"],["wordSpacing","word-spacing"],["writingMode","writing-mode"],["xmlnsXlink","xmlns:xlink"],["xHeight","x-height"]]),iO=/^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*:/i;function ju(s){return iO.test(""+s)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":s}function Br(){}var uh=null;function ch(s){return s=s.target||s.srcElement||window,s.correspondingUseElement&&(s=s.correspondingUseElement),s.nodeType===3?s.parentNode:s}var fo=null,ho=null;function W0(s){var a=oo(s);if(a&&(s=a.stateNode)){var u=s[Tn]||null;e:switch(s=a.stateNode,a.type){case"input":if(oh(s,u.value,u.defaultValue,u.defaultValue,u.checked,u.defaultChecked,u.type,u.name),a=u.name,u.type==="radio"&&a!=null){for(u=s;u.parentNode;)u=u.parentNode;for(u=u.querySelectorAll('input[name="'+Gn(""+a)+'"][type="radio"]'),a=0;a<u.length;a++){var h=u[a];if(h!==s&&h.form===s.form){var g=h[Tn]||null;if(!g)throw Error(r(90));oh(h,g.value,g.defaultValue,g.defaultValue,g.checked,g.defaultChecked,g.type,g.name)}}for(a=0;a<u.length;a++)h=u[a],h.form===s.form&&K0(h)}break e;case"textarea":Y0(s,u.value,u.defaultValue);break e;case"select":a=u.value,a!=null&&uo(s,!!u.multiple,a,!1)}}}var dh=!1;function Z0(s,a,u){if(dh)return s(a,u);dh=!0;try{var h=s(a);return h}finally{if(dh=!1,(fo!==null||ho!==null)&&(Tc(),fo&&(a=fo,s=ho,ho=fo=null,W0(a),s)))for(a=0;a<s.length;a++)W0(s[a])}}function Oa(s,a){var u=s.stateNode;if(u===null)return null;var h=u[Tn]||null;if(h===null)return null;u=h[a];e:switch(a){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(h=!h.disabled)||(s=s.type,h=!(s==="button"||s==="input"||s==="select"||s==="textarea")),s=!h;break e;default:s=!1}if(s)return null;if(u&&typeof u!="function")throw Error(r(231,a,typeof u));return u}var zr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),fh=!1;if(zr)try{var Na={};Object.defineProperty(Na,"passive",{get:function(){fh=!0}}),window.addEventListener("test",Na,Na),window.removeEventListener("test",Na,Na)}catch{fh=!1}var bi=null,hh=null,Bu=null;function eb(){if(Bu)return Bu;var s,a=hh,u=a.length,h,g="value"in bi?bi.value:bi.textContent,v=g.length;for(s=0;s<u&&a[s]===g[s];s++);var _=u-s;for(h=1;h<=_&&a[u-h]===g[v-h];h++);return Bu=g.slice(s,1<h?1-h:void 0)}function zu(s){var a=s.keyCode;return"charCode"in s?(s=s.charCode,s===0&&a===13&&(s=13)):s=a,s===10&&(s=13),32<=s||s===13?s:0}function Pu(){return!0}function tb(){return!1}function En(s){function a(u,h,g,v,_){this._reactName=u,this._targetInst=g,this.type=h,this.nativeEvent=v,this.target=_,this.currentTarget=null;for(var x in s)s.hasOwnProperty(x)&&(u=s[x],this[x]=u?u(v):v[x]);return this.isDefaultPrevented=(v.defaultPrevented!=null?v.defaultPrevented:v.returnValue===!1)?Pu:tb,this.isPropagationStopped=tb,this}return m(a.prototype,{preventDefault:function(){this.defaultPrevented=!0;var u=this.nativeEvent;u&&(u.preventDefault?u.preventDefault():typeof u.returnValue!="unknown"&&(u.returnValue=!1),this.isDefaultPrevented=Pu)},stopPropagation:function(){var u=this.nativeEvent;u&&(u.stopPropagation?u.stopPropagation():typeof u.cancelBubble!="unknown"&&(u.cancelBubble=!0),this.isPropagationStopped=Pu)},persist:function(){},isPersistent:Pu}),a}var hs={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(s){return s.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Uu=En(hs),Ra=m({},hs,{view:0,detail:0}),sO=En(Ra),ph,mh,Da,qu=m({},Ra,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gh,button:0,buttons:0,relatedTarget:function(s){return s.relatedTarget===void 0?s.fromElement===s.srcElement?s.toElement:s.fromElement:s.relatedTarget},movementX:function(s){return"movementX"in s?s.movementX:(s!==Da&&(Da&&s.type==="mousemove"?(ph=s.screenX-Da.screenX,mh=s.screenY-Da.screenY):mh=ph=0,Da=s),ph)},movementY:function(s){return"movementY"in s?s.movementY:mh}}),nb=En(qu),oO=m({},qu,{dataTransfer:0}),aO=En(oO),lO=m({},Ra,{relatedTarget:0}),yh=En(lO),uO=m({},hs,{animationName:0,elapsedTime:0,pseudoElement:0}),cO=En(uO),dO=m({},hs,{clipboardData:function(s){return"clipboardData"in s?s.clipboardData:window.clipboardData}}),fO=En(dO),hO=m({},hs,{data:0}),rb=En(hO),pO={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},mO={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},yO={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function gO(s){var a=this.nativeEvent;return a.getModifierState?a.getModifierState(s):(s=yO[s])?!!a[s]:!1}function gh(){return gO}var bO=m({},Ra,{key:function(s){if(s.key){var a=pO[s.key]||s.key;if(a!=="Unidentified")return a}return s.type==="keypress"?(s=zu(s),s===13?"Enter":String.fromCharCode(s)):s.type==="keydown"||s.type==="keyup"?mO[s.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gh,charCode:function(s){return s.type==="keypress"?zu(s):0},keyCode:function(s){return s.type==="keydown"||s.type==="keyup"?s.keyCode:0},which:function(s){return s.type==="keypress"?zu(s):s.type==="keydown"||s.type==="keyup"?s.keyCode:0}}),vO=En(bO),SO=m({},qu,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),ib=En(SO),wO=m({},Ra,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gh}),_O=En(wO),TO=m({},hs,{propertyName:0,elapsedTime:0,pseudoElement:0}),EO=En(TO),MO=m({},qu,{deltaX:function(s){return"deltaX"in s?s.deltaX:"wheelDeltaX"in s?-s.wheelDeltaX:0},deltaY:function(s){return"deltaY"in s?s.deltaY:"wheelDeltaY"in s?-s.wheelDeltaY:"wheelDelta"in s?-s.wheelDelta:0},deltaZ:0,deltaMode:0}),xO=En(MO),CO=m({},hs,{newState:0,oldState:0}),kO=En(CO),AO=[9,13,27,32],bh=zr&&"CompositionEvent"in window,Ia=null;zr&&"documentMode"in document&&(Ia=document.documentMode);var OO=zr&&"TextEvent"in window&&!Ia,sb=zr&&(!bh||Ia&&8<Ia&&11>=Ia),ob=" ",ab=!1;function lb(s,a){switch(s){case"keyup":return AO.indexOf(a.keyCode)!==-1;case"keydown":return a.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function ub(s){return s=s.detail,typeof s=="object"&&"data"in s?s.data:null}var po=!1;function NO(s,a){switch(s){case"compositionend":return ub(a);case"keypress":return a.which!==32?null:(ab=!0,ob);case"textInput":return s=a.data,s===ob&&ab?null:s;default:return null}}function RO(s,a){if(po)return s==="compositionend"||!bh&&lb(s,a)?(s=eb(),Bu=hh=bi=null,po=!1,s):null;switch(s){case"paste":return null;case"keypress":if(!(a.ctrlKey||a.altKey||a.metaKey)||a.ctrlKey&&a.altKey){if(a.char&&1<a.char.length)return a.char;if(a.which)return String.fromCharCode(a.which)}return null;case"compositionend":return sb&&a.locale!=="ko"?null:a.data;default:return null}}var DO={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function cb(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a==="input"?!!DO[s.type]:a==="textarea"}function db(s,a,u,h){fo?ho?ho.push(h):ho=[h]:fo=h,a=Oc(a,"onChange"),0<a.length&&(u=new Uu("onChange","change",null,u,h),s.push({event:u,listeners:a}))}var La=null,ja=null;function IO(s){G1(s,0)}function $u(s){var a=Aa(s);if(K0(a))return s}function fb(s,a){if(s==="change")return a}var hb=!1;if(zr){var vh;if(zr){var Sh="oninput"in document;if(!Sh){var pb=document.createElement("div");pb.setAttribute("oninput","return;"),Sh=typeof pb.oninput=="function"}vh=Sh}else vh=!1;hb=vh&&(!document.documentMode||9<document.documentMode)}function mb(){La&&(La.detachEvent("onpropertychange",yb),ja=La=null)}function yb(s){if(s.propertyName==="value"&&$u(ja)){var a=[];db(a,ja,s,ch(s)),Z0(IO,a)}}function LO(s,a,u){s==="focusin"?(mb(),La=a,ja=u,La.attachEvent("onpropertychange",yb)):s==="focusout"&&mb()}function jO(s){if(s==="selectionchange"||s==="keyup"||s==="keydown")return $u(ja)}function BO(s,a){if(s==="click")return $u(a)}function zO(s,a){if(s==="input"||s==="change")return $u(a)}function PO(s,a){return s===a&&(s!==0||1/s===1/a)||s!==s&&a!==a}var jn=typeof Object.is=="function"?Object.is:PO;function Ba(s,a){if(jn(s,a))return!0;if(typeof s!="object"||s===null||typeof a!="object"||a===null)return!1;var u=Object.keys(s),h=Object.keys(a);if(u.length!==h.length)return!1;for(h=0;h<u.length;h++){var g=u[h];if(!st.call(a,g)||!jn(s[g],a[g]))return!1}return!0}function gb(s){for(;s&&s.firstChild;)s=s.firstChild;return s}function bb(s,a){var u=gb(s);s=0;for(var h;u;){if(u.nodeType===3){if(h=s+u.textContent.length,s<=a&&h>=a)return{node:u,offset:a-s};s=h}e:{for(;u;){if(u.nextSibling){u=u.nextSibling;break e}u=u.parentNode}u=void 0}u=gb(u)}}function vb(s,a){return s&&a?s===a?!0:s&&s.nodeType===3?!1:a&&a.nodeType===3?vb(s,a.parentNode):"contains"in s?s.contains(a):s.compareDocumentPosition?!!(s.compareDocumentPosition(a)&16):!1:!1}function Sb(s){s=s!=null&&s.ownerDocument!=null&&s.ownerDocument.defaultView!=null?s.ownerDocument.defaultView:window;for(var a=Lu(s.document);a instanceof s.HTMLIFrameElement;){try{var u=typeof a.contentWindow.location.href=="string"}catch{u=!1}if(u)s=a.contentWindow;else break;a=Lu(s.document)}return a}function wh(s){var a=s&&s.nodeName&&s.nodeName.toLowerCase();return a&&(a==="input"&&(s.type==="text"||s.type==="search"||s.type==="tel"||s.type==="url"||s.type==="password")||a==="textarea"||s.contentEditable==="true")}var UO=zr&&"documentMode"in document&&11>=document.documentMode,mo=null,_h=null,za=null,Th=!1;function wb(s,a,u){var h=u.window===u?u.document:u.nodeType===9?u:u.ownerDocument;Th||mo==null||mo!==Lu(h)||(h=mo,"selectionStart"in h&&wh(h)?h={start:h.selectionStart,end:h.selectionEnd}:(h=(h.ownerDocument&&h.ownerDocument.defaultView||window).getSelection(),h={anchorNode:h.anchorNode,anchorOffset:h.anchorOffset,focusNode:h.focusNode,focusOffset:h.focusOffset}),za&&Ba(za,h)||(za=h,h=Oc(_h,"onSelect"),0<h.length&&(a=new Uu("onSelect","select",null,a,u),s.push({event:a,listeners:h}),a.target=mo)))}function ps(s,a){var u={};return u[s.toLowerCase()]=a.toLowerCase(),u["Webkit"+s]="webkit"+a,u["Moz"+s]="moz"+a,u}var yo={animationend:ps("Animation","AnimationEnd"),animationiteration:ps("Animation","AnimationIteration"),animationstart:ps("Animation","AnimationStart"),transitionrun:ps("Transition","TransitionRun"),transitionstart:ps("Transition","TransitionStart"),transitioncancel:ps("Transition","TransitionCancel"),transitionend:ps("Transition","TransitionEnd")},Eh={},_b={};zr&&(_b=document.createElement("div").style,"AnimationEvent"in window||(delete yo.animationend.animation,delete yo.animationiteration.animation,delete yo.animationstart.animation),"TransitionEvent"in window||delete yo.transitionend.transition);function ms(s){if(Eh[s])return Eh[s];if(!yo[s])return s;var a=yo[s],u;for(u in a)if(a.hasOwnProperty(u)&&u in _b)return Eh[s]=a[u];return s}var Tb=ms("animationend"),Eb=ms("animationiteration"),Mb=ms("animationstart"),qO=ms("transitionrun"),$O=ms("transitionstart"),FO=ms("transitioncancel"),xb=ms("transitionend"),Cb=new Map,Mh="abort auxClick beforeToggle cancel canPlay canPlayThrough click close contextMenu copy cut drag dragEnd dragEnter dragExit dragLeave dragOver dragStart drop durationChange emptied encrypted ended error gotPointerCapture input invalid keyDown keyPress keyUp load loadedData loadedMetadata loadStart lostPointerCapture mouseDown mouseMove mouseOut mouseOver mouseUp paste pause play playing pointerCancel pointerDown pointerMove pointerOut pointerOver pointerUp progress rateChange reset resize seeked seeking stalled submit suspend timeUpdate touchCancel touchEnd touchStart volumeChange scroll toggle touchMove waiting wheel".split(" ");Mh.push("scrollEnd");function pr(s,a){Cb.set(s,a),fs(a,[s])}var Fu=typeof reportError=="function"?reportError:function(s){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var a=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof s=="object"&&s!==null&&typeof s.message=="string"?String(s.message):String(s),error:s});if(!window.dispatchEvent(a))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",s);return}console.error(s)},Yn=[],go=0,xh=0;function Hu(){for(var s=go,a=xh=go=0;a<s;){var u=Yn[a];Yn[a++]=null;var h=Yn[a];Yn[a++]=null;var g=Yn[a];Yn[a++]=null;var v=Yn[a];if(Yn[a++]=null,h!==null&&g!==null){var _=h.pending;_===null?g.next=g:(g.next=_.next,_.next=g),h.pending=g}v!==0&&kb(u,g,v)}}function Vu(s,a,u,h){Yn[go++]=s,Yn[go++]=a,Yn[go++]=u,Yn[go++]=h,xh|=h,s.lanes|=h,s=s.alternate,s!==null&&(s.lanes|=h)}function Ch(s,a,u,h){return Vu(s,a,u,h),Ku(s)}function ys(s,a){return Vu(s,null,null,a),Ku(s)}function kb(s,a,u){s.lanes|=u;var h=s.alternate;h!==null&&(h.lanes|=u);for(var g=!1,v=s.return;v!==null;)v.childLanes|=u,h=v.alternate,h!==null&&(h.childLanes|=u),v.tag===22&&(s=v.stateNode,s===null||s._visibility&1||(g=!0)),s=v,v=v.return;return s.tag===3?(v=s.stateNode,g&&a!==null&&(g=31-Ke(u),s=v.hiddenUpdates,h=s[g],h===null?s[g]=[a]:h.push(a),a.lane=u|536870912),v):null}function Ku(s){if(50<ol)throw ol=0,jp=null,Error(r(185));for(var a=s.return;a!==null;)s=a,a=s.return;return s.tag===3?s.stateNode:null}var bo={};function HO(s,a,u,h){this.tag=s,this.key=u,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=a,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=h,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Bn(s,a,u,h){return new HO(s,a,u,h)}function kh(s){return s=s.prototype,!(!s||!s.isReactComponent)}function Pr(s,a){var u=s.alternate;return u===null?(u=Bn(s.tag,a,s.key,s.mode),u.elementType=s.elementType,u.type=s.type,u.stateNode=s.stateNode,u.alternate=s,s.alternate=u):(u.pendingProps=a,u.type=s.type,u.flags=0,u.subtreeFlags=0,u.deletions=null),u.flags=s.flags&65011712,u.childLanes=s.childLanes,u.lanes=s.lanes,u.child=s.child,u.memoizedProps=s.memoizedProps,u.memoizedState=s.memoizedState,u.updateQueue=s.updateQueue,a=s.dependencies,u.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext},u.sibling=s.sibling,u.index=s.index,u.ref=s.ref,u.refCleanup=s.refCleanup,u}function Ab(s,a){s.flags&=65011714;var u=s.alternate;return u===null?(s.childLanes=0,s.lanes=a,s.child=null,s.subtreeFlags=0,s.memoizedProps=null,s.memoizedState=null,s.updateQueue=null,s.dependencies=null,s.stateNode=null):(s.childLanes=u.childLanes,s.lanes=u.lanes,s.child=u.child,s.subtreeFlags=0,s.deletions=null,s.memoizedProps=u.memoizedProps,s.memoizedState=u.memoizedState,s.updateQueue=u.updateQueue,s.type=u.type,a=u.dependencies,s.dependencies=a===null?null:{lanes:a.lanes,firstContext:a.firstContext}),s}function Gu(s,a,u,h,g,v){var _=0;if(h=s,typeof s=="function")kh(s)&&(_=1);else if(typeof s=="string")_=QN(s,u,le.current)?26:s==="html"||s==="head"||s==="body"?27:5;else e:switch(s){case H:return s=Bn(31,u,a,g),s.elementType=H,s.lanes=v,s;case w:return gs(u.children,g,v,a);case T:_=8,g|=24;break;case M:return s=Bn(12,u,a,g|2),s.elementType=M,s.lanes=v,s;case O:return s=Bn(13,u,a,g),s.elementType=O,s.lanes=v,s;case P:return s=Bn(19,u,a,g),s.elementType=P,s.lanes=v,s;default:if(typeof s=="object"&&s!==null)switch(s.$$typeof){case j:_=10;break e;case k:_=9;break e;case I:_=11;break e;case A:_=14;break e;case U:_=16,h=null;break e}_=29,u=Error(r(130,s===null?"null":typeof s,"")),h=null}return a=Bn(_,u,a,g),a.elementType=s,a.type=h,a.lanes=v,a}function gs(s,a,u,h){return s=Bn(7,s,h,a),s.lanes=u,s}function Ah(s,a,u){return s=Bn(6,s,null,a),s.lanes=u,s}function Ob(s){var a=Bn(18,null,null,0);return a.stateNode=s,a}function Oh(s,a,u){return a=Bn(4,s.children!==null?s.children:[],s.key,a),a.lanes=u,a.stateNode={containerInfo:s.containerInfo,pendingChildren:null,implementation:s.implementation},a}var Nb=new WeakMap;function Qn(s,a){if(typeof s=="object"&&s!==null){var u=Nb.get(s);return u!==void 0?u:(a={value:s,source:a,stack:ft(a)},Nb.set(s,a),a)}return{value:s,source:a,stack:ft(a)}}var vo=[],So=0,Yu=null,Pa=0,Xn=[],Jn=0,vi=null,Er=1,Mr="";function Ur(s,a){vo[So++]=Pa,vo[So++]=Yu,Yu=s,Pa=a}function Rb(s,a,u){Xn[Jn++]=Er,Xn[Jn++]=Mr,Xn[Jn++]=vi,vi=s;var h=Er;s=Mr;var g=32-Ke(h)-1;h&=~(1<<g),u+=1;var v=32-Ke(a)+g;if(30<v){var _=g-g%5;v=(h&(1<<_)-1).toString(32),h>>=_,g-=_,Er=1<<32-Ke(a)+g|u<<g|h,Mr=v+s}else Er=1<<v|u<<g|h,Mr=s}function Nh(s){s.return!==null&&(Ur(s,1),Rb(s,1,0))}function Rh(s){for(;s===Yu;)Yu=vo[--So],vo[So]=null,Pa=vo[--So],vo[So]=null;for(;s===vi;)vi=Xn[--Jn],Xn[Jn]=null,Mr=Xn[--Jn],Xn[Jn]=null,Er=Xn[--Jn],Xn[Jn]=null}function Db(s,a){Xn[Jn++]=Er,Xn[Jn++]=Mr,Xn[Jn++]=vi,Er=a.id,Mr=a.overflow,vi=s}var rn=null,Et=null,We=!1,Si=null,Wn=!1,Dh=Error(r(519));function wi(s){var a=Error(r(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Ua(Qn(a,s)),Dh}function Ib(s){var a=s.stateNode,u=s.type,h=s.memoizedProps;switch(a[nn]=s,a[Tn]=h,u){case"dialog":Ye("cancel",a),Ye("close",a);break;case"iframe":case"object":case"embed":Ye("load",a);break;case"video":case"audio":for(u=0;u<ll.length;u++)Ye(ll[u],a);break;case"source":Ye("error",a);break;case"img":case"image":case"link":Ye("error",a),Ye("load",a);break;case"details":Ye("toggle",a);break;case"input":Ye("invalid",a),G0(a,h.value,h.defaultValue,h.checked,h.defaultChecked,h.type,h.name,!0);break;case"select":Ye("invalid",a);break;case"textarea":Ye("invalid",a),Q0(a,h.value,h.defaultValue,h.children)}u=h.children,typeof u!="string"&&typeof u!="number"&&typeof u!="bigint"||a.textContent===""+u||h.suppressHydrationWarning===!0||J1(a.textContent,u)?(h.popover!=null&&(Ye("beforetoggle",a),Ye("toggle",a)),h.onScroll!=null&&Ye("scroll",a),h.onScrollEnd!=null&&Ye("scrollend",a),h.onClick!=null&&(a.onclick=Br),a=!0):a=!1,a||wi(s,!0)}function Lb(s){for(rn=s.return;rn;)switch(rn.tag){case 5:case 31:case 13:Wn=!1;return;case 27:case 3:Wn=!0;return;default:rn=rn.return}}function wo(s){if(s!==rn)return!1;if(!We)return Lb(s),We=!0,!1;var a=s.tag,u;if((u=a!==3&&a!==27)&&((u=a===5)&&(u=s.type,u=!(u!=="form"&&u!=="button")||Jp(s.type,s.memoizedProps)),u=!u),u&&Et&&wi(s),Lb(s),a===13){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Et=oS(s)}else if(a===31){if(s=s.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(317));Et=oS(s)}else a===27?(a=Et,Li(s.type)?(s=nm,nm=null,Et=s):Et=a):Et=rn?er(s.stateNode.nextSibling):null;return!0}function bs(){Et=rn=null,We=!1}function Ih(){var s=Si;return s!==null&&(kn===null?kn=s:kn.push.apply(kn,s),Si=null),s}function Ua(s){Si===null?Si=[s]:Si.push(s)}var Lh=N(null),vs=null,qr=null;function _i(s,a,u){ce(Lh,a._currentValue),a._currentValue=u}function $r(s){s._currentValue=Lh.current,Q(Lh)}function jh(s,a,u){for(;s!==null;){var h=s.alternate;if((s.childLanes&a)!==a?(s.childLanes|=a,h!==null&&(h.childLanes|=a)):h!==null&&(h.childLanes&a)!==a&&(h.childLanes|=a),s===u)break;s=s.return}}function Bh(s,a,u,h){var g=s.child;for(g!==null&&(g.return=s);g!==null;){var v=g.dependencies;if(v!==null){var _=g.child;v=v.firstContext;e:for(;v!==null;){var x=v;v=g;for(var D=0;D<a.length;D++)if(x.context===a[D]){v.lanes|=u,x=v.alternate,x!==null&&(x.lanes|=u),jh(v.return,u,s),h||(_=null);break e}v=x.next}}else if(g.tag===18){if(_=g.return,_===null)throw Error(r(341));_.lanes|=u,v=_.alternate,v!==null&&(v.lanes|=u),jh(_,u,s),_=null}else _=g.child;if(_!==null)_.return=g;else for(_=g;_!==null;){if(_===s){_=null;break}if(g=_.sibling,g!==null){g.return=_.return,_=g;break}_=_.return}g=_}}function _o(s,a,u,h){s=null;for(var g=a,v=!1;g!==null;){if(!v){if((g.flags&524288)!==0)v=!0;else if((g.flags&262144)!==0)break}if(g.tag===10){var _=g.alternate;if(_===null)throw Error(r(387));if(_=_.memoizedProps,_!==null){var x=g.type;jn(g.pendingProps.value,_.value)||(s!==null?s.push(x):s=[x])}}else if(g===je.current){if(_=g.alternate,_===null)throw Error(r(387));_.memoizedState.memoizedState!==g.memoizedState.memoizedState&&(s!==null?s.push(hl):s=[hl])}g=g.return}s!==null&&Bh(a,s,u,h),a.flags|=262144}function Qu(s){for(s=s.firstContext;s!==null;){if(!jn(s.context._currentValue,s.memoizedValue))return!0;s=s.next}return!1}function Ss(s){vs=s,qr=null,s=s.dependencies,s!==null&&(s.firstContext=null)}function sn(s){return jb(vs,s)}function Xu(s,a){return vs===null&&Ss(s),jb(s,a)}function jb(s,a){var u=a._currentValue;if(a={context:a,memoizedValue:u,next:null},qr===null){if(s===null)throw Error(r(308));qr=a,s.dependencies={lanes:0,firstContext:a},s.flags|=524288}else qr=qr.next=a;return u}var VO=typeof AbortController<"u"?AbortController:function(){var s=[],a=this.signal={aborted:!1,addEventListener:function(u,h){s.push(h)}};this.abort=function(){a.aborted=!0,s.forEach(function(u){return u()})}},KO=t.unstable_scheduleCallback,GO=t.unstable_NormalPriority,Ut={$$typeof:j,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function zh(){return{controller:new VO,data:new Map,refCount:0}}function qa(s){s.refCount--,s.refCount===0&&KO(GO,function(){s.controller.abort()})}var $a=null,Ph=0,To=0,Eo=null;function YO(s,a){if($a===null){var u=$a=[];Ph=0,To=$p(),Eo={status:"pending",value:void 0,then:function(h){u.push(h)}}}return Ph++,a.then(Bb,Bb),a}function Bb(){if(--Ph===0&&$a!==null){Eo!==null&&(Eo.status="fulfilled");var s=$a;$a=null,To=0,Eo=null;for(var a=0;a<s.length;a++)(0,s[a])()}}function QO(s,a){var u=[],h={status:"pending",value:null,reason:null,then:function(g){u.push(g)}};return s.then(function(){h.status="fulfilled",h.value=a;for(var g=0;g<u.length;g++)(0,u[g])(a)},function(g){for(h.status="rejected",h.reason=g,g=0;g<u.length;g++)(0,u[g])(void 0)}),h}var zb=R.S;R.S=function(s,a){w1=Qe(),typeof a=="object"&&a!==null&&typeof a.then=="function"&&YO(s,a),zb!==null&&zb(s,a)};var ws=N(null);function Uh(){var s=ws.current;return s!==null?s:_t.pooledCache}function Ju(s,a){a===null?ce(ws,ws.current):ce(ws,a.pool)}function Pb(){var s=Uh();return s===null?null:{parent:Ut._currentValue,pool:s}}var Mo=Error(r(460)),qh=Error(r(474)),Wu=Error(r(542)),Zu={then:function(){}};function Ub(s){return s=s.status,s==="fulfilled"||s==="rejected"}function qb(s,a,u){switch(u=s[u],u===void 0?s.push(a):u!==a&&(a.then(Br,Br),a=u),a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Fb(s),s;default:if(typeof a.status=="string")a.then(Br,Br);else{if(s=_t,s!==null&&100<s.shellSuspendCounter)throw Error(r(482));s=a,s.status="pending",s.then(function(h){if(a.status==="pending"){var g=a;g.status="fulfilled",g.value=h}},function(h){if(a.status==="pending"){var g=a;g.status="rejected",g.reason=h}})}switch(a.status){case"fulfilled":return a.value;case"rejected":throw s=a.reason,Fb(s),s}throw Ts=a,Mo}}function _s(s){try{var a=s._init;return a(s._payload)}catch(u){throw u!==null&&typeof u=="object"&&typeof u.then=="function"?(Ts=u,Mo):u}}var Ts=null;function $b(){if(Ts===null)throw Error(r(459));var s=Ts;return Ts=null,s}function Fb(s){if(s===Mo||s===Wu)throw Error(r(483))}var xo=null,Fa=0;function ec(s){var a=Fa;return Fa+=1,xo===null&&(xo=[]),qb(xo,s,a)}function Ha(s,a){a=a.props.ref,s.ref=a!==void 0?a:null}function tc(s,a){throw a.$$typeof===y?Error(r(525)):(s=Object.prototype.toString.call(a),Error(r(31,s==="[object Object]"?"object with keys {"+Object.keys(a).join(", ")+"}":s)))}function Hb(s){function a(q,B){if(s){var V=q.deletions;V===null?(q.deletions=[B],q.flags|=16):V.push(B)}}function u(q,B){if(!s)return null;for(;B!==null;)a(q,B),B=B.sibling;return null}function h(q){for(var B=new Map;q!==null;)q.key!==null?B.set(q.key,q):B.set(q.index,q),q=q.sibling;return B}function g(q,B){return q=Pr(q,B),q.index=0,q.sibling=null,q}function v(q,B,V){return q.index=V,s?(V=q.alternate,V!==null?(V=V.index,V<B?(q.flags|=67108866,B):V):(q.flags|=67108866,B)):(q.flags|=1048576,B)}function _(q){return s&&q.alternate===null&&(q.flags|=67108866),q}function x(q,B,V,ee){return B===null||B.tag!==6?(B=Ah(V,q.mode,ee),B.return=q,B):(B=g(B,V),B.return=q,B)}function D(q,B,V,ee){var Oe=V.type;return Oe===w?W(q,B,V.props.children,ee,V.key):B!==null&&(B.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===U&&_s(Oe)===B.type)?(B=g(B,V.props),Ha(B,V),B.return=q,B):(B=Gu(V.type,V.key,V.props,null,q.mode,ee),Ha(B,V),B.return=q,B)}function K(q,B,V,ee){return B===null||B.tag!==4||B.stateNode.containerInfo!==V.containerInfo||B.stateNode.implementation!==V.implementation?(B=Oh(V,q.mode,ee),B.return=q,B):(B=g(B,V.children||[]),B.return=q,B)}function W(q,B,V,ee,Oe){return B===null||B.tag!==7?(B=gs(V,q.mode,ee,Oe),B.return=q,B):(B=g(B,V),B.return=q,B)}function ne(q,B,V){if(typeof B=="string"&&B!==""||typeof B=="number"||typeof B=="bigint")return B=Ah(""+B,q.mode,V),B.return=q,B;if(typeof B=="object"&&B!==null){switch(B.$$typeof){case b:return V=Gu(B.type,B.key,B.props,null,q.mode,V),Ha(V,B),V.return=q,V;case S:return B=Oh(B,q.mode,V),B.return=q,B;case U:return B=_s(B),ne(q,B,V)}if(fe(B)||te(B))return B=gs(B,q.mode,V,null),B.return=q,B;if(typeof B.then=="function")return ne(q,ec(B),V);if(B.$$typeof===j)return ne(q,Xu(q,B),V);tc(q,B)}return null}function Y(q,B,V,ee){var Oe=B!==null?B.key:null;if(typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint")return Oe!==null?null:x(q,B,""+V,ee);if(typeof V=="object"&&V!==null){switch(V.$$typeof){case b:return V.key===Oe?D(q,B,V,ee):null;case S:return V.key===Oe?K(q,B,V,ee):null;case U:return V=_s(V),Y(q,B,V,ee)}if(fe(V)||te(V))return Oe!==null?null:W(q,B,V,ee,null);if(typeof V.then=="function")return Y(q,B,ec(V),ee);if(V.$$typeof===j)return Y(q,B,Xu(q,V),ee);tc(q,V)}return null}function X(q,B,V,ee,Oe){if(typeof ee=="string"&&ee!==""||typeof ee=="number"||typeof ee=="bigint")return q=q.get(V)||null,x(B,q,""+ee,Oe);if(typeof ee=="object"&&ee!==null){switch(ee.$$typeof){case b:return q=q.get(ee.key===null?V:ee.key)||null,D(B,q,ee,Oe);case S:return q=q.get(ee.key===null?V:ee.key)||null,K(B,q,ee,Oe);case U:return ee=_s(ee),X(q,B,V,ee,Oe)}if(fe(ee)||te(ee))return q=q.get(V)||null,W(B,q,ee,Oe,null);if(typeof ee.then=="function")return X(q,B,V,ec(ee),Oe);if(ee.$$typeof===j)return X(q,B,V,Xu(B,ee),Oe);tc(B,ee)}return null}function Te(q,B,V,ee){for(var Oe=null,ot=null,Ee=B,$e=B=0,Je=null;Ee!==null&&$e<V.length;$e++){Ee.index>$e?(Je=Ee,Ee=null):Je=Ee.sibling;var at=Y(q,Ee,V[$e],ee);if(at===null){Ee===null&&(Ee=Je);break}s&&Ee&&at.alternate===null&&a(q,Ee),B=v(at,B,$e),ot===null?Oe=at:ot.sibling=at,ot=at,Ee=Je}if($e===V.length)return u(q,Ee),We&&Ur(q,$e),Oe;if(Ee===null){for(;$e<V.length;$e++)Ee=ne(q,V[$e],ee),Ee!==null&&(B=v(Ee,B,$e),ot===null?Oe=Ee:ot.sibling=Ee,ot=Ee);return We&&Ur(q,$e),Oe}for(Ee=h(Ee);$e<V.length;$e++)Je=X(Ee,q,$e,V[$e],ee),Je!==null&&(s&&Je.alternate!==null&&Ee.delete(Je.key===null?$e:Je.key),B=v(Je,B,$e),ot===null?Oe=Je:ot.sibling=Je,ot=Je);return s&&Ee.forEach(function(Ui){return a(q,Ui)}),We&&Ur(q,$e),Oe}function Ie(q,B,V,ee){if(V==null)throw Error(r(151));for(var Oe=null,ot=null,Ee=B,$e=B=0,Je=null,at=V.next();Ee!==null&&!at.done;$e++,at=V.next()){Ee.index>$e?(Je=Ee,Ee=null):Je=Ee.sibling;var Ui=Y(q,Ee,at.value,ee);if(Ui===null){Ee===null&&(Ee=Je);break}s&&Ee&&Ui.alternate===null&&a(q,Ee),B=v(Ui,B,$e),ot===null?Oe=Ui:ot.sibling=Ui,ot=Ui,Ee=Je}if(at.done)return u(q,Ee),We&&Ur(q,$e),Oe;if(Ee===null){for(;!at.done;$e++,at=V.next())at=ne(q,at.value,ee),at!==null&&(B=v(at,B,$e),ot===null?Oe=at:ot.sibling=at,ot=at);return We&&Ur(q,$e),Oe}for(Ee=h(Ee);!at.done;$e++,at=V.next())at=X(Ee,q,$e,at.value,ee),at!==null&&(s&&at.alternate!==null&&Ee.delete(at.key===null?$e:at.key),B=v(at,B,$e),ot===null?Oe=at:ot.sibling=at,ot=at);return s&&Ee.forEach(function(oR){return a(q,oR)}),We&&Ur(q,$e),Oe}function St(q,B,V,ee){if(typeof V=="object"&&V!==null&&V.type===w&&V.key===null&&(V=V.props.children),typeof V=="object"&&V!==null){switch(V.$$typeof){case b:e:{for(var Oe=V.key;B!==null;){if(B.key===Oe){if(Oe=V.type,Oe===w){if(B.tag===7){u(q,B.sibling),ee=g(B,V.props.children),ee.return=q,q=ee;break e}}else if(B.elementType===Oe||typeof Oe=="object"&&Oe!==null&&Oe.$$typeof===U&&_s(Oe)===B.type){u(q,B.sibling),ee=g(B,V.props),Ha(ee,V),ee.return=q,q=ee;break e}u(q,B);break}else a(q,B);B=B.sibling}V.type===w?(ee=gs(V.props.children,q.mode,ee,V.key),ee.return=q,q=ee):(ee=Gu(V.type,V.key,V.props,null,q.mode,ee),Ha(ee,V),ee.return=q,q=ee)}return _(q);case S:e:{for(Oe=V.key;B!==null;){if(B.key===Oe)if(B.tag===4&&B.stateNode.containerInfo===V.containerInfo&&B.stateNode.implementation===V.implementation){u(q,B.sibling),ee=g(B,V.children||[]),ee.return=q,q=ee;break e}else{u(q,B);break}else a(q,B);B=B.sibling}ee=Oh(V,q.mode,ee),ee.return=q,q=ee}return _(q);case U:return V=_s(V),St(q,B,V,ee)}if(fe(V))return Te(q,B,V,ee);if(te(V)){if(Oe=te(V),typeof Oe!="function")throw Error(r(150));return V=Oe.call(V),Ie(q,B,V,ee)}if(typeof V.then=="function")return St(q,B,ec(V),ee);if(V.$$typeof===j)return St(q,B,Xu(q,V),ee);tc(q,V)}return typeof V=="string"&&V!==""||typeof V=="number"||typeof V=="bigint"?(V=""+V,B!==null&&B.tag===6?(u(q,B.sibling),ee=g(B,V),ee.return=q,q=ee):(u(q,B),ee=Ah(V,q.mode,ee),ee.return=q,q=ee),_(q)):u(q,B)}return function(q,B,V,ee){try{Fa=0;var Oe=St(q,B,V,ee);return xo=null,Oe}catch(Ee){if(Ee===Mo||Ee===Wu)throw Ee;var ot=Bn(29,Ee,null,q.mode);return ot.lanes=ee,ot.return=q,ot}}}var Es=Hb(!0),Vb=Hb(!1),Ti=!1;function $h(s){s.updateQueue={baseState:s.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function Fh(s,a){s=s.updateQueue,a.updateQueue===s&&(a.updateQueue={baseState:s.baseState,firstBaseUpdate:s.firstBaseUpdate,lastBaseUpdate:s.lastBaseUpdate,shared:s.shared,callbacks:null})}function Ei(s){return{lane:s,tag:0,payload:null,callback:null,next:null}}function Mi(s,a,u){var h=s.updateQueue;if(h===null)return null;if(h=h.shared,(ut&2)!==0){var g=h.pending;return g===null?a.next=a:(a.next=g.next,g.next=a),h.pending=a,a=Ku(s),kb(s,null,u),a}return Vu(s,h,a,u),Ku(s)}function Va(s,a,u){if(a=a.updateQueue,a!==null&&(a=a.shared,(u&4194048)!==0)){var h=a.lanes;h&=s.pendingLanes,u|=h,a.lanes=u,j0(s,u)}}function Hh(s,a){var u=s.updateQueue,h=s.alternate;if(h!==null&&(h=h.updateQueue,u===h)){var g=null,v=null;if(u=u.firstBaseUpdate,u!==null){do{var _={lane:u.lane,tag:u.tag,payload:u.payload,callback:null,next:null};v===null?g=v=_:v=v.next=_,u=u.next}while(u!==null);v===null?g=v=a:v=v.next=a}else g=v=a;u={baseState:h.baseState,firstBaseUpdate:g,lastBaseUpdate:v,shared:h.shared,callbacks:h.callbacks},s.updateQueue=u;return}s=u.lastBaseUpdate,s===null?u.firstBaseUpdate=a:s.next=a,u.lastBaseUpdate=a}var Vh=!1;function Ka(){if(Vh){var s=Eo;if(s!==null)throw s}}function Ga(s,a,u,h){Vh=!1;var g=s.updateQueue;Ti=!1;var v=g.firstBaseUpdate,_=g.lastBaseUpdate,x=g.shared.pending;if(x!==null){g.shared.pending=null;var D=x,K=D.next;D.next=null,_===null?v=K:_.next=K,_=D;var W=s.alternate;W!==null&&(W=W.updateQueue,x=W.lastBaseUpdate,x!==_&&(x===null?W.firstBaseUpdate=K:x.next=K,W.lastBaseUpdate=D))}if(v!==null){var ne=g.baseState;_=0,W=K=D=null,x=v;do{var Y=x.lane&-536870913,X=Y!==x.lane;if(X?(Xe&Y)===Y:(h&Y)===Y){Y!==0&&Y===To&&(Vh=!0),W!==null&&(W=W.next={lane:0,tag:x.tag,payload:x.payload,callback:null,next:null});e:{var Te=s,Ie=x;Y=a;var St=u;switch(Ie.tag){case 1:if(Te=Ie.payload,typeof Te=="function"){ne=Te.call(St,ne,Y);break e}ne=Te;break e;case 3:Te.flags=Te.flags&-65537|128;case 0:if(Te=Ie.payload,Y=typeof Te=="function"?Te.call(St,ne,Y):Te,Y==null)break e;ne=m({},ne,Y);break e;case 2:Ti=!0}}Y=x.callback,Y!==null&&(s.flags|=64,X&&(s.flags|=8192),X=g.callbacks,X===null?g.callbacks=[Y]:X.push(Y))}else X={lane:Y,tag:x.tag,payload:x.payload,callback:x.callback,next:null},W===null?(K=W=X,D=ne):W=W.next=X,_|=Y;if(x=x.next,x===null){if(x=g.shared.pending,x===null)break;X=x,x=X.next,X.next=null,g.lastBaseUpdate=X,g.shared.pending=null}}while(!0);W===null&&(D=ne),g.baseState=D,g.firstBaseUpdate=K,g.lastBaseUpdate=W,v===null&&(g.shared.lanes=0),Oi|=_,s.lanes=_,s.memoizedState=ne}}function Kb(s,a){if(typeof s!="function")throw Error(r(191,s));s.call(a)}function Gb(s,a){var u=s.callbacks;if(u!==null)for(s.callbacks=null,s=0;s<u.length;s++)Kb(u[s],a)}var Co=N(null),nc=N(0);function Yb(s,a){s=Jr,ce(nc,s),ce(Co,a),Jr=s|a.baseLanes}function Kh(){ce(nc,Jr),ce(Co,Co.current)}function Gh(){Jr=nc.current,Q(Co),Q(nc)}var zn=N(null),Zn=null;function xi(s){var a=s.alternate;ce(Bt,Bt.current&1),ce(zn,s),Zn===null&&(a===null||Co.current!==null||a.memoizedState!==null)&&(Zn=s)}function Yh(s){ce(Bt,Bt.current),ce(zn,s),Zn===null&&(Zn=s)}function Qb(s){s.tag===22?(ce(Bt,Bt.current),ce(zn,s),Zn===null&&(Zn=s)):Ci()}function Ci(){ce(Bt,Bt.current),ce(zn,zn.current)}function Pn(s){Q(zn),Zn===s&&(Zn=null),Q(Bt)}var Bt=N(0);function rc(s){for(var a=s;a!==null;){if(a.tag===13){var u=a.memoizedState;if(u!==null&&(u=u.dehydrated,u===null||em(u)||tm(u)))return a}else if(a.tag===19&&(a.memoizedProps.revealOrder==="forwards"||a.memoizedProps.revealOrder==="backwards"||a.memoizedProps.revealOrder==="unstable_legacy-backwards"||a.memoizedProps.revealOrder==="together")){if((a.flags&128)!==0)return a}else if(a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return null;a=a.return}a.sibling.return=a.return,a=a.sibling}return null}var Fr=0,qe=null,bt=null,qt=null,ic=!1,ko=!1,Ms=!1,sc=0,Ya=0,Ao=null,XO=0;function Nt(){throw Error(r(321))}function Qh(s,a){if(a===null)return!1;for(var u=0;u<a.length&&u<s.length;u++)if(!jn(s[u],a[u]))return!1;return!0}function Xh(s,a,u,h,g,v){return Fr=v,qe=a,a.memoizedState=null,a.updateQueue=null,a.lanes=0,R.H=s===null||s.memoizedState===null?Rv:dp,Ms=!1,v=u(h,g),Ms=!1,ko&&(v=Jb(a,u,h,g)),Xb(s),v}function Xb(s){R.H=Ja;var a=bt!==null&&bt.next!==null;if(Fr=0,qt=bt=qe=null,ic=!1,Ya=0,Ao=null,a)throw Error(r(300));s===null||$t||(s=s.dependencies,s!==null&&Qu(s)&&($t=!0))}function Jb(s,a,u,h){qe=s;var g=0;do{if(ko&&(Ao=null),Ya=0,ko=!1,25<=g)throw Error(r(301));if(g+=1,qt=bt=null,s.updateQueue!=null){var v=s.updateQueue;v.lastEffect=null,v.events=null,v.stores=null,v.memoCache!=null&&(v.memoCache.index=0)}R.H=Dv,v=a(u,h)}while(ko);return v}function JO(){var s=R.H,a=s.useState()[0];return a=typeof a.then=="function"?Qa(a):a,s=s.useState()[0],(bt!==null?bt.memoizedState:null)!==s&&(qe.flags|=1024),a}function Jh(){var s=sc!==0;return sc=0,s}function Wh(s,a,u){a.updateQueue=s.updateQueue,a.flags&=-2053,s.lanes&=~u}function Zh(s){if(ic){for(s=s.memoizedState;s!==null;){var a=s.queue;a!==null&&(a.pending=null),s=s.next}ic=!1}Fr=0,qt=bt=qe=null,ko=!1,Ya=sc=0,Ao=null}function vn(){var s={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return qt===null?qe.memoizedState=qt=s:qt=qt.next=s,qt}function zt(){if(bt===null){var s=qe.alternate;s=s!==null?s.memoizedState:null}else s=bt.next;var a=qt===null?qe.memoizedState:qt.next;if(a!==null)qt=a,bt=s;else{if(s===null)throw qe.alternate===null?Error(r(467)):Error(r(310));bt=s,s={memoizedState:bt.memoizedState,baseState:bt.baseState,baseQueue:bt.baseQueue,queue:bt.queue,next:null},qt===null?qe.memoizedState=qt=s:qt=qt.next=s}return qt}function oc(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Qa(s){var a=Ya;return Ya+=1,Ao===null&&(Ao=[]),s=qb(Ao,s,a),a=qe,(qt===null?a.memoizedState:qt.next)===null&&(a=a.alternate,R.H=a===null||a.memoizedState===null?Rv:dp),s}function ac(s){if(s!==null&&typeof s=="object"){if(typeof s.then=="function")return Qa(s);if(s.$$typeof===j)return sn(s)}throw Error(r(438,String(s)))}function ep(s){var a=null,u=qe.updateQueue;if(u!==null&&(a=u.memoCache),a==null){var h=qe.alternate;h!==null&&(h=h.updateQueue,h!==null&&(h=h.memoCache,h!=null&&(a={data:h.data.map(function(g){return g.slice()}),index:0})))}if(a==null&&(a={data:[],index:0}),u===null&&(u=oc(),qe.updateQueue=u),u.memoCache=a,u=a.data[a.index],u===void 0)for(u=a.data[a.index]=Array(s),h=0;h<s;h++)u[h]=se;return a.index++,u}function Hr(s,a){return typeof a=="function"?a(s):a}function lc(s){var a=zt();return tp(a,bt,s)}function tp(s,a,u){var h=s.queue;if(h===null)throw Error(r(311));h.lastRenderedReducer=u;var g=s.baseQueue,v=h.pending;if(v!==null){if(g!==null){var _=g.next;g.next=v.next,v.next=_}a.baseQueue=g=v,h.pending=null}if(v=s.baseState,g===null)s.memoizedState=v;else{a=g.next;var x=_=null,D=null,K=a,W=!1;do{var ne=K.lane&-536870913;if(ne!==K.lane?(Xe&ne)===ne:(Fr&ne)===ne){var Y=K.revertLane;if(Y===0)D!==null&&(D=D.next={lane:0,revertLane:0,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null}),ne===To&&(W=!0);else if((Fr&Y)===Y){K=K.next,Y===To&&(W=!0);continue}else ne={lane:0,revertLane:K.revertLane,gesture:null,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},D===null?(x=D=ne,_=v):D=D.next=ne,qe.lanes|=Y,Oi|=Y;ne=K.action,Ms&&u(v,ne),v=K.hasEagerState?K.eagerState:u(v,ne)}else Y={lane:ne,revertLane:K.revertLane,gesture:K.gesture,action:K.action,hasEagerState:K.hasEagerState,eagerState:K.eagerState,next:null},D===null?(x=D=Y,_=v):D=D.next=Y,qe.lanes|=ne,Oi|=ne;K=K.next}while(K!==null&&K!==a);if(D===null?_=v:D.next=x,!jn(v,s.memoizedState)&&($t=!0,W&&(u=Eo,u!==null)))throw u;s.memoizedState=v,s.baseState=_,s.baseQueue=D,h.lastRenderedState=v}return g===null&&(h.lanes=0),[s.memoizedState,h.dispatch]}function np(s){var a=zt(),u=a.queue;if(u===null)throw Error(r(311));u.lastRenderedReducer=s;var h=u.dispatch,g=u.pending,v=a.memoizedState;if(g!==null){u.pending=null;var _=g=g.next;do v=s(v,_.action),_=_.next;while(_!==g);jn(v,a.memoizedState)||($t=!0),a.memoizedState=v,a.baseQueue===null&&(a.baseState=v),u.lastRenderedState=v}return[v,h]}function Wb(s,a,u){var h=qe,g=zt(),v=We;if(v){if(u===void 0)throw Error(r(407));u=u()}else u=a();var _=!jn((bt||g).memoizedState,u);if(_&&(g.memoizedState=u,$t=!0),g=g.queue,sp(tv.bind(null,h,g,s),[s]),g.getSnapshot!==a||_||qt!==null&&qt.memoizedState.tag&1){if(h.flags|=2048,Oo(9,{destroy:void 0},ev.bind(null,h,g,u,a),null),_t===null)throw Error(r(349));v||(Fr&127)!==0||Zb(h,a,u)}return u}function Zb(s,a,u){s.flags|=16384,s={getSnapshot:a,value:u},a=qe.updateQueue,a===null?(a=oc(),qe.updateQueue=a,a.stores=[s]):(u=a.stores,u===null?a.stores=[s]:u.push(s))}function ev(s,a,u,h){a.value=u,a.getSnapshot=h,nv(a)&&rv(s)}function tv(s,a,u){return u(function(){nv(a)&&rv(s)})}function nv(s){var a=s.getSnapshot;s=s.value;try{var u=a();return!jn(s,u)}catch{return!0}}function rv(s){var a=ys(s,2);a!==null&&An(a,s,2)}function rp(s){var a=vn();if(typeof s=="function"){var u=s;if(s=u(),Ms){Gt(!0);try{u()}finally{Gt(!1)}}}return a.memoizedState=a.baseState=s,a.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:s},a}function iv(s,a,u,h){return s.baseState=u,tp(s,bt,typeof h=="function"?h:Hr)}function WO(s,a,u,h,g){if(dc(s))throw Error(r(485));if(s=a.action,s!==null){var v={payload:g,action:s,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(_){v.listeners.push(_)}};R.T!==null?u(!0):v.isTransition=!1,h(v),u=a.pending,u===null?(v.next=a.pending=v,sv(a,v)):(v.next=u.next,a.pending=u.next=v)}}function sv(s,a){var u=a.action,h=a.payload,g=s.state;if(a.isTransition){var v=R.T,_={};R.T=_;try{var x=u(g,h),D=R.S;D!==null&&D(_,x),ov(s,a,x)}catch(K){ip(s,a,K)}finally{v!==null&&_.types!==null&&(v.types=_.types),R.T=v}}else try{v=u(g,h),ov(s,a,v)}catch(K){ip(s,a,K)}}function ov(s,a,u){u!==null&&typeof u=="object"&&typeof u.then=="function"?u.then(function(h){av(s,a,h)},function(h){return ip(s,a,h)}):av(s,a,u)}function av(s,a,u){a.status="fulfilled",a.value=u,lv(a),s.state=u,a=s.pending,a!==null&&(u=a.next,u===a?s.pending=null:(u=u.next,a.next=u,sv(s,u)))}function ip(s,a,u){var h=s.pending;if(s.pending=null,h!==null){h=h.next;do a.status="rejected",a.reason=u,lv(a),a=a.next;while(a!==h)}s.action=null}function lv(s){s=s.listeners;for(var a=0;a<s.length;a++)(0,s[a])()}function uv(s,a){return a}function cv(s,a){if(We){var u=_t.formState;if(u!==null){e:{var h=qe;if(We){if(Et){t:{for(var g=Et,v=Wn;g.nodeType!==8;){if(!v){g=null;break t}if(g=er(g.nextSibling),g===null){g=null;break t}}v=g.data,g=v==="F!"||v==="F"?g:null}if(g){Et=er(g.nextSibling),h=g.data==="F!";break e}}wi(h)}h=!1}h&&(a=u[0])}}return u=vn(),u.memoizedState=u.baseState=a,h={pending:null,lanes:0,dispatch:null,lastRenderedReducer:uv,lastRenderedState:a},u.queue=h,u=Av.bind(null,qe,h),h.dispatch=u,h=rp(!1),v=cp.bind(null,qe,!1,h.queue),h=vn(),g={state:a,dispatch:null,action:s,pending:null},h.queue=g,u=WO.bind(null,qe,g,v,u),g.dispatch=u,h.memoizedState=s,[a,u,!1]}function dv(s){var a=zt();return fv(a,bt,s)}function fv(s,a,u){if(a=tp(s,a,uv)[0],s=lc(Hr)[0],typeof a=="object"&&a!==null&&typeof a.then=="function")try{var h=Qa(a)}catch(_){throw _===Mo?Wu:_}else h=a;a=zt();var g=a.queue,v=g.dispatch;return u!==a.memoizedState&&(qe.flags|=2048,Oo(9,{destroy:void 0},ZO.bind(null,g,u),null)),[h,v,s]}function ZO(s,a){s.action=a}function hv(s){var a=zt(),u=bt;if(u!==null)return fv(a,u,s);zt(),a=a.memoizedState,u=zt();var h=u.queue.dispatch;return u.memoizedState=s,[a,h,!1]}function Oo(s,a,u,h){return s={tag:s,create:u,deps:h,inst:a,next:null},a=qe.updateQueue,a===null&&(a=oc(),qe.updateQueue=a),u=a.lastEffect,u===null?a.lastEffect=s.next=s:(h=u.next,u.next=s,s.next=h,a.lastEffect=s),s}function pv(){return zt().memoizedState}function uc(s,a,u,h){var g=vn();qe.flags|=s,g.memoizedState=Oo(1|a,{destroy:void 0},u,h===void 0?null:h)}function cc(s,a,u,h){var g=zt();h=h===void 0?null:h;var v=g.memoizedState.inst;bt!==null&&h!==null&&Qh(h,bt.memoizedState.deps)?g.memoizedState=Oo(a,v,u,h):(qe.flags|=s,g.memoizedState=Oo(1|a,v,u,h))}function mv(s,a){uc(8390656,8,s,a)}function sp(s,a){cc(2048,8,s,a)}function eN(s){qe.flags|=4;var a=qe.updateQueue;if(a===null)a=oc(),qe.updateQueue=a,a.events=[s];else{var u=a.events;u===null?a.events=[s]:u.push(s)}}function yv(s){var a=zt().memoizedState;return eN({ref:a,nextImpl:s}),function(){if((ut&2)!==0)throw Error(r(440));return a.impl.apply(void 0,arguments)}}function gv(s,a){return cc(4,2,s,a)}function bv(s,a){return cc(4,4,s,a)}function vv(s,a){if(typeof a=="function"){s=s();var u=a(s);return function(){typeof u=="function"?u():a(null)}}if(a!=null)return s=s(),a.current=s,function(){a.current=null}}function Sv(s,a,u){u=u!=null?u.concat([s]):null,cc(4,4,vv.bind(null,a,s),u)}function op(){}function wv(s,a){var u=zt();a=a===void 0?null:a;var h=u.memoizedState;return a!==null&&Qh(a,h[1])?h[0]:(u.memoizedState=[s,a],s)}function _v(s,a){var u=zt();a=a===void 0?null:a;var h=u.memoizedState;if(a!==null&&Qh(a,h[1]))return h[0];if(h=s(),Ms){Gt(!0);try{s()}finally{Gt(!1)}}return u.memoizedState=[h,a],h}function ap(s,a,u){return u===void 0||(Fr&1073741824)!==0&&(Xe&261930)===0?s.memoizedState=a:(s.memoizedState=u,s=T1(),qe.lanes|=s,Oi|=s,u)}function Tv(s,a,u,h){return jn(u,a)?u:Co.current!==null?(s=ap(s,u,h),jn(s,a)||($t=!0),s):(Fr&42)===0||(Fr&1073741824)!==0&&(Xe&261930)===0?($t=!0,s.memoizedState=u):(s=T1(),qe.lanes|=s,Oi|=s,a)}function Ev(s,a,u,h,g){var v=$.p;$.p=v!==0&&8>v?v:8;var _=R.T,x={};R.T=x,cp(s,!1,a,u);try{var D=g(),K=R.S;if(K!==null&&K(x,D),D!==null&&typeof D=="object"&&typeof D.then=="function"){var W=QO(D,h);Xa(s,a,W,$n(s))}else Xa(s,a,h,$n(s))}catch(ne){Xa(s,a,{then:function(){},status:"rejected",reason:ne},$n())}finally{$.p=v,_!==null&&x.types!==null&&(_.types=x.types),R.T=_}}function tN(){}function lp(s,a,u,h){if(s.tag!==5)throw Error(r(476));var g=Mv(s).queue;Ev(s,g,a,ie,u===null?tN:function(){return xv(s),u(h)})}function Mv(s){var a=s.memoizedState;if(a!==null)return a;a={memoizedState:ie,baseState:ie,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:ie},next:null};var u={};return a.next={memoizedState:u,baseState:u,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Hr,lastRenderedState:u},next:null},s.memoizedState=a,s=s.alternate,s!==null&&(s.memoizedState=a),a}function xv(s){var a=Mv(s);a.next===null&&(a=s.alternate.memoizedState),Xa(s,a.next.queue,{},$n())}function up(){return sn(hl)}function Cv(){return zt().memoizedState}function kv(){return zt().memoizedState}function nN(s){for(var a=s.return;a!==null;){switch(a.tag){case 24:case 3:var u=$n();s=Ei(u);var h=Mi(a,s,u);h!==null&&(An(h,a,u),Va(h,a,u)),a={cache:zh()},s.payload=a;return}a=a.return}}function rN(s,a,u){var h=$n();u={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null},dc(s)?Ov(a,u):(u=Ch(s,a,u,h),u!==null&&(An(u,s,h),Nv(u,a,h)))}function Av(s,a,u){var h=$n();Xa(s,a,u,h)}function Xa(s,a,u,h){var g={lane:h,revertLane:0,gesture:null,action:u,hasEagerState:!1,eagerState:null,next:null};if(dc(s))Ov(a,g);else{var v=s.alternate;if(s.lanes===0&&(v===null||v.lanes===0)&&(v=a.lastRenderedReducer,v!==null))try{var _=a.lastRenderedState,x=v(_,u);if(g.hasEagerState=!0,g.eagerState=x,jn(x,_))return Vu(s,a,g,0),_t===null&&Hu(),!1}catch{}if(u=Ch(s,a,g,h),u!==null)return An(u,s,h),Nv(u,a,h),!0}return!1}function cp(s,a,u,h){if(h={lane:2,revertLane:$p(),gesture:null,action:h,hasEagerState:!1,eagerState:null,next:null},dc(s)){if(a)throw Error(r(479))}else a=Ch(s,u,h,2),a!==null&&An(a,s,2)}function dc(s){var a=s.alternate;return s===qe||a!==null&&a===qe}function Ov(s,a){ko=ic=!0;var u=s.pending;u===null?a.next=a:(a.next=u.next,u.next=a),s.pending=a}function Nv(s,a,u){if((u&4194048)!==0){var h=a.lanes;h&=s.pendingLanes,u|=h,a.lanes=u,j0(s,u)}}var Ja={readContext:sn,use:ac,useCallback:Nt,useContext:Nt,useEffect:Nt,useImperativeHandle:Nt,useLayoutEffect:Nt,useInsertionEffect:Nt,useMemo:Nt,useReducer:Nt,useRef:Nt,useState:Nt,useDebugValue:Nt,useDeferredValue:Nt,useTransition:Nt,useSyncExternalStore:Nt,useId:Nt,useHostTransitionStatus:Nt,useFormState:Nt,useActionState:Nt,useOptimistic:Nt,useMemoCache:Nt,useCacheRefresh:Nt};Ja.useEffectEvent=Nt;var Rv={readContext:sn,use:ac,useCallback:function(s,a){return vn().memoizedState=[s,a===void 0?null:a],s},useContext:sn,useEffect:mv,useImperativeHandle:function(s,a,u){u=u!=null?u.concat([s]):null,uc(4194308,4,vv.bind(null,a,s),u)},useLayoutEffect:function(s,a){return uc(4194308,4,s,a)},useInsertionEffect:function(s,a){uc(4,2,s,a)},useMemo:function(s,a){var u=vn();a=a===void 0?null:a;var h=s();if(Ms){Gt(!0);try{s()}finally{Gt(!1)}}return u.memoizedState=[h,a],h},useReducer:function(s,a,u){var h=vn();if(u!==void 0){var g=u(a);if(Ms){Gt(!0);try{u(a)}finally{Gt(!1)}}}else g=a;return h.memoizedState=h.baseState=g,s={pending:null,lanes:0,dispatch:null,lastRenderedReducer:s,lastRenderedState:g},h.queue=s,s=s.dispatch=rN.bind(null,qe,s),[h.memoizedState,s]},useRef:function(s){var a=vn();return s={current:s},a.memoizedState=s},useState:function(s){s=rp(s);var a=s.queue,u=Av.bind(null,qe,a);return a.dispatch=u,[s.memoizedState,u]},useDebugValue:op,useDeferredValue:function(s,a){var u=vn();return ap(u,s,a)},useTransition:function(){var s=rp(!1);return s=Ev.bind(null,qe,s.queue,!0,!1),vn().memoizedState=s,[!1,s]},useSyncExternalStore:function(s,a,u){var h=qe,g=vn();if(We){if(u===void 0)throw Error(r(407));u=u()}else{if(u=a(),_t===null)throw Error(r(349));(Xe&127)!==0||Zb(h,a,u)}g.memoizedState=u;var v={value:u,getSnapshot:a};return g.queue=v,mv(tv.bind(null,h,v,s),[s]),h.flags|=2048,Oo(9,{destroy:void 0},ev.bind(null,h,v,u,a),null),u},useId:function(){var s=vn(),a=_t.identifierPrefix;if(We){var u=Mr,h=Er;u=(h&~(1<<32-Ke(h)-1)).toString(32)+u,a="_"+a+"R_"+u,u=sc++,0<u&&(a+="H"+u.toString(32)),a+="_"}else u=XO++,a="_"+a+"r_"+u.toString(32)+"_";return s.memoizedState=a},useHostTransitionStatus:up,useFormState:cv,useActionState:cv,useOptimistic:function(s){var a=vn();a.memoizedState=a.baseState=s;var u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return a.queue=u,a=cp.bind(null,qe,!0,u),u.dispatch=a,[s,a]},useMemoCache:ep,useCacheRefresh:function(){return vn().memoizedState=nN.bind(null,qe)},useEffectEvent:function(s){var a=vn(),u={impl:s};return a.memoizedState=u,function(){if((ut&2)!==0)throw Error(r(440));return u.impl.apply(void 0,arguments)}}},dp={readContext:sn,use:ac,useCallback:wv,useContext:sn,useEffect:sp,useImperativeHandle:Sv,useInsertionEffect:gv,useLayoutEffect:bv,useMemo:_v,useReducer:lc,useRef:pv,useState:function(){return lc(Hr)},useDebugValue:op,useDeferredValue:function(s,a){var u=zt();return Tv(u,bt.memoizedState,s,a)},useTransition:function(){var s=lc(Hr)[0],a=zt().memoizedState;return[typeof s=="boolean"?s:Qa(s),a]},useSyncExternalStore:Wb,useId:Cv,useHostTransitionStatus:up,useFormState:dv,useActionState:dv,useOptimistic:function(s,a){var u=zt();return iv(u,bt,s,a)},useMemoCache:ep,useCacheRefresh:kv};dp.useEffectEvent=yv;var Dv={readContext:sn,use:ac,useCallback:wv,useContext:sn,useEffect:sp,useImperativeHandle:Sv,useInsertionEffect:gv,useLayoutEffect:bv,useMemo:_v,useReducer:np,useRef:pv,useState:function(){return np(Hr)},useDebugValue:op,useDeferredValue:function(s,a){var u=zt();return bt===null?ap(u,s,a):Tv(u,bt.memoizedState,s,a)},useTransition:function(){var s=np(Hr)[0],a=zt().memoizedState;return[typeof s=="boolean"?s:Qa(s),a]},useSyncExternalStore:Wb,useId:Cv,useHostTransitionStatus:up,useFormState:hv,useActionState:hv,useOptimistic:function(s,a){var u=zt();return bt!==null?iv(u,bt,s,a):(u.baseState=s,[s,u.queue.dispatch])},useMemoCache:ep,useCacheRefresh:kv};Dv.useEffectEvent=yv;function fp(s,a,u,h){a=s.memoizedState,u=u(h,a),u=u==null?a:m({},a,u),s.memoizedState=u,s.lanes===0&&(s.updateQueue.baseState=u)}var hp={enqueueSetState:function(s,a,u){s=s._reactInternals;var h=$n(),g=Ei(h);g.payload=a,u!=null&&(g.callback=u),a=Mi(s,g,h),a!==null&&(An(a,s,h),Va(a,s,h))},enqueueReplaceState:function(s,a,u){s=s._reactInternals;var h=$n(),g=Ei(h);g.tag=1,g.payload=a,u!=null&&(g.callback=u),a=Mi(s,g,h),a!==null&&(An(a,s,h),Va(a,s,h))},enqueueForceUpdate:function(s,a){s=s._reactInternals;var u=$n(),h=Ei(u);h.tag=2,a!=null&&(h.callback=a),a=Mi(s,h,u),a!==null&&(An(a,s,u),Va(a,s,u))}};function Iv(s,a,u,h,g,v,_){return s=s.stateNode,typeof s.shouldComponentUpdate=="function"?s.shouldComponentUpdate(h,v,_):a.prototype&&a.prototype.isPureReactComponent?!Ba(u,h)||!Ba(g,v):!0}function Lv(s,a,u,h){s=a.state,typeof a.componentWillReceiveProps=="function"&&a.componentWillReceiveProps(u,h),typeof a.UNSAFE_componentWillReceiveProps=="function"&&a.UNSAFE_componentWillReceiveProps(u,h),a.state!==s&&hp.enqueueReplaceState(a,a.state,null)}function xs(s,a){var u=a;if("ref"in a){u={};for(var h in a)h!=="ref"&&(u[h]=a[h])}if(s=s.defaultProps){u===a&&(u=m({},u));for(var g in s)u[g]===void 0&&(u[g]=s[g])}return u}function jv(s){Fu(s)}function Bv(s){console.error(s)}function zv(s){Fu(s)}function fc(s,a){try{var u=s.onUncaughtError;u(a.value,{componentStack:a.stack})}catch(h){setTimeout(function(){throw h})}}function Pv(s,a,u){try{var h=s.onCaughtError;h(u.value,{componentStack:u.stack,errorBoundary:a.tag===1?a.stateNode:null})}catch(g){setTimeout(function(){throw g})}}function pp(s,a,u){return u=Ei(u),u.tag=3,u.payload={element:null},u.callback=function(){fc(s,a)},u}function Uv(s){return s=Ei(s),s.tag=3,s}function qv(s,a,u,h){var g=u.type.getDerivedStateFromError;if(typeof g=="function"){var v=h.value;s.payload=function(){return g(v)},s.callback=function(){Pv(a,u,h)}}var _=u.stateNode;_!==null&&typeof _.componentDidCatch=="function"&&(s.callback=function(){Pv(a,u,h),typeof g!="function"&&(Ni===null?Ni=new Set([this]):Ni.add(this));var x=h.stack;this.componentDidCatch(h.value,{componentStack:x!==null?x:""})})}function iN(s,a,u,h,g){if(u.flags|=32768,h!==null&&typeof h=="object"&&typeof h.then=="function"){if(a=u.alternate,a!==null&&_o(a,u,g,!0),u=zn.current,u!==null){switch(u.tag){case 31:case 13:return Zn===null?Ec():u.alternate===null&&Rt===0&&(Rt=3),u.flags&=-257,u.flags|=65536,u.lanes=g,h===Zu?u.flags|=16384:(a=u.updateQueue,a===null?u.updateQueue=new Set([h]):a.add(h),Pp(s,h,g)),!1;case 22:return u.flags|=65536,h===Zu?u.flags|=16384:(a=u.updateQueue,a===null?(a={transitions:null,markerInstances:null,retryQueue:new Set([h])},u.updateQueue=a):(u=a.retryQueue,u===null?a.retryQueue=new Set([h]):u.add(h)),Pp(s,h,g)),!1}throw Error(r(435,u.tag))}return Pp(s,h,g),Ec(),!1}if(We)return a=zn.current,a!==null?((a.flags&65536)===0&&(a.flags|=256),a.flags|=65536,a.lanes=g,h!==Dh&&(s=Error(r(422),{cause:h}),Ua(Qn(s,u)))):(h!==Dh&&(a=Error(r(423),{cause:h}),Ua(Qn(a,u))),s=s.current.alternate,s.flags|=65536,g&=-g,s.lanes|=g,h=Qn(h,u),g=pp(s.stateNode,h,g),Hh(s,g),Rt!==4&&(Rt=2)),!1;var v=Error(r(520),{cause:h});if(v=Qn(v,u),sl===null?sl=[v]:sl.push(v),Rt!==4&&(Rt=2),a===null)return!0;h=Qn(h,u),u=a;do{switch(u.tag){case 3:return u.flags|=65536,s=g&-g,u.lanes|=s,s=pp(u.stateNode,h,s),Hh(u,s),!1;case 1:if(a=u.type,v=u.stateNode,(u.flags&128)===0&&(typeof a.getDerivedStateFromError=="function"||v!==null&&typeof v.componentDidCatch=="function"&&(Ni===null||!Ni.has(v))))return u.flags|=65536,g&=-g,u.lanes|=g,g=Uv(g),qv(g,s,u,h),Hh(u,g),!1}u=u.return}while(u!==null);return!1}var mp=Error(r(461)),$t=!1;function on(s,a,u,h){a.child=s===null?Vb(a,null,u,h):Es(a,s.child,u,h)}function $v(s,a,u,h,g){u=u.render;var v=a.ref;if("ref"in h){var _={};for(var x in h)x!=="ref"&&(_[x]=h[x])}else _=h;return Ss(a),h=Xh(s,a,u,_,v,g),x=Jh(),s!==null&&!$t?(Wh(s,a,g),Vr(s,a,g)):(We&&x&&Nh(a),a.flags|=1,on(s,a,h,g),a.child)}function Fv(s,a,u,h,g){if(s===null){var v=u.type;return typeof v=="function"&&!kh(v)&&v.defaultProps===void 0&&u.compare===null?(a.tag=15,a.type=v,Hv(s,a,v,h,g)):(s=Gu(u.type,null,h,a,a.mode,g),s.ref=a.ref,s.return=a,a.child=s)}if(v=s.child,!Tp(s,g)){var _=v.memoizedProps;if(u=u.compare,u=u!==null?u:Ba,u(_,h)&&s.ref===a.ref)return Vr(s,a,g)}return a.flags|=1,s=Pr(v,h),s.ref=a.ref,s.return=a,a.child=s}function Hv(s,a,u,h,g){if(s!==null){var v=s.memoizedProps;if(Ba(v,h)&&s.ref===a.ref)if($t=!1,a.pendingProps=h=v,Tp(s,g))(s.flags&131072)!==0&&($t=!0);else return a.lanes=s.lanes,Vr(s,a,g)}return yp(s,a,u,h,g)}function Vv(s,a,u,h){var g=h.children,v=s!==null?s.memoizedState:null;if(s===null&&a.stateNode===null&&(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),h.mode==="hidden"){if((a.flags&128)!==0){if(v=v!==null?v.baseLanes|u:u,s!==null){for(h=a.child=s.child,g=0;h!==null;)g=g|h.lanes|h.childLanes,h=h.sibling;h=g&~v}else h=0,a.child=null;return Kv(s,a,v,u,h)}if((u&536870912)!==0)a.memoizedState={baseLanes:0,cachePool:null},s!==null&&Ju(a,v!==null?v.cachePool:null),v!==null?Yb(a,v):Kh(),Qb(a);else return h=a.lanes=536870912,Kv(s,a,v!==null?v.baseLanes|u:u,u,h)}else v!==null?(Ju(a,v.cachePool),Yb(a,v),Ci(),a.memoizedState=null):(s!==null&&Ju(a,null),Kh(),Ci());return on(s,a,g,u),a.child}function Wa(s,a){return s!==null&&s.tag===22||a.stateNode!==null||(a.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),a.sibling}function Kv(s,a,u,h,g){var v=Uh();return v=v===null?null:{parent:Ut._currentValue,pool:v},a.memoizedState={baseLanes:u,cachePool:v},s!==null&&Ju(a,null),Kh(),Qb(a),s!==null&&_o(s,a,h,!0),a.childLanes=g,null}function hc(s,a){return a=mc({mode:a.mode,children:a.children},s.mode),a.ref=s.ref,s.child=a,a.return=s,a}function Gv(s,a,u){return Es(a,s.child,null,u),s=hc(a,a.pendingProps),s.flags|=2,Pn(a),a.memoizedState=null,s}function sN(s,a,u){var h=a.pendingProps,g=(a.flags&128)!==0;if(a.flags&=-129,s===null){if(We){if(h.mode==="hidden")return s=hc(a,h),a.lanes=536870912,Wa(null,s);if(Yh(a),(s=Et)?(s=sS(s,Wn),s=s!==null&&s.data==="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:vi!==null?{id:Er,overflow:Mr}:null,retryLane:536870912,hydrationErrors:null},u=Ob(s),u.return=a,a.child=u,rn=a,Et=null)):s=null,s===null)throw wi(a);return a.lanes=536870912,null}return hc(a,h)}var v=s.memoizedState;if(v!==null){var _=v.dehydrated;if(Yh(a),g)if(a.flags&256)a.flags&=-257,a=Gv(s,a,u);else if(a.memoizedState!==null)a.child=s.child,a.flags|=128,a=null;else throw Error(r(558));else if($t||_o(s,a,u,!1),g=(u&s.childLanes)!==0,$t||g){if(h=_t,h!==null&&(_=B0(h,u),_!==0&&_!==v.retryLane))throw v.retryLane=_,ys(s,_),An(h,s,_),mp;Ec(),a=Gv(s,a,u)}else s=v.treeContext,Et=er(_.nextSibling),rn=a,We=!0,Si=null,Wn=!1,s!==null&&Db(a,s),a=hc(a,h),a.flags|=4096;return a}return s=Pr(s.child,{mode:h.mode,children:h.children}),s.ref=a.ref,a.child=s,s.return=a,s}function pc(s,a){var u=a.ref;if(u===null)s!==null&&s.ref!==null&&(a.flags|=4194816);else{if(typeof u!="function"&&typeof u!="object")throw Error(r(284));(s===null||s.ref!==u)&&(a.flags|=4194816)}}function yp(s,a,u,h,g){return Ss(a),u=Xh(s,a,u,h,void 0,g),h=Jh(),s!==null&&!$t?(Wh(s,a,g),Vr(s,a,g)):(We&&h&&Nh(a),a.flags|=1,on(s,a,u,g),a.child)}function Yv(s,a,u,h,g,v){return Ss(a),a.updateQueue=null,u=Jb(a,h,u,g),Xb(s),h=Jh(),s!==null&&!$t?(Wh(s,a,v),Vr(s,a,v)):(We&&h&&Nh(a),a.flags|=1,on(s,a,u,v),a.child)}function Qv(s,a,u,h,g){if(Ss(a),a.stateNode===null){var v=bo,_=u.contextType;typeof _=="object"&&_!==null&&(v=sn(_)),v=new u(h,v),a.memoizedState=v.state!==null&&v.state!==void 0?v.state:null,v.updater=hp,a.stateNode=v,v._reactInternals=a,v=a.stateNode,v.props=h,v.state=a.memoizedState,v.refs={},$h(a),_=u.contextType,v.context=typeof _=="object"&&_!==null?sn(_):bo,v.state=a.memoizedState,_=u.getDerivedStateFromProps,typeof _=="function"&&(fp(a,u,_,h),v.state=a.memoizedState),typeof u.getDerivedStateFromProps=="function"||typeof v.getSnapshotBeforeUpdate=="function"||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(_=v.state,typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount(),_!==v.state&&hp.enqueueReplaceState(v,v.state,null),Ga(a,h,v,g),Ka(),v.state=a.memoizedState),typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!0}else if(s===null){v=a.stateNode;var x=a.memoizedProps,D=xs(u,x);v.props=D;var K=v.context,W=u.contextType;_=bo,typeof W=="object"&&W!==null&&(_=sn(W));var ne=u.getDerivedStateFromProps;W=typeof ne=="function"||typeof v.getSnapshotBeforeUpdate=="function",x=a.pendingProps!==x,W||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(x||K!==_)&&Lv(a,v,h,_),Ti=!1;var Y=a.memoizedState;v.state=Y,Ga(a,h,v,g),Ka(),K=a.memoizedState,x||Y!==K||Ti?(typeof ne=="function"&&(fp(a,u,ne,h),K=a.memoizedState),(D=Ti||Iv(a,u,D,h,Y,K,_))?(W||typeof v.UNSAFE_componentWillMount!="function"&&typeof v.componentWillMount!="function"||(typeof v.componentWillMount=="function"&&v.componentWillMount(),typeof v.UNSAFE_componentWillMount=="function"&&v.UNSAFE_componentWillMount()),typeof v.componentDidMount=="function"&&(a.flags|=4194308)):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),a.memoizedProps=h,a.memoizedState=K),v.props=h,v.state=K,v.context=_,h=D):(typeof v.componentDidMount=="function"&&(a.flags|=4194308),h=!1)}else{v=a.stateNode,Fh(s,a),_=a.memoizedProps,W=xs(u,_),v.props=W,ne=a.pendingProps,Y=v.context,K=u.contextType,D=bo,typeof K=="object"&&K!==null&&(D=sn(K)),x=u.getDerivedStateFromProps,(K=typeof x=="function"||typeof v.getSnapshotBeforeUpdate=="function")||typeof v.UNSAFE_componentWillReceiveProps!="function"&&typeof v.componentWillReceiveProps!="function"||(_!==ne||Y!==D)&&Lv(a,v,h,D),Ti=!1,Y=a.memoizedState,v.state=Y,Ga(a,h,v,g),Ka();var X=a.memoizedState;_!==ne||Y!==X||Ti||s!==null&&s.dependencies!==null&&Qu(s.dependencies)?(typeof x=="function"&&(fp(a,u,x,h),X=a.memoizedState),(W=Ti||Iv(a,u,W,h,Y,X,D)||s!==null&&s.dependencies!==null&&Qu(s.dependencies))?(K||typeof v.UNSAFE_componentWillUpdate!="function"&&typeof v.componentWillUpdate!="function"||(typeof v.componentWillUpdate=="function"&&v.componentWillUpdate(h,X,D),typeof v.UNSAFE_componentWillUpdate=="function"&&v.UNSAFE_componentWillUpdate(h,X,D)),typeof v.componentDidUpdate=="function"&&(a.flags|=4),typeof v.getSnapshotBeforeUpdate=="function"&&(a.flags|=1024)):(typeof v.componentDidUpdate!="function"||_===s.memoizedProps&&Y===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===s.memoizedProps&&Y===s.memoizedState||(a.flags|=1024),a.memoizedProps=h,a.memoizedState=X),v.props=h,v.state=X,v.context=D,h=W):(typeof v.componentDidUpdate!="function"||_===s.memoizedProps&&Y===s.memoizedState||(a.flags|=4),typeof v.getSnapshotBeforeUpdate!="function"||_===s.memoizedProps&&Y===s.memoizedState||(a.flags|=1024),h=!1)}return v=h,pc(s,a),h=(a.flags&128)!==0,v||h?(v=a.stateNode,u=h&&typeof u.getDerivedStateFromError!="function"?null:v.render(),a.flags|=1,s!==null&&h?(a.child=Es(a,s.child,null,g),a.child=Es(a,null,u,g)):on(s,a,u,g),a.memoizedState=v.state,s=a.child):s=Vr(s,a,g),s}function Xv(s,a,u,h){return bs(),a.flags|=256,on(s,a,u,h),a.child}var gp={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function bp(s){return{baseLanes:s,cachePool:Pb()}}function vp(s,a,u){return s=s!==null?s.childLanes&~u:0,a&&(s|=qn),s}function Jv(s,a,u){var h=a.pendingProps,g=!1,v=(a.flags&128)!==0,_;if((_=v)||(_=s!==null&&s.memoizedState===null?!1:(Bt.current&2)!==0),_&&(g=!0,a.flags&=-129),_=(a.flags&32)!==0,a.flags&=-33,s===null){if(We){if(g?xi(a):Ci(),(s=Et)?(s=sS(s,Wn),s=s!==null&&s.data!=="&"?s:null,s!==null&&(a.memoizedState={dehydrated:s,treeContext:vi!==null?{id:Er,overflow:Mr}:null,retryLane:536870912,hydrationErrors:null},u=Ob(s),u.return=a,a.child=u,rn=a,Et=null)):s=null,s===null)throw wi(a);return tm(s)?a.lanes=32:a.lanes=536870912,null}var x=h.children;return h=h.fallback,g?(Ci(),g=a.mode,x=mc({mode:"hidden",children:x},g),h=gs(h,g,u,null),x.return=a,h.return=a,x.sibling=h,a.child=x,h=a.child,h.memoizedState=bp(u),h.childLanes=vp(s,_,u),a.memoizedState=gp,Wa(null,h)):(xi(a),Sp(a,x))}var D=s.memoizedState;if(D!==null&&(x=D.dehydrated,x!==null)){if(v)a.flags&256?(xi(a),a.flags&=-257,a=wp(s,a,u)):a.memoizedState!==null?(Ci(),a.child=s.child,a.flags|=128,a=null):(Ci(),x=h.fallback,g=a.mode,h=mc({mode:"visible",children:h.children},g),x=gs(x,g,u,null),x.flags|=2,h.return=a,x.return=a,h.sibling=x,a.child=h,Es(a,s.child,null,u),h=a.child,h.memoizedState=bp(u),h.childLanes=vp(s,_,u),a.memoizedState=gp,a=Wa(null,h));else if(xi(a),tm(x)){if(_=x.nextSibling&&x.nextSibling.dataset,_)var K=_.dgst;_=K,h=Error(r(419)),h.stack="",h.digest=_,Ua({value:h,source:null,stack:null}),a=wp(s,a,u)}else if($t||_o(s,a,u,!1),_=(u&s.childLanes)!==0,$t||_){if(_=_t,_!==null&&(h=B0(_,u),h!==0&&h!==D.retryLane))throw D.retryLane=h,ys(s,h),An(_,s,h),mp;em(x)||Ec(),a=wp(s,a,u)}else em(x)?(a.flags|=192,a.child=s.child,a=null):(s=D.treeContext,Et=er(x.nextSibling),rn=a,We=!0,Si=null,Wn=!1,s!==null&&Db(a,s),a=Sp(a,h.children),a.flags|=4096);return a}return g?(Ci(),x=h.fallback,g=a.mode,D=s.child,K=D.sibling,h=Pr(D,{mode:"hidden",children:h.children}),h.subtreeFlags=D.subtreeFlags&65011712,K!==null?x=Pr(K,x):(x=gs(x,g,u,null),x.flags|=2),x.return=a,h.return=a,h.sibling=x,a.child=h,Wa(null,h),h=a.child,x=s.child.memoizedState,x===null?x=bp(u):(g=x.cachePool,g!==null?(D=Ut._currentValue,g=g.parent!==D?{parent:D,pool:D}:g):g=Pb(),x={baseLanes:x.baseLanes|u,cachePool:g}),h.memoizedState=x,h.childLanes=vp(s,_,u),a.memoizedState=gp,Wa(s.child,h)):(xi(a),u=s.child,s=u.sibling,u=Pr(u,{mode:"visible",children:h.children}),u.return=a,u.sibling=null,s!==null&&(_=a.deletions,_===null?(a.deletions=[s],a.flags|=16):_.push(s)),a.child=u,a.memoizedState=null,u)}function Sp(s,a){return a=mc({mode:"visible",children:a},s.mode),a.return=s,s.child=a}function mc(s,a){return s=Bn(22,s,null,a),s.lanes=0,s}function wp(s,a,u){return Es(a,s.child,null,u),s=Sp(a,a.pendingProps.children),s.flags|=2,a.memoizedState=null,s}function Wv(s,a,u){s.lanes|=a;var h=s.alternate;h!==null&&(h.lanes|=a),jh(s.return,a,u)}function _p(s,a,u,h,g,v){var _=s.memoizedState;_===null?s.memoizedState={isBackwards:a,rendering:null,renderingStartTime:0,last:h,tail:u,tailMode:g,treeForkCount:v}:(_.isBackwards=a,_.rendering=null,_.renderingStartTime=0,_.last=h,_.tail=u,_.tailMode=g,_.treeForkCount=v)}function Zv(s,a,u){var h=a.pendingProps,g=h.revealOrder,v=h.tail;h=h.children;var _=Bt.current,x=(_&2)!==0;if(x?(_=_&1|2,a.flags|=128):_&=1,ce(Bt,_),on(s,a,h,u),h=We?Pa:0,!x&&s!==null&&(s.flags&128)!==0)e:for(s=a.child;s!==null;){if(s.tag===13)s.memoizedState!==null&&Wv(s,u,a);else if(s.tag===19)Wv(s,u,a);else if(s.child!==null){s.child.return=s,s=s.child;continue}if(s===a)break e;for(;s.sibling===null;){if(s.return===null||s.return===a)break e;s=s.return}s.sibling.return=s.return,s=s.sibling}switch(g){case"forwards":for(u=a.child,g=null;u!==null;)s=u.alternate,s!==null&&rc(s)===null&&(g=u),u=u.sibling;u=g,u===null?(g=a.child,a.child=null):(g=u.sibling,u.sibling=null),_p(a,!1,g,u,v,h);break;case"backwards":case"unstable_legacy-backwards":for(u=null,g=a.child,a.child=null;g!==null;){if(s=g.alternate,s!==null&&rc(s)===null){a.child=g;break}s=g.sibling,g.sibling=u,u=g,g=s}_p(a,!0,u,null,v,h);break;case"together":_p(a,!1,null,null,void 0,h);break;default:a.memoizedState=null}return a.child}function Vr(s,a,u){if(s!==null&&(a.dependencies=s.dependencies),Oi|=a.lanes,(u&a.childLanes)===0)if(s!==null){if(_o(s,a,u,!1),(u&a.childLanes)===0)return null}else return null;if(s!==null&&a.child!==s.child)throw Error(r(153));if(a.child!==null){for(s=a.child,u=Pr(s,s.pendingProps),a.child=u,u.return=a;s.sibling!==null;)s=s.sibling,u=u.sibling=Pr(s,s.pendingProps),u.return=a;u.sibling=null}return a.child}function Tp(s,a){return(s.lanes&a)!==0?!0:(s=s.dependencies,!!(s!==null&&Qu(s)))}function oN(s,a,u){switch(a.tag){case 3:nt(a,a.stateNode.containerInfo),_i(a,Ut,s.memoizedState.cache),bs();break;case 27:case 5:Me(a);break;case 4:nt(a,a.stateNode.containerInfo);break;case 10:_i(a,a.type,a.memoizedProps.value);break;case 31:if(a.memoizedState!==null)return a.flags|=128,Yh(a),null;break;case 13:var h=a.memoizedState;if(h!==null)return h.dehydrated!==null?(xi(a),a.flags|=128,null):(u&a.child.childLanes)!==0?Jv(s,a,u):(xi(a),s=Vr(s,a,u),s!==null?s.sibling:null);xi(a);break;case 19:var g=(s.flags&128)!==0;if(h=(u&a.childLanes)!==0,h||(_o(s,a,u,!1),h=(u&a.childLanes)!==0),g){if(h)return Zv(s,a,u);a.flags|=128}if(g=a.memoizedState,g!==null&&(g.rendering=null,g.tail=null,g.lastEffect=null),ce(Bt,Bt.current),h)break;return null;case 22:return a.lanes=0,Vv(s,a,u,a.pendingProps);case 24:_i(a,Ut,s.memoizedState.cache)}return Vr(s,a,u)}function e1(s,a,u){if(s!==null)if(s.memoizedProps!==a.pendingProps)$t=!0;else{if(!Tp(s,u)&&(a.flags&128)===0)return $t=!1,oN(s,a,u);$t=(s.flags&131072)!==0}else $t=!1,We&&(a.flags&1048576)!==0&&Rb(a,Pa,a.index);switch(a.lanes=0,a.tag){case 16:e:{var h=a.pendingProps;if(s=_s(a.elementType),a.type=s,typeof s=="function")kh(s)?(h=xs(s,h),a.tag=1,a=Qv(null,a,s,h,u)):(a.tag=0,a=yp(null,a,s,h,u));else{if(s!=null){var g=s.$$typeof;if(g===I){a.tag=11,a=$v(null,a,s,h,u);break e}else if(g===A){a.tag=14,a=Fv(null,a,s,h,u);break e}}throw a=G(s)||s,Error(r(306,a,""))}}return a;case 0:return yp(s,a,a.type,a.pendingProps,u);case 1:return h=a.type,g=xs(h,a.pendingProps),Qv(s,a,h,g,u);case 3:e:{if(nt(a,a.stateNode.containerInfo),s===null)throw Error(r(387));h=a.pendingProps;var v=a.memoizedState;g=v.element,Fh(s,a),Ga(a,h,null,u);var _=a.memoizedState;if(h=_.cache,_i(a,Ut,h),h!==v.cache&&Bh(a,[Ut],u,!0),Ka(),h=_.element,v.isDehydrated)if(v={element:h,isDehydrated:!1,cache:_.cache},a.updateQueue.baseState=v,a.memoizedState=v,a.flags&256){a=Xv(s,a,h,u);break e}else if(h!==g){g=Qn(Error(r(424)),a),Ua(g),a=Xv(s,a,h,u);break e}else for(s=a.stateNode.containerInfo,s.nodeType===9?s=s.body:s=s.nodeName==="HTML"?s.ownerDocument.body:s,Et=er(s.firstChild),rn=a,We=!0,Si=null,Wn=!0,u=Vb(a,null,h,u),a.child=u;u;)u.flags=u.flags&-3|4096,u=u.sibling;else{if(bs(),h===g){a=Vr(s,a,u);break e}on(s,a,h,u)}a=a.child}return a;case 26:return pc(s,a),s===null?(u=dS(a.type,null,a.pendingProps,null))?a.memoizedState=u:We||(u=a.type,s=a.pendingProps,h=Nc(ve.current).createElement(u),h[nn]=a,h[Tn]=s,an(h,u,s),Xt(h),a.stateNode=h):a.memoizedState=dS(a.type,s.memoizedProps,a.pendingProps,s.memoizedState),null;case 27:return Me(a),s===null&&We&&(h=a.stateNode=lS(a.type,a.pendingProps,ve.current),rn=a,Wn=!0,g=Et,Li(a.type)?(nm=g,Et=er(h.firstChild)):Et=g),on(s,a,a.pendingProps.children,u),pc(s,a),s===null&&(a.flags|=4194304),a.child;case 5:return s===null&&We&&((g=h=Et)&&(h=jN(h,a.type,a.pendingProps,Wn),h!==null?(a.stateNode=h,rn=a,Et=er(h.firstChild),Wn=!1,g=!0):g=!1),g||wi(a)),Me(a),g=a.type,v=a.pendingProps,_=s!==null?s.memoizedProps:null,h=v.children,Jp(g,v)?h=null:_!==null&&Jp(g,_)&&(a.flags|=32),a.memoizedState!==null&&(g=Xh(s,a,JO,null,null,u),hl._currentValue=g),pc(s,a),on(s,a,h,u),a.child;case 6:return s===null&&We&&((s=u=Et)&&(u=BN(u,a.pendingProps,Wn),u!==null?(a.stateNode=u,rn=a,Et=null,s=!0):s=!1),s||wi(a)),null;case 13:return Jv(s,a,u);case 4:return nt(a,a.stateNode.containerInfo),h=a.pendingProps,s===null?a.child=Es(a,null,h,u):on(s,a,h,u),a.child;case 11:return $v(s,a,a.type,a.pendingProps,u);case 7:return on(s,a,a.pendingProps,u),a.child;case 8:return on(s,a,a.pendingProps.children,u),a.child;case 12:return on(s,a,a.pendingProps.children,u),a.child;case 10:return h=a.pendingProps,_i(a,a.type,h.value),on(s,a,h.children,u),a.child;case 9:return g=a.type._context,h=a.pendingProps.children,Ss(a),g=sn(g),h=h(g),a.flags|=1,on(s,a,h,u),a.child;case 14:return Fv(s,a,a.type,a.pendingProps,u);case 15:return Hv(s,a,a.type,a.pendingProps,u);case 19:return Zv(s,a,u);case 31:return sN(s,a,u);case 22:return Vv(s,a,u,a.pendingProps);case 24:return Ss(a),h=sn(Ut),s===null?(g=Uh(),g===null&&(g=_t,v=zh(),g.pooledCache=v,v.refCount++,v!==null&&(g.pooledCacheLanes|=u),g=v),a.memoizedState={parent:h,cache:g},$h(a),_i(a,Ut,g)):((s.lanes&u)!==0&&(Fh(s,a),Ga(a,null,null,u),Ka()),g=s.memoizedState,v=a.memoizedState,g.parent!==h?(g={parent:h,cache:h},a.memoizedState=g,a.lanes===0&&(a.memoizedState=a.updateQueue.baseState=g),_i(a,Ut,h)):(h=v.cache,_i(a,Ut,h),h!==g.cache&&Bh(a,[Ut],u,!0))),on(s,a,a.pendingProps.children,u),a.child;case 29:throw a.pendingProps}throw Error(r(156,a.tag))}function Kr(s){s.flags|=4}function Ep(s,a,u,h,g){if((a=(s.mode&32)!==0)&&(a=!1),a){if(s.flags|=16777216,(g&335544128)===g)if(s.stateNode.complete)s.flags|=8192;else if(C1())s.flags|=8192;else throw Ts=Zu,qh}else s.flags&=-16777217}function t1(s,a){if(a.type!=="stylesheet"||(a.state.loading&4)!==0)s.flags&=-16777217;else if(s.flags|=16777216,!yS(a))if(C1())s.flags|=8192;else throw Ts=Zu,qh}function yc(s,a){a!==null&&(s.flags|=4),s.flags&16384&&(a=s.tag!==22?I0():536870912,s.lanes|=a,Io|=a)}function Za(s,a){if(!We)switch(s.tailMode){case"hidden":a=s.tail;for(var u=null;a!==null;)a.alternate!==null&&(u=a),a=a.sibling;u===null?s.tail=null:u.sibling=null;break;case"collapsed":u=s.tail;for(var h=null;u!==null;)u.alternate!==null&&(h=u),u=u.sibling;h===null?a||s.tail===null?s.tail=null:s.tail.sibling=null:h.sibling=null}}function Mt(s){var a=s.alternate!==null&&s.alternate.child===s.child,u=0,h=0;if(a)for(var g=s.child;g!==null;)u|=g.lanes|g.childLanes,h|=g.subtreeFlags&65011712,h|=g.flags&65011712,g.return=s,g=g.sibling;else for(g=s.child;g!==null;)u|=g.lanes|g.childLanes,h|=g.subtreeFlags,h|=g.flags,g.return=s,g=g.sibling;return s.subtreeFlags|=h,s.childLanes=u,a}function aN(s,a,u){var h=a.pendingProps;switch(Rh(a),a.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Mt(a),null;case 1:return Mt(a),null;case 3:return u=a.stateNode,h=null,s!==null&&(h=s.memoizedState.cache),a.memoizedState.cache!==h&&(a.flags|=2048),$r(Ut),pe(),u.pendingContext&&(u.context=u.pendingContext,u.pendingContext=null),(s===null||s.child===null)&&(wo(a)?Kr(a):s===null||s.memoizedState.isDehydrated&&(a.flags&256)===0||(a.flags|=1024,Ih())),Mt(a),null;case 26:var g=a.type,v=a.memoizedState;return s===null?(Kr(a),v!==null?(Mt(a),t1(a,v)):(Mt(a),Ep(a,g,null,h,u))):v?v!==s.memoizedState?(Kr(a),Mt(a),t1(a,v)):(Mt(a),a.flags&=-16777217):(s=s.memoizedProps,s!==h&&Kr(a),Mt(a),Ep(a,g,s,h,u)),null;case 27:if(wt(a),u=ve.current,g=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Kr(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Mt(a),null}s=le.current,wo(a)?Ib(a):(s=lS(g,h,u),a.stateNode=s,Kr(a))}return Mt(a),null;case 5:if(wt(a),g=a.type,s!==null&&a.stateNode!=null)s.memoizedProps!==h&&Kr(a);else{if(!h){if(a.stateNode===null)throw Error(r(166));return Mt(a),null}if(v=le.current,wo(a))Ib(a);else{var _=Nc(ve.current);switch(v){case 1:v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case 2:v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;default:switch(g){case"svg":v=_.createElementNS("http://www.w3.org/2000/svg",g);break;case"math":v=_.createElementNS("http://www.w3.org/1998/Math/MathML",g);break;case"script":v=_.createElement("div"),v.innerHTML="<script><\/script>",v=v.removeChild(v.firstChild);break;case"select":v=typeof h.is=="string"?_.createElement("select",{is:h.is}):_.createElement("select"),h.multiple?v.multiple=!0:h.size&&(v.size=h.size);break;default:v=typeof h.is=="string"?_.createElement(g,{is:h.is}):_.createElement(g)}}v[nn]=a,v[Tn]=h;e:for(_=a.child;_!==null;){if(_.tag===5||_.tag===6)v.appendChild(_.stateNode);else if(_.tag!==4&&_.tag!==27&&_.child!==null){_.child.return=_,_=_.child;continue}if(_===a)break e;for(;_.sibling===null;){if(_.return===null||_.return===a)break e;_=_.return}_.sibling.return=_.return,_=_.sibling}a.stateNode=v;e:switch(an(v,g,h),g){case"button":case"input":case"select":case"textarea":h=!!h.autoFocus;break e;case"img":h=!0;break e;default:h=!1}h&&Kr(a)}}return Mt(a),Ep(a,a.type,s===null?null:s.memoizedProps,a.pendingProps,u),null;case 6:if(s&&a.stateNode!=null)s.memoizedProps!==h&&Kr(a);else{if(typeof h!="string"&&a.stateNode===null)throw Error(r(166));if(s=ve.current,wo(a)){if(s=a.stateNode,u=a.memoizedProps,h=null,g=rn,g!==null)switch(g.tag){case 27:case 5:h=g.memoizedProps}s[nn]=a,s=!!(s.nodeValue===u||h!==null&&h.suppressHydrationWarning===!0||J1(s.nodeValue,u)),s||wi(a,!0)}else s=Nc(s).createTextNode(h),s[nn]=a,a.stateNode=s}return Mt(a),null;case 31:if(u=a.memoizedState,s===null||s.memoizedState!==null){if(h=wo(a),u!==null){if(s===null){if(!h)throw Error(r(318));if(s=a.memoizedState,s=s!==null?s.dehydrated:null,!s)throw Error(r(557));s[nn]=a}else bs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mt(a),s=!1}else u=Ih(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=u),s=!0;if(!s)return a.flags&256?(Pn(a),a):(Pn(a),null);if((a.flags&128)!==0)throw Error(r(558))}return Mt(a),null;case 13:if(h=a.memoizedState,s===null||s.memoizedState!==null&&s.memoizedState.dehydrated!==null){if(g=wo(a),h!==null&&h.dehydrated!==null){if(s===null){if(!g)throw Error(r(318));if(g=a.memoizedState,g=g!==null?g.dehydrated:null,!g)throw Error(r(317));g[nn]=a}else bs(),(a.flags&128)===0&&(a.memoizedState=null),a.flags|=4;Mt(a),g=!1}else g=Ih(),s!==null&&s.memoizedState!==null&&(s.memoizedState.hydrationErrors=g),g=!0;if(!g)return a.flags&256?(Pn(a),a):(Pn(a),null)}return Pn(a),(a.flags&128)!==0?(a.lanes=u,a):(u=h!==null,s=s!==null&&s.memoizedState!==null,u&&(h=a.child,g=null,h.alternate!==null&&h.alternate.memoizedState!==null&&h.alternate.memoizedState.cachePool!==null&&(g=h.alternate.memoizedState.cachePool.pool),v=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(v=h.memoizedState.cachePool.pool),v!==g&&(h.flags|=2048)),u!==s&&u&&(a.child.flags|=8192),yc(a,a.updateQueue),Mt(a),null);case 4:return pe(),s===null&&Kp(a.stateNode.containerInfo),Mt(a),null;case 10:return $r(a.type),Mt(a),null;case 19:if(Q(Bt),h=a.memoizedState,h===null)return Mt(a),null;if(g=(a.flags&128)!==0,v=h.rendering,v===null)if(g)Za(h,!1);else{if(Rt!==0||s!==null&&(s.flags&128)!==0)for(s=a.child;s!==null;){if(v=rc(s),v!==null){for(a.flags|=128,Za(h,!1),s=v.updateQueue,a.updateQueue=s,yc(a,s),a.subtreeFlags=0,s=u,u=a.child;u!==null;)Ab(u,s),u=u.sibling;return ce(Bt,Bt.current&1|2),We&&Ur(a,h.treeForkCount),a.child}s=s.sibling}h.tail!==null&&Qe()>wc&&(a.flags|=128,g=!0,Za(h,!1),a.lanes=4194304)}else{if(!g)if(s=rc(v),s!==null){if(a.flags|=128,g=!0,s=s.updateQueue,a.updateQueue=s,yc(a,s),Za(h,!0),h.tail===null&&h.tailMode==="hidden"&&!v.alternate&&!We)return Mt(a),null}else 2*Qe()-h.renderingStartTime>wc&&u!==536870912&&(a.flags|=128,g=!0,Za(h,!1),a.lanes=4194304);h.isBackwards?(v.sibling=a.child,a.child=v):(s=h.last,s!==null?s.sibling=v:a.child=v,h.last=v)}return h.tail!==null?(s=h.tail,h.rendering=s,h.tail=s.sibling,h.renderingStartTime=Qe(),s.sibling=null,u=Bt.current,ce(Bt,g?u&1|2:u&1),We&&Ur(a,h.treeForkCount),s):(Mt(a),null);case 22:case 23:return Pn(a),Gh(),h=a.memoizedState!==null,s!==null?s.memoizedState!==null!==h&&(a.flags|=8192):h&&(a.flags|=8192),h?(u&536870912)!==0&&(a.flags&128)===0&&(Mt(a),a.subtreeFlags&6&&(a.flags|=8192)):Mt(a),u=a.updateQueue,u!==null&&yc(a,u.retryQueue),u=null,s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),h=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(h=a.memoizedState.cachePool.pool),h!==u&&(a.flags|=2048),s!==null&&Q(ws),null;case 24:return u=null,s!==null&&(u=s.memoizedState.cache),a.memoizedState.cache!==u&&(a.flags|=2048),$r(Ut),Mt(a),null;case 25:return null;case 30:return null}throw Error(r(156,a.tag))}function lN(s,a){switch(Rh(a),a.tag){case 1:return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 3:return $r(Ut),pe(),s=a.flags,(s&65536)!==0&&(s&128)===0?(a.flags=s&-65537|128,a):null;case 26:case 27:case 5:return wt(a),null;case 31:if(a.memoizedState!==null){if(Pn(a),a.alternate===null)throw Error(r(340));bs()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 13:if(Pn(a),s=a.memoizedState,s!==null&&s.dehydrated!==null){if(a.alternate===null)throw Error(r(340));bs()}return s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 19:return Q(Bt),null;case 4:return pe(),null;case 10:return $r(a.type),null;case 22:case 23:return Pn(a),Gh(),s!==null&&Q(ws),s=a.flags,s&65536?(a.flags=s&-65537|128,a):null;case 24:return $r(Ut),null;case 25:return null;default:return null}}function n1(s,a){switch(Rh(a),a.tag){case 3:$r(Ut),pe();break;case 26:case 27:case 5:wt(a);break;case 4:pe();break;case 31:a.memoizedState!==null&&Pn(a);break;case 13:Pn(a);break;case 19:Q(Bt);break;case 10:$r(a.type);break;case 22:case 23:Pn(a),Gh(),s!==null&&Q(ws);break;case 24:$r(Ut)}}function el(s,a){try{var u=a.updateQueue,h=u!==null?u.lastEffect:null;if(h!==null){var g=h.next;u=g;do{if((u.tag&s)===s){h=void 0;var v=u.create,_=u.inst;h=v(),_.destroy=h}u=u.next}while(u!==g)}}catch(x){yt(a,a.return,x)}}function ki(s,a,u){try{var h=a.updateQueue,g=h!==null?h.lastEffect:null;if(g!==null){var v=g.next;h=v;do{if((h.tag&s)===s){var _=h.inst,x=_.destroy;if(x!==void 0){_.destroy=void 0,g=a;var D=u,K=x;try{K()}catch(W){yt(g,D,W)}}}h=h.next}while(h!==v)}}catch(W){yt(a,a.return,W)}}function r1(s){var a=s.updateQueue;if(a!==null){var u=s.stateNode;try{Gb(a,u)}catch(h){yt(s,s.return,h)}}}function i1(s,a,u){u.props=xs(s.type,s.memoizedProps),u.state=s.memoizedState;try{u.componentWillUnmount()}catch(h){yt(s,a,h)}}function tl(s,a){try{var u=s.ref;if(u!==null){switch(s.tag){case 26:case 27:case 5:var h=s.stateNode;break;case 30:h=s.stateNode;break;default:h=s.stateNode}typeof u=="function"?s.refCleanup=u(h):u.current=h}}catch(g){yt(s,a,g)}}function xr(s,a){var u=s.ref,h=s.refCleanup;if(u!==null)if(typeof h=="function")try{h()}catch(g){yt(s,a,g)}finally{s.refCleanup=null,s=s.alternate,s!=null&&(s.refCleanup=null)}else if(typeof u=="function")try{u(null)}catch(g){yt(s,a,g)}else u.current=null}function s1(s){var a=s.type,u=s.memoizedProps,h=s.stateNode;try{e:switch(a){case"button":case"input":case"select":case"textarea":u.autoFocus&&h.focus();break e;case"img":u.src?h.src=u.src:u.srcSet&&(h.srcset=u.srcSet)}}catch(g){yt(s,s.return,g)}}function Mp(s,a,u){try{var h=s.stateNode;ON(h,s.type,u,a),h[Tn]=a}catch(g){yt(s,s.return,g)}}function o1(s){return s.tag===5||s.tag===3||s.tag===26||s.tag===27&&Li(s.type)||s.tag===4}function xp(s){e:for(;;){for(;s.sibling===null;){if(s.return===null||o1(s.return))return null;s=s.return}for(s.sibling.return=s.return,s=s.sibling;s.tag!==5&&s.tag!==6&&s.tag!==18;){if(s.tag===27&&Li(s.type)||s.flags&2||s.child===null||s.tag===4)continue e;s.child.return=s,s=s.child}if(!(s.flags&2))return s.stateNode}}function Cp(s,a,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?(u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u).insertBefore(s,a):(a=u.nodeType===9?u.body:u.nodeName==="HTML"?u.ownerDocument.body:u,a.appendChild(s),u=u._reactRootContainer,u!=null||a.onclick!==null||(a.onclick=Br));else if(h!==4&&(h===27&&Li(s.type)&&(u=s.stateNode,a=null),s=s.child,s!==null))for(Cp(s,a,u),s=s.sibling;s!==null;)Cp(s,a,u),s=s.sibling}function gc(s,a,u){var h=s.tag;if(h===5||h===6)s=s.stateNode,a?u.insertBefore(s,a):u.appendChild(s);else if(h!==4&&(h===27&&Li(s.type)&&(u=s.stateNode),s=s.child,s!==null))for(gc(s,a,u),s=s.sibling;s!==null;)gc(s,a,u),s=s.sibling}function a1(s){var a=s.stateNode,u=s.memoizedProps;try{for(var h=s.type,g=a.attributes;g.length;)a.removeAttributeNode(g[0]);an(a,h,u),a[nn]=s,a[Tn]=u}catch(v){yt(s,s.return,v)}}var Gr=!1,Ft=!1,kp=!1,l1=typeof WeakSet=="function"?WeakSet:Set,Jt=null;function uN(s,a){if(s=s.containerInfo,Qp=zc,s=Sb(s),wh(s)){if("selectionStart"in s)var u={start:s.selectionStart,end:s.selectionEnd};else e:{u=(u=s.ownerDocument)&&u.defaultView||window;var h=u.getSelection&&u.getSelection();if(h&&h.rangeCount!==0){u=h.anchorNode;var g=h.anchorOffset,v=h.focusNode;h=h.focusOffset;try{u.nodeType,v.nodeType}catch{u=null;break e}var _=0,x=-1,D=-1,K=0,W=0,ne=s,Y=null;t:for(;;){for(var X;ne!==u||g!==0&&ne.nodeType!==3||(x=_+g),ne!==v||h!==0&&ne.nodeType!==3||(D=_+h),ne.nodeType===3&&(_+=ne.nodeValue.length),(X=ne.firstChild)!==null;)Y=ne,ne=X;for(;;){if(ne===s)break t;if(Y===u&&++K===g&&(x=_),Y===v&&++W===h&&(D=_),(X=ne.nextSibling)!==null)break;ne=Y,Y=ne.parentNode}ne=X}u=x===-1||D===-1?null:{start:x,end:D}}else u=null}u=u||{start:0,end:0}}else u=null;for(Xp={focusedElem:s,selectionRange:u},zc=!1,Jt=a;Jt!==null;)if(a=Jt,s=a.child,(a.subtreeFlags&1028)!==0&&s!==null)s.return=a,Jt=s;else for(;Jt!==null;){switch(a=Jt,v=a.alternate,s=a.flags,a.tag){case 0:if((s&4)!==0&&(s=a.updateQueue,s=s!==null?s.events:null,s!==null))for(u=0;u<s.length;u++)g=s[u],g.ref.impl=g.nextImpl;break;case 11:case 15:break;case 1:if((s&1024)!==0&&v!==null){s=void 0,u=a,g=v.memoizedProps,v=v.memoizedState,h=u.stateNode;try{var Te=xs(u.type,g);s=h.getSnapshotBeforeUpdate(Te,v),h.__reactInternalSnapshotBeforeUpdate=s}catch(Ie){yt(u,u.return,Ie)}}break;case 3:if((s&1024)!==0){if(s=a.stateNode.containerInfo,u=s.nodeType,u===9)Zp(s);else if(u===1)switch(s.nodeName){case"HEAD":case"HTML":case"BODY":Zp(s);break;default:s.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((s&1024)!==0)throw Error(r(163))}if(s=a.sibling,s!==null){s.return=a.return,Jt=s;break}Jt=a.return}}function u1(s,a,u){var h=u.flags;switch(u.tag){case 0:case 11:case 15:Qr(s,u),h&4&&el(5,u);break;case 1:if(Qr(s,u),h&4)if(s=u.stateNode,a===null)try{s.componentDidMount()}catch(_){yt(u,u.return,_)}else{var g=xs(u.type,a.memoizedProps);a=a.memoizedState;try{s.componentDidUpdate(g,a,s.__reactInternalSnapshotBeforeUpdate)}catch(_){yt(u,u.return,_)}}h&64&&r1(u),h&512&&tl(u,u.return);break;case 3:if(Qr(s,u),h&64&&(s=u.updateQueue,s!==null)){if(a=null,u.child!==null)switch(u.child.tag){case 27:case 5:a=u.child.stateNode;break;case 1:a=u.child.stateNode}try{Gb(s,a)}catch(_){yt(u,u.return,_)}}break;case 27:a===null&&h&4&&a1(u);case 26:case 5:Qr(s,u),a===null&&h&4&&s1(u),h&512&&tl(u,u.return);break;case 12:Qr(s,u);break;case 31:Qr(s,u),h&4&&f1(s,u);break;case 13:Qr(s,u),h&4&&h1(s,u),h&64&&(s=u.memoizedState,s!==null&&(s=s.dehydrated,s!==null&&(u=bN.bind(null,u),zN(s,u))));break;case 22:if(h=u.memoizedState!==null||Gr,!h){a=a!==null&&a.memoizedState!==null||Ft,g=Gr;var v=Ft;Gr=h,(Ft=a)&&!v?Xr(s,u,(u.subtreeFlags&8772)!==0):Qr(s,u),Gr=g,Ft=v}break;case 30:break;default:Qr(s,u)}}function c1(s){var a=s.alternate;a!==null&&(s.alternate=null,c1(a)),s.child=null,s.deletions=null,s.sibling=null,s.tag===5&&(a=s.stateNode,a!==null&&ih(a)),s.stateNode=null,s.return=null,s.dependencies=null,s.memoizedProps=null,s.memoizedState=null,s.pendingProps=null,s.stateNode=null,s.updateQueue=null}var Ct=null,Mn=!1;function Yr(s,a,u){for(u=u.child;u!==null;)d1(s,a,u),u=u.sibling}function d1(s,a,u){if(rt&&typeof rt.onCommitFiberUnmount=="function")try{rt.onCommitFiberUnmount(Ve,u)}catch{}switch(u.tag){case 26:Ft||xr(u,a),Yr(s,a,u),u.memoizedState?u.memoizedState.count--:u.stateNode&&(u=u.stateNode,u.parentNode.removeChild(u));break;case 27:Ft||xr(u,a);var h=Ct,g=Mn;Li(u.type)&&(Ct=u.stateNode,Mn=!1),Yr(s,a,u),cl(u.stateNode),Ct=h,Mn=g;break;case 5:Ft||xr(u,a);case 6:if(h=Ct,g=Mn,Ct=null,Yr(s,a,u),Ct=h,Mn=g,Ct!==null)if(Mn)try{(Ct.nodeType===9?Ct.body:Ct.nodeName==="HTML"?Ct.ownerDocument.body:Ct).removeChild(u.stateNode)}catch(v){yt(u,a,v)}else try{Ct.removeChild(u.stateNode)}catch(v){yt(u,a,v)}break;case 18:Ct!==null&&(Mn?(s=Ct,rS(s.nodeType===9?s.body:s.nodeName==="HTML"?s.ownerDocument.body:s,u.stateNode),$o(s)):rS(Ct,u.stateNode));break;case 4:h=Ct,g=Mn,Ct=u.stateNode.containerInfo,Mn=!0,Yr(s,a,u),Ct=h,Mn=g;break;case 0:case 11:case 14:case 15:ki(2,u,a),Ft||ki(4,u,a),Yr(s,a,u);break;case 1:Ft||(xr(u,a),h=u.stateNode,typeof h.componentWillUnmount=="function"&&i1(u,a,h)),Yr(s,a,u);break;case 21:Yr(s,a,u);break;case 22:Ft=(h=Ft)||u.memoizedState!==null,Yr(s,a,u),Ft=h;break;default:Yr(s,a,u)}}function f1(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null))){s=s.dehydrated;try{$o(s)}catch(u){yt(a,a.return,u)}}}function h1(s,a){if(a.memoizedState===null&&(s=a.alternate,s!==null&&(s=s.memoizedState,s!==null&&(s=s.dehydrated,s!==null))))try{$o(s)}catch(u){yt(a,a.return,u)}}function cN(s){switch(s.tag){case 31:case 13:case 19:var a=s.stateNode;return a===null&&(a=s.stateNode=new l1),a;case 22:return s=s.stateNode,a=s._retryCache,a===null&&(a=s._retryCache=new l1),a;default:throw Error(r(435,s.tag))}}function bc(s,a){var u=cN(s);a.forEach(function(h){if(!u.has(h)){u.add(h);var g=vN.bind(null,s,h);h.then(g,g)}})}function xn(s,a){var u=a.deletions;if(u!==null)for(var h=0;h<u.length;h++){var g=u[h],v=s,_=a,x=_;e:for(;x!==null;){switch(x.tag){case 27:if(Li(x.type)){Ct=x.stateNode,Mn=!1;break e}break;case 5:Ct=x.stateNode,Mn=!1;break e;case 3:case 4:Ct=x.stateNode.containerInfo,Mn=!0;break e}x=x.return}if(Ct===null)throw Error(r(160));d1(v,_,g),Ct=null,Mn=!1,v=g.alternate,v!==null&&(v.return=null),g.return=null}if(a.subtreeFlags&13886)for(a=a.child;a!==null;)p1(a,s),a=a.sibling}var mr=null;function p1(s,a){var u=s.alternate,h=s.flags;switch(s.tag){case 0:case 11:case 14:case 15:xn(a,s),Cn(s),h&4&&(ki(3,s,s.return),el(3,s),ki(5,s,s.return));break;case 1:xn(a,s),Cn(s),h&512&&(Ft||u===null||xr(u,u.return)),h&64&&Gr&&(s=s.updateQueue,s!==null&&(h=s.callbacks,h!==null&&(u=s.shared.hiddenCallbacks,s.shared.hiddenCallbacks=u===null?h:u.concat(h))));break;case 26:var g=mr;if(xn(a,s),Cn(s),h&512&&(Ft||u===null||xr(u,u.return)),h&4){var v=u!==null?u.memoizedState:null;if(h=s.memoizedState,u===null)if(h===null)if(s.stateNode===null){e:{h=s.type,u=s.memoizedProps,g=g.ownerDocument||g;t:switch(h){case"title":v=g.getElementsByTagName("title")[0],(!v||v[ka]||v[nn]||v.namespaceURI==="http://www.w3.org/2000/svg"||v.hasAttribute("itemprop"))&&(v=g.createElement(h),g.head.insertBefore(v,g.querySelector("head > title"))),an(v,h,u),v[nn]=s,Xt(v),h=v;break e;case"link":var _=pS("link","href",g).get(h+(u.href||""));if(_){for(var x=0;x<_.length;x++)if(v=_[x],v.getAttribute("href")===(u.href==null||u.href===""?null:u.href)&&v.getAttribute("rel")===(u.rel==null?null:u.rel)&&v.getAttribute("title")===(u.title==null?null:u.title)&&v.getAttribute("crossorigin")===(u.crossOrigin==null?null:u.crossOrigin)){_.splice(x,1);break t}}v=g.createElement(h),an(v,h,u),g.head.appendChild(v);break;case"meta":if(_=pS("meta","content",g).get(h+(u.content||""))){for(x=0;x<_.length;x++)if(v=_[x],v.getAttribute("content")===(u.content==null?null:""+u.content)&&v.getAttribute("name")===(u.name==null?null:u.name)&&v.getAttribute("property")===(u.property==null?null:u.property)&&v.getAttribute("http-equiv")===(u.httpEquiv==null?null:u.httpEquiv)&&v.getAttribute("charset")===(u.charSet==null?null:u.charSet)){_.splice(x,1);break t}}v=g.createElement(h),an(v,h,u),g.head.appendChild(v);break;default:throw Error(r(468,h))}v[nn]=s,Xt(v),h=v}s.stateNode=h}else mS(g,s.type,s.stateNode);else s.stateNode=hS(g,h,s.memoizedProps);else v!==h?(v===null?u.stateNode!==null&&(u=u.stateNode,u.parentNode.removeChild(u)):v.count--,h===null?mS(g,s.type,s.stateNode):hS(g,h,s.memoizedProps)):h===null&&s.stateNode!==null&&Mp(s,s.memoizedProps,u.memoizedProps)}break;case 27:xn(a,s),Cn(s),h&512&&(Ft||u===null||xr(u,u.return)),u!==null&&h&4&&Mp(s,s.memoizedProps,u.memoizedProps);break;case 5:if(xn(a,s),Cn(s),h&512&&(Ft||u===null||xr(u,u.return)),s.flags&32){g=s.stateNode;try{co(g,"")}catch(Te){yt(s,s.return,Te)}}h&4&&s.stateNode!=null&&(g=s.memoizedProps,Mp(s,g,u!==null?u.memoizedProps:g)),h&1024&&(kp=!0);break;case 6:if(xn(a,s),Cn(s),h&4){if(s.stateNode===null)throw Error(r(162));h=s.memoizedProps,u=s.stateNode;try{u.nodeValue=h}catch(Te){yt(s,s.return,Te)}}break;case 3:if(Ic=null,g=mr,mr=Rc(a.containerInfo),xn(a,s),mr=g,Cn(s),h&4&&u!==null&&u.memoizedState.isDehydrated)try{$o(a.containerInfo)}catch(Te){yt(s,s.return,Te)}kp&&(kp=!1,m1(s));break;case 4:h=mr,mr=Rc(s.stateNode.containerInfo),xn(a,s),Cn(s),mr=h;break;case 12:xn(a,s),Cn(s);break;case 31:xn(a,s),Cn(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,bc(s,h)));break;case 13:xn(a,s),Cn(s),s.child.flags&8192&&s.memoizedState!==null!=(u!==null&&u.memoizedState!==null)&&(Sc=Qe()),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,bc(s,h)));break;case 22:g=s.memoizedState!==null;var D=u!==null&&u.memoizedState!==null,K=Gr,W=Ft;if(Gr=K||g,Ft=W||D,xn(a,s),Ft=W,Gr=K,Cn(s),h&8192)e:for(a=s.stateNode,a._visibility=g?a._visibility&-2:a._visibility|1,g&&(u===null||D||Gr||Ft||Cs(s)),u=null,a=s;;){if(a.tag===5||a.tag===26){if(u===null){D=u=a;try{if(v=D.stateNode,g)_=v.style,typeof _.setProperty=="function"?_.setProperty("display","none","important"):_.display="none";else{x=D.stateNode;var ne=D.memoizedProps.style,Y=ne!=null&&ne.hasOwnProperty("display")?ne.display:null;x.style.display=Y==null||typeof Y=="boolean"?"":(""+Y).trim()}}catch(Te){yt(D,D.return,Te)}}}else if(a.tag===6){if(u===null){D=a;try{D.stateNode.nodeValue=g?"":D.memoizedProps}catch(Te){yt(D,D.return,Te)}}}else if(a.tag===18){if(u===null){D=a;try{var X=D.stateNode;g?iS(X,!0):iS(D.stateNode,!1)}catch(Te){yt(D,D.return,Te)}}}else if((a.tag!==22&&a.tag!==23||a.memoizedState===null||a===s)&&a.child!==null){a.child.return=a,a=a.child;continue}if(a===s)break e;for(;a.sibling===null;){if(a.return===null||a.return===s)break e;u===a&&(u=null),a=a.return}u===a&&(u=null),a.sibling.return=a.return,a=a.sibling}h&4&&(h=s.updateQueue,h!==null&&(u=h.retryQueue,u!==null&&(h.retryQueue=null,bc(s,u))));break;case 19:xn(a,s),Cn(s),h&4&&(h=s.updateQueue,h!==null&&(s.updateQueue=null,bc(s,h)));break;case 30:break;case 21:break;default:xn(a,s),Cn(s)}}function Cn(s){var a=s.flags;if(a&2){try{for(var u,h=s.return;h!==null;){if(o1(h)){u=h;break}h=h.return}if(u==null)throw Error(r(160));switch(u.tag){case 27:var g=u.stateNode,v=xp(s);gc(s,v,g);break;case 5:var _=u.stateNode;u.flags&32&&(co(_,""),u.flags&=-33);var x=xp(s);gc(s,x,_);break;case 3:case 4:var D=u.stateNode.containerInfo,K=xp(s);Cp(s,K,D);break;default:throw Error(r(161))}}catch(W){yt(s,s.return,W)}s.flags&=-3}a&4096&&(s.flags&=-4097)}function m1(s){if(s.subtreeFlags&1024)for(s=s.child;s!==null;){var a=s;m1(a),a.tag===5&&a.flags&1024&&a.stateNode.reset(),s=s.sibling}}function Qr(s,a){if(a.subtreeFlags&8772)for(a=a.child;a!==null;)u1(s,a.alternate,a),a=a.sibling}function Cs(s){for(s=s.child;s!==null;){var a=s;switch(a.tag){case 0:case 11:case 14:case 15:ki(4,a,a.return),Cs(a);break;case 1:xr(a,a.return);var u=a.stateNode;typeof u.componentWillUnmount=="function"&&i1(a,a.return,u),Cs(a);break;case 27:cl(a.stateNode);case 26:case 5:xr(a,a.return),Cs(a);break;case 22:a.memoizedState===null&&Cs(a);break;case 30:Cs(a);break;default:Cs(a)}s=s.sibling}}function Xr(s,a,u){for(u=u&&(a.subtreeFlags&8772)!==0,a=a.child;a!==null;){var h=a.alternate,g=s,v=a,_=v.flags;switch(v.tag){case 0:case 11:case 15:Xr(g,v,u),el(4,v);break;case 1:if(Xr(g,v,u),h=v,g=h.stateNode,typeof g.componentDidMount=="function")try{g.componentDidMount()}catch(K){yt(h,h.return,K)}if(h=v,g=h.updateQueue,g!==null){var x=h.stateNode;try{var D=g.shared.hiddenCallbacks;if(D!==null)for(g.shared.hiddenCallbacks=null,g=0;g<D.length;g++)Kb(D[g],x)}catch(K){yt(h,h.return,K)}}u&&_&64&&r1(v),tl(v,v.return);break;case 27:a1(v);case 26:case 5:Xr(g,v,u),u&&h===null&&_&4&&s1(v),tl(v,v.return);break;case 12:Xr(g,v,u);break;case 31:Xr(g,v,u),u&&_&4&&f1(g,v);break;case 13:Xr(g,v,u),u&&_&4&&h1(g,v);break;case 22:v.memoizedState===null&&Xr(g,v,u),tl(v,v.return);break;case 30:break;default:Xr(g,v,u)}a=a.sibling}}function Ap(s,a){var u=null;s!==null&&s.memoizedState!==null&&s.memoizedState.cachePool!==null&&(u=s.memoizedState.cachePool.pool),s=null,a.memoizedState!==null&&a.memoizedState.cachePool!==null&&(s=a.memoizedState.cachePool.pool),s!==u&&(s!=null&&s.refCount++,u!=null&&qa(u))}function Op(s,a){s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&qa(s))}function yr(s,a,u,h){if(a.subtreeFlags&10256)for(a=a.child;a!==null;)y1(s,a,u,h),a=a.sibling}function y1(s,a,u,h){var g=a.flags;switch(a.tag){case 0:case 11:case 15:yr(s,a,u,h),g&2048&&el(9,a);break;case 1:yr(s,a,u,h);break;case 3:yr(s,a,u,h),g&2048&&(s=null,a.alternate!==null&&(s=a.alternate.memoizedState.cache),a=a.memoizedState.cache,a!==s&&(a.refCount++,s!=null&&qa(s)));break;case 12:if(g&2048){yr(s,a,u,h),s=a.stateNode;try{var v=a.memoizedProps,_=v.id,x=v.onPostCommit;typeof x=="function"&&x(_,a.alternate===null?"mount":"update",s.passiveEffectDuration,-0)}catch(D){yt(a,a.return,D)}}else yr(s,a,u,h);break;case 31:yr(s,a,u,h);break;case 13:yr(s,a,u,h);break;case 23:break;case 22:v=a.stateNode,_=a.alternate,a.memoizedState!==null?v._visibility&2?yr(s,a,u,h):nl(s,a):v._visibility&2?yr(s,a,u,h):(v._visibility|=2,No(s,a,u,h,(a.subtreeFlags&10256)!==0||!1)),g&2048&&Ap(_,a);break;case 24:yr(s,a,u,h),g&2048&&Op(a.alternate,a);break;default:yr(s,a,u,h)}}function No(s,a,u,h,g){for(g=g&&((a.subtreeFlags&10256)!==0||!1),a=a.child;a!==null;){var v=s,_=a,x=u,D=h,K=_.flags;switch(_.tag){case 0:case 11:case 15:No(v,_,x,D,g),el(8,_);break;case 23:break;case 22:var W=_.stateNode;_.memoizedState!==null?W._visibility&2?No(v,_,x,D,g):nl(v,_):(W._visibility|=2,No(v,_,x,D,g)),g&&K&2048&&Ap(_.alternate,_);break;case 24:No(v,_,x,D,g),g&&K&2048&&Op(_.alternate,_);break;default:No(v,_,x,D,g)}a=a.sibling}}function nl(s,a){if(a.subtreeFlags&10256)for(a=a.child;a!==null;){var u=s,h=a,g=h.flags;switch(h.tag){case 22:nl(u,h),g&2048&&Ap(h.alternate,h);break;case 24:nl(u,h),g&2048&&Op(h.alternate,h);break;default:nl(u,h)}a=a.sibling}}var rl=8192;function Ro(s,a,u){if(s.subtreeFlags&rl)for(s=s.child;s!==null;)g1(s,a,u),s=s.sibling}function g1(s,a,u){switch(s.tag){case 26:Ro(s,a,u),s.flags&rl&&s.memoizedState!==null&&XN(u,mr,s.memoizedState,s.memoizedProps);break;case 5:Ro(s,a,u);break;case 3:case 4:var h=mr;mr=Rc(s.stateNode.containerInfo),Ro(s,a,u),mr=h;break;case 22:s.memoizedState===null&&(h=s.alternate,h!==null&&h.memoizedState!==null?(h=rl,rl=16777216,Ro(s,a,u),rl=h):Ro(s,a,u));break;default:Ro(s,a,u)}}function b1(s){var a=s.alternate;if(a!==null&&(s=a.child,s!==null)){a.child=null;do a=s.sibling,s.sibling=null,s=a;while(s!==null)}}function il(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];Jt=h,S1(h,s)}b1(s)}if(s.subtreeFlags&10256)for(s=s.child;s!==null;)v1(s),s=s.sibling}function v1(s){switch(s.tag){case 0:case 11:case 15:il(s),s.flags&2048&&ki(9,s,s.return);break;case 3:il(s);break;case 12:il(s);break;case 22:var a=s.stateNode;s.memoizedState!==null&&a._visibility&2&&(s.return===null||s.return.tag!==13)?(a._visibility&=-3,vc(s)):il(s);break;default:il(s)}}function vc(s){var a=s.deletions;if((s.flags&16)!==0){if(a!==null)for(var u=0;u<a.length;u++){var h=a[u];Jt=h,S1(h,s)}b1(s)}for(s=s.child;s!==null;){switch(a=s,a.tag){case 0:case 11:case 15:ki(8,a,a.return),vc(a);break;case 22:u=a.stateNode,u._visibility&2&&(u._visibility&=-3,vc(a));break;default:vc(a)}s=s.sibling}}function S1(s,a){for(;Jt!==null;){var u=Jt;switch(u.tag){case 0:case 11:case 15:ki(8,u,a);break;case 23:case 22:if(u.memoizedState!==null&&u.memoizedState.cachePool!==null){var h=u.memoizedState.cachePool.pool;h!=null&&h.refCount++}break;case 24:qa(u.memoizedState.cache)}if(h=u.child,h!==null)h.return=u,Jt=h;else e:for(u=s;Jt!==null;){h=Jt;var g=h.sibling,v=h.return;if(c1(h),h===u){Jt=null;break e}if(g!==null){g.return=v,Jt=g;break e}Jt=v}}}var dN={getCacheForType:function(s){var a=sn(Ut),u=a.data.get(s);return u===void 0&&(u=s(),a.data.set(s,u)),u},cacheSignal:function(){return sn(Ut).controller.signal}},fN=typeof WeakMap=="function"?WeakMap:Map,ut=0,_t=null,Ge=null,Xe=0,mt=0,Un=null,Ai=!1,Do=!1,Np=!1,Jr=0,Rt=0,Oi=0,ks=0,Rp=0,qn=0,Io=0,sl=null,kn=null,Dp=!1,Sc=0,w1=0,wc=1/0,_c=null,Ni=null,Yt=0,Ri=null,Lo=null,Wr=0,Ip=0,Lp=null,_1=null,ol=0,jp=null;function $n(){return(ut&2)!==0&&Xe!==0?Xe&-Xe:R.T!==null?$p():z0()}function T1(){if(qn===0)if((Xe&536870912)===0||We){var s=Ou;Ou<<=1,(Ou&3932160)===0&&(Ou=262144),qn=s}else qn=536870912;return s=zn.current,s!==null&&(s.flags|=32),qn}function An(s,a,u){(s===_t&&(mt===2||mt===9)||s.cancelPendingCommit!==null)&&(jo(s,0),Di(s,Xe,qn,!1)),Ca(s,u),((ut&2)===0||s!==_t)&&(s===_t&&((ut&2)===0&&(ks|=u),Rt===4&&Di(s,Xe,qn,!1)),Cr(s))}function E1(s,a,u){if((ut&6)!==0)throw Error(r(327));var h=!u&&(a&127)===0&&(a&s.expiredLanes)===0||xa(s,a),g=h?mN(s,a):zp(s,a,!0),v=h;do{if(g===0){Do&&!h&&Di(s,a,0,!1);break}else{if(u=s.current.alternate,v&&!hN(u)){g=zp(s,a,!1),v=!1;continue}if(g===2){if(v=a,s.errorRecoveryDisabledLanes&v)var _=0;else _=s.pendingLanes&-536870913,_=_!==0?_:_&536870912?536870912:0;if(_!==0){a=_;e:{var x=s;g=sl;var D=x.current.memoizedState.isDehydrated;if(D&&(jo(x,_).flags|=256),_=zp(x,_,!1),_!==2){if(Np&&!D){x.errorRecoveryDisabledLanes|=v,ks|=v,g=4;break e}v=kn,kn=g,v!==null&&(kn===null?kn=v:kn.push.apply(kn,v))}g=_}if(v=!1,g!==2)continue}}if(g===1){jo(s,0),Di(s,a,0,!0);break}e:{switch(h=s,v=g,v){case 0:case 1:throw Error(r(345));case 4:if((a&4194048)!==a)break;case 6:Di(h,a,qn,!Ai);break e;case 2:kn=null;break;case 3:case 5:break;default:throw Error(r(329))}if((a&62914560)===a&&(g=Sc+300-Qe(),10<g)){if(Di(h,a,qn,!Ai),Ru(h,0,!0)!==0)break e;Wr=a,h.timeoutHandle=tS(M1.bind(null,h,u,kn,_c,Dp,a,qn,ks,Io,Ai,v,"Throttled",-0,0),g);break e}M1(h,u,kn,_c,Dp,a,qn,ks,Io,Ai,v,null,-0,0)}}break}while(!0);Cr(s)}function M1(s,a,u,h,g,v,_,x,D,K,W,ne,Y,X){if(s.timeoutHandle=-1,ne=a.subtreeFlags,ne&8192||(ne&16785408)===16785408){ne={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Br},g1(a,v,ne);var Te=(v&62914560)===v?Sc-Qe():(v&4194048)===v?w1-Qe():0;if(Te=JN(ne,Te),Te!==null){Wr=v,s.cancelPendingCommit=Te(D1.bind(null,s,a,v,u,h,g,_,x,D,W,ne,null,Y,X)),Di(s,v,_,!K);return}}D1(s,a,v,u,h,g,_,x,D)}function hN(s){for(var a=s;;){var u=a.tag;if((u===0||u===11||u===15)&&a.flags&16384&&(u=a.updateQueue,u!==null&&(u=u.stores,u!==null)))for(var h=0;h<u.length;h++){var g=u[h],v=g.getSnapshot;g=g.value;try{if(!jn(v(),g))return!1}catch{return!1}}if(u=a.child,a.subtreeFlags&16384&&u!==null)u.return=a,a=u;else{if(a===s)break;for(;a.sibling===null;){if(a.return===null||a.return===s)return!0;a=a.return}a.sibling.return=a.return,a=a.sibling}}return!0}function Di(s,a,u,h){a&=~Rp,a&=~ks,s.suspendedLanes|=a,s.pingedLanes&=~a,h&&(s.warmLanes|=a),h=s.expirationTimes;for(var g=a;0<g;){var v=31-Ke(g),_=1<<v;h[v]=-1,g&=~_}u!==0&&L0(s,u,a)}function Tc(){return(ut&6)===0?(al(0),!1):!0}function Bp(){if(Ge!==null){if(mt===0)var s=Ge.return;else s=Ge,qr=vs=null,Zh(s),xo=null,Fa=0,s=Ge;for(;s!==null;)n1(s.alternate,s),s=s.return;Ge=null}}function jo(s,a){var u=s.timeoutHandle;u!==-1&&(s.timeoutHandle=-1,DN(u)),u=s.cancelPendingCommit,u!==null&&(s.cancelPendingCommit=null,u()),Wr=0,Bp(),_t=s,Ge=u=Pr(s.current,null),Xe=a,mt=0,Un=null,Ai=!1,Do=xa(s,a),Np=!1,Io=qn=Rp=ks=Oi=Rt=0,kn=sl=null,Dp=!1,(a&8)!==0&&(a|=a&32);var h=s.entangledLanes;if(h!==0)for(s=s.entanglements,h&=a;0<h;){var g=31-Ke(h),v=1<<g;a|=s[g],h&=~v}return Jr=a,Hu(),u}function x1(s,a){qe=null,R.H=Ja,a===Mo||a===Wu?(a=$b(),mt=3):a===qh?(a=$b(),mt=4):mt=a===mp?8:a!==null&&typeof a=="object"&&typeof a.then=="function"?6:1,Un=a,Ge===null&&(Rt=1,fc(s,Qn(a,s.current)))}function C1(){var s=zn.current;return s===null?!0:(Xe&4194048)===Xe?Zn===null:(Xe&62914560)===Xe||(Xe&536870912)!==0?s===Zn:!1}function k1(){var s=R.H;return R.H=Ja,s===null?Ja:s}function A1(){var s=R.A;return R.A=dN,s}function Ec(){Rt=4,Ai||(Xe&4194048)!==Xe&&zn.current!==null||(Do=!0),(Oi&134217727)===0&&(ks&134217727)===0||_t===null||Di(_t,Xe,qn,!1)}function zp(s,a,u){var h=ut;ut|=2;var g=k1(),v=A1();(_t!==s||Xe!==a)&&(_c=null,jo(s,a)),a=!1;var _=Rt;e:do try{if(mt!==0&&Ge!==null){var x=Ge,D=Un;switch(mt){case 8:Bp(),_=6;break e;case 3:case 2:case 9:case 6:zn.current===null&&(a=!0);var K=mt;if(mt=0,Un=null,Bo(s,x,D,K),u&&Do){_=0;break e}break;default:K=mt,mt=0,Un=null,Bo(s,x,D,K)}}pN(),_=Rt;break}catch(W){x1(s,W)}while(!0);return a&&s.shellSuspendCounter++,qr=vs=null,ut=h,R.H=g,R.A=v,Ge===null&&(_t=null,Xe=0,Hu()),_}function pN(){for(;Ge!==null;)O1(Ge)}function mN(s,a){var u=ut;ut|=2;var h=k1(),g=A1();_t!==s||Xe!==a?(_c=null,wc=Qe()+500,jo(s,a)):Do=xa(s,a);e:do try{if(mt!==0&&Ge!==null){a=Ge;var v=Un;t:switch(mt){case 1:mt=0,Un=null,Bo(s,a,v,1);break;case 2:case 9:if(Ub(v)){mt=0,Un=null,N1(a);break}a=function(){mt!==2&&mt!==9||_t!==s||(mt=7),Cr(s)},v.then(a,a);break e;case 3:mt=7;break e;case 4:mt=5;break e;case 7:Ub(v)?(mt=0,Un=null,N1(a)):(mt=0,Un=null,Bo(s,a,v,7));break;case 5:var _=null;switch(Ge.tag){case 26:_=Ge.memoizedState;case 5:case 27:var x=Ge;if(_?yS(_):x.stateNode.complete){mt=0,Un=null;var D=x.sibling;if(D!==null)Ge=D;else{var K=x.return;K!==null?(Ge=K,Mc(K)):Ge=null}break t}}mt=0,Un=null,Bo(s,a,v,5);break;case 6:mt=0,Un=null,Bo(s,a,v,6);break;case 8:Bp(),Rt=6;break e;default:throw Error(r(462))}}yN();break}catch(W){x1(s,W)}while(!0);return qr=vs=null,R.H=h,R.A=g,ut=u,Ge!==null?0:(_t=null,Xe=0,Hu(),Rt)}function yN(){for(;Ge!==null&&!hr();)O1(Ge)}function O1(s){var a=e1(s.alternate,s,Jr);s.memoizedProps=s.pendingProps,a===null?Mc(s):Ge=a}function N1(s){var a=s,u=a.alternate;switch(a.tag){case 15:case 0:a=Yv(u,a,a.pendingProps,a.type,void 0,Xe);break;case 11:a=Yv(u,a,a.pendingProps,a.type.render,a.ref,Xe);break;case 5:Zh(a);default:n1(u,a),a=Ge=Ab(a,Jr),a=e1(u,a,Jr)}s.memoizedProps=s.pendingProps,a===null?Mc(s):Ge=a}function Bo(s,a,u,h){qr=vs=null,Zh(a),xo=null,Fa=0;var g=a.return;try{if(iN(s,g,a,u,Xe)){Rt=1,fc(s,Qn(u,s.current)),Ge=null;return}}catch(v){if(g!==null)throw Ge=g,v;Rt=1,fc(s,Qn(u,s.current)),Ge=null;return}a.flags&32768?(We||h===1?s=!0:Do||(Xe&536870912)!==0?s=!1:(Ai=s=!0,(h===2||h===9||h===3||h===6)&&(h=zn.current,h!==null&&h.tag===13&&(h.flags|=16384))),R1(a,s)):Mc(a)}function Mc(s){var a=s;do{if((a.flags&32768)!==0){R1(a,Ai);return}s=a.return;var u=aN(a.alternate,a,Jr);if(u!==null){Ge=u;return}if(a=a.sibling,a!==null){Ge=a;return}Ge=a=s}while(a!==null);Rt===0&&(Rt=5)}function R1(s,a){do{var u=lN(s.alternate,s);if(u!==null){u.flags&=32767,Ge=u;return}if(u=s.return,u!==null&&(u.flags|=32768,u.subtreeFlags=0,u.deletions=null),!a&&(s=s.sibling,s!==null)){Ge=s;return}Ge=s=u}while(s!==null);Rt=6,Ge=null}function D1(s,a,u,h,g,v,_,x,D){s.cancelPendingCommit=null;do xc();while(Yt!==0);if((ut&6)!==0)throw Error(r(327));if(a!==null){if(a===s.current)throw Error(r(177));if(v=a.lanes|a.childLanes,v|=xh,QA(s,u,v,_,x,D),s===_t&&(Ge=_t=null,Xe=0),Lo=a,Ri=s,Wr=u,Ip=v,Lp=g,_1=h,(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?(s.callbackNode=null,s.callbackPriority=0,SN(ue,function(){return z1(),null})):(s.callbackNode=null,s.callbackPriority=0),h=(a.flags&13878)!==0,(a.subtreeFlags&13878)!==0||h){h=R.T,R.T=null,g=$.p,$.p=2,_=ut,ut|=4;try{uN(s,a,u)}finally{ut=_,$.p=g,R.T=h}}Yt=1,I1(),L1(),j1()}}function I1(){if(Yt===1){Yt=0;var s=Ri,a=Lo,u=(a.flags&13878)!==0;if((a.subtreeFlags&13878)!==0||u){u=R.T,R.T=null;var h=$.p;$.p=2;var g=ut;ut|=4;try{p1(a,s);var v=Xp,_=Sb(s.containerInfo),x=v.focusedElem,D=v.selectionRange;if(_!==x&&x&&x.ownerDocument&&vb(x.ownerDocument.documentElement,x)){if(D!==null&&wh(x)){var K=D.start,W=D.end;if(W===void 0&&(W=K),"selectionStart"in x)x.selectionStart=K,x.selectionEnd=Math.min(W,x.value.length);else{var ne=x.ownerDocument||document,Y=ne&&ne.defaultView||window;if(Y.getSelection){var X=Y.getSelection(),Te=x.textContent.length,Ie=Math.min(D.start,Te),St=D.end===void 0?Ie:Math.min(D.end,Te);!X.extend&&Ie>St&&(_=St,St=Ie,Ie=_);var q=bb(x,Ie),B=bb(x,St);if(q&&B&&(X.rangeCount!==1||X.anchorNode!==q.node||X.anchorOffset!==q.offset||X.focusNode!==B.node||X.focusOffset!==B.offset)){var V=ne.createRange();V.setStart(q.node,q.offset),X.removeAllRanges(),Ie>St?(X.addRange(V),X.extend(B.node,B.offset)):(V.setEnd(B.node,B.offset),X.addRange(V))}}}}for(ne=[],X=x;X=X.parentNode;)X.nodeType===1&&ne.push({element:X,left:X.scrollLeft,top:X.scrollTop});for(typeof x.focus=="function"&&x.focus(),x=0;x<ne.length;x++){var ee=ne[x];ee.element.scrollLeft=ee.left,ee.element.scrollTop=ee.top}}zc=!!Qp,Xp=Qp=null}finally{ut=g,$.p=h,R.T=u}}s.current=a,Yt=2}}function L1(){if(Yt===2){Yt=0;var s=Ri,a=Lo,u=(a.flags&8772)!==0;if((a.subtreeFlags&8772)!==0||u){u=R.T,R.T=null;var h=$.p;$.p=2;var g=ut;ut|=4;try{u1(s,a.alternate,a)}finally{ut=g,$.p=h,R.T=u}}Yt=3}}function j1(){if(Yt===4||Yt===3){Yt=0,_r();var s=Ri,a=Lo,u=Wr,h=_1;(a.subtreeFlags&10256)!==0||(a.flags&10256)!==0?Yt=5:(Yt=0,Lo=Ri=null,B1(s,s.pendingLanes));var g=s.pendingLanes;if(g===0&&(Ni=null),nh(u),a=a.stateNode,rt&&typeof rt.onCommitFiberRoot=="function")try{rt.onCommitFiberRoot(Ve,a,void 0,(a.current.flags&128)===128)}catch{}if(h!==null){a=R.T,g=$.p,$.p=2,R.T=null;try{for(var v=s.onRecoverableError,_=0;_<h.length;_++){var x=h[_];v(x.value,{componentStack:x.stack})}}finally{R.T=a,$.p=g}}(Wr&3)!==0&&xc(),Cr(s),g=s.pendingLanes,(u&261930)!==0&&(g&42)!==0?s===jp?ol++:(ol=0,jp=s):ol=0,al(0)}}function B1(s,a){(s.pooledCacheLanes&=a)===0&&(a=s.pooledCache,a!=null&&(s.pooledCache=null,qa(a)))}function xc(){return I1(),L1(),j1(),z1()}function z1(){if(Yt!==5)return!1;var s=Ri,a=Ip;Ip=0;var u=nh(Wr),h=R.T,g=$.p;try{$.p=32>u?32:u,R.T=null,u=Lp,Lp=null;var v=Ri,_=Wr;if(Yt=0,Lo=Ri=null,Wr=0,(ut&6)!==0)throw Error(r(331));var x=ut;if(ut|=4,v1(v.current),y1(v,v.current,_,u),ut=x,al(0,!1),rt&&typeof rt.onPostCommitFiberRoot=="function")try{rt.onPostCommitFiberRoot(Ve,v)}catch{}return!0}finally{$.p=g,R.T=h,B1(s,a)}}function P1(s,a,u){a=Qn(u,a),a=pp(s.stateNode,a,2),s=Mi(s,a,2),s!==null&&(Ca(s,2),Cr(s))}function yt(s,a,u){if(s.tag===3)P1(s,s,u);else for(;a!==null;){if(a.tag===3){P1(a,s,u);break}else if(a.tag===1){var h=a.stateNode;if(typeof a.type.getDerivedStateFromError=="function"||typeof h.componentDidCatch=="function"&&(Ni===null||!Ni.has(h))){s=Qn(u,s),u=Uv(2),h=Mi(a,u,2),h!==null&&(qv(u,h,a,s),Ca(h,2),Cr(h));break}}a=a.return}}function Pp(s,a,u){var h=s.pingCache;if(h===null){h=s.pingCache=new fN;var g=new Set;h.set(a,g)}else g=h.get(a),g===void 0&&(g=new Set,h.set(a,g));g.has(u)||(Np=!0,g.add(u),s=gN.bind(null,s,a,u),a.then(s,s))}function gN(s,a,u){var h=s.pingCache;h!==null&&h.delete(a),s.pingedLanes|=s.suspendedLanes&u,s.warmLanes&=~u,_t===s&&(Xe&u)===u&&(Rt===4||Rt===3&&(Xe&62914560)===Xe&&300>Qe()-Sc?(ut&2)===0&&jo(s,0):Rp|=u,Io===Xe&&(Io=0)),Cr(s)}function U1(s,a){a===0&&(a=I0()),s=ys(s,a),s!==null&&(Ca(s,a),Cr(s))}function bN(s){var a=s.memoizedState,u=0;a!==null&&(u=a.retryLane),U1(s,u)}function vN(s,a){var u=0;switch(s.tag){case 31:case 13:var h=s.stateNode,g=s.memoizedState;g!==null&&(u=g.retryLane);break;case 19:h=s.stateNode;break;case 22:h=s.stateNode._retryCache;break;default:throw Error(r(314))}h!==null&&h.delete(a),U1(s,u)}function SN(s,a){return xe(s,a)}var Cc=null,zo=null,Up=!1,kc=!1,qp=!1,Ii=0;function Cr(s){s!==zo&&s.next===null&&(zo===null?Cc=zo=s:zo=zo.next=s),kc=!0,Up||(Up=!0,_N())}function al(s,a){if(!qp&&kc){qp=!0;do for(var u=!1,h=Cc;h!==null;){if(s!==0){var g=h.pendingLanes;if(g===0)var v=0;else{var _=h.suspendedLanes,x=h.pingedLanes;v=(1<<31-Ke(42|s)+1)-1,v&=g&~(_&~x),v=v&201326741?v&201326741|1:v?v|2:0}v!==0&&(u=!0,H1(h,v))}else v=Xe,v=Ru(h,h===_t?v:0,h.cancelPendingCommit!==null||h.timeoutHandle!==-1),(v&3)===0||xa(h,v)||(u=!0,H1(h,v));h=h.next}while(u);qp=!1}}function wN(){q1()}function q1(){kc=Up=!1;var s=0;Ii!==0&&RN()&&(s=Ii);for(var a=Qe(),u=null,h=Cc;h!==null;){var g=h.next,v=$1(h,a);v===0?(h.next=null,u===null?Cc=g:u.next=g,g===null&&(zo=u)):(u=h,(s!==0||(v&3)!==0)&&(kc=!0)),h=g}Yt!==0&&Yt!==5||al(s),Ii!==0&&(Ii=0)}function $1(s,a){for(var u=s.suspendedLanes,h=s.pingedLanes,g=s.expirationTimes,v=s.pendingLanes&-62914561;0<v;){var _=31-Ke(v),x=1<<_,D=g[_];D===-1?((x&u)===0||(x&h)!==0)&&(g[_]=YA(x,a)):D<=a&&(s.expiredLanes|=x),v&=~x}if(a=_t,u=Xe,u=Ru(s,s===a?u:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h=s.callbackNode,u===0||s===a&&(mt===2||mt===9)||s.cancelPendingCommit!==null)return h!==null&&h!==null&&bn(h),s.callbackNode=null,s.callbackPriority=0;if((u&3)===0||xa(s,u)){if(a=u&-u,a===s.callbackPriority)return a;switch(h!==null&&bn(h),nh(u)){case 2:case 8:u=Lr;break;case 32:u=ue;break;case 268435456:u=be;break;default:u=ue}return h=F1.bind(null,s),u=xe(u,h),s.callbackPriority=a,s.callbackNode=u,a}return h!==null&&h!==null&&bn(h),s.callbackPriority=2,s.callbackNode=null,2}function F1(s,a){if(Yt!==0&&Yt!==5)return s.callbackNode=null,s.callbackPriority=0,null;var u=s.callbackNode;if(xc()&&s.callbackNode!==u)return null;var h=Xe;return h=Ru(s,s===_t?h:0,s.cancelPendingCommit!==null||s.timeoutHandle!==-1),h===0?null:(E1(s,h,a),$1(s,Qe()),s.callbackNode!=null&&s.callbackNode===u?F1.bind(null,s):null)}function H1(s,a){if(xc())return null;E1(s,a,!0)}function _N(){IN(function(){(ut&6)!==0?xe(Tr,wN):q1()})}function $p(){if(Ii===0){var s=To;s===0&&(s=Au,Au<<=1,(Au&261888)===0&&(Au=256)),Ii=s}return Ii}function V1(s){return s==null||typeof s=="symbol"||typeof s=="boolean"?null:typeof s=="function"?s:ju(""+s)}function K1(s,a){var u=a.ownerDocument.createElement("input");return u.name=a.name,u.value=a.value,s.id&&u.setAttribute("form",s.id),a.parentNode.insertBefore(u,a),s=new FormData(s),u.parentNode.removeChild(u),s}function TN(s,a,u,h,g){if(a==="submit"&&u&&u.stateNode===g){var v=V1((g[Tn]||null).action),_=h.submitter;_&&(a=(a=_[Tn]||null)?V1(a.formAction):_.getAttribute("formAction"),a!==null&&(v=a,_=null));var x=new Uu("action","action",null,h,g);s.push({event:x,listeners:[{instance:null,listener:function(){if(h.defaultPrevented){if(Ii!==0){var D=_?K1(g,_):new FormData(g);lp(u,{pending:!0,data:D,method:g.method,action:v},null,D)}}else typeof v=="function"&&(x.preventDefault(),D=_?K1(g,_):new FormData(g),lp(u,{pending:!0,data:D,method:g.method,action:v},v,D))},currentTarget:g}]})}}for(var Fp=0;Fp<Mh.length;Fp++){var Hp=Mh[Fp],EN=Hp.toLowerCase(),MN=Hp[0].toUpperCase()+Hp.slice(1);pr(EN,"on"+MN)}pr(Tb,"onAnimationEnd"),pr(Eb,"onAnimationIteration"),pr(Mb,"onAnimationStart"),pr("dblclick","onDoubleClick"),pr("focusin","onFocus"),pr("focusout","onBlur"),pr(qO,"onTransitionRun"),pr($O,"onTransitionStart"),pr(FO,"onTransitionCancel"),pr(xb,"onTransitionEnd"),lo("onMouseEnter",["mouseout","mouseover"]),lo("onMouseLeave",["mouseout","mouseover"]),lo("onPointerEnter",["pointerout","pointerover"]),lo("onPointerLeave",["pointerout","pointerover"]),fs("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),fs("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),fs("onBeforeInput",["compositionend","keypress","textInput","paste"]),fs("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),fs("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),fs("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var ll="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange resize seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),xN=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(ll));function G1(s,a){a=(a&4)!==0;for(var u=0;u<s.length;u++){var h=s[u],g=h.event;h=h.listeners;e:{var v=void 0;if(a)for(var _=h.length-1;0<=_;_--){var x=h[_],D=x.instance,K=x.currentTarget;if(x=x.listener,D!==v&&g.isPropagationStopped())break e;v=x,g.currentTarget=K;try{v(g)}catch(W){Fu(W)}g.currentTarget=null,v=D}else for(_=0;_<h.length;_++){if(x=h[_],D=x.instance,K=x.currentTarget,x=x.listener,D!==v&&g.isPropagationStopped())break e;v=x,g.currentTarget=K;try{v(g)}catch(W){Fu(W)}g.currentTarget=null,v=D}}}}function Ye(s,a){var u=a[rh];u===void 0&&(u=a[rh]=new Set);var h=s+"__bubble";u.has(h)||(Y1(a,s,2,!1),u.add(h))}function Vp(s,a,u){var h=0;a&&(h|=4),Y1(u,s,h,a)}var Ac="_reactListening"+Math.random().toString(36).slice(2);function Kp(s){if(!s[Ac]){s[Ac]=!0,q0.forEach(function(u){u!=="selectionchange"&&(xN.has(u)||Vp(u,!1,s),Vp(u,!0,s))});var a=s.nodeType===9?s:s.ownerDocument;a===null||a[Ac]||(a[Ac]=!0,Vp("selectionchange",!1,a))}}function Y1(s,a,u,h){switch(TS(a)){case 2:var g=eR;break;case 8:g=tR;break;default:g=am}u=g.bind(null,a,u,s),g=void 0,!fh||a!=="touchstart"&&a!=="touchmove"&&a!=="wheel"||(g=!0),h?g!==void 0?s.addEventListener(a,u,{capture:!0,passive:g}):s.addEventListener(a,u,!0):g!==void 0?s.addEventListener(a,u,{passive:g}):s.addEventListener(a,u,!1)}function Gp(s,a,u,h,g){var v=h;if((a&1)===0&&(a&2)===0&&h!==null)e:for(;;){if(h===null)return;var _=h.tag;if(_===3||_===4){var x=h.stateNode.containerInfo;if(x===g)break;if(_===4)for(_=h.return;_!==null;){var D=_.tag;if((D===3||D===4)&&_.stateNode.containerInfo===g)return;_=_.return}for(;x!==null;){if(_=so(x),_===null)return;if(D=_.tag,D===5||D===6||D===26||D===27){h=v=_;continue e}x=x.parentNode}}h=h.return}Z0(function(){var K=v,W=ch(u),ne=[];e:{var Y=Cb.get(s);if(Y!==void 0){var X=Uu,Te=s;switch(s){case"keypress":if(zu(u)===0)break e;case"keydown":case"keyup":X=vO;break;case"focusin":Te="focus",X=yh;break;case"focusout":Te="blur",X=yh;break;case"beforeblur":case"afterblur":X=yh;break;case"click":if(u.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":X=nb;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":X=aO;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":X=_O;break;case Tb:case Eb:case Mb:X=cO;break;case xb:X=EO;break;case"scroll":case"scrollend":X=sO;break;case"wheel":X=xO;break;case"copy":case"cut":case"paste":X=fO;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":X=ib;break;case"toggle":case"beforetoggle":X=kO}var Ie=(a&4)!==0,St=!Ie&&(s==="scroll"||s==="scrollend"),q=Ie?Y!==null?Y+"Capture":null:Y;Ie=[];for(var B=K,V;B!==null;){var ee=B;if(V=ee.stateNode,ee=ee.tag,ee!==5&&ee!==26&&ee!==27||V===null||q===null||(ee=Oa(B,q),ee!=null&&Ie.push(ul(B,ee,V))),St)break;B=B.return}0<Ie.length&&(Y=new X(Y,Te,null,u,W),ne.push({event:Y,listeners:Ie}))}}if((a&7)===0){e:{if(Y=s==="mouseover"||s==="pointerover",X=s==="mouseout"||s==="pointerout",Y&&u!==uh&&(Te=u.relatedTarget||u.fromElement)&&(so(Te)||Te[io]))break e;if((X||Y)&&(Y=W.window===W?W:(Y=W.ownerDocument)?Y.defaultView||Y.parentWindow:window,X?(Te=u.relatedTarget||u.toElement,X=K,Te=Te?so(Te):null,Te!==null&&(St=o(Te),Ie=Te.tag,Te!==St||Ie!==5&&Ie!==27&&Ie!==6)&&(Te=null)):(X=null,Te=K),X!==Te)){if(Ie=nb,ee="onMouseLeave",q="onMouseEnter",B="mouse",(s==="pointerout"||s==="pointerover")&&(Ie=ib,ee="onPointerLeave",q="onPointerEnter",B="pointer"),St=X==null?Y:Aa(X),V=Te==null?Y:Aa(Te),Y=new Ie(ee,B+"leave",X,u,W),Y.target=St,Y.relatedTarget=V,ee=null,so(W)===K&&(Ie=new Ie(q,B+"enter",Te,u,W),Ie.target=V,Ie.relatedTarget=St,ee=Ie),St=ee,X&&Te)t:{for(Ie=CN,q=X,B=Te,V=0,ee=q;ee;ee=Ie(ee))V++;ee=0;for(var Oe=B;Oe;Oe=Ie(Oe))ee++;for(;0<V-ee;)q=Ie(q),V--;for(;0<ee-V;)B=Ie(B),ee--;for(;V--;){if(q===B||B!==null&&q===B.alternate){Ie=q;break t}q=Ie(q),B=Ie(B)}Ie=null}else Ie=null;X!==null&&Q1(ne,Y,X,Ie,!1),Te!==null&&St!==null&&Q1(ne,St,Te,Ie,!0)}}e:{if(Y=K?Aa(K):window,X=Y.nodeName&&Y.nodeName.toLowerCase(),X==="select"||X==="input"&&Y.type==="file")var ot=fb;else if(cb(Y))if(hb)ot=zO;else{ot=jO;var Ee=LO}else X=Y.nodeName,!X||X.toLowerCase()!=="input"||Y.type!=="checkbox"&&Y.type!=="radio"?K&&lh(K.elementType)&&(ot=fb):ot=BO;if(ot&&(ot=ot(s,K))){db(ne,ot,u,W);break e}Ee&&Ee(s,Y,K),s==="focusout"&&K&&Y.type==="number"&&K.memoizedProps.value!=null&&ah(Y,"number",Y.value)}switch(Ee=K?Aa(K):window,s){case"focusin":(cb(Ee)||Ee.contentEditable==="true")&&(mo=Ee,_h=K,za=null);break;case"focusout":za=_h=mo=null;break;case"mousedown":Th=!0;break;case"contextmenu":case"mouseup":case"dragend":Th=!1,wb(ne,u,W);break;case"selectionchange":if(UO)break;case"keydown":case"keyup":wb(ne,u,W)}var $e;if(bh)e:{switch(s){case"compositionstart":var Je="onCompositionStart";break e;case"compositionend":Je="onCompositionEnd";break e;case"compositionupdate":Je="onCompositionUpdate";break e}Je=void 0}else po?lb(s,u)&&(Je="onCompositionEnd"):s==="keydown"&&u.keyCode===229&&(Je="onCompositionStart");Je&&(sb&&u.locale!=="ko"&&(po||Je!=="onCompositionStart"?Je==="onCompositionEnd"&&po&&($e=eb()):(bi=W,hh="value"in bi?bi.value:bi.textContent,po=!0)),Ee=Oc(K,Je),0<Ee.length&&(Je=new rb(Je,s,null,u,W),ne.push({event:Je,listeners:Ee}),$e?Je.data=$e:($e=ub(u),$e!==null&&(Je.data=$e)))),($e=OO?NO(s,u):RO(s,u))&&(Je=Oc(K,"onBeforeInput"),0<Je.length&&(Ee=new rb("onBeforeInput","beforeinput",null,u,W),ne.push({event:Ee,listeners:Je}),Ee.data=$e)),TN(ne,s,K,u,W)}G1(ne,a)})}function ul(s,a,u){return{instance:s,listener:a,currentTarget:u}}function Oc(s,a){for(var u=a+"Capture",h=[];s!==null;){var g=s,v=g.stateNode;if(g=g.tag,g!==5&&g!==26&&g!==27||v===null||(g=Oa(s,u),g!=null&&h.unshift(ul(s,g,v)),g=Oa(s,a),g!=null&&h.push(ul(s,g,v))),s.tag===3)return h;s=s.return}return[]}function CN(s){if(s===null)return null;do s=s.return;while(s&&s.tag!==5&&s.tag!==27);return s||null}function Q1(s,a,u,h,g){for(var v=a._reactName,_=[];u!==null&&u!==h;){var x=u,D=x.alternate,K=x.stateNode;if(x=x.tag,D!==null&&D===h)break;x!==5&&x!==26&&x!==27||K===null||(D=K,g?(K=Oa(u,v),K!=null&&_.unshift(ul(u,K,D))):g||(K=Oa(u,v),K!=null&&_.push(ul(u,K,D)))),u=u.return}_.length!==0&&s.push({event:a,listeners:_})}var kN=/\r\n?/g,AN=/\u0000|\uFFFD/g;function X1(s){return(typeof s=="string"?s:""+s).replace(kN,`
9
+ `).replace(AN,"")}function J1(s,a){return a=X1(a),X1(s)===a}function vt(s,a,u,h,g,v){switch(u){case"children":typeof h=="string"?a==="body"||a==="textarea"&&h===""||co(s,h):(typeof h=="number"||typeof h=="bigint")&&a!=="body"&&co(s,""+h);break;case"className":Iu(s,"class",h);break;case"tabIndex":Iu(s,"tabindex",h);break;case"dir":case"role":case"viewBox":case"width":case"height":Iu(s,u,h);break;case"style":J0(s,h,v);break;case"data":if(a!=="object"){Iu(s,"data",h);break}case"src":case"href":if(h===""&&(a!=="a"||u!=="href")){s.removeAttribute(u);break}if(h==null||typeof h=="function"||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(u);break}h=ju(""+h),s.setAttribute(u,h);break;case"action":case"formAction":if(typeof h=="function"){s.setAttribute(u,"javascript:throw new Error('A React form was unexpectedly submitted. If you called form.submit() manually, consider using form.requestSubmit() instead. If you\\'re trying to use event.stopPropagation() in a submit event handler, consider also calling event.preventDefault().')");break}else typeof v=="function"&&(u==="formAction"?(a!=="input"&&vt(s,a,"name",g.name,g,null),vt(s,a,"formEncType",g.formEncType,g,null),vt(s,a,"formMethod",g.formMethod,g,null),vt(s,a,"formTarget",g.formTarget,g,null)):(vt(s,a,"encType",g.encType,g,null),vt(s,a,"method",g.method,g,null),vt(s,a,"target",g.target,g,null)));if(h==null||typeof h=="symbol"||typeof h=="boolean"){s.removeAttribute(u);break}h=ju(""+h),s.setAttribute(u,h);break;case"onClick":h!=null&&(s.onclick=Br);break;case"onScroll":h!=null&&Ye("scroll",s);break;case"onScrollEnd":h!=null&&Ye("scrollend",s);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"multiple":s.multiple=h&&typeof h!="function"&&typeof h!="symbol";break;case"muted":s.muted=h&&typeof h!="function"&&typeof h!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(h==null||typeof h=="function"||typeof h=="boolean"||typeof h=="symbol"){s.removeAttribute("xlink:href");break}u=ju(""+h),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",u);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(u,""+h):s.removeAttribute(u);break;case"inert":case"allowFullScreen":case"async":case"autoPlay":case"controls":case"default":case"defer":case"disabled":case"disablePictureInPicture":case"disableRemotePlayback":case"formNoValidate":case"hidden":case"loop":case"noModule":case"noValidate":case"open":case"playsInline":case"readOnly":case"required":case"reversed":case"scoped":case"seamless":case"itemScope":h&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(u,""):s.removeAttribute(u);break;case"capture":case"download":h===!0?s.setAttribute(u,""):h!==!1&&h!=null&&typeof h!="function"&&typeof h!="symbol"?s.setAttribute(u,h):s.removeAttribute(u);break;case"cols":case"rows":case"size":case"span":h!=null&&typeof h!="function"&&typeof h!="symbol"&&!isNaN(h)&&1<=h?s.setAttribute(u,h):s.removeAttribute(u);break;case"rowSpan":case"start":h==null||typeof h=="function"||typeof h=="symbol"||isNaN(h)?s.removeAttribute(u):s.setAttribute(u,h);break;case"popover":Ye("beforetoggle",s),Ye("toggle",s),Du(s,"popover",h);break;case"xlinkActuate":jr(s,"http://www.w3.org/1999/xlink","xlink:actuate",h);break;case"xlinkArcrole":jr(s,"http://www.w3.org/1999/xlink","xlink:arcrole",h);break;case"xlinkRole":jr(s,"http://www.w3.org/1999/xlink","xlink:role",h);break;case"xlinkShow":jr(s,"http://www.w3.org/1999/xlink","xlink:show",h);break;case"xlinkTitle":jr(s,"http://www.w3.org/1999/xlink","xlink:title",h);break;case"xlinkType":jr(s,"http://www.w3.org/1999/xlink","xlink:type",h);break;case"xmlBase":jr(s,"http://www.w3.org/XML/1998/namespace","xml:base",h);break;case"xmlLang":jr(s,"http://www.w3.org/XML/1998/namespace","xml:lang",h);break;case"xmlSpace":jr(s,"http://www.w3.org/XML/1998/namespace","xml:space",h);break;case"is":Du(s,"is",h);break;case"innerText":case"textContent":break;default:(!(2<u.length)||u[0]!=="o"&&u[0]!=="O"||u[1]!=="n"&&u[1]!=="N")&&(u=rO.get(u)||u,Du(s,u,h))}}function Yp(s,a,u,h,g,v){switch(u){case"style":J0(s,h,v);break;case"dangerouslySetInnerHTML":if(h!=null){if(typeof h!="object"||!("__html"in h))throw Error(r(61));if(u=h.__html,u!=null){if(g.children!=null)throw Error(r(60));s.innerHTML=u}}break;case"children":typeof h=="string"?co(s,h):(typeof h=="number"||typeof h=="bigint")&&co(s,""+h);break;case"onScroll":h!=null&&Ye("scroll",s);break;case"onScrollEnd":h!=null&&Ye("scrollend",s);break;case"onClick":h!=null&&(s.onclick=Br);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!$0.hasOwnProperty(u))e:{if(u[0]==="o"&&u[1]==="n"&&(g=u.endsWith("Capture"),a=u.slice(2,g?u.length-7:void 0),v=s[Tn]||null,v=v!=null?v[u]:null,typeof v=="function"&&s.removeEventListener(a,v,g),typeof h=="function")){typeof v!="function"&&v!==null&&(u in s?s[u]=null:s.hasAttribute(u)&&s.removeAttribute(u)),s.addEventListener(a,h,g);break e}u in s?s[u]=h:h===!0?s.setAttribute(u,""):Du(s,u,h)}}}function an(s,a,u){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Ye("error",s),Ye("load",s);var h=!1,g=!1,v;for(v in u)if(u.hasOwnProperty(v)){var _=u[v];if(_!=null)switch(v){case"src":h=!0;break;case"srcSet":g=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:vt(s,a,v,_,u,null)}}g&&vt(s,a,"srcSet",u.srcSet,u,null),h&&vt(s,a,"src",u.src,u,null);return;case"input":Ye("invalid",s);var x=v=_=g=null,D=null,K=null;for(h in u)if(u.hasOwnProperty(h)){var W=u[h];if(W!=null)switch(h){case"name":g=W;break;case"type":_=W;break;case"checked":D=W;break;case"defaultChecked":K=W;break;case"value":v=W;break;case"defaultValue":x=W;break;case"children":case"dangerouslySetInnerHTML":if(W!=null)throw Error(r(137,a));break;default:vt(s,a,h,W,u,null)}}G0(s,v,x,D,K,_,g,!1);return;case"select":Ye("invalid",s),h=_=v=null;for(g in u)if(u.hasOwnProperty(g)&&(x=u[g],x!=null))switch(g){case"value":v=x;break;case"defaultValue":_=x;break;case"multiple":h=x;default:vt(s,a,g,x,u,null)}a=v,u=_,s.multiple=!!h,a!=null?uo(s,!!h,a,!1):u!=null&&uo(s,!!h,u,!0);return;case"textarea":Ye("invalid",s),v=g=h=null;for(_ in u)if(u.hasOwnProperty(_)&&(x=u[_],x!=null))switch(_){case"value":h=x;break;case"defaultValue":g=x;break;case"children":v=x;break;case"dangerouslySetInnerHTML":if(x!=null)throw Error(r(91));break;default:vt(s,a,_,x,u,null)}Q0(s,h,g,v);return;case"option":for(D in u)u.hasOwnProperty(D)&&(h=u[D],h!=null)&&(D==="selected"?s.selected=h&&typeof h!="function"&&typeof h!="symbol":vt(s,a,D,h,u,null));return;case"dialog":Ye("beforetoggle",s),Ye("toggle",s),Ye("cancel",s),Ye("close",s);break;case"iframe":case"object":Ye("load",s);break;case"video":case"audio":for(h=0;h<ll.length;h++)Ye(ll[h],s);break;case"image":Ye("error",s),Ye("load",s);break;case"details":Ye("toggle",s);break;case"embed":case"source":case"link":Ye("error",s),Ye("load",s);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(K in u)if(u.hasOwnProperty(K)&&(h=u[K],h!=null))switch(K){case"children":case"dangerouslySetInnerHTML":throw Error(r(137,a));default:vt(s,a,K,h,u,null)}return;default:if(lh(a)){for(W in u)u.hasOwnProperty(W)&&(h=u[W],h!==void 0&&Yp(s,a,W,h,u,void 0));return}}for(x in u)u.hasOwnProperty(x)&&(h=u[x],h!=null&&vt(s,a,x,h,u,null))}function ON(s,a,u,h){switch(a){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var g=null,v=null,_=null,x=null,D=null,K=null,W=null;for(X in u){var ne=u[X];if(u.hasOwnProperty(X)&&ne!=null)switch(X){case"checked":break;case"value":break;case"defaultValue":D=ne;default:h.hasOwnProperty(X)||vt(s,a,X,null,h,ne)}}for(var Y in h){var X=h[Y];if(ne=u[Y],h.hasOwnProperty(Y)&&(X!=null||ne!=null))switch(Y){case"type":v=X;break;case"name":g=X;break;case"checked":K=X;break;case"defaultChecked":W=X;break;case"value":_=X;break;case"defaultValue":x=X;break;case"children":case"dangerouslySetInnerHTML":if(X!=null)throw Error(r(137,a));break;default:X!==ne&&vt(s,a,Y,X,h,ne)}}oh(s,_,x,D,K,W,v,g);return;case"select":X=_=x=Y=null;for(v in u)if(D=u[v],u.hasOwnProperty(v)&&D!=null)switch(v){case"value":break;case"multiple":X=D;default:h.hasOwnProperty(v)||vt(s,a,v,null,h,D)}for(g in h)if(v=h[g],D=u[g],h.hasOwnProperty(g)&&(v!=null||D!=null))switch(g){case"value":Y=v;break;case"defaultValue":x=v;break;case"multiple":_=v;default:v!==D&&vt(s,a,g,v,h,D)}a=x,u=_,h=X,Y!=null?uo(s,!!u,Y,!1):!!h!=!!u&&(a!=null?uo(s,!!u,a,!0):uo(s,!!u,u?[]:"",!1));return;case"textarea":X=Y=null;for(x in u)if(g=u[x],u.hasOwnProperty(x)&&g!=null&&!h.hasOwnProperty(x))switch(x){case"value":break;case"children":break;default:vt(s,a,x,null,h,g)}for(_ in h)if(g=h[_],v=u[_],h.hasOwnProperty(_)&&(g!=null||v!=null))switch(_){case"value":Y=g;break;case"defaultValue":X=g;break;case"children":break;case"dangerouslySetInnerHTML":if(g!=null)throw Error(r(91));break;default:g!==v&&vt(s,a,_,g,h,v)}Y0(s,Y,X);return;case"option":for(var Te in u)Y=u[Te],u.hasOwnProperty(Te)&&Y!=null&&!h.hasOwnProperty(Te)&&(Te==="selected"?s.selected=!1:vt(s,a,Te,null,h,Y));for(D in h)Y=h[D],X=u[D],h.hasOwnProperty(D)&&Y!==X&&(Y!=null||X!=null)&&(D==="selected"?s.selected=Y&&typeof Y!="function"&&typeof Y!="symbol":vt(s,a,D,Y,h,X));return;case"img":case"link":case"area":case"base":case"br":case"col":case"embed":case"hr":case"keygen":case"meta":case"param":case"source":case"track":case"wbr":case"menuitem":for(var Ie in u)Y=u[Ie],u.hasOwnProperty(Ie)&&Y!=null&&!h.hasOwnProperty(Ie)&&vt(s,a,Ie,null,h,Y);for(K in h)if(Y=h[K],X=u[K],h.hasOwnProperty(K)&&Y!==X&&(Y!=null||X!=null))switch(K){case"children":case"dangerouslySetInnerHTML":if(Y!=null)throw Error(r(137,a));break;default:vt(s,a,K,Y,h,X)}return;default:if(lh(a)){for(var St in u)Y=u[St],u.hasOwnProperty(St)&&Y!==void 0&&!h.hasOwnProperty(St)&&Yp(s,a,St,void 0,h,Y);for(W in h)Y=h[W],X=u[W],!h.hasOwnProperty(W)||Y===X||Y===void 0&&X===void 0||Yp(s,a,W,Y,h,X);return}}for(var q in u)Y=u[q],u.hasOwnProperty(q)&&Y!=null&&!h.hasOwnProperty(q)&&vt(s,a,q,null,h,Y);for(ne in h)Y=h[ne],X=u[ne],!h.hasOwnProperty(ne)||Y===X||Y==null&&X==null||vt(s,a,ne,Y,h,X)}function W1(s){switch(s){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function NN(){if(typeof performance.getEntriesByType=="function"){for(var s=0,a=0,u=performance.getEntriesByType("resource"),h=0;h<u.length;h++){var g=u[h],v=g.transferSize,_=g.initiatorType,x=g.duration;if(v&&x&&W1(_)){for(_=0,x=g.responseEnd,h+=1;h<u.length;h++){var D=u[h],K=D.startTime;if(K>x)break;var W=D.transferSize,ne=D.initiatorType;W&&W1(ne)&&(D=D.responseEnd,_+=W*(D<x?1:(x-K)/(D-K)))}if(--h,a+=8*(v+_)/(g.duration/1e3),s++,10<s)break}}if(0<s)return a/s/1e6}return navigator.connection&&(s=navigator.connection.downlink,typeof s=="number")?s:5}var Qp=null,Xp=null;function Nc(s){return s.nodeType===9?s:s.ownerDocument}function Z1(s){switch(s){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function eS(s,a){if(s===0)switch(a){case"svg":return 1;case"math":return 2;default:return 0}return s===1&&a==="foreignObject"?0:s}function Jp(s,a){return s==="textarea"||s==="noscript"||typeof a.children=="string"||typeof a.children=="number"||typeof a.children=="bigint"||typeof a.dangerouslySetInnerHTML=="object"&&a.dangerouslySetInnerHTML!==null&&a.dangerouslySetInnerHTML.__html!=null}var Wp=null;function RN(){var s=window.event;return s&&s.type==="popstate"?s===Wp?!1:(Wp=s,!0):(Wp=null,!1)}var tS=typeof setTimeout=="function"?setTimeout:void 0,DN=typeof clearTimeout=="function"?clearTimeout:void 0,nS=typeof Promise=="function"?Promise:void 0,IN=typeof queueMicrotask=="function"?queueMicrotask:typeof nS<"u"?function(s){return nS.resolve(null).then(s).catch(LN)}:tS;function LN(s){setTimeout(function(){throw s})}function Li(s){return s==="head"}function rS(s,a){var u=a,h=0;do{var g=u.nextSibling;if(s.removeChild(u),g&&g.nodeType===8)if(u=g.data,u==="/$"||u==="/&"){if(h===0){s.removeChild(g),$o(a);return}h--}else if(u==="$"||u==="$?"||u==="$~"||u==="$!"||u==="&")h++;else if(u==="html")cl(s.ownerDocument.documentElement);else if(u==="head"){u=s.ownerDocument.head,cl(u);for(var v=u.firstChild;v;){var _=v.nextSibling,x=v.nodeName;v[ka]||x==="SCRIPT"||x==="STYLE"||x==="LINK"&&v.rel.toLowerCase()==="stylesheet"||u.removeChild(v),v=_}}else u==="body"&&cl(s.ownerDocument.body);u=g}while(u);$o(a)}function iS(s,a){var u=s;s=0;do{var h=u.nextSibling;if(u.nodeType===1?a?(u._stashedDisplay=u.style.display,u.style.display="none"):(u.style.display=u._stashedDisplay||"",u.getAttribute("style")===""&&u.removeAttribute("style")):u.nodeType===3&&(a?(u._stashedText=u.nodeValue,u.nodeValue=""):u.nodeValue=u._stashedText||""),h&&h.nodeType===8)if(u=h.data,u==="/$"){if(s===0)break;s--}else u!=="$"&&u!=="$?"&&u!=="$~"&&u!=="$!"||s++;u=h}while(u)}function Zp(s){var a=s.firstChild;for(a&&a.nodeType===10&&(a=a.nextSibling);a;){var u=a;switch(a=a.nextSibling,u.nodeName){case"HTML":case"HEAD":case"BODY":Zp(u),ih(u);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(u.rel.toLowerCase()==="stylesheet")continue}s.removeChild(u)}}function jN(s,a,u,h){for(;s.nodeType===1;){var g=u;if(s.nodeName.toLowerCase()!==a.toLowerCase()){if(!h&&(s.nodeName!=="INPUT"||s.type!=="hidden"))break}else if(h){if(!s[ka])switch(a){case"meta":if(!s.hasAttribute("itemprop"))break;return s;case"link":if(v=s.getAttribute("rel"),v==="stylesheet"&&s.hasAttribute("data-precedence"))break;if(v!==g.rel||s.getAttribute("href")!==(g.href==null||g.href===""?null:g.href)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin)||s.getAttribute("title")!==(g.title==null?null:g.title))break;return s;case"style":if(s.hasAttribute("data-precedence"))break;return s;case"script":if(v=s.getAttribute("src"),(v!==(g.src==null?null:g.src)||s.getAttribute("type")!==(g.type==null?null:g.type)||s.getAttribute("crossorigin")!==(g.crossOrigin==null?null:g.crossOrigin))&&v&&s.hasAttribute("async")&&!s.hasAttribute("itemprop"))break;return s;default:return s}}else if(a==="input"&&s.type==="hidden"){var v=g.name==null?null:""+g.name;if(g.type==="hidden"&&s.getAttribute("name")===v)return s}else return s;if(s=er(s.nextSibling),s===null)break}return null}function BN(s,a,u){if(a==="")return null;for(;s.nodeType!==3;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!u||(s=er(s.nextSibling),s===null))return null;return s}function sS(s,a){for(;s.nodeType!==8;)if((s.nodeType!==1||s.nodeName!=="INPUT"||s.type!=="hidden")&&!a||(s=er(s.nextSibling),s===null))return null;return s}function em(s){return s.data==="$?"||s.data==="$~"}function tm(s){return s.data==="$!"||s.data==="$?"&&s.ownerDocument.readyState!=="loading"}function zN(s,a){var u=s.ownerDocument;if(s.data==="$~")s._reactRetry=a;else if(s.data!=="$?"||u.readyState!=="loading")a();else{var h=function(){a(),u.removeEventListener("DOMContentLoaded",h)};u.addEventListener("DOMContentLoaded",h),s._reactRetry=h}}function er(s){for(;s!=null;s=s.nextSibling){var a=s.nodeType;if(a===1||a===3)break;if(a===8){if(a=s.data,a==="$"||a==="$!"||a==="$?"||a==="$~"||a==="&"||a==="F!"||a==="F")break;if(a==="/$"||a==="/&")return null}}return s}var nm=null;function oS(s){s=s.nextSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="/$"||u==="/&"){if(a===0)return er(s.nextSibling);a--}else u!=="$"&&u!=="$!"&&u!=="$?"&&u!=="$~"&&u!=="&"||a++}s=s.nextSibling}return null}function aS(s){s=s.previousSibling;for(var a=0;s;){if(s.nodeType===8){var u=s.data;if(u==="$"||u==="$!"||u==="$?"||u==="$~"||u==="&"){if(a===0)return s;a--}else u!=="/$"&&u!=="/&"||a++}s=s.previousSibling}return null}function lS(s,a,u){switch(a=Nc(u),s){case"html":if(s=a.documentElement,!s)throw Error(r(452));return s;case"head":if(s=a.head,!s)throw Error(r(453));return s;case"body":if(s=a.body,!s)throw Error(r(454));return s;default:throw Error(r(451))}}function cl(s){for(var a=s.attributes;a.length;)s.removeAttributeNode(a[0]);ih(s)}var tr=new Map,uS=new Set;function Rc(s){return typeof s.getRootNode=="function"?s.getRootNode():s.nodeType===9?s:s.ownerDocument}var Zr=$.d;$.d={f:PN,r:UN,D:qN,C:$N,L:FN,m:HN,X:KN,S:VN,M:GN};function PN(){var s=Zr.f(),a=Tc();return s||a}function UN(s){var a=oo(s);a!==null&&a.tag===5&&a.type==="form"?xv(a):Zr.r(s)}var Po=typeof document>"u"?null:document;function cS(s,a,u){var h=Po;if(h&&typeof a=="string"&&a){var g=Gn(a);g='link[rel="'+s+'"][href="'+g+'"]',typeof u=="string"&&(g+='[crossorigin="'+u+'"]'),uS.has(g)||(uS.add(g),s={rel:s,crossOrigin:u,href:a},h.querySelector(g)===null&&(a=h.createElement("link"),an(a,"link",s),Xt(a),h.head.appendChild(a)))}}function qN(s){Zr.D(s),cS("dns-prefetch",s,null)}function $N(s,a){Zr.C(s,a),cS("preconnect",s,a)}function FN(s,a,u){Zr.L(s,a,u);var h=Po;if(h&&s&&a){var g='link[rel="preload"][as="'+Gn(a)+'"]';a==="image"&&u&&u.imageSrcSet?(g+='[imagesrcset="'+Gn(u.imageSrcSet)+'"]',typeof u.imageSizes=="string"&&(g+='[imagesizes="'+Gn(u.imageSizes)+'"]')):g+='[href="'+Gn(s)+'"]';var v=g;switch(a){case"style":v=Uo(s);break;case"script":v=qo(s)}tr.has(v)||(s=m({rel:"preload",href:a==="image"&&u&&u.imageSrcSet?void 0:s,as:a},u),tr.set(v,s),h.querySelector(g)!==null||a==="style"&&h.querySelector(dl(v))||a==="script"&&h.querySelector(fl(v))||(a=h.createElement("link"),an(a,"link",s),Xt(a),h.head.appendChild(a)))}}function HN(s,a){Zr.m(s,a);var u=Po;if(u&&s){var h=a&&typeof a.as=="string"?a.as:"script",g='link[rel="modulepreload"][as="'+Gn(h)+'"][href="'+Gn(s)+'"]',v=g;switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":v=qo(s)}if(!tr.has(v)&&(s=m({rel:"modulepreload",href:s},a),tr.set(v,s),u.querySelector(g)===null)){switch(h){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(u.querySelector(fl(v)))return}h=u.createElement("link"),an(h,"link",s),Xt(h),u.head.appendChild(h)}}}function VN(s,a,u){Zr.S(s,a,u);var h=Po;if(h&&s){var g=ao(h).hoistableStyles,v=Uo(s);a=a||"default";var _=g.get(v);if(!_){var x={loading:0,preload:null};if(_=h.querySelector(dl(v)))x.loading=5;else{s=m({rel:"stylesheet",href:s,"data-precedence":a},u),(u=tr.get(v))&&rm(s,u);var D=_=h.createElement("link");Xt(D),an(D,"link",s),D._p=new Promise(function(K,W){D.onload=K,D.onerror=W}),D.addEventListener("load",function(){x.loading|=1}),D.addEventListener("error",function(){x.loading|=2}),x.loading|=4,Dc(_,a,h)}_={type:"stylesheet",instance:_,count:1,state:x},g.set(v,_)}}}function KN(s,a){Zr.X(s,a);var u=Po;if(u&&s){var h=ao(u).hoistableScripts,g=qo(s),v=h.get(g);v||(v=u.querySelector(fl(g)),v||(s=m({src:s,async:!0},a),(a=tr.get(g))&&im(s,a),v=u.createElement("script"),Xt(v),an(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function GN(s,a){Zr.M(s,a);var u=Po;if(u&&s){var h=ao(u).hoistableScripts,g=qo(s),v=h.get(g);v||(v=u.querySelector(fl(g)),v||(s=m({src:s,async:!0,type:"module"},a),(a=tr.get(g))&&im(s,a),v=u.createElement("script"),Xt(v),an(v,"link",s),u.head.appendChild(v)),v={type:"script",instance:v,count:1,state:null},h.set(g,v))}}function dS(s,a,u,h){var g=(g=ve.current)?Rc(g):null;if(!g)throw Error(r(446));switch(s){case"meta":case"title":return null;case"style":return typeof u.precedence=="string"&&typeof u.href=="string"?(a=Uo(u.href),u=ao(g).hoistableStyles,h=u.get(a),h||(h={type:"style",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};case"link":if(u.rel==="stylesheet"&&typeof u.href=="string"&&typeof u.precedence=="string"){s=Uo(u.href);var v=ao(g).hoistableStyles,_=v.get(s);if(_||(g=g.ownerDocument||g,_={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},v.set(s,_),(v=g.querySelector(dl(s)))&&!v._p&&(_.instance=v,_.state.loading=5),tr.has(s)||(u={rel:"preload",as:"style",href:u.href,crossOrigin:u.crossOrigin,integrity:u.integrity,media:u.media,hrefLang:u.hrefLang,referrerPolicy:u.referrerPolicy},tr.set(s,u),v||YN(g,s,u,_.state))),a&&h===null)throw Error(r(528,""));return _}if(a&&h!==null)throw Error(r(529,""));return null;case"script":return a=u.async,u=u.src,typeof u=="string"&&a&&typeof a!="function"&&typeof a!="symbol"?(a=qo(u),u=ao(g).hoistableScripts,h=u.get(a),h||(h={type:"script",instance:null,count:0,state:null},u.set(a,h)),h):{type:"void",instance:null,count:0,state:null};default:throw Error(r(444,s))}}function Uo(s){return'href="'+Gn(s)+'"'}function dl(s){return'link[rel="stylesheet"]['+s+"]"}function fS(s){return m({},s,{"data-precedence":s.precedence,precedence:null})}function YN(s,a,u,h){s.querySelector('link[rel="preload"][as="style"]['+a+"]")?h.loading=1:(a=s.createElement("link"),h.preload=a,a.addEventListener("load",function(){return h.loading|=1}),a.addEventListener("error",function(){return h.loading|=2}),an(a,"link",u),Xt(a),s.head.appendChild(a))}function qo(s){return'[src="'+Gn(s)+'"]'}function fl(s){return"script[async]"+s}function hS(s,a,u){if(a.count++,a.instance===null)switch(a.type){case"style":var h=s.querySelector('style[data-href~="'+Gn(u.href)+'"]');if(h)return a.instance=h,Xt(h),h;var g=m({},u,{"data-href":u.href,"data-precedence":u.precedence,href:null,precedence:null});return h=(s.ownerDocument||s).createElement("style"),Xt(h),an(h,"style",g),Dc(h,u.precedence,s),a.instance=h;case"stylesheet":g=Uo(u.href);var v=s.querySelector(dl(g));if(v)return a.state.loading|=4,a.instance=v,Xt(v),v;h=fS(u),(g=tr.get(g))&&rm(h,g),v=(s.ownerDocument||s).createElement("link"),Xt(v);var _=v;return _._p=new Promise(function(x,D){_.onload=x,_.onerror=D}),an(v,"link",h),a.state.loading|=4,Dc(v,u.precedence,s),a.instance=v;case"script":return v=qo(u.src),(g=s.querySelector(fl(v)))?(a.instance=g,Xt(g),g):(h=u,(g=tr.get(v))&&(h=m({},u),im(h,g)),s=s.ownerDocument||s,g=s.createElement("script"),Xt(g),an(g,"link",h),s.head.appendChild(g),a.instance=g);case"void":return null;default:throw Error(r(443,a.type))}else a.type==="stylesheet"&&(a.state.loading&4)===0&&(h=a.instance,a.state.loading|=4,Dc(h,u.precedence,s));return a.instance}function Dc(s,a,u){for(var h=u.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),g=h.length?h[h.length-1]:null,v=g,_=0;_<h.length;_++){var x=h[_];if(x.dataset.precedence===a)v=x;else if(v!==g)break}v?v.parentNode.insertBefore(s,v.nextSibling):(a=u.nodeType===9?u.head:u,a.insertBefore(s,a.firstChild))}function rm(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.title==null&&(s.title=a.title)}function im(s,a){s.crossOrigin==null&&(s.crossOrigin=a.crossOrigin),s.referrerPolicy==null&&(s.referrerPolicy=a.referrerPolicy),s.integrity==null&&(s.integrity=a.integrity)}var Ic=null;function pS(s,a,u){if(Ic===null){var h=new Map,g=Ic=new Map;g.set(u,h)}else g=Ic,h=g.get(u),h||(h=new Map,g.set(u,h));if(h.has(s))return h;for(h.set(s,null),u=u.getElementsByTagName(s),g=0;g<u.length;g++){var v=u[g];if(!(v[ka]||v[nn]||s==="link"&&v.getAttribute("rel")==="stylesheet")&&v.namespaceURI!=="http://www.w3.org/2000/svg"){var _=v.getAttribute(a)||"";_=s+_;var x=h.get(_);x?x.push(v):h.set(_,[v])}}return h}function mS(s,a,u){s=s.ownerDocument||s,s.head.insertBefore(u,a==="title"?s.querySelector("head > title"):null)}function QN(s,a,u){if(u===1||a.itemProp!=null)return!1;switch(s){case"meta":case"title":return!0;case"style":if(typeof a.precedence!="string"||typeof a.href!="string"||a.href==="")break;return!0;case"link":if(typeof a.rel!="string"||typeof a.href!="string"||a.href===""||a.onLoad||a.onError)break;return a.rel==="stylesheet"?(s=a.disabled,typeof a.precedence=="string"&&s==null):!0;case"script":if(a.async&&typeof a.async!="function"&&typeof a.async!="symbol"&&!a.onLoad&&!a.onError&&a.src&&typeof a.src=="string")return!0}return!1}function yS(s){return!(s.type==="stylesheet"&&(s.state.loading&3)===0)}function XN(s,a,u,h){if(u.type==="stylesheet"&&(typeof h.media!="string"||matchMedia(h.media).matches!==!1)&&(u.state.loading&4)===0){if(u.instance===null){var g=Uo(h.href),v=a.querySelector(dl(g));if(v){a=v._p,a!==null&&typeof a=="object"&&typeof a.then=="function"&&(s.count++,s=Lc.bind(s),a.then(s,s)),u.state.loading|=4,u.instance=v,Xt(v);return}v=a.ownerDocument||a,h=fS(h),(g=tr.get(g))&&rm(h,g),v=v.createElement("link"),Xt(v);var _=v;_._p=new Promise(function(x,D){_.onload=x,_.onerror=D}),an(v,"link",h),u.instance=v}s.stylesheets===null&&(s.stylesheets=new Map),s.stylesheets.set(u,a),(a=u.state.preload)&&(u.state.loading&3)===0&&(s.count++,u=Lc.bind(s),a.addEventListener("load",u),a.addEventListener("error",u))}}var sm=0;function JN(s,a){return s.stylesheets&&s.count===0&&Bc(s,s.stylesheets),0<s.count||0<s.imgCount?function(u){var h=setTimeout(function(){if(s.stylesheets&&Bc(s,s.stylesheets),s.unsuspend){var v=s.unsuspend;s.unsuspend=null,v()}},6e4+a);0<s.imgBytes&&sm===0&&(sm=62500*NN());var g=setTimeout(function(){if(s.waitingForImages=!1,s.count===0&&(s.stylesheets&&Bc(s,s.stylesheets),s.unsuspend)){var v=s.unsuspend;s.unsuspend=null,v()}},(s.imgBytes>sm?50:800)+a);return s.unsuspend=u,function(){s.unsuspend=null,clearTimeout(h),clearTimeout(g)}}:null}function Lc(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)Bc(this,this.stylesheets);else if(this.unsuspend){var s=this.unsuspend;this.unsuspend=null,s()}}}var jc=null;function Bc(s,a){s.stylesheets=null,s.unsuspend!==null&&(s.count++,jc=new Map,a.forEach(WN,s),jc=null,Lc.call(s))}function WN(s,a){if(!(a.state.loading&4)){var u=jc.get(s);if(u)var h=u.get(null);else{u=new Map,jc.set(s,u);for(var g=s.querySelectorAll("link[data-precedence],style[data-precedence]"),v=0;v<g.length;v++){var _=g[v];(_.nodeName==="LINK"||_.getAttribute("media")!=="not all")&&(u.set(_.dataset.precedence,_),h=_)}h&&u.set(null,h)}g=a.instance,_=g.getAttribute("data-precedence"),v=u.get(_)||h,v===h&&u.set(null,g),u.set(_,g),this.count++,h=Lc.bind(this),g.addEventListener("load",h),g.addEventListener("error",h),v?v.parentNode.insertBefore(g,v.nextSibling):(s=s.nodeType===9?s.head:s,s.insertBefore(g,s.firstChild)),a.state.loading|=4}}var hl={$$typeof:j,Provider:null,Consumer:null,_currentValue:ie,_currentValue2:ie,_threadCount:0};function ZN(s,a,u,h,g,v,_,x,D){this.tag=1,this.containerInfo=s,this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=eh(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=eh(0),this.hiddenUpdates=eh(null),this.identifierPrefix=h,this.onUncaughtError=g,this.onCaughtError=v,this.onRecoverableError=_,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=D,this.incompleteTransitions=new Map}function gS(s,a,u,h,g,v,_,x,D,K,W,ne){return s=new ZN(s,a,u,_,D,K,W,ne,x),a=1,v===!0&&(a|=24),v=Bn(3,null,null,a),s.current=v,v.stateNode=s,a=zh(),a.refCount++,s.pooledCache=a,a.refCount++,v.memoizedState={element:h,isDehydrated:u,cache:a},$h(v),s}function bS(s){return s?(s=bo,s):bo}function vS(s,a,u,h,g,v){g=bS(g),h.context===null?h.context=g:h.pendingContext=g,h=Ei(a),h.payload={element:u},v=v===void 0?null:v,v!==null&&(h.callback=v),u=Mi(s,h,a),u!==null&&(An(u,s,a),Va(u,s,a))}function SS(s,a){if(s=s.memoizedState,s!==null&&s.dehydrated!==null){var u=s.retryLane;s.retryLane=u!==0&&u<a?u:a}}function om(s,a){SS(s,a),(s=s.alternate)&&SS(s,a)}function wS(s){if(s.tag===13||s.tag===31){var a=ys(s,67108864);a!==null&&An(a,s,67108864),om(s,67108864)}}function _S(s){if(s.tag===13||s.tag===31){var a=$n();a=th(a);var u=ys(s,a);u!==null&&An(u,s,a),om(s,a)}}var zc=!0;function eR(s,a,u,h){var g=R.T;R.T=null;var v=$.p;try{$.p=2,am(s,a,u,h)}finally{$.p=v,R.T=g}}function tR(s,a,u,h){var g=R.T;R.T=null;var v=$.p;try{$.p=8,am(s,a,u,h)}finally{$.p=v,R.T=g}}function am(s,a,u,h){if(zc){var g=lm(h);if(g===null)Gp(s,a,h,Pc,u),ES(s,h);else if(rR(g,s,a,u,h))h.stopPropagation();else if(ES(s,h),a&4&&-1<nR.indexOf(s)){for(;g!==null;){var v=oo(g);if(v!==null)switch(v.tag){case 3:if(v=v.stateNode,v.current.memoizedState.isDehydrated){var _=ds(v.pendingLanes);if(_!==0){var x=v;for(x.pendingLanes|=2,x.entangledLanes|=2;_;){var D=1<<31-Ke(_);x.entanglements[1]|=D,_&=~D}Cr(v),(ut&6)===0&&(wc=Qe()+500,al(0))}}break;case 31:case 13:x=ys(v,2),x!==null&&An(x,v,2),Tc(),om(v,2)}if(v=lm(h),v===null&&Gp(s,a,h,Pc,u),v===g)break;g=v}g!==null&&h.stopPropagation()}else Gp(s,a,h,null,u)}}function lm(s){return s=ch(s),um(s)}var Pc=null;function um(s){if(Pc=null,s=so(s),s!==null){var a=o(s);if(a===null)s=null;else{var u=a.tag;if(u===13){if(s=l(a),s!==null)return s;s=null}else if(u===31){if(s=c(a),s!==null)return s;s=null}else if(u===3){if(a.stateNode.current.memoizedState.isDehydrated)return a.tag===3?a.stateNode.containerInfo:null;s=null}else a!==s&&(s=null)}}return Pc=s,null}function TS(s){switch(s){case"beforetoggle":case"cancel":case"click":case"close":case"contextmenu":case"copy":case"cut":case"auxclick":case"dblclick":case"dragend":case"dragstart":case"drop":case"focusin":case"focusout":case"input":case"invalid":case"keydown":case"keypress":case"keyup":case"mousedown":case"mouseup":case"paste":case"pause":case"play":case"pointercancel":case"pointerdown":case"pointerup":case"ratechange":case"reset":case"resize":case"seeked":case"submit":case"toggle":case"touchcancel":case"touchend":case"touchstart":case"volumechange":case"change":case"selectionchange":case"textInput":case"compositionstart":case"compositionend":case"compositionupdate":case"beforeblur":case"afterblur":case"beforeinput":case"blur":case"fullscreenchange":case"focus":case"hashchange":case"popstate":case"select":case"selectstart":return 2;case"drag":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"mousemove":case"mouseout":case"mouseover":case"pointermove":case"pointerout":case"pointerover":case"scroll":case"touchmove":case"wheel":case"mouseenter":case"mouseleave":case"pointerenter":case"pointerleave":return 8;case"message":switch(Vn()){case Tr:return 2;case Lr:return 8;case ue:case ae:return 32;case be:return 268435456;default:return 32}default:return 32}}var cm=!1,ji=null,Bi=null,zi=null,pl=new Map,ml=new Map,Pi=[],nR="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset".split(" ");function ES(s,a){switch(s){case"focusin":case"focusout":ji=null;break;case"dragenter":case"dragleave":Bi=null;break;case"mouseover":case"mouseout":zi=null;break;case"pointerover":case"pointerout":pl.delete(a.pointerId);break;case"gotpointercapture":case"lostpointercapture":ml.delete(a.pointerId)}}function yl(s,a,u,h,g,v){return s===null||s.nativeEvent!==v?(s={blockedOn:a,domEventName:u,eventSystemFlags:h,nativeEvent:v,targetContainers:[g]},a!==null&&(a=oo(a),a!==null&&wS(a)),s):(s.eventSystemFlags|=h,a=s.targetContainers,g!==null&&a.indexOf(g)===-1&&a.push(g),s)}function rR(s,a,u,h,g){switch(a){case"focusin":return ji=yl(ji,s,a,u,h,g),!0;case"dragenter":return Bi=yl(Bi,s,a,u,h,g),!0;case"mouseover":return zi=yl(zi,s,a,u,h,g),!0;case"pointerover":var v=g.pointerId;return pl.set(v,yl(pl.get(v)||null,s,a,u,h,g)),!0;case"gotpointercapture":return v=g.pointerId,ml.set(v,yl(ml.get(v)||null,s,a,u,h,g)),!0}return!1}function MS(s){var a=so(s.target);if(a!==null){var u=o(a);if(u!==null){if(a=u.tag,a===13){if(a=l(u),a!==null){s.blockedOn=a,P0(s.priority,function(){_S(u)});return}}else if(a===31){if(a=c(u),a!==null){s.blockedOn=a,P0(s.priority,function(){_S(u)});return}}else if(a===3&&u.stateNode.current.memoizedState.isDehydrated){s.blockedOn=u.tag===3?u.stateNode.containerInfo:null;return}}}s.blockedOn=null}function Uc(s){if(s.blockedOn!==null)return!1;for(var a=s.targetContainers;0<a.length;){var u=lm(s.nativeEvent);if(u===null){u=s.nativeEvent;var h=new u.constructor(u.type,u);uh=h,u.target.dispatchEvent(h),uh=null}else return a=oo(u),a!==null&&wS(a),s.blockedOn=u,!1;a.shift()}return!0}function xS(s,a,u){Uc(s)&&u.delete(a)}function iR(){cm=!1,ji!==null&&Uc(ji)&&(ji=null),Bi!==null&&Uc(Bi)&&(Bi=null),zi!==null&&Uc(zi)&&(zi=null),pl.forEach(xS),ml.forEach(xS)}function qc(s,a){s.blockedOn===a&&(s.blockedOn=null,cm||(cm=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,iR)))}var $c=null;function CS(s){$c!==s&&($c=s,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){$c===s&&($c=null);for(var a=0;a<s.length;a+=3){var u=s[a],h=s[a+1],g=s[a+2];if(typeof h!="function"){if(um(h||u)===null)continue;break}var v=oo(u);v!==null&&(s.splice(a,3),a-=3,lp(v,{pending:!0,data:g,method:u.method,action:h},h,g))}}))}function $o(s){function a(D){return qc(D,s)}ji!==null&&qc(ji,s),Bi!==null&&qc(Bi,s),zi!==null&&qc(zi,s),pl.forEach(a),ml.forEach(a);for(var u=0;u<Pi.length;u++){var h=Pi[u];h.blockedOn===s&&(h.blockedOn=null)}for(;0<Pi.length&&(u=Pi[0],u.blockedOn===null);)MS(u),u.blockedOn===null&&Pi.shift();if(u=(s.ownerDocument||s).$$reactFormReplay,u!=null)for(h=0;h<u.length;h+=3){var g=u[h],v=u[h+1],_=g[Tn]||null;if(typeof v=="function")_||CS(u);else if(_){var x=null;if(v&&v.hasAttribute("formAction")){if(g=v,_=v[Tn]||null)x=_.formAction;else if(um(g)!==null)continue}else x=_.action;typeof x=="function"?u[h+1]=x:(u.splice(h,3),h-=3),CS(u)}}}function kS(){function s(v){v.canIntercept&&v.info==="react-transition"&&v.intercept({handler:function(){return new Promise(function(_){return g=_})},focusReset:"manual",scroll:"manual"})}function a(){g!==null&&(g(),g=null),h||setTimeout(u,20)}function u(){if(!h&&!navigation.transition){var v=navigation.currentEntry;v&&v.url!=null&&navigation.navigate(v.url,{state:v.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var h=!1,g=null;return navigation.addEventListener("navigate",s),navigation.addEventListener("navigatesuccess",a),navigation.addEventListener("navigateerror",a),setTimeout(u,100),function(){h=!0,navigation.removeEventListener("navigate",s),navigation.removeEventListener("navigatesuccess",a),navigation.removeEventListener("navigateerror",a),g!==null&&(g(),g=null)}}}function dm(s){this._internalRoot=s}Fc.prototype.render=dm.prototype.render=function(s){var a=this._internalRoot;if(a===null)throw Error(r(409));var u=a.current,h=$n();vS(u,h,s,a,null,null)},Fc.prototype.unmount=dm.prototype.unmount=function(){var s=this._internalRoot;if(s!==null){this._internalRoot=null;var a=s.containerInfo;vS(s.current,2,null,s,null,null),Tc(),a[io]=null}};function Fc(s){this._internalRoot=s}Fc.prototype.unstable_scheduleHydration=function(s){if(s){var a=z0();s={blockedOn:null,target:s,priority:a};for(var u=0;u<Pi.length&&a!==0&&a<Pi[u].priority;u++);Pi.splice(u,0,s),u===0&&MS(s)}};var AS=e.version;if(AS!=="19.2.4")throw Error(r(527,AS,"19.2.4"));$.findDOMNode=function(s){var a=s._reactInternals;if(a===void 0)throw typeof s.render=="function"?Error(r(188)):(s=Object.keys(s).join(","),Error(r(268,s)));return s=f(a),s=s!==null?p(s):null,s=s===null?null:s.stateNode,s};var sR={bundleType:0,version:"19.2.4",rendererPackageName:"react-dom",currentDispatcherRef:R,reconcilerVersion:"19.2.4"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var Hc=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!Hc.isDisabled&&Hc.supportsFiber)try{Ve=Hc.inject(sR),rt=Hc}catch{}}return bl.createRoot=function(s,a){if(!i(s))throw Error(r(299));var u=!1,h="",g=jv,v=Bv,_=zv;return a!=null&&(a.unstable_strictMode===!0&&(u=!0),a.identifierPrefix!==void 0&&(h=a.identifierPrefix),a.onUncaughtError!==void 0&&(g=a.onUncaughtError),a.onCaughtError!==void 0&&(v=a.onCaughtError),a.onRecoverableError!==void 0&&(_=a.onRecoverableError)),a=gS(s,1,!1,null,null,u,h,null,g,v,_,kS),s[io]=a.current,Kp(s),new dm(a)},bl.hydrateRoot=function(s,a,u){if(!i(s))throw Error(r(299));var h=!1,g="",v=jv,_=Bv,x=zv,D=null;return u!=null&&(u.unstable_strictMode===!0&&(h=!0),u.identifierPrefix!==void 0&&(g=u.identifierPrefix),u.onUncaughtError!==void 0&&(v=u.onUncaughtError),u.onCaughtError!==void 0&&(_=u.onCaughtError),u.onRecoverableError!==void 0&&(x=u.onRecoverableError),u.formState!==void 0&&(D=u.formState)),a=gS(s,1,!0,a,u??null,h,g,D,v,_,x,kS),a.context=bS(null),u=a.current,h=$n(),h=th(h),g=Ei(h),g.callback=null,Mi(u,g,h),u=h,a.current.lanes=u,Ca(a,u),Cr(a),s[io]=a.current,Kp(s),new Fc(a)},bl.version="19.2.4",bl}var XS;function qR(){if(XS)return mm.exports;XS=1;function t(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(t)}catch(e){console.error(e)}}return t(),mm.exports=UR(),mm.exports}var $R=qR();let vm=null,JS=null;function FR(){const t=document.getElementById("root");if(!t)throw new Error('Unable to render plugin: root container "#root" was not found.');return t}function WS(t){const e=FR();(!vm||JS!==e)&&(vm=$R.createRoot(e),JS=e),vm.render(E.jsx(C.StrictMode,{children:t}))}var Sm={exports:{}};var ZS;function HR(){return ZS||(ZS=1,(function(t){(function(){var e={}.hasOwnProperty;function n(){for(var o="",l=0;l<arguments.length;l++){var c=arguments[l];c&&(o=i(o,r(c)))}return o}function r(o){if(typeof o=="string"||typeof o=="number")return o;if(typeof o!="object")return"";if(Array.isArray(o))return n.apply(null,o);if(o.toString!==Object.prototype.toString&&!o.toString.toString().includes("[native code]"))return o.toString();var l="";for(var c in o)e.call(o,c)&&o[c]&&(l=i(l,c));return l}function i(o,l){return l?o?o+" "+l:o+l:o}t.exports?(n.default=n,t.exports=n):window.classNames=n})()})(Sm)),Sm.exports}var VR=HR();const vr=Ea(VR),KR="_button_474wk_1",GR="_disabled_474wk_30",YR="_fullWidth_474wk_118",QR="_button__leftIcon_474wk_124",XR="_button__rightIcon_474wk_125",Os={button:KR,disabled:GR,"buttonType-muted":"_buttonType-muted_474wk_34","buttonType-primary":"_buttonType-primary_474wk_50","buttonType-negative":"_buttonType-negative_474wk_71","buttonSize-xxs":"_buttonSize-xxs_474wk_88","buttonSize-xs":"_buttonSize-xs_474wk_93","buttonSize-s":"_buttonSize-s_474wk_98","buttonSize-m":"_buttonSize-m_474wk_103","buttonSize-l":"_buttonSize-l_474wk_108","buttonSize-xl":"_buttonSize-xl_474wk_113",fullWidth:YR,button__leftIcon:QR,button__rightIcon:XR};function Fo(t){var e,n=t.children,r=t.className,i=t.disabled,o=t.buttonType,l=o===void 0?"muted":o,c=t.buttonSize,d=c===void 0?"m":c,f=t.fullWidth,p=t.onClick,m=t.style,y=t.leftIcon,b=t.rightIcon,S=t.type,w=S===void 0?"button":S;return Le.createElement("button",{type:w,className:vr(Os.button,Os["buttonType-".concat(l)],Os["buttonSize-".concat(d)],(e={},e[Os.disabled]=i,e[Os.fullWidth]=f,e),r),disabled:i,onClick:p,style:m},y&&Le.createElement("span",{className:Os.button__leftIcon},y),n&&Le.createElement("span",null,n),b&&Le.createElement("span",{className:Os.button__rightIcon},b))}var by=function(){return by=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},by.apply(this,arguments)};function ew(t){return t===t.toLowerCase()?t:t.replace(/[A-Z]/g,function(e){return"-".concat(e.toLowerCase())})}function JR(t,e){return e===void 0&&(e=!1),by({padding:e?void 0:t.bodyPadding.map(function(n){return"".concat(n,"px")}).join(" ")},Object.fromEntries(Object.entries(t.theme).flatMap(function(n){var r,i=n[0],o=n[1];return[["--".concat(ew(i)),o],["--".concat(ew("".concat(i,"RgbComponents"))),((r=o.match(/rgb\((\d+, \d+, \d+)\)/))===null||r===void 0?void 0:r[1])||void 0]]})))}const WR="_themeVariables_2dr1w_1",ZR="_canvas_2dr1w_70",tw={themeVariables:WR,canvas:ZR};var e2=C.createContext(null);function _d(t){var e=t.ctx,n=t.children,r=t.noAutoResizer,i=e.mode;return C.useEffect(function(){if(!r&&"startAutoResizer"in e){var o=e;return o.startAutoResizer(),function(){o.stopAutoResizer()}}},[i,r]),Le.createElement(e2.Provider,{value:e},Le.createElement("div",{className:vr(tw.themeVariables,tw.canvas),style:JR(e)},n))}var IE=DE();const t2=Ea(IE),n2="_fieldError_qi0xk_1",r2={fieldError:n2};function LE(t){var e=t.children;return Le.createElement("div",{className:r2.fieldError},e)}const i2="_fieldHint_1avon_1",s2={fieldHint:i2};function jE(t){var e=t.children;return Le.createElement("div",{className:s2.fieldHint},e)}var vy=function(){return vy=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},vy.apply(this,arguments)};function o2(t){var e=t.id,n=t.label,r=t.hint,i=t.error,o=t.required,l=t.formLabelProps,c=t.children;return Le.createElement(Le.Fragment,null,Le.createElement(BE,vy({},l,{htmlFor:e,required:o,error:!!i}),n),c,i&&Le.createElement(LE,null,i),r&&Le.createElement(jE,null,r))}const a2="_formLabel_tcjrv_1",l2="_formLabel__code_tcjrv_8",u2="_formLabel__label_tcjrv_18",c2="_formLabel__required_tcjrv_30",vl={formLabel:a2,formLabel__code:l2,"formLabel--error":"_formLabel--error_tcjrv_14",formLabel__label:u2,formLabel__required:c2};var Sy=function(){return Sy=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Sy.apply(this,arguments)},d2=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},BE=function(t){var e,n=t.children,r=t.className,i=t.htmlFor,o=t.code,l=t.required,c=l===void 0?!1:l,d=t.error,f=d===void 0?!1:d,p=d2(t,["children","className","htmlFor","code","required","error"]),m=vr(vl.formLabel,r,(e={},e[vl["formLabel--error"]]=f,e));return Le.createElement("label",Sy({className:m,htmlFor:i},p),Le.createElement("span",{className:vl.formLabel__label},n,c&&Le.createElement("span",{className:vl.formLabel__required},"*")),o&&Le.createElement("span",{className:vl.formLabel__code},o))};const f2="_Section_zh95u_1",h2="_Section__header_zh95u_19",p2="_Section__title_zh95u_38",m2="_Section__title__content_zh95u_52",y2="_Section__arrow_zh95u_55",Ns={Section:f2,"Section--highlighted":"_Section--highlighted_zh95u_5",Section__header:h2,Section__title:p2,Section__title__content:m2,Section__arrow:y2,"Section__arrow--is-open":"_Section__arrow--is-open_zh95u_82"};function g2(t){var e,n,r=t.title,i=t.children,o=t.highlighted,l=t.collapsible,c=t.headerClassName,d=t.titleClassName,f=t.headerStyle,p=t.titleStyle;return Le.createElement("div",{className:vr(Ns.Section,(e={},e[Ns["Section--highlighted"]]=o,e))},Le.createElement("div",{className:vr(Ns.Section__header,c),style:f},Le.createElement("div",{className:vr(Ns.Section__title,d),style:p},l&&Le.createElement("button",{type:"button",className:vr(Ns.Section__arrow,(n={},n[Ns["Section__arrow--is-open"]]=l.isOpen,n)),onClick:l.onToggle}),Le.createElement("div",{className:Ns.Section__title__content},r))),(!l||l.isOpen)&&i)}var nw=Number.isNaN||function(e){return typeof e=="number"&&e!==e};function b2(t,e){return!!(t===e||nw(t)&&nw(e))}function v2(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!b2(t[n],e[n]))return!1;return!0}function S2(t,e){e===void 0&&(e=v2);var n=null;function r(){for(var i=[],o=0;o<arguments.length;o++)i[o]=arguments[o];if(n&&n.lastThis===this&&e(i,n.lastArgs))return n.lastResult;var l=t.apply(this,i);return n={lastResult:l,lastArgs:i,lastThis:this},l}return r.clear=function(){n=null},r}const w2="_Spinner__bar_oumod_13",wm={"Spinner--inline":"_Spinner--inline_oumod_1","Spinner--centered":"_Spinner--centered_oumod_7",Spinner__bar:w2};var Dd=function(){return Dd=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Dd.apply(this,arguments)};function wy(t){for(var e,n=t.size,r=n===void 0?32:n,i=t.placement,o=i===void 0?"inline":i,l=t.style,c=l===void 0?{}:l,d=[],f=0;f<12;f+=1){var p={};p.animationDelay="".concat((f-12)/10,"s"),p.transform="rotate(".concat(f*30,"deg) translate(146%)"),d.push(Le.createElement("div",{style:p,className:wm.Spinner__bar,key:f}))}var m={width:r*.5,height:r*.5};return o==="inline"&&(m.marginLeft=r*.5,m.transform="translateY(33%)"),Le.createElement("div",{className:vr((e={},e[wm["Spinner--inline"]]=o==="inline",e[wm["Spinner--centered"]]=o==="centered",e)),style:Dd(Dd({},c),m)},d)}const _2="_switchField__flex_16z4j_1",T2="_switchField__switchInput_16z4j_6",E2="_switchField__label_16z4j_10",M2="_switchField__below_16z4j_22",Jc={switchField__flex:_2,switchField__switchInput:T2,switchField__label:E2,switchField__below:M2};var Id=function(){return Id=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Id.apply(this,arguments)};function rw(t){var e=t.id,n=t.name,r=t.label,i=t.hint,o=t.error,l=t.required,c=t.formLabelProps,d=t.value,f=t.onChange,p=t.switchInputProps;return Le.createElement(Le.Fragment,null,Le.createElement("div",{className:Jc.switchField__flex},Le.createElement("div",{className:Jc.switchField__switchInput},Le.createElement(N2,Id({},p,{name:n,value:d,onChange:f}))),Le.createElement(BE,Id({},c,{htmlFor:e,required:l,className:vr(Jc.switchField__label,c?.className),error:!!o}),r)),(i||o)&&Le.createElement("div",{className:Jc.switchField__below},o&&Le.createElement(LE,null,o),i&&Le.createElement(jE,null,i)))}const x2="_switchInput__inner_1knbg_1",C2="_switchInput_1knbg_1",k2="_switchInput__checked_1knbg_47",A2="_switchInput__disabled_1knbg_60",Wc={switchInput__inner:x2,switchInput:C2,switchInput__checked:k2,switchInput__disabled:A2};var _y=function(){return _y=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},_y.apply(this,arguments)},O2=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function N2(t){var e,n=t.className,r=t.value,i=t.disabled,o=t.onClick,l=t.onChange,c=t.onKeyDown,d=O2(t,["className","value","disabled","onClick","onChange","onKeyDown"]);function f(b,S){!i&&l&&l(b,S)}function p(b){b.key==="ArrowLeft"?f(!1,b):b.key==="ArrowRight"&&f(!0,b),c?.(b)}function m(b){f(!r,b),o?.(b)}var y=vr(Wc.switchInput,n,(e={},e[Wc.switchInput__checked]=r,e[Wc.switchInput__disabled]=i,e));return Le.createElement("button",_y({},d,{type:"button",role:"switch","aria-checked":r,disabled:i,className:y,onKeyDown:p,onClick:m}),Le.createElement("span",{className:Wc.switchInput__inner}))}var Ty=function(){return Ty=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Ty.apply(this,arguments)};function R2(t){var e=t.id,n=t.name,r=t.label,i=t.hint,o=t.error,l=t.required,c=t.placeholder,d=t.formLabelProps,f=t.value,p=t.onChange,m=t.textInputProps;return Le.createElement(o2,{formLabelProps:d,id:e,required:l,error:o,hint:i,label:r},Le.createElement(L2,Ty({},m,{id:e,name:n,value:f,placeholder:c,onChange:p,error:!!o})))}const D2="_TextInput_x2oj2_1",Zc={TextInput:D2,"TextInput--monospaced":"_TextInput--monospaced_x2oj2_30","TextInput--disabled":"_TextInput--disabled_x2oj2_35","TextInput--error":"_TextInput--error_x2oj2_41"};var Ey=function(){return Ey=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},Ey.apply(this,arguments)},I2=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},L2=function(t){var e,n=t.className,r=t.disabled,i=r===void 0?!1:r,o=t.error,l=t.id,c=t.inputRef,d=t.maxLength,f=t.name,p=t.labelText,m=t.onBlur,y=t.onChange,b=t.placeholder,S=t.required,w=S===void 0?!1:S,T=t.type,M=t.value,k=t.monospaced,j=I2(t,["className","disabled","error","id","inputRef","maxLength","name","labelText","onBlur","onChange","placeholder","required","type","value","monospaced"]),I=C.useCallback(function(P){y&&y(P.target.value,P)},[y]),O=vr(Zc.TextInput,n,(e={},e[Zc["TextInput--disabled"]]=i,e[Zc["TextInput--error"]]=o,e[Zc["TextInput--monospaced"]]=k,e));return Le.createElement("input",Ey({className:O,"aria-label":p,id:l,name:f,required:w,placeholder:b,maxLength:d,disabled:i,onBlur:m,onChange:I,value:M,type:T,ref:c},j))};function j2(t,e){C.useEffect(()=>{t.current&&typeof t.current.scrollIntoView=="function"&&t.current.scrollIntoView({block:"nearest",behavior:"smooth"})},[e])}function zE(t,e){const n=C.useRef(e);C.useLayoutEffect(()=>{n.current=e}),C.useEffect(()=>{const r=i=>{t.current&&!t.current.contains(i.target)&&n.current()};return document.addEventListener("mousedown",r),()=>document.removeEventListener("mousedown",r)},[t])}function ct(...t){return t.filter(Boolean).join(" ")}const B2="_comment_1154w_2",z2="_commentBody_1154w_7",P2="_reply_1154w_22",U2="_avatarContainer_1154w_27",q2="_avatar_1154w_27",$2="_content_1154w_39",F2="_header_1154w_46",H2="_authorName_1154w_53",V2="_timestamp_1154w_60",K2="_text_1154w_67",G2="_editContainer_1154w_77",Y2="_composerBox_1154w_85",Q2="_composerBoxCompact_1154w_107",X2="_footer_1154w_137",J2="_reaction_1154w_145",W2="_reactionActive_1154w_165",Z2="_reactionWrapper_1154w_176",eD="_tooltip_1154w_182 _tooltipBase_pq2lx_22",tD="_tooltipArrow_1154w_186 _tooltipArrowDown_pq2lx_51",nD="_replyToggle_1154w_196",rD="_replyText_1154w_218",iD="_replyAvatars_1154w_224",sD="_replyAvatar_1154w_224",oD="_replyMeta_1154w_249",aD="_chevron_1154w_255",lD="_chevronExpanded_1154w_268",uD="_actionsWrapper_1154w_278",cD="_actions_1154w_278",dD="_actionsTrigger_1154w_330",fD="_actionBtn_1154w_374",hD="_actionBtnActive_1154w_393",pD="_actionBtnDanger_1154w_402",mD="_replies_1154w_408",yD="_mentionDropdown_1154w_474",gD="_mentionDropdownAbove_1154w_492",bD="_mentionHeader_1154w_499",vD="_mentionList_1154w_512",SD="_mentionOption_1154w_549",wD="_mentionOptionSelected_1154w_568",_D="_mentionFieldLabel_1154w_577",TD="_mentionFieldApiKey_1154w_582",ED="_mentionEmpty_1154w_593",MD="_fieldMention_1154w_605",xD="_fieldMentionDisabled_1154w_633",CD="_fieldMentionWrapper_1154w_643",kD="_fieldMentionTooltip_1154w_649 _tooltipBase_pq2lx_22",AD="_fieldMentionTooltipArrow_1154w_653 _tooltipArrowDown_pq2lx_51",OD="_mentionUserAvatar_1154w_666",ND="_mentionUserName_1154w_675",RD="_mentionModelInfo_1154w_700",DD="_mentionModelName_1154w_708",ID="_mentionModelBadge_1154w_716",LD="_userMentionWrapper_1154w_738",jD="_userMention_1154w_738",BD="_userMentionDisabled_1154w_771",zD="_userMentionTooltip_1154w_781 _tooltipBase_pq2lx_22",PD="_userMentionTooltipArrow_1154w_785 _tooltipArrowDown_pq2lx_51",UD="_assetMentionWrapper_1154w_799",qD="_assetMention_1154w_799",$D="_assetMentionNoThumb_1154w_843",FD="_assetMentionName_1154w_847",HD="_assetMentionTooltip_1154w_851 _tooltipBase_pq2lx_22",VD="_assetMentionTooltipArrow_1154w_855 _tooltipArrowDown_pq2lx_51",KD="_assetMentionBlockWrapper_1154w_869",GD="_assetMentionBlock_1154w_869",YD="_assetMentionBlockThumb_1154w_903",QD="_assetMentionBlockName_1154w_911",XD="_assetMentionBlockSkeleton_1154w_929",JD="_assetMentionBlockThumbHidden_1154w_954",WD="_recordMentionWrapper_1154w_967",ZD="_recordMention_1154w_967",eI="_recordMentionIcon_1154w_1005",tI="_recordMentionEmoji_1154w_1012",nI="_recordMentionThumb_1154w_1018",rI="_recordMentionTitle_1154w_1026",iI="_recordMentionFallback_1154w_1037",sI="_recordMentionTooltip_1154w_1048 _tooltipBase_pq2lx_22",oI="_recordMentionTooltipArrow_1154w_1052 _tooltipArrowDown_pq2lx_51",aI="_modelMentionWrapper_1154w_1066",lI="_modelMention_1154w_1066",uI="_modelMentionIcon_1154w_1101",cI="_modelMentionEmoji_1154w_1108",dI="_modelMentionTooltip_1154w_1114 _tooltipBase_pq2lx_22",fI="_modelMentionTooltipArrow_1154w_1118 _tooltipArrowDown_pq2lx_51",hI="_recordModelSearchWrapper_1154w_1131",pI="_recordModelSearchInput_1154w_1136",mI="_mentionBackButton_1154w_1162",yI="_mentionLocaleBadge_1154w_1188",gI="_mentionLocaleIndicator_1154w_1209",bI="_mentionFieldMeta_1154w_1222",vI="_fieldMentionLocaleBadge_1154w_1233",SI="_mentionOptionEntireField_1154w_1253",wI="_mentionBlockCount_1154w_1266",_I="_mentionBlockBadge_1154w_1277",TI="_mentionBlockIndicator_1154w_1297",EI="_errorFallback_1154w_1317",MI="_slashCommandMenu_1154w_1331",xI="_slashCommandItem_1154w_1335",CI="_slashCommandIcon_1154w_1344",kI="_slashCommandContent_1154w_1363",AI="_slashCommandName_1154w_1372",OI="_slashCommandDescription_1154w_1382",F={comment:B2,commentBody:z2,reply:P2,avatarContainer:U2,avatar:q2,content:$2,header:F2,authorName:H2,timestamp:V2,text:K2,editContainer:G2,composerBox:Y2,composerBoxCompact:Q2,footer:X2,reaction:J2,reactionActive:W2,reactionWrapper:Z2,tooltip:eD,tooltipArrow:tD,replyToggle:nD,replyText:rD,replyAvatars:iD,replyAvatar:sD,replyMeta:oD,chevron:aD,chevronExpanded:lD,actionsWrapper:uD,actions:cD,actionsTrigger:dD,actionBtn:fD,actionBtnActive:hD,actionBtnDanger:pD,replies:mD,mentionDropdown:yD,mentionDropdownAbove:gD,mentionHeader:bD,mentionList:vD,mentionOption:SD,mentionOptionSelected:wD,mentionFieldLabel:_D,mentionFieldApiKey:TD,mentionEmpty:ED,fieldMention:MD,fieldMentionDisabled:xD,fieldMentionWrapper:CD,fieldMentionTooltip:kD,fieldMentionTooltipArrow:AD,mentionUserAvatar:OD,mentionUserName:ND,mentionModelInfo:RD,mentionModelName:DD,mentionModelBadge:ID,userMentionWrapper:LD,userMention:jD,userMentionDisabled:BD,userMentionTooltip:zD,userMentionTooltipArrow:PD,assetMentionWrapper:UD,assetMention:qD,assetMentionNoThumb:$D,assetMentionName:FD,assetMentionTooltip:HD,assetMentionTooltipArrow:VD,assetMentionBlockWrapper:KD,assetMentionBlock:GD,assetMentionBlockThumb:YD,assetMentionBlockName:QD,assetMentionBlockSkeleton:XD,assetMentionBlockThumbHidden:JD,recordMentionWrapper:WD,recordMention:ZD,recordMentionIcon:eI,recordMentionEmoji:tI,recordMentionThumb:nI,recordMentionTitle:rI,recordMentionFallback:iI,recordMentionTooltip:sI,recordMentionTooltipArrow:oI,modelMentionWrapper:aI,modelMention:lI,modelMentionIcon:uI,modelMentionEmoji:cI,modelMentionTooltip:dI,modelMentionTooltipArrow:fI,recordModelSearchWrapper:hI,recordModelSearchInput:pI,mentionBackButton:mI,mentionLocaleBadge:yI,mentionLocaleIndicator:gI,mentionFieldMeta:bI,fieldMentionLocaleBadge:vI,mentionOptionEntireField:SI,mentionBlockCount:wI,mentionBlockBadge:_I,mentionBlockIndicator:TI,errorFallback:EI,slashCommandMenu:MI,slashCommandItem:xI,slashCommandIcon:CI,slashCommandContent:kI,slashCommandName:AI,slashCommandDescription:OI};function Og({items:t,emptyMessage:e,headerText:n,selectedIndex:r,onClose:i,renderItem:o,keyExtractor:l,position:c="below",searchSlot:d}){const f=C.useRef(null),p=C.useRef(null);j2(p,r),zE(f,i);const m=ct(F.mentionDropdown,c==="above"&&F.mentionDropdownAbove);return t.length===0&&!d?E.jsx("div",{ref:f,className:m,children:E.jsx("div",{className:F.mentionEmpty,children:e})}):E.jsxs("div",{ref:f,className:m,children:[E.jsx("div",{className:F.mentionHeader,children:n}),d,t.length===0?E.jsx("div",{className:F.mentionEmpty,children:e}):E.jsx("div",{className:F.mentionList,children:t.map((y,b)=>E.jsx("div",{children:o(y,b,b===r,b===r?p:{current:null})},l(y)))})]})}const PE=({models:t,onSelect:e,onClose:n,position:r="below"})=>{const i=C.useRef(null),[o,l]=C.useState(""),[c,d]=C.useState(0),f=C.useMemo(()=>t.filter(S=>!S.isBlockModel),[t]),p=C.useMemo(()=>{const S=o.toLowerCase();return f.filter(w=>w.name.toLowerCase().includes(S)||w.apiKey.toLowerCase().includes(S))},[o,f]);C.useEffect(()=>{d(0)},[o]),C.useEffect(()=>{i.current?.focus()},[]);const m=o?`No models matching "${o}"`:f.length===0?"No models available with read permission":"No models available",y=S=>{switch(S.key){case"ArrowDown":S.preventDefault(),d(w=>w<p.length-1?w+1:w);break;case"ArrowUp":S.preventDefault(),d(w=>w>0?w-1:w);break;case"Enter":S.preventDefault(),p.length>0&&e(p[c]);break;case"Tab":S.preventDefault(),p.length>0&&e(p[c]);break;case"Escape":S.preventDefault(),n();break}},b=E.jsx("div",{className:F.recordModelSearchWrapper,onKeyDown:y,children:E.jsx("input",{ref:i,type:"text",className:F.recordModelSearchInput,placeholder:"Search models...",value:o,onChange:S=>l(S.target.value)})});return E.jsx(Og,{items:p,emptyMessage:m,headerText:"Select a Model",selectedIndex:c,onClose:n,position:r,keyExtractor:S=>S.id,searchSlot:b,renderItem:(S,w,T,M)=>E.jsxs("button",{ref:T?M:null,type:"button",className:ct(F.mentionOption,T&&F.mentionOptionSelected),onMouseDown:k=>{k.preventDefault(),e(S)},onMouseEnter:()=>d(w),children:[E.jsx("span",{className:F.mentionModelInfo,children:E.jsx("span",{className:F.mentionModelName,children:S.name})}),E.jsxs("span",{className:F.mentionFieldApiKey,children:["$",S.apiKey]})]})})};function NI(t){return E.jsx("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",...t,children:E.jsx("path",{d:"M9.5 13a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0zm0-5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"})})}function UE(t){return E.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"currentColor",...t,children:E.jsx("path",{d:"M2 20h2c.55 0 1-.45 1-1v-9c0-.55-.45-1-1-1H2v11zm19.83-7.12c.11-.25.17-.52.17-.8V11c0-1.1-.9-2-2-2h-5.5l.92-4.65c.05-.22.02-.46-.08-.66-.23-.45-.52-.86-.88-1.22L14 2 7.59 8.41C7.21 8.79 7 9.3 7 9.83v7.84C7 18.95 8.05 20 9.34 20h8.11c.7 0 1.36-.37 1.72-.97l2.66-6.15z"})})}function RI(t){return E.jsx("svg",{width:"20",height:"20",viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M6.598 5.013a.144.144 0 0 1 .202.134V6.3a.5.5 0 0 0 .5.5c.667 0 2.013.005 3.3.822.984.624 1.99 1.76 2.595 3.876-1.02-.983-2.185-1.516-3.205-1.799a8.74 8.74 0 0 0-1.921-.306 7.404 7.404 0 0 0-.798.008h-.013l-.005.001h-.001L7.3 9.9l-.05-.498a.5.5 0 0 0-.45.498v1.153c0 .108-.11.176-.202.134L3.614 8.146a.145.145 0 0 1 0-.292l2.984-2.841z"})})}function DI(t){return E.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M12.854.146a.5.5 0 0 0-.707 0L10.5 1.793 14.207 5.5l1.647-1.646a.5.5 0 0 0 0-.708l-3-3zm.646 6.061L9.793 2.5 3.293 9H3.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.207l6.5-6.5zm-7.468 7.468A.5.5 0 0 1 6 13.5V13h-.5a.5.5 0 0 1-.5-.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.5-.5V10h-.5a.499.499 0 0 1-.175-.032l-.179.178a.5.5 0 0 0-.11.168l-2 5a.5.5 0 0 0 .65.65l5-2a.5.5 0 0 0 .168-.11l.178-.178z"})})}function II(t){return E.jsx("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z"})})}function LI(t){return E.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0Zm4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4Zm-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10c-2.29 0-3.516.68-4.168 1.332-.678.678-.83 1.418-.832 1.664h10Z"})})}function jI(t){return E.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M8.39 12.648a1.32 1.32 0 0 0-.015.18c0 .305.21.508.5.508.266 0 .492-.172.555-.477l.554-2.703h1.204c.421 0 .617-.234.617-.547 0-.312-.188-.53-.617-.53h-.985l.516-2.524h1.265c.43 0 .618-.227.618-.547 0-.313-.188-.524-.618-.524h-1.046l.476-2.304a1.06 1.06 0 0 0 .016-.164.51.51 0 0 0-.516-.516.54.54 0 0 0-.539.43l-.523 2.554H7.617l.477-2.304c.008-.04.015-.118.015-.164a.512.512 0 0 0-.523-.516.539.539 0 0 0-.531.43L6.53 5.484H5.414c-.43 0-.617.22-.617.532 0 .312.187.539.617.539h.906l-.515 2.523H4.609c-.421 0-.609.219-.609.531 0 .313.188.547.61.547h.976l-.516 2.492c-.008.04-.015.125-.015.18 0 .305.21.508.5.508.265 0 .492-.172.554-.477l.555-2.703h2.242l-.515 2.492Zm-1-6.109h2.266l-.515 2.563H6.859l.532-2.563Z"})})}function BI(t){return E.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:[E.jsx("path",{d:"M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1h12zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2H2z"}),E.jsx("path",{d:"M3 4h10v1H3V4zm0 3h10v1H3V7zm0 3h6v1H3v-1z"})]})}function iw(t){return E.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M4 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h8a2 2 0 0 0 2-2V4.5L9.5 0H4zm0 1h5v3.5A1.5 1.5 0 0 0 10.5 6H13v8a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1z"})})}function zI(t){return E.jsxs("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:[E.jsx("path",{d:"M6.002 5.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0z"}),E.jsx("path",{d:"M2.002 1a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V3a2 2 0 0 0-2-2h-12zm12 1a1 1 0 0 1 1 1v6.5l-3.777-1.947a.5.5 0 0 0-.577.093l-3.71 3.71-2.66-1.772a.5.5 0 0 0-.63.062L1.002 12V3a1 1 0 0 1 1-1h12z"})]})}function qE(t){return E.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M1 2.5A1.5 1.5 0 0 1 2.5 1h3A1.5 1.5 0 0 1 7 2.5v3A1.5 1.5 0 0 1 5.5 7h-3A1.5 1.5 0 0 1 1 5.5v-3zm8 0A1.5 1.5 0 0 1 10.5 1h3A1.5 1.5 0 0 1 15 2.5v3A1.5 1.5 0 0 1 13.5 7h-3A1.5 1.5 0 0 1 9 5.5v-3zm-8 8A1.5 1.5 0 0 1 2.5 9h3A1.5 1.5 0 0 1 7 10.5v3A1.5 1.5 0 0 1 5.5 15h-3A1.5 1.5 0 0 1 1 13.5v-3zm8 0A1.5 1.5 0 0 1 10.5 9h3a1.5 1.5 0 0 1 1.5 1.5v3a1.5 1.5 0 0 1-1.5 1.5h-3A1.5 1.5 0 0 1 9 13.5v-3z"})})}function PI(t){return E.jsx("svg",{viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M15.964.686a.5.5 0 0 0-.65-.65L.767 5.855H.766l-.452.18a.5.5 0 0 0-.082.887l.41.26.001.002 4.995 3.178 3.178 4.995.002.002.26.41a.5.5 0 0 0 .886-.083l6-15Zm-1.833 1.89L6.637 10.07l-.215-.338a.5.5 0 0 0-.154-.154l-.338-.215 7.494-7.494 1.178-.471-.47 1.178Z"})})}function UI(t){return E.jsx("svg",{width:"10",height:"10",viewBox:"0 0 16 16",fill:"currentColor",...t,children:E.jsx("path",{d:"M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z"})})}const qI="_container_13l7o_2",$I="_loading_13l7o_13",FI="_error_13l7o_21",HI="_header_13l7o_39",VI="_warning_13l7o_51",KI="_composer_13l7o_69",GI="_composerInputWrapper_13l7o_90",YI="_commentsList_13l7o_145",QI="_empty_13l7o_151",XI="_composerToolbar_13l7o_176",JI="_toolbarMentions_13l7o_187",WI="_toolbarButtonWrapper_13l7o_196",ZI="_toolbarButton_13l7o_196",eL="_toolbarButtonUser_13l7o_237",tL="_toolbarButtonField_13l7o_242",nL="_toolbarButtonRecord_13l7o_247",rL="_toolbarButtonAsset_13l7o_252",iL="_toolbarButtonModel_13l7o_257",sL="_toolbarButtonDisabled_13l7o_263",oL="_toolbarTooltip_13l7o_274",aL="_toolbarTooltipArrow_13l7o_293",lL="_sendButton_13l7o_308",uL="_loadMoreButton_13l7o_350",ht={container:qI,loading:$I,error:FI,header:HI,warning:VI,composer:KI,composerInputWrapper:GI,commentsList:YI,empty:QI,composerToolbar:XI,toolbarMentions:JI,toolbarButtonWrapper:WI,toolbarButton:ZI,toolbarButtonUser:eL,toolbarButtonField:tL,toolbarButtonRecord:nL,toolbarButtonAsset:rL,toolbarButtonModel:iL,toolbarButtonDisabled:sL,toolbarTooltip:oL,toolbarTooltipArrow:aL,sendButton:lL,loadMoreButton:uL};function cL({icon:t,tooltipText:e,onClick:n,disabled:r=!1,ariaLabel:i,buttonClassName:o}){return E.jsxs("span",{className:ht.toolbarButtonWrapper,children:[E.jsx("button",{type:"button",className:ct(o,r&&ht.toolbarButtonDisabled),onClick:r?void 0:n,disabled:r,"aria-label":i,children:t}),E.jsxs("span",{className:ht.toolbarTooltip,children:[e,E.jsx("span",{className:ht.toolbarTooltipArrow})]})]})}const Sl=C.memo(cL),dL=E.jsx(LI,{}),fL=E.jsx(jI,{}),hL=E.jsx(BI,{}),pL=E.jsx(zI,{}),mL=E.jsx(qE,{}),yL=E.jsx(PI,{}),$E=({onUserClick:t,onFieldClick:e,onRecordClick:n,onAssetClick:r,onModelClick:i,onSendClick:o,isSendDisabled:l,canMentionAssets:c=!0,canMentionModels:d=!0,canMentionFields:f=!0})=>E.jsxs("div",{className:ht.composerToolbar,children:[E.jsxs("div",{className:ht.toolbarMentions,children:[E.jsx(Sl,{icon:dL,tooltipText:"User",onClick:t,ariaLabel:"Mention user",buttonClassName:ct(ht.toolbarButton,ht.toolbarButtonUser)}),f&&E.jsx(Sl,{icon:fL,tooltipText:"Field",onClick:e,ariaLabel:"Mention field",buttonClassName:ct(ht.toolbarButton,ht.toolbarButtonField)}),E.jsx(Sl,{icon:hL,tooltipText:"Record",onClick:n,ariaLabel:"Mention record",buttonClassName:ct(ht.toolbarButton,ht.toolbarButtonRecord)}),E.jsx(Sl,{icon:pL,tooltipText:c?"Asset":"No upload permission",onClick:r,disabled:!c,ariaLabel:c?"Mention asset":"Asset mentions unavailable - no upload permissions",buttonClassName:ct(ht.toolbarButton,ht.toolbarButtonAsset)}),E.jsx(Sl,{icon:mL,tooltipText:d?"Model":"No schema access",onClick:i,disabled:!d,ariaLabel:d?"Mention model":"Model mentions unavailable - no schema access",buttonClassName:ct(ht.toolbarButton,ht.toolbarButtonModel)})]}),E.jsxs("span",{className:ht.toolbarButtonWrapper,children:[E.jsx("button",{type:"button",className:ht.sendButton,onClick:o,disabled:l,"aria-label":"Send comment",children:yL}),E.jsxs("span",{className:ht.toolbarTooltip,children:["Send",E.jsx("span",{className:ht.toolbarTooltipArrow})]})]})]});var _m={exports:{}},Tm,sw;function gL(){if(sw)return Tm;sw=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return Tm=t,Tm}var Em,ow;function bL(){if(ow)return Em;ow=1;var t=gL();function e(){}function n(){}return n.resetWarningCache=e,Em=function(){function r(l,c,d,f,p,m){if(m!==t){var y=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw y.name="Invariant Violation",y}}r.isRequired=r;function i(){return r}var o={array:r,bigint:r,bool:r,func:r,number:r,object:r,string:r,symbol:r,any:r,arrayOf:i,element:r,elementType:r,instanceOf:i,node:r,objectOf:i,oneOf:i,oneOfType:i,shape:i,exact:i,checkPropTypes:n,resetWarningCache:e};return o.PropTypes=o,o},Em}var aw;function vL(){return aw||(aw=1,_m.exports=bL()()),_m.exports}var SL=vL();const et=Ea(SL);var wL=["date","verboseDate","tooltip","children"];function My(){return My=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},My.apply(this,arguments)}function _L(t,e){if(t==null)return{};var n=TL(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function TL(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Ld(t,e){var n=t.date,r=t.verboseDate,i=t.tooltip,o=t.children,l=_L(t,wL),c=C.useMemo(function(){return n.toISOString()},[n]);return Le.createElement("time",My({ref:e},l,{dateTime:c,title:i?r:void 0}),o)}Ld=Le.forwardRef(Ld);Ld.propTypes={date:et.instanceOf(Date).isRequired,verboseDate:et.string,tooltip:et.bool.isRequired,children:et.string.isRequired};var FE="en",Ng={},xy={};function HE(){return FE}function VE(t){FE=t}function EL(t){return Ng[t]}function KE(t){if(!t)throw new Error("No locale data passed");Ng[t.locale]=t,xy[t.locale.toLowerCase()]=t.locale}function lw(t){if(Ng[t])return t;if(xy[t.toLowerCase()])return xy[t.toLowerCase()]}function GE(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=e.localeMatcher||"lookup";switch(n){case"lookup":return uw(t);case"best fit":return uw(t);default:throw new RangeError('Invalid "localeMatcher" option: '.concat(n))}}function uw(t){var e=lw(t);if(e)return e;for(var n=t.split("-");t.length>1;){n.pop(),t=n.join("-");var r=lw(t);if(r)return r}}var L={af:function(e){return e==1?"one":"other"},ak:function(e){return e==0||e==1?"one":"other"},am:function(e){return e>=0&&e<=1?"one":"other"},ar:function(e){var n=String(e).split("."),r=Number(n[0])==e,i=r&&n[0].slice(-2);return e==0?"zero":e==1?"one":e==2?"two":i>=3&&i<=10?"few":i>=11&&i<=99?"many":"other"},ast:function(e){var n=String(e).split("."),r=!n[1];return e==1&&r?"one":"other"},be:function(e){var n=String(e).split("."),r=Number(n[0])==e,i=r&&n[0].slice(-1),o=r&&n[0].slice(-2);return i==1&&o!=11?"one":i>=2&&i<=4&&(o<12||o>14)?"few":r&&i==0||i>=5&&i<=9||o>=11&&o<=14?"many":"other"},blo:function(e){return e==0?"zero":e==1?"one":"other"},br:function(e){var n=String(e).split("."),r=Number(n[0])==e,i=r&&n[0].slice(-1),o=r&&n[0].slice(-2),l=r&&n[0].slice(-6);return i==1&&o!=11&&o!=71&&o!=91?"one":i==2&&o!=12&&o!=72&&o!=92?"two":(i==3||i==4||i==9)&&(o<10||o>19)&&(o<70||o>79)&&(o<90||o>99)?"few":e!=0&&r&&l==0?"many":"other"},bs:function(e){var n=String(e).split("."),r=n[0],i=n[1]||"",o=!n[1],l=r.slice(-1),c=r.slice(-2),d=i.slice(-1),f=i.slice(-2);return o&&l==1&&c!=11||d==1&&f!=11?"one":o&&l>=2&&l<=4&&(c<12||c>14)||d>=2&&d<=4&&(f<12||f>14)?"few":"other"},ca:function(e,n){var r=String(e).split("."),i=r[0],o=!r[1],l=i.slice(-6);return e==1&&o?"one":!n&&i!=0&&l==0&&o||n>5?"many":"other"},ceb:function(e){var n=String(e).split("."),r=n[0],i=n[1]||"",o=!n[1],l=r.slice(-1),c=i.slice(-1);return o&&(r==1||r==2||r==3)||o&&l!=4&&l!=6&&l!=9||!o&&c!=4&&c!=6&&c!=9?"one":"other"},cs:function(e){var n=String(e).split("."),r=n[0],i=!n[1];return e==1&&i?"one":r>=2&&r<=4&&i?"few":i?"other":"many"},cy:function(e){return e==0?"zero":e==1?"one":e==2?"two":e==3?"few":e==6?"many":"other"},da:function(e){var n=String(e).split("."),r=n[0],i=Number(n[0])==e;return e==1||!i&&(r==0||r==1)?"one":"other"},dsb:function(e){var n=String(e).split("."),r=n[0],i=n[1]||"",o=!n[1],l=r.slice(-2),c=i.slice(-2);return o&&l==1||c==1?"one":o&&l==2||c==2?"two":o&&(l==3||l==4)||c==3||c==4?"few":"other"},dz:function(e){return"other"},es:function(e,n){var r=String(e).split("."),i=r[0],o=!r[1],l=i.slice(-6);return e==1?"one":!n&&i!=0&&l==0&&o||n>5?"many":"other"},ff:function(e){return e>=0&&e<2?"one":"other"},fr:function(e,n){var r=String(e).split("."),i=r[0],o=!r[1],l=i.slice(-6);return e>=0&&e<2?"one":!n&&i!=0&&l==0&&o||n>5?"many":"other"},ga:function(e){var n=String(e).split("."),r=Number(n[0])==e;return e==1?"one":e==2?"two":r&&e>=3&&e<=6?"few":r&&e>=7&&e<=10?"many":"other"},gd:function(e){var n=String(e).split("."),r=Number(n[0])==e;return e==1||e==11?"one":e==2||e==12?"two":r&&e>=3&&e<=10||r&&e>=13&&e<=19?"few":"other"},he:function(e){var n=String(e).split("."),r=n[0],i=!n[1];return r==1&&i||r==0&&!i?"one":r==2&&i?"two":"other"},is:function(e){var n=String(e).split("."),r=n[0],i=(n[1]||"").replace(/0+$/,""),o=Number(n[0])==e,l=r.slice(-1),c=r.slice(-2);return o&&l==1&&c!=11||i%10==1&&i%100!=11?"one":"other"},lt:function(e){var n=String(e).split("."),r=n[1]||"",i=Number(n[0])==e,o=i&&n[0].slice(-1),l=i&&n[0].slice(-2);return o==1&&(l<11||l>19)?"one":o>=2&&o<=9&&(l<11||l>19)?"few":r!=0?"many":"other"},lv:function(e){var n=String(e).split("."),r=n[1]||"",i=r.length,o=Number(n[0])==e,l=o&&n[0].slice(-1),c=o&&n[0].slice(-2),d=r.slice(-2),f=r.slice(-1);return o&&l==0||c>=11&&c<=19||i==2&&d>=11&&d<=19?"zero":l==1&&c!=11||i==2&&f==1&&d!=11||i!=2&&f==1?"one":"other"},mk:function(e){var n=String(e).split("."),r=n[0],i=n[1]||"",o=!n[1],l=r.slice(-1),c=r.slice(-2),d=i.slice(-1),f=i.slice(-2);return o&&l==1&&c!=11||d==1&&f!=11?"one":"other"},mt:function(e){var n=String(e).split("."),r=Number(n[0])==e,i=r&&n[0].slice(-2);return e==1?"one":e==2?"two":e==0||i>=3&&i<=10?"few":i>=11&&i<=19?"many":"other"},pl:function(e){var n=String(e).split("."),r=n[0],i=!n[1],o=r.slice(-1),l=r.slice(-2);return e==1&&i?"one":i&&o>=2&&o<=4&&(l<12||l>14)?"few":i&&r!=1&&(o==0||o==1)||i&&o>=5&&o<=9||i&&l>=12&&l<=14?"many":"other"},pt:function(e,n){var r=String(e).split("."),i=r[0],o=!r[1],l=i.slice(-6);return i==0||i==1?"one":!n&&i!=0&&l==0&&o||n>5?"many":"other"},ro:function(e){var n=String(e).split("."),r=!n[1],i=Number(n[0])==e,o=i&&n[0].slice(-2);return e==1&&r?"one":!r||e==0||e!=1&&o>=1&&o<=19?"few":"other"},ru:function(e){var n=String(e).split("."),r=n[0],i=!n[1],o=r.slice(-1),l=r.slice(-2);return i&&o==1&&l!=11?"one":i&&o>=2&&o<=4&&(l<12||l>14)?"few":i&&o==0||i&&o>=5&&o<=9||i&&l>=11&&l<=14?"many":"other"},se:function(e){return e==1?"one":e==2?"two":"other"},si:function(e){var n=String(e).split("."),r=n[0],i=n[1]||"";return e==0||e==1||r==0&&i==1?"one":"other"},sl:function(e){var n=String(e).split("."),r=n[0],i=!n[1],o=r.slice(-2);return i&&o==1?"one":i&&o==2?"two":i&&(o==3||o==4)||!i?"few":"other"}};L.as=L.am;L.az=L.af;L.bal=L.af;L.bg=L.af;L.bn=L.am;L.brx=L.af;L.ce=L.af;L.chr=L.af;L.csw=L.ak;L.cv=L.blo;L.de=L.ast;L.doi=L.am;L.ee=L.af;L.el=L.af;L.en=L.ast;L.eo=L.af;L.et=L.ast;L.eu=L.af;L.fa=L.am;L.fi=L.ast;L.fil=L.ceb;L.fo=L.af;L.fur=L.af;L.fy=L.ast;L.gl=L.ast;L.gu=L.am;L.ha=L.af;L.hi=L.am;L.hr=L.bs;L.hsb=L.dsb;L.hu=L.af;L.hy=L.ff;L.ia=L.ast;L.id=L.dz;L.ie=L.ast;L.ig=L.dz;L.ii=L.dz;L.it=L.ca;L.ja=L.dz;L.jgo=L.af;L.jv=L.dz;L.ka=L.af;L.kea=L.dz;L.kk=L.af;L.kl=L.af;L.km=L.dz;L.kn=L.am;L.ko=L.dz;L.kok=L.am;L.ks=L.af;L.ksh=L.blo;L.ku=L.af;L.ky=L.af;L.lb=L.af;L.lkt=L.dz;L.lld=L.ca;L.lo=L.dz;L.ml=L.af;L.mn=L.af;L.mr=L.af;L.ms=L.dz;L.my=L.dz;L.nb=L.af;L.ne=L.af;L.nl=L.ast;L.nn=L.af;L.no=L.af;L.nqo=L.dz;L.nso=L.ak;L.om=L.af;L.or=L.af;L.pa=L.ak;L.pcm=L.am;L.ps=L.af;L.rm=L.af;L.sah=L.dz;L.sc=L.ast;L.scn=L.ca;L.sd=L.af;L.sk=L.cs;L.so=L.af;L.sq=L.af;L.sr=L.bs;L.su=L.dz;L.sv=L.ast;L.sw=L.ast;L.syr=L.af;L.ta=L.af;L.te=L.af;L.th=L.dz;L.ti=L.ak;L.tk=L.af;L.tn=L.af;L.to=L.dz;L.tr=L.af;L.ug=L.af;L.uk=L.ru;L.ur=L.ast;L.uz=L.af;L.vec=L.ca;L.vi=L.dz;L.wae=L.af;L.wo=L.dz;L.xh=L.af;L.yi=L.ast;L.yo=L.dz;L.yue=L.dz;L.zh=L.dz;L.zu=L.am;function cw(t){return t==="pt-PT"?t:xL(t)}var ML=/^([a-z0-9]+)/i;function xL(t){var e=t.match(ML);if(!e)throw new TypeError("Invalid locale: ".concat(t));return e[1]}function Ql(t){"@babel/helpers - typeof";return Ql=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ql(t)}function CL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dw(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,AL(r.key),r)}}function kL(t,e,n){return e&&dw(t.prototype,e),n&&dw(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function AL(t){var e=OL(t,"string");return Ql(e)=="symbol"?e:e+""}function OL(t,e){if(Ql(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Ql(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var Cy=(function(){function t(e,n){CL(this,t);var r=t.supportedLocalesOf(e);if(r.length===0)throw new RangeError("Unsupported locale: "+e);if(n&&n.type!=="cardinal")throw new RangeError('Only "cardinal" "type" is supported');this.$=L[cw(r[0])]}return kL(t,[{key:"select",value:function(n){return this.$(n)}}],[{key:"supportedLocalesOf",value:function(n){return typeof n=="string"&&(n=[n]),n.filter(function(r){return L[cw(r)]})}}]),t})();function ma(t){"@babel/helpers - typeof";return ma=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ma(t)}function fw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function hw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?fw(Object(n),!0).forEach(function(r){NL(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):fw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function NL(t,e,n){return(e=YE(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function pw(t,e){return LL(t)||IL(t,e)||DL(t,e)||RL()}function RL(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
10
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function DL(t,e){if(t){if(typeof t=="string")return mw(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?mw(t,e):void 0}}function mw(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function IL(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,o,l,c=[],d=!0,f=!1;try{if(o=(n=n.call(t)).next,e!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==e);d=!0);}catch(p){f=!0,i=p}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw i}}return c}}function LL(t){if(Array.isArray(t))return t}function jL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function BL(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,YE(r.key),r)}}function zL(t,e,n){return e&&BL(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function YE(t){var e=PL(t,"string");return ma(e)=="symbol"?e:e+""}function PL(t,e){if(ma(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ma(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var UL=["second","minute","hour","day","week","month","quarter","year"],qL=["auto","always"],$L=["long","short","narrow"],FL=["lookup","best fit"],fi=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};jL(this,t);var r=n.numeric,i=n.style,o=n.localeMatcher;if(this.numeric="always",this.style="long",this.localeMatcher="lookup",r!==void 0){if(qL.indexOf(r)<0)throw new RangeError('Invalid "numeric" option: '.concat(r));this.numeric=r}if(i!==void 0){if($L.indexOf(i)<0)throw new RangeError('Invalid "style" option: '.concat(i));this.style=i}if(o!==void 0){if(FL.indexOf(o)<0)throw new RangeError('Invalid "localeMatcher" option: '.concat(o));this.localeMatcher=o}if(typeof e=="string"&&(e=[e]),e.push(HE()),this.locale=t.supportedLocalesOf(e,{localeMatcher:this.localeMatcher})[0],!this.locale)throw new Error("Unsupported locale");Cy.supportedLocalesOf(this.locale).length>0?this.pluralRules=new Cy(this.locale):console.warn('"'.concat(this.locale,'" locale is not supported')),typeof Intl<"u"&&Intl.NumberFormat?(this.numberFormat=new Intl.NumberFormat(this.locale),this.numberingSystem=this.numberFormat.resolvedOptions().numberingSystem):this.numberingSystem="latn",this.locale=GE(this.locale,{localeMatcher:this.localeMatcher})}return zL(t,[{key:"format",value:function(){var n=yw(arguments),r=pw(n,2),i=r[0],o=r[1];return this.getRule(i,o).replace("{0}",this.formatNumber(Math.abs(i)))}},{key:"formatToParts",value:function(){var n=yw(arguments),r=pw(n,2),i=r[0],o=r[1],l=this.getRule(i,o),c=l.indexOf("{0}");if(c<0)return[{type:"literal",value:l}];var d=[];return c>0&&d.push({type:"literal",value:l.slice(0,c)}),d=d.concat(this.formatNumberToParts(Math.abs(i)).map(function(f){return hw(hw({},f),{},{unit:o})})),c+3<l.length-1&&d.push({type:"literal",value:l.slice(c+3)}),d}},{key:"getRule",value:function(n,r){var i=EL(this.locale)[this.style][r];if(typeof i=="string")return i;if(this.numeric==="auto"){if(n===-2||n===-1){var o=i["previous".concat(n===-1?"":"-"+Math.abs(n))];if(o)return o}else if(n===1||n===2){var l=i["next".concat(n===1?"":"-"+Math.abs(n))];if(l)return l}else if(n===0&&i.current)return i.current}var c=i[YL(n)?"past":"future"];if(typeof c=="string")return c;var d=this.pluralRules&&this.pluralRules.select(Math.abs(n))||"other";return c[d]||c.other}},{key:"formatNumber",value:function(n){return this.numberFormat?this.numberFormat.format(n):String(n)}},{key:"formatNumberToParts",value:function(n){return this.numberFormat&&this.numberFormat.formatToParts?this.numberFormat.formatToParts(n):[{type:"integer",value:this.formatNumber(n)}]}},{key:"resolvedOptions",value:function(){return{locale:this.locale,style:this.style,numeric:this.numeric,numberingSystem:this.numberingSystem}}}]),t})();fi.supportedLocalesOf=function(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};if(typeof t=="string")t=[t];else if(!Array.isArray(t))throw new TypeError('Invalid "locales" argument');return t.filter(function(n){return GE(n,e)})};fi.addLocale=KE;fi.addDefaultLocale=function(t){KE(t),VE(t.locale)};fi.setDefaultLocale=VE;fi.getDefaultLocale=HE;fi.PluralRules=Cy;var Mm='Invalid "unit" argument';function HL(t){if(ma(t)==="symbol")throw new TypeError(Mm);if(typeof t!="string")throw new RangeError("".concat(Mm,": ").concat(t));if(t[t.length-1]==="s"&&(t=t.slice(0,t.length-1)),UL.indexOf(t)<0)throw new RangeError("".concat(Mm,": ").concat(t));return t}var VL='Invalid "number" argument';function KL(t){if(t=Number(t),Number.isFinite&&!Number.isFinite(t))throw new RangeError("".concat(VL,": ").concat(t));return t}function GL(t){return 1/t===-1/0}function YL(t){return t<0||t===0&&GL(t)}function yw(t){if(t.length<2)throw new TypeError('"unit" argument is required');return[KL(t[0]),HL(t[1])]}function Gs(t){"@babel/helpers - typeof";return Gs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Gs(t)}function QL(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function XL(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,WL(r.key),r)}}function JL(t,e,n){return e&&XL(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function WL(t){var e=ZL(t,"string");return Gs(e)=="symbol"?e:e+""}function ZL(t,e){if(Gs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Gs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var gw=(function(){function t(){QL(this,t),this.cache={}}return JL(t,[{key:"get",value:function(){for(var n=this.cache,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];for(var l=0,c=i;l<c.length;l++){var d=c[l];if(Gs(n)!=="object")return;n=n[d]}return n}},{key:"put",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=r.pop(),l=r.pop(),c=this.cache,d=0,f=r;d<f.length;d++){var p=f[d];Gs(c[p])!=="object"&&(c[p]={}),c=c[p]}return c[l]=o}}]),t})();function ky(t){"@babel/helpers - typeof";return ky=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ky(t)}function e3(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=t3(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
11
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function t3(t,e){if(t){if(typeof t=="string")return bw(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?bw(t,e):void 0}}function bw(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function n3(t,e){for(var n=e3(t),r;!(r=n()).done;){var i=r.value;if(e(i))return i;for(var o=i.split("-");o.length>1;)if(o.pop(),i=o.join("-"),e(i))return i}throw new Error("No locale data has been registered for any of the locales: ".concat(t.join(", ")))}function r3(){var t=(typeof Intl>"u"?"undefined":ky(Intl))==="object";return t&&typeof Intl.DateTimeFormat=="function"}function Ay(t){"@babel/helpers - typeof";return Ay=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ay(t)}function i3(t){return o3(t)&&(Array.isArray(t.steps)||Array.isArray(t.gradation)||Array.isArray(t.flavour)||typeof t.flavour=="string"||Array.isArray(t.labels)||typeof t.labels=="string"||Array.isArray(t.units)||typeof t.custom=="function")}var s3={}.constructor;function o3(t){return Ay(t)!==void 0&&t!==null&&t.constructor===s3}var oi=60,jd=60*oi,qs=24*jd,Oy=7*qs,Ny=30.44*qs,QE=146097/400*qs;function Zo(t){switch(t){case"second":return 1;case"minute":return oi;case"hour":return jd;case"day":return qs;case"week":return Oy;case"month":return Ny;case"year":return QE}}function XE(t){return t.factor!==void 0?t.factor:Zo(t.unit||t.formatAs)||1}function Xl(t){return t==="floor"?Math.floor:Math.round}function Rg(t){return t==="floor"?1:.5}function Ry(t){"@babel/helpers - typeof";return Ry=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Ry(t)}function JE(t,e){var n=e.prevStep,r=e.timestamp,i=e.now,o=e.future,l=e.round,c;return n&&(n.id||n.unit)&&(c=t["threshold_for_".concat(n.id||n.unit)]),c===void 0&&t.threshold!==void 0&&(c=t.threshold,typeof c=="function"&&(c=c(i,o))),c===void 0&&(c=t.minTime),Ry(c)==="object"&&(n&&n.id&&c[n.id]!==void 0?c=c[n.id]:c=c.default),typeof c=="function"&&(c=c(r,{future:o,getMinTimeForUnit:function(f,p){return vw(f,p||n&&n.formatAs,{round:l})}})),c===void 0&&t.test&&(t.test(r,{now:i,future:o})?c=0:c=9007199254740991),c===void 0&&(n?t.formatAs&&n.formatAs&&(c=vw(t.formatAs,n.formatAs,{round:l})):c=0),c===void 0&&console.warn("[javascript-time-ago] A step should specify `minTime`:\n"+JSON.stringify(t,null,2)),c}function vw(t,e,n){var r=n.round,i=Zo(t),o=Zo(e==="now"?t:e);if(i!==void 0&&o!==void 0)return i-o*(1-Rg(r))}function Jl(t){"@babel/helpers - typeof";return Jl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Jl(t)}function Sw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function a3(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Sw(Object(n),!0).forEach(function(r){l3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Sw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function l3(t,e,n){return(e=u3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function u3(t){var e=c3(t,"string");return Jl(e)=="symbol"?e:e+""}function c3(t,e){if(Jl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Jl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}function d3(t,e,n){var r=n.now,i=n.future,o=n.round,l=n.units;t=h3(t,l);var c=f3(t,e,{now:r,future:i,round:o});{if(c){var d=t[t.indexOf(c)-1],f=t[t.indexOf(c)+1];return[d,c,f]}return[void 0,void 0,t[0]]}}function f3(t,e,n){var r=n.now,i=n.future,o=n.round;if(t.length!==0){var l=WE(t,e,{now:r,future:i||e<0,round:o});if(l!==-1){var c=t[l];if(c.granularity){var d=Xl(o)(Math.abs(e)/XE(c)/c.granularity)*c.granularity;if(d===0&&l>0)return t[l-1]}return c}}}function WE(t,e,n){var r=arguments.length>3&&arguments[3]!==void 0?arguments[3]:0,i=JE(t[r],a3({prevStep:t[r-1],timestamp:n.now-e*1e3},n));return i===void 0||Math.abs(e)<i?r-1:r===t.length-1?r:WE(t,e,n,r+1)}function h3(t,e){return t.filter(function(n){var r=n.unit,i=n.formatAs;return r=r||i,r?e.indexOf(r)>=0:!0})}function p3(t,e,n){var r=n.now,i=n.round;if(Zo(t)){var o=Zo(t)*1e3,l=e>r,c=Math.abs(e-r),d=Xl(i)(c/o)*o;return l?d>0?c-d+y3(i,o):c-d+1:-(c-d)+m3(i,o)}}function m3(t,e){return Rg(t)*e}function y3(t,e){return(1-Rg(t))*e+1}var g3=365*24*60*60*1e3,ZE=1e3*g3;function b3(t,e,n){var r=n.prevStep,i=n.nextStep,o=n.now,l=n.future,c=n.round,d=t.getTime?t.getTime():t,f=function(S){return p3(S,d,{now:o,round:c})},p=S3(l?e:i,d,{future:l,now:o,round:c,prevStep:l?r:e});if(p!==void 0){var m;if(e&&(e.getTimeToNextUpdate&&(m=e.getTimeToNextUpdate(d,{getTimeToNextUpdateForUnit:f,getRoundFunction:Xl,now:o,future:l,round:c})),m===void 0)){var y=e.unit||e.formatAs;y&&(m=f(y))}return m===void 0?p:Math.min(m,p)}}function v3(t,e,n){var r=n.now,i=n.future,o=n.round,l=n.prevStep,c=JE(t,{timestamp:e,now:r,future:i,round:o,prevStep:l});if(c!==void 0)return i?e-c*1e3+1:c===0&&e===r?ZE:e+c*1e3}function S3(t,e,n){var r=n.now,i=n.future,o=n.round,l=n.prevStep;if(t){var c=v3(t,e,{now:r,future:i,round:o,prevStep:l});return c===void 0?void 0:c-r}else return i?e-r+1:ZE}var eM={};function Xo(t){return eM[t]}function tM(t){if(!t)throw new Error("[javascript-time-ago] No locale data passed.");eM[t.locale]=t}const w3=[{formatAs:"now"},{formatAs:"second"},{formatAs:"minute"},{formatAs:"hour"},{formatAs:"day"},{formatAs:"week"},{formatAs:"month"},{formatAs:"year"}],Dy={steps:w3,labels:"long"};function Wl(t){"@babel/helpers - typeof";return Wl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Wl(t)}function ww(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function _w(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?ww(Object(n),!0).forEach(function(r){_3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ww(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function _3(t,e,n){return(e=T3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function T3(t){var e=E3(t,"string");return Wl(e)=="symbol"?e:e+""}function E3(t,e){if(Wl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Wl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Iy=_w(_w({},Dy),{},{steps:Dy.steps.filter(function(t){return t.formatAs!=="second"})}),nM=[{factor:1,unit:"now"},{threshold:1,threshold_for_now:45.5,factor:1,unit:"second"},{threshold:45.5,factor:oi,unit:"minute"},{threshold:2.5*oi,granularity:5,factor:oi,unit:"minute"},{threshold:22.5*oi,factor:.5*jd,unit:"half-hour"},{threshold:42.5*oi,threshold_for_minute:52.5*oi,factor:jd,unit:"hour"},{threshold:20.5/24*qs,factor:qs,unit:"day"},{threshold:5.5*qs,factor:Oy,unit:"week"},{threshold:3.5*Oy,factor:Ny,unit:"month"},{threshold:10.5*Ny,factor:QE,unit:"year"}],Tw={gradation:nM,flavour:"long",units:["now","minute","hour","day","week","month","year"]},M3={gradation:nM,flavour:"long-time",units:["now","minute","hour","day","week","month","year"]};function rM(t){return t instanceof Date?t:new Date(t)}var Ly=[{formatAs:"second"},{formatAs:"minute"},{formatAs:"hour"}],Nr={},x3={minTime:function(e,n){n.future;var r=n.getMinTimeForUnit;return r("day")},format:function(e,n){return Nr[n]||(Nr[n]={}),Nr[n].dayMonth||(Nr[n].dayMonth=new Intl.DateTimeFormat(n,{month:"short",day:"numeric"})),Nr[n].dayMonth.format(rM(e))}},C3={minTime:function(e,n){var r=n.future;if(r){var i=new Date(new Date(e).getFullYear(),0).getTime()-1;return(e-i)/1e3}else{var o=new Date(new Date(e).getFullYear()+1,0).getTime();return(o-e)/1e3}},format:function(e,n){return Nr[n]||(Nr[n]={}),Nr[n].dayMonthYear||(Nr[n].dayMonthYear=new Intl.DateTimeFormat(n,{year:"numeric",month:"short",day:"numeric"})),Nr[n].dayMonthYear.format(rM(e))}};r3()?Ly.push(x3,C3):Ly.push({formatAs:"day"},{formatAs:"week"},{formatAs:"month"},{formatAs:"year"});const Ys={steps:Ly,labels:["mini","short-time","narrow","short"]};function Zl(t){"@babel/helpers - typeof";return Zl=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Zl(t)}function Ew(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Mw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ew(Object(n),!0).forEach(function(r){k3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ew(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function k3(t,e,n){return(e=A3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function A3(t){var e=O3(t,"string");return Zl(e)=="symbol"?e:e+""}function O3(t,e){if(Zl(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Zl(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const N3=Mw(Mw({},Ys),{},{steps:[{formatAs:"now"}].concat(Ys.steps)});function eu(t){"@babel/helpers - typeof";return eu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},eu(t)}function xw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Cw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?xw(Object(n),!0).forEach(function(r){R3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):xw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function R3(t,e,n){return(e=D3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function D3(t){var e=I3(t,"string");return eu(e)=="symbol"?e:e+""}function I3(t,e){if(eu(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(eu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const jy=Cw(Cw({},Ys),{},{steps:Ys.steps.filter(function(t){return t.formatAs!=="second"})});function tu(t){"@babel/helpers - typeof";return tu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},tu(t)}function kw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Aw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?kw(Object(n),!0).forEach(function(r){L3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):kw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function L3(t,e,n){return(e=j3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function j3(t){var e=B3(t,"string");return tu(e)=="symbol"?e:e+""}function B3(t,e){if(tu(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(tu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const z3=Aw(Aw({},jy),{},{steps:[{formatAs:"now"}].concat(jy.steps)});function nu(t){"@babel/helpers - typeof";return nu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},nu(t)}function Ow(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function ed(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Ow(Object(n),!0).forEach(function(r){P3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Ow(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function P3(t,e,n){return(e=U3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function U3(t){var e=q3(t,"string");return nu(e)=="symbol"?e:e+""}function q3(t,e){if(nu(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(nu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const $3=ed(ed({},Ys),{},{steps:Ys.steps.filter(function(t){return t.formatAs!=="second"}).map(function(t){return t.formatAs==="minute"?ed(ed({},t),{},{minTime:oi}):t})}),ru={steps:[{formatAs:"second"},{formatAs:"minute"},{formatAs:"hour"},{formatAs:"day"},{formatAs:"month"},{formatAs:"year"}],labels:["mini","short-time","narrow","short"]};function iu(t){"@babel/helpers - typeof";return iu=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},iu(t)}function Nw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Rw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Nw(Object(n),!0).forEach(function(r){F3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Nw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function F3(t,e,n){return(e=H3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function H3(t){var e=V3(t,"string");return iu(e)=="symbol"?e:e+""}function V3(t,e){if(iu(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(iu(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const K3=Rw(Rw({},ru),{},{steps:[{formatAs:"now"}].concat(ru.steps)});function su(t){"@babel/helpers - typeof";return su=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},su(t)}function Dw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function Iw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Dw(Object(n),!0).forEach(function(r){G3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Dw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function G3(t,e,n){return(e=Y3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function Y3(t){var e=Q3(t,"string");return su(e)=="symbol"?e:e+""}function Q3(t,e){if(su(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(su(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const By=Iw(Iw({},ru),{},{steps:ru.steps.filter(function(t){return t.formatAs!=="second"})});function ou(t){"@babel/helpers - typeof";return ou=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},ou(t)}function Lw(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);e&&(r=r.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),n.push.apply(n,r)}return n}function jw(t){for(var e=1;e<arguments.length;e++){var n=arguments[e]!=null?arguments[e]:{};e%2?Lw(Object(n),!0).forEach(function(r){X3(t,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):Lw(Object(n)).forEach(function(r){Object.defineProperty(t,r,Object.getOwnPropertyDescriptor(n,r))})}return t}function X3(t,e,n){return(e=J3(e))in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function J3(t){var e=W3(t,"string");return ou(e)=="symbol"?e:e+""}function W3(t,e){if(ou(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(ou(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return(e==="string"?String:Number)(t)}const Z3=jw(jw({},By),{},{steps:[{formatAs:"now"}].concat(By.steps)});function ej(t){switch(t){case"default":case"round":return Dy;case"round-minute":return Iy;case"approximate":return Tw;case"time":case"approximate-time":return M3;case"mini":return ru;case"mini-now":return K3;case"mini-minute":return By;case"mini-minute-now":return Z3;case"twitter":return Ys;case"twitter-now":return N3;case"twitter-minute":return jy;case"twitter-minute-now":return z3;case"twitter-first-minute":return $3;default:return Tw}}function Qs(t){"@babel/helpers - typeof";return Qs=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Qs(t)}function tj(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=iM(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
12
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function nj(t,e){return sj(t)||ij(t,e)||iM(t,e)||rj()}function rj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
13
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function iM(t,e){if(t){if(typeof t=="string")return Bw(t,e);var n={}.toString.call(t).slice(8,-1);return n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set"?Array.from(t):n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?Bw(t,e):void 0}}function Bw(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=Array(e);n<e;n++)r[n]=t[n];return r}function ij(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r,i,o,l,c=[],d=!0,f=!1;try{if(o=(n=n.call(t)).next,e!==0)for(;!(d=(r=o.call(n)).done)&&(c.push(r.value),c.length!==e);d=!0);}catch(p){f=!0,i=p}finally{try{if(!d&&n.return!=null&&(l=n.return(),Object(l)!==l))return}finally{if(f)throw i}}return c}}function sj(t){if(Array.isArray(t))return t}function oj(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function aj(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,uj(r.key),r)}}function lj(t,e,n){return e&&aj(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}function uj(t){var e=cj(t,"string");return Qs(e)=="symbol"?e:e+""}function cj(t,e){if(Qs(t)!="object"||!t)return t;var n=t[Symbol.toPrimitive];if(n!==void 0){var r=n.call(t,e);if(Qs(r)!="object")return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}var In=(function(){function t(){var e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[],n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=n.polyfill;oj(this,t),typeof e=="string"&&(e=[e]),this.locale=n3(e.concat(t.getDefaultLocale()),Xo),typeof Intl<"u"&&Intl.NumberFormat&&(this.numberFormat=new Intl.NumberFormat(this.locale)),r===!1?(this.IntlRelativeTimeFormat=Intl.RelativeTimeFormat,this.IntlPluralRules=Intl.PluralRules):(this.IntlRelativeTimeFormat=fi,this.IntlPluralRules=fi.PluralRules),this.relativeTimeFormatCache=new gw,this.pluralRulesCache=new gw}return lj(t,[{key:"format",value:function(n,r,i){var o=this;i||(r&&!mj(r)?(i=r,r=void 0):i={}),r||(r=Iy),typeof r=="string"&&(r=ej(r));var l=dj(n),c=this.getLabels(r.flavour||r.labels),d=c.labels,f=c.labelsType,p=i.round||r.round,m,y=Date.now();r.now!==void 0&&(m=r.now),m===void 0&&i.now!==void 0&&(m=i.now),m===void 0&&(m=y);var b=function(P){var A=P.now,U=(A-l)/1e3,H=i.future||U<0,se=pj(d,Xo(o.locale).now,Xo(o.locale).long,H);if(r.custom){var re=r.custom({now:A,date:new Date(l),time:l,elapsed:U,locale:o.locale});if(re!==void 0)return{getText:function(){return re},getTextRefreshDelay:function(){throw new Error('`getTimeToNextUpdate: true` feature is not supported by legacy "styles" that have a `custom` function')}}}var te=hj(r.units,d,se),Z=d3(r.gradation||r.steps||Iy.steps,U,{now:A,units:te,round:p,future:H}),G=nj(Z,3),fe=G[0],R=G[1],$=G[2],ie=function(){return o.formatDateForStep(l,R,U,{labels:d,labelsType:f,nowLabel:se,now:A,future:H,round:p})||""},me=function(){var N=b3(l,R,{nextStep:$,prevStep:fe,now:A,future:H,round:p});if(typeof N=="number")return i.getTimeToNextUpdateUncapped?N:oM(N)};return{getText:ie,getTextRefreshDelay:me}},S=b({now:m}),w=S.getText,T=S.getTextRefreshDelay;if(i.getTimeToNextUpdate)return[w(),T()];if(i.refresh){var M=6e4,k,j=function O(){var P=arguments.length>0&&arguments[0]!==void 0?arguments[0]:M;k=yj(function(){var A=b({now:m+(Date.now()-y)}),U=A.getText,H=A.getTextRefreshDelay;i.refresh(U()),O(H())},P)};j(T());var I=function(){clearTimeout(k)};return[w(),I]}return w()}},{key:"formatDateForStep",value:function(n,r,i,o){var l=this,c=o.labels,d=o.labelsType,f=o.nowLabel,p=o.now,m=o.future,y=o.round;if(r){if(r.format)return r.format(n,this.locale,{formatAs:function(M,k){return l.formatValue(k,M,{labels:c,future:m})},now:p,future:m});var b=r.unit||r.formatAs;if(!b)throw new Error("[javascript-time-ago] Each step must define either `formatAs` or `format()`. Step: ".concat(JSON.stringify(r)));if(b==="now")return f;var S=Math.abs(i)/XE(r);r.granularity&&(S=Xl(y)(S/r.granularity)*r.granularity);var w=-1*Math.sign(i)*Xl(y)(S);switch(w===0&&(m?w=0:w=-0),d){case"long":case"short":case"narrow":return this.getFormatter(d).format(w,b);default:return this.formatValue(w,b,{labels:c,future:m})}}}},{key:"formatValue",value:function(n,r,i){var o=i.labels,l=i.future;return this.getFormattingRule(o,r,n,{future:l}).replace("{0}",this.formatNumber(Math.abs(n)))}},{key:"getFormattingRule",value:function(n,r,i,o){var l=o.future;if(this.locale,n=n[r],typeof n=="string")return n;var c=i===0?l?"future":"past":i<0?"past":"future",d=n[c]||n;if(typeof d=="string")return d;var f=this.getPluralRules().select(Math.abs(i));return d[f]||d.other}},{key:"formatNumber",value:function(n){return this.numberFormat?this.numberFormat.format(n):String(n)}},{key:"getFormatter",value:function(n){return this.relativeTimeFormatCache.get(this.locale,n)||this.relativeTimeFormatCache.put(this.locale,n,new this.IntlRelativeTimeFormat(this.locale,{style:n}))}},{key:"getPluralRules",value:function(){return this.pluralRulesCache.get(this.locale)||this.pluralRulesCache.put(this.locale,new this.IntlPluralRules(this.locale))}},{key:"getLabels",value:function(){var n=arguments.length>0&&arguments[0]!==void 0?arguments[0]:[];typeof n=="string"&&(n=[n]),n=n.map(function(c){switch(c){case"tiny":case"mini-time":return"mini";default:return c}}),n=n.concat("long");for(var r=Xo(this.locale),i=tj(n),o;!(o=i()).done;){var l=o.value;if(r[l])return{labelsType:l,labels:r[l]}}}}]),t})(),sM="en";In.getDefaultLocale=function(){return sM};In.setDefaultLocale=function(t){zy=!0,sM=t};In.addDefaultLocale=function(t){zy&&In.getDefaultLocale()!==t.locale&&console.warn(`[javascript-time-ago] You're adding "`.concat(t.locale,'" as the default locale but you have already added "').concat(In.getDefaultLocale(),'" as the default locale. "').concat(t.locale,'" is the default locale now.')),zy=!0,In.addLocale(t),In.setDefaultLocale(t.locale)};var zy=!1;In.addLocale=function(t){tM(t),fi.addLocale(t)};In.locale=In.addLocale;In.addLabels=function(t,e,n){var r=Xo(t);r||(tM({locale:t}),r=Xo(t)),r[e]=n};function dj(t){if(t.constructor===Date||fj(t))return t.getTime();if(typeof t=="number")return t;throw new Error("Unsupported relative time formatter input: ".concat(Qs(t),", ").concat(t))}function fj(t){return Qs(t)==="object"&&typeof t.getTime=="function"}function hj(t,e,n){var r=Object.keys(e);return n&&r.push("now"),t&&(r=t.filter(function(i){return i==="now"||r.indexOf(i)>=0})),r}function pj(t,e,n,r){var i=t.now||e&&e.now;if(i)return typeof i=="string"?i:r?i.future:i.past;if(n&&n.second&&n.second.current)return n.second.current}function mj(t){return typeof t=="string"||i3(t)}function yj(t,e){return setTimeout(t,oM(e))}function oM(t){return Math.min(t,gj)}var gj=2147483647;function Py(t){"@babel/helpers - typeof";return Py=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Py(t)}function bj(t){if(aM())return Intl.DateTimeFormat.supportedLocalesOf(t)[0]}function aM(){var t=(typeof Intl>"u"?"undefined":Py(Intl))==="object";return t&&typeof Intl.DateTimeFormat=="function"}function Uy(t){"@babel/helpers - typeof";return Uy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Uy(t)}function lM(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function vj(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function uM(t,e,n){return e&&vj(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var Sj=(function(){function t(e){lM(this,t);var n=(typeof Intl>"u"?"undefined":Uy(Intl))==="object",r=n&&typeof Intl.DateTimeFormat=="function";r?this.formatter=new Intl.DateTimeFormat(e,Tj):this.formatter=new wj}return uM(t,[{key:"format",value:function(n){return this.formatter.format(_j(n))}}]),t})(),wj=(function(){function t(){lM(this,t)}return uM(t,[{key:"format",value:function(n){return String(n)}}]),t})();function _j(t){return typeof t=="number"?new Date(t):t}var Tj={weekday:"long",day:"numeric",month:"long",year:"numeric",hour:"numeric",minute:"2-digit",second:"2-digit"};function Bd(t){"@babel/helpers - typeof";return Bd=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},Bd(t)}function Ej(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Mj(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function xj(t,e,n){return e&&Mj(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t}var cM=(function(){function t(){Ej(this,t),this.cache={}}return xj(t,[{key:"get",value:function(){for(var n=this.cache,r=arguments.length,i=new Array(r),o=0;o<r;o++)i[o]=arguments[o];for(var l=0,c=i;l<c.length;l++){var d=c[l];if(Bd(n)!=="object")return;n=n[d]}return n}},{key:"put",value:function(){for(var n=arguments.length,r=new Array(n),i=0;i<n;i++)r[i]=arguments[i];for(var o=r.pop(),l=r.pop(),c=this.cache,d=0,f=r;d<f.length;d++){var p=f[d];Bd(c[p])!=="object"&&(c[p]={}),c=c[p]}return c[l]=o}}]),t})(),zw=new cM,Cj=aM();function kj(t,e){var n=Oj(t),r=JSON.stringify(e),i=function(){return e&&Cj?new Intl.DateTimeFormat(n,e):new Sj(n)},o=zw.get(String(n),r)||zw.put(String(n),r,i());return function(l){return o.format(l)}}const Aj=S2(kj);var xm={};function Oj(t){var e=t.toString();return xm[e]?xm[e]:xm[e]=bj(t)}function qy(t){"@babel/helpers - typeof";return qy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol=="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},qy(t)}function Nj(t){return Rj(t)?t:new Date(t)}function Rj(t){return t instanceof Date||Dj(t)}function Dj(t){return qy(t)==="object"&&typeof t.getTime=="function"}var Pw=new cM;function Ij(t,e){var n=e.polyfill,r=String(t)+":"+String(n);return Pw.get(r)||Pw.put(r,new In(t,{polyfill:n}))}function Lj(t,e){return zj(t)||Bj(t,e)||dM(t,e)||jj()}function jj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
14
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Bj(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,l,c;try{for(n=n.call(t);!(i=(l=n.next()).done)&&(r.push(l.value),!(e&&r.length===e));i=!0);}catch(d){o=!0,c=d}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw c}}return r}}function zj(t){if(Array.isArray(t))return t}function Pj(t,e){var n=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n)return(n=n.call(t)).next.bind(n);if(Array.isArray(t)||(n=dM(t))||e){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
15
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function dM(t,e){if(t){if(typeof t=="string")return Uw(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return Uw(t,e)}}function Uw(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}const Uj={listeners:[],add:function(e){var n=this,r=this.listeners.length===0;return qj(this.listeners,e),r?this.start():this.scheduleNextTick(),{stop:function(){$j(n.listeners,e),n.listeners.length===0?n.stop():n.scheduleNextTick()},forceUpdate:function(){qw(e)}}},tick:function(){this.scheduledTick=void 0;for(var e=Date.now(),n=Pj(this.listeners),r;!(r=n()).done;){var i=r.value;e>=i.updateTime&&qw(i)}},scheduleNextTick:function(){var e=this;if(this.cancelNextTick(),this.listeners.length!==0){for(var n=this.listeners[0].updateTime,r=1;r<this.listeners.length;)this.listeners[r].updateTime<n&&(n=this.listeners[r].updateTime),r++;this.scheduledTick=setTimeout(function(){e.tick(),e.scheduleNextTick()},n-Date.now())}},cancelNextTick:function(){clearTimeout(this.scheduledTick),this.scheduledTick=void 0},start:function(){this.scheduleNextTick()},stop:function(){this.cancelNextTick()}};function qw(t){var e=t.getNewValueAndNextUpdateTime(),n=Lj(e,2),r=n[0],i=n[1];t.setValue(r),t.updateTime=i}function qj(t,e){t.push(e)}function $j(t,e){var n=Fj(t,e);t.splice(n,1)}function Fj(t,e){return t.indexOf(e)}function td(t,e){return Gj(t)||Kj(t,e)||Vj(t,e)||Hj()}function Hj(){throw new TypeError(`Invalid attempt to destructure non-iterable instance.
16
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Vj(t,e){if(t){if(typeof t=="string")return $w(t,e);var n=Object.prototype.toString.call(t).slice(8,-1);if(n==="Object"&&t.constructor&&(n=t.constructor.name),n==="Map"||n==="Set")return Array.from(t);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return $w(t,e)}}function $w(t,e){(e==null||e>t.length)&&(e=t.length);for(var n=0,r=new Array(e);n<e;n++)r[n]=t[n];return r}function Kj(t,e){var n=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(n!=null){var r=[],i=!0,o=!1,l,c;try{for(n=n.call(t);!(i=(l=n.next()).done)&&(r.push(l.value),!(e&&r.length===e));i=!0);}catch(d){o=!0,c=d}finally{try{!i&&n.return!=null&&n.return()}finally{if(o)throw c}}return r}}function Gj(t){if(Array.isArray(t))return t}function Yj(t){var e=t.date,n=t.future,r=t.locale,i=t.locales,o=t.timeStyle,l=t.round,c=t.freezeAt,d=t.formatVerboseDate,f=t.verboseDateFormat,p=t.updateInterval,m=t.tick,y=m===void 0?!0:m,b=t.now,S=t.timeOffset,w=S===void 0?0:S,T=t.polyfill,M=C.useMemo(function(){return r&&(i=[r]),i.concat(In.getDefaultLocale())},[r,i]),k=C.useMemo(function(){return Ij(M,{polyfill:T})},[M,T]);e=C.useMemo(function(){return Nj(e)},[e]);var j=C.useCallback(function(){var R=(b||Date.now())-w,$=!1;c!==void 0&&R>c&&(R=c,$=!0);var ie=k.format(e,o,{getTimeToNextUpdate:!0,now:R,future:n,round:l}),me=td(ie,2),ye=me[0],N=me[1];return $?N=Xj:N=p||N||60*1e3,[ye,R+N]},[e,n,o,p,l,c,k,b]),I=C.useRef();I.current=j;var O=C.useMemo(j,[]),P=td(O,2),A=P[0],U=P[1],H=C.useState(A),se=td(H,2),re=se[0],te=se[1],Z=C.useRef();C.useEffect(function(){if(y)return Z.current=Uj.add({getNewValueAndNextUpdateTime:function(){return I.current()},setValue:te,updateTime:U}),function(){Z.current.stop()}},[y]),C.useEffect(function(){if(Z.current)Z.current.forceUpdate();else{var R=j(),$=td(R,1),ie=$[0];te(ie)}},[j]);var G=C.useMemo(function(){return Aj(M,f)},[M,f]),fe=C.useMemo(function(){return d?d(e):G(e)},[e,d,G]);return{date:e,formattedDate:re,verboseDate:fe}}var Qj=365*24*60*60*1e3,Xj=1e3*Qj,$y=et.oneOfType,Fw=et.arrayOf,Jo=et.string,Hw=et.number,Cl=et.shape,nd=et.func,Jj=$y([Cl({minTime:Hw,formatAs:Jo.isRequired}),Cl({test:nd,formatAs:Jo.isRequired}),Cl({minTime:Hw,format:nd.isRequired}),Cl({test:nd,format:nd.isRequired})]),Wj=$y([Jo,Cl({steps:Fw(Jj).isRequired,labels:$y([Jo,Fw(Jo)]).isRequired,round:Jo})]),Zj=["date","future","timeStyle","round","freezeAt","locale","locales","formatVerboseDate","verboseDateFormat","updateInterval","tick","now","timeOffset","polyfill","tooltip","component","container","wrapperComponent","wrapperProps"];function zd(){return zd=Object.assign||function(t){for(var e=1;e<arguments.length;e++){var n=arguments[e];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(t[r]=n[r])}return t},zd.apply(this,arguments)}function e5(t,e){if(t==null)return{};var n=t5(t,e),r,i;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);for(i=0;i<o.length;i++)r=o[i],!(e.indexOf(r)>=0)&&Object.prototype.propertyIsEnumerable.call(t,r)&&(n[r]=t[r])}return n}function t5(t,e){if(t==null)return{};var n={},r=Object.keys(t),i,o;for(o=0;o<r.length;o++)i=r[o],!(e.indexOf(i)>=0)&&(n[i]=t[i]);return n}function Pd(t){var e=t.date,n=t.future,r=t.timeStyle,i=t.round,o=t.freezeAt,l=t.locale,c=t.locales,d=c===void 0?[]:c,f=t.formatVerboseDate,p=t.verboseDateFormat,m=t.updateInterval,y=t.tick,b=t.now,S=t.timeOffset,w=t.polyfill,T=t.tooltip,M=T===void 0?!0:T,k=t.component,j=k===void 0?Ld:k,I=t.container,O=t.wrapperComponent,P=t.wrapperProps,A=e5(t,Zj),U=Yj({date:e,future:n,timeStyle:r,round:i,freezeAt:o,locale:l,locales:d,formatVerboseDate:f,verboseDateFormat:p,updateInterval:m,tick:y,now:b,timeOffset:S,polyfill:w}),H=U.date,se=U.verboseDate,re=U.formattedDate,te=Le.createElement(j,zd({date:H,verboseDate:se,tooltip:M},A),re),Z=O||I;return Z?Le.createElement(Z,zd({},P,{verboseDate:se}),te):te}Pd.propTypes={date:et.oneOfType([et.instanceOf(Date),et.number]).isRequired,locale:et.string,locales:et.arrayOf(et.string),future:et.bool,timeStyle:Wj,round:et.string,freezeAt:et.number,component:et.elementType,tooltip:et.bool,formatVerboseDate:et.func,verboseDateFormat:et.object,updateInterval:et.oneOfType([et.number,et.arrayOf(et.shape({threshold:et.number,interval:et.number.isRequired}))]),tick:et.bool,now:et.number,timeOffset:et.number,polyfill:et.bool,wrapperComponent:et.elementType,wrapperProps:et.object};Pd=Le.memo(Pd);function Vw(t){return t.type==="user"}function Kw(t){return t.type==="field"}function Gw(t){return t.type==="asset"}function Yw(t){return t.type==="record"}function Qw(t){return t.type==="model"}function fM(t,e){return t.type!==e.type?!1:Vw(t)&&Vw(e)?t.id===e.id&&t.name===e.name&&t.email===e.email&&t.avatarUrl===e.avatarUrl:Kw(t)&&Kw(e)?t.fieldPath===e.fieldPath&&t.locale===e.locale&&t.apiKey===e.apiKey&&t.label===e.label&&t.localized===e.localized&&t.fieldType===e.fieldType:Gw(t)&&Gw(e)?t.id===e.id&&t.filename===e.filename&&t.url===e.url&&t.thumbnailUrl===e.thumbnailUrl&&t.mimeType===e.mimeType:Yw(t)&&Yw(e)?t.id===e.id&&t.title===e.title&&t.modelId===e.modelId&&t.modelApiKey===e.modelApiKey&&t.modelName===e.modelName&&t.modelEmoji===e.modelEmoji&&t.thumbnailUrl===e.thumbnailUrl&&t.isSingleton===e.isSingleton:Qw(t)&&Qw(e)?t.id===e.id&&t.apiKey===e.apiKey&&t.name===e.name&&t.isBlockModel===e.isBlockModel:!1}function n5(t,e){return t.type!==e.type?!1:t.type==="text"&&e.type==="text"?t.content===e.content:t.type==="mention"&&e.type==="mention"?fM(t.mention,e.mention):!1}function au(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(!n5(t[n],e[n]))return!1;return!0}function r5(t,e){if(t===e)return!0;if(t.length!==e.length)return!1;for(let n=0;n<t.length;n++)if(t[n].email!==e[n].email)return!1;return!0}const i5=20;function hM(t,e,n=0){if(n>i5)return!1;if(t===e||!t&&!e)return!0;if(!t||!e||t.length!==e.length)return!1;for(let r=0;r<t.length;r++){const i=t[r],o=e[r];if(i.id!==o.id||!au(i.content,o.content)||!r5(i.upvoters,o.upvoters)||!hM(i.replies,o.replies,n+1))return!1}return!0}function pM(t){const e=t.site.attributes.internal_domain;return e?`https://${e}`:null}function s5(t,e){return e?`/schema/blocks_library/${t}`:`/schema/item_types/${t}`}function Cm(t,e){return`/editor/item_types/${t}/items/${e}/edit`}function o5(t,e){const n=pM(t);n&&(e==="sso"?window.open(`${n}/project_settings/sso-users`,"_blank"):e==="user"&&window.open(`${n}/project_settings/users`,"_blank"))}function a5(t,e,n){const r=pM(t);if(!r)return;const i=s5(e,n);window.open(`${r}${i}`,"_blank")}function l5(t){const e=C.useCallback((i="user")=>{o5(t,i)},[t]),n=C.useCallback((i,o)=>{a5(t,i,o)},[t]),r=C.useCallback(async i=>{await t.editUpload(i)},[t]);return{handleNavigateToUsers:e,handleNavigateToModel:n,handleOpenAsset:r}}function u5(t){const e=l5(t),n=C.useCallback(async(i,o,l)=>{try{const c=t.itemType.id,d=t.item?.id;if(!d)return;if(o){const f=l??t.locale;await t.scrollToField(i,f);const m=f&&i.includes(`.${f}.`)?i:`${i}.${f}`,y=`${Cm(c,d)}#fieldPath=${m}`;await t.navigateTo(y)}else{const f=`${Cm(c,d)}#fieldPath=${i}`;await t.navigateTo(f)}}catch{}},[t]),r=C.useCallback(async(i,o)=>{const l=t.item?.id;if(l){const c=Cm(t.itemType.id,l);await t.navigateTo(c)}await t.editItem(i)},[t]);return{...e,handleScrollToField:n,handleOpenRecord:r}}const mM=C.createContext(null);function yM(){const t=C.useContext(mM);if(!t)throw new Error("useNavigationContext must be used within a NavigationCallbacksProvider");return t}function c5({ctx:t,children:e}){const n=u5(t);return E.jsx(mM.Provider,{value:n,children:e})}const gM=C.createContext(null);function d5({children:t,projectUsers:e,projectModels:n,modelFields:r,currentUserId:i,typedUsers:o}){const l=C.useMemo(()=>({projectUsers:e,projectModels:n,modelFields:r,currentUserId:i,typedUsers:o}),[e,n,r,i,o]);return E.jsx(gM.Provider,{value:l,children:t})}function bM(){const t=C.useContext(gM);if(!t)throw new Error("useProjectDataContext must be used within a ProjectDataProvider");return t}const ai="project_comment",Ls={SYNC_COOLDOWN_MS:8e3,VERSION_CONFLICT_BACKOFF_BASE:100,VERSION_CONFLICT_BACKOFF_MAX:5e3,COMMENT_BLUR_DELAY_MS:150,SCROLL_AFTER_REPLY_DELAY_MS:100,VISIBILITY_REFRESH_THRESHOLD_MS:6e4},km=30,Ko={MENTION_CHIP_MAX_NAME_LENGTH:8,AVATAR_SIZE_COMMENT:32,AVATAR_SIZE_REPLY:24,AVATAR_SIZE_THUMBNAIL:40,MAX_VISIBLE_REPLIER_AVATARS:3},Am={MODEL_ID:"model_id",RECORD_ID:"record_id",CONTENT:"content"},Xw={SIDEBAR:"comments"},Rn={SAVE_FAILED:"Failed to save comment. Please refresh and try again.",SAVE_RECORD_FIRST:"Please save the record first before adding comments.",ASSET_PICKER_FAILED:"Failed to open asset picker. Please try again.",RECORD_PICKER_FAILED:"Failed to open record picker. Please try again.",COMMENTS_LOAD_FAILED:"Failed to load comments. Please refresh the page.",VERSION_CONFLICT_RETRYING:"Another user edited comments. Retrying...",MAX_RETRIES_EXCEEDED:"Unable to save after multiple attempts. Please check your connection and try again.",OPERATION_TIMEOUT:"Operation timed out after 2 minutes. Please try again.",MISSING_USER_INFO:"Unable to add comment: user information is missing."},Jw={MAX_ATTEMPTS:15,MAX_DURATION_MS:12e4},rd={TIMEOUT_MS:3e4,MAX_RETRIES:3},f5=new RegExp("^(\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F?)\\s*","u");function Ud(t){const e=t.match(f5);if(!e)return{emoji:null,textWithoutEmoji:t};const n=e[0].trim(),r=t.slice(e[0].length);return{emoji:n,textWithoutEmoji:r}}function vM(t){const e=Ko.MENTION_CHIP_MAX_NAME_LENGTH,n=t.lastIndexOf(".");if(!(n!==-1))return t.length>e?`${t.slice(0,e)}…`:t;const i=t.slice(0,n),o=t.slice(n);return i.length<=e?t:`${i.slice(0,e)}…${o}`}function h5(t){if(!t)return null;const e=t.replace(/_/g," ");return e.charAt(0).toUpperCase()+e.slice(1)}function p5({mention:t,tabIndex:e,onClick:n,tooltipId:r}){const[i,o]=C.useState(!0),[l,c]=C.useState(!1),d=vM(t.filename);return l?E.jsxs("span",{className:F.assetMentionWrapper,children:[E.jsx("button",{type:"button",tabIndex:e,className:ct(F.assetMention,F.assetMentionNoThumb),"aria-describedby":r,onClick:n,children:E.jsx("span",{className:F.assetMentionName,children:d})}),E.jsxs("span",{id:r,role:"tooltip",className:F.assetMentionTooltip,children:[t.filename,E.jsx("span",{className:F.assetMentionTooltipArrow,"aria-hidden":"true"})]})]}):E.jsx("span",{className:F.assetMentionBlockWrapper,children:E.jsxs("button",{type:"button",tabIndex:e,className:F.assetMentionBlock,onClick:n,children:[i&&E.jsx("span",{className:F.assetMentionBlockSkeleton,"aria-hidden":"true"}),E.jsx("img",{src:t.thumbnailUrl,alt:t.filename,className:ct(F.assetMentionBlockThumb,i&&F.assetMentionBlockThumbHidden),onLoad:()=>o(!1),onError:()=>{o(!1),c(!0)}}),E.jsx("span",{className:F.assetMentionBlockName,children:t.filename})]})})}const m5=({mention:t,onClick:e,isClickable:n=!0,isProjectOwner:r=!1,tabIndex:i=0,tooltipId:o,projectUsers:l})=>{const c=C.useId(),d=o??`mention-tooltip-${c}`,f=m=>{m.preventDefault(),m.stopPropagation(),e?.(m)},p=C.useMemo(()=>{if(t.type!=="user"||!l)return t.type==="user"?t.name:"";let m=l.find(y=>y.id===t.id);return!m&&t.email&&(m=l.find(y=>y.email&&y.email===t.email)),m?m.name:t.name},[t,l]);switch(t.type){case"user":{const m=r?"Project Owner":t.email||"Organization";return E.jsxs("span",{className:F.userMentionWrapper,children:[E.jsxs("button",{type:"button",tabIndex:i,className:ct(F.userMention,!n&&F.userMentionDisabled),"aria-describedby":d,onClick:n?f:void 0,disabled:!n,children:["@",p]}),E.jsxs("span",{id:d,role:"tooltip",className:F.userMentionTooltip,children:[m,E.jsx("span",{className:F.userMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"field":{const m=t.localized&&t.locale,y=h5(t.fieldType);return E.jsxs("span",{className:F.fieldMentionWrapper,children:[E.jsxs("button",{type:"button",tabIndex:i,className:ct(F.fieldMention,!n&&F.fieldMentionDisabled),"aria-describedby":y?d:void 0,onClick:n?f:void 0,disabled:!n,children:["#",t.apiKey,m&&E.jsx("span",{className:F.fieldMentionLocaleBadge,children:t.locale})]}),y&&E.jsxs("span",{id:d,role:"tooltip",className:F.fieldMentionTooltip,children:[y,E.jsx("span",{className:F.fieldMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"asset":{const m=t.mimeType.startsWith("image/")||t.mimeType.startsWith("video/"),y=t.thumbnailUrl&&m,b=vM(t.filename);return y?E.jsx(p5,{mention:t,tabIndex:i,onClick:f,tooltipId:d}):E.jsxs("span",{className:F.assetMentionWrapper,children:[E.jsx("button",{type:"button",tabIndex:i,className:ct(F.assetMention,F.assetMentionNoThumb),"aria-describedby":d,onClick:f,children:E.jsx("span",{className:F.assetMentionName,children:b})}),E.jsxs("span",{id:d,role:"tooltip",className:F.assetMentionTooltip,children:[t.filename,E.jsx("span",{className:F.assetMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"record":{const{emoji:m,textWithoutEmoji:y}=Ud(t.title),b=t.thumbnailUrl?null:m||t.modelEmoji||(t.isSingleton?"📄":null),S=m?y:t.title,w=t.isSingleton?"Singleton":t.modelName;return E.jsxs("span",{className:F.recordMentionWrapper,children:[E.jsxs("button",{type:"button",tabIndex:i,className:ct(F.recordMention,!t.thumbnailUrl&&F.recordMentionNoThumb),"aria-describedby":d,onClick:f,children:[t.thumbnailUrl?E.jsxs(E.Fragment,{children:[E.jsx("img",{src:t.thumbnailUrl,alt:`Thumbnail for ${S}`,className:F.recordMentionThumb,onError:T=>{const M=T.currentTarget;M.onerror=null,M.style.display="none";const k=M.closest("button");k&&k.setAttribute("data-img-error","true")}}),E.jsx("span",{className:F.recordMentionFallback,"aria-hidden":"true",children:E.jsx(iw,{className:F.recordMentionIcon})})]}):b?E.jsx("span",{className:F.recordMentionEmoji,children:b}):E.jsx(iw,{className:F.recordMentionIcon}),E.jsx("span",{className:F.recordMentionTitle,children:S})]}),E.jsxs("span",{id:d,role:"tooltip",className:F.recordMentionTooltip,children:[w,E.jsx("span",{className:F.recordMentionTooltipArrow,"aria-hidden":"true"})]})]})}case"model":{const{emoji:m,textWithoutEmoji:y}=Ud(t.name);return E.jsxs("span",{className:F.modelMentionWrapper,children:[E.jsxs("button",{type:"button",tabIndex:i,className:F.modelMention,"aria-describedby":d,onClick:f,children:[m?E.jsx("span",{className:F.modelMentionEmoji,children:m}):E.jsx(qE,{className:F.modelMentionIcon}),y]}),E.jsxs("span",{id:d,role:"tooltip",className:F.modelMentionTooltip,children:[t.isBlockModel?"Block":"Model",": ",t.apiKey,E.jsx("span",{className:F.modelMentionTooltipArrow,"aria-hidden":"true"})]})]})}default:return null}},SM=C.memo(m5,(t,e)=>t.isClickable!==e.isClickable||t.isProjectOwner!==e.isProjectOwner||t.tabIndex!==e.tabIndex||t.tooltipId!==e.tooltipId||t.onClick!==e.onClick||t.projectUsers!==e.projectUsers?!1:fM(t.mention,e.mention));function y5(t,e){return au(t.segments,e.segments)}const g5=C.memo(function({segments:e}){const n=yM(),{projectUsers:r,typedUsers:i}=bM(),o=C.useCallback(d=>{let f=i.find(p=>p.user.id===d.id);if(!f&&d.email&&(f=i.find(p=>p.user.email===d.email)),!f)return"owner";switch(f.userType){case"user":return"user";case"sso":return"sso";default:return"owner"}},[i]),l=C.useMemo(()=>{const d=new Map;for(const f of e)f.type==="mention"&&f.mention.type==="user"&&d.set(f.mention.id,o(f.mention));return d},[e,o]),c=C.useCallback(d=>{switch(d.type){case"user":{const f=l.get(d.id)??"owner";return f==="owner"?void 0:()=>n.handleNavigateToUsers(f)}case"field":{if(!n.handleScrollToField)return;const f=d.fieldPath??d.apiKey;return()=>n.handleScrollToField?.(f,d.localized,d.locale)}case"asset":return()=>n.handleOpenAsset(d.id);case"record":return()=>n.handleOpenRecord(d.id,d.modelId);case"model":return()=>n.handleNavigateToModel(d.id,d.isBlockModel);default:return}},[n,l]);return E.jsx(E.Fragment,{children:e.map((d,f)=>{if(d.type==="text"){const T=`text-${f}`;return E.jsx("span",{children:d.content},T)}const{mention:p}=d,m=b5(p,f),y=v5(p,f),b=c(p);let S=!0,w=!1;return p.type==="field"?S=!!n.handleScrollToField:p.type==="user"&&(w=(l.get(p.id)??"owner")==="owner",S=!w),E.jsx(SM,{mention:p,onClick:b,isClickable:S,isProjectOwner:w,tooltipId:y,projectUsers:r},m)})})},y5);function wM(t,e,n){const r=(()=>{switch(t.type){case"user":return`user-${t.id}`;case"field":return`field-${t.fieldPath??t.apiKey}-${t.locale??""}`;case"asset":return`asset-${t.id}`;case"record":return`record-${t.id}`;case"model":return`model-${t.id}`;default:return"unknown"}})();return n?`${r}-${n}-${e}`:`${r}-${e}`}function b5(t,e){return wM(t,e,"")}function v5(t,e){return wM(t,e,"tooltip")}function S5(t,e){return t.userUpvoted===e.userUpvoted&&t.userIsAuthor===e.userIsAuthor&&t.isTopLevel===e.isTopLevel&&t.hasUpvotes===e.hasUpvotes&&t.onUpvote===e.onUpvote&&t.onReply===e.onReply&&t.onEdit===e.onEdit&&t.onDelete===e.onDelete}const w5=C.memo(function({onUpvote:e,onReply:n,onEdit:r,onDelete:i,userUpvoted:o,userIsAuthor:l,isTopLevel:c,hasUpvotes:d}){return E.jsxs("div",{className:F.actionsWrapper,children:[E.jsx("button",{type:"button",className:F.actionsTrigger,"aria-label":"Show comment actions",children:E.jsx(NI,{"aria-hidden":"true"})}),E.jsxs("div",{className:F.actions,role:"group","aria-label":"Comment actions",children:[!d&&E.jsx("button",{type:"button",className:ct(F.actionBtn,o&&F.actionBtnActive),onClick:e,"aria-label":o?"Remove upvote":"Upvote",children:E.jsx(UE,{"aria-hidden":"true"})}),c&&n&&E.jsx("button",{type:"button",className:F.actionBtn,onClick:n,"aria-label":"Reply to comment",children:E.jsx(RI,{"aria-hidden":"true"})}),l&&E.jsxs(E.Fragment,{children:[E.jsx("button",{type:"button",className:F.actionBtn,onClick:r,"aria-label":"Edit comment",children:E.jsx(DI,{"aria-hidden":"true"})}),E.jsx("button",{type:"button",className:ct(F.actionBtn,F.actionBtnDanger),onClick:i,"aria-label":"Delete comment",children:E.jsx(II,{"aria-hidden":"true"})})]})]})]})},S5),_5=C.memo(function({compact:e=!1,children:n}){return E.jsx("div",{className:ct(F.composerBox,e&&F.composerBoxCompact),children:n})});var Om={exports:{}},Nm={};var Ww;function T5(){if(Ww)return Nm;Ww=1;var t=_u();function e(m,y){return m===y&&(m!==0||1/m===1/y)||m!==m&&y!==y}var n=typeof Object.is=="function"?Object.is:e,r=t.useState,i=t.useEffect,o=t.useLayoutEffect,l=t.useDebugValue;function c(m,y){var b=y(),S=r({inst:{value:b,getSnapshot:y}}),w=S[0].inst,T=S[1];return o(function(){w.value=b,w.getSnapshot=y,d(w)&&T({inst:w})},[m,b,y]),i(function(){return d(w)&&T({inst:w}),m(function(){d(w)&&T({inst:w})})},[m]),l(b),b}function d(m){var y=m.getSnapshot;m=m.value;try{var b=y();return!n(m,b)}catch{return!0}}function f(m,y){return y()}var p=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?f:c;return Nm.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:p,Nm}var Zw;function _M(){return Zw||(Zw=1,Om.exports=T5()),Om.exports}var TM=_M();function un(t){this.content=t}un.prototype={constructor:un,find:function(t){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===t)return e;return-1},get:function(t){var e=this.find(t);return e==-1?void 0:this.content[e+1]},update:function(t,e,n){var r=n&&n!=t?this.remove(n):this,i=r.find(t),o=r.content.slice();return i==-1?o.push(n||t,e):(o[i+1]=e,n&&(o[i]=n)),new un(o)},remove:function(t){var e=this.find(t);if(e==-1)return this;var n=this.content.slice();return n.splice(e,2),new un(n)},addToStart:function(t,e){return new un([t,e].concat(this.remove(t).content))},addToEnd:function(t,e){var n=this.remove(t).content.slice();return n.push(t,e),new un(n)},addBefore:function(t,e,n){var r=this.remove(e),i=r.content.slice(),o=r.find(t);return i.splice(o==-1?i.length:o,0,e,n),new un(i)},forEach:function(t){for(var e=0;e<this.content.length;e+=2)t(this.content[e],this.content[e+1])},prepend:function(t){return t=un.from(t),t.size?new un(t.content.concat(this.subtract(t).content)):this},append:function(t){return t=un.from(t),t.size?new un(this.subtract(t).content.concat(t.content)):this},subtract:function(t){var e=this;t=un.from(t);for(var n=0;n<t.content.length;n+=2)e=e.remove(t.content[n]);return e},toObject:function(){var t={};return this.forEach(function(e,n){t[e]=n}),t},get size(){return this.content.length>>1}};un.from=function(t){if(t instanceof un)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new un(e)};function EM(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(r),o=e.child(r);if(i==o){n+=i.nodeSize;continue}if(!i.sameMarkup(o))return n;if(i.isText&&i.text!=o.text){for(let l=0;i.text[l]==o.text[l];l++)n++;return n}if(i.content.size||o.content.size){let l=EM(i.content,o.content,n+1);if(l!=null)return l}n+=i.nodeSize}}function MM(t,e,n,r){for(let i=t.childCount,o=e.childCount;;){if(i==0||o==0)return i==o?null:{a:n,b:r};let l=t.child(--i),c=e.child(--o),d=l.nodeSize;if(l==c){n-=d,r-=d;continue}if(!l.sameMarkup(c))return{a:n,b:r};if(l.isText&&l.text!=c.text){let f=0,p=Math.min(l.text.length,c.text.length);for(;f<p&&l.text[l.text.length-f-1]==c.text[c.text.length-f-1];)f++,n--,r--;return{a:n,b:r}}if(l.content.size||c.content.size){let f=MM(l.content,c.content,n-1,r-1);if(f)return f}n-=d,r-=d}}class oe{constructor(e,n){if(this.content=e,this.size=n||0,n==null)for(let r=0;r<e.length;r++)this.size+=e[r].nodeSize}nodesBetween(e,n,r,i=0,o){for(let l=0,c=0;c<n;l++){let d=this.content[l],f=c+d.nodeSize;if(f>e&&r(d,i+c,o||null,l)!==!1&&d.content.size){let p=c+1;d.nodesBetween(Math.max(0,e-p),Math.min(d.content.size,n-p),r,i+p)}c=f}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,i){let o="",l=!0;return this.nodesBetween(e,n,(c,d)=>{let f=c.isText?c.text.slice(Math.max(e,d)-d,n-d):c.isLeaf?i?typeof i=="function"?i(c):i:c.type.spec.leafText?c.type.spec.leafText(c):"":"";c.isBlock&&(c.isLeaf&&f||c.isTextblock)&&r&&(l?l=!1:o+=r),o+=f},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,i=this.content.slice(),o=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),o=1);o<e.content.length;o++)i.push(e.content[o]);return new oe(i,this.size+e.size)}cut(e,n=this.size){if(e==0&&n==this.size)return this;let r=[],i=0;if(n>e)for(let o=0,l=0;l<n;o++){let c=this.content[o],d=l+c.nodeSize;d>e&&((l<e||d>n)&&(c.isText?c=c.cut(Math.max(0,e-l),Math.min(c.text.length,n-l)):c=c.cut(Math.max(0,e-l-1),Math.min(c.content.size,n-l-1))),r.push(c),i+=c.nodeSize),l=d}return new oe(r,i)}cutByIndex(e,n){return e==n?oe.empty:e==0&&n==this.content.length?this:new oe(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let i=this.content.slice(),o=this.size+n.nodeSize-r.nodeSize;return i[e]=n,new oe(i,o)}addToStart(e){return new oe([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new oe(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;n<this.content.length;n++)if(!this.content[n].eq(e.content[n]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let n=this.content[e];if(!n)throw new RangeError("Index "+e+" out of range for "+this);return n}maybeChild(e){return this.content[e]||null}forEach(e){for(let n=0,r=0;n<this.content.length;n++){let i=this.content[n];e(i,r,n),r+=i.nodeSize}}findDiffStart(e,n=0){return EM(this,e,n)}findDiffEnd(e,n=this.size,r=e.size){return MM(this,e,n,r)}findIndex(e){if(e==0)return id(0,e);if(e==this.size)return id(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),o=r+i.nodeSize;if(o>=e)return o==e?id(n+1,o):id(n,r);r=o}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return oe.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new oe(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return oe.empty;let n,r=0;for(let i=0;i<e.length;i++){let o=e[i];r+=o.nodeSize,i&&o.isText&&e[i-1].sameMarkup(o)?(n||(n=e.slice(0,i)),n[n.length-1]=o.withText(n[n.length-1].text+o.text)):n&&n.push(o)}return new oe(n||e,r)}static from(e){if(!e)return oe.empty;if(e instanceof oe)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new oe([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}oe.empty=new oe([],0);const Rm={index:0,offset:0};function id(t,e){return Rm.index=t,Rm.offset=e,Rm}function qd(t,e){if(t===e)return!0;if(!(t&&typeof t=="object")||!(e&&typeof e=="object"))return!1;let n=Array.isArray(t);if(Array.isArray(e)!=n)return!1;if(n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!qd(t[r],e[r]))return!1}else{for(let r in t)if(!(r in e)||!qd(t[r],e[r]))return!1;for(let r in e)if(!(r in t))return!1}return!0}let Tt=class Fy{constructor(e,n){this.type=e,this.attrs=n}addToSet(e){let n,r=!1;for(let i=0;i<e.length;i++){let o=e[i];if(this.eq(o))return e;if(this.type.excludes(o.type))n||(n=e.slice(0,i));else{if(o.type.excludes(this.type))return e;!r&&o.type.rank>this.type.rank&&(n||(n=e.slice(0,i)),n.push(this),r=!0),n&&n.push(o)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return e.slice(0,n).concat(e.slice(n+1));return e}isInSet(e){for(let n=0;n<e.length;n++)if(this.eq(e[n]))return!0;return!1}eq(e){return this==e||this.type==e.type&&qd(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Mark.fromJSON");let r=e.marks[n.type];if(!r)throw new RangeError(`There is no mark type ${n.type} in this schema`);let i=r.create(n.attrs);return r.checkAttrs(i.attrs),i}static sameSet(e,n){if(e==n)return!0;if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++)if(!e[r].eq(n[r]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return Fy.none;if(e instanceof Fy)return[e];let n=e.slice();return n.sort((r,i)=>r.type.rank-i.type.rank),n}};Tt.none=[];class $d extends Error{}class ge{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=CM(this.content,e+this.openStart,n);return r&&new ge(r,this.openStart,this.openEnd)}removeBetween(e,n){return new ge(xM(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return ge.empty;let r=n.openStart||0,i=n.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new ge(oe.fromJSON(e,n.content),r,i)}static maxOpen(e,n=!0){let r=0,i=0;for(let o=e.firstChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=e.lastChild;o&&!o.isLeaf&&(n||!o.type.spec.isolating);o=o.lastChild)i++;return new ge(e,r,i)}}ge.empty=new ge(oe.empty,0,0);function xM(t,e,n){let{index:r,offset:i}=t.findIndex(e),o=t.maybeChild(r),{index:l,offset:c}=t.findIndex(n);if(i==e||o.isText){if(c!=n&&!t.child(l).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=l)throw new RangeError("Removing non-flat range");return t.replaceChild(r,o.copy(xM(o.content,e-i-1,n-i-1)))}function CM(t,e,n,r){let{index:i,offset:o}=t.findIndex(e),l=t.maybeChild(i);if(o==e||l.isText)return r&&!r.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let c=CM(l.content,e-o-1,n,l);return c&&t.replaceChild(i,l.copy(c))}function E5(t,e,n){if(n.openStart>t.depth)throw new $d("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new $d("Inconsistent open depths");return kM(t,e,n,0)}function kM(t,e,n,r){let i=t.index(r),o=t.node(r);if(i==e.index(r)&&r<t.depth-n.openStart){let l=kM(t,e,n,r+1);return o.copy(o.content.replaceChild(i,l))}else if(n.content.size)if(!n.openStart&&!n.openEnd&&t.depth==r&&e.depth==r){let l=t.parent,c=l.content;return Fs(l,c.cut(0,t.parentOffset).append(n.content).append(c.cut(e.parentOffset)))}else{let{start:l,end:c}=M5(n,t);return Fs(o,OM(t,l,c,e,r))}else return Fs(o,Fd(t,e,r))}function AM(t,e){if(!e.type.compatibleContent(t.type))throw new $d("Cannot join "+e.type.name+" onto "+t.type.name)}function Hy(t,e,n){let r=t.node(n);return AM(r,e.node(n)),r}function $s(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Il(t,e,n,r){let i=(e||t).node(n),o=0,l=e?e.index(n):i.childCount;t&&(o=t.index(n),t.depth>n?o++:t.textOffset&&($s(t.nodeAfter,r),o++));for(let c=o;c<l;c++)$s(i.child(c),r);e&&e.depth==n&&e.textOffset&&$s(e.nodeBefore,r)}function Fs(t,e){return t.type.checkContent(e),t.copy(e)}function OM(t,e,n,r,i){let o=t.depth>i&&Hy(t,e,i+1),l=r.depth>i&&Hy(n,r,i+1),c=[];return Il(null,t,i,c),o&&l&&e.index(i)==n.index(i)?(AM(o,l),$s(Fs(o,OM(t,e,n,r,i+1)),c)):(o&&$s(Fs(o,Fd(t,e,i+1)),c),Il(e,n,i,c),l&&$s(Fs(l,Fd(n,r,i+1)),c)),Il(r,null,i,c),new oe(c)}function Fd(t,e,n){let r=[];if(Il(null,t,n,r),t.depth>n){let i=Hy(t,e,n+1);$s(Fs(i,Fd(t,e,n+1)),r)}return Il(e,null,n,r),new oe(r)}function M5(t,e){let n=e.depth-t.openStart,i=e.node(n).copy(t.content);for(let o=n-1;o>=0;o--)i=e.node(o).copy(oe.from(i));return{start:i.resolveNoCache(t.openStart+n),end:i.resolveNoCache(i.content.size-t.openEnd-n)}}class lu{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=e.child(n);return r?e.child(n).cut(r):i}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let o=0;o<e;o++)i+=r.child(o).nodeSize;return i}marks(){let e=this.parent,n=this.index();if(e.content.size==0)return Tt.none;if(this.textOffset)return e.child(n).marks;let r=e.maybeChild(n-1),i=e.maybeChild(n);if(!r){let c=r;r=i,i=c}let o=r.marks;for(var l=0;l<o.length;l++)o[l].type.spec.inclusive===!1&&(!i||!o[l].isInSet(i.marks))&&(o=o[l--].removeFromSet(o));return o}marksAcross(e){let n=this.parent.maybeChild(this.index());if(!n||!n.isInline)return null;let r=n.marks,i=e.parent.maybeChild(e.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(e){for(let n=this.depth;n>0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos<this.pos)return e.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);r>=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new Hd(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let n=1;n<=this.depth;n++)e+=(e?"/":"")+this.node(n).type.name+"_"+this.index(n-1);return e+":"+this.parentOffset}static resolve(e,n){if(!(n>=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,o=n;for(let l=e;;){let{index:c,offset:d}=l.content.findIndex(o),f=o-d;if(r.push(l,c,i+d),!f||(l=l.child(c),l.isText))break;o=f-1,i+=d+1}return new lu(n,r,o)}static resolveCached(e,n){let r=e_.get(e);if(r)for(let o=0;o<r.elts.length;o++){let l=r.elts[o];if(l.pos==n)return l}else e_.set(e,r=new x5);let i=r.elts[r.i]=lu.resolve(e,n);return r.i=(r.i+1)%C5,i}}class x5{constructor(){this.elts=[],this.i=0}}const C5=12,e_=new WeakMap;class Hd{constructor(e,n,r){this.$from=e,this.$to=n,this.depth=r}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const k5=Object.create(null);class cr{constructor(e,n,r,i=Tt.none){this.type=e,this.attrs=n,this.marks=i,this.content=r||oe.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,n,r,i=0){this.content.nodesBetween(e,n,r,i,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,n,r,i){return this.content.textBetween(e,n,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,n,r){return this.type==e&&qd(this.attrs,n||e.defaultAttrs||k5)&&Tt.sameSet(this.marks,r||Tt.none)}copy(e=null){return e==this.content?this:new cr(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new cr(this.type,this.attrs,this.content,e)}cut(e,n=this.content.size){return e==0&&n==this.content.size?this:this.copy(this.content.cut(e,n))}slice(e,n=this.content.size,r=!1){if(e==n)return ge.empty;let i=this.resolve(e),o=this.resolve(n),l=r?0:i.sharedDepth(n),c=i.start(l),f=i.node(l).content.cut(i.pos-c,o.pos-c);return new ge(f,i.depth-l,o.depth-l)}replace(e,n,r){return E5(this.resolve(e),this.resolve(n),r)}nodeAt(e){for(let n=this;;){let{index:r,offset:i}=n.content.findIndex(e);if(n=n.maybeChild(r),!n)return null;if(i==e||n.isText)return n;e-=i+1}}childAfter(e){let{index:n,offset:r}=this.content.findIndex(e);return{node:this.content.maybeChild(n),index:n,offset:r}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:n,offset:r}=this.content.findIndex(e);if(r<e)return{node:this.content.child(n),index:n,offset:r};let i=this.content.child(n-1);return{node:i,index:n-1,offset:r-i.nodeSize}}resolve(e){return lu.resolveCached(this,e)}resolveNoCache(e){return lu.resolve(this,e)}rangeHasMark(e,n,r){let i=!1;return n>e&&this.nodesBetween(e,n,o=>(r.isInSet(o.marks)&&(i=!0),!i)),i}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),NM(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=oe.empty,i=0,o=r.childCount){let l=this.contentMatchAt(e).matchFragment(r,i,o),c=l&&l.matchFragment(this.content,n);if(!c||!c.validEnd)return!1;for(let d=i;d<o;d++)if(!this.type.allowsMarks(r.child(d).marks))return!1;return!0}canReplaceWith(e,n,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(e).matchType(r),l=o&&o.matchFragment(this.content,n);return l?l.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=Tt.none;for(let n=0;n<this.marks.length;n++){let r=this.marks[n];r.type.checkAttrs(r.attrs),e=r.addToSet(e)}if(!Tt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(n=>n.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let i=oe.fromJSON(e,n.content),o=e.nodeType(n.type).create(n.attrs,i,r);return o.type.checkAttrs(o.attrs),o}}cr.prototype.text=void 0;class Vd extends cr{constructor(e,n,r,i){if(super(e,n,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):NM(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Vd(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Vd(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function NM(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class Xs{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new A5(e,n);if(r.next==null)return Xs.empty;let i=RM(r);r.next&&r.err("Unexpected trailing text");let o=j5(L5(i));return B5(o,r),o}matchType(e){for(let n=0;n<this.next.length;n++)if(this.next[n].type==e)return this.next[n].next;return null}matchFragment(e,n=0,r=e.childCount){let i=this;for(let o=n;i&&o<r;o++)i=i.matchType(e.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:n}=this.next[e];if(!(n.isText||n.hasRequiredAttrs()))return n}return null}compatible(e){for(let n=0;n<this.next.length;n++)for(let r=0;r<e.next.length;r++)if(this.next[n].type==e.next[r].type)return!0;return!1}fillBefore(e,n=!1,r=0){let i=[this];function o(l,c){let d=l.matchFragment(e,r);if(d&&(!n||d.validEnd))return oe.from(c.map(f=>f.createAndFill()));for(let f=0;f<l.next.length;f++){let{type:p,next:m}=l.next[f];if(!(p.isText||p.hasRequiredAttrs())&&i.indexOf(m)==-1){i.push(m);let y=o(m,c.concat(p));if(y)return y}}return null}return o(this,[])}findWrapping(e){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==e)return this.wrapCache[r+1];let n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}computeWrapping(e){let n=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(e)){let l=[];for(let c=i;c.type;c=c.via)l.push(c.type);return l.reverse()}for(let l=0;l<o.next.length;l++){let{type:c,next:d}=o.next[l];!c.isLeaf&&!c.hasRequiredAttrs()&&!(c.name in n)&&(!i.type||d.validEnd)&&(r.push({match:c.contentMatch,type:c,via:i}),n[c.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let i=0;i<r.next.length;i++)e.indexOf(r.next[i].next)==-1&&n(r.next[i].next)}return n(this),e.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let l=0;l<r.next.length;l++)o+=(l?", ":"")+r.next[l].type.name+"->"+e.indexOf(r.next[l].next);return o}).join(`
17
+ `)}}Xs.empty=new Xs(!0);class A5{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function RM(t){let e=[];do e.push(O5(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function O5(t){let e=[];do e.push(N5(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function N5(t){let e=I5(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=R5(t,e);else break;return e}function t_(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function R5(t,e){let n=t_(t),r=n;return t.eat(",")&&(t.next!="}"?r=t_(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function D5(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let i=[];for(let o in n){let l=n[o];l.isInGroup(e)&&i.push(l)}return i.length==0&&t.err("No node type or group '"+e+"' found"),i}function I5(t){if(t.eat("(")){let e=RM(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=D5(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function L5(t){let e=[[]];return i(o(t,0),n()),e;function n(){return e.push([])-1}function r(l,c,d){let f={term:d,to:c};return e[l].push(f),f}function i(l,c){l.forEach(d=>d.to=c)}function o(l,c){if(l.type=="choice")return l.exprs.reduce((d,f)=>d.concat(o(f,c)),[]);if(l.type=="seq")for(let d=0;;d++){let f=o(l.exprs[d],c);if(d==l.exprs.length-1)return f;i(f,c=n())}else if(l.type=="star"){let d=n();return r(c,d),i(o(l.expr,d),d),[r(d)]}else if(l.type=="plus"){let d=n();return i(o(l.expr,c),d),i(o(l.expr,d),d),[r(d)]}else{if(l.type=="opt")return[r(c)].concat(o(l.expr,c));if(l.type=="range"){let d=c;for(let f=0;f<l.min;f++){let p=n();i(o(l.expr,d),p),d=p}if(l.max==-1)i(o(l.expr,d),d);else for(let f=l.min;f<l.max;f++){let p=n();r(d,p),i(o(l.expr,d),p),d=p}return[r(d)]}else{if(l.type=="name")return[r(c,void 0,l.value)];throw new Error("Unknown expr type")}}}}function DM(t,e){return e-t}function n_(t,e){let n=[];return r(e),n.sort(DM);function r(i){let o=t[i];if(o.length==1&&!o[0].term)return r(o[0].to);n.push(i);for(let l=0;l<o.length;l++){let{term:c,to:d}=o[l];!c&&n.indexOf(d)==-1&&r(d)}}}function j5(t){let e=Object.create(null);return n(n_(t,0));function n(r){let i=[];r.forEach(l=>{t[l].forEach(({term:c,to:d})=>{if(!c)return;let f;for(let p=0;p<i.length;p++)i[p][0]==c&&(f=i[p][1]);n_(t,d).forEach(p=>{f||i.push([c,f=[]]),f.indexOf(p)==-1&&f.push(p)})})});let o=e[r.join(",")]=new Xs(r.indexOf(t.length-1)>-1);for(let l=0;l<i.length;l++){let c=i[l][1].sort(DM);o.next.push({type:i[l][0],next:e[c.join(",")]||n(c)})}return o}}function B5(t,e){for(let n=0,r=[t];n<r.length;n++){let i=r[n],o=!i.validEnd,l=[];for(let c=0;c<i.next.length;c++){let{type:d,next:f}=i.next[c];l.push(d.name),o&&!(d.isText||d.hasRequiredAttrs())&&(o=!1),r.indexOf(f)==-1&&r.push(f)}o&&e.err("Only non-generatable nodes ("+l.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function IM(t){let e=Object.create(null);for(let n in t){let r=t[n];if(!r.hasDefault)return null;e[n]=r.default}return e}function LM(t,e){let n=Object.create(null);for(let r in t){let i=e&&e[r];if(i===void 0){let o=t[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}n[r]=i}return n}function jM(t,e,n,r){for(let i in e)if(!(i in t))throw new RangeError(`Unsupported attribute ${i} for ${n} of type ${i}`);for(let i in t){let o=t[i];o.validate&&o.validate(e[i])}}function BM(t,e){let n=Object.create(null);if(e)for(let r in e)n[r]=new P5(t,r,e[r]);return n}let r_=class zM{constructor(e,n,r){this.name=e,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=BM(e,r.attrs),this.defaultAttrs=IM(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==Xs.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:LM(this.attrs,e)}create(e=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new cr(this,this.computeAttrs(e),oe.from(n),Tt.setFrom(r))}createChecked(e=null,n,r){return n=oe.from(n),this.checkContent(n),new cr(this,this.computeAttrs(e),n,Tt.setFrom(r))}createAndFill(e=null,n,r){if(e=this.computeAttrs(e),n=oe.from(n),n.size){let l=this.contentMatch.fillBefore(n);if(!l)return null;n=l.append(n)}let i=this.contentMatch.matchFragment(n),o=i&&i.fillBefore(oe.empty,!0);return o?new cr(this,e,n.append(o),Tt.setFrom(r)):null}validContent(e){let n=this.contentMatch.matchFragment(e);if(!n||!n.validEnd)return!1;for(let r=0;r<e.childCount;r++)if(!this.allowsMarks(e.child(r).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){jM(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;n<e.length;n++)if(!this.allowsMarkType(e[n].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let n;for(let r=0;r<e.length;r++)this.allowsMarkType(e[r].type)?n&&n.push(e[r]):n||(n=e.slice(0,r));return n?n.length?n:Tt.none:e}static compile(e,n){let r=Object.create(null);e.forEach((o,l)=>r[o]=new zM(o,n,l));let i=n.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function z5(t,e,n){let r=n.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${e} on type ${t}, got ${o}`)}}class P5{constructor(e,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?z5(e,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}}class jf{constructor(e,n,r,i){this.name=e,this.rank=n,this.schema=r,this.spec=i,this.attrs=BM(e,i.attrs),this.excluded=null;let o=IM(this.attrs);this.instance=o?new Tt(this,o):null}create(e=null){return!e&&this.instance?this.instance:new Tt(this,LM(this.attrs,e))}static compile(e,n){let r=Object.create(null),i=0;return e.forEach((o,l)=>r[o]=new jf(o,i++,n,l)),r}removeFromSet(e){for(var n=0;n<e.length;n++)e[n].type==this&&(e=e.slice(0,n).concat(e.slice(n+1)),n--);return e}isInSet(e){for(let n=0;n<e.length;n++)if(e[n].type==this)return e[n]}checkAttrs(e){jM(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class PM{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in e)n[i]=e[i];n.nodes=un.from(e.nodes),n.marks=un.from(e.marks||{}),this.nodes=r_.compile(this.spec.nodes,this),this.marks=jf.compile(this.spec.marks,this);let r=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let o=this.nodes[i],l=o.spec.content||"",c=o.spec.marks;if(o.contentMatch=r[l]||(r[l]=Xs.parse(l,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=c=="_"?null:c?i_(this,c.split(" ")):c==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],l=o.spec.excludes;o.excluded=l==null?[o]:l==""?[]:i_(this,l.split(" "))}this.nodeFromJSON=i=>cr.fromJSON(this,i),this.markFromJSON=i=>Tt.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof r_){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,i)}text(e,n){let r=this.nodes.text;return new Vd(r,r.defaultAttrs,e,Tt.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}}function i_(t,e){let n=[];for(let r=0;r<e.length;r++){let i=e[r],o=t.marks[i],l=o;if(o)n.push(o);else for(let c in t.marks){let d=t.marks[c];(i=="_"||d.spec.group&&d.spec.group.split(" ").indexOf(i)>-1)&&n.push(l=d)}if(!l)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}function U5(t){return t.tag!=null}function q5(t){return t.style!=null}class Zi{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(U5(i))this.tags.push(i);else if(q5(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=e.nodes[i.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new o_(this,n,!1);return r.addAll(e,Tt.none,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new o_(this,n,!0);return r.addAll(e,Tt.none,n.from,n.to),ge.maxOpen(r.finish())}matchTag(e,n,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(H5(e,o.tag)&&(o.namespace===void 0||e.namespaceURI==o.namespace)&&(!o.context||n.matchesContext(o.context))){if(o.getAttrs){let l=o.getAttrs(e);if(l===!1)continue;o.attrs=l||void 0}return o}}}matchStyle(e,n,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let l=this.styles[o],c=l.style;if(!(c.indexOf(e)!=0||l.context&&!r.matchesContext(l.context)||c.length>e.length&&(c.charCodeAt(e.length)!=61||c.slice(e.length+1)!=n))){if(l.getAttrs){let d=l.getAttrs(n);if(d===!1)continue;l.attrs=d||void 0}return l}}}static schemaRules(e){let n=[];function r(i){let o=i.priority==null?50:i.priority,l=0;for(;l<n.length;l++){let c=n[l];if((c.priority==null?50:c.priority)<o)break}n.splice(l,0,i)}for(let i in e.marks){let o=e.marks[i].spec.parseDOM;o&&o.forEach(l=>{r(l=a_(l)),l.mark||l.ignore||l.clearMark||(l.mark=i)})}for(let i in e.nodes){let o=e.nodes[i].spec.parseDOM;o&&o.forEach(l=>{r(l=a_(l)),l.node||l.ignore||l.mark||(l.node=i)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Zi(e,Zi.schemaRules(e)))}}const UM={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},$5={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},qM={ol:!0,ul:!0},uu=1,Vy=2,Ll=4;function s_(t,e,n){return e!=null?(e?uu:0)|(e==="full"?Vy:0):t&&t.whitespace=="pre"?uu|Vy:n&~Ll}class sd{constructor(e,n,r,i,o,l){this.type=e,this.attrs=n,this.marks=r,this.solid=i,this.options=l,this.content=[],this.activeMarks=Tt.none,this.match=o||(l&Ll?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(oe.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(e.type))?(this.match=r,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&uu)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let n=oe.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(oe.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!UM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class o_{constructor(e,n,r){this.parser=e,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,o,l=s_(null,n.preserveWhitespace,0)|(r?Ll:0);i?o=new sd(i.type,i.attrs,Tt.none,!0,n.topMatch||i.type.contentMatch,l):r?o=new sd(null,null,Tt.none,!0,null,l):o=new sd(e.schema.topNodeType,null,Tt.none,!0,null,l),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,n){e.nodeType==3?this.addTextNode(e,n):e.nodeType==1&&this.addElement(e,n)}addTextNode(e,n){let r=e.nodeValue,i=this.top,o=i.options&Vy?"full":this.localPreserveWS||(i.options&uu)>0,{schema:l}=this.parser;if(o==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(r)){if(o)if(o==="full")r=r.replace(/\r\n?/g,`
18
+ `);else if(l.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(l.linebreakReplacement.create())){let c=r.split(/\r?\n|\r/);for(let d=0;d<c.length;d++)d&&this.insertNode(l.linebreakReplacement.create(),n,!0),c[d]&&this.insertNode(l.text(c[d]),n,!/\S/.test(c[d]));r=""}else r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let c=i.content[i.content.length-1],d=e.previousSibling;(!c||d&&d.nodeName=="BR"||c.isText&&/[ \t\r\n\u000c]$/.test(c.text))&&(r=r.slice(1))}r&&this.insertNode(l.text(r),n,!/\S/.test(r)),this.findInText(e)}else this.findInside(e)}addElement(e,n,r){let i=this.localPreserveWS,o=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let l=e.nodeName.toLowerCase(),c;qM.hasOwnProperty(l)&&this.parser.normalizeLists&&F5(e);let d=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(c=this.parser.matchTag(e,this,r));e:if(d?d.ignore:$5.hasOwnProperty(l))this.findInside(e),this.ignoreFallback(e,n);else if(!d||d.skip||d.closeParent){d&&d.closeParent?this.open=Math.max(0,this.open-1):d&&d.skip.nodeType&&(e=d.skip);let f,p=this.needsBlock;if(UM.hasOwnProperty(l))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),f=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,n);break e}let m=d&&d.skip?n:this.readStyles(e,n);m&&this.addAll(e,m),f&&this.sync(o),this.needsBlock=p}else{let f=this.readStyles(e,n);f&&this.addElementByRule(e,d,f,d.consuming===!1?c:void 0)}this.localPreserveWS=i}leafFallback(e,n){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
19
+ `),n)}ignoreFallback(e,n){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),n,!0)}readStyles(e,n){let r=e.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],l=r.getPropertyValue(o);if(l)for(let c=void 0;;){let d=this.parser.matchStyle(o,l,this,c);if(!d)break;if(d.ignore)return null;if(d.clearMark?n=n.filter(f=>!d.clearMark(f)):n=n.concat(this.parser.schema.marks[d.mark].create(d.attrs)),d.consuming===!1)c=d;else break}}return n}addElementByRule(e,n,r,i){let o,l;if(n.node)if(l=this.parser.schema.nodes[n.node],l.isLeaf)this.insertNode(l.create(n.attrs),r,e.nodeName=="BR")||this.leafFallback(e,r);else{let d=this.enter(l,n.attrs||null,r,n.preserveWhitespace);d&&(o=!0,r=d)}else{let d=this.parser.schema.marks[n.mark];r=r.concat(d.create(n.attrs))}let c=this.top;if(l&&l.isLeaf)this.findInside(e);else if(i)this.addElement(e,r,i);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(d=>this.insertNode(d,r,!1));else{let d=e;typeof n.contentElement=="string"?d=e.querySelector(n.contentElement):typeof n.contentElement=="function"?d=n.contentElement(e):n.contentElement&&(d=n.contentElement),this.findAround(e,d,!0),this.addAll(d,r),this.findAround(e,d,!1)}o&&this.sync(c)&&this.open--}addAll(e,n,r,i){let o=r||0;for(let l=r?e.childNodes[r]:e.firstChild,c=i==null?null:e.childNodes[i];l!=c;l=l.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(l,n);this.findAtPoint(e,o)}findPlace(e,n,r){let i,o;for(let l=this.open,c=0;l>=0;l--){let d=this.nodes[l],f=d.findWrapping(e);if(f&&(!i||i.length>f.length+c)&&(i=f,o=d,!f.length))break;if(d.solid){if(r)break;c+=2}}if(!i)return null;this.sync(o);for(let l=0;l<i.length;l++)n=this.enterInner(i[l],null,n,!1);return n}insertNode(e,n,r){if(e.isInline&&this.needsBlock&&!this.top.type){let o=this.textblockFromContext();o&&(n=this.enterInner(o,null,n))}let i=this.findPlace(e,n,r);if(i){this.closeExtra();let o=this.top;o.match&&(o.match=o.match.matchType(e.type));let l=Tt.none;for(let c of i.concat(e.marks))(o.type?o.type.allowsMarkType(c.type):l_(c.type,e.type))&&(l=c.addToSet(l));return o.content.push(e.mark(l)),!0}return!1}enter(e,n,r,i){let o=this.findPlace(e.create(n),r,!1);return o&&(o=this.enterInner(e,n,r,!0,i)),o}enterInner(e,n,r,i=!1,o){this.closeExtra();let l=this.top;l.match=l.match&&l.match.matchType(e);let c=s_(e,o,l.options);l.options&Ll&&l.content.length==0&&(c|=Ll);let d=Tt.none;return r=r.filter(f=>(l.type?l.type.allowsMarkType(f.type):l_(f.type,e))?(d=f.addToSet(d),!1):!0),this.nodes.push(new sd(e,n,d,i,null,c)),this.open++,r}closeExtra(e=!1){let n=this.nodes.length-1;if(n>this.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let n=this.open;n>=0;n--){if(this.nodes[n]==e)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=uu)}return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)e+=r[i].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==e&&this.find[r].offset==n&&(this.find[r].pos=this.currentPos)}findInside(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].pos==null&&e.nodeType==1&&e.contains(this.find[n].node)&&(this.find[n].pos=this.currentPos)}findAround(e,n,r){if(e!=n&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&n.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(e){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&(this.find[n].pos=this.currentPos-(e.nodeValue.length-this.find[n].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),l=(c,d)=>{for(;c>=0;c--){let f=n[c];if(f==""){if(c==n.length-1||c==0)continue;for(;d>=o;d--)if(l(c-1,d))return!0;return!1}else{let p=d>0||d==0&&i?this.nodes[d].type:r&&d>=o?r.node(d-o).type:null;if(!p||p.name!=f&&!p.isInGroup(f))return!1;d--}}return!0};return l(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}}function F5(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&qM.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function H5(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function a_(t){let e={};for(let n in t)e[n]=t[n];return e}function l_(t,e){let n=e.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(t))continue;let o=[],l=c=>{o.push(c);for(let d=0;d<c.edgeCount;d++){let{type:f,next:p}=c.edge(d);if(f==e||o.indexOf(p)<0&&l(p))return!0}};if(l(i.contentMatch))return!0}}class to{constructor(e,n){this.nodes=e,this.marks=n}serializeFragment(e,n={},r){r||(r=Dm(n).createDocumentFragment());let i=r,o=[];return e.forEach(l=>{if(o.length||l.marks.length){let c=0,d=0;for(;c<o.length&&d<l.marks.length;){let f=l.marks[d];if(!this.marks[f.type.name]){d++;continue}if(!f.eq(o[c][0])||f.type.spec.spanning===!1)break;c++,d++}for(;c<o.length;)i=o.pop()[1];for(;d<l.marks.length;){let f=l.marks[d++],p=this.serializeMark(f,l.isInline,n);p&&(o.push([f,i]),i.appendChild(p.dom),i=p.contentDOM||p.dom)}}i.appendChild(this.serializeNodeInner(l,n))}),r}serializeNodeInner(e,n){let{dom:r,contentDOM:i}=Td(Dm(n),this.nodes[e.type.name](e),null,e.attrs);if(i){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,n,i)}return r}serializeNode(e,n={}){let r=this.serializeNodeInner(e,n);for(let i=e.marks.length-1;i>=0;i--){let o=this.serializeMark(e.marks[i],e.isInline,n);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(e,n,r={}){let i=this.marks[e.type.name];return i&&Td(Dm(r),i(e,n),null,e.attrs)}static renderSpec(e,n,r=null,i){return Td(e,n,r,i)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new to(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=u_(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return u_(e.marks)}}function u_(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Dm(t){return t.document||window.document}const c_=new WeakMap;function V5(t){let e=c_.get(t);return e===void 0&&c_.set(t,e=K5(t)),e}function K5(t){let e=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")e||(e=[]),e.push(r);else for(let i=0;i<r.length;i++)n(r[i]);else for(let i in r)n(r[i])}return n(t),e}function Td(t,e,n,r){if(typeof e=="string")return{dom:t.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let i=e[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=V5(r))&&o.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let l=i.indexOf(" ");l>0&&(n=i.slice(0,l),i=i.slice(l+1));let c,d=n?t.createElementNS(n,i):t.createElement(i),f=e[1],p=1;if(f&&typeof f=="object"&&f.nodeType==null&&!Array.isArray(f)){p=2;for(let m in f)if(f[m]!=null){let y=m.indexOf(" ");y>0?d.setAttributeNS(m.slice(0,y),m.slice(y+1),f[m]):m=="style"&&d.style?d.style.cssText=f[m]:d.setAttribute(m,f[m])}}for(let m=p;m<e.length;m++){let y=e[m];if(y===0){if(m<e.length-1||m>p)throw new RangeError("Content hole must be the only child of its parent node");return{dom:d,contentDOM:d}}else{let{dom:b,contentDOM:S}=Td(t,y,n,r);if(d.appendChild(b),S){if(c)throw new RangeError("Multiple content holes");c=S}}}return{dom:d,contentDOM:c}}const $M=65535,FM=Math.pow(2,16);function G5(t,e){return t+e*FM}function d_(t){return t&$M}function Y5(t){return(t-(t&$M))/FM}const HM=1,VM=2,Ed=4,KM=8;class Ky{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&KM)>0}get deletedBefore(){return(this.delInfo&(HM|Ed))>0}get deletedAfter(){return(this.delInfo&(VM|Ed))>0}get deletedAcross(){return(this.delInfo&Ed)>0}}class Fn{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&Fn.empty)return Fn.empty}recover(e){let n=0,r=d_(e);if(!this.inverted)for(let i=0;i<r;i++)n+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+n+Y5(e)}mapResult(e,n=1){return this._map(e,n,!1)}map(e,n=1){return this._map(e,n,!0)}_map(e,n,r){let i=0,o=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let d=this.ranges[c]-(this.inverted?i:0);if(d>e)break;let f=this.ranges[c+o],p=this.ranges[c+l],m=d+f;if(e<=m){let y=f?e==d?-1:e==m?1:n:n,b=d+i+(y<0?0:p);if(r)return b;let S=e==(n<0?d:m)?null:G5(c/3,e-d),w=e==d?VM:e==m?HM:Ed;return(n<0?e!=d:e!=m)&&(w|=KM),new Ky(b,w,S)}i+=p-f}return r?e+i:new Ky(e+i,0,null)}touches(e,n){let r=0,i=d_(n),o=this.inverted?2:1,l=this.inverted?1:2;for(let c=0;c<this.ranges.length;c+=3){let d=this.ranges[c]-(this.inverted?r:0);if(d>e)break;let f=this.ranges[c+o],p=d+f;if(e<=p&&c==i*3)return!0;r+=this.ranges[c+l]-f}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let l=this.ranges[i],c=l-(this.inverted?o:0),d=l+(this.inverted?0:o),f=this.ranges[i+n],p=this.ranges[i+r];e(c,c+f,d,d+p),o+=p-f}}invert(){return new Fn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Fn.empty:new Fn(e<0?[0,-e,0]:[0,0,e])}}Fn.empty=new Fn([]);class cu{constructor(e,n,r=0,i=e?e.length:0){this.mirror=n,this.from=r,this.to=i,this._maps=e||[],this.ownData=!(e||n)}get maps(){return this._maps}slice(e=0,n=this.maps.length){return new cu(this._maps,this.mirror,e,n)}appendMap(e,n){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),n!=null&&this.setMirror(this._maps.length-1,n)}appendMapping(e){for(let n=0,r=this._maps.length;n<e._maps.length;n++){let i=e.getMirror(n);this.appendMap(e._maps[n],i!=null&&i<n?r+i:void 0)}}getMirror(e){if(this.mirror){for(let n=0;n<this.mirror.length;n++)if(this.mirror[n]==e)return this.mirror[n+(n%2?-1:1)]}}setMirror(e,n){this.mirror||(this.mirror=[]),this.mirror.push(e,n)}appendMappingInverted(e){for(let n=e.maps.length-1,r=this._maps.length+e._maps.length;n>=0;n--){let i=e.getMirror(n);this.appendMap(e._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let e=new cu;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;r<this.to;r++)e=this._maps[r].map(e,n);return e}mapResult(e,n=1){return this._map(e,n,!1)}_map(e,n,r){let i=0;for(let o=this.from;o<this.to;o++){let l=this._maps[o],c=l.mapResult(e,n);if(c.recover!=null){let d=this.getMirror(o);if(d!=null&&d>o&&d<this.to){o=d,e=this._maps[d].recover(c.recover);continue}}i|=c.delInfo,e=c.pos}return r?e:new Ky(e,i,null)}}const Im=Object.create(null);class gn{getMap(){return Fn.empty}merge(e){return null}static fromJSON(e,n){if(!n||!n.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=Im[n.stepType];if(!r)throw new RangeError(`No step type ${n.stepType} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Im)throw new RangeError("Duplicate use of step JSON ID "+e);return Im[e]=n,n.prototype.jsonID=e,n}}class Vt{constructor(e,n){this.doc=e,this.failed=n}static ok(e){return new Vt(e,null)}static fail(e){return new Vt(null,e)}static fromReplace(e,n,r,i){try{return Vt.ok(e.replace(n,r,i))}catch(o){if(o instanceof $d)return Vt.fail(o.message);throw o}}}function Dg(t,e,n){let r=[];for(let i=0;i<t.childCount;i++){let o=t.child(i);o.content.size&&(o=o.copy(Dg(o.content,e,o))),o.isInline&&(o=e(o,n,i)),r.push(o)}return oe.fromArray(r)}class Xi extends gn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=e.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new ge(Dg(n.content,(l,c)=>!l.isAtom||!c.type.allowsMarkType(this.mark.type)?l:l.mark(this.mark.addToSet(l.marks)),i),n.openStart,n.openEnd);return Vt.fromReplace(e,this.from,this.to,o)}invert(){return new Sr(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Xi(n.pos,r.pos,this.mark)}merge(e){return e instanceof Xi&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Xi(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Xi(n.from,n.to,e.markFromJSON(n.mark))}}gn.jsonID("addMark",Xi);class Sr extends gn{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ge(Dg(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),n.openStart,n.openEnd);return Vt.fromReplace(e,this.from,this.to,r)}invert(){return new Xi(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new Sr(n.pos,r.pos,this.mark)}merge(e){return e instanceof Sr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Sr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Sr(n.from,n.to,e.markFromJSON(n.mark))}}gn.jsonID("removeMark",Sr);class Ji extends gn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new ge(oe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;i<n.marks.length;i++)if(!n.marks[i].isInSet(r))return new Ji(this.pos,n.marks[i]);return new Ji(this.pos,this.mark)}}return new Js(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Ji(n.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Ji(n.pos,e.markFromJSON(n.mark))}}gn.jsonID("addNodeMark",Ji);class Js extends gn{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.removeFromSet(n.marks));return Vt.fromReplace(e,this.pos,this.pos+1,new ge(oe.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);return!n||!this.mark.isInSet(n.marks)?this:new Ji(this.pos,this.mark)}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new Js(n.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Js(n.pos,e.markFromJSON(n.mark))}}gn.jsonID("removeNodeMark",Js);class Wt extends gn{constructor(e,n,r,i=!1){super(),this.from=e,this.to=n,this.slice=r,this.structure=i}apply(e){return this.structure&&Gy(e,this.from,this.to)?Vt.fail("Structure replace would overwrite content"):Vt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Fn([this.from,this.to-this.from,this.slice.size])}invert(e){return new Wt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deletedAcross&&r.deletedAcross?null:new Wt(n.pos,Math.max(n.pos,r.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Wt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let n=this.slice.size+e.slice.size==0?ge.empty:new ge(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Wt(this.from,this.to+(e.to-e.from),n,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let n=this.slice.size+e.slice.size==0?ge.empty:new ge(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Wt(e.from,this.to,n,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Wt(n.from,n.to,ge.fromJSON(e,n.slice),!!n.structure)}}gn.jsonID("replace",Wt);class en extends gn{constructor(e,n,r,i,o,l,c=!1){super(),this.from=e,this.to=n,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=l,this.structure=c}apply(e){if(this.structure&&(Gy(e,this.from,this.gapFrom)||Gy(e,this.gapTo,this.to)))return Vt.fail("Structure gap-replace would overwrite content");let n=e.slice(this.gapFrom,this.gapTo);if(n.openStart||n.openEnd)return Vt.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,n.content);return r?Vt.fromReplace(e,this.from,this.to,r):Vt.fail("Content does not fit in gap")}getMap(){return new Fn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let n=this.gapTo-this.gapFrom;return new en(this.from,this.from+this.slice.size+n,this.from+this.insert,this.from+this.insert+n,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),i=this.from==this.gapFrom?n.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return n.deletedAcross&&r.deletedAcross||i<n.pos||o>r.pos?null:new en(n.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new en(n.from,n.to,n.gapFrom,n.gapTo,ge.fromJSON(e,n.slice),n.insert,!!n.structure)}}gn.jsonID("replaceAround",en);function Gy(t,e,n){let r=t.resolve(e),i=n-e,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let l=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!l||l.isLeaf)return!0;l=l.firstChild,i--}}return!1}function Q5(t,e,n,r){let i=[],o=[],l,c;t.doc.nodesBetween(e,n,(d,f,p)=>{if(!d.isInline)return;let m=d.marks;if(!r.isInSet(m)&&p.type.allowsMarkType(r.type)){let y=Math.max(f,e),b=Math.min(f+d.nodeSize,n),S=r.addToSet(m);for(let w=0;w<m.length;w++)m[w].isInSet(S)||(l&&l.to==y&&l.mark.eq(m[w])?l.to=b:i.push(l=new Sr(y,b,m[w])));c&&c.to==y?c.to=b:o.push(c=new Xi(y,b,r))}}),i.forEach(d=>t.step(d)),o.forEach(d=>t.step(d))}function X5(t,e,n,r){let i=[],o=0;t.doc.nodesBetween(e,n,(l,c)=>{if(!l.isInline)return;o++;let d=null;if(r instanceof jf){let f=l.marks,p;for(;p=r.isInSet(f);)(d||(d=[])).push(p),f=p.removeFromSet(f)}else r?r.isInSet(l.marks)&&(d=[r]):d=l.marks;if(d&&d.length){let f=Math.min(c+l.nodeSize,n);for(let p=0;p<d.length;p++){let m=d[p],y;for(let b=0;b<i.length;b++){let S=i[b];S.step==o-1&&m.eq(i[b].style)&&(y=S)}y?(y.to=f,y.step=o):i.push({style:m,from:Math.max(c,e),to:f,step:o})}}}),i.forEach(l=>t.step(new Sr(l.from,l.to,l.style)))}function Ig(t,e,n,r=n.contentMatch,i=!0){let o=t.doc.nodeAt(e),l=[],c=e+1;for(let d=0;d<o.childCount;d++){let f=o.child(d),p=c+f.nodeSize,m=r.matchType(f.type);if(!m)l.push(new Wt(c,p,ge.empty));else{r=m;for(let y=0;y<f.marks.length;y++)n.allowsMarkType(f.marks[y].type)||t.step(new Sr(c,p,f.marks[y]));if(i&&f.isText&&n.whitespace!="pre"){let y,b=/\r?\n|\r/g,S;for(;y=b.exec(f.text);)S||(S=new ge(oe.from(n.schema.text(" ",n.allowedMarks(f.marks))),0,0)),l.push(new Wt(c+y.index,c+y.index+y[0].length,S))}}c=p}if(!r.validEnd){let d=r.fillBefore(oe.empty,!0);t.replace(c,c,new ge(d,0,0))}for(let d=l.length-1;d>=0;d--)t.step(l[d])}function J5(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function Ma(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth,i=0,o=0;;--r){let l=t.$from.node(r),c=t.$from.index(r)+i,d=t.$to.indexAfter(r)-o;if(r<t.depth&&l.canReplace(c,d,n))return r;if(r==0||l.type.spec.isolating||!J5(l,c,d))break;c&&(i=1),d<l.childCount&&(o=1)}return null}function W5(t,e,n){let{$from:r,$to:i,depth:o}=e,l=r.before(o+1),c=i.after(o+1),d=l,f=c,p=oe.empty,m=0;for(let S=o,w=!1;S>n;S--)w||r.index(S)>0?(w=!0,p=oe.from(r.node(S).copy(p)),m++):d--;let y=oe.empty,b=0;for(let S=o,w=!1;S>n;S--)w||i.after(S+1)<i.end(S)?(w=!0,y=oe.from(i.node(S).copy(y)),b++):f++;t.step(new en(d,f,l,c,new ge(p.append(y),m,b),p.size-m,!0))}function Lg(t,e,n=null,r=t){let i=Z5(t,e),o=i&&eB(r,e);return o?i.map(f_).concat({type:e,attrs:n}).concat(o.map(f_)):null}function f_(t){return{type:t,attrs:null}}function Z5(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.contentMatchAt(r).findWrapping(e);if(!o)return null;let l=o.length?o[0]:e;return n.canReplaceWith(r,i,l)?o:null}function eB(t,e){let{parent:n,startIndex:r,endIndex:i}=t,o=n.child(r),l=e.contentMatch.findWrapping(o.type);if(!l)return null;let d=(l.length?l[l.length-1]:e).contentMatch;for(let f=r;d&&f<i;f++)d=d.matchType(n.child(f).type);return!d||!d.validEnd?null:l}function tB(t,e,n){let r=oe.empty;for(let l=n.length-1;l>=0;l--){if(r.size){let c=n[l].type.contentMatch.matchFragment(r);if(!c||!c.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=oe.from(n[l].type.create(n[l].attrs,r))}let i=e.start,o=e.end;t.step(new en(i,o,i,o,new ge(r,0,0),n.length,!0))}function nB(t,e,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=t.steps.length;t.doc.nodesBetween(e,n,(l,c)=>{let d=typeof i=="function"?i(l):i;if(l.isTextblock&&!l.hasMarkup(r,d)&&rB(t.doc,t.mapping.slice(o).map(c),r)){let f=null;if(r.schema.linebreakReplacement){let b=r.whitespace=="pre",S=!!r.contentMatch.matchType(r.schema.linebreakReplacement);b&&!S?f=!1:!b&&S&&(f=!0)}f===!1&&YM(t,l,c,o),Ig(t,t.mapping.slice(o).map(c,1),r,void 0,f===null);let p=t.mapping.slice(o),m=p.map(c,1),y=p.map(c+l.nodeSize,1);return t.step(new en(m,y,m+1,y-1,new ge(oe.from(r.create(d,null,l.marks)),0,0),1,!0)),f===!0&&GM(t,l,c,o),!1}})}function GM(t,e,n,r){e.forEach((i,o)=>{if(i.isText){let l,c=/\r?\n|\r/g;for(;l=c.exec(i.text);){let d=t.mapping.slice(r).map(n+1+o+l.index);t.replaceWith(d,d+1,e.type.schema.linebreakReplacement.create())}}})}function YM(t,e,n,r){e.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let l=t.mapping.slice(r).map(n+1+o);t.replaceWith(l,l+1,e.type.schema.text(`
20
+ `))}})}function rB(t,e,n){let r=t.resolve(e),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function iB(t,e,n,r,i){let o=t.doc.nodeAt(e);if(!o)throw new RangeError("No node at given position");n||(n=o.type);let l=n.create(r,null,i||o.marks);if(o.isLeaf)return t.replaceWith(e,e+o.nodeSize,l);if(!n.validContent(o.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new en(e,e+o.nodeSize,e+1,e+o.nodeSize-1,new ge(oe.from(l),0,0),1,!0))}function ci(t,e,n=1,r){let i=t.resolve(e),o=i.depth-n,l=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!l.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let f=i.depth-1,p=n-2;f>o;f--,p--){let m=i.node(f),y=i.index(f);if(m.type.spec.isolating)return!1;let b=m.content.cutByIndex(y,m.childCount),S=r&&r[p+1];S&&(b=b.replaceChild(0,S.type.create(S.attrs)));let w=r&&r[p]||m;if(!m.canReplace(y+1,m.childCount)||!w.type.validContent(b))return!1}let c=i.indexAfter(o),d=r&&r[0];return i.node(o).canReplaceWith(c,c,d?d.type:i.node(o+1).type)}function sB(t,e,n=1,r){let i=t.doc.resolve(e),o=oe.empty,l=oe.empty;for(let c=i.depth,d=i.depth-n,f=n-1;c>d;c--,f--){o=oe.from(i.node(c).copy(o));let p=r&&r[f];l=oe.from(p?p.type.create(p.attrs,l):i.node(c).copy(l))}t.step(new Wt(e,e,new ge(o.append(l),n,n),!0))}function ls(t,e){let n=t.resolve(e),r=n.index();return QM(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function oB(t,e){e.content.size||t.type.compatibleContent(e.type);let n=t.contentMatchAt(t.childCount),{linebreakReplacement:r}=t.type.schema;for(let i=0;i<e.childCount;i++){let o=e.child(i),l=o.type==r?t.type.schema.nodes.text:o.type;if(n=n.matchType(l),!n||!t.type.allowsMarks(o.marks))return!1}return n.validEnd}function QM(t,e){return!!(t&&e&&!t.isLeaf&&oB(t,e))}function Bf(t,e,n=-1){let r=t.resolve(e);for(let i=r.depth;;i--){let o,l,c=r.index(i);if(i==r.depth?(o=r.nodeBefore,l=r.nodeAfter):n>0?(o=r.node(i+1),c++,l=r.node(i).maybeChild(c)):(o=r.node(i).maybeChild(c-1),l=r.node(i+1)),o&&!o.isTextblock&&QM(o,l)&&r.node(i).canReplace(c,c+1))return e;if(i==0)break;e=n<0?r.before(i):r.after(i)}}function aB(t,e,n){let r=null,{linebreakReplacement:i}=t.doc.type.schema,o=t.doc.resolve(e-n),l=o.node().type;if(i&&l.inlineContent){let p=l.whitespace=="pre",m=!!l.contentMatch.matchType(i);p&&!m?r=!1:!p&&m&&(r=!0)}let c=t.steps.length;if(r===!1){let p=t.doc.resolve(e+n);YM(t,p.node(),p.before(),c)}l.inlineContent&&Ig(t,e+n-1,l,o.node().contentMatchAt(o.index()),r==null);let d=t.mapping.slice(c),f=d.map(e-n);if(t.step(new Wt(f,d.map(e+n,-1),ge.empty,!0)),r===!0){let p=t.doc.resolve(f);GM(t,p.node(),p.before(),t.steps.length)}return t}function lB(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,n))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,n))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function XM(t,e,n){let r=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let o=0;o<n.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(n.openStart==0&&n.size?2:1);o++)for(let l=r.depth;l>=0;l--){let c=l==r.depth?0:r.pos<=(r.start(l+1)+r.end(l+1))/2?-1:1,d=r.index(l)+(c>0?1:0),f=r.node(l),p=!1;if(o==1)p=f.canReplace(d,d,i);else{let m=f.contentMatchAt(d).findWrapping(i.firstChild.type);p=m&&f.canReplaceWith(d,d,m[0])}if(p)return c==0?r.pos:c<0?r.before(l+1):r.after(l+1)}return null}function zf(t,e,n=e,r=ge.empty){if(e==n&&!r.size)return null;let i=t.resolve(e),o=t.resolve(n);return JM(i,o,r)?new Wt(e,n,r):new uB(i,o,r).fit()}function JM(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}class uB{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=oe.empty;for(let i=0;i<=e.depth;i++){let o=e.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=oe.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let f=this.findFittable();f?this.placeNodes(f):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(e<0?this.$to:r.doc.resolve(e));if(!i)return null;let o=this.placed,l=r.depth,c=i.depth;for(;l&&c&&o.childCount==1;)o=o.firstChild.content,l--,c--;let d=new ge(o,l,c);return e>-1?new en(r.pos,e,this.$to.pos,this.$to.end(),d,n):d.size||r.pos!=this.$to.pos?new Wt(r.pos,i.pos,d):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<e;r++){let o=n.firstChild;if(n.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){e=r;break}n=o.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=Lm(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let l=i.firstChild;for(let c=this.depth;c>=0;c--){let{type:d,match:f}=this.frontier[c],p,m=null;if(n==1&&(l?f.matchType(l.type)||(m=f.fillBefore(oe.from(l),!1)):o&&d.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:c,parent:o,inject:m};if(n==2&&l&&(p=f.findWrapping(l.type)))return{sliceDepth:r,frontierDepth:c,parent:o,wrap:p};if(o&&f.matchType(o.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Lm(e,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new ge(e,n+1,Math.max(r,i.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,i=Lm(e,n);if(i.childCount<=1&&n>0){let o=e.size-n<=n+i.size;this.unplaced=new ge(kl(e,n-1,1),n-1,o?n-1:r)}else this.unplaced=new ge(kl(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:i,wrap:o}){for(;this.depth>n;)this.closeFrontierNode();if(o)for(let w=0;w<o.length;w++)this.openFrontierNode(o[w]);let l=this.unplaced,c=r?r.content:l.content,d=l.openStart-e,f=0,p=[],{match:m,type:y}=this.frontier[n];if(i){for(let w=0;w<i.childCount;w++)p.push(i.child(w));m=m.matchFragment(i)}let b=c.size+e-(l.content.size-l.openEnd);for(;f<c.childCount;){let w=c.child(f),T=m.matchType(w.type);if(!T)break;f++,(f>1||d==0||w.content.size)&&(m=T,p.push(WM(w.mark(y.allowedMarks(w.marks)),f==1?d:0,f==c.childCount?b:-1)))}let S=f==c.childCount;S||(b=-1),this.placed=Al(this.placed,n,oe.from(p)),this.frontier[n].match=m,S&&b<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let w=0,T=c;w<b;w++){let M=T.lastChild;this.frontier.push({type:M.type,match:M.contentMatchAt(M.childCount)}),T=M.content}this.unplaced=S?e==0?ge.empty:new ge(kl(l.content,e-1,1),e-1,b<0?l.openEnd:e-1):new ge(kl(l.content,e,f),l.openStart,l.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],n;if(!e.type.isTextblock||!jm(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(n=this.findCloseLevel(this.$to))&&n.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],o=n<e.depth&&e.end(n+1)==e.pos+(e.depth-(n+1)),l=jm(e,n,i,r,o);if(l){for(let c=n-1;c>=0;c--){let{match:d,type:f}=this.frontier[c],p=jm(e,c,f,d,!0);if(!p||p.childCount)continue e}return{depth:n,fit:l,move:o?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=Al(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let i=e.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,e.index(r));this.openFrontierNode(i.type,i.attrs,o)}return e}openFrontierNode(e,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=Al(this.placed,this.depth,oe.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(oe.empty,!0);n.childCount&&(this.placed=Al(this.placed,this.frontier.length,n))}}function kl(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(kl(t.firstChild.content,e-1,n)))}function Al(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(Al(t.lastChild.content,e-1,n)))}function Lm(t,e){for(let n=0;n<e;n++)t=t.firstChild.content;return t}function WM(t,e,n){if(e<=0)return t;let r=t.content;return e>1&&(r=r.replaceChild(0,WM(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(oe.empty,!0)))),t.copy(r)}function jm(t,e,n,r,i){let o=t.node(e),l=i?t.indexAfter(e):t.index(e);if(l==o.childCount&&!n.compatibleContent(o.type))return null;let c=r.fillBefore(o.content,!0,l);return c&&!cB(n,o.content,l)?c:null}function cB(t,e,n){for(let r=n;r<e.childCount;r++)if(!t.allowsMarks(e.child(r).marks))return!0;return!1}function dB(t){return t.spec.defining||t.spec.definingForContent}function fB(t,e,n,r){if(!r.size)return t.deleteRange(e,n);let i=t.doc.resolve(e),o=t.doc.resolve(n);if(JM(i,o,r))return t.step(new Wt(e,n,r));let l=ex(i,o);l[l.length-1]==0&&l.pop();let c=-(i.depth+1);l.unshift(c);for(let y=i.depth,b=i.pos-1;y>0;y--,b--){let S=i.node(y).type.spec;if(S.defining||S.definingAsContext||S.isolating)break;l.indexOf(y)>-1?c=y:i.before(y)==b&&l.splice(1,0,-y)}let d=l.indexOf(c),f=[],p=r.openStart;for(let y=r.content,b=0;;b++){let S=y.firstChild;if(f.push(S),b==r.openStart)break;y=S.content}for(let y=p-1;y>=0;y--){let b=f[y],S=dB(b.type);if(S&&!b.sameMarkup(i.node(Math.abs(c)-1)))p=y;else if(S||!b.type.isTextblock)break}for(let y=r.openStart;y>=0;y--){let b=(y+p+1)%(r.openStart+1),S=f[b];if(S)for(let w=0;w<l.length;w++){let T=l[(w+d)%l.length],M=!0;T<0&&(M=!1,T=-T);let k=i.node(T-1),j=i.index(T-1);if(k.canReplaceWith(j,j,S.type,S.marks))return t.replace(i.before(T),M?o.after(T):n,new ge(ZM(r.content,0,r.openStart,b),b,r.openEnd))}}let m=t.steps.length;for(let y=l.length-1;y>=0&&(t.replace(e,n,r),!(t.steps.length>m));y--){let b=l[y];b<0||(e=i.before(b),n=o.after(b))}}function ZM(t,e,n,r,i){if(e<n){let o=t.firstChild;t=t.replaceChild(0,o.copy(ZM(o.content,e+1,n,r,o)))}if(e>r){let o=i.contentMatchAt(0),l=o.fillBefore(t).append(t);t=l.append(o.matchFragment(l).fillBefore(oe.empty,!0))}return t}function hB(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let i=lB(t.doc,e,r.type);i!=null&&(e=n=i)}t.replaceRange(e,n,new ge(oe.from(r),0,0))}function pB(t,e,n){let r=t.doc.resolve(e),i=t.doc.resolve(n),o=ex(r,i);for(let l=0;l<o.length;l++){let c=o[l],d=l==o.length-1;if(d&&c==0||r.node(c).type.contentMatch.validEnd)return t.delete(r.start(c),i.end(c));if(c>0&&(d||r.node(c-1).canReplace(r.index(c-1),i.indexAfter(c-1))))return t.delete(r.before(c),i.after(c))}for(let l=1;l<=r.depth&&l<=i.depth;l++)if(e-r.start(l)==r.depth-l&&n>r.end(l)&&i.end(l)-n!=i.depth-l&&r.start(l-1)==i.start(l-1)&&r.node(l-1).canReplace(r.index(l-1),i.index(l-1)))return t.delete(r.before(l),n);t.delete(e,n)}function ex(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let i=r;i>=0;i--){let o=t.start(i);if(o<t.pos-(t.depth-i)||e.end(i)>e.pos+(e.depth-i)||t.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(o==e.start(i)||i==t.depth&&i==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==o-1)&&n.push(i)}return n}class ea extends gn{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return Vt.fail("No node at attribute step's position");let r=Object.create(null);for(let o in n.attrs)r[o]=n.attrs[o];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return Vt.fromReplace(e,this.pos,this.pos+1,new ge(oe.from(i),0,n.isLeaf?0:1))}getMap(){return Fn.empty}invert(e){return new ea(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new ea(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ea(n.pos,n.attr,n.value)}}gn.jsonID("attr",ea);class du extends gn{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let i in e.attrs)n[i]=e.attrs[i];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return Vt.ok(r)}getMap(){return Fn.empty}invert(e){return new du(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new du(n.attr,n.value)}}gn.jsonID("docAttr",du);let ya=class extends Error{};ya=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};ya.prototype=Object.create(Error.prototype);ya.prototype.constructor=ya;ya.prototype.name="TransformError";class tx{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new cu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new ya(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ge.empty){let i=zf(this.doc,e,n,r);return i&&this.step(i),this}replaceWith(e,n,r){return this.replace(e,n,new ge(oe.from(r),0,0))}delete(e,n){return this.replace(e,n,ge.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return fB(this,e,n,r),this}replaceRangeWith(e,n,r){return hB(this,e,n,r),this}deleteRange(e,n){return pB(this,e,n),this}lift(e,n){return W5(this,e,n),this}join(e,n=1){return aB(this,e,n),this}wrap(e,n){return tB(this,e,n),this}setBlockType(e,n=e,r,i=null){return nB(this,e,n,r,i),this}setNodeMarkup(e,n,r=null,i){return iB(this,e,n,r,i),this}setNodeAttribute(e,n,r){return this.step(new ea(e,n,r)),this}setDocAttribute(e,n){return this.step(new du(e,n)),this}addNodeMark(e,n){return this.step(new Ji(e,n)),this}removeNodeMark(e,n){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n instanceof Tt)n.isInSet(r.marks)&&this.step(new Js(e,n));else{let i=r.marks,o,l=[];for(;o=n.isInSet(i);)l.push(new Js(e,o)),i=o.removeFromSet(i);for(let c=l.length-1;c>=0;c--)this.step(l[c])}return this}split(e,n=1,r){return sB(this,e,n,r),this}addMark(e,n,r){return Q5(this,e,n,r),this}removeMark(e,n,r){return X5(this,e,n,r),this}clearIncompatible(e,n,r){return Ig(this,e,n,r),this}}const Bm=Object.create(null);class He{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new mB(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n<e.length;n++)if(e[n].$from.pos!=e[n].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,n=ge.empty){let r=n.content.lastChild,i=null;for(let c=0;c<n.openEnd;c++)i=r,r=r.lastChild;let o=e.steps.length,l=this.ranges;for(let c=0;c<l.length;c++){let{$from:d,$to:f}=l[c],p=e.mapping.slice(o);e.replaceRange(p.map(d.pos),p.map(f.pos),c?ge.empty:n),c==0&&m_(e,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,n){let r=e.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:l,$to:c}=i[o],d=e.mapping.slice(r),f=d.map(l.pos),p=d.map(c.pos);o?e.deleteRange(f,p):(e.replaceRangeWith(f,p,n),m_(e,r,n.isInline?-1:1))}}static findFrom(e,n,r=!1){let i=e.parent.inlineContent?new Pe(e):Go(e.node(0),e.parent,e.pos,e.index(),n,r);if(i)return i;for(let o=e.depth-1;o>=0;o--){let l=n<0?Go(e.node(0),e.node(o),e.before(o+1),e.index(o),n,r):Go(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,n,r);if(l)return l}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new Hn(e.node(0))}static atStart(e){return Go(e,e,0,0,1)||new Hn(e)}static atEnd(e){return Go(e,e,e.content.size,e.childCount,-1)||new Hn(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Bm[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Bm)throw new RangeError("Duplicate use of selection JSON ID "+e);return Bm[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Pe.between(this.$anchor,this.$head).getBookmark()}}He.prototype.visible=!0;class mB{constructor(e,n){this.$from=e,this.$to=n}}let h_=!1;function p_(t){!h_&&!t.parent.inlineContent&&(h_=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class Pe extends He{constructor(e,n=e){p_(e),p_(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return He.near(r);let i=e.resolve(n.map(this.anchor));return new Pe(i.parent.inlineContent?i:r,r)}replace(e,n=ge.empty){if(super.replace(e,n),n==ge.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof Pe&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Pf(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Pe(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let i=e.resolve(n);return new this(i,r==n?i:e.resolve(r))}static between(e,n,r){let i=e.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let o=He.findFrom(n,r,!0)||He.findFrom(n,-r,!0);if(o)n=o.$head;else return He.near(n,r)}return e.parent.inlineContent||(i==0?e=n:(e=(He.findFrom(e,-r,!0)||He.findFrom(e,r,!0)).$anchor,e.pos<n.pos!=i<0&&(e=n))),new Pe(e,n)}}He.jsonID("text",Pe);class Pf{constructor(e,n){this.anchor=e,this.head=n}map(e){return new Pf(e.map(this.anchor),e.map(this.head))}resolve(e){return Pe.between(e.resolve(this.anchor),e.resolve(this.head))}}class Ae extends He{constructor(e){let n=e.nodeAfter,r=e.node(0).resolve(e.pos+n.nodeSize);super(e,r),this.node=n}map(e,n){let{deleted:r,pos:i}=n.mapResult(this.anchor),o=e.resolve(i);return r?He.near(o):new Ae(o)}content(){return new ge(oe.from(this.node),0,0)}eq(e){return e instanceof Ae&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new jg(this.anchor)}static fromJSON(e,n){if(typeof n.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Ae(e.resolve(n.anchor))}static create(e,n){return new Ae(e.resolve(n))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Ae.prototype.visible=!1;He.jsonID("node",Ae);class jg{constructor(e){this.anchor=e}map(e){let{deleted:n,pos:r}=e.mapResult(this.anchor);return n?new Pf(r,r):new jg(r)}resolve(e){let n=e.resolve(this.anchor),r=n.nodeAfter;return r&&Ae.isSelectable(r)?new Ae(n):He.near(n)}}class Hn extends He{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,n=ge.empty){if(n==ge.empty){e.delete(0,e.doc.content.size);let r=He.atStart(e.doc);r.eq(e.selection)||e.setSelection(r)}else super.replace(e,n)}toJSON(){return{type:"all"}}static fromJSON(e){return new Hn(e)}map(e){return new Hn(e)}eq(e){return e instanceof Hn}getBookmark(){return yB}}He.jsonID("all",Hn);const yB={map(){return this},resolve(t){return new Hn(t)}};function Go(t,e,n,r,i,o=!1){if(e.inlineContent)return Pe.create(t,n);for(let l=r-(i>0?0:1);i>0?l<e.childCount:l>=0;l+=i){let c=e.child(l);if(c.isAtom){if(!o&&Ae.isSelectable(c))return Ae.create(t,n-(i<0?c.nodeSize:0))}else{let d=Go(t,c,n+i,i<0?c.childCount:0,i,o);if(d)return d}n+=c.nodeSize*i}return null}function m_(t,e,n){let r=t.steps.length-1;if(r<e)return;let i=t.steps[r];if(!(i instanceof Wt||i instanceof en))return;let o=t.mapping.maps[r],l;o.forEach((c,d,f,p)=>{l==null&&(l=p)}),t.setSelection(He.near(t.doc.resolve(l),n))}const y_=1,od=2,g_=4;class gB extends tx{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|y_)&~od,this.storedMarks=null,this}get selectionSet(){return(this.updated&y_)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=od,this}ensureMarks(e){return Tt.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&od)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~od,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Tt.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let i=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(i.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),!e)return this.deleteRange(n,r);let o=this.storedMarks;if(!o){let l=this.doc.resolve(n);o=r==n?l.marks():l.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(e,o)),!this.selection.empty&&this.selection.to==n+e.length&&this.setSelection(He.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=g_,this}get scrolledIntoView(){return(this.updated&g_)>0}}function b_(t,e){return!e||!t?t:t.bind(e)}class Ol{constructor(e,n,r){this.name=e,this.init=b_(n.init,r),this.apply=b_(n.apply,r)}}const bB=[new Ol("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new Ol("selection",{init(t,e){return t.selection||He.atStart(e.doc)},apply(t){return t.selection}}),new Ol("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new Ol("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})];class zm{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=bB.slice(),n&&n.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new Ol(r.key,r.spec.state,r))})}}class Wo{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=n){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let n=[e],r=this.applyInner(e),i=null;for(;;){let o=!1;for(let l=0;l<this.config.plugins.length;l++){let c=this.config.plugins[l];if(c.spec.appendTransaction){let d=i?i[l].n:0,f=i?i[l].state:this,p=d<n.length&&c.spec.appendTransaction.call(c,d?n.slice(d):n,f,r);if(p&&r.filterTransaction(p,l)){if(p.setMeta("appendedTransaction",e),!i){i=[];for(let m=0;m<this.config.plugins.length;m++)i.push(m<l?{state:r,n:n.length}:{state:this,n:0})}n.push(p),r=r.applyInner(p),o=!0}i&&(i[l]={state:r,n:n.length})}}if(!o)return{state:r,transactions:n}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let n=new Wo(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];n[o.name]=o.apply(e,this[o.name],this,n)}return n}get tr(){return new gB(this)}static create(e){let n=new zm(e.doc?e.doc.type.schema:e.schema,e.plugins),r=new Wo(n);for(let i=0;i<n.fields.length;i++)r[n.fields[i].name]=n.fields[i].init(e,r);return r}reconfigure(e){let n=new zm(this.schema,e.plugins),r=n.fields,i=new Wo(n);for(let o=0;o<r.length;o++){let l=r[o].name;i[l]=this.hasOwnProperty(l)?this[l]:r[o].init(e,i)}return i}toJSON(e){let n={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(n.storedMarks=this.storedMarks.map(r=>r.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=e[r],o=i.spec.state;o&&o.toJSON&&(n[r]=o.toJSON.call(i,this[i.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let i=new zm(e.schema,e.plugins),o=new Wo(i);return i.fields.forEach(l=>{if(l.name=="doc")o.doc=cr.fromJSON(e.schema,n.doc);else if(l.name=="selection")o.selection=He.fromJSON(o.doc,n.selection);else if(l.name=="storedMarks")n.storedMarks&&(o.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let c in r){let d=r[c],f=d.spec.state;if(d.key==l.name&&f&&f.fromJSON&&Object.prototype.hasOwnProperty.call(n,c)){o[l.name]=f.fromJSON.call(d,e,n[c],o);return}}o[l.name]=l.init(e,o)}}),o}}function nx(t,e,n){for(let r in t){let i=t[r];i instanceof Function?i=i.bind(e):r=="handleDOMEvents"&&(i=nx(i,e,{})),n[r]=i}return n}let Ot=class{constructor(e){this.spec=e,this.props={},e.props&&nx(e.props,this,this.props),this.key=e.key?e.key.key:rx("plugin")}getState(e){return e[this.key]}};const Pm=Object.create(null);function rx(t){return t in Pm?t+"$"+ ++Pm[t]:(Pm[t]=0,t+"$")}class Pt{constructor(e="key"){this.key=rx(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Bg=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function ix(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const sx=(t,e,n)=>{let r=ix(t,n);if(!r)return!1;let i=zg(r);if(!i){let l=r.blockRange(),c=l&&Ma(l);return c==null?!1:(e&&e(t.tr.lift(l,c).scrollIntoView()),!0)}let o=i.nodeBefore;if(px(t,i,e,-1))return!0;if(r.parent.content.size==0&&(ga(o,"end")||Ae.isSelectable(o)))for(let l=r.depth;;l--){let c=zf(t.doc,r.before(l),r.after(l),ge.empty);if(c&&c.slice.size<c.to-c.from){if(e){let d=t.tr.step(c);d.setSelection(ga(o,"end")?He.findFrom(d.doc.resolve(d.mapping.map(i.pos,-1)),-1):Ae.create(d.doc,i.pos-o.nodeSize)),e(d.scrollIntoView())}return!0}if(l==1||r.node(l-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},vB=(t,e,n)=>{let r=ix(t,n);if(!r)return!1;let i=zg(r);return i?ox(t,i,e):!1},SB=(t,e,n)=>{let r=lx(t,n);if(!r)return!1;let i=Pg(r);return i?ox(t,i,e):!1};function ox(t,e,n){let r=e.nodeBefore,i=r,o=e.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let p=i.lastChild;if(!p)return!1;i=p}let l=e.nodeAfter,c=l,d=e.pos+1;for(;!c.isTextblock;d++){if(c.type.spec.isolating)return!1;let p=c.firstChild;if(!p)return!1;c=p}let f=zf(t.doc,o,d,ge.empty);if(!f||f.from!=o||f instanceof Wt&&f.slice.size>=d-o)return!1;if(n){let p=t.tr.step(f);p.setSelection(Pe.create(p.doc,o)),n(p.scrollIntoView())}return!0}function ga(t,e,n=!1){for(let r=t;r;r=e=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}const ax=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;o=zg(r)}let l=o&&o.nodeBefore;return!l||!Ae.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ae.create(t.doc,o.pos-l.nodeSize)).scrollIntoView()),!0)};function zg(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function lx(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset<n.parent.content.size)?null:n}const ux=(t,e,n)=>{let r=lx(t,n);if(!r)return!1;let i=Pg(r);if(!i)return!1;let o=i.nodeAfter;if(px(t,i,e,1))return!0;if(r.parent.content.size==0&&(ga(o,"start")||Ae.isSelectable(o))){let l=zf(t.doc,r.before(),r.after(),ge.empty);if(l&&l.slice.size<l.to-l.from){if(e){let c=t.tr.step(l);c.setSelection(ga(o,"start")?He.findFrom(c.doc.resolve(c.mapping.map(i.pos)),1):Ae.create(c.doc,c.mapping.map(i.pos))),e(c.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(e&&e(t.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},cx=(t,e,n)=>{let{$head:r,empty:i}=t.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset<r.parent.content.size)return!1;o=Pg(r)}let l=o&&o.nodeAfter;return!l||!Ae.isSelectable(l)?!1:(e&&e(t.tr.setSelection(Ae.create(t.doc,o.pos)).scrollIntoView()),!0)};function Pg(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){let n=t.node(e);if(t.index(e)+1<n.childCount)return t.doc.resolve(t.after(e+1));if(n.type.spec.isolating)break}return null}const wB=(t,e)=>{let n=t.selection,r=n instanceof Ae,i;if(r){if(n.node.isTextblock||!ls(t.doc,n.from))return!1;i=n.from}else if(i=Bf(t.doc,n.from,-1),i==null)return!1;if(e){let o=t.tr.join(i);r&&o.setSelection(Ae.create(o.doc,i-t.doc.resolve(i).nodeBefore.nodeSize)),e(o.scrollIntoView())}return!0},_B=(t,e)=>{let n=t.selection,r;if(n instanceof Ae){if(n.node.isTextblock||!ls(t.doc,n.to))return!1;r=n.to}else if(r=Bf(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},TB=(t,e)=>{let{$from:n,$to:r}=t.selection,i=n.blockRange(r),o=i&&Ma(i);return o==null?!1:(e&&e(t.tr.lift(i,o).scrollIntoView()),!0)},dx=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(`
21
+ `).scrollIntoView()),!0)};function Ug(t){for(let e=0;e<t.edgeCount;e++){let{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const EB=(t,e)=>{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),o=n.indexAfter(-1),l=Ug(i.contentMatchAt(o));if(!l||!i.canReplaceWith(o,o,l))return!1;if(e){let c=n.after(),d=t.tr.replaceWith(c,c,l.createAndFill());d.setSelection(He.near(d.doc.resolve(c),1)),e(d.scrollIntoView())}return!0},fx=(t,e)=>{let n=t.selection,{$from:r,$to:i}=n;if(n instanceof Hn||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=Ug(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(e){let l=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,c=t.tr.insert(l,o.createAndFill());c.setSelection(Pe.create(c.doc,l+1)),e(c.scrollIntoView())}return!0},hx=(t,e)=>{let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if(ci(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Ma(r);return i==null?!1:(e&&e(t.tr.lift(r,i).scrollIntoView()),!0)};function MB(t){return(e,n)=>{let{$from:r,$to:i}=e.selection;if(e.selection instanceof Ae&&e.selection.node.isBlock)return!r.parentOffset||!ci(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],l,c,d=!1,f=!1;for(let b=r.depth;;b--)if(r.node(b).isBlock){d=r.end(b)==r.pos+(r.depth-b),f=r.start(b)==r.pos-(r.depth-b),c=Ug(r.node(b-1).contentMatchAt(r.indexAfter(b-1))),o.unshift(d&&c?{type:c}:null),l=b;break}else{if(b==1)return!1;o.unshift(null)}let p=e.tr;(e.selection instanceof Pe||e.selection instanceof Hn)&&p.deleteSelection();let m=p.mapping.map(r.pos),y=ci(p.doc,m,o.length,o);if(y||(o[0]=c?{type:c}:null,y=ci(p.doc,m,o.length,o)),!y)return!1;if(p.split(m,o.length,o),!d&&f&&r.node(l).type!=c){let b=p.mapping.map(r.before(l)),S=p.doc.resolve(b);c&&r.node(l-1).canReplaceWith(S.index(),S.index()+1,c)&&p.setNodeMarkup(p.mapping.map(r.before(l)),c)}return n&&n(p.scrollIntoView()),!0}}const xB=MB(),CB=(t,e)=>{let{$from:n,to:r}=t.selection,i,o=n.sharedDepth(r);return o==0?!1:(i=n.before(o),e&&e(t.tr.setSelection(Ae.create(t.doc,i))),!0)};function kB(t,e,n){let r=e.nodeBefore,i=e.nodeAfter,o=e.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&e.parent.canReplace(o-1,o)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(o,o+1)||!(i.isTextblock||ls(t.doc,e.pos))?!1:(n&&n(t.tr.join(e.pos).scrollIntoView()),!0)}function px(t,e,n,r){let i=e.nodeBefore,o=e.nodeAfter,l,c,d=i.type.spec.isolating||o.type.spec.isolating;if(!d&&kB(t,e,n))return!0;let f=!d&&e.parent.canReplace(e.index(),e.index()+1);if(f&&(l=(c=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&c.matchType(l[0]||o.type).validEnd){if(n){let b=e.pos+o.nodeSize,S=oe.empty;for(let M=l.length-1;M>=0;M--)S=oe.from(l[M].create(null,S));S=oe.from(i.copy(S));let w=t.tr.step(new en(e.pos-1,b,e.pos,b,new ge(S,1,0),l.length,!0)),T=w.doc.resolve(b+2*l.length);T.nodeAfter&&T.nodeAfter.type==i.type&&ls(w.doc,T.pos)&&w.join(T.pos),n(w.scrollIntoView())}return!0}let p=o.type.spec.isolating||r>0&&d?null:He.findFrom(e,1),m=p&&p.$from.blockRange(p.$to),y=m&&Ma(m);if(y!=null&&y>=e.depth)return n&&n(t.tr.lift(m,y).scrollIntoView()),!0;if(f&&ga(o,"start",!0)&&ga(i,"end")){let b=i,S=[];for(;S.push(b),!b.isTextblock;)b=b.lastChild;let w=o,T=1;for(;!w.isTextblock;w=w.firstChild)T++;if(b.canReplace(b.childCount,b.childCount,w.content)){if(n){let M=oe.empty;for(let j=S.length-1;j>=0;j--)M=oe.from(S[j].copy(M));let k=t.tr.step(new en(e.pos-S.length,e.pos+o.nodeSize,e.pos+T,e.pos+o.nodeSize-T,new ge(M,S.length,0),0,!0));n(k.scrollIntoView())}return!0}}return!1}function mx(t){return function(e,n){let r=e.selection,i=t<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(n&&n(e.tr.setSelection(Pe.create(e.doc,t<0?i.start(o):i.end(o)))),!0):!1}}const AB=mx(-1),OB=mx(1);function NB(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,l=i.blockRange(o),c=l&&Lg(l,t,e);return c?(r&&r(n.tr.wrap(l,c).scrollIntoView()),!0):!1}}function v_(t,e=null){return function(n,r){let i=!1;for(let o=0;o<n.selection.ranges.length&&!i;o++){let{$from:{pos:l},$to:{pos:c}}=n.selection.ranges[o];n.doc.nodesBetween(l,c,(d,f)=>{if(i)return!1;if(!(!d.isTextblock||d.hasMarkup(t,e)))if(d.type==t)i=!0;else{let p=n.doc.resolve(f),m=p.index();i=p.parent.canReplaceWith(m,m+1,t)}})}if(!i)return!1;if(r){let o=n.tr;for(let l=0;l<n.selection.ranges.length;l++){let{$from:{pos:c},$to:{pos:d}}=n.selection.ranges[l];o.setBlockType(c,d,t,e)}r(o.scrollIntoView())}return!0}}function qg(...t){return function(e,n,r){for(let i=0;i<t.length;i++)if(t[i](e,n,r))return!0;return!1}}qg(Bg,sx,ax);qg(Bg,ux,cx);qg(dx,fx,hx,xB);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function RB(t,e=null){return function(n,r){let{$from:i,$to:o}=n.selection,l=i.blockRange(o);if(!l)return!1;let c=r?n.tr:null;return DB(c,l,t,e)?(r&&r(c.scrollIntoView()),!0):!1}}function DB(t,e,n,r=null){let i=!1,o=e,l=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(n)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let d=l.resolve(e.start-2);o=new Hd(d,d,e.depth),e.endIndex<e.parent.childCount&&(e=new Hd(e.$from,l.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let c=Lg(o,n,r,e);return c?(t&&IB(t,e,c,i,n),!0):!1}function IB(t,e,n,r,i){let o=oe.empty;for(let p=n.length-1;p>=0;p--)o=oe.from(n[p].type.create(n[p].attrs,o));t.step(new en(e.start-(r?2:0),e.end,e.start,e.end,new ge(o,0,0),n.length,!0));let l=0;for(let p=0;p<n.length;p++)n[p].type==i&&(l=p+1);let c=n.length-l,d=e.start+n.length-(r?2:0),f=e.parent;for(let p=e.startIndex,m=e.endIndex,y=!0;p<m;p++,y=!1)!y&&ci(t.doc,d,c)&&(t.split(d,c),d+=2*c),d+=f.child(p).nodeSize;return t}function LB(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,l=>l.childCount>0&&l.firstChild.type==t);return o?n?r.node(o.depth-1).type==t?jB(e,n,t,o):BB(e,n,o):!0:!1}}function jB(t,e,n,r){let i=t.tr,o=r.end,l=r.$to.end(r.depth);o<l&&(i.step(new en(o-1,l,o,l,new ge(oe.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new Hd(i.doc.resolve(r.$from.pos),i.doc.resolve(l),r.depth));const c=Ma(r);if(c==null)return!1;i.lift(r,c);let d=i.doc.resolve(i.mapping.map(o,-1)-1);return ls(i.doc,d.pos)&&d.nodeBefore.type==d.nodeAfter.type&&i.join(d.pos),e(i.scrollIntoView()),!0}function BB(t,e,n){let r=t.tr,i=n.parent;for(let b=n.end,S=n.endIndex-1,w=n.startIndex;S>w;S--)b-=i.child(S).nodeSize,r.delete(b-1,b+1);let o=r.doc.resolve(n.start),l=o.nodeAfter;if(r.mapping.map(n.end)!=n.start+o.nodeAfter.nodeSize)return!1;let c=n.startIndex==0,d=n.endIndex==i.childCount,f=o.node(-1),p=o.index(-1);if(!f.canReplace(p+(c?0:1),p+1,l.content.append(d?oe.empty:oe.from(i))))return!1;let m=o.pos,y=m+l.nodeSize;return r.step(new en(m-(c?1:0),y+(d?1:0),m+1,y-1,new ge((c?oe.empty:oe.from(i.copy(oe.empty))).append(d?oe.empty:oe.from(i.copy(oe.empty))),c?0:1,d?0:1),c?0:1)),e(r.scrollIntoView()),!0}function zB(t){return function(e,n){let{$from:r,$to:i}=e.selection,o=r.blockRange(i,f=>f.childCount>0&&f.firstChild.type==t);if(!o)return!1;let l=o.startIndex;if(l==0)return!1;let c=o.parent,d=c.child(l-1);if(d.type!=t)return!1;if(n){let f=d.lastChild&&d.lastChild.type==c.type,p=oe.from(f?t.create():null),m=new ge(oe.from(t.create(null,oe.from(c.type.create(null,p)))),f?3:1,0),y=o.start,b=o.end;n(e.tr.step(new en(y-(f?3:1),b,y,b,m,1,!0)).scrollIntoView())}return!0}}const cn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},ba=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e};let Yy=null;const si=function(t,e,n){let r=Yy||(Yy=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},PB=function(){Yy=null},Ws=function(t,e,n,r){return n&&(S_(t,e,n,r,-1)||S_(t,e,n,r,1))},UB=/^(img|br|input|textarea|hr)$/i;function S_(t,e,n,r,i){for(var o;;){if(t==n&&e==r)return!0;if(e==(i<0?0:ur(t))){let l=t.parentNode;if(!l||l.nodeType!=1||Tu(t)||UB.test(t.nodeName)||t.contentEditable=="false")return!1;e=cn(t)+(i<0?0:1),t=l}else if(t.nodeType==1){let l=t.childNodes[e+(i<0?-1:0)];if(l.nodeType==1&&l.contentEditable=="false")if(!((o=l.pmViewDesc)===null||o===void 0)&&o.ignoreForSelection)e+=i;else return!1;else t=l,e=i<0?ur(t):0}else return!1}}function ur(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function qB(t,e){for(;;){if(t.nodeType==3&&e)return t;if(t.nodeType==1&&e>0){if(t.contentEditable=="false")return null;t=t.childNodes[e-1],e=ur(t)}else if(t.parentNode&&!Tu(t))e=cn(t),t=t.parentNode;else return null}}function $B(t,e){for(;;){if(t.nodeType==3&&e<t.nodeValue.length)return t;if(t.nodeType==1&&e<t.childNodes.length){if(t.contentEditable=="false")return null;t=t.childNodes[e],e=0}else if(t.parentNode&&!Tu(t))e=cn(t)+1,t=t.parentNode;else return null}}function FB(t,e,n){for(let r=e==0,i=e==ur(t);r||i;){if(t==n)return!0;let o=cn(t);if(t=t.parentNode,!t)return!1;r=r&&o==0,i=i&&o==ur(t)}}function Tu(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const Uf=function(t){return t.focusNode&&Ws(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function Is(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function HB(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function VB(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:Math.min(ur(r.offsetNode),r.offset)}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:Math.min(ur(r.startContainer),r.startOffset)}}}const Dr=typeof navigator<"u"?navigator:null,w_=typeof document<"u"?document:null,us=Dr&&Dr.userAgent||"",Qy=/Edge\/(\d+)/.exec(us),yx=/MSIE \d/.exec(us),Xy=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(us),Ln=!!(yx||Xy||Qy),es=yx?document.documentMode:Xy?+Xy[1]:Qy?+Qy[1]:0,dr=!Ln&&/gecko\/(\d+)/i.test(us);dr&&+(/Firefox\/(\d+)/.exec(us)||[0,0])[1];const Jy=!Ln&&/Chrome\/(\d+)/.exec(us),Zt=!!Jy,gx=Jy?+Jy[1]:0,yn=!Ln&&!!Dr&&/Apple Computer/.test(Dr.vendor),va=yn&&(/Mobile\/\w+/.test(us)||!!Dr&&Dr.maxTouchPoints>2),lr=va||(Dr?/Mac/.test(Dr.platform):!1),bx=Dr?/Win/.test(Dr.platform):!1,ui=/Android \d/.test(us),Eu=!!w_&&"webkitFontSmoothing"in w_.documentElement.style,KB=Eu?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function GB(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ei(t,e){return typeof t=="number"?t:t[e]}function YB(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function __(t,e,n){let r=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,o=t.dom.ownerDocument;for(let l=n||t.dom;l;){if(l.nodeType!=1){l=ba(l);continue}let c=l,d=c==o.body,f=d?GB(o):YB(c),p=0,m=0;if(e.top<f.top+ei(r,"top")?m=-(f.top-e.top+ei(i,"top")):e.bottom>f.bottom-ei(r,"bottom")&&(m=e.bottom-e.top>f.bottom-f.top?e.top+ei(i,"top")-f.top:e.bottom-f.bottom+ei(i,"bottom")),e.left<f.left+ei(r,"left")?p=-(f.left-e.left+ei(i,"left")):e.right>f.right-ei(r,"right")&&(p=e.right-f.right+ei(i,"right")),p||m)if(d)o.defaultView.scrollBy(p,m);else{let b=c.scrollLeft,S=c.scrollTop;m&&(c.scrollTop+=m),p&&(c.scrollLeft+=p);let w=c.scrollLeft-b,T=c.scrollTop-S;e={left:e.left-w,top:e.top-T,right:e.right-w,bottom:e.bottom-T}}let y=d?"fixed":getComputedStyle(l).position;if(/^(fixed|sticky)$/.test(y))break;l=y=="absolute"?l.offsetParent:ba(l)}}function QB(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,i;for(let o=(e.left+e.right)/2,l=n+1;l<Math.min(innerHeight,e.bottom);l+=5){let c=t.root.elementFromPoint(o,l);if(!c||c==t.dom||!t.dom.contains(c))continue;let d=c.getBoundingClientRect();if(d.top>=n-20){r=c,i=d.top;break}}return{refDOM:r,refTop:i,stack:vx(t.dom)}}function vx(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=ba(r));return e}function XB({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;Sx(n,r==0?0:r-e)}function Sx(t,e){for(let n=0;n<t.length;n++){let{dom:r,top:i,left:o}=t[n];r.scrollTop!=i+e&&(r.scrollTop=i+e),r.scrollLeft!=o&&(r.scrollLeft=o)}}let Ho=null;function JB(t){if(t.setActive)return t.setActive();if(Ho)return t.focus(Ho);let e=vx(t);t.focus(Ho==null?{get preventScroll(){return Ho={preventScroll:!0},!0}}:void 0),Ho||(Ho=!1,Sx(e,0))}function wx(t,e){let n,r=2e8,i,o=0,l=e.top,c=e.top,d,f;for(let p=t.firstChild,m=0;p;p=p.nextSibling,m++){let y;if(p.nodeType==1)y=p.getClientRects();else if(p.nodeType==3)y=si(p).getClientRects();else continue;for(let b=0;b<y.length;b++){let S=y[b];if(S.top<=l&&S.bottom>=c){l=Math.max(S.bottom,l),c=Math.min(S.top,c);let w=S.left>e.left?S.left-e.left:S.right<e.left?e.left-S.right:0;if(w<r){n=p,r=w,i=w&&n.nodeType==3?{left:S.right<e.left?S.right:S.left,top:e.top}:e,p.nodeType==1&&w&&(o=m+(e.left>=(S.left+S.right)/2?1:0));continue}}else S.top>e.top&&!d&&S.left<=e.left&&S.right>=e.left&&(d=p,f={left:Math.max(S.left,Math.min(S.right,e.left)),top:S.top});!n&&(e.left>=S.right&&e.top>=S.top||e.left>=S.left&&e.top>=S.bottom)&&(o=m+1)}}return!n&&d&&(n=d,i=f,r=0),n&&n.nodeType==3?WB(n,i):!n||r&&n.nodeType==1?{node:t,offset:o}:wx(n,i)}function WB(t,e){let n=t.nodeValue.length,r=document.createRange(),i;for(let o=0;o<n;o++){r.setEnd(t,o+1),r.setStart(t,o);let l=Hi(r,1);if(l.top!=l.bottom&&$g(e,l)){i={node:t,offset:o+(e.left>=(l.left+l.right)/2?1:0)};break}}return r.detach(),i||{node:t,offset:0}}function $g(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function ZB(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left<t.getBoundingClientRect().left?n:t}function e4(t,e,n){let{node:r,offset:i}=wx(e,n),o=-1;if(r.nodeType==1&&!r.firstChild){let l=r.getBoundingClientRect();o=l.left!=l.right&&n.left>(l.left+l.right)/2?1:-1}return t.docView.posFromDOM(r,i,o)}function t4(t,e,n,r){let i=-1;for(let o=e,l=!1;o!=t.dom;){let c=t.docView.nearestDesc(o,!0),d;if(!c)return null;if(c.dom.nodeType==1&&(c.node.isBlock&&c.parent||!c.contentDOM)&&((d=c.dom.getBoundingClientRect()).width||d.height)&&(c.node.isBlock&&c.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(c.dom.nodeName)&&(!l&&d.left>r.left||d.top>r.top?i=c.posBefore:(!l&&d.right<r.left||d.bottom<r.top)&&(i=c.posAfter),l=!0),!c.contentDOM&&i<0&&!c.node.isText))return(c.node.isBlock?r.top<(d.top+d.bottom)/2:r.left<(d.left+d.right)/2)?c.posBefore:c.posAfter;o=c.dom.parentNode}return i>-1?i:t.docView.posFromDOM(e,n,-1)}function _x(t,e,n){let r=t.childNodes.length;if(r&&n.top<n.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(e.top-n.top)/(n.bottom-n.top))-2)),o=i;;){let l=t.childNodes[o];if(l.nodeType==1){let c=l.getClientRects();for(let d=0;d<c.length;d++){let f=c[d];if($g(e,f))return _x(l,e,f)}}if((o=(o+1)%r)==i)break}return t}function n4(t,e){let n=t.dom.ownerDocument,r,i=0,o=VB(n,e.left,e.top);o&&({node:r,offset:i}=o);let l=(t.root.elementFromPoint?t.root:n).elementFromPoint(e.left,e.top),c;if(!l||!t.dom.contains(l.nodeType!=1?l.parentNode:l)){let f=t.dom.getBoundingClientRect();if(!$g(e,f)||(l=_x(t.dom,e,f),!l))return null}if(yn)for(let f=l;r&&f;f=ba(f))f.draggable&&(r=void 0);if(l=ZB(l,e),r){if(dr&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let p=r.childNodes[i],m;p.nodeName=="IMG"&&(m=p.getBoundingClientRect()).right<=e.left&&m.bottom>e.top&&i++}let f;Eu&&i&&r.nodeType==1&&(f=r.childNodes[i-1]).nodeType==1&&f.contentEditable=="false"&&f.getBoundingClientRect().top>=e.top&&i--,r==t.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?c=t.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(c=t4(t,r,i,e))}c==null&&(c=e4(t,l,e));let d=t.docView.nearestDesc(l,!0);return{pos:c,inside:d?d.posAtStart-d.border:-1}}function T_(t){return t.top<t.bottom||t.left<t.right}function Hi(t,e){let n=t.getClientRects();if(n.length){let r=n[e<0?0:n.length-1];if(T_(r))return r}return Array.prototype.find.call(n,T_)||t.getBoundingClientRect()}const r4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Tx(t,e,n){let{node:r,offset:i,atom:o}=t.docView.domFromPos(e,n<0?-1:1),l=Eu||dr;if(r.nodeType==3)if(l&&(r4.test(r.nodeValue)||(n<0?!i:i==r.nodeValue.length))){let d=Hi(si(r,i,i),n);if(dr&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let f=Hi(si(r,i-1,i-1),-1);if(f.top==d.top){let p=Hi(si(r,i,i+1),-1);if(p.top!=d.top)return wl(p,p.left<f.left)}}return d}else{let d=i,f=i,p=n<0?1:-1;return n<0&&!i?(f++,p=-1):n>=0&&i==r.nodeValue.length?(d--,p=1):n<0?d--:f++,wl(Hi(si(r,d,f),p),p<0)}if(!t.state.doc.resolve(e-(o||0)).parent.inlineContent){if(o==null&&i&&(n<0||i==ur(r))){let d=r.childNodes[i-1];if(d.nodeType==1)return Um(d.getBoundingClientRect(),!1)}if(o==null&&i<ur(r)){let d=r.childNodes[i];if(d.nodeType==1)return Um(d.getBoundingClientRect(),!0)}return Um(r.getBoundingClientRect(),n>=0)}if(o==null&&i&&(n<0||i==ur(r))){let d=r.childNodes[i-1],f=d.nodeType==3?si(d,ur(d)-(l?0:1)):d.nodeType==1&&(d.nodeName!="BR"||!d.nextSibling)?d:null;if(f)return wl(Hi(f,1),!1)}if(o==null&&i<ur(r)){let d=r.childNodes[i];for(;d.pmViewDesc&&d.pmViewDesc.ignoreForCoords;)d=d.nextSibling;let f=d?d.nodeType==3?si(d,0,l?0:1):d.nodeType==1?d:null:null;if(f)return wl(Hi(f,-1),!0)}return wl(Hi(r.nodeType==3?si(r):r,-n),n>=0)}function wl(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Um(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Ex(t,e,n){let r=t.state,i=t.root.activeElement;r!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),i!=t.dom&&i&&i.focus()}}function i4(t,e,n){let r=e.selection,i=n=="up"?r.$from:r.$to;return Ex(t,e,()=>{let{node:o}=t.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let c=t.docView.nearestDesc(o,!0);if(!c)break;if(c.node.isBlock){o=c.contentDOM||c.dom;break}o=c.dom.parentNode}let l=Tx(t,i.pos,1);for(let c=o.firstChild;c;c=c.nextSibling){let d;if(c.nodeType==1)d=c.getClientRects();else if(c.nodeType==3)d=si(c,0,c.nodeValue.length).getClientRects();else continue;for(let f=0;f<d.length;f++){let p=d[f];if(p.bottom>p.top+1&&(n=="up"?l.top-p.top>(p.bottom-l.top)*2:p.bottom-l.bottom>(l.bottom-p.top)*2))return!1}}return!0})}const s4=/[\u0590-\u08ac]/;function o4(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,l=i==r.parent.content.size,c=t.domSelection();return c?!s4.test(r.parent.textContent)||!c.modify?n=="left"||n=="backward"?o:l:Ex(t,e,()=>{let{focusNode:d,focusOffset:f,anchorNode:p,anchorOffset:m}=t.domSelectionRange(),y=c.caretBidiLevel;c.modify("move",n,"character");let b=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:S,focusOffset:w}=t.domSelectionRange(),T=S&&!b.contains(S.nodeType==1?S:S.parentNode)||d==S&&f==w;try{c.collapse(p,m),d&&(d!=p||f!=m)&&c.extend&&c.extend(d,f)}catch{}return y!=null&&(c.caretBidiLevel=y),T}):r.pos==r.start()||r.pos==r.end()}let E_=null,M_=null,x_=!1;function a4(t,e,n){return E_==e&&M_==n?x_:(E_=e,M_=n,x_=n=="up"||n=="down"?i4(t,e,n):o4(t,e,n))}const fr=0,C_=1,js=2,Ir=3;class Mu{constructor(e,n,r,i){this.parent=e,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=fr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;n<this.children.length;n++)e+=this.children[n].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let n=0,r=this.posAtStart;;n++){let i=this.children[n];if(i==e)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,n,r){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(r<0){let o,l;if(e==this.contentDOM)o=e.childNodes[n-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.previousSibling}for(;o&&!((l=o.pmViewDesc)&&l.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(l)+l.size:this.posAtStart}else{let o,l;if(e==this.contentDOM)o=e.childNodes[n];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;o=e.nextSibling}for(;o&&!((l=o.pmViewDesc)&&l.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(l):this.posAtEnd}let i;if(e==this.dom&&this.contentDOM)i=n>cn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&n==e.childNodes.length)for(let o=e;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,i=e;i;i=i.parentNode){let o=this.getDesc(i),l;if(o&&(!n||o.node))if(r&&(l=o.nodeDOM)&&!(l.nodeType==1?l.contains(e.nodeType==1?e:e.parentNode):l==e))r=!1;else return o}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let i=e;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;n<this.children.length;n++){let i=this.children[n],o=r+i.size;if(r==e&&o!=r){for(;!i.border&&i.children.length;)for(let l=0;l<i.children.length;l++){let c=i.children[l];if(c.size){i=c;break}}return i}if(e<o)return i.descAt(e-r-i.border);r=o}}domFromPos(e,n){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let l=this.children[r],c=o+l.size;if(c>e||l instanceof xx){i=e-o;break}o=c}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Mx&&o.side>=0;r--);if(n<=0){let o,l=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,l=!1);return o&&n&&l&&!o.border&&!o.domAtom?o.domFromPos(o.size,n):{node:this.contentDOM,offset:o?cn(o.dom)+1:0}}else{let o,l=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,l=!1);return o&&l&&!o.border&&!o.domAtom?o.domFromPos(0,n):{node:this.contentDOM,offset:o?cn(o.dom):this.contentDOM.childNodes.length}}}parseRange(e,n,r=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:n,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let l=r,c=0;;c++){let d=this.children[c],f=l+d.size;if(i==-1&&e<=f){let p=l+d.border;if(e>=p&&n<=f-d.border&&d.node&&d.contentDOM&&this.contentDOM.contains(d.contentDOM))return d.parseRange(e,n,p);e=l;for(let m=c;m>0;m--){let y=this.children[m-1];if(y.size&&y.dom.parentNode==this.contentDOM&&!y.emptyChildAt(1)){i=cn(y.dom)+1;break}e-=y.size}i==-1&&(i=0)}if(i>-1&&(f>n||c==this.children.length-1)){n=f;for(let p=c+1;p<this.children.length;p++){let m=this.children[p];if(m.size&&m.dom.parentNode==this.contentDOM&&!m.emptyChildAt(-1)){o=cn(m.dom);break}n+=m.size}o==-1&&(o=this.contentDOM.childNodes.length);break}l=f}return{node:this.contentDOM,from:e,to:n,fromOffset:i,toOffset:o}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let n=this.children[e<0?0:this.children.length-1];return n.size==0||n.emptyChildAt(e)}domAfterPos(e){let{node:n,offset:r}=this.domFromPos(e,0);if(n.nodeType!=1||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}setSelection(e,n,r,i=!1){let o=Math.min(e,n),l=Math.max(e,n);for(let b=0,S=0;b<this.children.length;b++){let w=this.children[b],T=S+w.size;if(o>S&&l<T)return w.setSelection(e-S-w.border,n-S-w.border,r,i);S=T}let c=this.domFromPos(e,e?-1:1),d=n==e?c:this.domFromPos(n,n?-1:1),f=r.root.getSelection(),p=r.domSelectionRange(),m=!1;if((dr||yn)&&e==n){let{node:b,offset:S}=c;if(b.nodeType==3){if(m=!!(S&&b.nodeValue[S-1]==`
22
+ `),m&&S==b.nodeValue.length)for(let w=b,T;w;w=w.parentNode){if(T=w.nextSibling){T.nodeName=="BR"&&(c=d={node:T.parentNode,offset:cn(T)+1});break}let M=w.pmViewDesc;if(M&&M.node&&M.node.isBlock)break}}else{let w=b.childNodes[S-1];m=w&&(w.nodeName=="BR"||w.contentEditable=="false")}}if(dr&&p.focusNode&&p.focusNode!=d.node&&p.focusNode.nodeType==1){let b=p.focusNode.childNodes[p.focusOffset];b&&b.contentEditable=="false"&&(i=!0)}if(!(i||m&&yn)&&Ws(c.node,c.offset,p.anchorNode,p.anchorOffset)&&Ws(d.node,d.offset,p.focusNode,p.focusOffset))return;let y=!1;if((f.extend||e==n)&&!(m&&dr)){f.collapse(c.node,c.offset);try{e!=n&&f.extend(d.node,d.offset),y=!0}catch{}}if(!y){if(e>n){let S=c;c=d,d=S}let b=document.createRange();b.setEnd(d.node,d.offset),b.setStart(c.node,c.offset),f.removeAllRanges(),f.addRange(b)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],l=r+o.size;if(r==l?e<=l&&n>=r:e<l&&n>r){let c=r+o.border,d=l-o.border;if(e>=c&&n<=d){this.dirty=e==r||n==l?js:C_,e==c&&n==d&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=Ir:o.markDirty(e-c,n-c);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?js:Ir}r=l}this.dirty=js}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?js:C_;n.dirty<r&&(n.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class Mx extends Mu{constructor(e,n,r,i){let o,l=n.type.toDOM;if(typeof l=="function"&&(l=l(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!n.type.spec.raw){if(l.nodeType!=1){let c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}super(e,[],l,null),this.widget=n,this.widget=n,o=this}matchesWidget(e){return this.dirty==fr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class l4 extends Mu{constructor(e,n,r,i){super(e,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class Zs extends Mu{constructor(e,n,r,i,o){super(e,[],r,i),this.mark=n,this.spec=o}static create(e,n,r,i){let o=i.nodeViews[n.type.name],l=o&&o(n,i,r);return(!l||!l.dom)&&(l=to.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new Zs(e,n,l.dom,l.contentDOM||l.dom,l)}parseRule(){return this.dirty&Ir||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ir&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=fr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=fr}}slice(e,n,r){let i=Zs.create(this.parent,this.mark,!0,r),o=this.children,l=this.size;n<l&&(o=Zy(o,n,l,r)),e>0&&(o=Zy(o,0,e,r));for(let c=0;c<o.length;c++)o[c].parent=i;return i.children=o,i}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class ts extends Mu{constructor(e,n,r,i,o,l,c,d,f){super(e,[],o,l),this.node=n,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=c}static create(e,n,r,i,o,l){let c=o.nodeViews[n.type.name],d,f=c&&c(n,o,()=>{if(!d)return l;if(d.parent)return d.parent.posBeforeChild(d)},r,i),p=f&&f.dom,m=f&&f.contentDOM;if(n.isText){if(!p)p=document.createTextNode(n.text);else if(p.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else p||({dom:p,contentDOM:m}=to.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!m&&!n.isText&&p.nodeName!="BR"&&(p.hasAttribute("contenteditable")||(p.contentEditable="false"),n.type.spec.draggable&&(p.draggable=!0));let y=p;return p=Ax(p,r,n),f?d=new u4(e,n,r,i,p,m||null,y,f,o,l+1):n.isText?new qf(e,n,r,i,p,y,o):new ts(e,n,r,i,p,m||null,y,o,l+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>oe.empty)}return e}matchesNode(e,n,r){return this.dirty==fr&&e.eq(this.node)&&Kd(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,i=n,o=e.composing?this.localCompositionInfo(e,n):null,l=o&&o.pos>-1?o:null,c=o&&o.pos<0,d=new d4(this,l&&l.node,e);p4(this.node,this.innerDeco,(f,p,m)=>{f.spec.marks?d.syncToMarks(f.spec.marks,r,e):f.type.side>=0&&!m&&d.syncToMarks(p==this.node.childCount?Tt.none:this.node.child(p).marks,r,e),d.placeWidget(f,e,i)},(f,p,m,y)=>{d.syncToMarks(f.marks,r,e);let b;d.findNodeMatch(f,p,m,y)||c&&e.state.selection.from>i&&e.state.selection.to<i+f.nodeSize&&(b=d.findIndexWithChild(o.node))>-1&&d.updateNodeAt(f,p,m,b,e)||d.updateNextNode(f,p,m,e,y,i)||d.addNode(f,p,m,e,i),i+=f.nodeSize}),d.syncToMarks([],r,e),this.node.isTextblock&&d.addTextblockHacks(),d.destroyRest(),(d.changed||this.dirty==js)&&(l&&this.protectLocalComposition(e,l),Cx(this.contentDOM,this.children,e),va&&m4(this.dom))}localCompositionInfo(e,n){let{from:r,to:i}=e.state.selection;if(!(e.state.selection instanceof Pe)||r<n||i>n+this.node.content.size)return null;let o=e.input.compositionNode;if(!o||!this.dom.contains(o.parentNode))return null;if(this.node.inlineContent){let l=o.nodeValue,c=y4(this.node.content,l,r-n,i-n);return c<0?null:{node:o,pos:c,text:l}}else return{node:o,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let o=n;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let l=new l4(this,o,n,i);e.input.compositionNodes.push(l),this.children=Zy(this.children,r,r+i.length,e,l)}update(e,n,r,i){return this.dirty==Ir||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,i),!0)}updateInner(e,n,r,i){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=fr}updateOuterDeco(e){if(Kd(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=kx(this.dom,this.nodeDOM,Wy(this.outerDeco,this.node,n),Wy(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function k_(t,e,n,r,i){Ax(r,e,t);let o=new ts(void 0,t,e,n,r,r,r,i,0);return o.contentDOM&&o.updateChildren(i,0),o}class qf extends ts{constructor(e,n,r,i,o,l,c){super(e,n,r,i,o,null,l,c,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,i){return this.dirty==Ir||this.dirty!=fr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=fr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=e,this.dirty=fr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let i=this.node.cut(e,n),o=document.createTextNode(i.text);return new qf(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ir)}get domAtom(){return!1}isText(e){return this.node.text==e}}class xx extends Mu{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==fr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class u4 extends ts{constructor(e,n,r,i,o,l,c,d,f,p){super(e,n,r,i,o,l,c,f,p),this.spec=d}update(e,n,r,i){if(this.dirty==Ir)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let o=this.spec.update(e,n,r);return o&&this.updateInner(e,n,r,i),o}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,i){this.spec.setSelection?this.spec.setSelection(e,n,r.root):super.setSelection(e,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function Cx(t,e,n){let r=t.firstChild,i=!1;for(let o=0;o<e.length;o++){let l=e[o],c=l.dom;if(c.parentNode==t){for(;c!=r;)r=A_(r),i=!0;r=r.nextSibling}else i=!0,t.insertBefore(c,r);if(l instanceof Zs){let d=r?r.previousSibling:t.lastChild;Cx(l.contentDOM,l.children,n),r=d?d.nextSibling:t.firstChild}}for(;r;)r=A_(r),i=!0;i&&n.trackWrites==t&&(n.trackWrites=null)}const jl=function(t){t&&(this.nodeName=t)};jl.prototype=Object.create(null);const Bs=[new jl];function Wy(t,e,n){if(t.length==0)return Bs;let r=n?Bs[0]:new jl,i=[r];for(let o=0;o<t.length;o++){let l=t[o].type.attrs;if(l){l.nodeName&&i.push(r=new jl(l.nodeName));for(let c in l){let d=l[c];d!=null&&(n&&i.length==1&&i.push(r=new jl(e.isInline?"span":"div")),c=="class"?r.class=(r.class?r.class+" ":"")+d:c=="style"?r.style=(r.style?r.style+";":"")+d:c!="nodeName"&&(r[c]=d))}}}return i}function kx(t,e,n,r){if(n==Bs&&r==Bs)return e;let i=e;for(let o=0;o<r.length;o++){let l=r[o],c=n[o];if(o){let d;c&&c.nodeName==l.nodeName&&i!=t&&(d=i.parentNode)&&d.nodeName.toLowerCase()==l.nodeName||(d=document.createElement(l.nodeName),d.pmIsDeco=!0,d.appendChild(i),c=Bs[0]),i=d}c4(i,c||Bs[0],l)}return i}function c4(t,e,n){for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&!(r in n)&&t.removeAttribute(r);for(let r in n)r!="class"&&r!="style"&&r!="nodeName"&&n[r]!=e[r]&&t.setAttribute(r,n[r]);if(e.class!=n.class){let r=e.class?e.class.split(" ").filter(Boolean):[],i=n.class?n.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&t.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&t.classList.add(i[o]);t.classList.length==0&&t.removeAttribute("class")}if(e.style!=n.style){if(e.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(e.style);)t.style.removeProperty(i[1])}n.style&&(t.style.cssText+=n.style)}}function Ax(t,e,n){return kx(t,t,Bs,Wy(e,n,t.nodeType!=1))}function Kd(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(!t[n].type.eq(e[n].type))return!1;return!0}function A_(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}class d4{constructor(e,n,r){this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=f4(e.node.content,e)}destroyBetween(e,n){if(e!=n){for(let r=e;r<n;r++)this.top.children[r].destroy();this.top.children.splice(e,n-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,n,r){let i=0,o=this.stack.length>>1,l=Math.min(o,e.length);for(;i<l&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=fr,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<e.length;){this.stack.push(this.top,this.index+1);let c=-1;for(let d=this.index;d<Math.min(this.index+3,this.top.children.length);d++){let f=this.top.children[d];if(f.matchesMark(e[o])&&!this.isLocked(f.dom)){c=d;break}}if(c>-1)c>this.index&&(this.changed=!0,this.destroyBetween(this.index,c)),this.top=this.top.children[this.index];else{let d=Zs.create(this.top,e[o],n,r);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,o++}}findNodeMatch(e,n,r,i){let o=-1,l;if(i>=this.preMatch.index&&(l=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&l.matchesNode(e,n,r))o=this.top.children.indexOf(l,this.index);else for(let c=this.index,d=Math.min(this.top.children.length,c+5);c<d;c++){let f=this.top.children[c];if(f.matchesNode(e,n,r)&&!this.preMatch.matched.has(f)){o=c;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(e,n,r,i,o){let l=this.top.children[i];return l.dirty==Ir&&l.dom==l.contentDOM&&(l.dirty=js),l.update(e,n,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(e){for(;;){let n=e.parentNode;if(!n)return-1;if(n==this.top.contentDOM){let r=e.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}e=n}}updateNextNode(e,n,r,i,o,l){for(let c=this.index;c<this.top.children.length;c++){let d=this.top.children[c];if(d instanceof ts){let f=this.preMatch.matched.get(d);if(f!=null&&f!=o)return!1;let p=d.dom,m,y=this.isLocked(p)&&!(e.isText&&d.node&&d.node.isText&&d.nodeDOM.nodeValue==e.text&&d.dirty!=Ir&&Kd(n,d.outerDeco));if(!y&&d.update(e,n,r,i))return this.destroyBetween(this.index,c),d.dom!=p&&(this.changed=!0),this.index++,!0;if(!y&&(m=this.recreateWrapper(d,e,n,r,i,l)))return this.destroyBetween(this.index,c),this.top.children[this.index]=m,m.contentDOM&&(m.dirty=js,m.updateChildren(i,l+1),m.dirty=fr),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,n,r,i,o,l){if(e.dirty||n.isAtom||!e.children.length||!e.node.content.eq(n.content)||!Kd(r,e.outerDeco)||!i.eq(e.innerDeco))return null;let c=ts.create(this.top,n,r,i,o,l);if(c.contentDOM){c.children=e.children,e.children=[];for(let d of c.children)d.parent=c}return e.destroy(),c}addNode(e,n,r,i,o){let l=ts.create(this.top,e,n,r,i,o);l.contentDOM&&l.updateChildren(i,o+1),this.top.children.splice(this.index++,0,l),this.changed=!0}placeWidget(e,n,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(e)&&(e==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Mx(this.top,e,n,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],n=this.top;for(;e instanceof Zs;)n=e,e=n.children[n.children.length-1];(!e||!(e instanceof qf)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((yn||Zt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",n),this.addHackNode("BR",this.top))}addHackNode(e,n){if(n==this.top&&this.index<n.children.length&&n.children[this.index].matchesHack(e))this.index++;else{let r=document.createElement(e);e=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),e=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new xx(this.top,[],r,null);n!=this.top?n.children.push(i):n.children.splice(this.index++,0,i),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function f4(t,e){let n=e,r=n.children.length,i=t.childCount,o=new Map,l=[];e:for(;i>0;){let c;for(;;)if(r){let f=n.children[r-1];if(f instanceof Zs)n=f,r=f.children.length;else{c=f,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let d=c.node;if(d){if(d!=t.child(i-1))break;--i,o.set(c,i),l.push(c)}}return{index:i,matched:o,matches:l.reverse()}}function h4(t,e){return t.type.side-e.type.side}function p4(t,e,n,r){let i=e.locals(t),o=0;if(i.length==0){for(let f=0;f<t.childCount;f++){let p=t.child(f);r(p,i,e.forChild(o,p),f),o+=p.nodeSize}return}let l=0,c=[],d=null;for(let f=0;;){let p,m;for(;l<i.length&&i[l].to==o;){let T=i[l++];T.widget&&(p?(m||(m=[p])).push(T):p=T)}if(p)if(m){m.sort(h4);for(let T=0;T<m.length;T++)n(m[T],f,!!d)}else n(p,f,!!d);let y,b;if(d)b=-1,y=d,d=null;else if(f<t.childCount)b=f,y=t.child(f++);else break;for(let T=0;T<c.length;T++)c[T].to<=o&&c.splice(T--,1);for(;l<i.length&&i[l].from<=o&&i[l].to>o;)c.push(i[l++]);let S=o+y.nodeSize;if(y.isText){let T=S;l<i.length&&i[l].from<T&&(T=i[l].from);for(let M=0;M<c.length;M++)c[M].to<T&&(T=c[M].to);T<S&&(d=y.cut(T-o),y=y.cut(0,T-o),S=T,b=-1)}else for(;l<i.length&&i[l].to<S;)l++;let w=y.isInline&&!y.isLeaf?c.filter(T=>!T.inline):c.slice();r(y,w,e.forChild(o,y),b),o=S}}function m4(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function y4(t,e,n,r){for(let i=0,o=0;i<t.childCount&&o<=r;){let l=t.child(i++),c=o;if(o+=l.nodeSize,!l.isText)continue;let d=l.text;for(;i<t.childCount;){let f=t.child(i++);if(o+=f.nodeSize,!f.isText)break;d+=f.text}if(o>=n){if(o>=r&&d.slice(r-e.length-c,r-c)==e)return r-e.length;let f=c<r?d.lastIndexOf(e,r-c-1):-1;if(f>=0&&f+e.length+c>=n)return c+f;if(n==r&&d.length>=r+e.length-c&&d.slice(r-c,r-c+e.length)==e)return r}}return-1}function Zy(t,e,n,r,i){let o=[];for(let l=0,c=0;l<t.length;l++){let d=t[l],f=c,p=c+=d.size;f>=n||p<=e?o.push(d):(f<e&&o.push(d.slice(0,e-f,r)),i&&(o.push(i),i=void 0),p>n&&o.push(d.slice(n-f,d.size,r)))}return o}function Fg(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let i=t.docView.nearestDesc(n.focusNode),o=i&&i.size==0,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c=r.resolve(l),d,f;if(Uf(n)){for(d=l;i&&!i.node;)i=i.parent;let m=i.node;if(i&&m.isAtom&&Ae.isSelectable(m)&&i.parent&&!(m.isInline&&FB(n.focusNode,n.focusOffset,i.dom))){let y=i.posBefore;f=new Ae(l==y?c:r.resolve(y))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let m=l,y=l;for(let b=0;b<n.rangeCount;b++){let S=n.getRangeAt(b);m=Math.min(m,t.docView.posFromDOM(S.startContainer,S.startOffset,1)),y=Math.max(y,t.docView.posFromDOM(S.endContainer,S.endOffset,-1))}if(m<0)return null;[d,l]=y==t.state.selection.anchor?[y,m]:[m,y],c=r.resolve(l)}else d=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(d<0)return null}let p=r.resolve(d);if(!f){let m=e=="pointer"||t.state.selection.head<c.pos&&!o?1:-1;f=Hg(t,p,c,m)}return f}function Ox(t){return t.editable?t.hasFocus():Rx(t)&&document.activeElement&&document.activeElement.contains(t.dom)}function di(t,e=!1){let n=t.state.selection;if(Nx(t,n),!!Ox(t)){if(!e&&t.input.mouseDown&&t.input.mouseDown.allowDefault&&Zt){let r=t.domSelectionRange(),i=t.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&Ws(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){t.input.mouseDown.delayedSelectionSync=!0,t.domObserver.setCurSelection();return}}if(t.domObserver.disconnectSelection(),t.cursorWrapper)b4(t);else{let{anchor:r,head:i}=n,o,l;O_&&!(n instanceof Pe)&&(n.$from.parent.inlineContent||(o=N_(t,n.from)),!n.empty&&!n.$from.parent.inlineContent&&(l=N_(t,n.to))),t.docView.setSelection(r,i,t,e),O_&&(o&&R_(o),l&&R_(l)),n.visible?t.dom.classList.remove("ProseMirror-hideselection"):(t.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&g4(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const O_=yn||Zt&&gx<63;function N_(t,e){let{node:n,offset:r}=t.docView.domFromPos(e,0),i=r<n.childNodes.length?n.childNodes[r]:null,o=r?n.childNodes[r-1]:null;if(yn&&i&&i.contentEditable=="false")return qm(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return qm(i);if(o)return qm(o)}}function qm(t){return t.contentEditable="true",yn&&t.draggable&&(t.draggable=!1,t.wasDraggable=!0),t}function R_(t){t.contentEditable="false",t.wasDraggable&&(t.draggable=!0,t.wasDraggable=null)}function g4(t){let e=t.dom.ownerDocument;e.removeEventListener("selectionchange",t.input.hideSelectionGuard);let n=t.domSelectionRange(),r=n.anchorNode,i=n.anchorOffset;e.addEventListener("selectionchange",t.input.hideSelectionGuard=()=>{(n.anchorNode!=r||n.anchorOffset!=i)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!Ox(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function b4(t){let e=t.domSelection();if(!e)return;let n=t.cursorWrapper.dom,r=n.nodeName=="IMG";r?e.collapse(n.parentNode,cn(n)+1):e.collapse(n,0),!r&&!t.state.selection.visible&&Ln&&es<=11&&(n.disabled=!0,n.disabled=!1)}function Nx(t,e){if(e instanceof Ae){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(D_(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else D_(t)}function D_(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Hg(t,e,n,r){return t.someProp("createSelectionBetween",i=>i(t,e,n))||Pe.between(e,n,r)}function I_(t){return t.editable&&!t.hasFocus()?!1:Rx(t)}function Rx(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function v4(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Ws(e.node,e.offset,n.anchorNode,n.anchorOffset)}function eg(t,e){let{$anchor:n,$head:r}=t.selection,i=e>0?n.max(r):n.min(r),o=i.parent.inlineContent?i.depth?t.doc.resolve(e>0?i.after():i.before()):null:i;return o&&He.findFrom(o,e)}function Vi(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function L_(t,e,n){let r=t.state.selection;if(r instanceof Pe)if(n.indexOf("s")>-1){let{$head:i}=r,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let l=t.state.doc.resolve(i.pos+o.nodeSize*(e<0?-1:1));return Vi(t,new Pe(r.$anchor,l))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let i=eg(t.state,e);return i&&i instanceof Ae?Vi(t,i):!1}else if(!(lr&&n.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:e<0?i.nodeBefore:i.nodeAfter,l;if(!o||o.isText)return!1;let c=e<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(l=t.docView.descAt(c))&&!l.contentDOM?Ae.isSelectable(o)?Vi(t,new Ae(e<0?t.state.doc.resolve(i.pos-o.nodeSize):i)):Eu?Vi(t,new Pe(t.state.doc.resolve(e<0?c:c+o.nodeSize))):!1:!1}}else return!1;else{if(r instanceof Ae&&r.node.isInline)return Vi(t,new Pe(e>0?r.$to:r.$from));{let i=eg(t.state,e);return i?Vi(t,i):!1}}}function Gd(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Bl(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Vo(t,e){return e<0?S4(t):w4(t)}function S4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i,o,l=!1;for(dr&&n.nodeType==1&&r<Gd(n)&&Bl(n.childNodes[r],-1)&&(l=!0);;)if(r>0){if(n.nodeType!=1)break;{let c=n.childNodes[r-1];if(Bl(c,-1))i=n,o=--r;else if(c.nodeType==3)n=c,r=n.nodeValue.length;else break}}else{if(Dx(n))break;{let c=n.previousSibling;for(;c&&Bl(c,-1);)i=n.parentNode,o=cn(c),c=c.previousSibling;if(c)n=c,r=Gd(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}l?tg(t,n,r):i&&tg(t,i,o)}function w4(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let i=Gd(n),o,l;for(;;)if(r<i){if(n.nodeType!=1)break;let c=n.childNodes[r];if(Bl(c,1))o=n,l=++r;else break}else{if(Dx(n))break;{let c=n.nextSibling;for(;c&&Bl(c,1);)o=c.parentNode,l=cn(c)+1,c=c.nextSibling;if(c)n=c,r=0,i=Gd(n);else{if(n=n.parentNode,n==t.dom)break;r=i=0}}}o&&tg(t,o,l)}function Dx(t){let e=t.pmViewDesc;return e&&e.node&&e.node.isBlock}function _4(t,e){for(;t&&e==t.childNodes.length&&!Tu(t);)e=cn(t)+1,t=t.parentNode;for(;t&&e<t.childNodes.length;){let n=t.childNodes[e];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=0}}function T4(t,e){for(;t&&!e&&!Tu(t);)e=cn(t),t=t.parentNode;for(;t&&e;){let n=t.childNodes[e-1];if(n.nodeType==3)return n;if(n.nodeType==1&&n.contentEditable=="false")break;t=n,e=t.childNodes.length}}function tg(t,e,n){if(e.nodeType!=3){let o,l;(l=_4(e,n))?(e=l,n=0):(o=T4(e,n))&&(e=o,n=o.nodeValue.length)}let r=t.domSelection();if(!r)return;if(Uf(r)){let o=document.createRange();o.setEnd(e,n),o.setStart(e,n),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(e,n);t.domObserver.setCurSelection();let{state:i}=t;setTimeout(()=>{t.state==i&&di(t)},50)}function j_(t,e){let n=t.state.doc.resolve(e);if(!(Zt||bx)&&n.parent.inlineContent){let i=t.coordsAtPos(e);if(e>n.start()){let o=t.coordsAtPos(e-1),l=(o.top+o.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(o.left-i.left)>1)return o.left<i.left?"ltr":"rtl"}if(e<n.end()){let o=t.coordsAtPos(e+1),l=(o.top+o.bottom)/2;if(l>i.top&&l<i.bottom&&Math.abs(o.left-i.left)>1)return o.left>i.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function B_(t,e,n){let r=t.state.selection;if(r instanceof Pe&&!r.empty||n.indexOf("s")>-1||lr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let l=eg(t.state,e);if(l&&l instanceof Ae)return Vi(t,l)}if(!i.parent.inlineContent){let l=e<0?i:o,c=r instanceof Hn?He.near(l,e):He.findFrom(l,e);return c?Vi(t,c):!1}return!1}function z_(t,e){if(!(t.state.selection instanceof Pe))return!0;let{$head:n,$anchor:r,empty:i}=t.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let o=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(o&&!o.isText){let l=t.state.tr;return e<0?l.delete(n.pos-o.nodeSize,n.pos):l.delete(n.pos,n.pos+o.nodeSize),t.dispatch(l),!0}return!1}function P_(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function E4(t){if(!yn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;P_(t,r,"true"),setTimeout(()=>P_(t,r,"false"),20)}return!1}function M4(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function x4(t,e){let n=e.keyCode,r=M4(e);if(n==8||lr&&n==72&&r=="c")return z_(t,-1)||Vo(t,-1);if(n==46&&!e.shiftKey||lr&&n==68&&r=="c")return z_(t,1)||Vo(t,1);if(n==13||n==27)return!0;if(n==37||lr&&n==66&&r=="c"){let i=n==37?j_(t,t.state.selection.from)=="ltr"?-1:1:-1;return L_(t,i,r)||Vo(t,i)}else if(n==39||lr&&n==70&&r=="c"){let i=n==39?j_(t,t.state.selection.from)=="ltr"?1:-1:1;return L_(t,i,r)||Vo(t,i)}else{if(n==38||lr&&n==80&&r=="c")return B_(t,-1,r)||Vo(t,-1);if(n==40||lr&&n==78&&r=="c")return E4(t)||B_(t,1,r)||Vo(t,1);if(r==(lr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function Vg(t,e){t.someProp("transformCopied",b=>{e=b(e,t)});let n=[],{content:r,openStart:i,openEnd:o}=e;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let b=r.firstChild;n.push(b.type.name,b.attrs!=b.type.defaultAttrs?b.attrs:null),r=b.content}let l=t.someProp("clipboardSerializer")||to.fromSchema(t.state.schema),c=Px(),d=c.createElement("div");d.appendChild(l.serializeFragment(r,{document:c}));let f=d.firstChild,p,m=0;for(;f&&f.nodeType==1&&(p=zx[f.nodeName.toLowerCase()]);){for(let b=p.length-1;b>=0;b--){let S=c.createElement(p[b]);for(;d.firstChild;)S.appendChild(d.firstChild);d.appendChild(S),m++}f=d.firstChild}f&&f.nodeType==1&&f.setAttribute("data-pm-slice",`${i} ${o}${m?` -${m}`:""} ${JSON.stringify(n)}`);let y=t.someProp("clipboardTextSerializer",b=>b(e,t))||e.content.textBetween(0,e.content.size,`
23
+
24
+ `);return{dom:d,text:y,slice:e}}function Ix(t,e,n,r,i){let o=i.parent.type.spec.code,l,c;if(!n&&!e)return null;let d=!!e&&(r||o||!n);if(d){if(t.someProp("transformPastedText",y=>{e=y(e,o||r,t)}),o)return c=new ge(oe.from(t.state.schema.text(e.replace(/\r\n?/g,`
25
+ `))),0,0),t.someProp("transformPasted",y=>{c=y(c,t,!0)}),c;let m=t.someProp("clipboardTextParser",y=>y(e,i,r,t));if(m)c=m;else{let y=i.marks(),{schema:b}=t.state,S=to.fromSchema(b);l=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(w=>{let T=l.appendChild(document.createElement("p"));w&&T.appendChild(S.serializeNode(b.text(w,y)))})}}else t.someProp("transformPastedHTML",m=>{n=m(n,t)}),l=O4(n),Eu&&N4(l);let f=l&&l.querySelector("[data-pm-slice]"),p=f&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(f.getAttribute("data-pm-slice")||"");if(p&&p[3])for(let m=+p[3];m>0;m--){let y=l.firstChild;for(;y&&y.nodeType!=1;)y=y.nextSibling;if(!y)break;l=y}if(c||(c=(t.someProp("clipboardParser")||t.someProp("domParser")||Zi.fromSchema(t.state.schema)).parseSlice(l,{preserveWhitespace:!!(d||p),context:i,ruleFromNode(y){return y.nodeName=="BR"&&!y.nextSibling&&y.parentNode&&!C4.test(y.parentNode.nodeName)?{ignore:!0}:null}})),p)c=R4(U_(c,+p[1],+p[2]),p[4]);else if(c=ge.maxOpen(k4(c.content,i),!0),c.openStart||c.openEnd){let m=0,y=0;for(let b=c.content.firstChild;m<c.openStart&&!b.type.spec.isolating;m++,b=b.firstChild);for(let b=c.content.lastChild;y<c.openEnd&&!b.type.spec.isolating;y++,b=b.lastChild);c=U_(c,m,y)}return t.someProp("transformPasted",m=>{c=m(c,t,d)}),c}const C4=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function k4(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let i=e.node(n).contentMatchAt(e.index(n)),o,l=[];if(t.forEach(c=>{if(!l)return;let d=i.findWrapping(c.type),f;if(!d)return l=null;if(f=l.length&&o.length&&jx(d,o,c,l[l.length-1],0))l[l.length-1]=f;else{l.length&&(l[l.length-1]=Bx(l[l.length-1],o.length));let p=Lx(c,d);l.push(p),i=i.matchType(p.type),o=d}}),l)return oe.from(l)}return t}function Lx(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,oe.from(t));return t}function jx(t,e,n,r,i){if(i<t.length&&i<e.length&&t[i]==e[i]){let o=jx(t,e,n,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==t.length-1?n.type:t[i+1]))return r.copy(r.content.append(oe.from(Lx(n,t,i+1))))}}function Bx(t,e){if(e==0)return t;let n=t.content.replaceChild(t.childCount-1,Bx(t.lastChild,e-1)),r=t.contentMatchAt(t.childCount).fillBefore(oe.empty,!0);return t.copy(n.append(r))}function ng(t,e,n,r,i,o){let l=e<0?t.firstChild:t.lastChild,c=l.content;return t.childCount>1&&(o=0),i<r-1&&(c=ng(c,e,n,r,i+1,o)),i>=n&&(c=e<0?l.contentMatchAt(0).fillBefore(c,o<=i).append(c):c.append(l.contentMatchAt(l.childCount).fillBefore(oe.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,l.copy(c))}function U_(t,e,n){return e<t.openStart&&(t=new ge(ng(t.content,-1,e,t.openStart,0,t.openEnd),e,t.openEnd)),n<t.openEnd&&(t=new ge(ng(t.content,1,n,t.openEnd,0,0),t.openStart,n)),t}const zx={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let q_=null;function Px(){return q_||(q_=document.implementation.createHTMLDocument("title"))}let $m=null;function A4(t){let e=window.trustedTypes;return e?($m||($m=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:n=>n})),$m.createHTML(t)):t}function O4(t){let e=/^(\s*<meta [^>]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=Px().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),i;if((i=r&&zx[r[1].toLowerCase()])&&(t=i.map(o=>"<"+o+">").join("")+t+i.map(o=>"</"+o+">").reverse().join("")),n.innerHTML=A4(t),i)for(let o=0;o<i.length;o++)n=n.querySelector(i[o])||n;return n}function N4(t){let e=t.querySelectorAll(Zt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<e.length;n++){let r=e[n];r.childNodes.length==1&&r.textContent==" "&&r.parentNode&&r.parentNode.replaceChild(t.ownerDocument.createTextNode(" "),r)}}function R4(t,e){if(!t.size)return t;let n=t.content.firstChild.type.schema,r;try{r=JSON.parse(e)}catch{return t}let{content:i,openStart:o,openEnd:l}=t;for(let c=r.length-2;c>=0;c-=2){let d=n.nodes[r[c]];if(!d||d.hasRequiredAttrs())break;i=oe.from(d.create(r[c+1],i)),o++,l++}return new ge(i,o,l)}const Sn={},wn={},D4={touchstart:!0,touchmove:!0};class I4{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function L4(t){for(let e in Sn){let n=Sn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{B4(t,r)&&!Kg(t,r)&&(t.editable||!(r.type in wn))&&n(t,r)},D4[e]?{passive:!0}:void 0)}yn&&t.dom.addEventListener("input",()=>null),rg(t)}function Wi(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function j4(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function rg(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Kg(t,r))})}function Kg(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function B4(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function z4(t,e){!Kg(t,e)&&Sn[e.type]&&(t.editable||!(e.type in wn))&&Sn[e.type](t,e)}wn.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!qx(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ui&&Zt&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),va&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",i=>i(t,Is(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||x4(t,n)?n.preventDefault():Wi(t,"key")};wn.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};wn.keypress=(t,e)=>{let n=e;if(qx(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||lr&&n.metaKey)return;if(t.someProp("handleKeyPress",i=>i(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Pe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),o=()=>t.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!t.someProp("handleTextInput",l=>l(t,r.$from.pos,r.$to.pos,i,o))&&t.dispatch(o()),n.preventDefault()}};function $f(t){return{left:t.clientX,top:t.clientY}}function P4(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Gg(t,e,n,r,i){if(r==-1)return!1;let o=t.state.doc.resolve(r);for(let l=o.depth+1;l>0;l--)if(t.someProp(e,c=>l>o.depth?c(t,n,o.nodeAfter,o.before(l),i,!0):c(t,n,o.node(l),o.before(l),i,!1)))return!0;return!1}function ta(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let r=t.state.tr.setSelection(e);r.setMeta("pointer",!0),t.dispatch(r)}function U4(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&Ae.isSelectable(r)?(ta(t,new Ae(n)),!0):!1}function q4(t,e){if(e==-1)return!1;let n=t.state.selection,r,i;n instanceof Ae&&(r=n.node);let o=t.state.doc.resolve(e);for(let l=o.depth+1;l>0;l--){let c=l>o.depth?o.nodeAfter:o.node(l);if(Ae.isSelectable(c)){r&&n.$from.depth>0&&l>=n.$from.depth&&o.before(n.$from.depth+1)==n.$from.pos?i=o.before(n.$from.depth):i=o.before(l);break}}return i!=null?(ta(t,Ae.create(t.state.doc,i)),!0):!1}function $4(t,e,n,r,i){return Gg(t,"handleClickOn",e,n,r)||t.someProp("handleClick",o=>o(t,e,r))||(i?q4(t,n):U4(t,n))}function F4(t,e,n,r){return Gg(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",i=>i(t,e,r))}function H4(t,e,n,r){return Gg(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",i=>i(t,e,r))||V4(t,n,r)}function V4(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(ta(t,Pe.create(r,0,r.content.size)),!0):!1;let i=r.resolve(e);for(let o=i.depth+1;o>0;o--){let l=o>i.depth?i.nodeAfter:i.node(o),c=i.before(o);if(l.inlineContent)ta(t,Pe.create(r,c+1,c+1+l.content.size));else if(Ae.isSelectable(l))ta(t,Ae.create(r,c));else continue;return!0}}function Yg(t){return Yd(t)}const Ux=lr?"metaKey":"ctrlKey";Sn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Yg(t),i=Date.now(),o="singleClick";i-t.input.lastClick.time<500&&P4(n,t.input.lastClick)&&!n[Ux]&&t.input.lastClick.button==n.button&&(t.input.lastClick.type=="singleClick"?o="doubleClick":t.input.lastClick.type=="doubleClick"&&(o="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:o,button:n.button};let l=t.posAtCoords($f(n));l&&(o=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new K4(t,l,n,!!r)):(o=="doubleClick"?F4:H4)(t,l.pos,l.inside,n)?n.preventDefault():Wi(t,"pointer"))};class K4{constructor(e,n,r,i){this.view=e,this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[Ux],this.allowDefault=r.shiftKey;let o,l;if(n.inside>-1)o=e.state.doc.nodeAt(n.inside),l=n.inside;else{let p=e.state.doc.resolve(n.pos);o=p.parent,l=p.depth?p.before():0}const c=i?null:r.target,d=c?e.docView.nearestDesc(c,!0):null;this.target=d&&d.nodeDOM.nodeType==1?d.nodeDOM:null;let{selection:f}=e.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||f instanceof Ae&&f.from<=l&&f.to>l)&&(this.mightDrag={node:o,pos:l,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&dr&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Wi(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>di(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords($f(e))),this.updateAllowDefault(e),this.allowDefault||!n?Wi(this.view,"pointer"):$4(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||yn&&this.mightDrag&&!this.mightDrag.node.isAtom||Zt&&!this.view.state.selection.visible&&Math.min(Math.abs(n.pos-this.view.state.selection.from),Math.abs(n.pos-this.view.state.selection.to))<=2)?(ta(this.view,He.near(this.view.state.doc.resolve(n.pos))),e.preventDefault()):Wi(this.view,"pointer")}move(e){this.updateAllowDefault(e),Wi(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}Sn.touchstart=t=>{t.input.lastTouch=Date.now(),Yg(t),Wi(t,"pointer")};Sn.touchmove=t=>{t.input.lastTouch=Date.now(),Wi(t,"pointer")};Sn.contextmenu=t=>Yg(t);function qx(t,e){return t.composing?!0:yn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}const G4=ui?5e3:-1;wn.compositionstart=wn.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof Pe&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Zt&&bx&&Y4(t)))t.markCursor=t.state.storedMarks||n.marks(),Yd(t,!0),t.markCursor=null;else if(Yd(t,!e.selection.empty),dr&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let l=o<0?i.lastChild:i.childNodes[o-1];if(!l)break;if(l.nodeType==3){let c=t.domSelection();c&&c.collapse(l,l.nodeValue.length);break}else i=l,o=-1}}t.input.composing=!0}$x(t,G4)};function Y4(t){let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(!e||e.nodeType!=1||n>=e.childNodes.length)return!1;let r=e.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}wn.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,$x(t,20))};function $x(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Yd(t),e))}function Fx(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=X4());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Q4(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=qB(e.focusNode,e.focusOffset),r=$B(e.focusNode,e.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,o=t.domObserver.lastChangedTextNode;if(n==o||r==o)return o;if(!i||!i.isText(r.nodeValue))return r;if(t.input.compositionNode==r){let l=n.pmViewDesc;if(!(!l||!l.isText(n.nodeValue)))return r}}return n||r}function X4(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Yd(t,e=!1){if(!(ui&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Fx(t),e||t.docView&&t.docView.dirty){let n=Fg(t),r=t.state.selection;return n&&!n.eq(r)?t.dispatch(t.state.tr.setSelection(n)):(t.markCursor||e)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?t.dispatch(t.state.tr.deleteSelection()):t.updateState(t.state),!0}return!1}}function J4(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}const fu=Ln&&es<15||va&&KB<604;Sn.copy=wn.cut=(t,e)=>{let n=e,r=t.state.selection,i=n.type=="cut";if(r.empty)return;let o=fu?null:n.clipboardData,l=r.content(),{dom:c,text:d}=Vg(t,l);o?(n.preventDefault(),o.clearData(),o.setData("text/html",c.innerHTML),o.setData("text/plain",d)):J4(t,c),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function W4(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Z4(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let i=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?hu(t,r.value,null,i,e):hu(t,r.textContent,r.innerHTML,i,e)},50)}function hu(t,e,n,r,i){let o=Ix(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",d=>d(t,i,o||ge.empty)))return!0;if(!o)return!1;let l=W4(o),c=l?t.state.tr.replaceSelectionWith(l,r):t.state.tr.replaceSelection(o);return t.dispatch(c.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Hx(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}wn.paste=(t,e)=>{let n=e;if(t.composing&&!ui)return;let r=fu?null:n.clipboardData,i=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&hu(t,Hx(r),r.getData("text/html"),i,n)?n.preventDefault():Z4(t,n)};class Vx{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}}const ez=lr?"altKey":"ctrlKey";function Kx(t,e){let n=t.someProp("dragCopies",r=>!r(e));return n??!e[ez]}Sn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=t.state.selection,o=i.empty?null:t.posAtCoords($f(n)),l;if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof Ae?i.to-1:i.to))){if(r&&r.mightDrag)l=Ae.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let m=t.docView.nearestDesc(n.target,!0);m&&m.node.type.spec.draggable&&m!=t.docView&&(l=Ae.create(t.state.doc,m.posBefore))}}let c=(l||t.state.selection).content(),{dom:d,text:f,slice:p}=Vg(t,c);(!n.dataTransfer.files.length||!Zt||gx>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(fu?"Text":"text/html",d.innerHTML),n.dataTransfer.effectAllowed="copyMove",fu||n.dataTransfer.setData("text/plain",f),t.dragging=new Vx(p,Kx(t,n),l)};Sn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};wn.dragover=wn.dragenter=(t,e)=>e.preventDefault();wn.drop=(t,e)=>{try{tz(t,e,t.dragging)}finally{t.dragging=null}};function tz(t,e,n){if(!e.dataTransfer)return;let r=t.posAtCoords($f(e));if(!r)return;let i=t.state.doc.resolve(r.pos),o=n&&n.slice;o?t.someProp("transformPasted",b=>{o=b(o,t,!1)}):o=Ix(t,Hx(e.dataTransfer),fu?null:e.dataTransfer.getData("text/html"),!1,i);let l=!!(n&&Kx(t,e));if(t.someProp("handleDrop",b=>b(t,e,o||ge.empty,l))){e.preventDefault();return}if(!o)return;e.preventDefault();let c=o?XM(t.state.doc,i.pos,o):i.pos;c==null&&(c=i.pos);let d=t.state.tr;if(l){let{node:b}=n;b?b.replace(d):d.deleteSelection()}let f=d.mapping.map(c),p=o.openStart==0&&o.openEnd==0&&o.content.childCount==1,m=d.doc;if(p?d.replaceRangeWith(f,f,o.content.firstChild):d.replaceRange(f,f,o),d.doc.eq(m))return;let y=d.doc.resolve(f);if(p&&Ae.isSelectable(o.content.firstChild)&&y.nodeAfter&&y.nodeAfter.sameMarkup(o.content.firstChild))d.setSelection(new Ae(y));else{let b=d.mapping.map(c);d.mapping.maps[d.mapping.maps.length-1].forEach((S,w,T,M)=>b=M),d.setSelection(Hg(t,y,d.doc.resolve(b)))}t.focus(),t.dispatch(d.setMeta("uiEvent","drop"))}Sn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&di(t)},20))};Sn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Sn.beforeinput=(t,e)=>{if(Zt&&ui&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",o=>o(t,Is(8,"Backspace")))))return;let{$cursor:i}=t.state.selection;i&&i.pos>0&&t.dispatch(t.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let t in wn)Sn[t]=wn[t];function pu(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Qd{constructor(e,n){this.toDOM=e,this.spec=n||Hs,this.side=this.spec.side||0}map(e,n,r,i){let{pos:o,deleted:l}=e.mapResult(n.from+i,this.side<0?-1:1);return l?null:new mn(o-r,o-r,this)}valid(){return!0}eq(e){return this==e||e instanceof Qd&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&pu(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class ns{constructor(e,n){this.attrs=e,this.spec=n||Hs}map(e,n,r,i){let o=e.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,l=e.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=l?null:new mn(o,l,this)}valid(e,n){return n.from<n.to}eq(e){return this==e||e instanceof ns&&pu(this.attrs,e.attrs)&&pu(this.spec,e.spec)}static is(e){return e.type instanceof ns}destroy(){}}class Qg{constructor(e,n){this.attrs=e,this.spec=n||Hs}map(e,n,r,i){let o=e.mapResult(n.from+i,1);if(o.deleted)return null;let l=e.mapResult(n.to+i,-1);return l.deleted||l.pos<=o.pos?null:new mn(o.pos-r,l.pos-r,this)}valid(e,n){let{index:r,offset:i}=e.content.findIndex(n.from),o;return i==n.from&&!(o=e.child(r)).isText&&i+o.nodeSize==n.to}eq(e){return this==e||e instanceof Qg&&pu(this.attrs,e.attrs)&&pu(this.spec,e.spec)}destroy(){}}class mn{constructor(e,n,r){this.from=e,this.to=n,this.type=r}copy(e,n){return new mn(e,n,this.type)}eq(e,n=0){return this.type.eq(e.type)&&this.from+n==e.from&&this.to+n==e.to}map(e,n,r){return this.type.map(e,this,n,r)}static widget(e,n,r){return new mn(e,e,new Qd(n,r))}static inline(e,n,r,i){return new mn(e,n,new ns(r,i))}static node(e,n,r,i){return new mn(e,n,new Qg(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof ns}get widget(){return this.type instanceof Qd}}const Yo=[],Hs={};class kt{constructor(e,n){this.local=e.length?e:Yo,this.children=n.length?n:Yo}static create(e,n){return n.length?Xd(n,e,0,Hs):hn}find(e,n,r){let i=[];return this.findInner(e??0,n??1e9,i,0,r),i}findInner(e,n,r,i,o){for(let l=0;l<this.local.length;l++){let c=this.local[l];c.from<=n&&c.to>=e&&(!o||o(c.spec))&&r.push(c.copy(c.from+i,c.to+i))}for(let l=0;l<this.children.length;l+=3)if(this.children[l]<n&&this.children[l+1]>e){let c=this.children[l]+1;this.children[l+2].findInner(e-c,n-c,r,i+c,o)}}map(e,n,r){return this==hn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||Hs)}mapInner(e,n,r,i,o){let l;for(let c=0;c<this.local.length;c++){let d=this.local[c].map(e,r,i);d&&d.type.valid(n,d)?(l||(l=[])).push(d):o.onRemove&&o.onRemove(this.local[c].spec)}return this.children.length?nz(this.children,l||[],e,n,r,i,o):l?new kt(l.sort(Vs),Yo):hn}add(e,n){return n.length?this==hn?kt.create(e,n):this.addInner(e,n,0):this}addInner(e,n,r){let i,o=0;e.forEach((c,d)=>{let f=d+r,p;if(p=Yx(n,c,f)){for(i||(i=this.children.slice());o<i.length&&i[o]<d;)o+=3;i[o]==d?i[o+2]=i[o+2].addInner(c,p,f+1):i.splice(o,0,d,d+c.nodeSize,Xd(p,c,f+1,Hs)),o+=3}});let l=Gx(o?Qx(n):n,-r);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||l.splice(c--,1);return new kt(l.length?this.local.concat(l).sort(Vs):this.local,i||this.children)}remove(e){return e.length==0||this==hn?this:this.removeInner(e,0)}removeInner(e,n){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let l,c=r[o]+n,d=r[o+1]+n;for(let p=0,m;p<e.length;p++)(m=e[p])&&m.from>c&&m.to<d&&(e[p]=null,(l||(l=[])).push(m));if(!l)continue;r==this.children&&(r=this.children.slice());let f=r[o+2].removeInner(l,c+1);f!=hn?r[o+2]=f:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,l;o<e.length;o++)if(l=e[o])for(let c=0;c<i.length;c++)i[c].eq(l,n)&&(i==this.local&&(i=this.local.slice()),i.splice(c--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new kt(i,r):hn}forChild(e,n){if(this==hn)return this;if(n.isLeaf)return kt.empty;let r,i;for(let c=0;c<this.children.length;c+=3)if(this.children[c]>=e){this.children[c]==e&&(r=this.children[c+2]);break}let o=e+1,l=o+n.content.size;for(let c=0;c<this.local.length;c++){let d=this.local[c];if(d.from<l&&d.to>o&&d.type instanceof ns){let f=Math.max(o,d.from)-o,p=Math.min(l,d.to)-o;f<p&&(i||(i=[])).push(d.copy(f,p))}}if(i){let c=new kt(i.sort(Vs),Yo);return r?new Yi([c,r]):c}return r||hn}eq(e){if(this==e)return!0;if(!(e instanceof kt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let n=0;n<this.local.length;n++)if(!this.local[n].eq(e.local[n]))return!1;for(let n=0;n<this.children.length;n+=3)if(this.children[n]!=e.children[n]||this.children[n+1]!=e.children[n+1]||!this.children[n+2].eq(e.children[n+2]))return!1;return!0}locals(e){return Xg(this.localsInner(e))}localsInner(e){if(this==hn)return Yo;if(e.inlineContent||!this.local.some(ns.is))return this.local;let n=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof ns||n.push(this.local[r]);return n}forEachSet(e){e(this)}}kt.empty=new kt([],[]);kt.removeOverlap=Xg;const hn=kt.empty;class Yi{constructor(e){this.members=e}map(e,n){const r=this.members.map(i=>i.map(e,n,Hs));return Yi.from(r)}forChild(e,n){if(n.isLeaf)return kt.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(e,n);o!=hn&&(o instanceof Yi?r=r.concat(o.members):r.push(o))}return Yi.from(r)}eq(e){if(!(e instanceof Yi)||e.members.length!=this.members.length)return!1;for(let n=0;n<this.members.length;n++)if(!this.members[n].eq(e.members[n]))return!1;return!0}locals(e){let n,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(e);if(o.length)if(!n)n=o;else{r&&(n=n.slice(),r=!1);for(let l=0;l<o.length;l++)n.push(o[l])}}return n?Xg(r?n:n.sort(Vs)):Yo}static from(e){switch(e.length){case 0:return hn;case 1:return e[0];default:return new Yi(e.every(n=>n instanceof kt)?e:e.reduce((n,r)=>n.concat(r instanceof kt?r:r.members),[]))}}forEachSet(e){for(let n=0;n<this.members.length;n++)this.members[n].forEachSet(e)}}function nz(t,e,n,r,i,o,l){let c=t.slice();for(let f=0,p=o;f<n.maps.length;f++){let m=0;n.maps[f].forEach((y,b,S,w)=>{let T=w-S-(b-y);for(let M=0;M<c.length;M+=3){let k=c[M+1];if(k<0||y>k+p-m)continue;let j=c[M]+p-m;b>=j?c[M+1]=y<=j?-2:-1:y>=p&&T&&(c[M]+=T,c[M+1]+=T)}m+=T}),p=n.maps[f].map(p,-1)}let d=!1;for(let f=0;f<c.length;f+=3)if(c[f+1]<0){if(c[f+1]==-2){d=!0,c[f+1]=-1;continue}let p=n.map(t[f]+o),m=p-i;if(m<0||m>=r.content.size){d=!0;continue}let y=n.map(t[f+1]+o,-1),b=y-i,{index:S,offset:w}=r.content.findIndex(m),T=r.maybeChild(S);if(T&&w==m&&w+T.nodeSize==b){let M=c[f+2].mapInner(n,T,p+1,t[f]+o+1,l);M!=hn?(c[f]=m,c[f+1]=b,c[f+2]=M):(c[f+1]=-2,d=!0)}else d=!0}if(d){let f=rz(c,t,e,n,i,o,l),p=Xd(f,r,0,l);e=p.local;for(let m=0;m<c.length;m+=3)c[m+1]<0&&(c.splice(m,3),m-=3);for(let m=0,y=0;m<p.children.length;m+=3){let b=p.children[m];for(;y<c.length&&c[y]<b;)y+=3;c.splice(y,0,p.children[m],p.children[m+1],p.children[m+2])}}return new kt(e.sort(Vs),c)}function Gx(t,e){if(!e||!t.length)return t;let n=[];for(let r=0;r<t.length;r++){let i=t[r];n.push(new mn(i.from+e,i.to+e,i.type))}return n}function rz(t,e,n,r,i,o,l){function c(d,f){for(let p=0;p<d.local.length;p++){let m=d.local[p].map(r,i,f);m?n.push(m):l.onRemove&&l.onRemove(d.local[p].spec)}for(let p=0;p<d.children.length;p+=3)c(d.children[p+2],d.children[p]+f+1)}for(let d=0;d<t.length;d+=3)t[d+1]==-1&&c(t[d+2],e[d]+o+1);return n}function Yx(t,e,n){if(e.isLeaf)return null;let r=n+e.nodeSize,i=null;for(let o=0,l;o<t.length;o++)(l=t[o])&&l.from>n&&l.to<r&&((i||(i=[])).push(l),t[o]=null);return i}function Qx(t){let e=[];for(let n=0;n<t.length;n++)t[n]!=null&&e.push(t[n]);return e}function Xd(t,e,n,r){let i=[],o=!1;e.forEach((c,d)=>{let f=Yx(t,c,d+n);if(f){o=!0;let p=Xd(f,c,n+d+1,r);p!=hn&&i.push(d,d+c.nodeSize,p)}});let l=Gx(o?Qx(t):t,-n).sort(Vs);for(let c=0;c<l.length;c++)l[c].type.valid(e,l[c])||(r.onRemove&&r.onRemove(l[c].spec),l.splice(c--,1));return l.length||i.length?new kt(l,i):hn}function Vs(t,e){return t.from-e.from||t.to-e.to}function Xg(t){let e=t;for(let n=0;n<e.length-1;n++){let r=e[n];if(r.from!=r.to)for(let i=n+1;i<e.length;i++){let o=e[i];if(o.from==r.from){o.to!=r.to&&(e==t&&(e=t.slice()),e[i]=o.copy(o.from,r.to),$_(e,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(e==t&&(e=t.slice()),e[n]=r.copy(r.from,o.from),$_(e,i,r.copy(o.from,r.to)));break}}}return e}function $_(t,e,n){for(;e<t.length&&Vs(n,t[e])>0;)e++;t.splice(e,0,n)}function Fm(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=hn&&e.push(r)}),t.cursorWrapper&&e.push(kt.create(t.state.doc,[t.cursorWrapper.deco])),Yi.from(e)}const iz={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},sz=Ln&&es<=11;class oz{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class az{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new oz,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Ln&&es<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),sz&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,iz)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;n<e.length;n++)this.queue.push(e[n]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(I_(this.view)){if(this.suppressingSelectionUpdates)return di(this.view);if(Ln&&es<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Ws(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let o=e.focusNode;o;o=ba(o))n.add(o);for(let o=e.anchorNode;o;o=ba(o))if(n.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&I_(e)&&!this.ignoreSelectionChange(r),o=-1,l=-1,c=!1,d=[];if(e.editable)for(let p=0;p<n.length;p++){let m=this.registerMutation(n[p],d);m&&(o=o<0?m.from:Math.min(m.from,o),l=l<0?m.to:Math.max(m.to,l),m.typeOver&&(c=!0))}if(dr&&d.length){let p=d.filter(m=>m.nodeName=="BR");if(p.length==2){let[m,y]=p;m.parentNode&&m.parentNode.parentNode==y.parentNode?y.remove():m.remove()}else{let{focusNode:m}=this.currentSelection;for(let y of p){let b=y.parentNode;b&&b.nodeName=="LI"&&(!m||cz(e,m)!=b)&&y.remove()}}}else if((Zt||yn)&&d.some(p=>p.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let p of d)if(p.nodeName=="BR"&&p.parentNode){let m=p.nextSibling;m&&m.nodeType==1&&m.contentEditable=="false"&&p.parentNode.removeChild(p)}}let f=null;o<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&Uf(r)&&(f=Fg(e))&&f.eq(He.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,di(e),this.currentSelection.set(r),e.scrollToSelection()):(o>-1||i)&&(o>-1&&(e.docView.markDirty(o,l),lz(e)),this.handleDOMChange(o,l,c,d),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||di(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let p=0;p<e.addedNodes.length;p++){let m=e.addedNodes[p];n.push(m),m.nodeType==3&&(this.lastChangedTextNode=m)}if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(e.target))return{from:r.posBefore,to:r.posAfter};let i=e.previousSibling,o=e.nextSibling;if(Ln&&es<=11&&e.addedNodes.length)for(let p=0;p<e.addedNodes.length;p++){let{previousSibling:m,nextSibling:y}=e.addedNodes[p];(!m||Array.prototype.indexOf.call(e.addedNodes,m)<0)&&(i=m),(!y||Array.prototype.indexOf.call(e.addedNodes,y)<0)&&(o=y)}let l=i&&i.parentNode==e.target?cn(i)+1:0,c=r.localPosFromDOM(e.target,l,-1),d=o&&o.parentNode==e.target?cn(o):e.target.childNodes.length,f=r.localPosFromDOM(e.target,d,1);return{from:c,to:f}}else return e.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:(this.lastChangedTextNode=e.target,{from:r.posAtStart,to:r.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let F_=new WeakMap,H_=!1;function lz(t){if(!F_.has(t)&&(F_.set(t,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace)!==-1)){if(t.requiresGeckoHackNode=dr,H_)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),H_=!0}}function V_(t,e){let n=e.startContainer,r=e.startOffset,i=e.endContainer,o=e.endOffset,l=t.domAtPos(t.state.selection.anchor);return Ws(l.node,l.offset,i,o)&&([n,r,i,o]=[i,o,n,r]),{anchorNode:n,anchorOffset:r,focusNode:i,focusOffset:o}}function uz(t,e){if(e.getComposedRanges){let i=e.getComposedRanges(t.root)[0];if(i)return V_(t,i)}let n;function r(i){i.preventDefault(),i.stopImmediatePropagation(),n=i.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",r,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",r,!0),n?V_(t,n):null}function cz(t,e){for(let n=e.parentNode;n&&n!=t.dom;n=n.parentNode){let r=t.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function dz(t,e,n){let{node:r,fromOffset:i,toOffset:o,from:l,to:c}=t.docView.parseRange(e,n),d=t.domSelectionRange(),f,p=d.anchorNode;if(p&&t.dom.contains(p.nodeType==1?p:p.parentNode)&&(f=[{node:p,offset:d.anchorOffset}],Uf(d)||f.push({node:d.focusNode,offset:d.focusOffset})),Zt&&t.input.lastKeyCode===8)for(let T=o;T>i;T--){let M=r.childNodes[T-1],k=M.pmViewDesc;if(M.nodeName=="BR"&&!k){o=T;break}if(!k||k.size)break}let m=t.state.doc,y=t.someProp("domParser")||Zi.fromSchema(t.state.schema),b=m.resolve(l),S=null,w=y.parse(r,{topNode:b.parent,topMatch:b.parent.contentMatchAt(b.index()),topOpen:!0,from:i,to:o,preserveWhitespace:b.parent.type.whitespace=="pre"?"full":!0,findPositions:f,ruleFromNode:fz,context:b});if(f&&f[0].pos!=null){let T=f[0].pos,M=f[1]&&f[1].pos;M==null&&(M=T),S={anchor:T+l,head:M+l}}return{doc:w,sel:S,from:l,to:c}}function fz(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(yn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||yn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}const hz=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function pz(t,e,n,r,i){let o=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let A=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,U=Fg(t,A);if(U&&!t.state.selection.eq(U)){if(Zt&&ui&&t.input.lastKeyCode===13&&Date.now()-100<t.input.lastKeyCodeTime&&t.someProp("handleKeyDown",se=>se(t,Is(13,"Enter"))))return;let H=t.state.tr.setSelection(U);A=="pointer"?H.setMeta("pointer",!0):A=="key"&&H.scrollIntoView(),o&&H.setMeta("composition",o),t.dispatch(H)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let d=t.state.selection,f=dz(t,e,n),p=t.state.doc,m=p.slice(f.from,f.to),y,b;t.input.lastKeyCode===8&&Date.now()-100<t.input.lastKeyCodeTime?(y=t.state.selection.to,b="end"):(y=t.state.selection.from,b="start"),t.input.lastKeyCode=null;let S=gz(m.content,f.doc.content,f.from,y,b);if(S&&t.input.domChangeCount++,(va&&t.input.lastIOSEnter>Date.now()-225||ui)&&i.some(A=>A.nodeType==1&&!hz.test(A.nodeName))&&(!S||S.endA>=S.endB)&&t.someProp("handleKeyDown",A=>A(t,Is(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!S)if(r&&d instanceof Pe&&!d.empty&&d.$head.sameParent(d.$anchor)&&!t.composing&&!(f.sel&&f.sel.anchor!=f.sel.head))S={start:d.from,endA:d.to,endB:d.to};else{if(f.sel){let A=K_(t,t.state.doc,f.sel);if(A&&!A.eq(t.state.selection)){let U=t.state.tr.setSelection(A);o&&U.setMeta("composition",o),t.dispatch(U)}}return}t.state.selection.from<t.state.selection.to&&S.start==S.endB&&t.state.selection instanceof Pe&&(S.start>t.state.selection.from&&S.start<=t.state.selection.from+2&&t.state.selection.from>=f.from?S.start=t.state.selection.from:S.endA<t.state.selection.to&&S.endA>=t.state.selection.to-2&&t.state.selection.to<=f.to&&(S.endB+=t.state.selection.to-S.endA,S.endA=t.state.selection.to)),Ln&&es<=11&&S.endB==S.start+1&&S.endA==S.start&&S.start>f.from&&f.doc.textBetween(S.start-f.from-1,S.start-f.from+1)=="  "&&(S.start--,S.endA--,S.endB--);let w=f.doc.resolveNoCache(S.start-f.from),T=f.doc.resolveNoCache(S.endB-f.from),M=p.resolve(S.start),k=w.sameParent(T)&&w.parent.inlineContent&&M.end()>=S.endA;if((va&&t.input.lastIOSEnter>Date.now()-225&&(!k||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!k&&w.pos<f.doc.content.size&&(!w.sameParent(T)||!w.parent.inlineContent)&&w.pos<T.pos&&!/\S/.test(f.doc.textBetween(w.pos,T.pos,"","")))&&t.someProp("handleKeyDown",A=>A(t,Is(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>S.start&&yz(p,S.start,S.endA,w,T)&&t.someProp("handleKeyDown",A=>A(t,Is(8,"Backspace")))){ui&&Zt&&t.domObserver.suppressSelectionUpdates();return}Zt&&S.endB==S.start&&(t.input.lastChromeDelete=Date.now()),ui&&!k&&w.start()!=T.start()&&T.parentOffset==0&&w.depth==T.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==S.endA&&(S.endB-=2,T=f.doc.resolveNoCache(S.endB-f.from),setTimeout(()=>{t.someProp("handleKeyDown",function(A){return A(t,Is(13,"Enter"))})},20));let j=S.start,I=S.endA,O=A=>{let U=A||t.state.tr.replace(j,I,f.doc.slice(S.start-f.from,S.endB-f.from));if(f.sel){let H=K_(t,U.doc,f.sel);H&&!(Zt&&t.composing&&H.empty&&(S.start!=S.endB||t.input.lastChromeDelete<Date.now()-100)&&(H.head==j||H.head==U.mapping.map(I)-1)||Ln&&H.empty&&H.head==j)&&U.setSelection(H)}return o&&U.setMeta("composition",o),U.scrollIntoView()},P;if(k)if(w.pos==T.pos){Ln&&es<=11&&w.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>di(t),20));let A=O(t.state.tr.delete(j,I)),U=p.resolve(S.start).marksAcross(p.resolve(S.endA));U&&A.ensureMarks(U),t.dispatch(A)}else if(S.endA==S.endB&&(P=mz(w.parent.content.cut(w.parentOffset,T.parentOffset),M.parent.content.cut(M.parentOffset,S.endA-M.start())))){let A=O(t.state.tr);P.type=="add"?A.addMark(j,I,P.mark):A.removeMark(j,I,P.mark),t.dispatch(A)}else if(w.parent.child(w.index()).isText&&w.index()==T.index()-(T.textOffset?0:1)){let A=w.parent.textBetween(w.parentOffset,T.parentOffset),U=()=>O(t.state.tr.insertText(A,j,I));t.someProp("handleTextInput",H=>H(t,j,I,A,U))||t.dispatch(U())}else t.dispatch(O());else t.dispatch(O())}function K_(t,e,n){return Math.max(n.anchor,n.head)>e.content.size?null:Hg(t,e.resolve(n.anchor),e.resolve(n.head))}function mz(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,i=n,o=r,l,c,d;for(let p=0;p<r.length;p++)i=r[p].removeFromSet(i);for(let p=0;p<n.length;p++)o=n[p].removeFromSet(o);if(i.length==1&&o.length==0)c=i[0],l="add",d=p=>p.mark(c.addToSet(p.marks));else if(i.length==0&&o.length==1)c=o[0],l="remove",d=p=>p.mark(c.removeFromSet(p.marks));else return null;let f=[];for(let p=0;p<e.childCount;p++)f.push(d(e.child(p)));if(oe.from(f).eq(t))return{mark:c,type:l}}function yz(t,e,n,r,i){if(n-e<=i.pos-r.pos||Hm(r,!0,!1)<i.pos)return!1;let o=t.resolve(e);if(!r.parent.isTextblock){let c=o.nodeAfter;return c!=null&&n==e+c.nodeSize}if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let l=t.resolve(Hm(o,!0,!0));return!l.parent.isTextblock||l.pos>n||Hm(l,!0,!1)<n?!1:r.parent.content.cut(r.parentOffset).eq(l.parent.content)}function Hm(t,e,n){let r=t.depth,i=e?t.end():t.pos;for(;r>0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,i++,e=!1;if(n){let o=t.node(r).maybeChild(t.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function gz(t,e,n,r,i){let o=t.findDiffStart(e,n);if(o==null)return null;let{a:l,b:c}=t.findDiffEnd(e,n+t.size,n+e.size);if(i=="end"){let d=Math.max(0,o-Math.min(l,c));r-=l+d-o}if(l<o&&t.size<e.size){let d=r<=o&&r>=l?o-r:0;o-=d,o&&o<e.size&&G_(e.textBetween(o-1,o+1))&&(o+=d?1:-1),c=o+(c-l),l=o}else if(c<o){let d=r<=o&&r>=c?o-r:0;o-=d,o&&o<t.size&&G_(t.textBetween(o-1,o+1))&&(o+=d?1:-1),l=o+(l-c),c=o}return{start:o,endA:l,endB:c}}function G_(t){if(t.length!=2)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class Xx{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new I4,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(W_),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=X_(this),Q_(this),this.nodeViews=J_(this),this.docView=k_(this.state.doc,Y_(this),Fm(this),this.dom,this),this.domObserver=new az(this,(r,i,o,l)=>pz(this,r,i,o,l)),this.domObserver.start(),L4(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&rg(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(W_),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let i=this.state,o=!1,l=!1;e.storedMarks&&this.composing&&(Fx(this),l=!0),this.state=e;let c=i.plugins!=e.plugins||this._props.plugins!=n.plugins;if(c||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let b=J_(this);vz(b,this.nodeViews)&&(this.nodeViews=b,o=!0)}(c||n.handleDOMEvents!=this._props.handleDOMEvents)&&rg(this),this.editable=X_(this),Q_(this);let d=Fm(this),f=Y_(this),p=i.plugins!=e.plugins&&!i.doc.eq(e.doc)?"reset":e.scrollToSelection>i.scrollToSelection?"to selection":"preserve",m=o||!this.docView.matchesNode(e.doc,f,d);(m||!e.selection.eq(i.selection))&&(l=!0);let y=p=="preserve"&&l&&this.dom.style.overflowAnchor==null&&QB(this);if(l){this.domObserver.stop();let b=m&&(Ln||Zt)&&!this.composing&&!i.selection.empty&&!e.selection.empty&&bz(i.selection,e.selection);if(m){let S=Zt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=Q4(this)),(o||!this.docView.update(e.doc,f,d,this))&&(this.docView.updateOuterDeco(f),this.docView.destroy(),this.docView=k_(e.doc,f,d,this.dom,this)),S&&!this.trackWrites&&(b=!0)}b||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&v4(this))?di(this,b):(Nx(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,i),p=="reset"?this.dom.scrollTop=0:p=="to selection"?this.scrollToSelection():y&&XB(y)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof Ae){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&__(this,n.getBoundingClientRect(),e)}else __(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n<this.directPlugins.length;n++){let r=this.directPlugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let n=0;n<this.state.plugins.length;n++){let r=this.state.plugins[n];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let n=0;n<this.pluginViews.length;n++){let r=this.pluginViews[n];r.update&&r.update(this,e)}}updateDraggedNode(e,n){let r=e.node,i=-1;if(this.state.doc.nodeAt(r.from)==r.node)i=r.from;else{let o=r.from+(this.state.doc.content.size-n.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==r.node&&(i=o)}this.dragging=new Vx(e.slice,e.move,i<0?void 0:Ae.create(this.state.doc,i))}someProp(e,n){let r=this._props&&this._props[e],i;if(r!=null&&(i=n?n(r):r))return i;for(let l=0;l<this.directPlugins.length;l++){let c=this.directPlugins[l].props[e];if(c!=null&&(i=n?n(c):c))return i}let o=this.state.plugins;if(o)for(let l=0;l<o.length;l++){let c=o[l].props[e];if(c!=null&&(i=n?n(c):c))return i}}hasFocus(){if(Ln){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&JB(this.dom),di(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let n=this.dom.parentNode;n;n=n.parentNode)if(n.nodeType==9||n.nodeType==11&&n.host)return n.getSelection||(Object.getPrototypeOf(n).getSelection=()=>n.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return n4(this,e)}coordsAtPos(e,n=1){return Tx(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let i=this.docView.posFromDOM(e,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(e,n){return a4(this,n||this.state,e)}pasteHTML(e,n){return hu(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return hu(this,e,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(e){return Vg(this,e)}destroy(){this.docView&&(j4(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Fm(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,PB())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return z4(this,e)}domSelectionRange(){let e=this.domSelection();return e?yn&&this.root.nodeType===11&&HB(this.dom.ownerDocument)==this.dom&&uz(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}Xx.prototype.dispatch=function(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))};function Y_(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[mn.node(0,t.state.doc.content.size,e)]}function Q_(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:mn.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function X_(t){return!t.someProp("editable",e=>e(t.state)===!1)}function bz(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function J_(t){let e=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(e,i)||(e[i]=r[i])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function vz(t,e){let n=0,r=0;for(let i in t){if(t[i]!=e[i])return!0;n++}for(let i in e)r++;return n!=r}function W_(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ss={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Jd={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Sz=typeof navigator<"u"&&/Mac/.test(navigator.platform),wz=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var dn=0;dn<10;dn++)ss[48+dn]=ss[96+dn]=String(dn);for(var dn=1;dn<=24;dn++)ss[dn+111]="F"+dn;for(var dn=65;dn<=90;dn++)ss[dn]=String.fromCharCode(dn+32),Jd[dn]=String.fromCharCode(dn);for(var Vm in ss)Jd.hasOwnProperty(Vm)||(Jd[Vm]=ss[Vm]);function _z(t){var e=Sz&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||wz&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Jd:ss)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}const Tz=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),Ez=typeof navigator<"u"&&/Win/.test(navigator.platform);function Mz(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,i,o,l;for(let c=0;c<e.length-1;c++){let d=e[c];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))Tz?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+d)}return r&&(n="Alt-"+n),i&&(n="Ctrl-"+n),l&&(n="Meta-"+n),o&&(n="Shift-"+n),n}function xz(t){let e=Object.create(null);for(let n in t)e[Mz(n)]=t[n];return e}function Km(t,e,n=!0){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n&&e.shiftKey&&(t="Shift-"+t),t}function Cz(t){return new Ot({props:{handleKeyDown:Jx(t)}})}function Jx(t){let e=xz(t);return function(n,r){let i=_z(r),o,l=e[Km(i,r)];if(l&&l(n.state,n.dispatch,n))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let c=e[Km(i,r,!1)];if(c&&c(n.state,n.dispatch,n))return!0}if((r.altKey||r.metaKey||r.ctrlKey)&&!(Ez&&r.ctrlKey&&r.altKey)&&(o=ss[r.keyCode])&&o!=i){let c=e[Km(o,r)];if(c&&c(n.state,n.dispatch,n))return!0}}return!1}}var kz=Object.defineProperty,Jg=(t,e)=>{for(var n in e)kz(t,n,{get:e[n],enumerable:!0})};function Ff(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:i}=n,{storedMarks:o}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,o=n.storedMarks,n}}}var Hf=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:i}=n,o=this.buildProps(i);return Object.fromEntries(Object.entries(t).map(([l,c])=>[l,(...f)=>{const p=c(...f)(o);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),p}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:o}=r,l=[],c=!!t,d=t||i.tr,f=()=>(!c&&e&&!d.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(d),l.every(m=>m===!0)),p={...Object.fromEntries(Object.entries(n).map(([m,y])=>[m,(...S)=>{const w=this.buildProps(d,e),T=y(...S)(w);return l.push(T),p}])),run:f};return p}createCan(t){const{rawCommands:e,state:n}=this,r=!1,i=t||n.tr,o=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(e).map(([c,d])=>[c,(...f)=>d(...f)({...o,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:i}=this,{view:o}=r,l={tr:t,editor:r,view:o,state:Ff({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([c,d])=>[c,(...f)=>d(...f)(l)]))}};return l}},Wx={};Jg(Wx,{blur:()=>Az,clearContent:()=>Oz,clearNodes:()=>Nz,command:()=>Rz,createParagraphNear:()=>Dz,cut:()=>Iz,deleteCurrentNode:()=>Lz,deleteNode:()=>jz,deleteRange:()=>Bz,deleteSelection:()=>zz,enter:()=>Pz,exitCode:()=>Uz,extendMarkRange:()=>qz,first:()=>$z,focus:()=>Hz,forEach:()=>Vz,insertContent:()=>Kz,insertContentAt:()=>Qz,joinBackward:()=>Wz,joinDown:()=>Jz,joinForward:()=>Zz,joinItemBackward:()=>eP,joinItemForward:()=>tP,joinTextblockBackward:()=>nP,joinTextblockForward:()=>rP,joinUp:()=>Xz,keyboardShortcut:()=>sP,lift:()=>oP,liftEmptyBlock:()=>aP,liftListItem:()=>lP,newlineInCode:()=>uP,resetAttributes:()=>cP,scrollIntoView:()=>dP,selectAll:()=>fP,selectNodeBackward:()=>hP,selectNodeForward:()=>pP,selectParentNode:()=>mP,selectTextblockEnd:()=>yP,selectTextblockStart:()=>gP,setContent:()=>bP,setMark:()=>zP,setMeta:()=>PP,setNode:()=>UP,setNodeSelection:()=>qP,setTextDirection:()=>$P,setTextSelection:()=>FP,sinkListItem:()=>HP,splitBlock:()=>VP,splitListItem:()=>KP,toggleList:()=>GP,toggleMark:()=>YP,toggleNode:()=>QP,toggleWrap:()=>XP,undoInputRule:()=>JP,unsetAllMarks:()=>WP,unsetMark:()=>ZP,unsetTextDirection:()=>eU,updateAttributes:()=>tU,wrapIn:()=>nU,wrapInList:()=>rU});var Az=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),Oz=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),Nz=()=>({state:t,tr:e,dispatch:n})=>{const{selection:r}=e,{ranges:i}=r;return n&&i.forEach(({$from:o,$to:l})=>{t.doc.nodesBetween(o.pos,l.pos,(c,d)=>{if(c.type.isText)return;const{doc:f,mapping:p}=e,m=f.resolve(p.map(d)),y=f.resolve(p.map(d+c.nodeSize)),b=m.blockRange(y);if(!b)return;const S=Ma(b);if(c.type.isTextblock){const{defaultType:w}=m.parent.contentMatchAt(m.index());e.setNodeMarkup(b.start,w)}(S||S===0)&&e.lift(b,S)})}),!0},Rz=t=>e=>t(e),Dz=()=>({state:t,dispatch:e})=>fx(t,e),Iz=(t,e)=>({editor:n,tr:r})=>{const{state:i}=n,o=i.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const l=r.mapping.map(e);return r.insert(l,o.content),r.setSelection(new Pe(r.doc.resolve(Math.max(l-1,0)))),!0},Lz=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const i=t.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(e){const c=i.before(o),d=i.after(o);t.delete(c,d).scrollIntoView()}return!0}return!1};function Kt(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}var jz=t=>({tr:e,state:n,dispatch:r})=>{const i=Kt(t,n.schema),o=e.selection.$anchor;for(let l=o.depth;l>0;l-=1)if(o.node(l).type===i){if(r){const d=o.before(l),f=o.after(l);e.delete(d,f).scrollIntoView()}return!0}return!1},Bz=t=>({tr:e,dispatch:n})=>{const{from:r,to:i}=t;return n&&e.delete(r,i),!0},zz=()=>({state:t,dispatch:e})=>Bg(t,e),Pz=()=>({commands:t})=>t.keyboardShortcut("Enter"),Uz=()=>({state:t,dispatch:e})=>EB(t,e);function Wg(t){return Object.prototype.toString.call(t)==="[object RegExp]"}function Wd(t,e,n={strict:!0}){const r=Object.keys(e);return r.length?r.every(i=>n.strict?e[i]===t[i]:Wg(e[i])?e[i].test(t[i]):e[i]===t[i]):!0}function Zx(t,e,n={}){return t.find(r=>r.type===e&&Wd(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function Z_(t,e,n={}){return!!Zx(t,e,n)}function Zg(t,e,n){var r;if(!t||!e)return;let i=t.parent.childAfter(t.parentOffset);if((!i.node||!i.node.marks.some(p=>p.type===e))&&(i=t.parent.childBefore(t.parentOffset)),!i.node||!i.node.marks.some(p=>p.type===e)||(n=n||((r=i.node.marks[0])==null?void 0:r.attrs),!Zx([...i.node.marks],e,n)))return;let l=i.index,c=t.start()+i.offset,d=l+1,f=c+i.node.nodeSize;for(;l>0&&Z_([...t.parent.child(l-1).marks],e,n);)l-=1,c-=t.parent.child(l).nodeSize;for(;d<t.parent.childCount&&Z_([...t.parent.child(d).marks],e,n);)f+=t.parent.child(d).nodeSize,d+=1;return{from:c,to:f}}function pi(t,e){if(typeof t=="string"){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var qz=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const o=pi(t,r.schema),{doc:l,selection:c}=n,{$from:d,from:f,to:p}=c;if(i){const m=Zg(d,o,e);if(m&&m.from<=f&&m.to>=p){const y=Pe.create(l,m.from,m.to);n.setSelection(y)}}return!0},$z=t=>e=>{const n=typeof t=="function"?t(e):t;for(let r=0;r<n.length;r+=1)if(n[r](e))return!0;return!1};function eC(t){return t instanceof Pe}function zs(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function tC(t,e=null){if(!e)return null;const n=He.atStart(t),r=He.atEnd(t);if(e==="start"||e===!0)return n;if(e==="end")return r;const i=n.from,o=r.to;return e==="all"?Pe.create(t,zs(0,i,o),zs(t.content.size,i,o)):Pe.create(t,zs(e,i,o),zs(e,i,o))}function ig(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function mu(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Fz(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Hz=(t=null,e={})=>({editor:n,view:r,tr:i,dispatch:o})=>{e={scrollIntoView:!0,...e};const l=()=>{(mu()||ig())&&r.dom.focus(),Fz()&&!mu()&&!ig()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&t===null||t===!1)return!0}catch{return!1}if(o&&t===null&&!eC(n.state.selection))return l(),!0;const c=tC(i.doc,t)||n.state.selection,d=n.state.selection.eq(c);return o&&(d||i.setSelection(c),d&&i.storedMarks&&i.setStoredMarks(i.storedMarks),l()),!0},Vz=(t,e)=>n=>t.every((r,i)=>e(r,{...n,index:i})),Kz=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),nC=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):r.nodeType===1&&nC(r)}return t};function ad(t){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=new window.DOMParser().parseFromString(e,"text/html").body;return nC(n)}function yu(t,e,n){if(t instanceof cr||t instanceof oe)return t;n={slice:!0,parseOptions:{},...n};const r=typeof t=="object"&&t!==null,i=typeof t=="string";if(r)try{if(Array.isArray(t)&&t.length>0)return oe.fromArray(t.map(c=>e.nodeFromJSON(c)));const l=e.nodeFromJSON(t);return n.errorOnInvalidContent&&l.check(),l}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),yu("",e,n)}if(i){if(n.errorOnInvalidContent){let l=!1,c="";const d=new PM({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:f=>(l=!0,c=typeof f=="string"?f:f.outerHTML,null)}]}})});if(n.slice?Zi.fromSchema(d).parseSlice(ad(t),n.parseOptions):Zi.fromSchema(d).parse(ad(t),n.parseOptions),n.errorOnInvalidContent&&l)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${c}`)})}const o=Zi.fromSchema(e);return n.slice?o.parseSlice(ad(t),n.parseOptions).content:o.parse(ad(t),n.parseOptions)}return yu("",e,n)}function Gz(t,e,n){const r=t.steps.length-1;if(r<e)return;const i=t.steps[r];if(!(i instanceof Wt||i instanceof en))return;const o=t.mapping.maps[r];let l=0;o.forEach((c,d,f,p)=>{l===0&&(l=p)}),t.setSelection(He.near(t.doc.resolve(l),n))}var Yz=t=>!("type"in t),Qz=(t,e,n)=>({tr:r,dispatch:i,editor:o})=>{var l;if(i){n={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let c;const d=T=>{o.emit("contentError",{editor:o,error:T,disableCollaboration:()=>{"collaboration"in o.storage&&typeof o.storage.collaboration=="object"&&o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}})},f={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!o.options.enableContentCheck&&o.options.emitContentError)try{yu(e,o.schema,{parseOptions:f,errorOnInvalidContent:!0})}catch(T){d(T)}try{c=yu(e,o.schema,{parseOptions:f,errorOnInvalidContent:(l=n.errorOnInvalidContent)!=null?l:o.options.enableContentCheck})}catch(T){return d(T),!1}let{from:p,to:m}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},y=!0,b=!0;if((Yz(c)?c:[c]).forEach(T=>{T.check(),y=y?T.isText&&T.marks.length===0:!1,b=b?T.isBlock:!1}),p===m&&b){const{parent:T}=r.doc.resolve(p);T.isTextblock&&!T.type.spec.code&&!T.childCount&&(p-=1,m+=1)}let w;if(y){if(Array.isArray(e))w=e.map(T=>T.text||"").join("");else if(e instanceof oe){let T="";e.forEach(M=>{M.text&&(T+=M.text)}),w=T}else typeof e=="object"&&e&&e.text?w=e.text:w=e;r.insertText(w,p,m)}else{w=c;const T=r.doc.resolve(p),M=T.node(),k=T.parentOffset===0,j=M.isText||M.isTextblock,I=M.content.size>0;k&&j&&I&&(p=Math.max(0,p-1)),r.replaceWith(p,m,w)}n.updateSelection&&Gz(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:p,text:w}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:p,text:w})}return!0},Xz=()=>({state:t,dispatch:e})=>wB(t,e),Jz=()=>({state:t,dispatch:e})=>_B(t,e),Wz=()=>({state:t,dispatch:e})=>sx(t,e),Zz=()=>({state:t,dispatch:e})=>ux(t,e),eP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Bf(t.doc,t.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},tP=()=>({state:t,dispatch:e,tr:n})=>{try{const r=Bf(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}},nP=()=>({state:t,dispatch:e})=>vB(t,e),rP=()=>({state:t,dispatch:e})=>SB(t,e);function rC(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function iP(t){const e=t.split(/-(?!$)/);let n=e[e.length-1];n==="Space"&&(n=" ");let r,i,o,l;for(let c=0;c<e.length-1;c+=1){const d=e[c];if(/^(cmd|meta|m)$/i.test(d))l=!0;else if(/^a(lt)?$/i.test(d))r=!0;else if(/^(c|ctrl|control)$/i.test(d))i=!0;else if(/^s(hift)?$/i.test(d))o=!0;else if(/^mod$/i.test(d))mu()||rC()?l=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${d}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),l&&(n=`Meta-${n}`),o&&(n=`Shift-${n}`),n}var sP=t=>({editor:e,view:n,tr:r,dispatch:i})=>{const o=iP(t).split(/-(?!$)/),l=o.find(f=>!["Alt","Ctrl","Meta","Shift"].includes(f)),c=new KeyboardEvent("keydown",{key:l==="Space"?" ":l,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),d=e.captureTransaction(()=>{n.someProp("handleKeyDown",f=>f(n,c))});return d?.steps.forEach(f=>{const p=f.map(r.mapping);p&&i&&r.maybeStep(p)}),!0};function as(t,e,n={}){const{from:r,to:i,empty:o}=t.selection,l=e?Kt(e,t.schema):null,c=[];t.doc.nodesBetween(r,i,(m,y)=>{if(m.isText)return;const b=Math.max(r,y),S=Math.min(i,y+m.nodeSize);c.push({node:m,from:b,to:S})});const d=i-r,f=c.filter(m=>l?l.name===m.node.type.name:!0).filter(m=>Wd(m.node.attrs,n,{strict:!1}));return o?!!f.length:f.reduce((m,y)=>m+y.to-y.from,0)>=d}var oP=(t,e={})=>({state:n,dispatch:r})=>{const i=Kt(t,n.schema);return as(n,i,e)?TB(n,r):!1},aP=()=>({state:t,dispatch:e})=>hx(t,e),lP=t=>({state:e,dispatch:n})=>{const r=Kt(t,e.schema);return LB(r)(e,n)},uP=()=>({state:t,dispatch:e})=>dx(t,e);function Vf(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function eT(t,e){const n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,i)=>(n.includes(i)||(r[i]=t[i]),r),{})}var cP=(t,e)=>({tr:n,state:r,dispatch:i})=>{let o=null,l=null;const c=Vf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(o=Kt(t,r.schema)),c==="mark"&&(l=pi(t,r.schema));let d=!1;return n.selection.ranges.forEach(f=>{r.doc.nodesBetween(f.$from.pos,f.$to.pos,(p,m)=>{o&&o===p.type&&(d=!0,i&&n.setNodeMarkup(m,void 0,eT(p.attrs,e))),l&&p.marks.length&&p.marks.forEach(y=>{l===y.type&&(d=!0,i&&n.addMark(m,m+p.nodeSize,l.create(eT(y.attrs,e))))})})}),d},dP=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),fP=()=>({tr:t,dispatch:e})=>{if(e){const n=new Hn(t.doc);t.setSelection(n)}return!0},hP=()=>({state:t,dispatch:e})=>ax(t,e),pP=()=>({state:t,dispatch:e})=>cx(t,e),mP=()=>({state:t,dispatch:e})=>CB(t,e),yP=()=>({state:t,dispatch:e})=>OB(t,e),gP=()=>({state:t,dispatch:e})=>AB(t,e);function sg(t,e,n={},r={}){return yu(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var bP=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:o,dispatch:l,commands:c})=>{const{doc:d}=o;if(r.preserveWhitespace!=="full"){const f=sg(t,i.schema,r,{errorOnInvalidContent:e??i.options.enableContentCheck});return l&&o.replaceWith(0,d.content.size,f).setMeta("preventUpdate",!n),!0}return l&&o.setMeta("preventUpdate",!n),c.insertContentAt({from:0,to:d.content.size},t,{parseOptions:r,errorOnInvalidContent:e??i.options.enableContentCheck})};function iC(t,e){const n=pi(e,t.schema),{from:r,to:i,empty:o}=t.selection,l=[];o?(t.storedMarks&&l.push(...t.storedMarks),l.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,i,d=>{l.push(...d.marks)});const c=l.find(d=>d.type.name===n.name);return c?{...c.attrs}:{}}function sC(t,e){const n=new tx(t);return e.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function vP(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function SP(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(i,o)=>{n(i)&&r.push({node:i,pos:o})}),r}function wP(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Kf(t){return e=>wP(e.$from,t)}function ke(t,e,n){return t.config[e]===void 0&&t.parent?ke(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ke(t.parent,e,n):null}):t.config[e]}function e0(t){return t.map(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=ke(e,"addExtensions",n);return r?[e,...e0(r())]:e}).flat(10)}function t0(t,e){const n=to.fromSchema(e).serializeFragment(t),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function oC(t){return typeof t=="function"}function gt(t,e=void 0,...n){return oC(t)?e?t.bind(e)(...n):t(...n):t}function _P(t={}){return Object.keys(t).length===0&&t.constructor===Object}function Sa(t){const e=t.filter(i=>i.type==="extension"),n=t.filter(i=>i.type==="node"),r=t.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function aC(t){const e=[],{nodeExtensions:n,markExtensions:r}=Sa(t),i=[...n,...r],o={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},l=n.filter(f=>f.name!=="text").map(f=>f.name),c=r.map(f=>f.name),d=[...l,...c];return t.forEach(f=>{const p={name:f.name,options:f.options,storage:f.storage,extensions:i},m=ke(f,"addGlobalAttributes",p);if(!m)return;m().forEach(b=>{let S;Array.isArray(b.types)?S=b.types:b.types==="*"?S=d:b.types==="nodes"?S=l:b.types==="marks"?S=c:S=[],S.forEach(w=>{Object.entries(b.attributes).forEach(([T,M])=>{e.push({type:w,name:T,attribute:{...o,...M}})})})})}),i.forEach(f=>{const p={name:f.name,options:f.options,storage:f.storage},m=ke(f,"addAttributes",p);if(!m)return;const y=m();Object.entries(y).forEach(([b,S])=>{const w={...o,...S};typeof w?.default=="function"&&(w.default=w.default()),w?.isRequired&&w?.default===void 0&&delete w.default,e.push({type:f.name,name:b,attribute:w})})}),e}function At(...t){return t.filter(e=>!!e).reduce((e,n)=>{const r={...e};return Object.entries(n).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){const c=o?String(o).split(" "):[],d=r[i]?r[i].split(" "):[],f=c.filter(p=>!d.includes(p));r[i]=[...d,...f].join(" ")}else if(i==="style"){const c=o?o.split(";").map(p=>p.trim()).filter(Boolean):[],d=r[i]?r[i].split(";").map(p=>p.trim()).filter(Boolean):[],f=new Map;d.forEach(p=>{const[m,y]=p.split(":").map(b=>b.trim());f.set(m,y)}),c.forEach(p=>{const[m,y]=p.split(":").map(b=>b.trim());f.set(m,y)}),r[i]=Array.from(f.entries()).map(([p,m])=>`${p}: ${m}`).join("; ")}else r[i]=o}),r},{})}function wa(t,e){return e.filter(n=>n.type===t.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>At(n,r),{})}function TP(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function tT(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;const i=e.reduce((o,l)=>{const c=l.attribute.parseHTML?l.attribute.parseHTML(n):TP(n.getAttribute(l.name));return c==null?o:{...o,[l.name]:c}},{});return{...r,...i}}}}function nT(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&_P(n)?!1:n!=null))}function rT(t){var e,n;const r={};return!((e=t?.attribute)!=null&&e.isRequired)&&"default"in(t?.attribute||{})&&(r.default=t.attribute.default),((n=t?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=t.attribute.validate),[t.name,r]}function EP(t,e){var n;const r=aC(t),{nodeExtensions:i,markExtensions:o}=Sa(t),l=(n=i.find(f=>ke(f,"topNode")))==null?void 0:n.name,c=Object.fromEntries(i.map(f=>{const p=r.filter(M=>M.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},y=t.reduce((M,k)=>{const j=ke(k,"extendNodeSchema",m);return{...M,...j?j(f):{}}},{}),b=nT({...y,content:gt(ke(f,"content",m)),marks:gt(ke(f,"marks",m)),group:gt(ke(f,"group",m)),inline:gt(ke(f,"inline",m)),atom:gt(ke(f,"atom",m)),selectable:gt(ke(f,"selectable",m)),draggable:gt(ke(f,"draggable",m)),code:gt(ke(f,"code",m)),whitespace:gt(ke(f,"whitespace",m)),linebreakReplacement:gt(ke(f,"linebreakReplacement",m)),defining:gt(ke(f,"defining",m)),isolating:gt(ke(f,"isolating",m)),attrs:Object.fromEntries(p.map(rT))}),S=gt(ke(f,"parseHTML",m));S&&(b.parseDOM=S.map(M=>tT(M,p)));const w=ke(f,"renderHTML",m);w&&(b.toDOM=M=>w({node:M,HTMLAttributes:wa(M,p)}));const T=ke(f,"renderText",m);return T&&(b.toText=T),[f.name,b]})),d=Object.fromEntries(o.map(f=>{const p=r.filter(T=>T.type===f.name),m={name:f.name,options:f.options,storage:f.storage,editor:e},y=t.reduce((T,M)=>{const k=ke(M,"extendMarkSchema",m);return{...T,...k?k(f):{}}},{}),b=nT({...y,inclusive:gt(ke(f,"inclusive",m)),excludes:gt(ke(f,"excludes",m)),group:gt(ke(f,"group",m)),spanning:gt(ke(f,"spanning",m)),code:gt(ke(f,"code",m)),attrs:Object.fromEntries(p.map(rT))}),S=gt(ke(f,"parseHTML",m));S&&(b.parseDOM=S.map(T=>tT(T,p)));const w=ke(f,"renderHTML",m);return w&&(b.toDOM=T=>w({mark:T,HTMLAttributes:wa(T,p)})),[f.name,b]}));return new PM({topNode:l,nodes:c,marks:d})}function MP(t){const e=t.filter((n,r)=>t.indexOf(n)!==r);return Array.from(new Set(e))}function zl(t){return t.sort((n,r)=>{const i=ke(n,"priority")||100,o=ke(r,"priority")||100;return i>o?-1:i<o?1:0})}function lC(t){const e=zl(e0(t)),n=MP(e.map(r=>r.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),e}function uC(t,e,n){const{from:r,to:i}=e,{blockSeparator:o=`
26
+
27
+ `,textSerializers:l={}}=n||{};let c="";return t.nodesBetween(r,i,(d,f,p,m)=>{var y;d.isBlock&&f>r&&(c+=o);const b=l?.[d.type.name];if(b)return p&&(c+=b({node:d,pos:f,parent:p,index:m,range:e})),!1;d.isText&&(c+=(y=d?.text)==null?void 0:y.slice(Math.max(r,f)-f,i-f))}),c}function xP(t,e){const n={from:0,to:t.content.size};return uC(t,n,e)}function cC(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}function CP(t,e){const n=Kt(e,t.schema),{from:r,to:i}=t.selection,o=[];t.doc.nodesBetween(r,i,c=>{o.push(c)});const l=o.reverse().find(c=>c.type.name===n.name);return l?{...l.attrs}:{}}function dC(t,e){const n=Vf(typeof e=="string"?e:e.name,t.schema);return n==="node"?CP(t,e):n==="mark"?iC(t,e):{}}function kP(t,e=JSON.stringify){const n={};return t.filter(r=>{const i=e(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function AP(t){const e=kP(t);return e.length===1?e:e.filter((n,r)=>!e.filter((o,l)=>l!==r).some(o=>n.oldRange.from>=o.oldRange.from&&n.oldRange.to<=o.oldRange.to&&n.newRange.from>=o.newRange.from&&n.newRange.to<=o.newRange.to))}function fC(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((i,o)=>{const l=[];if(i.ranges.length)i.forEach((c,d)=>{l.push({from:c,to:d})});else{const{from:c,to:d}=n[o];if(c===void 0||d===void 0)return;l.push({from:c,to:d})}l.forEach(({from:c,to:d})=>{const f=e.slice(o).map(c,-1),p=e.slice(o).map(d),m=e.invert().map(f,-1),y=e.invert().map(p);r.push({oldRange:{from:m,to:y},newRange:{from:f,to:p}})})}),AP(r)}function n0(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(i=>{const o=n.resolve(t),l=Zg(o,i.type);l&&r.push({mark:i,...l})}):n.nodesBetween(t,e,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(l=>({from:o,to:o+i.nodeSize,mark:l})))}),r}var OP=(t,e,n,r=20)=>{const i=t.doc.resolve(n);let o=r,l=null;for(;o>0&&l===null;){const c=i.node(o);c?.type.name===e?l=c:o-=1}return[l,o]};function _l(t,e){return e.nodes[t]||e.marks[t]||null}function Md(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{const i=t.find(o=>o.type===e&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}var NP=(t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(i,o,l,c)=>{var d,f;const p=((f=(d=i.type.spec).toText)==null?void 0:f.call(d,{node:i,pos:o,parent:l,index:c}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?p:p.slice(0,Math.max(0,r-o))}),n};function og(t,e,n={}){const{empty:r,ranges:i}=t.selection,o=e?pi(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(m=>o?o.name===m.type.name:!0).find(m=>Wd(m.attrs,n,{strict:!1}));let l=0;const c=[];if(i.forEach(({$from:m,$to:y})=>{const b=m.pos,S=y.pos;t.doc.nodesBetween(b,S,(w,T)=>{if(o&&w.inlineContent&&!w.type.allowsMarkType(o))return!1;if(!w.isText&&!w.marks.length)return;const M=Math.max(b,T),k=Math.min(S,T+w.nodeSize),j=k-M;l+=j,c.push(...w.marks.map(I=>({mark:I,from:M,to:k})))})}),l===0)return!1;const d=c.filter(m=>o?o.name===m.mark.type.name:!0).filter(m=>Wd(m.mark.attrs,n,{strict:!1})).reduce((m,y)=>m+y.to-y.from,0),f=c.filter(m=>o?m.mark.type!==o&&m.mark.type.excludes(o):!0).reduce((m,y)=>m+y.to-y.from,0);return(d>0?d+f:d)>=l}function RP(t,e,n={}){if(!e)return as(t,null,n)||og(t,null,n);const r=Vf(e,t.schema);return r==="node"?as(t,e,n):r==="mark"?og(t,e,n):!1}var DP=(t,e)=>{const{$from:n,$to:r,$anchor:i}=t.selection;if(e){const o=Kf(c=>c.type.name===e)(t.selection);if(!o)return!1;const l=t.doc.resolve(o.pos+1);return i.pos+1===l.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},IP=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function iT(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}function sT(t,e){const{nodeExtensions:n}=Sa(e),r=n.find(l=>l.name===t);if(!r)return!1;const i={name:r.name,options:r.options,storage:r.storage},o=gt(ke(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Gf(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(t.type.name==="hardBreak")return!0;if(t.isText)return/^\s*$/m.test((r=t.text)!=null?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(t.content.childCount===0)return!0;if(e){let i=!0;return t.content.forEach(o=>{i!==!1&&(Gf(o,{ignoreWhitespace:n,checkChildren:e})||(i=!1))}),i}return!1}function hC(t){return t instanceof Ae}var pC=class mC{constructor(e){this.position=e}static fromJSON(e){return new mC(e.position)}toJSON(){return{position:this.position}}};function LP(t,e){const n=e.mapping.mapResult(t.position);return{position:new pC(n.pos),mapResult:n}}function jP(t){return new pC(t)}function BP(t,e,n){var r;const{selection:i}=e;let o=null;if(eC(i)&&(o=i.$cursor),o){const c=(r=t.storedMarks)!=null?r:o.marks();return o.parent.type.allowsMarkType(n)&&(!!n.isInSet(c)||!c.some(f=>f.type.excludes(n)))}const{ranges:l}=i;return l.some(({$from:c,$to:d})=>{let f=c.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(c.pos,d.pos,(p,m,y)=>{if(f)return!1;if(p.isInline){const b=!y||y.type.allowsMarkType(n),S=!!n.isInSet(p.marks)||!p.marks.some(w=>w.type.excludes(n));f=b&&S}return!f}),f})}var zP=(t,e={})=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=n,{empty:l,ranges:c}=o,d=pi(t,r.schema);if(i)if(l){const f=iC(r,d);n.addStoredMark(d.create({...f,...e}))}else c.forEach(f=>{const p=f.$from.pos,m=f.$to.pos;r.doc.nodesBetween(p,m,(y,b)=>{const S=Math.max(b,p),w=Math.min(b+y.nodeSize,m);y.marks.find(M=>M.type===d)?y.marks.forEach(M=>{d===M.type&&n.addMark(S,w,d.create({...M.attrs,...e}))}):n.addMark(S,w,d.create(e))})});return BP(r,n,d)},PP=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),UP=(t,e={})=>({state:n,dispatch:r,chain:i})=>{const o=Kt(t,n.schema);let l;return n.selection.$anchor.sameParent(n.selection.$head)&&(l=n.selection.$anchor.parent.attrs),o.isTextblock?i().command(({commands:c})=>v_(o,{...l,...e})(n)?!0:c.clearNodes()).command(({state:c})=>v_(o,{...l,...e})(c,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},qP=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,i=zs(t,0,r.content.size),o=Ae.create(r,i);e.setSelection(o)}return!0},$P=(t,e)=>({tr:n,state:r,dispatch:i})=>{const{selection:o}=r;let l,c;return typeof e=="number"?(l=e,c=e):e&&"from"in e&&"to"in e?(l=e.from,c=e.to):(l=o.from,c=o.to),i&&n.doc.nodesBetween(l,c,(d,f)=>{d.isText||n.setNodeMarkup(f,void 0,{...d.attrs,dir:t})}),!0},FP=t=>({tr:e,dispatch:n})=>{if(n){const{doc:r}=e,{from:i,to:o}=typeof t=="number"?{from:t,to:t}:t,l=Pe.atStart(r).from,c=Pe.atEnd(r).to,d=zs(i,l,c),f=zs(o,l,c),p=Pe.create(r,d,f);e.setSelection(p)}return!0},HP=t=>({state:e,dispatch:n})=>{const r=Kt(t,e.schema);return zB(r)(e,n)};function oT(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(i=>e?.includes(i.type.name));t.tr.ensureMarks(r)}}var VP=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:i})=>{const{selection:o,doc:l}=e,{$from:c,$to:d}=o,f=i.extensionManager.attributes,p=Md(f,c.node().type.name,c.node().attrs);if(o instanceof Ae&&o.node.isBlock)return!c.parentOffset||!ci(l,c.pos)?!1:(r&&(t&&oT(n,i.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),!0);if(!c.parent.isBlock)return!1;const m=d.parentOffset===d.parent.content.size,y=c.depth===0?void 0:vP(c.node(-1).contentMatchAt(c.indexAfter(-1)));let b=m&&y?[{type:y,attrs:p}]:void 0,S=ci(e.doc,e.mapping.map(c.pos),1,b);if(!b&&!S&&ci(e.doc,e.mapping.map(c.pos),1,y?[{type:y}]:void 0)&&(S=!0,b=y?[{type:y,attrs:p}]:void 0),r){if(S&&(o instanceof Pe&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,b),y&&!m&&!c.parentOffset&&c.parent.type!==y)){const w=e.mapping.map(c.before()),T=e.doc.resolve(w);c.node(-1).canReplaceWith(T.index(),T.index()+1,y)&&e.setNodeMarkup(e.mapping.map(c.before()),y)}t&&oT(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return S},KP=(t,e={})=>({tr:n,state:r,dispatch:i,editor:o})=>{var l;const c=Kt(t,r.schema),{$from:d,$to:f}=r.selection,p=r.selection.node;if(p&&p.isBlock||d.depth<2||!d.sameParent(f))return!1;const m=d.node(-1);if(m.type!==c)return!1;const y=o.extensionManager.attributes;if(d.parent.content.size===0&&d.node(-1).childCount===d.indexAfter(-1)){if(d.depth===2||d.node(-3).type!==c||d.index(-2)!==d.node(-2).childCount-1)return!1;if(i){let M=oe.empty;const k=d.index(-1)?1:d.index(-2)?2:3;for(let U=d.depth-k;U>=d.depth-3;U-=1)M=oe.from(d.node(U).copy(M));const j=d.indexAfter(-1)<d.node(-2).childCount?1:d.indexAfter(-2)<d.node(-3).childCount?2:3,I={...Md(y,d.node().type.name,d.node().attrs),...e},O=((l=c.contentMatch.defaultType)==null?void 0:l.createAndFill(I))||void 0;M=M.append(oe.from(c.createAndFill(null,O)||void 0));const P=d.before(d.depth-(k-1));n.replace(P,d.after(-j),new ge(M,4-k,0));let A=-1;n.doc.nodesBetween(P,n.doc.content.size,(U,H)=>{if(A>-1)return!1;U.isTextblock&&U.content.size===0&&(A=H+1)}),A>-1&&n.setSelection(Pe.near(n.doc.resolve(A))),n.scrollIntoView()}return!0}const b=f.pos===d.end()?m.contentMatchAt(0).defaultType:null,S={...Md(y,m.type.name,m.attrs),...e},w={...Md(y,d.node().type.name,d.node().attrs),...e};n.delete(d.pos,f.pos);const T=b?[{type:c,attrs:S},{type:b,attrs:w}]:[{type:c,attrs:S}];if(!ci(n.doc,d.pos,2))return!1;if(i){const{selection:M,storedMarks:k}=r,{splittableMarks:j}=o.extensionManager,I=k||M.$to.parentOffset&&M.$from.marks();if(n.split(d.pos,2,T).scrollIntoView(),!I||!i)return!0;const O=I.filter(P=>j.includes(P.type.name));n.ensureMarks(O)}return!0},Gm=(t,e)=>{const n=Kf(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&ls(t.doc,n.pos)&&t.join(n.pos),!0},Ym=(t,e)=>{const n=Kf(l=>l.type===e)(t.selection);if(!n)return!0;const r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;const i=t.doc.nodeAt(r);return n.node.type===i?.type&&ls(t.doc,r)&&t.join(r),!0},GP=(t,e,n,r={})=>({editor:i,tr:o,state:l,dispatch:c,chain:d,commands:f,can:p})=>{const{extensions:m,splittableMarks:y}=i.extensionManager,b=Kt(t,l.schema),S=Kt(e,l.schema),{selection:w,storedMarks:T}=l,{$from:M,$to:k}=w,j=M.blockRange(k),I=T||w.$to.parentOffset&&w.$from.marks();if(!j)return!1;const O=Kf(P=>sT(P.type.name,m))(w);if(j.depth>=1&&O&&j.depth-O.depth<=1){if(O.node.type===b)return f.liftListItem(S);if(sT(O.node.type.name,m)&&b.validContent(O.node.content)&&c)return d().command(()=>(o.setNodeMarkup(O.pos,b),!0)).command(()=>Gm(o,b)).command(()=>Ym(o,b)).run()}return!n||!I||!c?d().command(()=>p().wrapInList(b,r)?!0:f.clearNodes()).wrapInList(b,r).command(()=>Gm(o,b)).command(()=>Ym(o,b)).run():d().command(()=>{const P=p().wrapInList(b,r),A=I.filter(U=>y.includes(U.type.name));return o.ensureMarks(A),P?!0:f.clearNodes()}).wrapInList(b,r).command(()=>Gm(o,b)).command(()=>Ym(o,b)).run()},YP=(t,e={},n={})=>({state:r,commands:i})=>{const{extendEmptyMarkRange:o=!1}=n,l=pi(t,r.schema);return og(r,l,e)?i.unsetMark(l,{extendEmptyMarkRange:o}):i.setMark(l,e)},QP=(t,e,n={})=>({state:r,commands:i})=>{const o=Kt(t,r.schema),l=Kt(e,r.schema),c=as(r,o,n);let d;return r.selection.$anchor.sameParent(r.selection.$head)&&(d=r.selection.$anchor.parent.attrs),c?i.setNode(l,d):i.setNode(o,{...d,...n})},XP=(t,e={})=>({state:n,commands:r})=>{const i=Kt(t,n.schema);return as(n,i,e)?r.lift(i):r.wrapIn(i,e)},JP=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const i=n[r];let o;if(i.spec.isInputRules&&(o=i.getState(t))){if(e){const l=t.tr,c=o.transform;for(let d=c.steps.length-1;d>=0;d-=1)l.step(c.steps[d].invert(c.docs[d]));if(o.text){const d=l.doc.resolve(o.from).marks();l.replaceWith(o.from,o.to,t.schema.text(o.text,d))}else l.delete(o.from,o.to)}return!0}}return!1},WP=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:i}=n;return r||e&&i.forEach(o=>{t.removeMark(o.$from.pos,o.$to.pos)}),!0},ZP=(t,e={})=>({tr:n,state:r,dispatch:i})=>{var o;const{extendEmptyMarkRange:l=!1}=e,{selection:c}=n,d=pi(t,r.schema),{$from:f,empty:p,ranges:m}=c;if(!i)return!0;if(p&&l){let{from:y,to:b}=c;const S=(o=f.marks().find(T=>T.type===d))==null?void 0:o.attrs,w=Zg(f,d,S);w&&(y=w.from,b=w.to),n.removeMark(y,b,d)}else m.forEach(y=>{n.removeMark(y.$from.pos,y.$to.pos,d)});return n.removeStoredMark(d),!0},eU=t=>({tr:e,state:n,dispatch:r})=>{const{selection:i}=n;let o,l;return typeof t=="number"?(o=t,l=t):t&&"from"in t&&"to"in t?(o=t.from,l=t.to):(o=i.from,l=i.to),r&&e.doc.nodesBetween(o,l,(c,d)=>{if(c.isText)return;const f={...c.attrs};delete f.dir,e.setNodeMarkup(d,void 0,f)}),!0},tU=(t,e={})=>({tr:n,state:r,dispatch:i})=>{let o=null,l=null;const c=Vf(typeof t=="string"?t:t.name,r.schema);if(!c)return!1;c==="node"&&(o=Kt(t,r.schema)),c==="mark"&&(l=pi(t,r.schema));let d=!1;return n.selection.ranges.forEach(f=>{const p=f.$from.pos,m=f.$to.pos;let y,b,S,w;n.selection.empty?r.doc.nodesBetween(p,m,(T,M)=>{o&&o===T.type&&(d=!0,S=Math.max(M,p),w=Math.min(M+T.nodeSize,m),y=M,b=T)}):r.doc.nodesBetween(p,m,(T,M)=>{M<p&&o&&o===T.type&&(d=!0,S=Math.max(M,p),w=Math.min(M+T.nodeSize,m),y=M,b=T),M>=p&&M<=m&&(o&&o===T.type&&(d=!0,i&&n.setNodeMarkup(M,void 0,{...T.attrs,...e})),l&&T.marks.length&&T.marks.forEach(k=>{if(l===k.type&&(d=!0,i)){const j=Math.max(M,p),I=Math.min(M+T.nodeSize,m);n.addMark(j,I,l.create({...k.attrs,...e}))}}))}),b&&(y!==void 0&&i&&n.setNodeMarkup(y,void 0,{...b.attrs,...e}),l&&b.marks.length&&b.marks.forEach(T=>{l===T.type&&i&&n.addMark(S,w,l.create({...T.attrs,...e}))}))}),d},nU=(t,e={})=>({state:n,dispatch:r})=>{const i=Kt(t,n.schema);return NB(i,e)(n,r)},rU=(t,e={})=>({state:n,dispatch:r})=>{const i=Kt(t,n.schema);return RB(i,e)(n,r)},iU=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach(r=>r.apply(this,e)),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter(r=>r!==e):delete this.callbacks[t]),this}once(t,e){const n=(...r)=>{this.off(t,n),e.apply(this,r)};return this.on(t,n)}removeAllListeners(){this.callbacks={}}},Yf=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=(e=t.undoable)!=null?e:!0}},sU=(t,e)=>{if(Wg(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function ld(t){var e;const{editor:n,from:r,to:i,text:o,rules:l,plugin:c}=t,{view:d}=n;if(d.composing)return!1;const f=d.state.doc.resolve(r);if(f.parent.type.spec.code||(e=f.nodeBefore||f.nodeAfter)!=null&&e.marks.find(y=>y.type.spec.code))return!1;let p=!1;const m=NP(f)+o;return l.forEach(y=>{if(p)return;const b=sU(m,y.find);if(!b)return;const S=d.state.tr,w=Ff({state:d.state,transaction:S}),T={from:r-(b[0].length-o.length),to:i},{commands:M,chain:k,can:j}=new Hf({editor:n,state:w});y.handler({state:w,range:T,match:b,commands:M,chain:k,can:j})===null||!S.steps.length||(y.undoable&&S.setMeta(c,{transform:S,from:r,to:i,text:o}),d.dispatch(S),p=!0)}),p}function oU(t){const{editor:e,rules:n}=t,r=new Ot({state:{init(){return null},apply(i,o,l){const c=i.getMeta(r);if(c)return c;const d=i.getMeta("applyInputRules");return d&&setTimeout(()=>{let{text:p}=d;typeof p=="string"?p=p:p=t0(oe.from(p),l.schema);const{from:m}=d,y=m+p.length;ld({editor:e,from:m,to:y,text:p,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,l,c){return ld({editor:e,from:o,to:l,text:c,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{const{$cursor:o}=i.state.selection;o&&ld({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;const{$cursor:l}=i.state.selection;return l?ld({editor:e,from:l.pos,to:l.pos,text:`
28
+ `,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function aU(t){return Object.prototype.toString.call(t).slice(8,-1)}function ud(t){return aU(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function yC(t,e){const n={...t};return ud(t)&&ud(e)&&Object.keys(e).forEach(r=>{ud(e[r])&&ud(t[r])?n[r]=yC(t[r],e[r]):n[r]=e[r]}),n}var r0=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...gt(ke(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...gt(ke(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>yC(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},no=class gC extends r0{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n=typeof e=="function"?e():e;return new gC(n)}static handleExit({editor:e,mark:n}){const{tr:r}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const l=i.marks();if(!!!l.find(f=>f?.type.name===n.name))return!1;const d=l.find(f=>f?.type.name===n.name);return d&&r.removeStoredMark(d),r.insertText(" ",i.pos),e.view.dispatch(r),!0}return!1}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}};function lU(t){return typeof t=="number"}var uU=class{constructor(t){this.find=t.find,this.handler=t.handler}},cU=(t,e,n)=>{if(Wg(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(i=>{const o=[i.text];return o.index=i.index,o.input=t,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function dU(t){const{editor:e,state:n,from:r,to:i,rule:o,pasteEvent:l,dropEvent:c}=t,{commands:d,chain:f,can:p}=new Hf({editor:e,state:n}),m=[];return n.doc.nodesBetween(r,i,(b,S)=>{var w,T,M,k,j;if((T=(w=b.type)==null?void 0:w.spec)!=null&&T.code||!(b.isText||b.isTextblock||b.isInline))return;const I=(j=(k=(M=b.content)==null?void 0:M.size)!=null?k:b.nodeSize)!=null?j:0,O=Math.max(r,S),P=Math.min(i,S+I);if(O>=P)return;const A=b.isText?b.text||"":b.textBetween(O-S,P-S,void 0,"");cU(A,o.find,l).forEach(H=>{if(H.index===void 0)return;const se=O+H.index+1,re=se+H[0].length,te={from:n.tr.mapping.map(se),to:n.tr.mapping.map(re)},Z=o.handler({state:n,range:te,match:H,commands:d,chain:f,can:p,pasteEvent:l,dropEvent:c});m.push(Z)})}),m.every(b=>b!==null)}var cd=null,fU=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=n.clipboardData)==null||e.setData("text/html",t),n};function hU(t){const{editor:e,rules:n}=t;let r=null,i=!1,o=!1,l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,c;try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}const d=({state:p,from:m,to:y,rule:b,pasteEvt:S})=>{const w=p.tr,T=Ff({state:p,transaction:w});if(!(!dU({editor:e,state:T,from:Math.max(m-1,0),to:y.b-1,rule:b,pasteEvent:S,dropEvent:c})||!w.steps.length)){try{c=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{c=null}return l=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,w}};return n.map(p=>new Ot({view(m){const y=S=>{var w;r=(w=m.dom.parentElement)!=null&&w.contains(S.target)?m.dom.parentElement:null,r&&(cd=e)},b=()=>{cd&&(cd=null)};return window.addEventListener("dragstart",y),window.addEventListener("dragend",b),{destroy(){window.removeEventListener("dragstart",y),window.removeEventListener("dragend",b)}}},props:{handleDOMEvents:{drop:(m,y)=>{if(o=r===m.dom.parentElement,c=y,!o){const b=cd;b?.isEditable&&setTimeout(()=>{const S=b.state.selection;S&&b.commands.deleteRange({from:S.from,to:S.to})},10)}return!1},paste:(m,y)=>{var b;const S=(b=y.clipboardData)==null?void 0:b.getData("text/html");return l=y,i=!!S?.includes("data-pm-slice"),!1}}},appendTransaction:(m,y,b)=>{const S=m[0],w=S.getMeta("uiEvent")==="paste"&&!i,T=S.getMeta("uiEvent")==="drop"&&!o,M=S.getMeta("applyPasteRules"),k=!!M;if(!w&&!T&&!k)return;if(k){let{text:O}=M;typeof O=="string"?O=O:O=t0(oe.from(O),b.schema);const{from:P}=M,A=P+O.length,U=fU(O);return d({rule:p,state:b,from:P,to:{b:A},pasteEvt:U})}const j=y.doc.content.findDiffStart(b.doc.content),I=y.doc.content.findDiffEnd(b.doc.content);if(!(!lU(j)||!I||j===I.b))return d({rule:p,state:b,from:j,to:I,pasteEvt:l})}}))}var Qf=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=lC(t),this.schema=EP(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_l(e.name,this.schema)},r=ke(e,"addCommands",n);return r?{...t,...r()}:t},{})}get plugins(){const{editor:t}=this;return zl([...this.extensions].reverse()).flatMap(r=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:t,type:_l(r.name,this.schema)},o=[],l=ke(r,"addKeyboardShortcuts",i);let c={};if(r.type==="mark"&&ke(r,"exitable",i)&&(c.ArrowRight=()=>no.handleExit({editor:t,mark:r})),l){const y=Object.fromEntries(Object.entries(l()).map(([b,S])=>[b,()=>S({editor:t})]));c={...c,...y}}const d=Cz(c);o.push(d);const f=ke(r,"addInputRules",i);if(iT(r,t.options.enableInputRules)&&f){const y=f();if(y&&y.length){const b=oU({editor:t,rules:y}),S=Array.isArray(b)?b:[b];o.push(...S)}}const p=ke(r,"addPasteRules",i);if(iT(r,t.options.enablePasteRules)&&p){const y=p();if(y&&y.length){const b=hU({editor:t,rules:y});o.push(...b)}}const m=ke(r,"addProseMirrorPlugins",i);if(m){const y=m();o.push(...y)}return o})}get attributes(){return aC(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Sa(this.extensions);return Object.fromEntries(e.filter(n=>!!ke(n,"addNodeView")).map(n=>{const r=this.attributes.filter(d=>d.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:Kt(n.name,this.schema)},o=ke(n,"addNodeView",i);if(!o)return[];const l=o();if(!l)return[];const c=(d,f,p,m,y)=>{const b=wa(d,r);return l({node:d,view:f,getPos:p,decorations:m,innerDecorations:y,editor:t,extension:n,HTMLAttributes:b})};return[n.name,c]}))}dispatchTransaction(t){const{editor:e}=this;return zl([...this.extensions].reverse()).reduceRight((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:_l(i.name,this.schema)},l=ke(i,"dispatchTransaction",o);return l?c=>{l.call(o,{transaction:c,next:r})}:r},t)}transformPastedHTML(t){const{editor:e}=this;return zl([...this.extensions]).reduce((r,i)=>{const o={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:e,type:_l(i.name,this.schema)},l=ke(i,"transformPastedHTML",o);return l?(c,d)=>{const f=r(c,d);return l.call(o,f)}:r},t||(r=>r))}get markViews(){const{editor:t}=this,{markExtensions:e}=Sa(this.extensions);return Object.fromEntries(e.filter(n=>!!ke(n,"addMarkView")).map(n=>{const r=this.attributes.filter(c=>c.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:pi(n.name,this.schema)},o=ke(n,"addMarkView",i);if(!o)return[];const l=(c,d,f)=>{const p=wa(c,r);return o()({mark:c,view:d,inline:f,editor:t,extension:n,HTMLAttributes:p,updateAttributes:m=>{CU(c,t,m)}})};return[n.name,l]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(e=>[e.name,e.storage])),t.forEach(e=>{var n;const r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_l(e.name,this.schema)};e.type==="mark"&&((n=gt(ke(e,"keepOnSplit",r)))==null||n)&&this.splittableMarks.push(e.name);const i=ke(e,"onBeforeCreate",r),o=ke(e,"onCreate",r),l=ke(e,"onUpdate",r),c=ke(e,"onSelectionUpdate",r),d=ke(e,"onTransaction",r),f=ke(e,"onFocus",r),p=ke(e,"onBlur",r),m=ke(e,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),l&&this.editor.on("update",l),c&&this.editor.on("selectionUpdate",c),d&&this.editor.on("transaction",d),f&&this.editor.on("focus",f),p&&this.editor.on("blur",p),m&&this.editor.on("destroy",m)})}};Qf.resolve=lC;Qf.sort=zl;Qf.flatten=e0;var pU={};Jg(pU,{ClipboardTextSerializer:()=>vC,Commands:()=>SC,Delete:()=>wC,Drop:()=>_C,Editable:()=>TC,FocusEvents:()=>MC,Keymap:()=>xC,Paste:()=>CC,Tabindex:()=>kC,TextDirection:()=>AC,focusEventsPluginKey:()=>EC});var jt=class bC extends r0{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n=typeof e=="function"?e():e;return new bC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},vC=jt.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ot({key:new Pt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:i}=e,{ranges:o}=i,l=Math.min(...o.map(p=>p.$from.pos)),c=Math.max(...o.map(p=>p.$to.pos)),d=cC(n);return uC(r,{from:l,to:c},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:d})}}})]}}),SC=jt.create({name:"commands",addCommands(){return{...Wx}}}),wC=jt.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,r,i;const o=()=>{var l,c,d,f;if((f=(d=(c=(l=this.editor.options.coreExtensionOptions)==null?void 0:l.delete)==null?void 0:c.filterTransaction)==null?void 0:d.call(c,t))!=null?f:t.getMeta("y-sync$"))return;const p=sC(t.before,[t,...e]);fC(p).forEach(b=>{p.mapping.mapResult(b.oldRange.from).deletedAfter&&p.mapping.mapResult(b.oldRange.to).deletedBefore&&p.before.nodesBetween(b.oldRange.from,b.oldRange.to,(S,w)=>{const T=w+S.nodeSize-2,M=b.oldRange.from<=w&&T<=b.oldRange.to;this.editor.emit("delete",{type:"node",node:S,from:w,to:T,newFrom:p.mapping.map(w),newTo:p.mapping.map(T),deletedRange:b.oldRange,newRange:b.newRange,partial:!M,editor:this.editor,transaction:t,combinedTransform:p})})});const y=p.mapping;p.steps.forEach((b,S)=>{var w,T;if(b instanceof Sr){const M=y.slice(S).map(b.from,-1),k=y.slice(S).map(b.to),j=y.invert().map(M,-1),I=y.invert().map(k),O=(w=p.doc.nodeAt(M-1))==null?void 0:w.marks.some(A=>A.eq(b.mark)),P=(T=p.doc.nodeAt(k))==null?void 0:T.marks.some(A=>A.eq(b.mark));this.editor.emit("delete",{type:"mark",mark:b.mark,from:b.from,to:b.to,deletedRange:{from:j,to:I},newRange:{from:M,to:k},partial:!!(P||O),editor:this.editor,transaction:t,combinedTransform:p})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(o,0):o()}}),_C=jt.create({name:"drop",addProseMirrorPlugins(){return[new Ot({key:new Pt("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),TC=jt.create({name:"editable",addProseMirrorPlugins(){return[new Ot({key:new Pt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),EC=new Pt("focusEvents"),MC=jt.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new Ot({key:EC,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),xC=jt.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:l})=>[()=>l.undoInputRule(),()=>l.command(({tr:c})=>{const{selection:d,doc:f}=c,{empty:p,$anchor:m}=d,{pos:y,parent:b}=m,S=m.parent.isTextblock&&y>0?c.doc.resolve(y-1):m,w=S.parent.type.spec.isolating,T=m.pos-m.parentOffset,M=w&&S.parent.childCount===1?T===m.pos:He.atStart(f).from===y;return!p||!b.type.isTextblock||b.textContent.length||!M||M&&m.parent.type.name==="paragraph"?!1:l.clearNodes()}),()=>l.deleteSelection(),()=>l.joinBackward(),()=>l.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:l})=>[()=>l.deleteSelection(),()=>l.deleteCurrentNode(),()=>l.joinForward(),()=>l.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:l})=>[()=>l.newlineInCode(),()=>l.createParagraphNear(),()=>l.liftEmptyBlock(),()=>l.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return mu()||rC()?o:i},addProseMirrorPlugins(){return[new Ot({key:new Pt("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(w=>w.getMeta("composition")))return;const r=t.some(w=>w.docChanged)&&!e.doc.eq(n.doc),i=t.some(w=>w.getMeta("preventClearDocument"));if(!r||i)return;const{empty:o,from:l,to:c}=e.selection,d=He.atStart(e.doc).from,f=He.atEnd(e.doc).to;if(o||!(l===d&&c===f)||!Gf(n.doc))return;const y=n.tr,b=Ff({state:n,transaction:y}),{commands:S}=new Hf({editor:this.editor,state:b});if(S.clearNodes(),!!y.steps.length)return y}})]}}),CC=jt.create({name:"paste",addProseMirrorPlugins(){return[new Ot({key:new Pt("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),kC=jt.create({name:"tabindex",addProseMirrorPlugins(){return[new Ot({key:new Pt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),AC=jt.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Sa(this.extensions);return[{types:t.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const n=e.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ot({key:new Pt("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}}),mU=class Nl{constructor(e,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=e,this.editor=n,this.currentNode=i}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}n=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:n,to:r},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(e);return new Nl(n,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Nl(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Nl(e,this.editor)}get children(){const e=[];return this.node.content.forEach((n,r)=>{const i=n.isBlock&&!n.isTextblock,o=n.isAtom&&!n.isText,l=n.isInline,c=this.pos+r+(o?0:1);if(c<0||c>this.resolvedPos.doc.nodeSize-2)return;const d=this.resolvedPos.doc.resolve(c);if(!i&&!l&&d.depth<=this.depth)return;const f=new Nl(d,this.editor,i,i||l?n:null);i&&(f.actualDepth=this.depth+1),e.push(f)}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===e)if(Object.keys(n).length>0){const o=i.node.attrs,l=Object.keys(n);for(let c=0;c<l.length;c+=1){const d=l[c];if(o[d]!==n[d])break}}else r=i;i=i.parent}return r}querySelector(e,n={}){return this.querySelectorAll(e,n,!0)[0]||null}querySelectorAll(e,n={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;const o=Object.keys(n);return this.children.forEach(l=>{r&&i.length>0||(l.node.type.name===e&&o.every(d=>n[d]===l.node.attrs[d])&&i.push(l),!(r&&i.length>0)&&(i=i.concat(l.querySelectorAll(e,n,r))))}),i}setAttribute(e){const{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(n)}},yU=`.ProseMirror {
29
+ position: relative;
30
+ }
31
+
32
+ .ProseMirror {
33
+ word-wrap: break-word;
34
+ white-space: pre-wrap;
35
+ white-space: break-spaces;
36
+ -webkit-font-variant-ligatures: none;
37
+ font-variant-ligatures: none;
38
+ font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
39
+ }
40
+
41
+ .ProseMirror [contenteditable="false"] {
42
+ white-space: normal;
43
+ }
44
+
45
+ .ProseMirror [contenteditable="false"] [contenteditable="true"] {
46
+ white-space: pre-wrap;
47
+ }
48
+
49
+ .ProseMirror pre {
50
+ white-space: pre-wrap;
51
+ }
52
+
53
+ img.ProseMirror-separator {
54
+ display: inline !important;
55
+ border: none !important;
56
+ margin: 0 !important;
57
+ width: 0 !important;
58
+ height: 0 !important;
59
+ }
60
+
61
+ .ProseMirror-gapcursor {
62
+ display: none;
63
+ pointer-events: none;
64
+ position: absolute;
65
+ margin: 0;
66
+ }
67
+
68
+ .ProseMirror-gapcursor:after {
69
+ content: "";
70
+ display: block;
71
+ position: absolute;
72
+ top: -2px;
73
+ width: 20px;
74
+ border-top: 1px solid black;
75
+ animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
76
+ }
77
+
78
+ @keyframes ProseMirror-cursor-blink {
79
+ to {
80
+ visibility: hidden;
81
+ }
82
+ }
83
+
84
+ .ProseMirror-hideselection *::selection {
85
+ background: transparent;
86
+ }
87
+
88
+ .ProseMirror-hideselection *::-moz-selection {
89
+ background: transparent;
90
+ }
91
+
92
+ .ProseMirror-hideselection * {
93
+ caret-color: transparent;
94
+ }
95
+
96
+ .ProseMirror-focused .ProseMirror-gapcursor {
97
+ display: block;
98
+ }`;function gU(t,e,n){const r=document.querySelector("style[data-tiptap-style]");if(r!==null)return r;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style",""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}var bU=class extends iU{constructor(t={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:typeof document<"u"?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:LP,createMappablePosition:jP},this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:r,slice:i,moved:o})=>this.options.onDrop(r,i,o)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const e=this.createDoc(),n=tC(e,this.options.autofocus);this.editorState=Wo.create({doc:e,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(t){if(typeof document>"u")throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(t),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const t=this.editorView.dom;t?.editor&&delete t.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove=="function"?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(t){console.warn("Failed to remove CSS element:",t)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=gU(yU,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:t=>{this.editorState=t},dispatch:t=>{this.dispatchTransaction(t)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(t,e)=>{if(this.editorView)return this.editorView[e];if(e==="state")return this.editorState;if(e in t)return Reflect.get(t,e);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${e}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(t,e){const n=oC(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(t){if(this.isDestroyed)return;const e=this.state.plugins;let n=e;if([].concat(t).forEach(i=>{const o=typeof i=="string"?`${i}$`:i.key;n=n.filter(l=>!l.key.startsWith(o))}),e.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var t,e;const r=[...this.options.enableCoreExtensions?[TC,vC.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)==null?void 0:t.clipboardTextSerializer)==null?void 0:e.blockSeparator}),SC,MC,xC,kC,_C,CC,wC,AC.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i?.type));this.extensionManager=new Qf(r,this)}createCommandManager(){this.commandManager=new Hf({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let t;try{t=sg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{"collaboration"in this.storage&&typeof this.storage.collaboration=="object"&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(n=>n.name!=="collaboration"),this.createExtensionManager()}}),t=sg(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return t}createView(t){const{editorProps:e,enableExtensionDispatchTransaction:n}=this.options,r=e.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,o=e.transformPastedHTML,l=this.extensionManager.transformPastedHTML(o);this.editorView=new Xx(t,{...e,attributes:{role:"textbox",...e?.attributes},dispatchTransaction:i,transformPastedHTML:l,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const c=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(c),this.prependClass(),this.injectCSS();const d=this.view.dom;d.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(f=>{var p;return(p=this.capturedTransaction)==null?void 0:p.step(f)});return}const{state:e,transactions:n}=this.state.applyTransaction(t),r=!this.state.selection.eq(e.selection),i=n.includes(t),o=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),!i)return;this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});const l=n.findLast(f=>f.getMeta("focus")||f.getMeta("blur")),c=l?.getMeta("focus"),d=l?.getMeta("blur");c&&this.emit("focus",{editor:this,event:c.event,transaction:l}),d&&this.emit("blur",{editor:this,event:d.event,transaction:l}),!(t.getMeta("preventUpdate")||!n.some(f=>f.docChanged)||o.doc.eq(e.doc))&&this.emit("update",{editor:this,transaction:t,appendedTransactions:n.slice(1)})}getAttributes(t){return dC(this.state,t)}isActive(t,e){const n=typeof t=="string"?t:null,r=typeof t=="string"?e:t;return RP(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return t0(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e=`
99
+
100
+ `,textSerializers:n={}}=t||{};return xP(this.state.doc,{blockSeparator:e,textSerializers:{...cC(this.schema),...n}})}get isEmpty(){return Gf(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var t,e;return(e=(t=this.editorView)==null?void 0:t.isDestroyed)!=null?e:!0}$node(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new mU(e,this)}get $doc(){return this.$pos(0)}};function _a(t){return new Yf({find:t.find,handler:({state:e,range:n,match:r})=>{const i=gt(t.getAttributes,void 0,r);if(i===!1||i===null)return null;const{tr:o}=e,l=r[r.length-1],c=r[0];if(l){const d=c.search(/\S/),f=n.from+c.indexOf(l),p=f+l.length;if(n0(n.from,n.to,e.doc).filter(b=>b.mark.type.excluded.find(w=>w===t.type&&w!==b.mark.type)).filter(b=>b.to>f).length)return null;p<n.to&&o.delete(p,n.to),f>n.from&&o.delete(n.from+d,f);const y=n.from+d+l.length;o.addMark(n.from+d,y,t.type.create(i||{})),o.removeStoredMark(t.type)}},undoable:t.undoable})}function vU(t){return new Yf({find:t.find,handler:({state:e,range:n,match:r})=>{const i=gt(t.getAttributes,void 0,r)||{},{tr:o}=e,l=n.from;let c=n.to;const d=t.type.create(i);if(r[1]){const f=r[0].lastIndexOf(r[1]);let p=l+f;p>c?p=c:c=p+r[1].length;const m=r[0][r[0].length-1];o.insertText(m,l+r[0].length-1),o.replaceWith(p,c,d)}else if(r[0]){const f=t.type.isInline?l:l-1;o.insert(f,t.type.create(i)).delete(o.mapping.map(l),o.mapping.map(c))}o.scrollIntoView()},undoable:t.undoable})}function ag(t){return new Yf({find:t.find,handler:({state:e,range:n,match:r})=>{const i=e.doc.resolve(n.from),o=gt(t.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,o)},undoable:t.undoable})}function Ta(t){return new Yf({find:t.find,handler:({state:e,range:n,match:r,chain:i})=>{const o=gt(t.getAttributes,void 0,r)||{},l=e.tr.delete(n.from,n.to),d=l.doc.resolve(n.from).blockRange(),f=d&&Lg(d,t.type,o);if(!f)return null;if(l.wrap(d,f),t.keepMarks&&t.editor){const{selection:m,storedMarks:y}=e,{splittableMarks:b}=t.editor.extensionManager,S=y||m.$to.parentOffset&&m.$from.marks();if(S){const w=S.filter(T=>b.includes(T.type.name));l.ensureMarks(w)}}if(t.keepAttributes){const m=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(m,o).run()}const p=l.doc.resolve(n.from-1).nodeBefore;p&&p.type===t.type&&ls(l.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,p))&&l.join(n.from-1)},undoable:t.undoable})}function SU(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof Ae){const o=r.index();return r.parent.canReplaceWith(o,o+1,e)}let i=r.depth;for(;i>=0;){const o=r.index(i);if(r.node(i).contentMatchAt(o).matchType(e))return!0;i-=1}return!1}function wU(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var _U={};Jg(_U,{createAtomBlockMarkdownSpec:()=>TU,createBlockMarkdownSpec:()=>EU,createInlineMarkdownSpec:()=>OC,parseAttributes:()=>i0,parseIndentedBlocks:()=>lg,renderNestedMarkdownContent:()=>o0,serializeAttributes:()=>s0});function i0(t){if(!t?.trim())return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,f=>(n.push(f),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const f=i.map(p=>p.trim().slice(1));e.class=f.join(" ")}const o=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);o&&(e.id=o[1]);const l=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(l)).forEach(([,f,p])=>{var m;const y=parseInt(((m=p.match(/__QUOTED_(\d+)__/))==null?void 0:m[1])||"0",10),b=n[y];b&&(e[f]=b.slice(1,-1))});const d=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return d&&d.split(/\s+/).filter(Boolean).forEach(p=>{p.match(/^[a-zA-Z][\w-]*$/)&&(e[p]=!0)}),e}function s0(t){if(!t||Object.keys(t).length===0)return"";const e=[];return t.class&&String(t.class).split(/\s+/).filter(Boolean).forEach(r=>e.push(`.${r}`)),t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?e.push(n):r!==!1&&r!=null&&e.push(`${n}="${String(r)}"`))}),e.join(" ")}function TU(t){const{nodeName:e,name:n,parseAttributes:r=i0,serializeAttributes:i=s0,defaultAttributes:o={},requiredAttributes:l=[],allowedAttributes:c}=t,d=n||e,f=p=>{if(!c)return p;const m={};return c.forEach(y=>{y in p&&(m[y]=p[y])}),m};return{parseMarkdown:(p,m)=>{const y={...o,...p.attributes};return m.createNode(e,y,[])},markdownTokenizer:{name:e,level:"block",start(p){var m;const y=new RegExp(`^:::${d}(?:\\s|$)`,"m"),b=(m=p.match(y))==null?void 0:m.index;return b!==void 0?b:-1},tokenize(p,m,y){const b=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),S=p.match(b);if(!S)return;const w=S[1]||"",T=r(w);if(!l.find(k=>!(k in T)))return{type:e,raw:S[0],attributes:T}}},renderMarkdown:p=>{const m=f(p.attrs||{}),y=i(m),b=y?` {${y}}`:"";return`:::${d}${b} :::`}}}function EU(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=i0,serializeAttributes:o=s0,defaultAttributes:l={},content:c="block",allowedAttributes:d}=t,f=n||e,p=m=>{if(!d)return m;const y={};return d.forEach(b=>{b in m&&(y[b]=m[b])}),y};return{parseMarkdown:(m,y)=>{let b;if(r){const w=r(m);b=typeof w=="string"?[{type:"text",text:w}]:w}else c==="block"?b=y.parseChildren(m.tokens||[]):b=y.parseInline(m.tokens||[]);const S={...l,...m.attributes};return y.createNode(e,S,b)},markdownTokenizer:{name:e,level:"block",start(m){var y;const b=new RegExp(`^:::${f}`,"m"),S=(y=m.match(b))==null?void 0:y.index;return S!==void 0?S:-1},tokenize(m,y,b){var S;const w=new RegExp(`^:::${f}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),T=m.match(w);if(!T)return;const[M,k=""]=T,j=i(k);let I=1;const O=M.length;let P="";const A=/^:::([\w-]*)(\s.*)?/gm,U=m.slice(O);for(A.lastIndex=0;;){const H=A.exec(U);if(H===null)break;const se=H.index,re=H[1];if(!((S=H[2])!=null&&S.endsWith(":::"))){if(re)I+=1;else if(I-=1,I===0){const te=U.slice(0,se);P=te.trim();const Z=m.slice(0,O+se+H[0].length);let G=[];if(P)if(c==="block")for(G=b.blockTokens(te),G.forEach(fe=>{fe.text&&(!fe.tokens||fe.tokens.length===0)&&(fe.tokens=b.inlineTokens(fe.text))});G.length>0;){const fe=G[G.length-1];if(fe.type==="paragraph"&&(!fe.text||fe.text.trim()===""))G.pop();else break}else G=b.inlineTokens(P);return{type:e,raw:Z,attributes:j,content:P,tokens:G}}}}}},renderMarkdown:(m,y)=>{const b=p(m.attrs||{}),S=o(b),w=S?` {${S}}`:"",T=y.renderChildren(m.content||[],`
101
+
102
+ `);return`:::${f}${w}
103
+
104
+ ${T}
105
+
106
+ :::`}}}function MU(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,o,l]=r;e[i]=o||l,r=n.exec(t)}return e}function xU(t){return Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e}="${n}"`).join(" ")}function OC(t){const{nodeName:e,name:n,getContent:r,parseAttributes:i=MU,serializeAttributes:o=xU,defaultAttributes:l={},selfClosing:c=!1,allowedAttributes:d}=t,f=n||e,p=y=>{if(!d)return y;const b={};return d.forEach(S=>{const w=typeof S=="string"?S:S.name,T=typeof S=="string"?void 0:S.skipIfDefault;if(w in y){const M=y[w];if(T!==void 0&&M===T)return;b[w]=M}}),b},m=f.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(y,b)=>{const S={...l,...y.attributes};if(c)return b.createNode(e,S);const w=r?r(y):y.content||"";return w?b.createNode(e,S,[b.createTextNode(w)]):b.createNode(e,S,[])},markdownTokenizer:{name:e,level:"inline",start(y){const b=c?new RegExp(`\\[${m}\\s*[^\\]]*\\]`):new RegExp(`\\[${m}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${m}\\]`),S=y.match(b),w=S?.index;return w!==void 0?w:-1},tokenize(y,b,S){const w=c?new RegExp(`^\\[${m}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${m}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${m}\\]`),T=y.match(w);if(!T)return;let M="",k="";if(c){const[,I]=T;k=I}else{const[,I,O]=T;k=I,M=O||""}const j=i(k.trim());return{type:e,raw:T[0],content:M.trim(),attributes:j}}},renderMarkdown:y=>{let b="";r?b=r(y):y.content&&y.content.length>0&&(b=y.content.filter(M=>M.type==="text").map(M=>M.text).join(""));const S=p(y.attrs||{}),w=o(S),T=w?` ${w}`:"";return c?`[${f}${T}]`:`[${f}${T}]${b}[/${f}]`}}}function lg(t,e,n){var r,i,o,l;const c=t.split(`
107
+ `),d=[];let f="",p=0;const m=e.baseIndentSize||2;for(;p<c.length;){const y=c[p],b=y.match(e.itemPattern);if(!b){if(d.length>0)break;if(y.trim()===""){p+=1,f=`${f}${y}
108
+ `;continue}else return}const S=e.extractItemData(b),{indentLevel:w,mainContent:T}=S;f=`${f}${y}
109
+ `;const M=[T];for(p+=1;p<c.length;){const O=c[p];if(O.trim()===""){const A=c.slice(p+1).findIndex(se=>se.trim()!=="");if(A===-1)break;if((((i=(r=c[p+1+A].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>w){M.push(O),f=`${f}${O}
110
+ `,p+=1;continue}else break}if((((l=(o=O.match(/^(\s*)/))==null?void 0:o[1])==null?void 0:l.length)||0)>w)M.push(O),f=`${f}${O}
111
+ `,p+=1;else break}let k;const j=M.slice(1);if(j.length>0){const O=j.map(P=>P.slice(w+m)).join(`
112
+ `);O.trim()&&(e.customNestedParser?k=e.customNestedParser(O):k=n.blockTokens(O))}const I=e.createToken(S,k);d.push(I)}if(d.length!==0)return{items:d,raw:f}}function o0(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const i=typeof n=="function"?n(r):n,[o,...l]=t.content,c=e.renderChildren([o]),d=[`${i}${c}`];return l&&l.length>0&&l.forEach(f=>{const p=e.renderChildren([f]);if(p){const m=p.split(`
113
+ `).map(y=>y?e.indent(y):"").join(`
114
+ `);d.push(m)}}),d.join(`
115
+ `)}function CU(t,e,n={}){const{state:r}=e,{doc:i,tr:o}=r,l=t;i.descendants((c,d)=>{const f=o.mapping.map(d),p=o.mapping.map(d)+c.nodeSize;let m=null;if(c.marks.forEach(b=>{if(b!==l)return!1;m=b}),!m)return;let y=!1;if(Object.keys(n).forEach(b=>{n[b]!==m.attrs[b]&&(y=!0)}),y){const b=t.type.create({...t.attrs,...n});o.removeMark(f,p,t.type),o.addMark(f,p,b)}}),o.docChanged&&e.view.dispatch(o)}var _n=class NC extends r0{constructor(){super(...arguments),this.type="node"}static create(e={}){const n=typeof e=="function"?e():e;return new NC(n)}configure(e){return super.configure(e)}extend(e){const n=typeof e=="function"?e():e;return super.extend(n)}},kU=class{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(t){var e,n,r,i,o,l,c;const{view:d}=this.editor,f=t.target,p=f.nodeType===3?(e=f.parentElement)==null?void 0:e.closest("[data-drag-handle]"):f.closest("[data-drag-handle]");if(!this.dom||(n=this.contentDOM)!=null&&n.contains(f)||!p)return;let m=0,y=0;if(this.dom!==p){const k=this.dom.getBoundingClientRect(),j=p.getBoundingClientRect(),I=(i=t.offsetX)!=null?i:(r=t.nativeEvent)==null?void 0:r.offsetX,O=(l=t.offsetY)!=null?l:(o=t.nativeEvent)==null?void 0:o.offsetY;m=j.x-k.x+I,y=j.y-k.y+O}const b=this.dom.cloneNode(!0);try{const k=this.dom.getBoundingClientRect();b.style.width=`${Math.round(k.width)}px`,b.style.height=`${Math.round(k.height)}px`,b.style.boxSizing="border-box",b.style.pointerEvents="none"}catch{}let S=null;try{S=document.createElement("div"),S.style.position="absolute",S.style.top="-9999px",S.style.left="-9999px",S.style.pointerEvents="none",S.appendChild(b),document.body.appendChild(S),(c=t.dataTransfer)==null||c.setDragImage(b,m,y)}finally{S&&setTimeout(()=>{try{S?.remove()}catch{}},0)}const w=this.getPos();if(typeof w!="number")return;const T=Ae.create(d.state.doc,w),M=d.state.tr.setSelection(T);d.dispatch(M)}stopEvent(t){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:t});const n=t.target;if(!(this.dom.contains(n)&&!((e=this.contentDOM)!=null&&e.contains(n))))return!1;const i=t.type.startsWith("drag"),o=t.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!i)return!0;const{isEditable:c}=this.editor,{isDragging:d}=this,f=!!this.node.type.spec.draggable,p=Ae.isSelectable(this.node),m=t.type==="copy",y=t.type==="paste",b=t.type==="cut",S=t.type==="mousedown";if(!f&&p&&i&&t.target===this.dom&&t.preventDefault(),f&&i&&!d&&t.target===this.dom)return t.preventDefault(),!1;if(f&&c&&!d&&S){const w=n.closest("[data-drag-handle]");w&&(this.dom===w||this.dom.contains(w))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(d||o||m||y||b||S&&p)}ignoreMutation(t){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:t}):this.node.isLeaf||this.node.isAtom?!0:t.type==="selection"||this.dom.contains(t.target)&&t.type==="childList"&&(mu()||ig())&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every(n=>n.isContentEditable)?!1:this.contentDOM===t.target&&t.type==="attributes"?!0:!this.contentDOM.contains(t.target)}updateAttributes(t){this.editor.commands.command(({tr:e})=>{const n=this.getPos();return typeof n!="number"?!1:(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)})}deleteNode(){const t=this.getPos();if(typeof t!="number")return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}};function eo(t){return new uU({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:i})=>{const o=gt(t.getAttributes,void 0,r,i);if(o===!1||o===null)return null;const{tr:l}=e,c=r[r.length-1],d=r[0];let f=n.to;if(c){const p=d.search(/\S/),m=n.from+d.indexOf(c),y=m+c.length;if(n0(n.from,n.to,e.doc).filter(S=>S.mark.type.excluded.find(T=>T===t.type&&T!==S.mark.type)).filter(S=>S.to>m).length)return null;y<n.to&&l.delete(y,n.to),m>n.from&&l.delete(n.from+p,m),f=n.from+p+c.length,l.addMark(n.from+p,f,t.type.create(o||{})),l.removeStoredMark(t.type)}}})}const{getOwnPropertyNames:AU,getOwnPropertySymbols:OU}=Object,{hasOwnProperty:NU}=Object.prototype;function Qm(t,e){return function(r,i,o){return t(r,i,o)&&e(r,i,o)}}function dd(t){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return t(n,r,i);const{cache:o}=i,l=o.get(n),c=o.get(r);if(l&&c)return l===r&&c===n;o.set(n,r),o.set(r,n);const d=t(n,r,i);return o.delete(n),o.delete(r),d}}function RU(t){return t?.[Symbol.toStringTag]}function aT(t){return AU(t).concat(OU(t))}const DU=Object.hasOwn||((t,e)=>NU.call(t,e));function ro(t,e){return t===e||!t&&!e&&t!==t&&e!==e}const IU="__v",LU="__o",jU="_owner",{getOwnPropertyDescriptor:lT,keys:uT}=Object;function BU(t,e){return t.byteLength===e.byteLength&&Zd(new Uint8Array(t),new Uint8Array(e))}function zU(t,e,n){let r=t.length;if(e.length!==r)return!1;for(;r-- >0;)if(!n.equals(t[r],e[r],r,r,t,e,n))return!1;return!0}function PU(t,e){return t.byteLength===e.byteLength&&Zd(new Uint8Array(t.buffer,t.byteOffset,t.byteLength),new Uint8Array(e.buffer,e.byteOffset,e.byteLength))}function UU(t,e){return ro(t.getTime(),e.getTime())}function qU(t,e){return t.name===e.name&&t.message===e.message&&t.cause===e.cause&&t.stack===e.stack}function $U(t,e){return t===e}function cT(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),o=t.entries();let l,c,d=0;for(;(l=o.next())&&!l.done;){const f=e.entries();let p=!1,m=0;for(;(c=f.next())&&!c.done;){if(i[m]){m++;continue}const y=l.value,b=c.value;if(n.equals(y[0],b[0],d,m,t,e,n)&&n.equals(y[1],b[1],y[0],b[0],t,e,n)){p=i[m]=!0;break}m++}if(!p)return!1;d++}return!0}const FU=ro;function HU(t,e,n){const r=uT(t);let i=r.length;if(uT(e).length!==i)return!1;for(;i-- >0;)if(!RC(t,e,n,r[i]))return!1;return!0}function Tl(t,e,n){const r=aT(t);let i=r.length;if(aT(e).length!==i)return!1;let o,l,c;for(;i-- >0;)if(o=r[i],!RC(t,e,n,o)||(l=lT(t,o),c=lT(e,o),(l||c)&&(!l||!c||l.configurable!==c.configurable||l.enumerable!==c.enumerable||l.writable!==c.writable)))return!1;return!0}function VU(t,e){return ro(t.valueOf(),e.valueOf())}function KU(t,e){return t.source===e.source&&t.flags===e.flags}function dT(t,e,n){const r=t.size;if(r!==e.size)return!1;if(!r)return!0;const i=new Array(r),o=t.values();let l,c;for(;(l=o.next())&&!l.done;){const d=e.values();let f=!1,p=0;for(;(c=d.next())&&!c.done;){if(!i[p]&&n.equals(l.value,c.value,l.value,c.value,t,e,n)){f=i[p]=!0;break}p++}if(!f)return!1}return!0}function Zd(t,e){let n=t.byteLength;if(e.byteLength!==n||t.byteOffset!==e.byteOffset)return!1;for(;n-- >0;)if(t[n]!==e[n])return!1;return!0}function GU(t,e){return t.hostname===e.hostname&&t.pathname===e.pathname&&t.protocol===e.protocol&&t.port===e.port&&t.hash===e.hash&&t.username===e.username&&t.password===e.password}function RC(t,e,n,r){return(r===jU||r===LU||r===IU)&&(t.$$typeof||e.$$typeof)?!0:DU(e,r)&&n.equals(t[r],e[r],r,r,t,e,n)}const YU="[object ArrayBuffer]",QU="[object Arguments]",XU="[object Boolean]",JU="[object DataView]",WU="[object Date]",ZU="[object Error]",e6="[object Map]",t6="[object Number]",n6="[object Object]",r6="[object RegExp]",i6="[object Set]",s6="[object String]",o6={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},a6="[object URL]",l6=Object.prototype.toString;function u6({areArrayBuffersEqual:t,areArraysEqual:e,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:o,areMapsEqual:l,areNumbersEqual:c,areObjectsEqual:d,arePrimitiveWrappersEqual:f,areRegExpsEqual:p,areSetsEqual:m,areTypedArraysEqual:y,areUrlsEqual:b,unknownTagComparators:S}){return function(T,M,k){if(T===M)return!0;if(T==null||M==null)return!1;const j=typeof T;if(j!==typeof M)return!1;if(j!=="object")return j==="number"?c(T,M,k):j==="function"?o(T,M,k):!1;const I=T.constructor;if(I!==M.constructor)return!1;if(I===Object)return d(T,M,k);if(Array.isArray(T))return e(T,M,k);if(I===Date)return r(T,M,k);if(I===RegExp)return p(T,M,k);if(I===Map)return l(T,M,k);if(I===Set)return m(T,M,k);const O=l6.call(T);if(O===WU)return r(T,M,k);if(O===r6)return p(T,M,k);if(O===e6)return l(T,M,k);if(O===i6)return m(T,M,k);if(O===n6)return typeof T.then!="function"&&typeof M.then!="function"&&d(T,M,k);if(O===a6)return b(T,M,k);if(O===ZU)return i(T,M,k);if(O===QU)return d(T,M,k);if(o6[O])return y(T,M,k);if(O===YU)return t(T,M,k);if(O===JU)return n(T,M,k);if(O===XU||O===t6||O===s6)return f(T,M,k);if(S){let P=S[O];if(!P){const A=RU(T);A&&(P=S[A])}if(P)return P(T,M,k)}return!1}}function c6({circular:t,createCustomConfig:e,strict:n}){let r={areArrayBuffersEqual:BU,areArraysEqual:n?Tl:zU,areDataViewsEqual:PU,areDatesEqual:UU,areErrorsEqual:qU,areFunctionsEqual:$U,areMapsEqual:n?Qm(cT,Tl):cT,areNumbersEqual:FU,areObjectsEqual:n?Tl:HU,arePrimitiveWrappersEqual:VU,areRegExpsEqual:KU,areSetsEqual:n?Qm(dT,Tl):dT,areTypedArraysEqual:n?Qm(Zd,Tl):Zd,areUrlsEqual:GU,unknownTagComparators:void 0};if(e&&(r=Object.assign({},r,e(r))),t){const i=dd(r.areArraysEqual),o=dd(r.areMapsEqual),l=dd(r.areObjectsEqual),c=dd(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:o,areObjectsEqual:l,areSetsEqual:c})}return r}function d6(t){return function(e,n,r,i,o,l,c){return t(e,n,c)}}function f6({circular:t,comparator:e,createState:n,equals:r,strict:i}){if(n)return function(c,d){const{cache:f=t?new WeakMap:void 0,meta:p}=n();return e(c,d,{cache:f,equals:r,meta:p,strict:i})};if(t)return function(c,d){return e(c,d,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};const o={cache:void 0,equals:r,meta:void 0,strict:i};return function(c,d){return e(c,d,o)}}const h6=cs();cs({strict:!0});cs({circular:!0});cs({circular:!0,strict:!0});cs({createInternalComparator:()=>ro});cs({strict:!0,createInternalComparator:()=>ro});cs({circular:!0,createInternalComparator:()=>ro});cs({circular:!0,createInternalComparator:()=>ro,strict:!0});function cs(t={}){const{circular:e=!1,createInternalComparator:n,createState:r,strict:i=!1}=t,o=c6(t),l=u6(o),c=n?n(l):d6(l);return f6({circular:e,comparator:l,createState:r,equals:c,strict:i})}var Xm={exports:{}},Jm={};var fT;function p6(){if(fT)return Jm;fT=1;var t=_u(),e=_M();function n(f,p){return f===p&&(f!==0||1/f===1/p)||f!==f&&p!==p}var r=typeof Object.is=="function"?Object.is:n,i=e.useSyncExternalStore,o=t.useRef,l=t.useEffect,c=t.useMemo,d=t.useDebugValue;return Jm.useSyncExternalStoreWithSelector=function(f,p,m,y,b){var S=o(null);if(S.current===null){var w={hasValue:!1,value:null};S.current=w}else w=S.current;S=c(function(){function M(P){if(!k){if(k=!0,j=P,P=y(P),b!==void 0&&w.hasValue){var A=w.value;if(b(A,P))return I=A}return I=P}if(A=I,r(j,P))return A;var U=y(P);return b!==void 0&&b(A,U)?(j=P,A):(j=P,I=U)}var k=!1,j,I,O=m===void 0?null:m;return[function(){return M(p())},O===null?void 0:function(){return M(O())}]},[p,m,y,b]);var T=i(f,S[0],S[1]);return l(function(){w.hasValue=!0,w.value=T},[T]),d(T),T},Jm}var hT;function m6(){return hT||(hT=1,Xm.exports=p6()),Xm.exports}var y6=m6(),g6=(...t)=>e=>{t.forEach(n=>{typeof n=="function"?n(e):n&&(n.current=e)})},b6=({contentComponent:t})=>{const e=TM.useSyncExternalStore(t.subscribe,t.getSnapshot,t.getServerSnapshot);return E.jsx(E.Fragment,{children:Object.values(e)})};function v6(){const t=new Set;let e={};return{subscribe(n){return t.add(n),()=>{t.delete(n)}},getSnapshot(){return e},getServerSnapshot(){return e},setRenderer(n,r){e={...e,[n]:t2.createPortal(r.reactElement,r.element,n)},t.forEach(i=>i())},removeRenderer(n){const r={...e};delete r[n],e=r,t.forEach(i=>i())}}}var S6=class extends Le.Component{constructor(t){var e;super(t),this.editorContentRef=Le.createRef(),this.initialized=!1,this.state={hasContentComponentInitialized:!!((e=t.editor)!=null&&e.contentComponent)}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var t;const e=this.props.editor;if(e&&!e.isDestroyed&&((t=e.view.dom)!=null&&t.parentNode)){if(e.contentComponent)return;const n=this.editorContentRef.current;n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n}),e.contentComponent=v6(),this.state.hasContentComponentInitialized||(this.unsubscribeToContentComponent=e.contentComponent.subscribe(()=>{this.setState(r=>r.hasContentComponentInitialized?r:{hasContentComponentInitialized:!0}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent()})),e.createNodeViews(),this.initialized=!0}}componentWillUnmount(){var t;const e=this.props.editor;if(e){this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),this.unsubscribeToContentComponent&&this.unsubscribeToContentComponent(),e.contentComponent=null;try{if(!((t=e.view.dom)!=null&&t.parentNode))return;const n=document.createElement("div");n.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:n})}catch{}}}render(){const{editor:t,innerRef:e,...n}=this.props;return E.jsxs(E.Fragment,{children:[E.jsx("div",{ref:g6(e,this.editorContentRef),...n}),t?.contentComponent&&E.jsx(b6,{contentComponent:t.contentComponent})]})}},w6=C.forwardRef((t,e)=>{const n=Le.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Le.createElement(S6,{key:n,innerRef:e,...t})}),DC=Le.memo(w6),_6=typeof window<"u"?C.useLayoutEffect:C.useEffect,T6=class{constructor(t){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=t,this.lastSnapshot={editor:t,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber?this.lastSnapshot:(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber},this.lastSnapshot)}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(t){return this.subscribers.add(t),()=>{this.subscribers.delete(t)}}watch(t){if(this.editor=t,this.editor){const e=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",e),()=>{n.off("transaction",e)}}}};function E6(t){var e;const[n]=C.useState(()=>new T6(t.editor)),r=y6.useSyncExternalStoreWithSelector(n.subscribe,n.getSnapshot,n.getServerSnapshot,t.selector,(e=t.equalityFn)!=null?e:h6);return _6(()=>n.watch(t.editor),[t.editor,n]),C.useDebugValue(r),r}var M6=!1,ug=typeof window>"u",x6=ug||!!(typeof window<"u"&&window.next),C6=class IC{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){return this.options.current.immediatelyRender===void 0?ug||x6?null:this.createEditor():(this.options.current.immediatelyRender,this.options.current.immediatelyRender?this.createEditor():null)}createEditor(){const e={...this.options.current,onBeforeCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onBeforeCreate)==null?void 0:o.call(i,...r)},onBlur:(...r)=>{var i,o;return(o=(i=this.options.current).onBlur)==null?void 0:o.call(i,...r)},onCreate:(...r)=>{var i,o;return(o=(i=this.options.current).onCreate)==null?void 0:o.call(i,...r)},onDestroy:(...r)=>{var i,o;return(o=(i=this.options.current).onDestroy)==null?void 0:o.call(i,...r)},onFocus:(...r)=>{var i,o;return(o=(i=this.options.current).onFocus)==null?void 0:o.call(i,...r)},onSelectionUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onSelectionUpdate)==null?void 0:o.call(i,...r)},onTransaction:(...r)=>{var i,o;return(o=(i=this.options.current).onTransaction)==null?void 0:o.call(i,...r)},onUpdate:(...r)=>{var i,o;return(o=(i=this.options.current).onUpdate)==null?void 0:o.call(i,...r)},onContentError:(...r)=>{var i,o;return(o=(i=this.options.current).onContentError)==null?void 0:o.call(i,...r)},onDrop:(...r)=>{var i,o;return(o=(i=this.options.current).onDrop)==null?void 0:o.call(i,...r)},onPaste:(...r)=>{var i,o;return(o=(i=this.options.current).onPaste)==null?void 0:o.call(i,...r)},onDelete:(...r)=>{var i,o;return(o=(i=this.options.current).onDelete)==null?void 0:o.call(i,...r)}};return new bU(e)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,n){return Object.keys(e).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&e.extensions&&n.extensions?e.extensions.length!==n.extensions.length?!1:e.extensions.every((i,o)=>{var l;return i===((l=n.extensions)==null?void 0:l[o])}):e[r]===n[r])}onRender(e){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&e.length===0?IC.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(e),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((r,i)=>r===e[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){const e=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===e){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function k6(t={},e=[]){const n=C.useRef(t);n.current=t;const[r]=C.useState(()=>new C6(n)),i=TM.useSyncExternalStore(r.subscribe,r.getEditor,r.getServerSnapshot);return C.useDebugValue(i),C.useEffect(r.onRender(e)),E6({editor:i,selector:({transactionNumber:o})=>t.shouldRerenderOnTransaction===!1||t.shouldRerenderOnTransaction===void 0?null:t.immediatelyRender&&o===0?0:o+1}),i}var LC=C.createContext({editor:null});LC.Consumer;var jC=C.createContext({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),A6=()=>C.useContext(jC),O6=Le.forwardRef((t,e)=>{const{onDragStart:n}=A6(),r=t.as||"div";return E.jsx(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});function pT(t){return!!(typeof t=="function"&&t.prototype&&t.prototype.isReactComponent)}function mT(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.forward_ref)"||t.$$typeof.description==="react.forward_ref"))}function N6(t){return!!(typeof t=="object"&&t.$$typeof&&(t.$$typeof.toString()==="Symbol(react.memo)"||t.$$typeof.description==="react.memo"))}function R6(t){if(pT(t)||mT(t))return!0;if(N6(t)){const e=t.type;if(e)return pT(e)||mT(e)}return!1}function D6(){try{if(C.version)return parseInt(C.version.split(".")[0],10)>=19}catch{}return!1}var I6=class{constructor(t,{editor:e,props:n={},as:r="div",className:i=""}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=t,this.editor=e,this.props=n,this.element=document.createElement(r),this.element.classList.add("react-renderer"),i&&this.element.classList.add(...i.split(" ")),this.editor.isInitialized?IE.flushSync(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var t;if(this.destroyed)return;const e=this.component,n=this.props,r=this.editor,i=D6(),o=R6(e),l={...n};l.ref&&!(i||o)&&delete l.ref,!l.ref&&(i||o)&&(l.ref=c=>{this.ref=c}),this.reactElement=E.jsx(e,{...l}),(t=r?.contentComponent)==null||t.setRenderer(this.id,this)}updateProps(t={}){this.destroyed||(this.props={...this.props,...t},this.render())}destroy(){var t;this.destroyed=!0;const e=this.editor;(t=e?.contentComponent)==null||t.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(t){Object.keys(t).forEach(e=>{this.element.setAttribute(e,t[e])})}};Le.createContext({markViewContentRef:()=>{}});var L6=class extends kU{constructor(t,e,n){if(super(t,e,n),this.selectionRafId=null,this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.options.contentDOMElementTag?this.contentDOMElement=document.createElement(this.options.contentDOMElementTag):this.contentDOMElement=document.createElement(this.node.isInline?"span":"div"),this.contentDOMElement.dataset.nodeViewContentReact="",this.contentDOMElement.dataset.nodeViewWrapper="",this.contentDOMElement.style.whiteSpace="inherit";const r=this.dom.querySelector("[data-node-view-content]");if(!r)return;r.appendChild(this.contentDOMElement)}}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){const t=this.editor,e=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(e,{get(n,r,i){var o;return r==="storage"?(o=t.storage[e.name])!=null?o:{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){const t={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(d={})=>this.updateAttributes(d),deleteNode:()=>this.deleteNode(),ref:C.createRef()};if(!this.component.displayName){const d=f=>f.charAt(0).toUpperCase()+f.substring(1);this.component.displayName=d(this.extension.name)}const r={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:d=>{d&&this.contentDOMElement&&d.firstChild!==this.contentDOMElement&&(d.hasAttribute("data-node-view-wrapper")&&d.removeAttribute("data-node-view-wrapper"),d.appendChild(this.contentDOMElement))}},i=this.component,o=C.memo(d=>E.jsx(jC.Provider,{value:r,children:C.createElement(i,d)}));o.displayName="ReactNodeView";let l=this.node.isInline?"span":"div";this.options.as&&(l=this.options.as);const{className:c=""}=this.options;this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.renderer=new I6(o,{editor:this.editor,props:t,as:l,className:`node-${this.node.type.name} ${c}`.trim()}),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.updateElementAttributes()}get dom(){var t;if(this.renderer.element.firstElementChild&&!((t=this.renderer.element.firstElementChild)!=null&&t.hasAttribute("data-node-view-wrapper")))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}handleSelectionUpdate(){this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null),this.selectionRafId=requestAnimationFrame(()=>{this.selectionRafId=null;const{from:t,to:e}=this.editor.state.selection,n=this.getPos();if(typeof n=="number")if(t<=n&&e>=n+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}})}update(t,e,n){const r=i=>{this.renderer.updateProps(i),typeof this.options.attrs=="function"&&this.updateElementAttributes()};if(t.type!==this.node.type)return!1;if(typeof this.options.update=="function"){const i=this.node,o=this.decorations,l=this.innerDecorations;return this.node=t,this.decorations=e,this.innerDecorations=n,this.options.update({oldNode:i,oldDecorations:o,newNode:t,newDecorations:e,oldInnerDecorations:l,innerDecorations:n,updateProps:()=>r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}return t===this.node&&this.decorations===e&&this.innerDecorations===n||(this.node=t,this.decorations=e,this.innerDecorations=n,r({node:t,decorations:e,innerDecorations:n,extension:this.extensionWithSyncedStorage})),!0}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate),this.contentDOMElement=null,this.selectionRafId&&(cancelAnimationFrame(this.selectionRafId),this.selectionRafId=null)}updateElementAttributes(){if(this.options.attrs){let t={};if(typeof this.options.attrs=="function"){const e=this.editor.extensionManager.attributes,n=wa(this.node,e);t=this.options.attrs({node:this.node,HTMLAttributes:n})}else t=this.options.attrs;this.renderer.updateAttributes(t)}}};function j6(t,e){return n=>n.editor.contentComponent?new L6(t,n,e):{}}var a0=C.createContext({get editor(){throw new Error("useTiptap must be used within a <Tiptap> provider")}});a0.displayName="TiptapContext";var B6=()=>C.useContext(a0);function BC({editor:t,instance:e,children:n}){const r=t??e;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");const i=C.useMemo(()=>({editor:r}),[r]),o=C.useMemo(()=>({editor:r}),[r]);return E.jsx(LC.Provider,{value:o,children:E.jsx(a0.Provider,{value:i,children:n})})}BC.displayName="Tiptap";function zC({...t}){const{editor:e}=B6();return E.jsx(DC,{editor:e,...t})}zC.displayName="Tiptap.Content";Object.assign(BC,{Content:zC});var ef=(t,e)=>{if(t==="slot")return 0;if(t instanceof Function)return t(e);const{children:n,...r}=e??{};if(t==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[t,r,n]},z6=/^\s*>\s$/,P6=_n.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:t}){return ef("blockquote",{...At(this.options.HTMLAttributes,t),children:ef("slot",{})})},parseMarkdown:(t,e)=>e.createNode("blockquote",void 0,e.parseChildren(t.tokens||[])),renderMarkdown:(t,e)=>{if(!t.content)return"";const n=">",r=[];return t.content.forEach(i=>{const c=e.renderChildren([i]).split(`
116
+ `).map(d=>d.trim()===""?n:`${n} ${d}`);r.push(c.join(`
117
+ `))}),r.join(`
118
+ ${n}
119
+ `)},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ta({find:z6,type:this.type})]}}),U6=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,q6=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,$6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,F6=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,H6=no.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:t=>t.type.name===this.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return ef("strong",{...At(this.options.HTMLAttributes,t),children:ef("slot",{})})},markdownTokenName:"strong",parseMarkdown:(t,e)=>e.applyMark("bold",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`**${e.renderChildren(t)}**`,addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[_a({find:U6,type:this.type}),_a({find:$6,type:this.type})]},addPasteRules(){return[eo({find:q6,type:this.type}),eo({find:F6,type:this.type})]}}),V6=/(^|[^`])`([^`]+)`(?!`)$/,K6=/(^|[^`])`([^`]+)`(?!`)/g,G6=no.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:t}){return["code",At(this.options.HTMLAttributes,t),0]},markdownTokenName:"codespan",parseMarkdown:(t,e)=>e.applyMark("code",[{type:"text",text:t.text||""}]),renderMarkdown:(t,e)=>t.content?`\`${e.renderChildren(t.content)}\``:"",addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[_a({find:V6,type:this.type})]},addPasteRules(){return[eo({find:K6,type:this.type})]}}),Wm=4,Y6=/^```([a-z]+)?[\s\n]$/,Q6=/^~~~([a-z]+)?[\s\n]$/,X6=_n.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Wm,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;if(!n)return null;const o=[...((e=t.firstElementChild)==null?void 0:e.classList)||[]].filter(l=>l.startsWith(n)).map(l=>l.replace(n,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:t,HTMLAttributes:e}){return["pre",At(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(t,e)=>{var n;return((n=t.raw)==null?void 0:n.startsWith("```"))===!1&&t.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:t.lang||null},t.text?[e.createTextNode(t.text)]:[])},renderMarkdown:(t,e)=>{var n;let r="";const i=((n=t.attrs)==null?void 0:n.language)||"";return t.content?r=[`\`\`\`${i}`,e.renderChildren(t.content),"```"].join(`
120
+ `):r=`\`\`\`${i}
121
+
122
+ \`\`\``,r},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=e.pos===1;return!t||e.parent.type.name!==this.name?!1:n||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Wm,{state:r}=t,{selection:i}=r,{$from:o,empty:l}=i;if(o.parent.type!==this.type)return!1;const c=" ".repeat(n);return l?t.commands.insertContent(c):t.commands.command(({tr:d})=>{const{from:f,to:p}=i,b=r.doc.textBetween(f,p,`
123
+ `,`
124
+ `).split(`
125
+ `).map(S=>c+S).join(`
126
+ `);return d.replaceWith(f,p,r.schema.text(b)),!0})},"Shift-Tab":({editor:t})=>{var e;if(!this.options.enableTabIndentation)return!1;const n=(e=this.options.tabSize)!=null?e:Wm,{state:r}=t,{selection:i}=r,{$from:o,empty:l}=i;return o.parent.type!==this.type?!1:l?t.commands.command(({tr:c})=>{var d;const{pos:f}=o,p=o.start(),m=o.end(),b=r.doc.textBetween(p,m,`
127
+ `,`
128
+ `).split(`
129
+ `);let S=0,w=0;const T=f-p;for(let P=0;P<b.length;P+=1){if(w+b[P].length>=T){S=P;break}w+=b[P].length+1}const k=((d=b[S].match(/^ */))==null?void 0:d[0])||"",j=Math.min(k.length,n);if(j===0)return!0;let I=p;for(let P=0;P<S;P+=1)I+=b[P].length+1;return c.delete(I,I+j),f-I<=j&&c.setSelection(Pe.create(c.doc,I)),!0}):t.commands.command(({tr:c})=>{const{from:d,to:f}=i,y=r.doc.textBetween(d,f,`
130
+ `,`
131
+ `).split(`
132
+ `).map(b=>{var S;const w=((S=b.match(/^ */))==null?void 0:S[0])||"",T=Math.min(w.length,n);return b.slice(T)}).join(`
133
+ `);return c.replaceWith(d,f,r.schema.text(y)),!0})},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:r,empty:i}=n;if(!i||r.parent.type!==this.type)return!1;const o=r.parentOffset===r.parent.nodeSize-2,l=r.parent.textContent.endsWith(`
134
+
135
+ `);return!o||!l?!1:t.chain().command(({tr:c})=>(c.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:r}=e,{$from:i,empty:o}=n;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;const c=i.after();return c===void 0?!1:r.nodeAt(c)?t.commands.command(({tr:f})=>(f.setSelection(He.near(r.resolve(c))),!0)):t.commands.exitCode()}}},addInputRules(){return[ag({find:Y6,type:this.type,getAttributes:t=>({language:t[1]})}),ag({find:Q6,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new Ot({key:new Pt("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),r=e.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!n||!o)return!1;const{tr:l,schema:c}=t.state,d=c.text(n.replace(/\r\n?/g,`
136
+ `));return l.replaceSelectionWith(this.type.create({language:o},d)),l.selection.$from.parent.type!==this.type&&l.setSelection(Pe.near(l.doc.resolve(Math.max(0,l.selection.from-2)))),l.setMeta("paste",!0),t.dispatch(l),!0}}})]}}),J6=_n.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
137
+
138
+ `):""}),W6=_n.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:t}){return["br",At(this.options.HTMLAttributes,t)]},renderText(){return`
139
+ `},renderMarkdown:()=>`
140
+ `,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:r})=>t.first([()=>t.exitCode(),()=>t.command(()=>{const{selection:i,storedMarks:o}=n;if(i.$from.parent.type.spec.isolating)return!1;const{keepMarks:l}=this.options,{splittableMarks:c}=r.extensionManager,d=o||i.$to.parentOffset&&i.$from.marks();return e().insertContent({type:this.name}).command(({tr:f,dispatch:p})=>{if(p&&d&&l){const m=d.filter(y=>c.includes(y.type.name));f.ensureMarks(m)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Z6=_n.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(t=>({tag:`h${t}`,attrs:{level:t}}))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,At(this.options.HTMLAttributes,e),0]},parseMarkdown:(t,e)=>e.createNode("heading",{level:t.depth||1},e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>{var n;const r=(n=t.attrs)!=null&&n.level?parseInt(t.attrs.level,10):1,i="#".repeat(r);return t.content?`${i} ${e.renderChildren(t.content)}`:""},addCommands(){return{setHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.setNode(this.name,t):!1,toggleHeading:t=>({commands:e})=>this.options.levels.includes(t.level)?e.toggleNode(this.name,"paragraph",t):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(t=>ag({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${t}})\\s$`),type:this.type,getAttributes:{level:t}}))}}),eq=_n.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:t}){return["hr",At(this.options.HTMLAttributes,t)]},markdownTokenName:"hr",parseMarkdown:(t,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{if(!SU(e,e.schema.nodes[this.name]))return!1;const{selection:n}=e,{$to:r}=n,i=t();return hC(n)?i.insertContentAt(r.pos,{type:this.name}):i.insertContent({type:this.name}),i.command(({state:o,tr:l,dispatch:c})=>{if(c){const{$to:d}=l.selection,f=d.end();if(d.nodeAfter)d.nodeAfter.isTextblock?l.setSelection(Pe.create(l.doc,d.pos+1)):d.nodeAfter.isBlock?l.setSelection(Ae.create(l.doc,d.pos)):l.setSelection(Pe.create(l.doc,d.pos));else{const p=o.schema.nodes[this.options.nextNodeType]||d.parent.type.contentMatch.defaultType,m=p?.create();m&&(l.insert(f,m),l.setSelection(Pe.create(l.doc,f+1)))}l.scrollIntoView()}return!0}).run()}}},addInputRules(){return[vU({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),tq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,nq=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,rq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,iq=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sq=no.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:t=>t.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",At(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(t,e)=>e.applyMark("italic",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`*${e.renderChildren(t)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[_a({find:tq,type:this.type}),_a({find:rq,type:this.type})]},addPasteRules(){return[eo({find:nq,type:this.type}),eo({find:iq,type:this.type})]}});const oq="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",aq="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",cg="numeric",dg="ascii",fg="alpha",Pl="asciinumeric",Rl="alphanumeric",hg="domain",PC="emoji",lq="scheme",uq="slashscheme",Zm="whitespace";function cq(t,e){return t in e||(e[t]=[]),e[t]}function Ps(t,e,n){e[cg]&&(e[Pl]=!0,e[Rl]=!0),e[dg]&&(e[Pl]=!0,e[fg]=!0),e[Pl]&&(e[Rl]=!0),e[fg]&&(e[Rl]=!0),e[Rl]&&(e[hg]=!0),e[PC]&&(e[hg]=!0);for(const r in e){const i=cq(r,n);i.indexOf(t)<0&&i.push(t)}}function dq(t,e){const n={};for(const r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Dn(t=null){this.j={},this.jr=[],this.jd=null,this.t=t}Dn.groups={};Dn.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let r=0;r<e.jr.length;r++){const i=e.jr[r][0],o=e.jr[r][1];if(o&&i.test(t))return o}return e.jd},has(t,e=!1){return e?t in this.j:!!this.go(t)},ta(t,e,n,r){for(let i=0;i<t.length;i++)this.tt(t[i],e,n,r)},tr(t,e,n,r){r=r||Dn.groups;let i;return e&&e.j?i=e:(i=new Dn(e),n&&r&&Ps(e,n,r)),this.jr.push([t,i]),i},ts(t,e,n,r){let i=this;const o=t.length;if(!o)return i;for(let l=0;l<o-1;l++)i=i.tt(t[l]);return i.tt(t[o-1],e,n,r)},tt(t,e,n,r){r=r||Dn.groups;const i=this;if(e&&e.j)return i.j[t]=e,e;const o=e;let l,c=i.go(t);if(c?(l=new Dn,Object.assign(l.j,c.j),l.jr.push.apply(l.jr,c.jr),l.jd=c.jd,l.t=c.t):l=new Dn,o){if(r)if(l.t&&typeof l.t=="string"){const d=Object.assign(dq(l.t,r),n);Ps(o,d,r)}else n&&Ps(o,n,r);l.t=o}return i.j[t]=l,l}};const Fe=(t,e,n,r,i)=>t.ta(e,n,r,i),Dt=(t,e,n,r,i)=>t.tr(e,n,r,i),yT=(t,e,n,r,i)=>t.ts(e,n,r,i),de=(t,e,n,r,i)=>t.tt(e,n,r,i),ii="WORD",pg="UWORD",UC="ASCIINUMERICAL",qC="ALPHANUMERICAL",gu="LOCALHOST",mg="TLD",yg="UTLD",xd="SCHEME",Qo="SLASH_SCHEME",l0="NUM",gg="WS",u0="NL",Ul="OPENBRACE",ql="CLOSEBRACE",tf="OPENBRACKET",nf="CLOSEBRACKET",rf="OPENPAREN",sf="CLOSEPAREN",of="OPENANGLEBRACKET",af="CLOSEANGLEBRACKET",lf="FULLWIDTHLEFTPAREN",uf="FULLWIDTHRIGHTPAREN",cf="LEFTCORNERBRACKET",df="RIGHTCORNERBRACKET",ff="LEFTWHITECORNERBRACKET",hf="RIGHTWHITECORNERBRACKET",pf="FULLWIDTHLESSTHAN",mf="FULLWIDTHGREATERTHAN",yf="AMPERSAND",gf="APOSTROPHE",bf="ASTERISK",Ki="AT",vf="BACKSLASH",Sf="BACKTICK",wf="CARET",Qi="COLON",c0="COMMA",_f="DOLLAR",Ar="DOT",Tf="EQUALS",d0="EXCLAMATION",ir="HYPHEN",$l="PERCENT",Ef="PIPE",Mf="PLUS",xf="POUND",Fl="QUERY",f0="QUOTE",$C="FULLWIDTHMIDDLEDOT",h0="SEMI",Or="SLASH",Hl="TILDE",Cf="UNDERSCORE",FC="EMOJI",kf="SYM";var HC=Object.freeze({__proto__:null,ALPHANUMERICAL:qC,AMPERSAND:yf,APOSTROPHE:gf,ASCIINUMERICAL:UC,ASTERISK:bf,AT:Ki,BACKSLASH:vf,BACKTICK:Sf,CARET:wf,CLOSEANGLEBRACKET:af,CLOSEBRACE:ql,CLOSEBRACKET:nf,CLOSEPAREN:sf,COLON:Qi,COMMA:c0,DOLLAR:_f,DOT:Ar,EMOJI:FC,EQUALS:Tf,EXCLAMATION:d0,FULLWIDTHGREATERTHAN:mf,FULLWIDTHLEFTPAREN:lf,FULLWIDTHLESSTHAN:pf,FULLWIDTHMIDDLEDOT:$C,FULLWIDTHRIGHTPAREN:uf,HYPHEN:ir,LEFTCORNERBRACKET:cf,LEFTWHITECORNERBRACKET:ff,LOCALHOST:gu,NL:u0,NUM:l0,OPENANGLEBRACKET:of,OPENBRACE:Ul,OPENBRACKET:tf,OPENPAREN:rf,PERCENT:$l,PIPE:Ef,PLUS:Mf,POUND:xf,QUERY:Fl,QUOTE:f0,RIGHTCORNERBRACKET:df,RIGHTWHITECORNERBRACKET:hf,SCHEME:xd,SEMI:h0,SLASH:Or,SLASH_SCHEME:Qo,SYM:kf,TILDE:Hl,TLD:mg,UNDERSCORE:Cf,UTLD:yg,UWORD:pg,WORD:ii,WS:gg});const ti=/[a-z]/,El=new RegExp("\\p{L}","u"),ey=new RegExp("\\p{Emoji}","u"),ni=/\d/,ty=/\s/,gT="\r",ny=`
141
+ `,fq="️",hq="‍",ry="";let fd=null,hd=null;function pq(t=[]){const e={};Dn.groups=e;const n=new Dn;fd==null&&(fd=bT(oq)),hd==null&&(hd=bT(aq)),de(n,"'",gf),de(n,"{",Ul),de(n,"}",ql),de(n,"[",tf),de(n,"]",nf),de(n,"(",rf),de(n,")",sf),de(n,"<",of),de(n,">",af),de(n,"(",lf),de(n,")",uf),de(n,"「",cf),de(n,"」",df),de(n,"『",ff),de(n,"』",hf),de(n,"<",pf),de(n,">",mf),de(n,"&",yf),de(n,"*",bf),de(n,"@",Ki),de(n,"`",Sf),de(n,"^",wf),de(n,":",Qi),de(n,",",c0),de(n,"$",_f),de(n,".",Ar),de(n,"=",Tf),de(n,"!",d0),de(n,"-",ir),de(n,"%",$l),de(n,"|",Ef),de(n,"+",Mf),de(n,"#",xf),de(n,"?",Fl),de(n,'"',f0),de(n,"/",Or),de(n,";",h0),de(n,"~",Hl),de(n,"_",Cf),de(n,"\\",vf),de(n,"・",$C);const r=Dt(n,ni,l0,{[cg]:!0});Dt(r,ni,r);const i=Dt(r,ti,UC,{[Pl]:!0}),o=Dt(r,El,qC,{[Rl]:!0}),l=Dt(n,ti,ii,{[dg]:!0});Dt(l,ni,i),Dt(l,ti,l),Dt(i,ni,i),Dt(i,ti,i);const c=Dt(n,El,pg,{[fg]:!0});Dt(c,ti),Dt(c,ni,o),Dt(c,El,c),Dt(o,ni,o),Dt(o,ti),Dt(o,El,o);const d=de(n,ny,u0,{[Zm]:!0}),f=de(n,gT,gg,{[Zm]:!0}),p=Dt(n,ty,gg,{[Zm]:!0});de(n,ry,p),de(f,ny,d),de(f,ry,p),Dt(f,ty,p),de(p,gT),de(p,ny),Dt(p,ty,p),de(p,ry,p);const m=Dt(n,ey,FC,{[PC]:!0});de(m,"#"),Dt(m,ey,m),de(m,fq,m);const y=de(m,hq);de(y,"#"),Dt(y,ey,m);const b=[[ti,l],[ni,i]],S=[[ti,null],[El,c],[ni,o]];for(let w=0;w<fd.length;w++)qi(n,fd[w],mg,ii,b);for(let w=0;w<hd.length;w++)qi(n,hd[w],yg,pg,S);Ps(mg,{tld:!0,ascii:!0},e),Ps(yg,{utld:!0,alpha:!0},e),qi(n,"file",xd,ii,b),qi(n,"mailto",xd,ii,b),qi(n,"http",Qo,ii,b),qi(n,"https",Qo,ii,b),qi(n,"ftp",Qo,ii,b),qi(n,"ftps",Qo,ii,b),Ps(xd,{scheme:!0,ascii:!0},e),Ps(Qo,{slashscheme:!0,ascii:!0},e),t=t.sort((w,T)=>w[0]>T[0]?1:-1);for(let w=0;w<t.length;w++){const T=t[w][0],k=t[w][1]?{[lq]:!0}:{[uq]:!0};T.indexOf("-")>=0?k[hg]=!0:ti.test(T)?ni.test(T)?k[Pl]=!0:k[dg]=!0:k[cg]=!0,yT(n,T,T,k)}return yT(n,"localhost",gu,{ascii:!0}),n.jd=new Dn(kf),{start:n,tokens:Object.assign({groups:e},HC)}}function VC(t,e){const n=mq(e.replace(/[A-Z]/g,c=>c.toLowerCase())),r=n.length,i=[];let o=0,l=0;for(;l<r;){let c=t,d=null,f=0,p=null,m=-1,y=-1;for(;l<r&&(d=c.go(n[l]));)c=d,c.accepts()?(m=0,y=0,p=c):m>=0&&(m+=n[l].length,y++),f+=n[l].length,o+=n[l].length,l++;o-=m,l-=y,f-=m,i.push({t:p.t,v:e.slice(o-f,o),s:o-f,e:o})}return i}function mq(t){const e=[],n=t.length;let r=0;for(;r<n;){let i=t.charCodeAt(r),o,l=i<55296||i>56319||r+1===n||(o=t.charCodeAt(r+1))<56320||o>57343?t[r]:t.slice(r,r+2);e.push(l),r+=l.length}return e}function qi(t,e,n,r,i){let o;const l=e.length;for(let c=0;c<l-1;c++){const d=e[c];t.j[d]?o=t.j[d]:(o=new Dn(r),o.jr=i.slice(),t.j[d]=o),t=o}return o=new Dn(n),o.jr=i.slice(),t.j[e[l-1]]=o,o}function bT(t){const e=[],n=[];let r=0,i="0123456789";for(;r<t.length;){let o=0;for(;i.indexOf(t[r+o])>=0;)o++;if(o>0){e.push(n.join(""));for(let l=parseInt(t.substring(r,r+o),10);l>0;l--)n.pop();r+=o}else n.push(t[r]),r++}return e}const bu={defaultProtocol:"http",events:null,format:vT,formatHref:vT,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function p0(t,e=null){let n=Object.assign({},bu);t&&(n=Object.assign(n,t instanceof p0?t.o:t));const r=n.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=n,e&&(this.defaultRender=e),this.ignoreTags=i}p0.prototype={o:bu,ignoreTags:[],defaultRender(t){return t},check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const r=e!=null;let i=this.o[t];return i&&(typeof i=="object"?(i=n.t in i?i[n.t]:bu[t],typeof i=="function"&&r&&(i=i(e,n))):typeof i=="function"&&r&&(i=i(e,n.t,n)),i)},getObj(t,e,n){let r=this.o[t];return typeof r=="function"&&e!=null&&(r=r(e,n.t,n)),r},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}};function vT(t){return t}function KC(t,e){this.t="token",this.v=t,this.tk=e}KC.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),r=t.get("format",e,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t=bu.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),i=t.get("tagName",n,e),o=this.toFormattedString(t),l={},c=t.get("className",n,e),d=t.get("target",n,e),f=t.get("rel",n,e),p=t.getObj("attributes",n,e),m=t.getObj("events",n,e);return l.href=r,c&&(l.class=c),d&&(l.target=d),f&&(l.rel=f),p&&Object.assign(l,p),{tagName:i,attributes:l,content:o,eventListeners:m}}};function Xf(t,e){class n extends KC{constructor(i,o){super(i,o),this.t=t}}for(const r in e)n.prototype[r]=e[r];return n.t=t,n}const ST=Xf("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),wT=Xf("text"),yq=Xf("nl"),pd=Xf("url",{isLink:!0,toHref(t=bu.defaultProtocol){return this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==gu&&t[1].t===Qi}}),nr=t=>new Dn(t);function gq({groups:t}){const e=t.domain.concat([yf,bf,Ki,vf,Sf,wf,_f,Tf,ir,l0,$l,Ef,Mf,xf,Or,kf,Hl,Cf]),n=[gf,Qi,c0,Ar,d0,$l,Fl,f0,h0,of,af,Ul,ql,nf,tf,rf,sf,lf,uf,cf,df,ff,hf,pf,mf],r=[yf,gf,bf,vf,Sf,wf,_f,Tf,ir,Ul,ql,$l,Ef,Mf,xf,Fl,Or,kf,Hl,Cf],i=nr(),o=de(i,Hl);Fe(o,r,o),Fe(o,t.domain,o);const l=nr(),c=nr(),d=nr();Fe(i,t.domain,l),Fe(i,t.scheme,c),Fe(i,t.slashscheme,d),Fe(l,r,o),Fe(l,t.domain,l);const f=de(l,Ki);de(o,Ki,f),de(c,Ki,f),de(d,Ki,f);const p=de(o,Ar);Fe(p,r,o),Fe(p,t.domain,o);const m=nr();Fe(f,t.domain,m),Fe(m,t.domain,m);const y=de(m,Ar);Fe(y,t.domain,m);const b=nr(ST);Fe(y,t.tld,b),Fe(y,t.utld,b),de(f,gu,b);const S=de(m,ir);de(S,ir,S),Fe(S,t.domain,m),Fe(b,t.domain,m),de(b,Ar,y),de(b,ir,S);const w=de(b,Qi);Fe(w,t.numeric,ST);const T=de(l,ir),M=de(l,Ar);de(T,ir,T),Fe(T,t.domain,l),Fe(M,r,o),Fe(M,t.domain,l);const k=nr(pd);Fe(M,t.tld,k),Fe(M,t.utld,k),Fe(k,t.domain,l),Fe(k,r,o),de(k,Ar,M),de(k,ir,T),de(k,Ki,f);const j=de(k,Qi),I=nr(pd);Fe(j,t.numeric,I);const O=nr(pd),P=nr();Fe(O,e,O),Fe(O,n,P),Fe(P,e,O),Fe(P,n,P),de(k,Or,O),de(I,Or,O);const A=de(c,Qi),U=de(d,Qi),H=de(U,Or),se=de(H,Or);Fe(c,t.domain,l),de(c,Ar,M),de(c,ir,T),Fe(d,t.domain,l),de(d,Ar,M),de(d,ir,T),Fe(A,t.domain,O),de(A,Or,O),de(A,Fl,O),Fe(se,t.domain,O),Fe(se,e,O),de(se,Or,O);const re=[[Ul,ql],[tf,nf],[rf,sf],[of,af],[lf,uf],[cf,df],[ff,hf],[pf,mf]];for(let te=0;te<re.length;te++){const[Z,G]=re[te],fe=de(O,Z);de(P,Z,fe),de(fe,G,O);const R=nr(pd);Fe(fe,e,R);const $=nr();Fe(fe,n),Fe(R,e,R),Fe(R,n,$),Fe($,e,R),Fe($,n,$),de(R,G,O),de($,G,O)}return de(i,gu,k),de(i,u0,yq),{start:i,tokens:HC}}function bq(t,e,n){let r=n.length,i=0,o=[],l=[];for(;i<r;){let c=t,d=null,f=null,p=0,m=null,y=-1;for(;i<r&&!(d=c.go(n[i].t));)l.push(n[i++]);for(;i<r&&(f=d||c.go(n[i].t));)d=null,c=f,c.accepts()?(y=0,m=c):y>=0&&y++,i++,p++;if(y<0)i-=p,i<r&&(l.push(n[i]),i++);else{l.length>0&&(o.push(iy(wT,e,l)),l=[]),i-=y,p-=y;const b=m.t,S=n.slice(i-p,i);o.push(iy(b,e,S))}}return l.length>0&&o.push(iy(wT,e,l)),o}function iy(t,e,n){const r=n[0].s,i=n[n.length-1].e,o=e.slice(r,i);return new t(o,n)}const vq=typeof console<"u"&&console&&console.warn||(()=>{}),Sq="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",xt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function wq(){return Dn.groups={},xt.scanner=null,xt.parser=null,xt.tokenQueue=[],xt.pluginQueue=[],xt.customSchemes=[],xt.initialized=!1,xt}function _T(t,e=!1){if(xt.initialized&&vq(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Sq}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format.
142
+ 1. Must only contain digits, lowercase ASCII letters or "-"
143
+ 2. Cannot start or end with "-"
144
+ 3. "-" cannot repeat`);xt.customSchemes.push([t,e])}function _q(){xt.scanner=pq(xt.customSchemes);for(let t=0;t<xt.tokenQueue.length;t++)xt.tokenQueue[t][1]({scanner:xt.scanner});xt.parser=gq(xt.scanner.tokens);for(let t=0;t<xt.pluginQueue.length;t++)xt.pluginQueue[t][1]({scanner:xt.scanner,parser:xt.parser});return xt.initialized=!0,xt}function m0(t){return xt.initialized||_q(),bq(xt.parser.start,t,VC(xt.scanner.start,t))}m0.scan=VC;function GC(t,e=null,n=null){if(e&&typeof e=="object"){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const r=new p0(n),i=m0(t),o=[];for(let l=0;l<i.length;l++){const c=i[l];c.isLink&&(!e||c.t===e)&&r.check(c)&&o.push(c.toFormattedObject(r))}return o}var y0="[\0-   ᠎ -\u2029  ]",Tq=new RegExp(y0),Eq=new RegExp(`${y0}$`),Mq=new RegExp(y0,"g");function xq(t){return t.length===1?t[0].isLink:t.length===3&&t[1].isLink?["()","[]"].includes(t[0].value+t[2].value):!1}function Cq(t){return new Ot({key:new Pt("autolink"),appendTransaction:(e,n,r)=>{const i=e.some(f=>f.docChanged)&&!n.doc.eq(r.doc),o=e.some(f=>f.getMeta("preventAutolink"));if(!i||o)return;const{tr:l}=r,c=sC(n.doc,[...e]);if(fC(c).forEach(({newRange:f})=>{const p=SP(r.doc,f,b=>b.isTextblock);let m,y;if(p.length>1)m=p[0],y=r.doc.textBetween(m.pos,m.pos+m.node.nodeSize,void 0," ");else if(p.length){const b=r.doc.textBetween(f.from,f.to," "," ");if(!Eq.test(b))return;m=p[0],y=r.doc.textBetween(m.pos,f.to,void 0," ")}if(m&&y){const b=y.split(Tq).filter(Boolean);if(b.length<=0)return!1;const S=b[b.length-1],w=m.pos+y.lastIndexOf(S);if(!S)return!1;const T=m0(S).map(M=>M.toObject(t.defaultProtocol));if(!xq(T))return!1;T.filter(M=>M.isLink).map(M=>({...M,from:w+M.start+1,to:w+M.end+1})).filter(M=>r.schema.marks.code?!r.doc.rangeHasMark(M.from,M.to,r.schema.marks.code):!0).filter(M=>t.validate(M.value)).filter(M=>t.shouldAutoLink(M.value)).forEach(M=>{n0(M.from,M.to,r.doc).some(k=>k.mark.type===t.type)||l.addMark(M.from,M.to,t.type.create({href:M.href}))})}}),!!l.steps.length)return l}})}function kq(t){return new Ot({key:new Pt("handleClickLink"),props:{handleClick:(e,n,r)=>{var i,o;if(r.button!==0||!e.editable)return!1;let l=null;if(r.target instanceof HTMLAnchorElement)l=r.target;else{const d=r.target;if(!d)return!1;const f=t.editor.view.dom;l=d.closest("a"),l&&!f.contains(l)&&(l=null)}if(!l)return!1;let c=!1;if(t.enableClickSelection&&(c=t.editor.commands.extendMarkRange(t.type.name)),t.openOnClick){const d=dC(e.state,t.type.name),f=(i=l.href)!=null?i:d.href,p=(o=l.target)!=null?o:d.target;f&&(window.open(f,p),c=!0)}return c}}})}function Aq(t){return new Ot({key:new Pt("handlePasteLink"),props:{handlePaste:(e,n,r)=>{const{shouldAutoLink:i}=t,{state:o}=e,{selection:l}=o,{empty:c}=l;if(c)return!1;let d="";r.content.forEach(p=>{d+=p.textContent});const f=GC(d,{defaultProtocol:t.defaultProtocol}).find(p=>p.isLink&&p.value===d);return!d||!f||i!==void 0&&!i(f.value)?!1:t.editor.commands.setMark(t.type,{href:f.href})}}})}function Rs(t,e){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(r=>{const i=typeof r=="string"?r:r.scheme;i&&n.push(i)}),!t||t.replace(Mq,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Oq=no.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(t=>{if(typeof t=="string"){_T(t);return}_T(t.scheme,t.optionalSlashes)})},onDestroy(){wq()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(t,e)=>!!Rs(t,e.protocols),validate:t=>!!t,shouldAutoLink:t=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(t),n=/^[a-z][a-z0-9+.-]*:/i.test(t);if(e||n&&!t.includes("@"))return!0;const i=(t.includes("@")?t.split("@").pop():t).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(i)||!/\./.test(i))}}},addAttributes(){return{href:{default:null,parseHTML(t){return t.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:t=>{const e=t.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:n=>!!Rs(n,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:t}){return this.options.isAllowedUri(t.href,{defaultValidate:e=>!!Rs(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",At(this.options.HTMLAttributes,t),0]:["a",At(this.options.HTMLAttributes,{...t,href:""}),0]},markdownTokenName:"link",parseMarkdown:(t,e)=>e.applyMark("link",e.parseInline(t.tokens||[]),{href:t.href,title:t.title||null}),renderMarkdown:(t,e)=>{var n,r,i,o;const l=(r=(n=t.attrs)==null?void 0:n.href)!=null?r:"",c=(o=(i=t.attrs)==null?void 0:i.title)!=null?o:"",d=e.renderChildren(t);return c?`[${d}](${l} "${c}")`:`[${d}](${l})`},addCommands(){return{setLink:t=>({chain:e})=>{const{href:n}=t;return this.options.isAllowedUri(n,{defaultValidate:r=>!!Rs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,t).setMeta("preventAutolink",!0).run():!1},toggleLink:t=>({chain:e})=>{const{href:n}=t||{};return n&&!this.options.isAllowedUri(n,{defaultValidate:r=>!!Rs(r,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[eo({find:t=>{const e=[];if(t){const{protocols:n,defaultProtocol:r}=this.options,i=GC(t).filter(o=>o.isLink&&this.options.isAllowedUri(o.value,{defaultValidate:l=>!!Rs(l,n),protocols:n,defaultProtocol:r}));i.length&&i.forEach(o=>{this.options.shouldAutoLink(o.value)&&e.push({text:o.value,data:{href:o.href},index:o.start})})}return e},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[],{protocols:e,defaultProtocol:n}=this.options;return this.options.autolink&&t.push(Cq({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:r=>this.options.isAllowedUri(r,{defaultValidate:i=>!!Rs(i,e),protocols:e,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink})),t.push(kq({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&t.push(Aq({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),t}}),Nq=Object.defineProperty,Rq=(t,e)=>{for(var n in e)Nq(t,n,{get:e[n],enumerable:!0})},Dq="listItem",TT="textStyle",ET=/^\s*([-+*])\s$/,YC=_n.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",At(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>t.type!=="list"||t.ordered?[]:{type:"bulletList",content:t.items?e.parseChildren(t.items):[]},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
145
+ `):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Dq,this.editor.getAttributes(TT)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=Ta({find:ET,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ta({find:ET,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(TT),editor:this.editor})),[t]}}),QC=_n.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",At(this.options.HTMLAttributes,t),0]},markdownTokenName:"list_item",parseMarkdown:(t,e)=>{if(t.type!=="list_item")return[];let n=[];if(t.tokens&&t.tokens.length>0)if(t.tokens.some(i=>i.type==="paragraph"))n=e.parseChildren(t.tokens);else{const i=t.tokens[0];if(i&&i.type==="text"&&i.tokens&&i.tokens.length>0){if(n=[{type:"paragraph",content:e.parseInline(i.tokens)}],t.tokens.length>1){const l=t.tokens.slice(1),c=e.parseChildren(l);n.push(...c)}}else n=e.parseChildren(t.tokens)}return n.length===0&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(t,e,n)=>o0(t,e,r=>{var i,o;return r.parentType==="bulletList"?"- ":r.parentType==="orderedList"?`${(((o=(i=r.meta)==null?void 0:i.parentAttrs)==null?void 0:o.start)||1)+r.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Iq={};Rq(Iq,{findListItemPos:()=>xu,getNextListDepth:()=>g0,handleBackspace:()=>bg,handleDelete:()=>vg,hasListBefore:()=>XC,hasListItemAfter:()=>Lq,hasListItemBefore:()=>JC,listItemHasSubList:()=>WC,nextListIsDeeper:()=>ZC,nextListIsHigher:()=>ek});var xu=(t,e)=>{const{$from:n}=e.selection,r=Kt(t,e.schema);let i=null,o=n.depth,l=n.pos,c=null;for(;o>0&&c===null;)i=n.node(o),i.type===r?c=o:(o-=1,l-=1);return c===null?null:{$pos:e.doc.resolve(l),depth:c}},g0=(t,e)=>{const n=xu(t,e);if(!n)return!1;const[,r]=OP(e,t,n.$pos.pos+4);return r},XC=(t,e,n)=>{const{$anchor:r}=t.selection,i=Math.max(0,r.pos-2),o=t.doc.resolve(i).node();return!(!o||!n.includes(o.type.name))},JC=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-2);return!(i.index()===0||((n=i.nodeBefore)==null?void 0:n.type.name)!==t)},WC=(t,e,n)=>{if(!n)return!1;const r=Kt(t,e.schema);let i=!1;return n.descendants(o=>{o.type===r&&(i=!0)}),i},bg=(t,e,n)=>{if(t.commands.undoInputRule())return!0;if(t.state.selection.from!==t.state.selection.to)return!1;if(!as(t.state,e)&&XC(t.state,e,n)){const{$anchor:c}=t.state.selection,d=t.state.doc.resolve(c.before()-1),f=[];d.node().descendants((y,b)=>{y.type.name===e&&f.push({node:y,pos:b})});const p=f.at(-1);if(!p)return!1;const m=t.state.doc.resolve(d.start()+p.pos+1);return t.chain().cut({from:c.start()-1,to:c.end()+1},m.end()).joinForward().run()}if(!as(t.state,e)||!IP(t.state))return!1;const r=xu(e,t.state);if(!r)return!1;const o=t.state.doc.resolve(r.$pos.pos-2).node(r.depth),l=WC(e,t.state,o);return JC(e,t.state)&&!l?t.commands.joinItemBackward():t.chain().liftListItem(e).run()},ZC=(t,e)=>{const n=g0(t,e),r=xu(t,e);return!r||!n?!1:n>r.depth},ek=(t,e)=>{const n=g0(t,e),r=xu(t,e);return!r||!n?!1:n<r.depth},vg=(t,e)=>{if(!as(t.state,e)||!DP(t.state,e))return!1;const{selection:n}=t.state,{$from:r,$to:i}=n;return!n.empty&&r.sameParent(i)?!1:ZC(e,t.state)?t.chain().focus(t.state.selection.from+4).lift(e).joinBackward().run():ek(e,t.state)?t.chain().joinForward().joinBackward().run():t.commands.joinItemForward()},Lq=(t,e)=>{var n;const{$anchor:r}=e.selection,i=e.doc.resolve(r.pos-r.parentOffset-2);return!(i.index()===i.parent.childCount-1||((n=i.nodeAfter)==null?void 0:n.type.name)!==t)},tk=jt.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vg(t,n)&&(e=!0)}),e},"Mod-Delete":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n})=>{t.state.schema.nodes[n]!==void 0&&vg(t,n)&&(e=!0)}),e},Backspace:({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&bg(t,n,r)&&(e=!0)}),e},"Mod-Backspace":({editor:t})=>{let e=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{t.state.schema.nodes[n]!==void 0&&bg(t,n,r)&&(e=!0)}),e}}}}),MT=/^(\s*)(\d+)\.\s+(.*)$/,jq=/^\s/;function Bq(t){const e=[];let n=0,r=0;for(;n<t.length;){const i=t[n],o=i.match(MT);if(!o)break;const[,l,c,d]=o,f=l.length;let p=d,m=n+1;const y=[i];for(;m<t.length;){const b=t[m];if(b.match(MT))break;if(b.trim()==="")y.push(b),p+=`
146
+ `,m+=1;else if(b.match(jq))y.push(b),p+=`
147
+ ${b.slice(f+2)}`,m+=1;else break}e.push({indent:f,number:parseInt(c,10),content:p.trim(),raw:y.join(`
148
+ `)}),r=m,n=m}return[e,r]}function nk(t,e,n){var r;const i=[];let o=0;for(;o<t.length;){const l=t[o];if(l.indent===e){const c=l.content.split(`
149
+ `),d=((r=c[0])==null?void 0:r.trim())||"",f=[];d&&f.push({type:"paragraph",raw:d,tokens:n.inlineTokens(d)});const p=c.slice(1).join(`
150
+ `).trim();if(p){const b=n.blockTokens(p);f.push(...b)}let m=o+1;const y=[];for(;m<t.length&&t[m].indent>e;)y.push(t[m]),m+=1;if(y.length>0){const b=Math.min(...y.map(w=>w.indent)),S=nk(y,b,n);f.push({type:"list",ordered:!0,start:y[0].number,items:S,raw:y.map(w=>w.raw).join(`
151
+ `)})}i.push({type:"list_item",raw:l.raw,tokens:f}),o=m}else o+=1}return i}function zq(t,e){return t.map(n=>{if(n.type!=="list_item")return e.parseChildren([n])[0];const r=[];return n.tokens&&n.tokens.length>0&&n.tokens.forEach(i=>{if(i.type==="paragraph"||i.type==="list"||i.type==="blockquote"||i.type==="code")r.push(...e.parseChildren([i]));else if(i.type==="text"&&i.tokens){const o=e.parseChildren([i]);r.push({type:"paragraph",content:o})}else{const o=e.parseChildren([i]);o.length>0&&r.push(...o)}}),{type:"listItem",content:r}})}var Pq="listItem",xT="textStyle",CT=/^(\d+)\.\s$/,rk=_n.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:null,parseHTML:t=>t.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return e===1?["ol",At(this.options.HTMLAttributes,n),0]:["ol",At(this.options.HTMLAttributes,t),0]},markdownTokenName:"list",parseMarkdown:(t,e)=>{if(t.type!=="list"||!t.ordered)return[];const n=t.start||1,r=t.items?zq(t.items,e):[];return n!==1?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
152
+ `):"",markdownTokenizer:{name:"orderedList",level:"block",start:t=>{const e=t.match(/^(\s*)(\d+)\.\s+/),n=e?.index;return n!==void 0?n:-1},tokenize:(t,e,n)=>{var r;const i=t.split(`
153
+ `),[o,l]=Bq(i);if(o.length===0)return;const c=nk(o,0,n);return c.length===0?void 0:{type:"list",ordered:!0,start:((r=o[0])==null?void 0:r.number)||1,items:c,raw:i.slice(0,l).join(`
154
+ `)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Pq,this.editor.getAttributes(xT)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=Ta({find:CT,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=Ta({find:CT,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(xT)}),joinPredicate:(e,n)=>n.childCount+n.attrs.start===+e[1],editor:this.editor})),[t]}}),Uq=/^\s*(\[([( |x])?\])\s$/,qq=_n.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return e===""||e==="true"},renderHTML:t=>({"data-checked":t.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",At(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(t,e)=>{const n=[];if(t.tokens&&t.tokens.length>0?n.push(e.createNode("paragraph",{},e.parseInline(t.tokens))):t.text?n.push(e.createNode("paragraph",{},[e.createNode("text",{text:t.text})])):n.push(e.createNode("paragraph",{},[])),t.nestedTokens&&t.nestedTokens.length>0){const r=e.parseChildren(t.nestedTokens);n.push(...r)}return e.createNode("taskItem",{checked:t.checked||!1},n)},renderMarkdown:(t,e)=>{var n;const i=`- [${(n=t.attrs)!=null&&n.checked?"x":" "}] `;return o0(t,e,i)},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:r})=>{const i=document.createElement("li"),o=document.createElement("label"),l=document.createElement("span"),c=document.createElement("input"),d=document.createElement("div"),f=m=>{var y,b;c.ariaLabel=((b=(y=this.options.a11y)==null?void 0:y.checkboxLabel)==null?void 0:b.call(y,m,c.checked))||`Task item checkbox for ${m.textContent||"empty task item"}`};f(t),o.contentEditable="false",c.type="checkbox",c.addEventListener("mousedown",m=>m.preventDefault()),c.addEventListener("change",m=>{if(!r.isEditable&&!this.options.onReadOnlyChecked){c.checked=!c.checked;return}const{checked:y}=m.target;r.isEditable&&typeof n=="function"&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:b})=>{const S=n();if(typeof S!="number")return!1;const w=b.doc.nodeAt(S);return b.setNodeMarkup(S,void 0,{...w?.attrs,checked:y}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,y)||(c.checked=!c.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([m,y])=>{i.setAttribute(m,y)}),i.dataset.checked=t.attrs.checked,c.checked=t.attrs.checked,o.append(c,l),i.append(o,d),Object.entries(e).forEach(([m,y])=>{i.setAttribute(m,y)});let p=new Set(Object.keys(e));return{dom:i,contentDOM:d,update:m=>{if(m.type!==this.type)return!1;i.dataset.checked=m.attrs.checked,c.checked=m.attrs.checked,f(m);const y=r.extensionManager.attributes,b=wa(m,y),S=new Set(Object.keys(b)),w=this.options.HTMLAttributes;return p.forEach(T=>{S.has(T)||(T in w?i.setAttribute(T,w[T]):i.removeAttribute(T))}),Object.entries(b).forEach(([T,M])=>{M==null?T in w?i.setAttribute(T,w[T]):i.removeAttribute(T):i.setAttribute(T,M)}),p=S,!0}}}},addInputRules(){return[Ta({find:Uq,type:this.type,getAttributes:t=>({checked:t[t.length-1]==="x"})})]}}),$q=_n.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",At(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},parseMarkdown:(t,e)=>e.createNode("taskList",{},e.parseChildren(t.items||[])),renderMarkdown:(t,e)=>t.content?e.renderChildren(t.content,`
155
+ `):"",markdownTokenizer:{name:"taskList",level:"block",start(t){var e;const n=(e=t.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return n!==void 0?n:-1},tokenize(t,e,n){const r=o=>{const l=lg(o,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:c=>({indentLevel:c[1].length,mainContent:c[4],checked:c[3].toLowerCase()==="x"}),createToken:(c,d)=>({type:"taskItem",raw:"",mainContent:c.mainContent,indentLevel:c.indentLevel,checked:c.checked,text:c.mainContent,tokens:n.inlineTokens(c.mainContent),nestedTokens:d}),customNestedParser:r},n);return l?[{type:"taskList",raw:l.raw,items:l.items}]:n.blockTokens(o)},i=lg(t,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:o=>({indentLevel:o[1].length,mainContent:o[4],checked:o[3].toLowerCase()==="x"}),createToken:(o,l)=>({type:"taskItem",raw:"",mainContent:o.mainContent,indentLevel:o.indentLevel,checked:o.checked,text:o.mainContent,tokens:n.inlineTokens(o.mainContent),nestedTokens:l}),customNestedParser:r},n);if(i)return{type:"taskList",raw:i.raw,items:i.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});jt.create({name:"listKit",addExtensions(){const t=[];return this.options.bulletList!==!1&&t.push(YC.configure(this.options.bulletList)),this.options.listItem!==!1&&t.push(QC.configure(this.options.listItem)),this.options.listKeymap!==!1&&t.push(tk.configure(this.options.listKeymap)),this.options.orderedList!==!1&&t.push(rk.configure(this.options.orderedList)),this.options.taskItem!==!1&&t.push(qq.configure(this.options.taskItem)),this.options.taskList!==!1&&t.push($q.configure(this.options.taskList)),t}});var kT="&nbsp;",Fq=" ",Hq=_n.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",At(this.options.HTMLAttributes,t),0]},parseMarkdown:(t,e)=>{const n=t.tokens||[];if(n.length===1&&n[0].type==="image")return e.parseChildren([n[0]]);const r=e.parseInline(n);return r.length===1&&r[0].type==="text"&&(r[0].text===kT||r[0].text===Fq)?e.createNode("paragraph",void 0,[]):e.createNode("paragraph",void 0,r)},renderMarkdown:(t,e)=>{if(!t)return"";const n=Array.isArray(t.content)?t.content:[];return n.length===0?kT:e.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Vq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Kq=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Gq=no.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",At(this.options.HTMLAttributes,t),0]},markdownTokenName:"del",parseMarkdown:(t,e)=>e.applyMark("strike",e.parseInline(t.tokens||[])),renderMarkdown:(t,e)=>`~~${e.renderChildren(t)}~~`,addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[_a({find:Vq,type:this.type})]},addPasteRules(){return[eo({find:Kq,type:this.type})]}}),Yq=_n.create({name:"text",group:"inline",parseMarkdown:t=>({type:"text",text:t.text||""}),renderMarkdown:t=>t.text||""}),Qq=no.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["u",At(this.options.HTMLAttributes,t),0]},parseMarkdown(t,e){return e.applyMark(this.name||"underline",e.parseInline(t.tokens||[]))},renderMarkdown(t,e){return`++${e.renderChildren(t)}++`},markdownTokenizer:{name:"underline",level:"inline",start(t){return t.indexOf("++")},tokenize(t,e,n){const i=/^(\+\+)([\s\S]+?)(\+\+)/.exec(t);if(!i)return;const o=i[2].trim();return{type:"underline",raw:i[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:t})=>t.setMark(this.name),toggleUnderline:()=>({commands:t})=>t.toggleMark(this.name),unsetUnderline:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}});function Xq(t={}){return new Ot({view(e){return new Jq(e,t)}})}class Jq{constructor(e,n){var r;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=n.width)!==null&&r!==void 0?r:1,this.color=n.color===!1?void 0:n.color||"black",this.class=n.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=l=>{this[i](l)};return e.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:e,handler:n})=>this.editorView.dom.removeEventListener(e,n))}update(e,n){this.cursorPos!=null&&n.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent,r,i=this.editorView.dom,o=i.getBoundingClientRect(),l=o.width/i.offsetWidth,c=o.height/i.offsetHeight;if(n){let m=e.nodeBefore,y=e.nodeAfter;if(m||y){let b=this.editorView.nodeDOM(this.cursorPos-(m?m.nodeSize:0));if(b){let S=b.getBoundingClientRect(),w=m?S.bottom:S.top;m&&y&&(w=(w+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let T=this.width/2*c;r={left:S.left,right:S.right,top:w-T,bottom:w+T}}}}if(!r){let m=this.editorView.coordsAtPos(this.cursorPos),y=this.width/2*l;r={left:m.left-y,right:m.left+y,top:m.top,bottom:m.bottom}}let d=this.editorView.dom.offsetParent;this.element||(this.element=d.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n);let f,p;if(!d||d==document.body&&getComputedStyle(d).position=="static")f=-pageXOffset,p=-pageYOffset;else{let m=d.getBoundingClientRect(),y=m.width/d.offsetWidth,b=m.height/d.offsetHeight;f=m.left-d.scrollLeft*y,p=m.top-d.scrollTop*b}this.element.style.left=(r.left-f)/l+"px",this.element.style.top=(r.top-p)/c+"px",this.element.style.width=(r.right-r.left)/l+"px",this.element.style.height=(r.bottom-r.top)/c+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let n=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),r=n&&n.inside>=0&&this.editorView.state.doc.nodeAt(n.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,n,e):i;if(n&&!o){let l=n.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let c=XM(this.editorView.state.doc,l,this.editorView.dragging.slice);c!=null&&(l=c)}this.setCursor(l),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Lt extends He{constructor(e){super(e,e)}map(e,n){let r=e.resolve(n.map(this.head));return Lt.valid(r)?new Lt(r):He.near(r)}content(){return ge.empty}eq(e){return e instanceof Lt&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,n){if(typeof n.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new Lt(e.resolve(n.pos))}getBookmark(){return new b0(this.anchor)}static valid(e){let n=e.parent;if(n.isTextblock||!Wq(e)||!Zq(e))return!1;let r=n.type.spec.allowGapCursor;if(r!=null)return r;let i=n.contentMatchAt(e.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(e,n,r=!1){e:for(;;){if(!r&&Lt.valid(e))return e;let i=e.pos,o=null;for(let l=e.depth;;l--){let c=e.node(l);if(n>0?e.indexAfter(l)<c.childCount:e.index(l)>0){o=c.child(n>0?e.indexAfter(l):e.index(l)-1);break}else if(l==0)return null;i+=n;let d=e.doc.resolve(i);if(Lt.valid(d))return d}for(;;){let l=n>0?o.firstChild:o.lastChild;if(!l){if(o.isAtom&&!o.isText&&!Ae.isSelectable(o)){e=e.doc.resolve(i+o.nodeSize*n),r=!1;continue e}break}o=l,i+=n;let c=e.doc.resolve(i);if(Lt.valid(c))return c}return null}}}Lt.prototype.visible=!1;Lt.findFrom=Lt.findGapCursorFrom;He.jsonID("gapcursor",Lt);class b0{constructor(e){this.pos=e}map(e){return new b0(e.map(this.pos))}resolve(e){let n=e.resolve(this.pos);return Lt.valid(n)?new Lt(n):He.near(n)}}function ik(t){return t.isAtom||t.spec.isolating||t.spec.createGapCursor}function Wq(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),r=t.node(e);if(n==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||ik(i.type))return!0;if(i.inlineContent)return!1}}return!0}function Zq(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),r=t.node(e);if(n==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(n);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||ik(i.type))return!0;if(i.inlineContent)return!1}}return!0}function e8(){return new Ot({props:{decorations:i8,createSelectionBetween(t,e,n){return e.pos==n.pos&&Lt.valid(n)?new Lt(n):null},handleClick:n8,handleKeyDown:t8,handleDOMEvents:{beforeinput:r8}}})}const t8=Jx({ArrowLeft:md("horiz",-1),ArrowRight:md("horiz",1),ArrowUp:md("vert",-1),ArrowDown:md("vert",1)});function md(t,e){const n=t=="vert"?e>0?"down":"up":e>0?"right":"left";return function(r,i,o){let l=r.selection,c=e>0?l.$to:l.$from,d=l.empty;if(l instanceof Pe){if(!o.endOfTextblock(n)||c.depth==0)return!1;d=!1,c=r.doc.resolve(e>0?c.after():c.before())}let f=Lt.findGapCursorFrom(c,e,d);return f?(i&&i(r.tr.setSelection(new Lt(f))),!0):!1}}function n8(t,e,n){if(!t||!t.editable)return!1;let r=t.state.doc.resolve(e);if(!Lt.valid(r))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&Ae.isSelectable(t.state.doc.nodeAt(i.inside))?!1:(t.dispatch(t.state.tr.setSelection(new Lt(r))),!0)}function r8(t,e){if(e.inputType!="insertCompositionText"||!(t.state.selection instanceof Lt))return!1;let{$from:n}=t.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!r)return!1;let i=oe.empty;for(let l=r.length-1;l>=0;l--)i=oe.from(r[l].createAndFill(null,i));let o=t.state.tr.replace(n.pos,n.pos,new ge(i,0,0));return o.setSelection(Pe.near(o.doc.resolve(n.pos+1))),t.dispatch(o),!1}function i8(t){if(!(t.selection instanceof Lt))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",kt.create(t.doc,[mn.widget(t.selection.head,e,{key:"gapcursor"})])}var Af=200,tn=function(){};tn.prototype.append=function(e){return e.length?(e=tn.from(e),!this.length&&e||e.length<Af&&this.leafAppend(e)||this.length<Af&&e.leafPrepend(this)||this.appendInner(e)):this};tn.prototype.prepend=function(e){return e.length?tn.from(e).append(this):this};tn.prototype.appendInner=function(e){return new s8(this,e)};tn.prototype.slice=function(e,n){return e===void 0&&(e=0),n===void 0&&(n=this.length),e>=n?tn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};tn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};tn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};tn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,l){return i.push(e(o,l))},n,r),i};tn.from=function(e){return e instanceof tn?e:e&&e.length?new sk(e):tn.empty};var sk=(function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new e(this.values.slice(i,o))},e.prototype.getInner=function(i){return this.values[i]},e.prototype.forEachInner=function(i,o,l,c){for(var d=o;d<l;d++)if(i(this.values[d],c+d)===!1)return!1},e.prototype.forEachInvertedInner=function(i,o,l,c){for(var d=o-1;d>=l;d--)if(i(this.values[d],c+d)===!1)return!1},e.prototype.leafAppend=function(i){if(this.length+i.length<=Af)return new e(this.values.concat(i.flatten()))},e.prototype.leafPrepend=function(i){if(this.length+i.length<=Af)return new e(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e})(tn);tn.empty=new sk([]);var s8=(function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},e.prototype.forEachInner=function(r,i,o,l){var c=this.left.length;if(i<c&&this.left.forEachInner(r,i,Math.min(o,c),l)===!1||o>c&&this.right.forEachInner(r,Math.max(i-c,0),Math.min(this.length,o)-c,l+c)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,o,l){var c=this.left.length;if(i>c&&this.right.forEachInvertedInner(r,i-c,Math.max(o,c)-c,l+c)===!1||o<c&&this.left.forEachInvertedInner(r,Math.min(i,c),o,l)===!1)return!1},e.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},e.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new e(this.left,i)},e.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new e(i,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e})(tn);const o8=500;class br{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;n&&(i=this.remapping(r,this.items.length),o=i.maps.length);let l=e.tr,c,d,f=[],p=[];return this.items.forEach((m,y)=>{if(!m.step){i||(i=this.remapping(r,y+1),o=i.maps.length),o--,p.push(m);return}if(i){p.push(new $i(m.map));let b=m.step.map(i.slice(o)),S;b&&l.maybeStep(b).doc&&(S=l.mapping.maps[l.mapping.maps.length-1],f.push(new $i(S,void 0,void 0,f.length+p.length))),o--,S&&i.appendMap(S,o)}else l.maybeStep(m.step);if(m.selection)return c=i?m.selection.map(i.slice(o)):m.selection,d=new br(this.items.slice(0,r).append(p.reverse().concat(f)),this.eventCount-1),!1},this.items.length,0),{remaining:d,transform:l,selection:c}}addTransform(e,n,r,i){let o=[],l=this.eventCount,c=this.items,d=!i&&c.length?c.get(c.length-1):null;for(let p=0;p<e.steps.length;p++){let m=e.steps[p].invert(e.docs[p]),y=new $i(e.mapping.maps[p],m,n),b;(b=d&&d.merge(y))&&(y=b,p?o.pop():c=c.slice(0,c.length-1)),o.push(y),n&&(l++,n=void 0),i||(d=y)}let f=l-r.depth;return f>l8&&(c=a8(c,f),l-=f),new br(c.append(o),l)}remapping(e,n){let r=new cu;return this.items.forEach((i,o)=>{let l=i.mirrorOffset!=null&&o-i.mirrorOffset>=e?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,l)},e,n),r}addMaps(e){return this.eventCount==0?this:new br(this.items.append(e.map(n=>new $i(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),o=e.mapping,l=e.steps.length,c=this.eventCount;this.items.forEach(y=>{y.selection&&c--},i);let d=n;this.items.forEach(y=>{let b=o.getMirror(--d);if(b==null)return;l=Math.min(l,b);let S=o.maps[b];if(y.step){let w=e.steps[b].invert(e.docs[b]),T=y.selection&&y.selection.map(o.slice(d+1,b));T&&c++,r.push(new $i(S,w,T))}else r.push(new $i(S))},i);let f=[];for(let y=n;y<l;y++)f.push(new $i(o.maps[y]));let p=this.items.slice(0,i).append(f).append(r),m=new br(p,c);return m.emptyItemCount()>o8&&(m=m.compress(this.items.length-r.length)),m}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,i=[],o=0;return this.items.forEach((l,c)=>{if(c>=e)i.push(l),l.selection&&o++;else if(l.step){let d=l.step.map(n.slice(r)),f=d&&d.getMap();if(r--,f&&n.appendMap(f,r),d){let p=l.selection&&l.selection.map(n.slice(r));p&&o++;let m=new $i(f.invert(),d,p),y,b=i.length-1;(y=i.length&&i[b].merge(m))?i[b]=y:i.push(m)}}else l.map&&r--},this.items.length,0),new br(tn.from(i.reverse()),o)}}br.empty=new br(tn.empty,0);function a8(t,e){let n;return t.forEach((r,i)=>{if(r.selection&&e--==0)return n=i,!1}),t.slice(n)}let $i=class ok{constructor(e,n,r,i){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=i}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new ok(n.getMap().invert(),n,this.selection)}}};class Gi{constructor(e,n,r,i,o){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}}const l8=20;function u8(t,e,n,r){let i=n.getMeta(Ks),o;if(i)return i.historyState;n.getMeta(f8)&&(t=new Gi(t.done,t.undone,null,0,-1));let l=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(l&&l.getMeta(Ks))return l.getMeta(Ks).redo?new Gi(t.done.addTransform(n,void 0,r,Cd(e)),t.undone,AT(n.mapping.maps),t.prevTime,t.prevComposition):new Gi(t.done,t.undone.addTransform(n,void 0,r,Cd(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(l&&l.getMeta("addToHistory")===!1)){let c=n.getMeta("composition"),d=t.prevTime==0||!l&&t.prevComposition!=c&&(t.prevTime<(n.time||0)-r.newGroupDelay||!c8(n,t.prevRanges)),f=l?sy(t.prevRanges,n.mapping):AT(n.mapping.maps);return new Gi(t.done.addTransform(n,d?e.selection.getBookmark():void 0,r,Cd(e)),br.empty,f,n.time,c??t.prevComposition)}else return(o=n.getMeta("rebased"))?new Gi(t.done.rebased(n,o),t.undone.rebased(n,o),sy(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Gi(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),sy(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function c8(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<e.length;o+=2)r<=e[o+1]&&i>=e[o]&&(n=!0)}),n}function AT(t){let e=[];for(let n=t.length-1;n>=0&&e.length==0;n--)t[n].forEach((r,i,o,l)=>e.push(o,l));return e}function sy(t,e){if(!t)return null;let n=[];for(let r=0;r<t.length;r+=2){let i=e.map(t[r],1),o=e.map(t[r+1],-1);i<=o&&n.push(i,o)}return n}function d8(t,e,n){let r=Cd(e),i=Ks.get(e).spec.config,o=(n?t.undone:t.done).popEvent(e,r);if(!o)return null;let l=o.selection.resolve(o.transform.doc),c=(n?t.done:t.undone).addTransform(o.transform,e.selection.getBookmark(),i,r),d=new Gi(n?c:o.remaining,n?o.remaining:c,null,0,-1);return o.transform.setSelection(l).setMeta(Ks,{redo:n,historyState:d})}let oy=!1,OT=null;function Cd(t){let e=t.plugins;if(OT!=e){oy=!1,OT=e;for(let n=0;n<e.length;n++)if(e[n].spec.historyPreserveItems){oy=!0;break}}return oy}const Ks=new Pt("history"),f8=new Pt("closeHistory");function h8(t={}){return t={depth:t.depth||100,newGroupDelay:t.newGroupDelay||500},new Ot({key:Ks,state:{init(){return new Gi(br.empty,br.empty,null,0,-1)},apply(e,n,r){return u8(n,r,e,t)}},config:t,props:{handleDOMEvents:{beforeinput(e,n){let r=n.inputType,i=r=="historyUndo"?lk:r=="historyRedo"?uk:null;return!i||!e.editable?!1:(n.preventDefault(),i(e.state,e.dispatch))}}}})}function ak(t,e){return(n,r)=>{let i=Ks.getState(n);if(!i||(t?i.undone:i.done).eventCount==0)return!1;if(r){let o=d8(i,n,t);o&&r(e?o.scrollIntoView():o)}return!0}}const lk=ak(!1,!0),uk=ak(!0,!0);jt.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:t=>t.length,wordCounter:t=>t.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=t=>{const e=t?.node||this.editor.state.doc;if((t?.mode||this.options.mode)==="textSize"){const r=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(r)}return e.nodeSize},this.storage.words=t=>{const e=t?.node||this.editor.state.doc,n=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let t=!1;return[new Ot({key:new Pt("characterCount"),appendTransaction:(e,n,r)=>{if(t)return;const i=this.options.limit;if(i==null||i===0){t=!0;return}const o=this.storage.characters({node:r.doc});if(o>i){const l=o-i,c=0,d=l;console.warn(`[CharacterCount] Initial content exceeded limit of ${i} characters. Content was automatically trimmed.`);const f=r.tr.deleteRange(c,d);return t=!0,f}t=!0},filterTransaction:(e,n)=>{const r=this.options.limit;if(!e.docChanged||r===0||r===null||r===void 0)return!0;const i=this.storage.characters({node:n.doc}),o=this.storage.characters({node:e.doc});if(o<=r||i>r&&o>r&&o<=i)return!0;if(i>r&&o>r&&o>i||!e.getMeta("paste"))return!1;const c=e.selection.$head.pos,d=o-r,f=c-d,p=c;return e.deleteRange(f,p),!(this.storage.characters({node:e.doc})>r)}})]}});var p8=jt.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Xq(this.options)]}});jt.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new Ot({key:new Pt("focus"),props:{decorations:({doc:t,selection:e})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:i}=e,o=[];if(!n||!r)return kt.create(t,[]);let l=0;this.options.mode==="deepest"&&t.descendants((d,f)=>{if(d.isText)return;if(!(i>=f&&i<=f+d.nodeSize-1))return!1;l+=1});let c=0;return t.descendants((d,f)=>{if(d.isText||!(i>=f&&i<=f+d.nodeSize-1))return!1;if(c+=1,this.options.mode==="deepest"&&l-c>0||this.options.mode==="shallowest"&&c>1)return this.options.mode==="deepest";o.push(mn.node(f,f+d.nodeSize,{class:this.options.className}))}),kt.create(t,o)}}})]}});var m8=jt.create({name:"gapCursor",addProseMirrorPlugins(){return[e8()]},extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:(e=gt(ke(t,"allowGapCursor",n)))!=null?e:null}}}),NT="placeholder";function y8(t){return t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}var g8=jt.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:NT,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const t=this.options.dataAttribute?`data-${y8(this.options.dataAttribute)}`:`data-${NT}`;return[new Ot({key:new Pt("placeholder"),props:{decorations:({doc:e,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=n,o=[];if(!r)return null;const l=this.editor.isEmpty;return e.descendants((c,d)=>{const f=i>=d&&i<=d+c.nodeSize,p=!c.isLeaf&&Gf(c);if((f||!this.options.showOnlyCurrent)&&p){const m=[this.options.emptyNodeClass];l&&m.push(this.options.emptyEditorClass);const y=mn.node(d,d+c.nodeSize,{class:m.join(" "),[t]:typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:c,pos:d,hasAnchor:f}):this.options.placeholder});o.push(y)}return this.options.includeChildren}),kt.create(e,o)}}})]}});jt.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:t,options:e}=this;return[new Ot({key:new Pt("selection"),props:{decorations(n){return n.selection.empty||t.isFocused||!t.isEditable||hC(n.selection)||t.view.dragging?null:kt.create(n.doc,[mn.inline(n.selection.from,n.selection.to,{class:e.className})])}}})]}});function RT({types:t,node:e}){return e&&Array.isArray(t)&&t.includes(e.type)||e?.type===t}var b8=jt.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var t;const e=new Pt(this.name),n=this.options.node||((t=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:t.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,i])=>i).filter(i=>(this.options.notAfter||[]).concat(n).includes(i.name));return[new Ot({key:e,appendTransaction:(i,o,l)=>{const{doc:c,tr:d,schema:f}=l,p=e.getState(l),m=c.content.size,y=f.nodes[n];if(p)return d.insert(m,y.create())},state:{init:(i,o)=>{const l=o.tr.doc.lastChild;return!RT({node:l,types:r})},apply:(i,o)=>{if(!i.docChanged||i.getMeta("__uniqueIDTransaction"))return o;const l=i.doc.lastChild;return!RT({node:l,types:r})}}})]}}),v8=jt.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>lk(t,e),redo:()=>({state:t,dispatch:e})=>uk(t,e)}},addProseMirrorPlugins(){return[h8(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),S8=jt.create({name:"starterKit",addExtensions(){var t,e,n,r;const i=[];return this.options.bold!==!1&&i.push(H6.configure(this.options.bold)),this.options.blockquote!==!1&&i.push(P6.configure(this.options.blockquote)),this.options.bulletList!==!1&&i.push(YC.configure(this.options.bulletList)),this.options.code!==!1&&i.push(G6.configure(this.options.code)),this.options.codeBlock!==!1&&i.push(X6.configure(this.options.codeBlock)),this.options.document!==!1&&i.push(J6.configure(this.options.document)),this.options.dropcursor!==!1&&i.push(p8.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&i.push(m8.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&i.push(W6.configure(this.options.hardBreak)),this.options.heading!==!1&&i.push(Z6.configure(this.options.heading)),this.options.undoRedo!==!1&&i.push(v8.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&i.push(eq.configure(this.options.horizontalRule)),this.options.italic!==!1&&i.push(sq.configure(this.options.italic)),this.options.listItem!==!1&&i.push(QC.configure(this.options.listItem)),this.options.listKeymap!==!1&&i.push(tk.configure((t=this.options)==null?void 0:t.listKeymap)),this.options.link!==!1&&i.push(Oq.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&i.push(rk.configure(this.options.orderedList)),this.options.paragraph!==!1&&i.push(Hq.configure(this.options.paragraph)),this.options.strike!==!1&&i.push(Gq.configure(this.options.strike)),this.options.text!==!1&&i.push(Yq.configure(this.options.text)),this.options.underline!==!1&&i.push(Qq.configure((n=this.options)==null?void 0:n.underline)),this.options.trailingNode!==!1&&i.push(b8.configure((r=this.options)==null?void 0:r.trailingNode)),i}}),w8=S8,_8=g8;function T8(t){var e;const{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:c}=t,d=r&&!i,f=wU(n),p=new RegExp(`\\s${f}$`),m=l?"^":"",y=i?"":f,b=d?new RegExp(`${m}${f}.*?(?=\\s${y}|$)`,"gm"):new RegExp(`${m}(?:^)?${f}[^\\s${y}]*`,"gm"),S=((e=c.nodeBefore)==null?void 0:e.isText)&&c.nodeBefore.text;if(!S)return null;const w=c.pos-S.length,T=Array.from(S.matchAll(b)).pop();if(!T||T.input===void 0||T.index===void 0)return null;const M=T.input.slice(Math.max(0,T.index-1),T.index),k=new RegExp(`^[${o?.join("")}\0]?$`).test(M);if(o!==null&&!k)return null;const j=w+T.index;let I=j+T[0].length;return d&&p.test(S.slice(I-1,I+1))&&(T[0]+=" ",I+=1),j<c.pos&&I>=c.pos?{range:{from:j,to:I},query:T[0].slice(n.length),text:T[0]}:null}var E8=new Pt("suggestion");function ck({pluginKey:t=E8,editor:e,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:o=[" "],startOfLine:l=!1,decorationTag:c="span",decorationClass:d="suggestion",decorationContent:f="",decorationEmptyClass:p="is-empty",command:m=()=>null,items:y=()=>[],render:b=()=>({}),allow:S=()=>!0,findSuggestionMatch:w=T8,shouldShow:T}){let M;const k=b?.(),j=()=>{const A=e.state.selection.$anchor.pos,U=e.view.coordsAtPos(A),{top:H,right:se,bottom:re,left:te}=U;try{return new DOMRect(te,H,se-te,re-H)}catch{return null}},I=(A,U)=>U?()=>{const H=t.getState(e.state),se=H?.decorationId,re=A.dom.querySelector(`[data-decoration-id="${se}"]`);return re?.getBoundingClientRect()||null}:j;function O(A,U){var H;try{const re=t.getState(A.state),te=re?.decorationId?A.dom.querySelector(`[data-decoration-id="${re.decorationId}"]`):null,Z={editor:e,range:re?.range||{from:0,to:0},query:re?.query||null,text:re?.text||null,items:[],command:G=>m({editor:e,range:re?.range||{from:0,to:0},props:G}),decorationNode:te,clientRect:I(A,te)};(H=k?.onExit)==null||H.call(k,Z)}catch{}const se=A.state.tr.setMeta(U,{exit:!0});A.dispatch(se)}const P=new Ot({key:t,view(){return{update:async(A,U)=>{var H,se,re,te,Z,G,fe;const R=(H=this.key)==null?void 0:H.getState(U),$=(se=this.key)==null?void 0:se.getState(A.state),ie=R.active&&$.active&&R.range.from!==$.range.from,me=!R.active&&$.active,ye=R.active&&!$.active,N=!me&&!ye&&R.query!==$.query,Q=me||ie&&N,ce=N||ie,le=ye||ie&&N;if(!Q&&!ce&&!le)return;const we=le&&!Q?R:$,ve=A.dom.querySelector(`[data-decoration-id="${we.decorationId}"]`);M={editor:e,range:we.range,query:we.query,text:we.text,items:[],command:je=>m({editor:e,range:we.range,props:je}),decorationNode:ve,clientRect:I(A,ve)},Q&&((re=k?.onBeforeStart)==null||re.call(k,M)),ce&&((te=k?.onBeforeUpdate)==null||te.call(k,M)),(ce||Q)&&(M.items=await y({editor:e,query:we.query})),le&&((Z=k?.onExit)==null||Z.call(k,M)),ce&&((G=k?.onUpdate)==null||G.call(k,M)),Q&&((fe=k?.onStart)==null||fe.call(k,M))},destroy:()=>{var A;M&&((A=k?.onExit)==null||A.call(k,M))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(A,U,H,se){const{isEditable:re}=e,{composing:te}=e.view,{selection:Z}=A,{empty:G,from:fe}=Z,R={...U},$=A.getMeta(t);if($&&$.exit)return R.active=!1,R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null,R;if(R.composing=te,re&&(G||e.view.composing)){(fe<U.range.from||fe>U.range.to)&&!te&&!U.composing&&(R.active=!1);const ie=w({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:o,startOfLine:l,$position:Z.$from}),me=`id_${Math.floor(Math.random()*4294967295)}`;ie&&S({editor:e,state:se,range:ie.range,isActive:U.active})&&(!T||T({editor:e,range:ie.range,query:ie.query,text:ie.text,transaction:A}))?(R.active=!0,R.decorationId=U.decorationId?U.decorationId:me,R.range=ie.range,R.query=ie.query,R.text=ie.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(A,U){var H,se,re,te;const{active:Z,range:G}=P.getState(A.state);if(!Z)return!1;if(U.key==="Escape"||U.key==="Esc"){const R=P.getState(A.state),$=(H=M?.decorationNode)!=null?H:null,ie=$??(R?.decorationId?A.dom.querySelector(`[data-decoration-id="${R.decorationId}"]`):null);if(((se=k?.onKeyDown)==null?void 0:se.call(k,{view:A,event:U,range:R.range}))||!1)return!0;const ye={editor:e,range:R.range,query:R.query,text:R.text,items:[],command:N=>m({editor:e,range:R.range,props:N}),decorationNode:ie,clientRect:ie?()=>ie.getBoundingClientRect()||null:null};return(re=k?.onExit)==null||re.call(k,ye),O(A,t),!0}return((te=k?.onKeyDown)==null?void 0:te.call(k,{view:A,event:U,range:G}))||!1},decorations(A){const{active:U,range:H,decorationId:se,query:re}=P.getState(A);if(!U)return null;const te=!re?.length,Z=[d];return te&&Z.push(p),kt.create(A.doc,[mn.inline(H.from,H.to,{nodeName:c,class:Z.join(" "),"data-decoration-id":se,"data-decoration-content":f})])}}});return P}var M8=ck;function x8({editor:t,overrideSuggestionOptions:e,extensionName:n,char:r="@"}){const i=new Pt;return{editor:t,char:r,pluginKey:i,command:({editor:o,range:l,props:c})=>{var d,f,p;const m=o.view.state.selection.$to.nodeAfter;(d=m?.text)!=null&&d.startsWith(" ")&&(l.to+=1),o.chain().focus().insertContentAt(l,[{type:n,attrs:{...c,mentionSuggestionChar:r}},{type:"text",text:" "}]).run(),(p=(f=o.view.dom.ownerDocument.defaultView)==null?void 0:f.getSelection())==null||p.collapseToEnd()},allow:({state:o,range:l})=>{const c=o.doc.resolve(l.from),d=o.schema.nodes[n];return!!c.parent.type.contentMatch.matchType(d)},...e}}function dk(t){return(t.options.suggestions.length?t.options.suggestions:[t.options.suggestion]).map(e=>x8({editor:t.editor,overrideSuggestionOptions:e,extensionName:t.name,char:e.char}))}function DT(t,e){const n=dk(t),r=n.find(i=>i.char===e);return r||(n.length?n[0]:null)}_n.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:t,suggestion:e}){var n,r;return`${(n=e?.char)!=null?n:"@"}${(r=t.attrs.label)!=null?r:t.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:t,node:e,suggestion:n}){var r,i;return["span",At(this.HTMLAttributes,t.HTMLAttributes),`${(r=n?.char)!=null?r:"@"}${(i=e.attrs.label)!=null?i:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:t=>t.getAttribute("data-id"),renderHTML:t=>t.id?{"data-id":t.id}:{}},label:{default:null,parseHTML:t=>t.getAttribute("data-label"),renderHTML:t=>t.label?{"data-label":t.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:t=>t.getAttribute("data-mention-suggestion-char"),renderHTML:t=>({"data-mention-suggestion-char":t.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=DT(this,t.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",At({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:t,suggestion:n})];const r={...this.options};r.HTMLAttributes=At({"data-type":this.name},this.options.HTMLAttributes,e);const i=this.options.renderHTML({options:r,node:t,suggestion:n});return typeof i=="string"?["span",At({"data-type":this.name},this.options.HTMLAttributes,e),i]:i},...OC({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:t=>{const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;r!==null;){const[,i,o,l]=r,c=o??l;e[i==="char"?"mentionSuggestionChar":i]=c,r=n.exec(t)}return e},serializeAttributes:t=>Object.entries(t).filter(([,e])=>e!=null).map(([e,n])=>`${e==="mentionSuggestionChar"?"char":e}="${n}"`).join(" ")}),renderText({node:t}){const e={options:this.options,node:t,suggestion:DT(this,t.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:t,state:e})=>{let n=!1;const{selection:r}=e,{empty:i,anchor:o}=r;if(!i)return!1;let l=new cr,c=0;return e.doc.nodesBetween(o-1,o,(d,f)=>{if(d.type.name===this.name)return n=!0,l=d,c=f,!1}),n&&t.insertText(this.options.deleteTriggerWithBackspace?"":l.attrs.mentionSuggestionChar,c,c+l.nodeSize),n})}},addProseMirrorPlugins(){return dk(this).map(ck)}});const C8={type:{default:null}},k8={user:{id:{default:null},name:{default:null},email:{default:null},avatarUrl:{default:null}},field:{apiKey:{default:null},label:{default:null},localized:{default:!1},fieldPath:{default:null},locale:{default:null},fieldType:{default:null}},asset:{id:{default:null},filename:{default:null},url:{default:null},thumbnailUrl:{default:null},mimeType:{default:null}},record:{id:{default:null},title:{default:null},modelId:{default:null},modelApiKey:{default:null},modelName:{default:null},modelEmoji:{default:null},thumbnailUrl:{default:null},isSingleton:{default:!1}},model:{id:{default:null},apiKey:{default:null},name:{default:null},isBlockModel:{default:!1}}};function Ml(t){const{name:e,mentionType:n,nodeViewComponent:r}=t,i=k8[n];return _n.create({name:e,group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{...C8,...i,...t.extraAttrs??{}}},parseHTML(){return[{tag:`span[data-mention-type="${n}"]`}]},renderHTML({HTMLAttributes:o}){return["span",{"data-mention-type":n,...o}]},addNodeView(){return j6(r)}})}function A8(){return jt.create({name:"slashSuggestion",addOptions(){return{suggestion:{char:"/",allowSpaces:!0,startOfLine:!1}}},addProseMirrorPlugins(){return[M8({editor:this.editor,...this.options.suggestion})]}})}const O8=({mention:t,onClick:e,isInComposer:n=!1,projectUsers:r})=>{const i=o=>{e?.(t,o)};return E.jsx(SM,{mention:t,onClick:i,tabIndex:n?-1:0,projectUsers:r})},N8=C.memo(O8),fk=C.createContext({});function R8(){return C.useContext(fk)}function dt(t){return typeof t=="string"}function Of(t){return t===null||typeof t=="string"}function Sg(t){return t==null||typeof t=="string"}function v0(t){return t===void 0||typeof t=="boolean"}function D8(t){return dt(t.id)&&dt(t.name)&&dt(t.email)&&Of(t.avatarUrl)}function I8(t){return dt(t.apiKey)&&dt(t.label)&&v0(t.localized)&&dt(t.fieldPath)&&Sg(t.locale)&&Sg(t.fieldType)}function L8(t){return dt(t.id)&&dt(t.filename)&&dt(t.url)&&Of(t.thumbnailUrl)&&dt(t.mimeType)}function j8(t){return dt(t.id)&&dt(t.title)&&dt(t.modelId)&&dt(t.modelApiKey)&&dt(t.modelName)&&Of(t.modelEmoji)&&Of(t.thumbnailUrl)&&v0(t.isSingleton)}function B8(t){return dt(t.id)&&dt(t.apiKey)&&dt(t.name)&&v0(t.isBlockModel)}function z8(t){if(!t||typeof t!="string")return!1;const e=Date.parse(t);if(Number.isNaN(e))return!1;try{return new Date(e).toISOString().length>0}catch{return!1}}function S0(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function P8(t){return dt(t)&&t.length>0}function U8(t){return Array.isArray(t)?t.every(e=>dt(e)):!1}function q8(t){return t.type==="user"&&dt(t.id)}function $8(t){return t.type==="field"&&dt(t.fieldPath)&&dt(t.modelId)&&Sg(t.locale)}function F8(t){return t.type==="asset"&&dt(t.id)}function H8(t){return t.type==="record"&&dt(t.id)&&dt(t.modelId)}function V8(t){return t.type==="model"&&dt(t.id)}function K8(t){return S0(t)?q8(t)||$8(t)||F8(t)||H8(t)||V8(t):!1}function G8(t){return S0(t)?t.type==="text"?dt(t.content):t.type==="mention"?K8(t.mention):!1:!1}function hk(t,e=new WeakSet){if(!S0(t)||e.has(t)||(e.add(t),!dt(t.id))||!dt(t.dateISO)||!z8(t.dateISO)||!P8(t.authorId)||!Array.isArray(t.content))return!1;for(const n of t.content)if(!G8(n))return!1;if(!U8(t.upvoterIds)||t.parentCommentId!==void 0&&!dt(t.parentCommentId))return!1;if(t.replies!==void 0){if(!Array.isArray(t.replies))return!1;for(const n of t.replies)if(!hk(n,e))return!1}return!0}function IT(t){if(!Array.isArray(t))return!1;for(const e of t)if(!hk(e))return!1;return!0}const pk={field:{localized:!1},model:{isBlockModel:!1}},Y8={localized:t=>t??pk.field.localized},Q8={isBlockModel:t=>t??pk.model.isBlockModel};let mk=!1;const X8=new Set(["token","apiToken","cdaToken","currentUserAccessToken","authorization","content","newContent","commentLog"]);function J8(t){return X8.has(t)}function Nf(t,e,n=new WeakSet){return e&&J8(e)?"[redacted]":Array.isArray(t)?t.map(r=>Nf(r,void 0,n)):t&&typeof t=="object"?n.has(t)?"[circular]":(n.add(t),Object.fromEntries(Object.entries(t).map(([r,i])=>[r,Nf(i,r,n)]))):t}function W8(t){const e={name:t.name,message:t.message};t.stack&&(e.stack=t.stack),"cause"in t&&t.cause!==void 0&&(e.cause=t.cause);for(const[n,r]of Object.entries(t))n in e||(e[n]=r);return e}function Z8(t){if(t===void 0)return;const e=t instanceof Error?Nf(W8(t)):Nf(t);if(typeof e=="string")return e;if(e===null||typeof e=="number"||typeof e=="boolean")return String(e);try{return JSON.stringify(e,null,2)}catch{return String(e)}}function w0(t,e,n){const r=[`[RecordComments][${t}] ${e}`];for(const[i,o]of Object.entries(n)){const l=Z8(o);l!==void 0&&r.push(`${i}: ${l}`)}return r.join(`
156
+ `)}function yk(){return mk}function kd(t){mk=t}function tt(t,e,n){console.error(w0("error",t,{error:e,context:n}))}function pn(t,e){yk()&&console.warn(w0("warn",t,{context:e}))}function Be(t,e){yk()&&console.info(w0("debug",t,{context:e}))}function gk(t,e){switch(t){case"user":return D8(e)?{type:"user",id:e.id,name:e.name,email:e.email,avatarUrl:e.avatarUrl}:(pn("Invalid user mention attrs",{attrs:e}),null);case"field":return I8(e)?{type:"field",apiKey:e.apiKey,label:e.label,localized:Y8.localized(e.localized),fieldPath:e.fieldPath,locale:e.locale??void 0,fieldType:e.fieldType??void 0}:(pn("Invalid field mention attrs",{attrs:e}),null);case"asset":return L8(e)?{type:"asset",id:e.id,filename:e.filename,url:e.url,thumbnailUrl:e.thumbnailUrl,mimeType:e.mimeType}:(pn("Invalid asset mention attrs",{attrs:e}),null);case"record":return j8(e)?{type:"record",id:e.id,title:e.title,modelId:e.modelId,modelApiKey:e.modelApiKey,modelName:e.modelName,modelEmoji:e.modelEmoji,thumbnailUrl:e.thumbnailUrl,isSingleton:e.isSingleton}:(pn("Invalid record mention attrs",{attrs:e}),null);case"model":return B8(e)?{type:"model",id:e.id,apiKey:e.apiKey,name:e.name,isBlockModel:Q8.isBlockModel(e.isBlockModel)}:(pn("Invalid model mention attrs",{attrs:e}),null);default:return null}}function e$(){return E.jsx("span",{style:{color:"#888",fontStyle:"italic",fontSize:"inherit"},children:"[invalid mention]"})}function Cu(t,e=!1){return function({node:r}){const{onMentionClick:i}=R8(),{projectUsers:o}=bM(),l=gk(t,r.attrs);return E.jsx(O6,{as:"span",contentEditable:!1,children:l?E.jsx(N8,{mention:l,onClick:i,isInComposer:!0,...e&&{projectUsers:o}}):E.jsx(e$,{})})}}const t$=Cu("user",!0),n$=Cu("field"),r$=Cu("asset"),i$=Cu("record"),s$=Cu("model"),Nn={user:"userMention",field:"fieldMention",asset:"assetMention",record:"recordMention",model:"modelMention"},o$={userMention:"user",fieldMention:"field",assetMention:"asset",recordMention:"record",modelMention:"model"};function a$(t){return{...t}}function l$(t,e){const n=o$[t];return n?gk(n,e):null}function u$(t){switch(t.type){case"user":return{type:"user",id:t.id};case"field":return{type:"field",fieldPath:t.fieldPath,...t.locale&&{locale:t.locale},modelId:""};case"asset":return{type:"asset",id:t.id};case"record":return{type:"record",id:t.id,modelId:t.modelId};case"model":return{type:"model",id:t.id}}}function LT(t){if(t.length===0)return{type:"doc",content:[{type:"paragraph"}]};const e=[];for(const n of t)if(n.type==="text"){const r=n.content.split(`
157
+ `);for(let i=0;i<r.length;i++){const o=r[i];o&&e.push({type:"text",text:o}),i<r.length-1&&e.push({type:"hardBreak"})}}else{const{mention:r}=n,i=Nn[r.type];e.push({type:i,attrs:a$(r)})}return{type:"doc",content:[{type:"paragraph",content:e.length>0?e:void 0}]}}function c$(t,e){const n=[];let r="";const i=()=>{r&&(n.push({type:"text",content:r}),r="")},o=l=>{if(!l)return;if(l.type==="text"&&l.text){r+=l.text;return}if(l.type==="hardBreak"){r+=`
158
+ `;return}const c=l.type?Object.values(Nn).find(d=>d===l.type):void 0;if(c){i();const d=e(c,l.attrs??{});d&&n.push({type:"mention",mention:d});return}if(l.type==="paragraph"){if((n.length>0||r)&&(r+=`
159
+ `),l.content)for(const d of l.content)o(d);return}if(l.content)for(const d of l.content)o(d)};if(t.content)for(const l of t.content)o(l);for(i();n.length>0;){const l=n[0];if(l.type==="text"&&(l.content=l.content.replace(/^[\s\n\r]+/,""),!l.content)){n.shift();continue}break}for(;n.length>0;){const l=n[n.length-1];if(l.type==="text"&&(l.content=l.content.replace(/[\s\n\r]+$/,""),!l.content)){n.pop();continue}break}return n}function yd(t){return c$(t,l$)}function _0(t){return t.map(e=>e.type==="text"?e:{type:"mention",mention:u$(e.mention)})}function T0(t,e,n){const r=e.toLowerCase();return t.filter(i=>n(i).some(o=>o&&o.toLowerCase().includes(r)))}function jT(t,e){return T0(t,e,n=>[n.name,n.email])}function BT(t,e){return T0(t,e,n=>[n.apiKey,n.label,n.displayLabel])}function zT(t,e){return T0(t,e,n=>[n.apiKey,n.name])}const d$=({users:t,query:e,selectedIndex:n,onSelect:r,onClose:i,position:o="below"})=>{const l=e?`No users matching "${e}"`:"No users available";return E.jsx(Og,{items:t,emptyMessage:l,headerText:"People",selectedIndex:n,onClose:i,position:o,keyExtractor:c=>c.id,renderItem:(c,d,f,p)=>E.jsxs("button",{ref:f?p:null,type:"button",className:ct(F.mentionOption,f&&F.mentionOptionSelected),onMouseDown:m=>{m.preventDefault(),r(c)},children:[c.avatarUrl&&E.jsx("img",{src:c.avatarUrl,alt:`Avatar for ${c.name}`,className:F.mentionUserAvatar}),E.jsx("span",{className:F.mentionUserName,children:c.name})]})})};function E0(t){if(!t||typeof t!="object"||Array.isArray(t))return!1;const e=t,n=typeof e.id=="string"||typeof e.type=="string"||typeof e.itemTypeId=="string",r=e.attributes===void 0||typeof e.attributes=="object"&&e.attributes!==null;return n&&r}function na(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function Rf(t){return t!==null&&typeof t=="object"&&!Array.isArray(t)}function M0(t){return t==="modular_content"||t==="structured_text"||t==="single_block"||t==="rich_text"}function f$(t){return t.attributes!==void 0&&typeof t.attributes=="object"&&t.attributes!==null}function PT(t){return t.__isStructuredTextBlock===!0&&typeof t.__dastIndex=="number"}function h$(t){if(!t||typeof t!="object")return!1;const e=t;if(e.item_item_type!==void 0){if(!na(e.item_item_type))return!1;const n=e.item_item_type;if(!Array.isArray(n.item_types)||!n.item_types.every(r=>typeof r=="string"))return!1}if(e.rich_text_blocks!==void 0){if(!na(e.rich_text_blocks))return!1;const n=e.rich_text_blocks;if(!Array.isArray(n.item_types)||!n.item_types.every(r=>typeof r=="string"))return!1}if(e.structured_text_blocks!==void 0){if(!na(e.structured_text_blocks))return!1;const n=e.structured_text_blocks;if(!Array.isArray(n.item_types)||!n.item_types.every(r=>typeof r=="string"))return!1}return!0}function p$(t){if(!t||typeof t!="object")return!1;const e=t;return!(e.editor!==void 0&&typeof e.editor!="string")}function x0(t){if(p$(t))return t.editor}function bk(t){if(h$(t))return t}function wg(t){const e=t.itemTypeId??t.type;return typeof e=="string"?e:void 0}const m$=new Set(["id","type","itemTypeId","attributes","item","__dastIndex","__isStructuredTextBlock","blockModelId"]);function UT(t){if(t.attributes&&typeof t.attributes=="object")return t.attributes;const e={};for(const n of Object.keys(t))m$.has(n)||(e[n]=t[n]);return e}function C0(t,e){if(!t)return[];if(e!=="structured_text"&&e!=="rich_text")return Array.isArray(t)?t:[];if(na(t)&&"document"in t)return t.blocks??[];if(na(t)&&"value"in t)return t.blocks??[];if(!Array.isArray(t))return[];const n=t[0];if(n&&typeof n.itemTypeId=="string"&&!n.blockModelId)return t;const i=[];return t.forEach((o,l)=>{const c=o;typeof c.blockModelId=="string"&&i.push({...c,itemTypeId:c.blockModelId,type:c.blockModelId,__dastIndex:l,__isStructuredTextBlock:!0})}),i}function y$(t,e){return t.__isStructuredTextBlock&&t.__dastIndex!==void 0?t.__dastIndex:e}function Jf(t,e){if(!e||!t||typeof t!="object"||Array.isArray(t))return t;const n=t;return e in n?n[e]:t}function vk(t,e,n={}){if(!e)return t;const r=e.split(".");let i=t;for(const o of r){if(i==null)return;const l=parseInt(o,10);if(!Number.isNaN(l)&&Array.isArray(i))i=i[l];else if(Rf(i))n.checkBlockAttributes&&i.attributes&&Rf(i.attributes)?i=i.attributes[o]:i=i[o];else return}return i}function g$(t,e){return{getFieldValue:n=>w$(t,n,e)}}function b$(t){return{getFieldValue:e=>t[e]}}function Sk(t,e){return e?t==="modular_content"||t==="single_block"?e.item_item_type?.item_types??[]:t==="structured_text"?e.structured_text_blocks?.item_types??e.rich_text_blocks?.item_types??[]:[]:[]}function k0(t,e){if(!na(t))return e.length>0?[...e]:void 0;const n=e.filter(r=>{const i=t[r];return!(i==null||typeof i=="string"&&i.trim()===""||Array.isArray(i)&&i.length===0)});return n.length>0?n:[...e]}async function qT(t){const{ctx:e,blockFields:n,blockAttrs:r,blockModelName:i,parentFieldLabel:o,basePath:l,depth:c,allLocales:d,blockIndex:f}=t,p=[],m=f!==void 0?` #${f+1}`:"";for(const y of n){const b=y.attributes.api_key,S=y.attributes.label,w=y.attributes.localized,T=y.attributes.field_type,M=x0(y.attributes.appearance),k=`${l}.${b}`,j=`${o} > ${i}${m} > ${S}`,I=r[b],O=w?k0(I,d):void 0,P=M0(T),A=P?T:void 0;if(p.push({apiKey:b,label:S,localized:w,fieldPath:k,displayLabel:j,depth:c,availableLocales:O,fieldType:M,isBlockContainer:P,blockFieldType:A}),P){const U=bk(y.attributes.validators),H=Sk(T,U),se=await wk(e,b$(r),{parentFieldApiKey:b,parentFieldLabel:S,parentFieldType:T,allowedBlockModelIds:H,allLocales:d,depth:c+1,basePath:l});p.push(...se)}}return p}async function wk(t,e,n){const{parentFieldApiKey:r,parentFieldLabel:i,parentFieldType:o,allowedBlockModelIds:l,allLocales:c,depth:d,basePath:f}=n,p=[],m=e.getFieldValue(r);if(o==="single_block"){if(E0(m)){const y=wg(m);if(y&&l.includes(y)){const b=t.itemTypes[y];if(b){const S=b.attributes.name,w=f?`${f}.${r}`:r,T=UT(m),M=await t.loadItemTypeFields(y),k=await qT({ctx:t,blockFields:M,blockAttrs:T,blockModelName:S,parentFieldLabel:i,basePath:w,depth:d,allLocales:c});p.push(...k)}}}}else if(o==="modular_content"||o==="structured_text"){const y=C0(m,o);for(let b=0;b<y.length;b++){const S=y[b],w=wg(S);if(!w){tt("loadNestedFieldsUnified: Block without model ID found",void 0,{parentFieldApiKey:r,blockIndex:b,basePath:f,blockKeys:Object.keys(S)});continue}const T=t.itemTypes[w];if(!T){tt("loadNestedFieldsUnified: Block references unknown model",void 0,{parentFieldApiKey:r,blockIndex:b,blockModelId:w,basePath:f});continue}const M=T.attributes.name,k=f?`${f}.${r}.${b}`:`${r}.${b}`,j=UT(S),I=await t.loadItemTypeFields(w),O=await qT({ctx:t,blockFields:I,blockAttrs:j,blockModelName:M,parentFieldLabel:i,basePath:k,depth:d,allLocales:c,blockIndex:b});p.push(...O)}}return p}async function v$(t){const e=[],n=t.formValues,r=t.site.attributes.locales,i=await t.loadItemTypeFields(t.itemType.id);for(const o of i){const l=o.attributes.field_type,c=o.attributes.api_key,d=o.attributes.label,f=o.attributes.localized,p=bk(o.attributes.validators),m=x0(o.attributes.appearance),y=n[c],b=f?k0(y,r):void 0,S=M0(l)?l:void 0;if(e.push({apiKey:c,label:d,localized:f,fieldPath:c,displayLabel:d,depth:0,availableLocales:b,fieldType:m,isBlockContainer:S!==void 0,blockFieldType:S}),S){const w=Sk(l,p),T=await S$(t,n,c,d,l,w,r,1);e.push(...T)}}return e}async function S$(t,e,n,r,i,o,l,c,d=""){const f=g$(e,d);return wk(t,f,{parentFieldApiKey:n,parentFieldLabel:r,parentFieldType:i,allowedBlockModelIds:o,allLocales:l,depth:c,basePath:d||""})}function w$(t,e,n){if(!n)return t[e];const r=vk(t,n,{checkBlockAttributes:!0});if(Rf(r))return Rf(r.attributes)?r.attributes[e]:r[e]}function _$(t,e,n,r){const i=t.formValues,o=_k(i,e),l=Jf(o,r);if(n==="single_block"){if(E0(l)){const d=wg(l);if(d){const f=t.itemTypes[d];if(f)return[{index:0,modelId:d,modelName:f.attributes.name}]}}return[]}return C0(l,n).map((d,f)=>{const p=d.itemTypeId??d.type;if(!p)return null;const m=t.itemTypes[p];return m?{index:y$(d,f),modelId:p,modelName:m.attributes.name}:null}).filter(d=>d!==null)}async function T$(t,e,n,r){const i=t.site.attributes.locales,o=await t.loadItemTypeFields(e),l=n??{};return o.map(c=>{const d=c.attributes.api_key,f=c.attributes.label,p=c.attributes.localized,m=c.attributes.field_type,y=x0(c.attributes.appearance),b=r?`${r}.${d}`:d,S=M0(m)?m:void 0,w=l[d],T=p?k0(w,i):void 0;return{apiKey:d,label:f,localized:p,fieldPath:b,displayLabel:f,depth:0,availableLocales:T,fieldType:y,isBlockContainer:S!==void 0,blockFieldType:S}})}function _k(t,e){return vk(t,e,{checkBlockAttributes:!0})}function ay(t){return f$(t)?t.attributes:t}function E$(t,e,n,r,i){const o=t.formValues,l=_k(o,e),c=Jf(l,i);if(r==="single_block")return E0(c)?ay(c):null;const d=C0(c,r),f=d[0];if(f&&PT(f)){const m=d.find(y=>PT(y)&&y.__dastIndex===n);if(m)return ay(m)}else if(n>=0&&n<d.length){const m=d[n];return ay(m)}return null}function Tk(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.type==="field")return n.field}return null}function M$(t){for(let e=t.length-1;e>=0;e--){const n=t[e];if(n.type==="locale")return n.locale}}function $T(t){let e="",n=null;for(const r of t)r.type==="field"?(e=r.field.fieldPath,n=r.field):r.type==="locale"?e=`${e}.${r.locale}`:r.type==="block"&&n?.blockFieldType!=="single_block"&&(e=`${e}.${r.blockIndex}`);return e}function x$(t){if(t.length===0)return"fields";const e=t[t.length-1];if(e.type==="block")return"nestedFields";if(e.type==="locale")return Tk(t)?.isBlockContainer?"blocks":"fields";if(e.type==="field"){const n=e.field;return n.localized&&n.availableLocales&&n.availableLocales.length>1?"locales":n.isBlockContainer?"blocks":"fields"}return"fields"}function C$(t){const e=[];for(const n of t)n.type==="field"?e.push(n.field.label):n.type==="locale"?e.push(`(${n.locale.toUpperCase()})`):n.type==="block"&&e.push(`${n.blockModelName} #${n.blockIndex+1}`);return e.join(" > ")}function ly(t,e,n,r,i){switch(t){case"ArrowDown":return n>0&&e(o=>(o+1)%n),!0;case"ArrowUp":return n>0&&e(o=>(o-1+n)%n),!0;case"Enter":case"Tab":return r(),!0;case"Escape":case"Backspace":return i(),!0;default:return!1}}function k$({ctx:t,onSelect:e,pendingFieldForLocale:n,onClearPendingField:r,selectedIndex:i,onPathChange:o}){const[l,c]=C.useState([]),[d,f]=C.useState(0),[p,m]=C.useState([]),[y,b]=C.useState([]),[S,w]=C.useState(!1),T=C.useRef(0),M=C.useMemo(()=>x$(l),[l]),k=C.useMemo(()=>Tk(l),[l]),j=C.useMemo(()=>M$(l),[l]),I=C.useMemo(()=>C$(l),[l]),O=C.useRef(o);O.current=o,C.useEffect(()=>{O.current?.(I)},[I]),C.useEffect(()=>{if(M==="blocks"&&k?.blockFieldType==="single_block"&&p.length===1){const G=p[0];c(fe=>[...fe,{type:"block",blockIndex:G.index,blockModelId:G.modelId,blockModelName:G.modelName}]),f(0)}},[p,k,M]),C.useEffect(()=>{if(M!=="blocks"||!t){m([]);return}if(!k?.isBlockContainer||!k.blockFieldType){m([]);return}w(!0);const G=_$(t,k.fieldPath,k.blockFieldType,j);m(G),f(0),w(!1)},[l,t,k,M,j]),C.useEffect(()=>{if(M!=="nestedFields"||!t){b([]);return}let G=!0;return(async()=>{const R=++T.current;w(!0);let $=null;for(let N=l.length-1;N>=0;N--)if(l[N].type==="block"){$=l[N];break}if(!$||$.type!=="block"){if(!G||T.current!==R)return;b([]),w(!1);return}if(!k?.blockFieldType){if(!G||T.current!==R)return;b([]),w(!1);return}const ie=E$(t,k.fieldPath,$.blockIndex,k.blockFieldType,j),me=$T(l),ye=await T$(t,$.blockModelId,ie,me);!G||T.current!==R||(b(ye),f(0),w(!1))})(),()=>{G=!1}},[l,t,k,M,j]),C.useEffect(()=>{n?.isBlockContainer&&!n.localized&&l.length===0&&(c([{type:"field",field:n}]),f(0),r?.())},[n,l.length,r]);const P=C.useCallback(()=>{l.length>0&&(c(G=>G.slice(0,-1)),f(0)),r?.()},[l.length,r]),A=C.useCallback(G=>{if(G.isBlockContainer){c(ie=>[...ie,{type:"field",field:G}]),f(0);return}if(G.localized&&G.availableLocales&&G.availableLocales.length>1){c(ie=>[...ie,{type:"field",field:G}]),f(0);return}const fe=$T(l),R=fe?`${fe}.${G.apiKey}`:G.fieldPath,$={...G,fieldPath:R,localized:G.localized||!!j};e($,j),c([])},[l,j,e]),U=C.useCallback(G=>{k?.isBlockContainer?(c(fe=>[...fe,{type:"locale",locale:G}]),f(0)):k&&(e(k,G),c([]))},[k,e]),H=C.useCallback(()=>{k&&(e(k,j),c([]))},[k,j,e]),se=C.useCallback(G=>{c(fe=>[...fe,{type:"block",blockIndex:G.index,blockModelId:G.modelId,blockModelName:G.modelName}]),f(0)},[]),re=C.useCallback(G=>{n&&(n.isBlockContainer?(c([{type:"field",field:n},{type:"locale",locale:G}]),f(0),r?.()):(e(n,G),r?.()))},[n,e,r]),te=C.useCallback(()=>{T.current++,c([]),f(0)},[]);C.useEffect(()=>{n?.availableLocales&&l.length===0&&f(0)},[n,l.length]);const Z=C.useCallback(G=>{if(n?.availableLocales&&l.length===0){const fe=n.availableLocales.length;if(G==="ArrowDown")return fe>0&&f(R=>(R+1)%fe),!0;if(G==="ArrowUp")return fe>0&&f(R=>(R-1+fe)%fe),!0;if(G==="Enter"||G==="Tab"){const R=n.availableLocales[d];return R&&re(R),!0}return G==="Escape"?(r?.(),!0):!1}if(M==="blocks"){const fe=p.length+1;return ly(G,f,fe,()=>{if(d===0)H();else{const R=d-1;R<p.length&&se(p[R])}},P)}return M==="nestedFields"?ly(G,f,y.length,()=>{d<y.length&&A(y[d])},P):M==="locales"&&k?.availableLocales?ly(G,f,k.availableLocales.length,()=>{d<k.availableLocales.length&&U(k.availableLocales[d])},P):!1},[M,d,p,y,k,H,se,A,U,P,n,l,i,r,re]);return{navigationStack:l,localSelectedIndex:d,setLocalSelectedIndex:f,currentBlocks:p,currentNestedFields:y,isLoadingBlocks:S,viewMode:M,currentField:k,selectedLocale:j,breadcrumb:I,handleBack:P,handleFieldClick:A,handleLocaleClick:U,handleBlockClick:se,handleSelectEntireField:H,handleKeyboardNavigation:Z,handlePendingLocaleSelection:re,resetNavigation:te}}const A$=()=>E.jsxs("svg",{width:"12",height:"12",viewBox:"0 0 16 16",fill:"currentColor",children:[E.jsx("title",{children:"Go back"}),E.jsx("path",{fillRule:"evenodd",d:"M11.354 1.646a.5.5 0 0 1 0 .708L5.707 8l5.647 5.646a.5.5 0 0 1-.708.708l-6-6a.5.5 0 0 1 0-.708l6-6a.5.5 0 0 1 .708 0z"})]});function gd({title:t,onBack:e,justClickedInsideRef:n}){return E.jsxs("div",{className:F.mentionHeader,children:[E.jsx("button",{type:"button",className:F.mentionBackButton,onMouseDown:r=>{r.preventDefault(),n.current=!0,e()},children:E.jsx(A$,{})}),t]})}function FT({locales:t,selectedIndex:e,onSelect:n,onHover:r,selectedRef:i,justClickedInsideRef:o}){return E.jsx("div",{className:F.mentionList,role:"listbox","aria-label":"Select locale",children:t.map((l,c)=>E.jsxs("button",{ref:c===e?i:null,type:"button",role:"option","aria-selected":c===e,className:ct(F.mentionOption,c===e&&F.mentionOptionSelected),onMouseDown:d=>{d.preventDefault(),o.current=!0,n(l)},onMouseEnter:()=>r(c),children:[E.jsx("span",{className:F.mentionLocaleBadge,children:l.toUpperCase()}),E.jsx("span",{className:F.mentionFieldLabel,children:l})]},l))})}function O$({blocks:t,selectedIndex:e,isLoading:n,onSelectEntireField:r,onSelectBlock:i,onHover:o,selectedRef:l,justClickedInsideRef:c}){return n?E.jsx("div",{className:F.mentionList,children:E.jsx("div",{className:F.mentionEmpty,children:"Loading blocks..."})}):E.jsxs("div",{className:F.mentionList,role:"listbox","aria-label":"Select block",children:[E.jsxs("button",{ref:e===0?l:null,type:"button",role:"option","aria-selected":e===0,className:ct(F.mentionOption,F.mentionOptionEntireField,e===0&&F.mentionOptionSelected),onMouseDown:d=>{d.preventDefault(),c.current=!0,r()},onMouseEnter:()=>o(0),children:[E.jsx("span",{className:F.mentionFieldLabel,children:"Select entire field"}),E.jsx("span",{className:F.mentionFieldMeta,children:E.jsxs("span",{className:F.mentionBlockCount,children:[t.length," block",t.length!==1?"s":""]})})]}),t.length===0?E.jsx("div",{className:F.mentionEmpty,children:"No blocks in this field"}):t.map((d,f)=>{const p=f+1;return E.jsxs("button",{ref:p===e?l:null,type:"button",role:"option","aria-selected":p===e,className:ct(F.mentionOption,p===e&&F.mentionOptionSelected),onMouseDown:m=>{m.preventDefault(),c.current=!0,i(d)},onMouseEnter:()=>o(p),children:[E.jsxs("span",{className:F.mentionFieldLabel,children:[d.modelName," #",d.index+1]}),E.jsx("span",{className:F.mentionFieldMeta,children:E.jsx("span",{className:F.mentionBlockBadge,children:d.modelName})})]},`${d.modelId}-${d.index}`)})]})}function N$({fields:t,selectedIndex:e,isLoading:n,onSelect:r,onHover:i,selectedRef:o,justClickedInsideRef:l}){return n?E.jsx("div",{className:F.mentionList,children:E.jsx("div",{className:F.mentionEmpty,children:"Loading fields..."})}):t.length===0?E.jsx("div",{className:F.mentionList,children:E.jsx("div",{className:F.mentionEmpty,children:"No fields in this block"})}):E.jsx("div",{className:F.mentionList,children:t.map((c,d)=>{const f=c.availableLocales&&c.availableLocales.length>1,p=c.isBlockContainer;return E.jsxs("button",{ref:d===e?o:null,type:"button",className:ct(F.mentionOption,d===e&&F.mentionOptionSelected),onMouseDown:m=>{m.preventDefault(),l.current=!0,r(c)},onMouseEnter:()=>i(d),children:[E.jsx("span",{className:F.mentionFieldLabel,children:c.label}),E.jsxs("span",{className:F.mentionFieldMeta,children:[p&&!f&&E.jsx("span",{className:F.mentionBlockIndicator,title:"Contains blocks",children:"▶"}),f&&E.jsx("span",{className:F.mentionLocaleIndicator,title:"Localized field",children:E.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:E.jsx("path",{d:"M12.87 15.07l-2.54-2.51.03-.03A17.52 17.52 0 0014.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"})})}),E.jsxs("span",{className:F.mentionFieldApiKey,children:["#",c.apiKey]})]})]},c.fieldPath)})})}function R$({fields:t,selectedIndex:e,onSelect:n,selectedRef:r,justClickedInsideRef:i}){return E.jsxs(E.Fragment,{children:[E.jsx("div",{className:F.mentionHeader,children:"Fields"}),E.jsx("div",{className:F.mentionList,role:"listbox",children:t.map((o,l)=>{const c=o.depth>0,d=o.availableLocales&&o.availableLocales.length>1,f=o.isBlockContainer;return E.jsxs("button",{ref:l===e?r:null,type:"button",role:"option","aria-selected":l===e,className:ct(F.mentionOption,l===e&&F.mentionOptionSelected),style:{paddingLeft:`${8+o.depth*12}px`},onMouseDown:p=>{p.preventDefault(),i.current=!0,n(o)},children:[E.jsx("span",{className:F.mentionFieldLabel,children:c?o.displayLabel:o.label}),E.jsxs("span",{className:F.mentionFieldMeta,children:[f&&!d&&E.jsx("span",{className:F.mentionBlockIndicator,title:"Contains blocks",children:"▶"}),d&&E.jsx("span",{className:F.mentionLocaleIndicator,title:"Localized field",children:E.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor",children:E.jsx("path",{d:"M12.87 15.07l-2.54-2.51.03-.03A17.52 17.52 0 0014.07 6H17V4h-7V2H8v2H1v2h11.17C11.5 7.92 10.44 9.75 9 11.35 8.07 10.32 7.3 9.19 6.69 8h-2c.73 1.63 1.73 3.17 2.98 4.56l-5.09 5.02L4 19l5-5 3.11 3.11.76-2.04zM18.5 10h-2L12 22h2l1.12-3h4.75L21 22h2l-4.5-12zm-2.62 7l1.62-4.33L19.12 17h-3.24z"})})}),E.jsxs("span",{className:F.mentionFieldApiKey,children:["#",o.apiKey]})]})]},o.fieldPath)})})]})}const D$=({fields:t,query:e,selectedIndex:n,onSelect:r,onClose:i,pendingFieldForLocale:o,onClearPendingField:l,ctx:c,registerKeyHandler:d,position:f="below",onPathChange:p})=>{const m=ct(F.mentionDropdown,f==="above"&&F.mentionDropdownAbove),y=C.useRef(null),b=C.useRef(null),S=C.useRef(!1);zE(y,()=>{if(S.current){S.current=!1;return}i()});const{navigationStack:w,localSelectedIndex:T,setLocalSelectedIndex:M,currentBlocks:k,currentNestedFields:j,isLoadingBlocks:I,viewMode:O,currentField:P,breadcrumb:A,handleBack:U,handleFieldClick:H,handleLocaleClick:se,handleBlockClick:re,handleSelectEntireField:te,handleKeyboardNavigation:Z,handlePendingLocaleSelection:G}=k$({ctx:c,onSelect:r,pendingFieldForLocale:o,onClearPendingField:l,selectedIndex:n,onPathChange:p});return C.useEffect(()=>{b.current?.scrollIntoView({block:"nearest",behavior:"smooth"})},[T,n]),C.useEffect(()=>{d&&d(Z)},[d,Z]),o?.availableLocales&&w.length===0?E.jsxs("div",{ref:y,className:m,children:[E.jsx(gd,{title:`Select locale for ${o.label}`,onBack:()=>l?.(),justClickedInsideRef:S}),E.jsx(FT,{locales:o.availableLocales,selectedIndex:T,onSelect:G,onHover:M,selectedRef:b,justClickedInsideRef:S})]}):O==="fields"&&t.length===0?E.jsx("div",{ref:y,className:m,children:E.jsx("div",{className:F.mentionEmpty,children:e?`No fields matching "${e}"`:"No fields available"})}):O==="locales"&&P?.availableLocales?E.jsxs("div",{ref:y,className:m,children:[E.jsx(gd,{title:`Select locale for ${P.label}`,onBack:U,justClickedInsideRef:S}),E.jsx(FT,{locales:P.availableLocales,selectedIndex:T,onSelect:se,onHover:M,selectedRef:b,justClickedInsideRef:S})]}):O==="blocks"?E.jsxs("div",{ref:y,className:m,children:[E.jsx(gd,{title:A,onBack:U,justClickedInsideRef:S}),E.jsx(O$,{blocks:k,selectedIndex:T,isLoading:I,onSelectEntireField:te,onSelectBlock:re,onHover:M,selectedRef:b,justClickedInsideRef:S})]}):O==="nestedFields"?E.jsxs("div",{ref:y,className:m,children:[E.jsx(gd,{title:A,onBack:U,justClickedInsideRef:S}),E.jsx(N$,{fields:j,selectedIndex:T,isLoading:I,onSelect:H,onHover:M,selectedRef:b,justClickedInsideRef:S})]}):E.jsx("div",{ref:y,className:m,children:E.jsx(R$,{fields:t,selectedIndex:n,onSelect:H,selectedRef:b,justClickedInsideRef:S})})},I$=({models:t,query:e,selectedIndex:n,onSelect:r,onClose:i,position:o="below"})=>{const l=e?`No models matching "${e}"`:"No models available";return E.jsx(Og,{items:t,emptyMessage:l,headerText:"Models",selectedIndex:n,onClose:i,position:o,keyExtractor:c=>c.id,renderItem:(c,d,f,p)=>E.jsxs("button",{ref:f?p:null,type:"button",className:ct(F.mentionOption,f&&F.mentionOptionSelected),onMouseDown:m=>{m.preventDefault(),r(c)},children:[E.jsxs("span",{className:F.mentionModelInfo,children:[E.jsx("span",{className:F.mentionModelName,children:c.name}),c.isBlockModel&&E.jsx("span",{className:F.mentionModelBadge,children:"Block"})]}),E.jsxs("span",{className:F.mentionFieldApiKey,children:["$",c.apiKey]})]})})},L$=C.memo(function({commands:e,selectedIndex:n,onSelect:r,onClose:i,position:o="below"}){const l=C.useRef(null),c=C.useRef(null);C.useEffect(()=>{if(c.current&&l.current){const f=l.current,p=c.current,m=f.getBoundingClientRect(),y=p.getBoundingClientRect();y.top<m.top?p.scrollIntoView({block:"nearest"}):y.bottom>m.bottom&&p.scrollIntoView({block:"nearest"})}},[n]),C.useEffect(()=>{const f=p=>{l.current&&!l.current.contains(p.target)&&i()};return document.addEventListener("mousedown",f),()=>document.removeEventListener("mousedown",f)},[i]);const d=ct(F.mentionDropdown,F.slashCommandMenu,o==="above"&&F.mentionDropdownAbove);return e.length===0?E.jsxs("div",{className:d,children:[E.jsx("div",{className:F.mentionHeader,children:"Commands"}),E.jsx("div",{className:F.mentionEmpty,children:"No matching commands"})]}):E.jsxs("div",{className:d,children:[E.jsx("div",{className:F.mentionHeader,children:"Commands"}),E.jsx("div",{className:F.mentionList,ref:l,children:e.map((f,p)=>{const m=p===n;return E.jsxs("button",{ref:m?c:null,type:"button",className:ct(F.mentionOption,F.slashCommandItem,m&&F.mentionOptionSelected),onClick:()=>r(f),onMouseEnter:y=>y.currentTarget.focus(),children:[E.jsx("span",{className:F.slashCommandIcon,children:f.icon}),E.jsxs("span",{className:F.slashCommandContent,children:[E.jsxs("span",{className:F.slashCommandName,children:["/",f.name]}),E.jsx("span",{className:F.slashCommandDescription,children:f.description})]})]},f.name)})})]})}),ra=[{name:"user",label:"User",description:"Mention a team member",icon:"👤"},{name:"field",label:"Field",description:"Reference a field",icon:"#"},{name:"record",label:"Record",description:"Link to a record",icon:"📄"},{name:"asset",label:"Asset",description:"Link to an asset",icon:"📎"},{name:"model",label:"Model",description:"Reference a model",icon:"📦"}];function HT(t){const e=t.indexOf(" ");if(e===-1){const o=t.toLowerCase(),l=ra.filter(d=>d.name.startsWith(o)),c=ra.find(d=>d.name===o)??null;return{commandPart:o,searchQuery:"",matchedCommands:l,exactMatch:c,isComplete:!1}}const n=t.substring(0,e).toLowerCase(),r=t.substring(e+1),i=ra.find(o=>o.name===n)??null;return{commandPart:n,searchQuery:r,matchedCommands:i?[i]:[],exactMatch:i,isComplete:!0}}function j$(t){if(!t)return ra;const e=t.toLowerCase();return ra.filter(n=>n.name.startsWith(e))}const B$="_editor_1a2hb_3",z$="_editorLarge_1a2hb_20",VT={editor:B$,editorLarge:z$},A0=C.forwardRef(({segments:t,onSegmentsChange:e,onSubmit:n,onCancel:r,onBlur:i,placeholder:o="Write a comment...",projectUsers:l,modelFields:c=[],projectModels:d,canMentionAssets:f=!0,canMentionModels:p=!0,canMentionFields:m=!0,onAssetTrigger:y,onRecordTrigger:b,autoFocus:S=!1,large:w=!1,dropdownPosition:T="below",ctx:M},k)=>{const j=yM(),[I,O]=C.useState(null),[P,A]=C.useState(0),[U,H]=C.useState(0),se=C.useRef(null),re=C.useRef(null),[te,Z]=C.useState(null);C.useEffect(()=>{se.current=I},[I]);const G=C.useRef(n),fe=C.useRef(r),R=C.useRef(i),$=C.useRef(y),ie=C.useRef(b),me=C.useRef(e);C.useEffect(()=>()=>{se.current=null,Ne.current=null,re.current=null},[]),C.useEffect(()=>{G.current=n,fe.current=r,R.current=i,$.current=y,ie.current=b,me.current=e},[n,r,i,y,b,e]);const ye=C.useRef(l),N=C.useRef(c),Q=C.useRef(d);C.useEffect(()=>{ye.current=l,N.current=c,Q.current=d},[l,c,d]);const ce=C.useMemo(()=>ra.filter(ue=>!(ue.name==="asset"&&!f||ue.name==="model"&&!p||ue.name==="field"&&(!m||c.length===0))),[f,p,m,c]),le=C.useCallback(ue=>ce.some(ae=>ae.name===ue),[ce]),we=C.useCallback(ue=>j$(ue).filter(ae=>le(ae.name)),[le]),ve=C.useMemo(()=>!I||I.phase!=="command_selection"?ce:we(I.commandPart),[I,ce,we]),je=C.useMemo(()=>I?.phase!=="type_selection"||I.selectedType!=="user"?[]:jT(l,I.searchQuery),[l,I]),nt=C.useMemo(()=>I?.phase!=="type_selection"||I.selectedType!=="field"?[]:BT(c,I.searchQuery),[c,I]),pe=C.useMemo(()=>I?.phase!=="type_selection"||I.selectedType!=="model"?[]:zT(d,I.searchQuery),[d,I]),Me=C.useRef(0);C.useEffect(()=>{Me.current=P},[P]);const wt=C.useRef(0);C.useEffect(()=>{wt.current=U},[U]);const Ne=C.useRef(null),Re=C.useCallback(ue=>{re.current=ue},[]),De=C.useCallback(()=>{Z(null)},[]),pt=C.useCallback(ue=>{switch(ue.type){case"user":j.handleNavigateToUsers();break;case"field":{const ae=ue;j.handleScrollToField?.(ae.fieldPath,ae.localized,ae.locale);break}case"asset":{const ae=ue;j.handleOpenAsset(ae.id);break}case"record":{const ae=ue;j.handleOpenRecord(ae.id,ae.modelId);break}case"model":{const ae=ue;j.handleNavigateToModel(ae.id,ae.isBlockModel);break}}},[j]),it=C.useMemo(()=>({onMentionClick:pt}),[pt]),lt=C.useCallback(ue=>{if(!le(ue.name))return;const ae=Ne.current,be=se.current;if(!ae||!be)return;if(ue.name==="record"||ue.name==="asset"){ae.chain().focus().deleteRange(be.range).run(),O(null),ue.name==="record"?ie.current?.():$.current?.();return}const he=`/${ue.name} `,Ce=be.range.from;ae.chain().focus().deleteRange(be.range).insertContentAt(Ce,he).run();const Ve={from:Ce,to:Ce+he.length};O({...be,phase:"type_selection",selectedType:ue.name,searchQuery:"",commandPart:ue.name,rawQuery:`${ue.name} `,range:Ve}),H(0)},[le]),ft=C.useCallback(()=>({char:"/",allowSpaces:!0,items:()=>[],render:()=>({onStart:ue=>{const ae=HT(ue.query);if(ae.isComplete&&ae.exactMatch){if(!le(ae.exactMatch.name)){O({phase:"command_selection",rawQuery:ue.query,commandPart:ae.commandPart,searchQuery:ae.searchQuery,selectedType:null,range:ue.range,clientRect:ue.clientRect??null}),A(0);return}if(ae.exactMatch.name==="record"||ae.exactMatch.name==="asset"){const be=Ne.current;be&&be.chain().focus().deleteRange(ue.range).run(),ae.exactMatch.name==="record"?ie.current?.():$.current?.();return}O({phase:"type_selection",rawQuery:ue.query,commandPart:ae.commandPart,searchQuery:ae.searchQuery,selectedType:ae.exactMatch.name,range:ue.range,clientRect:ue.clientRect??null}),H(0);return}O({phase:"command_selection",rawQuery:ue.query,commandPart:ae.commandPart,searchQuery:ae.searchQuery,selectedType:null,range:ue.range,clientRect:ue.clientRect??null}),A(0),H(0)},onUpdate:ue=>{const ae=HT(ue.query),be=se.current;if(ae.isComplete&&ae.exactMatch&&be?.phase==="command_selection"){if(!le(ae.exactMatch.name)){O(he=>he?{...he,rawQuery:ue.query,commandPart:ae.commandPart,searchQuery:ae.searchQuery,selectedType:null,range:ue.range,clientRect:ue.clientRect??null}:null),A(0);return}if(ae.exactMatch.name==="record"||ae.exactMatch.name==="asset"){const he=Ne.current;he&&he.chain().focus().deleteRange(ue.range).run(),O(null),ae.exactMatch.name==="record"?ie.current?.():$.current?.();return}O({phase:"type_selection",rawQuery:ue.query,commandPart:ae.commandPart,searchQuery:ae.searchQuery,selectedType:ae.exactMatch.name,range:ue.range,clientRect:ue.clientRect??null}),H(0);return}O(he=>he?{...he,rawQuery:ue.query,commandPart:ae.commandPart,searchQuery:ae.searchQuery,range:ue.range,clientRect:ue.clientRect??null}:null),be?.phase==="command_selection"?A(0):H(0)},onExit:()=>{O(null),A(0),H(0),Z(null),re.current=null},onKeyDown:ue=>{const{event:ae,range:be}=ue,he=se.current;if(!he)return!1;if(he.phase==="command_selection"){const Ce=we(he.commandPart);if(ae.key==="ArrowDown")return Ce.length>0&&A(Ve=>(Ve+1)%Ce.length),!0;if(ae.key==="ArrowUp")return Ce.length>0&&A(Ve=>(Ve-1+Ce.length)%Ce.length),!0;if(ae.key==="Enter"||ae.key==="Tab"){ae.preventDefault();const Ve=Me.current,rt=Ce[Ve];return rt&&lt(rt),!0}return ae.key==="Escape"?(O(null),!0):!1}if(he.phase==="type_selection"){if(he.selectedType==="field"&&re.current&&re.current(ae.key))return ae.preventDefault(),!0;let Ce=[];if(he.selectedType==="user"?Ce=jT(ye.current,he.searchQuery):he.selectedType==="field"?Ce=BT(N.current,he.searchQuery):he.selectedType==="model"&&(Ce=zT(Q.current,he.searchQuery)),ae.key==="ArrowDown")return Ce.length>0&&H(Ve=>(Ve+1)%Ce.length),!0;if(ae.key==="ArrowUp")return Ce.length>0&&H(Ve=>(Ve-1+Ce.length)%Ce.length),!0;if(ae.key==="Enter"||ae.key==="Tab"){ae.preventDefault();const Ve=wt.current,rt=Ce[Ve],Gt=Ne.current;if(rt&&Gt){if(he.selectedType==="user"){const Ke=rt;Gt.chain().focus().deleteRange(be).insertContent([{type:Nn.user,attrs:{type:"user",id:Ke.id,name:Ke.name,email:Ke.email,avatarUrl:Ke.avatarUrl}},{type:"text",text:" "}]).run(),O(null)}else if(he.selectedType==="model"){const Ke=rt;Gt.chain().focus().deleteRange(be).insertContent([{type:Nn.model,attrs:{type:"model",id:Ke.id,apiKey:Ke.apiKey,name:Ke.name,isBlockModel:Ke.isBlockModel}},{type:"text",text:" "}]).run(),O(null)}else if(he.selectedType==="field"){const Ke=rt;Ke.isBlockContainer||Ke.localized&&Ke.availableLocales&&Ke.availableLocales.length>1?(Z(Ke),H(0)):(Gt.chain().focus().deleteRange(be).insertContent([{type:Nn.field,attrs:{type:"field",apiKey:Ke.apiKey,label:Ke.label,localized:Ke.localized,fieldPath:Ke.fieldPath,locale:Ke.availableLocales?.[0],fieldType:Ke.fieldType}},{type:"text",text:" "}]).run(),O(null))}}return!0}return ae.key==="Backspace"&&!he.searchQuery?(O({...he,phase:"command_selection",selectedType:null}),A(0),!0):ae.key==="Escape"?(O(null),!0):!1}return!1}})}),[lt,we,le]),st=C.useMemo(()=>[A8().configure({suggestion:ft()}),Ml({name:Nn.user,mentionType:"user",nodeViewComponent:t$}),Ml({name:Nn.field,mentionType:"field",nodeViewComponent:n$}),Ml({name:Nn.model,mentionType:"model",nodeViewComponent:s$}),Ml({name:Nn.asset,mentionType:"asset",nodeViewComponent:r$}),Ml({name:Nn.record,mentionType:"record",nodeViewComponent:i$})],[ft]),xe=k6({extensions:[w8.configure({blockquote:!1,bulletList:!1,codeBlock:!1,heading:!1,horizontalRule:!1,listItem:!1,orderedList:!1,paragraph:{},hardBreak:{},bold:!1,code:!1,italic:!1,strike:!1}),_8.configure({placeholder:o}),...st],content:LT(t),autofocus:S?"end":!1,editorProps:{handleKeyDown:(ue,ae)=>ae.key==="Enter"&&!ae.shiftKey&&!se.current?(ae.preventDefault(),G.current?.(),!0):ae.key==="Escape"&&!se.current?(ae.preventDefault(),fe.current?.(),!0):!1},onUpdate:({editor:ue})=>{const ae=ue.getJSON(),be=yd(ae);me.current?.(be)},onBlur:()=>{R.current?.()}});C.useEffect(()=>{Ne.current=xe},[xe]);const bn=C.useCallback(ue=>{const ae=se.current;if(!xe||!ae||ae.selectedType!=="user")return;const be={type:"user",id:ue.id,name:ue.name,email:ue.email,avatarUrl:ue.avatarUrl};xe.chain().focus().deleteRange(ae.range).insertContent([{type:Nn.user,attrs:be},{type:"text",text:" "}]).run(),O(null)},[xe]),hr=C.useCallback((ue,ae)=>{const be=se.current;if(!xe||!be||be.selectedType!=="field")return;const he={type:"field",apiKey:ue.apiKey,label:ue.label,localized:ue.localized,fieldPath:ue.fieldPath,locale:ae,fieldType:ue.fieldType};xe.chain().focus().deleteRange(be.range).insertContent([{type:Nn.field,attrs:he},{type:"text",text:" "}]).run(),O(null)},[xe]),_r=C.useCallback(ue=>{const ae=se.current;if(!xe||!ae||ae.selectedType!=="model")return;const be={type:"model",id:ue.id,apiKey:ue.apiKey,name:ue.name,isBlockModel:ue.isBlockModel};xe.chain().focus().deleteRange(ae.range).insertContent([{type:Nn.model,attrs:be},{type:"text",text:" "}]).run(),O(null)},[xe]),Qe=C.useCallback(()=>{O(null)},[]),Vn=C.useCallback(ue=>{const ae=Ne.current,be=se.current;if(!ae||!be||be.selectedType!=="field")return;const he=ue?`/field ${ue}`:"/field ",Ce=be.range.from;ae.chain().focus().deleteRange(be.range).insertContentAt(Ce,he).run();const Ve={from:Ce,to:Ce+he.length};O(rt=>rt?{...rt,range:Ve,rawQuery:ue?`field ${ue}`:"field "}:null)},[]);C.useImperativeHandle(k,()=>({focus:()=>{xe?.chain().focus().run()},clear:()=>{xe?.chain().clearContent().run()},insertMention:ue=>{if(!xe)return;const ae=Nn[ue.type],be=yd(xe.getJSON());be.length===0||be.length===1&&be[0].type==="text"&&!be[0].content.trim()?xe.chain().focus().setContent({type:"doc",content:[{type:"paragraph",content:[{type:ae,attrs:ue},{type:"text",text:" "}]}]}).run():xe.chain().focus().insertContent([{type:ae,attrs:ue},{type:"text",text:" "}]).run()},insertText:ue=>{xe?.chain().focus().insertContent(ue).run()},getSegments:()=>xe?yd(xe.getJSON()):[],isEmpty:()=>xe?xe.isEmpty:!0,getEditor:()=>xe,triggerMentionType:ue=>{if(!xe)return;xe.chain().focus().run();const ae=xe.state.selection.from;O({phase:"type_selection",rawQuery:"",commandPart:ue,searchQuery:"",selectedType:ue,range:{from:ae,to:ae},clientRect:null}),H(0)}}),[xe]);const Tr=C.useRef(t);C.useEffect(()=>{if(!xe)return;const ue=yd(xe.getJSON()),ae=!au(Tr.current,t),be=au(ue,t);if(ae&&!be){const{from:he,to:Ce}=xe.state.selection,Ve=LT(t);xe.commands.setContent(Ve,{emitUpdate:!1});const rt=xe.state.doc.content.size,Gt=Math.min(he,rt-1),Ke=Math.min(Ce,rt-1);Gt>0&&xe.commands.setTextSelection({from:Gt,to:Ke})}Tr.current=t},[xe,t]);const Lr=ct(VT.editor,w&&VT.editorLarge);return E.jsx(fk.Provider,{value:it,children:E.jsxs("div",{style:{position:"relative"},children:[E.jsx("div",{className:Lr,children:E.jsx(DC,{editor:xe})}),I?.phase==="command_selection"&&E.jsx(L$,{commands:ve,selectedIndex:P,onSelect:lt,onClose:Qe,position:T}),I?.phase==="type_selection"&&I.selectedType==="user"&&E.jsx(d$,{users:je,query:I.searchQuery,selectedIndex:U,onSelect:bn,onClose:Qe,position:T}),I?.phase==="type_selection"&&I.selectedType==="field"&&E.jsx(D$,{fields:nt,query:I.searchQuery,selectedIndex:U,onSelect:hr,onClose:Qe,pendingFieldForLocale:te,onClearPendingField:De,registerKeyHandler:Re,ctx:M,position:T,onPathChange:Vn}),I?.phase==="type_selection"&&I.selectedType==="model"&&E.jsx(I$,{models:pe,query:I.searchQuery,selectedIndex:U,onSelect:_r,onClose:Qe,position:T})]})})});A0.displayName="TipTapComposer";function P$({commentContent:t,isNewComment:e}){const n=C.useRef(null),[r,i]=C.useState(e),[o,l]=C.useState(t);return C.useEffect(()=>{r||l(t)},[t,r]),C.useEffect(()=>{r&&n.current&&n.current.focus()},[r]),{isEditing:r,setIsEditing:i,segments:o,setSegments:l,composerRef:n,handleStartEditing:()=>{l(t),i(!0)},resetToOriginal:()=>{l(t),i(!1)}}}function Ek(t){const e=t.replies?.map(Ek),n=t.parentCommentId==null;return{...t,...e?{replies:e}:{},...n?{replies:e??[]}:{}}}function KT(t){return t.map(Ek)}const U$=`
160
+ query CommentsQuery($modelId: String!, $recordId: String!) {
161
+ allProjectComments(filter: { modelId: { eq: $modelId }, recordId: { eq: $recordId } }, first: 1) {
162
+ id
163
+ content
164
+ }
165
+ }
166
+ `;function Df(t){if(!t)return[];if(Array.isArray(t))return IT(t)?KT(t):(tt("parseComments: Array content failed validation",void 0,{arrayLength:t.length,firstItemType:t.length>0?typeof t[0]:"empty",hasNestedArrays:t.some(e=>Array.isArray(e))}),[]);if(typeof t=="string")try{const e=JSON.parse(t);return IT(e)?KT(e):(tt("parseComments: Parsed JSON failed validation",void 0,{contentLength:t.length,parsedType:typeof e,isArray:Array.isArray(e),parsedLength:Array.isArray(e)?e.length:void 0}),[])}catch(e){return tt("parseComments: JSON parsing failed",e,{contentLength:t.length,startsWithBracket:t.startsWith("[")||t.startsWith("{"),containsNullBytes:t.includes("\0")}),[]}return tt("parseComments: Unexpected content type",void 0,{contentType:typeof t}),[]}function ia(t){return t.length===0?!0:t.every(e=>e.type==="text"&&e.content.trim()==="")}var uy={exports:{}},cy={exports:{}},GT;function q$(){return GT||(GT=1,(function(){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",e={rotl:function(n,r){return n<<r|n>>>32-r},rotr:function(n,r){return n<<32-r|n>>>r},endian:function(n){if(n.constructor==Number)return e.rotl(n,8)&16711935|e.rotl(n,24)&4278255360;for(var r=0;r<n.length;r++)n[r]=e.endian(n[r]);return n},randomBytes:function(n){for(var r=[];n>0;n--)r.push(Math.floor(Math.random()*256));return r},bytesToWords:function(n){for(var r=[],i=0,o=0;i<n.length;i++,o+=8)r[o>>>5]|=n[i]<<24-o%32;return r},wordsToBytes:function(n){for(var r=[],i=0;i<n.length*32;i+=8)r.push(n[i>>>5]>>>24-i%32&255);return r},bytesToHex:function(n){for(var r=[],i=0;i<n.length;i++)r.push((n[i]>>>4).toString(16)),r.push((n[i]&15).toString(16));return r.join("")},hexToBytes:function(n){for(var r=[],i=0;i<n.length;i+=2)r.push(parseInt(n.substr(i,2),16));return r},bytesToBase64:function(n){for(var r=[],i=0;i<n.length;i+=3)for(var o=n[i]<<16|n[i+1]<<8|n[i+2],l=0;l<4;l++)i*8+l*6<=n.length*8?r.push(t.charAt(o>>>6*(3-l)&63)):r.push("=");return r.join("")},base64ToBytes:function(n){n=n.replace(/[^A-Z0-9+\/]/ig,"");for(var r=[],i=0,o=0;i<n.length;o=++i%4)o!=0&&r.push((t.indexOf(n.charAt(i-1))&Math.pow(2,-2*o+8)-1)<<o*2|t.indexOf(n.charAt(i))>>>6-o*2);return r}};cy.exports=e})()),cy.exports}var dy,YT;function QT(){if(YT)return dy;YT=1;var t={utf8:{stringToBytes:function(e){return t.bin.stringToBytes(unescape(encodeURIComponent(e)))},bytesToString:function(e){return decodeURIComponent(escape(t.bin.bytesToString(e)))}},bin:{stringToBytes:function(e){for(var n=[],r=0;r<e.length;r++)n.push(e.charCodeAt(r)&255);return n},bytesToString:function(e){for(var n=[],r=0;r<e.length;r++)n.push(String.fromCharCode(e[r]));return n.join("")}}};return dy=t,dy}var fy,XT;function $$(){if(XT)return fy;XT=1,fy=function(n){return n!=null&&(t(n)||e(n)||!!n._isBuffer)};function t(n){return!!n.constructor&&typeof n.constructor.isBuffer=="function"&&n.constructor.isBuffer(n)}function e(n){return typeof n.readFloatLE=="function"&&typeof n.slice=="function"&&t(n.slice(0,0))}return fy}var JT;function F$(){return JT||(JT=1,(function(){var t=q$(),e=QT().utf8,n=$$(),r=QT().bin,i=function(o,l){o.constructor==String?l&&l.encoding==="binary"?o=r.stringToBytes(o):o=e.stringToBytes(o):n(o)?o=Array.prototype.slice.call(o,0):!Array.isArray(o)&&o.constructor!==Uint8Array&&(o=o.toString());for(var c=t.bytesToWords(o),d=o.length*8,f=1732584193,p=-271733879,m=-1732584194,y=271733878,b=0;b<c.length;b++)c[b]=(c[b]<<8|c[b]>>>24)&16711935|(c[b]<<24|c[b]>>>8)&4278255360;c[d>>>5]|=128<<d%32,c[(d+64>>>9<<4)+14]=d;for(var S=i._ff,w=i._gg,T=i._hh,M=i._ii,b=0;b<c.length;b+=16){var k=f,j=p,I=m,O=y;f=S(f,p,m,y,c[b+0],7,-680876936),y=S(y,f,p,m,c[b+1],12,-389564586),m=S(m,y,f,p,c[b+2],17,606105819),p=S(p,m,y,f,c[b+3],22,-1044525330),f=S(f,p,m,y,c[b+4],7,-176418897),y=S(y,f,p,m,c[b+5],12,1200080426),m=S(m,y,f,p,c[b+6],17,-1473231341),p=S(p,m,y,f,c[b+7],22,-45705983),f=S(f,p,m,y,c[b+8],7,1770035416),y=S(y,f,p,m,c[b+9],12,-1958414417),m=S(m,y,f,p,c[b+10],17,-42063),p=S(p,m,y,f,c[b+11],22,-1990404162),f=S(f,p,m,y,c[b+12],7,1804603682),y=S(y,f,p,m,c[b+13],12,-40341101),m=S(m,y,f,p,c[b+14],17,-1502002290),p=S(p,m,y,f,c[b+15],22,1236535329),f=w(f,p,m,y,c[b+1],5,-165796510),y=w(y,f,p,m,c[b+6],9,-1069501632),m=w(m,y,f,p,c[b+11],14,643717713),p=w(p,m,y,f,c[b+0],20,-373897302),f=w(f,p,m,y,c[b+5],5,-701558691),y=w(y,f,p,m,c[b+10],9,38016083),m=w(m,y,f,p,c[b+15],14,-660478335),p=w(p,m,y,f,c[b+4],20,-405537848),f=w(f,p,m,y,c[b+9],5,568446438),y=w(y,f,p,m,c[b+14],9,-1019803690),m=w(m,y,f,p,c[b+3],14,-187363961),p=w(p,m,y,f,c[b+8],20,1163531501),f=w(f,p,m,y,c[b+13],5,-1444681467),y=w(y,f,p,m,c[b+2],9,-51403784),m=w(m,y,f,p,c[b+7],14,1735328473),p=w(p,m,y,f,c[b+12],20,-1926607734),f=T(f,p,m,y,c[b+5],4,-378558),y=T(y,f,p,m,c[b+8],11,-2022574463),m=T(m,y,f,p,c[b+11],16,1839030562),p=T(p,m,y,f,c[b+14],23,-35309556),f=T(f,p,m,y,c[b+1],4,-1530992060),y=T(y,f,p,m,c[b+4],11,1272893353),m=T(m,y,f,p,c[b+7],16,-155497632),p=T(p,m,y,f,c[b+10],23,-1094730640),f=T(f,p,m,y,c[b+13],4,681279174),y=T(y,f,p,m,c[b+0],11,-358537222),m=T(m,y,f,p,c[b+3],16,-722521979),p=T(p,m,y,f,c[b+6],23,76029189),f=T(f,p,m,y,c[b+9],4,-640364487),y=T(y,f,p,m,c[b+12],11,-421815835),m=T(m,y,f,p,c[b+15],16,530742520),p=T(p,m,y,f,c[b+2],23,-995338651),f=M(f,p,m,y,c[b+0],6,-198630844),y=M(y,f,p,m,c[b+7],10,1126891415),m=M(m,y,f,p,c[b+14],15,-1416354905),p=M(p,m,y,f,c[b+5],21,-57434055),f=M(f,p,m,y,c[b+12],6,1700485571),y=M(y,f,p,m,c[b+3],10,-1894986606),m=M(m,y,f,p,c[b+10],15,-1051523),p=M(p,m,y,f,c[b+1],21,-2054922799),f=M(f,p,m,y,c[b+8],6,1873313359),y=M(y,f,p,m,c[b+15],10,-30611744),m=M(m,y,f,p,c[b+6],15,-1560198380),p=M(p,m,y,f,c[b+13],21,1309151649),f=M(f,p,m,y,c[b+4],6,-145523070),y=M(y,f,p,m,c[b+11],10,-1120210379),m=M(m,y,f,p,c[b+2],15,718787259),p=M(p,m,y,f,c[b+9],21,-343485551),f=f+k>>>0,p=p+j>>>0,m=m+I>>>0,y=y+O>>>0}return t.endian([f,p,m,y])};i._ff=function(o,l,c,d,f,p,m){var y=o+(l&c|~l&d)+(f>>>0)+m;return(y<<p|y>>>32-p)+l},i._gg=function(o,l,c,d,f,p,m){var y=o+(l&d|c&~d)+(f>>>0)+m;return(y<<p|y>>>32-p)+l},i._hh=function(o,l,c,d,f,p,m){var y=o+(l^c^d)+(f>>>0)+m;return(y<<p|y>>>32-p)+l},i._ii=function(o,l,c,d,f,p,m){var y=o+(c^(l|~d))+(f>>>0)+m;return(y<<p|y>>>32-p)+l},i._blocksize=16,i._digestsize=16,uy.exports=function(o,l){if(o==null)throw new Error("Illegal argument "+o);var c=t.wordsToBytes(i(o,l));return l&&l.asBytes?c:l&&l.asString?r.bytesToString(c):t.bytesToHex(c)}})()),uy.exports}var H$=F$();const V$=Ea(H$);function rs(t,e=64){const n=t.trim().toLowerCase();return`https://www.gravatar.com/avatar/${V$(n)}?d=mp&s=${e}`}function Mk(t,e,n,r=300){const i=t.startsWith("image/"),o=t.startsWith("video/");return i&&e?`${e}?w=${r}&fit=max&auto=format&dpr=2&q=80`:o&&n?`https://image.mux.com/${n}/thumbnail.jpg?width=${r}&fit_mode=preserve`:null}function K$(t){return t?.toLowerCase().trim()??""}function G$(t,e){const n=t.commentObject,r=e.commentObject;return n===r?WT(t,e):n.id!==r.id||!au(n.content,r.content)||n.upvoters.length!==r.upvoters.length||!n.upvoters.every((i,o)=>i.email===r.upvoters[o].email)||!hM(n.replies,r.replies)?!1:WT(t,e)}function WT(t,e){return t.currentUserId===e.currentUserId&&t.isReply===e.isReply&&t.canMentionFields===e.canMentionFields&&t.canMentionAssets===e.canMentionAssets&&t.canMentionModels===e.canMentionModels&&t.isPickerActive===e.isPickerActive&&t.dropdownPosition===e.dropdownPosition&&t.modelFields===e.modelFields&&t.projectUsers===e.projectUsers&&t.projectModels===e.projectModels&&t.readableModels===e.readableModels&&t.deleteComment===e.deleteComment&&t.editComment===e.editComment&&t.upvoteComment===e.upvoteComment&&t.replyComment===e.replyComment&&t.onPickerRequest===e.onPickerRequest&&t.onRecordModelSelect===e.onRecordModelSelect}const Y$=C.memo(function t({deleteComment:e,editComment:n,upvoteComment:r,replyComment:i,commentObject:o,currentUserId:l,isReply:c=!1,modelFields:d=[],projectUsers:f,projectModels:p,ctx:m,canMentionFields:y=!0,onPickerRequest:b,onRecordModelSelect:S,readableModels:w=[],canMentionAssets:T=!1,canMentionModels:M=!0,isPickerActive:k=!1,dropdownPosition:j="below"}){const[I,O]=C.useState(!1),P=o.upvoters.some(be=>be.id===l),A=ia(o.content),U=o.parentCommentId==null,H=U?void 0:o.parentCommentId,se=o.author.id===l,re=U?o.replies??[]:[],te=re.length,Z=re.some(be=>ia(be.content)),G=c?Ko.AVATAR_SIZE_REPLY:Ko.AVATAR_SIZE_COMMENT,fe=o.author.avatarUrl??rs(o.author.email,G*2),R=o.author.name,[$,ie]=C.useState(!1),me=C.useRef(k);me.current=k;const ye=C.useRef(!0),N=C.useRef(A),{isEditing:Q,setIsEditing:ce,segments:le,setSegments:we,composerRef:ve,handleStartEditing:je,resetToOriginal:nt}=P$({commentContent:o.content,isNewComment:A});C.useEffect(()=>{Z&&!$&&ie(!0)},[Z,$]);const pe=C.useMemo(()=>o.upvoters.map(be=>be.name).join(", "),[o.upvoters]),Me=C.useMemo(()=>ia(le),[le]),wt=C.useMemo(()=>{if(!U||re.length===0)return[];const be=new Set,he=[];for(const Ce of re){const Ve=K$(Ce.author.email)||Ce.id;if(be.has(Ve))continue;be.add(Ve);const rt=rs(Ce.author.email,Ko.AVATAR_SIZE_THUMBNAIL);if(he.push({id:Ce.id,avatarUrl:Ce.author.avatarUrl??rt,name:Ce.author.name,fallbackUrl:rt}),he.length>=Ko.MAX_VISIBLE_REPLIER_AVATARS)break}return he},[U,re]);ye.current=Me,N.current=A;const Ne=()=>{if(Me){e(o.id,H);return}n(o.id,le,H)&&ce(!1)},Re=async()=>{await m.openConfirm({title:"Delete comment",content:"Are you sure you want to delete this comment?",choices:[{label:"Delete",value:!0,intent:"negative"}],cancel:{label:"Cancel",value:!1}})&&e(o.id,H)},De=()=>{r(o.id,P,H)},pt=C.useRef(null),it=C.useRef(null),lt=C.useRef(null),ft=C.useRef(null);C.useEffect(()=>()=>{lt.current&&clearTimeout(lt.current),ft.current&&clearTimeout(ft.current)},[]);const st=()=>{ie(!0),i(o.id),lt.current&&clearTimeout(lt.current),lt.current=setTimeout(()=>{if(pt.current){const be=it.current;if(be){const he=be.lastElementChild;if(he){he.scrollIntoView({behavior:"smooth",block:"center"});return}}pt.current.scrollIntoView({behavior:"smooth",block:"end"})}lt.current=null},Ls.SCROLL_AFTER_REPLY_DELAY_MS)},xe=()=>{A?e(o.id,H):nt()},bn=()=>{ft.current&&clearTimeout(ft.current),ft.current=setTimeout(()=>{ye.current&&N.current&&!me.current&&e(o.id,H),ft.current=null},Ls.COMMENT_BLUR_DELAY_MS)},hr=()=>{ie(!$)},_r=C.useCallback(()=>{ve.current?.insertText("@")},[ve]),Qe=C.useCallback(()=>{ve.current?.insertText("#")},[ve]),Vn=C.useCallback(()=>{ve.current?.insertText("$")},[ve]),Tr=C.useCallback(()=>{b&&b("asset",ve)},[b,ve]),Lr=C.useCallback(()=>{O(!0)},[]),ue=C.useCallback(be=>{O(!1),S&&S(be,ve)},[S,ve]),ae=C.useCallback(()=>{O(!1),ve.current?.focus()},[ve]);return E.jsxs("div",{ref:pt,className:ct(F.comment,c&&F.reply,se&&F.ownComment),"data-comment-id":o.id,children:[!Q&&E.jsx(w5,{onUpvote:De,onReply:U?st:void 0,onEdit:je,onDelete:Re,userUpvoted:P,userIsAuthor:se,isTopLevel:U,hasUpvotes:o.upvoters.length>0}),E.jsxs("div",{className:F.commentBody,style:{gridTemplateColumns:`${G}px 1fr`},children:[E.jsx("div",{className:F.avatarContainer,children:E.jsx("img",{className:F.avatar,src:fe,alt:R,style:{width:G,height:G},onError:be=>{const he=be.currentTarget;he.onerror=null,he.src=rs(o.author.email,G*2)}})}),E.jsxs("div",{className:F.content,children:[E.jsxs("div",{className:F.header,children:[E.jsx("span",{className:F.authorName,children:R}),E.jsx("span",{className:F.timestamp,children:E.jsx(Pd,{date:new Date(o.dateISO)})})]}),Q?E.jsx("div",{className:F.editContainer,children:E.jsxs(_5,{compact:!0,children:[E.jsx(A0,{ref:ve,segments:le,onSegmentsChange:we,onSubmit:Ne,onCancel:xe,onBlur:bn,placeholder:"Write a comment...",projectUsers:f,modelFields:d,projectModels:p,canMentionAssets:T,canMentionModels:M,canMentionFields:y,onAssetTrigger:Tr,onRecordTrigger:Lr,autoFocus:!0,dropdownPosition:j,ctx:m}),I&&w.length>0&&E.jsx(PE,{models:w,onSelect:ue,onClose:ae,position:j}),E.jsx($E,{onUserClick:_r,onFieldClick:Qe,onRecordClick:Lr,onAssetClick:Tr,onModelClick:Vn,onSendClick:Ne,isSendDisabled:Me,canMentionAssets:T&&!!b,canMentionModels:M,canMentionFields:y})]})}):E.jsx("div",{className:F.text,children:E.jsx(g5,{segments:o.content})}),E.jsxs("div",{className:F.footer,children:[o.upvoters.length>0&&!Q&&E.jsxs("div",{className:F.reactionWrapper,children:[E.jsxs("button",{type:"button",className:ct(F.reaction,P&&F.reactionActive),onClick:De,"aria-label":P?`Remove upvote from comment. ${o.upvoters.length} upvote${o.upvoters.length===1?"":"s"}`:`Upvote comment. ${o.upvoters.length} upvote${o.upvoters.length===1?"":"s"}`,children:[E.jsx(UE,{"aria-hidden":"true"}),E.jsx("span",{children:o.upvoters.length})]}),E.jsxs("div",{className:F.tooltip,children:[pe,E.jsx("div",{className:F.tooltipArrow})]})]}),U&&te>0&&!Q&&E.jsxs("button",{type:"button",className:F.replyToggle,onClick:hr,"aria-expanded":$,"aria-label":`${$?"Collapse":"Expand"} ${te} ${te===1?"reply":"replies"}`,children:[E.jsx("div",{className:F.replyAvatars,children:wt.map((be,he)=>E.jsx("img",{src:be.avatarUrl,alt:be.name,className:F.replyAvatar,style:{zIndex:Ko.MAX_VISIBLE_REPLIER_AVATARS-he},onError:Ce=>{const Ve=Ce.currentTarget;Ve.onerror=null,Ve.src=be.fallbackUrl}},be.id))}),E.jsx("div",{className:F.replyMeta,children:E.jsxs("span",{className:F.replyText,children:[te," ",te===1?"reply":"replies"]})}),E.jsx(UI,{className:ct(F.chevron,$&&F.chevronExpanded),"aria-hidden":"true"})]})]})]})]}),U&&te>0&&$&&E.jsx("div",{ref:it,className:F.replies,children:re.map(be=>E.jsx(t,{deleteComment:e,editComment:n,upvoteComment:r,replyComment:i,commentObject:be,currentUserId:l,isReply:!0,modelFields:d,projectUsers:f,projectModels:p,ctx:m,canMentionFields:y,onPickerRequest:b,onRecordModelSelect:S,readableModels:w,canMentionAssets:T,canMentionModels:M,isPickerActive:k,dropdownPosition:j},be.id))})]})},G$);class xk extends Le.Component{constructor(e){super(e),this.state={hasError:!1,error:null}}static getDerivedStateFromError(e){return{hasError:!0,error:e}}componentDidCatch(e,n){tt("Comment rendering failed",e,{componentStack:n.componentStack})}render(){return this.state.hasError?E.jsx("div",{className:F.errorFallback,children:this.props.fallbackMessage??"Unable to display comment"}):this.props.children}}const Q$=({comments:t,hasMoreComments:e,onLoadMore:n,currentUserId:r,modelFields:i,projectUsers:o,projectModels:l,deleteComment:c,editComment:d,upvoteComment:f,replyComment:p,onPickerRequest:m,onRecordModelSelect:y,readableModels:b,canMentionAssets:S,canMentionModels:w,ctx:T,isPickerActive:M})=>t.length===0?E.jsxs("div",{className:ht.empty,children:[E.jsx("p",{children:"No comments yet"}),E.jsx("span",{children:"Be the first to leave a comment on this record."})]}):E.jsxs("div",{className:ht.commentsList,children:[t.map(k=>E.jsx(xk,{children:E.jsx(Y$,{deleteComment:c,editComment:d,upvoteComment:f,replyComment:p,commentObject:k,currentUserId:r,modelFields:i,projectUsers:o,projectModels:l,onPickerRequest:m,onRecordModelSelect:y,readableModels:b,canMentionAssets:S,canMentionModels:w,ctx:T,isPickerActive:M})},k.id)),e&&E.jsx("button",{type:"button",className:ht.loadMoreButton,onClick:n,children:"Load more comments"})]}),X$=C.memo(Q$);function On(t,e,n){for(var r="",i=0;i<t.length;i++)i&&(r+=e),r+=n(t[i]);return r}function J$(t){return JSON.stringify(t)}function W$(t){return`"""
167
+ `+t.replace(/"""/g,'\\"""')+`
168
+ """`}var kr=`
169
+ `,It={OperationDefinition(t){var e="";t.description&&(e+=It.StringValue(t.description)+`
170
+ `),e+=t.operation,t.name&&(e+=" "+t.name.value),t.variableDefinitions&&t.variableDefinitions.length&&(t.name||(e+=" "),e+="("+On(t.variableDefinitions,", ",It.VariableDefinition)+")"),t.directives&&t.directives.length&&(e+=" "+On(t.directives," ",It.Directive));var n=It.SelectionSet(t.selectionSet);return e!=="query"?e+" "+n:n},VariableDefinition(t){var e="";return t.description&&(e+=It.StringValue(t.description)+" "),e+=It.Variable(t.variable)+": "+ri(t.type),t.defaultValue&&(e+=" = "+ri(t.defaultValue)),t.directives&&t.directives.length&&(e+=" "+On(t.directives," ",It.Directive)),e},Field(t){var e=t.alias?t.alias.value+": "+t.name.value:t.name.value;if(t.arguments&&t.arguments.length){var n=On(t.arguments,", ",It.Argument);e.length+n.length+2>80?e+="("+(kr+=" ")+On(t.arguments,kr,It.Argument)+(kr=kr.slice(0,-2))+")":e+="("+n+")"}return t.directives&&t.directives.length&&(e+=" "+On(t.directives," ",It.Directive)),t.selectionSet&&t.selectionSet.selections.length&&(e+=" "+It.SelectionSet(t.selectionSet)),e},StringValue(t){return t.block?W$(t.value).replace(/\n/g,kr):J$(t.value)},BooleanValue:t=>""+t.value,NullValue:t=>"null",IntValue:t=>t.value,FloatValue:t=>t.value,EnumValue:t=>t.value,Name:t=>t.value,Variable:t=>"$"+t.name.value,ListValue:t=>"["+On(t.values,", ",ri)+"]",ObjectValue:t=>"{"+On(t.fields,", ",It.ObjectField)+"}",ObjectField:t=>t.name.value+": "+ri(t.value),Document(t){return!t.definitions||!t.definitions.length?"":On(t.definitions,`
171
+
172
+ `,ri)},SelectionSet:t=>"{"+(kr+=" ")+On(t.selections,kr,ri)+(kr=kr.slice(0,-2))+"}",Argument:t=>t.name.value+": "+ri(t.value),FragmentSpread(t){var e="..."+t.name.value;return t.directives&&t.directives.length&&(e+=" "+On(t.directives," ",It.Directive)),e},InlineFragment(t){var e="...";return t.typeCondition&&(e+=" on "+t.typeCondition.name.value),t.directives&&t.directives.length&&(e+=" "+On(t.directives," ",It.Directive)),e+=" "+It.SelectionSet(t.selectionSet)},FragmentDefinition(t){var e="";return t.description&&(e+=It.StringValue(t.description)+`
173
+ `),e+="fragment "+t.name.value,e+=" on "+t.typeCondition.name.value,t.directives&&t.directives.length&&(e+=" "+On(t.directives," ",It.Directive)),e+" "+It.SelectionSet(t.selectionSet)},Directive(t){var e="@"+t.name.value;return t.arguments&&t.arguments.length&&(e+="("+On(t.arguments,", ",It.Argument)+")"),e},NamedType:t=>t.name.value,ListType:t=>"["+ri(t.type)+"]",NonNullType:t=>ri(t.type)+"!"},ri=t=>It[t.kind](t);function Z$(t){return kr=`
174
+ `,It[t.kind]?It[t.kind](t):""}function eF(t){var e={Accept:"application/json",Authorization:"Bearer ".concat(t.token)};return t.includeDrafts&&(e["X-Include-Drafts"]="true"),t.excludeInvalid&&(e["X-Exclude-Invalid"]="true"),t.environment&&(e["X-Environment"]=t.environment),t.returnCacheTags&&(e["X-Cache-Tags"]="true"),t.contentLink&&(e["X-Visual-Editing"]=t.contentLink),t.baseEditingUrl&&(e["X-Base-Editing-Url"]=t.baseEditingUrl),t.referer&&(e.Referer=t.referer),e}var O0=(function(){var t=function(e,n){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var o in i)Object.prototype.hasOwnProperty.call(i,o)&&(r[o]=i[o])},t(e,n)};return function(e,n){if(typeof n!="function"&&n!==null)throw new TypeError("Class extends value "+String(n)+" is not a constructor or null");t(e,n);function r(){this.constructor=e}e.prototype=n===null?Object.create(n):(r.prototype=n.prototype,new r)}})(),If=function(){return If=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},If.apply(this,arguments)},ZT=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})},eE=function(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,l=Object.create((typeof Iterator=="function"?Iterator:Object).prototype);return l.next=c(0),l.throw=c(1),l.return=c(2),typeof Symbol=="function"&&(l[Symbol.iterator]=function(){return this}),l;function c(f){return function(p){return d([f,p])}}function d(f){if(r)throw new TypeError("Generator is already executing.");for(;l&&(l=0,f[0]&&(n=0)),n;)try{if(r=1,i&&(o=f[0]&2?i.return:f[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,f[1])).done)return o;switch(i=0,o&&(f=[f[0]&2,o.value]),f[0]){case 0:case 1:o=f;break;case 4:return n.label++,{value:f[1],done:!1};case 5:n.label++,i=f[1],f=[0];continue;case 7:f=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(f[0]===6||f[0]===2)){n=0;continue}if(f[0]===3&&(!o||f[1]>o[0]&&f[1]<o[3])){n.label=f[1];break}if(f[0]===6&&n.label<o[1]){n.label=o[1],o=f;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(f);break}o[2]&&n.ops.pop(),n.trys.pop();continue}f=e.call(t,n)}catch(p){f=[6,p],i=0}finally{r=o=0}if(f[0]&5)throw f[1];return{value:f[0]?f[1]:void 0,done:!0}}},tF=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n},nF=(function(){function t(e,n){this.type=e,this.data=n?.data}return t})(),rF=typeof MessageEvent<"u"?MessageEvent:nF,iF=(function(t){O0(e,t);function e(n,r){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.response=r,i}return e})(Error),tE=(function(t){O0(e,t);function e(n,r){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.response=r,i}return e})(Error),sF=(function(t){O0(e,t);function e(n,r){var i=t.call(this,n)||this;return Object.setPrototypeOf(i,e.prototype),i.response=r,i}return e})(Error);function Ck(t){return ZT(this,void 0,void 0,function(){var e,n,r,i,o,l,c,d,f,p,m,y,b,S,w,T,M,k,j,I,O,P,A,U=this;return eE(this,function(H){switch(H.label){case 0:e=t.query,n=t.variables,r=t.fetcher,i=t.eventSourceClass,o=t.onStatusChange,l=t.onUpdate,c=t.onChannelError,d=t.onError,f=t.onEvent,p=t.reconnectionPeriod,m=t.baseUrl,y=tF(t,["query","variables","fetcher","eventSourceClass","onStatusChange","onUpdate","onChannelError","onError","onEvent","reconnectionPeriod","baseUrl"]),b=r||window.fetch,S=i||window.EventSource,w=Math.min(p||1e3,2e4),T=m||"https://graphql-listen.datocms.com",M=function(){return ZT(U,void 0,void 0,function(){return eE(this,function(se){switch(se.label){case 0:return[4,new Promise(function(re){return setTimeout(re,w)})];case 1:return se.sent(),[2,Ck(If(If({},t),{reconnectionPeriod:w*2*(1+(Math.random()*.2-.1))}))]}})})},o&&o("connecting"),H.label=1;case 1:return H.trys.push([1,4,,5]),j=typeof e=="string"?e:Z$(e),[4,b(T,{headers:eF(y),method:"POST",body:JSON.stringify({query:j,variables:n})})];case 2:if(I=H.sent(),I.status>=300&&I.status<500)throw new tE("Invalid status code: ".concat(I.status," ").concat(I.statusText),I);if(I.status>=500)throw new iF("Invalid status code: ".concat(I.status," ").concat(I.statusText),I);if(I.headers.get("Content-Type")!=="application/json")throw new sF("Invalid content type: ".concat(I.headers.get("Content-Type")),I);return[4,I.json()];case 3:return O=H.sent(),k=O.url,f&&f({status:"connecting",channelUrl:k,message:"Received channel URL",response:I}),[3,5];case 4:if(P=H.sent(),d&&(A=new rF("FetchError",{data:P}),d(A)),P instanceof tE)throw P;return o&&o("closed"),[2,M()];case 5:return[2,new Promise(function(se){var re=new S(k),te=!1,Z=function(){re.readyState!==2&&(te=!0,re.close())};re.addEventListener("open",function(){o&&o("connected"),se(Z)});var G=setInterval(function(){re.readyState===2&&(clearInterval(G),o&&o("closed"),te||M())},300);re.addEventListener("update",function(fe){var R=JSON.parse(fe.data);l(R)}),re.addEventListener("channelError",function(fe){var R=JSON.parse(fe.data);R.fatal&&(te=!0),c&&c(R),re.close()}),re.addEventListener("onerror",function(fe){var R=fe;d&&d(R),re.close()})})]}})})}var nE=Object.prototype.hasOwnProperty;function rE(t,e,n){for(n of t.keys())if(Vl(n,e))return n}function Vl(t,e){var n,r,i;if(t===e)return!0;if(t&&e&&(n=t.constructor)===e.constructor){if(n===Date)return t.getTime()===e.getTime();if(n===RegExp)return t.toString()===e.toString();if(n===Array){if((r=t.length)===e.length)for(;r--&&Vl(t[r],e[r]););return r===-1}if(n===Set){if(t.size!==e.size)return!1;for(r of t)if(i=r,i&&typeof i=="object"&&(i=rE(e,i),!i)||!e.has(i))return!1;return!0}if(n===Map){if(t.size!==e.size)return!1;for(r of t)if(i=r[0],i&&typeof i=="object"&&(i=rE(e,i),!i)||!Vl(r[1],e.get(i)))return!1;return!0}if(n===ArrayBuffer)t=new Uint8Array(t),e=new Uint8Array(e);else if(n===DataView){if((r=t.byteLength)===e.byteLength)for(;r--&&t.getInt8(r)===e.getInt8(r););return r===-1}if(ArrayBuffer.isView(t)){if((r=t.byteLength)===e.byteLength)for(;r--&&t[r]===e[r];);return r===-1}if(!n||typeof t=="object"){r=0;for(n in t)if(nE.call(t,n)&&++r&&!nE.call(e,n)||!(n in e)||!Vl(t[n],e[n]))return!1;return Object.keys(e).length===r}}return t!==t&&e!==e}function oF(t){var e=C.useRef(t),n=C.useRef(0);return Vl(t,e.current)||(e.current=t,n.current+=1),C.useMemo(function(){return e.current},[n.current])}function aF(t,e){return C.useEffect(t,oF(e))}var lF=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})},uF=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function cF(t){const{enabled:e,initialData:n}=t,r=uF(t,["enabled","initialData"]),[i,o]=C.useState(null),[l,c]=C.useState(null),[d,f]=C.useState(e?"connecting":"closed"),p=r;return aF(()=>{if(e===!1)return f("closed"),()=>{};let m;function y(){return lF(this,void 0,void 0,function*(){m=yield Ck(Object.assign(Object.assign({},p),{onStatusChange:b=>{f(b)},onUpdate:b=>{o(null),c(b.response.data)},onChannelError:b=>{c(null),o(b)}}))})}return y(),()=>{m&&m()}},[p]),{error:i,status:d,data:l||n}}function Dl(t){return Object.values(t).find(e=>e?.attributes.api_key===ai)}function iE(t){return Object.values(t).filter(e=>e!==void 0)}const dF=["token","unauthorized","401","403","authentication","forbidden"],fF=["network","fetch","connection","timeout","socket","econnrefused"],hF=["graphql","query","syntax","validation"],pF=["forbidden","401","403"],mF=["network","fetch","timeout"];function Kl(t,e){return e.some(n=>t.includes(n))}function yF(t){const e=t.message.toLowerCase();return Kl(e,dF)?{type:"token_expired",message:"CDA token is invalid or expired. Please reconfigure in plugin settings."}:Kl(e,fF)?{type:"network_error",message:"Connection lost. Attempting to reconnect..."}:Kl(e,hF)?{type:"graphql_error",message:"Query error. Please refresh the page."}:{type:"unknown",message:"Sync error occurred. Please try again."}}function kk(t){const e=t.message.toLowerCase();return Kl(e,pF)?{type:"permission_denied",message:"Permission denied."}:Kl(e,mF)?{type:"network_error",message:"Network error. Check your connection."}:{type:"unknown",message:"Failed to load data."}}function Ak(t){if(t instanceof Error)return t;if(typeof t=="object"&&t!==null){const e=t;if(typeof e.message=="string")return new Error(e.message)}return new Error(String(t))}function sE(t,e){const n=[];for(const r of t)if(ia(r.content)&&r.authorId===e&&n.push({comment:r}),r.replies)for(const i of r.replies)ia(i.content)&&i.authorId===e&&n.push({comment:i,parentId:r.id});return n}function oE(t,e){const n=[],r=[...t];for(const i of e)if(!i.parentId)r.some(l=>l.id===i.comment.id)||r.push(i.comment);else{const o=r.findIndex(l=>l.id===i.parentId);if(o===-1)n.push(i);else{const l=r[o],c=l.replies??[];c.some(f=>f.id===i.comment.id)||(r[o]={...l,replies:[...c,i.comment]})}}return{comments:r,orphanedDrafts:n}}const _g={CONNECTING:"connecting",CLOSED:"closed"};function gF({ctx:t,realTimeEnabled:e,cdaToken:n,client:r,commentsModelId:i,isSyncAllowed:o,query:l,variables:c,filterParams:d,subscriptionEnabled:f,onCommentRecordIdChange:p,currentUserId:m,onOrphanedDraft:y,onBeforeSync:b,onAfterSync:S}){const[w,T]=C.useState([]),[M,k]=C.useState(null),[j,I]=C.useState(!0),O=C.useCallback(Ne=>{k(Ne),p?.(Ne)},[p]),[P,A]=C.useState(0),U=C.useRef(0),H=C.useRef(null),[se,re]=C.useState(!1),te=C.useRef(null),Z=f&&!!n&&e,G={modelId:d.modelId,recordId:d.recordId},fe=i??Dl(t.itemTypes)?.id??null,R=C.useRef(0),$=C.useRef(0),ie=C.useRef(o),{data:me,status:ye,error:N}=cF({query:l,variables:c,token:n??"",enabled:Z,includeDrafts:!0,reconnectionPeriod:P>0?100:void 0});C.useEffect(()=>{Z&&Be("Comments subscription status changed",{modelId:G.modelId,recordId:G.recordId,status:ye,subscriptionKey:P})},[Z,G.modelId,G.recordId,ye,P]),C.useEffect(()=>{Z&&ye==="connected"&&(U.current=0,re(!1),Be("Comments subscription connected",{modelId:G.modelId,recordId:G.recordId,subscriptionKey:P}),te.current&&(clearTimeout(te.current),te.current=null))},[Z,G.modelId,G.recordId,ye,P]),C.useEffect(()=>{if(!Z){re(!1),te.current&&(clearTimeout(te.current),te.current=null);return}if(ye==="closed"){const Ne=U.current,Re=Math.min(1e3*Math.pow(2,Ne),3e4);re(!0),Be("Comments subscription auto-reconnect scheduled",{consecutiveErrorCount:Ne,delayMs:Re,modelId:G.modelId,recordId:G.recordId}),te.current=setTimeout(()=>{te.current=null,Be("Comments subscription auto-reconnect triggered",{modelId:G.modelId,recordId:G.recordId}),A(De=>De+1)},Re)}return()=>{te.current&&(clearTimeout(te.current),te.current=null)}},[Z,G.modelId,G.recordId,ye]),C.useEffect(()=>{!o&&ie.current&&($.current=Date.now()),ie.current=o},[o]);const Q=C.useRef(me);C.useEffect(()=>{me&&me!==Q.current&&(R.current=Date.now(),Q.current=me)},[me]),C.useEffect(()=>{if(N){const Ne=N instanceof Error?N.message:String(N),Re=H.current,De=Re instanceof Error?Re.message:String(Re??"");(!Re||Ne!==De)&&(U.current+=1,H.current=N)}else H.current=null},[N]);const ce=C.useCallback(async()=>{if(Z){te.current&&(clearTimeout(te.current),te.current=null),re(!1);const Ne=U.current,Re=Math.min(1e3*Math.pow(2,Ne),3e4);Be("Manual comments retry requested",{delayMs:Re,errorCount:Ne,mode:"realtime",modelId:G.modelId,recordId:G.recordId}),Ne>0&&await new Promise(De=>setTimeout(De,Re)),A(De=>De+1)}else Be("Manual comments retry requested",{mode:"cma-fallback",modelId:G.modelId,recordId:G.recordId}),pe.current=0,ve(null),nt(Ne=>Ne+1)},[Z,G.modelId,G.recordId]),le=C.useRef(0);C.useEffect(()=>{if(!Z)return;const Ne=()=>{if(document.hidden)le.current=Date.now();else{const Re=le.current;if(Re>0){const De=Date.now()-Re;le.current=0,De>Ls.VISIBILITY_REFRESH_THRESHOLD_MS&&(Be("Refreshing comments subscription after tab visibility change",{hiddenDurationMs:De,modelId:G.modelId,recordId:G.recordId}),A(pt=>pt+1))}}};return document.addEventListener("visibilitychange",Ne),()=>{document.removeEventListener("visibilitychange",Ne)}},[Z,G.modelId,G.recordId]),C.useEffect(()=>{if(!Z)return;const Ne=me?.allProjectComments[0];if(me&&I(!1),!o)return;if(!Ne){O(null),b?.(),T(pt=>pt.length===0?pt:[]),S&&requestAnimationFrame(S);return}const Re=R.current,De=$.current;if(De>0&&Re>0&&Re<De){Be("Skipped stale realtime sync update",{commentRecordId:Ne.id,dataReceivedAt:Re,modelId:G.modelId,recordId:G.recordId,syncBlockedAt:De});return}$.current=0,O(Ne.id),b?.(),T(pt=>{const it=sE(pt,m),lt=Df(Ne.content),{comments:ft,orphanedDrafts:st}=oE(lt,it);return st.length>0&&y&&y(),ft}),S&&requestAnimationFrame(S)},[me,o,Z,O,m,y,b,S]);const[we,ve]=C.useState(null),[je,nt]=C.useState(0),pe=C.useRef(0);C.useEffect(()=>{if(Z)return;if(!r||!fe||!d.recordId){O(null),T(it=>it.length===0?it:[]),ve(null),I(!1);return}let Ne=!0,Re=null,De=null;const pt=async(it=0)=>{if(!Ne)return;I(!0),it===0&&ve(null),Be("Fetching comments via CMA fallback",{attempt:it+1,modelId:G.modelId,recordId:G.recordId});const lt=new Promise((ft,st)=>{Re=setTimeout(()=>{Ne&&st(new Error(`CMA fetch timed out after ${rd.TIMEOUT_MS/1e3} seconds`))},rd.TIMEOUT_MS)});try{const ft=r.items.list({filter:{type:ai,fields:{model_id:{eq:d.modelId},record_id:{eq:d.recordId}}}}),st=await Promise.race([ft,lt]);if(Re!==null&&(clearTimeout(Re),Re=null),!Ne)return;if(pe.current=0,Be("Comments fetched via CMA fallback",{attempt:it+1,commentRecordId:st[0]?.id??null,modelId:G.modelId,recordId:G.recordId,recordsFound:st.length}),st.length>0){const xe=st[0];typeof xe.id=="string"&&O(xe.id),b?.(),T(bn=>{const hr=sE(bn,m),_r=Df(xe.content),{comments:Qe,orphanedDrafts:Vn}=oE(_r,hr);return Vn.length>0&&y&&y(),Qe}),S&&requestAnimationFrame(S)}else O(null),b?.(),T(xe=>xe.length===0?xe:[]),S&&requestAnimationFrame(S);I(!1)}catch(ft){if(Re!==null&&(clearTimeout(Re),Re=null),!Ne)return;const st=ft instanceof Error?ft:new Error(String(ft));if(it<rd.MAX_RETRIES){pe.current=it+1;const xe=Math.min(1e3*Math.pow(2,it),8e3);tt(`CMA fetch failed (attempt ${it+1}/${rd.MAX_RETRIES+1}), retrying in ${xe}ms`,st,{modelId:d.modelId,recordId:d.recordId}),Be("CMA fallback retry scheduled",{attempt:it+1,delayMs:xe,errorMessage:st.message,modelId:G.modelId,recordId:G.recordId}),De=setTimeout(()=>{Ne&&pt(it+1)},xe);return}tt("Failed to fetch comments (CMA fallback) after max retries",st,{modelId:d.modelId,recordId:d.recordId,attempts:it+1}),Be("CMA fallback retries exhausted",{attempts:it+1,errorMessage:st.message,modelId:G.modelId,recordId:G.recordId}),ve(st),I(!1)}};return pt(),()=>{Ne=!1,Re!==null&&(clearTimeout(Re),Re=null),De!==null&&(clearTimeout(De),De=null)}},[Z,r,d.modelId,d.recordId,fe,je,O,T,m,y,b,S]);const Me=N?Ak(N):we,wt=Me?{error:Me,...yF(Me),consecutiveCount:U.current}:null;return{comments:w,setComments:T,commentsModelId:fe,commentRecordId:M,setCommentRecordId:O,isLoading:j,error:Me,errorInfo:wt,status:ye,retry:ce,isAutoReconnecting:se}}const bF="_indicator_1yi3h_1",vF="_banner_1yi3h_13",SF="_spinner_1yi3h_49",wF="_icon_1yi3h_68",_F="_text_1yi3h_78",TF="_count_1yi3h_82",EF="_retryButton_1yi3h_86",Ht={indicator:bF,banner:vF,spinner:SF,icon:wF,text:_F,count:TF,retryButton:EF};function MF({subscriptionStatus:t,subscriptionError:e,retryState:n,onRetry:r,realTimeEnabled:i,isAutoReconnecting:o=!1,variant:l="inline"}){if(n.isRetrying)return E.jsxs("div",{className:Ht.indicator,"data-status":"retrying",role:"status","aria-live":"polite","aria-atomic":"true",children:[E.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),E.jsxs("span",{className:Ht.text,children:[n.message,n.retryCount>1&&E.jsxs("span",{className:Ht.count,children:[" (attempt ",n.retryCount,")"]})]})]});if(e)return E.jsxs("div",{className:Ht.indicator,"data-status":"error",role:"alert","aria-live":"assertive",children:[E.jsx("span",{className:Ht.icon,"aria-hidden":"true",children:"!"}),E.jsx("span",{className:Ht.text,children:"Sync error"}),r&&E.jsx("button",{type:"button",className:Ht.retryButton,onClick:r,children:"Retry"})]});if(t===_g.CONNECTING)return E.jsxs("div",{className:Ht.indicator,"data-status":"connecting",role:"status","aria-live":"polite",children:[E.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),E.jsx("span",{className:Ht.text,children:"Connecting..."})]});if(i&&t===_g.CLOSED){if(o){const c=l==="banner"?`${Ht.indicator} ${Ht.banner}`:Ht.indicator;return E.jsxs("div",{className:c,"data-status":"reconnecting",role:"status","aria-live":"polite",children:[E.jsx("span",{className:Ht.spinner,"aria-hidden":"true"}),E.jsx("span",{className:Ht.text,children:"Reconnecting..."})]})}return E.jsxs("div",{className:Ht.indicator,"data-status":"error",role:"alert","aria-live":"assertive",children:[E.jsx("span",{className:Ht.icon,"aria-hidden":"true",children:"!"}),E.jsx("span",{className:Ht.text,children:"Connection lost"}),r&&E.jsx("button",{type:"button",className:Ht.retryButton,onClick:r,children:"Retry"})]})}return null}const aE=C.memo(MF);function Ok(t){return typeof t=="object"&&!!t&&"data"in t}function xF(t){return typeof t=="object"&&!!t&&"included"in t}function wr({__itemTypeId:t,id:e,type:n,attributes:r,relationships:i,meta:o}){return Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},t?{__itemTypeId:t}:{}),e?{id:e}:{}),n?{type:n}:{}),r||{}),i?Object.fromEntries(Object.entries(i).map(([l,c])=>[l,c?.data])):{}),o?{meta:o}:{})}function z(t){if(!Ok(t))throw new Error("Invalid body!");return Array.isArray(t.data)?t.data.map(wr):wr(t.data)}function Nk(t){return!!(t&&typeof t=="object"&&"type"in t&&t.type==="item")}function Tg(t){if(Array.isArray(t))return t.map(Tg);if(t&&typeof t=="object"){if(Nk(t))return Gl(t);const e={};for(const[n,r]of Object.entries(t))e[n]=Tg(r);return e}return t}function Gl(t){if(!Nk(t))return t;const e=t.attributes?Tg(t.attributes):t.attributes;return Object.assign(Object.assign({},t),{attributes:e,__itemTypeId:t.relationships.item_type.data.id})}function or(t){if(!Ok(t))throw new Error("Invalid body!");let e;Array.isArray(t.data)?e=t.data.map(Gl):e=Gl(t.data);let n;return xF(t)&&(n=t.included.map(Gl)),Object.assign(Object.assign(Object.assign({},t),{data:e}),n?{included:n}:{})}function CF(t){if(typeof t!="object"||t===null||!("data"in t))return!1;const e=t;if(!Array.isArray(e.data))return!1;const n=e;if(n.data.length===0)return!1;const r=n.data[0];return!(typeof r!="object"||r===null||!("id"in r)||!("type"in r)||!("attributes"in r)||r.type!=="api_error")}class kF extends Error{constructor(e){super("API Error!"),Object.setPrototypeOf(this,new.target.prototype),"captureStackTrace"in Error?Error.captureStackTrace(this,is):this.stack=new Error().stack,this.request=e.request,this.preCallStack=e.preCallStack,this.message=`${e.request.method} ${e.request.url}: Timeout error`,this.preCallStack&&(this.stack+=`
175
+ Caused By:
176
+ ${this.preCallStack}`)}}class is extends Error{constructor(e){super("API Error!"),Object.setPrototypeOf(this,new.target.prototype),"captureStackTrace"in Error?Error.captureStackTrace(this,is):this.stack=new Error().stack,this.request=e.request,this.response=e.response,this.preCallStack=e.preCallStack;let n=`${e.request.method} ${e.request.url}: ${this.response.status} ${this.response.statusText}`;this.errors.length>0&&(n+=`
177
+
178
+ ${JSON.stringify(this.errors,null,2)}`),this.message=n,this.preCallStack&&(this.stack+=`
179
+ Caused By:
180
+ ${this.preCallStack}`)}get errors(){return CF(this.response.body)?this.response.body.data:[]}findError(e,n){const r=Array.isArray(e)?e:[e];return this.errors.find(i=>r.includes(i.attributes.code)&&(!n||(typeof n=="function"?n(i.attributes.details):Object.entries(n).every(([o,l])=>i.attributes.details[o]===l))))}}class vu extends Error{constructor(){super("Promise canceled!"),Object.setPrototypeOf(this,new.target.prototype)}}function Su(t,e){let n=null;const r=new Promise((i,o)=>{n=()=>{try{e&&e(),o(new vu)}catch(c){o(c)}},(typeof t=="function"?t():t).then(i,o)});return n&&(r.cancel=n),r}function Ad(t){return new Promise(e=>{setTimeout(e,t)})}var AF=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})};function OF(t){return AF(this,void 0,void 0,function*(){let e,n=0;do try{n+=1,yield Ad(n*1e3),e=yield t()}catch(r){if(!(r instanceof is)||r.response.status!==404)throw r}while(!e);return e})}var xl={},Fi={},hy={},lE;function Rk(){return lE||(lE=1,(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.TaskCollisionStrategy=void 0,(function(e){e[e.DEFAULT=0]="DEFAULT",e[e.KEEP_THIS=1]="KEEP_THIS",e[e.KEEP_OTHER=2]="KEEP_OTHER",e[e.KEEP_BOTH=3]="KEEP_BOTH",e[e.RESOLVE_THIS=4]="RESOLVE_THIS",e[e.RESOLVE_OTHER=5]="RESOLVE_OTHER"})(t.TaskCollisionStrategy||(t.TaskCollisionStrategy={}))})(hy)),hy}var bd={},uE;function Dk(){if(uE)return bd;uE=1,Object.defineProperty(bd,"__esModule",{value:!0});let t=class{constructor(n,r){this._code=n,this._message=r}get code(){return this._code}get message(){return this._message}};return bd.default=t,bd}var Ds={},cE;function Ik(){if(cE)return Ds;cE=1,Object.defineProperty(Ds,"__esModule",{value:!0}),Ds.mutexEquality=Ds.mutexBitwiseAnd=void 0;function t(n,r){return(n&r)!==0}Ds.mutexBitwiseAnd=t;function e(n,r){return n===r}return Ds.mutexEquality=e,Ds}var vd={},dE;function NF(){if(dE)return vd;dE=1,Object.defineProperty(vd,"__esModule",{value:!0});let t=class{constructor(n,r){this._meta=void 0,this._task=n,this._scheduler=r}withDescriptor(n){return this._descriptor=n,this}withMutex(n){return this._mutex=n,this}withMeta(n){return this._meta=n,this}runBeforeExecuting(n){return this._onPreExecute=n,this}handleCollisions(n){return this._onTaskCollision=n,this}execute(n){return this._scheduler.enqueue({priority:n,mutex:this._mutex,descriptor:this._descriptor,meta:this._meta,execute:this._task,onPreExecute:this._onPreExecute,onTaskCollision:this._onTaskCollision})}};return vd.default=t,vd}var fE;function RF(){if(fE)return Fi;fE=1;var t=Fi&&Fi.__awaiter||function(f,p,m,y){function b(S){return S instanceof m?S:new m(function(w){w(S)})}return new(m||(m=Promise))(function(S,w){function T(j){try{k(y.next(j))}catch(I){w(I)}}function M(j){try{k(y.throw(j))}catch(I){w(I)}}function k(j){j.done?S(j.value):b(j.value).then(T,M)}k((y=y.apply(f,p||[])).next())})},e=Fi&&Fi.__importDefault||function(f){return f&&f.__esModule?f:{default:f}};Object.defineProperty(Fi,"__esModule",{value:!0});const n=Rk(),r=e(Dk()),i=Ik(),o=e(NF());var l;(function(f){f[f.PENDING=0]="PENDING",f[f.EXECUTING=1]="EXECUTING",f[f.TERMINATED=2]="TERMINATED"})(l||(l={}));function c(f,p){for(let m of f.listeners)m.reject(p)}let d=class{constructor(p,m={}){this._queue=[],this._isExecuting=!1,this._idleListeners=[],this._maxConcurrentTasks=p,this._samePriorityMutex=!!m.samePriorityMutex,this._mutexStrategy=m.mutexStrategy||i.mutexEquality,m.disableLogging?this._errorLog=()=>{}:this._errorLog=console.error}enqueue(p){return new Promise((m,y)=>{typeof p=="function"&&(p={priority:0,execute:p});const b=this._checkMutexes(p,m,y);b.task?this._addTask(b.task):b.canceled&&y(this.createCanceledError())})}prepare(p){return new o.default(p,this)}_addTask(p){this._queue.push(p),this._applyPriorities(),this._isExecuting||(this._isExecuting=!0,setTimeout(this._executeNextTasks.bind(this)))}get executingTasks(){return this._queue.reduce((p,m)=>m.state===l.EXECUTING?p+1:p,0)}createCanceledError(){return new r.default(50,"Task has been canceled in favor of another task")}_findFirstPendingTask(){return this._queue.find(p=>p.state===l.PENDING)}_isIdle(){return this._queue.length===0||!this._queue.find(p=>p.state!==l.TERMINATED)}_removeTaskAt(p){this._queue.splice(p,1)}_executeTask(p){return t(this,void 0,void 0,function*(){try{return p.task.onPreExecute&&p.task.onPreExecute(),yield p.task.execute()}catch(m){throw m}finally{p.state=l.TERMINATED;let m=this._queue.indexOf(p);this._removeTaskAt(m),this._executeNextTasks()}})}_executeNextTasks(){let p=this.executingTasks;if(p>=this._maxConcurrentTasks)return;let m=this._maxConcurrentTasks-p;for(let y=0;y<m;y++){const b=this._findFirstPendingTask();if(!b){this._isIdle()&&this._switchToIdle();return}b.state=l.EXECUTING,this._executeTask(b).then(S=>{for(const{resolve:w}of b.listeners)try{w(S)}catch(T){this._errorLog("An error occurred while resolving listener",T)}}).catch(S=>{for(const{reject:w}of b.listeners)try{w(S)}catch(T){this._errorLog("An error occurred while rejecting listener",T)}})}}_switchToIdle(){this._isExecuting=!1;const p=this._idleListeners;this._idleListeners=[];for(const{resolve:m}of p)try{m()}catch{}}waitForIdle(){return this._isExecuting?new Promise((p,m)=>{this._idleListeners.push({resolve:p,reject:m})}):Promise.resolve()}_applyPriorities(){this._queue.sort((p,m)=>m.task.priority-p.task.priority)}_checkMutexes(p,m,y){for(let b=0;b<this._queue.length;b++){let S=this._queue[b];if(S.state===l.TERMINATED||this._samePriorityMutex&&S.task.priority!=p.priority||!S.task.mutex||!p.mutex||!this._mutexStrategy(S.task.mutex,p.mutex))continue;let w,T;if(S.task.onTaskCollision)if(w=S.task.onTaskCollision(p),w===n.TaskCollisionStrategy.KEEP_OTHER&&S.state!==l.EXECUTING){this._removeTaskAt(b--),c(S,this.createCanceledError());continue}else{if(w===n.TaskCollisionStrategy.KEEP_THIS)return{canceled:!0};if(w===n.TaskCollisionStrategy.RESOLVE_OTHER)return this._removeTaskAt(b--),{canceled:!1,task:{task:p,state:l.PENDING,listeners:[{resolve:m,reject:y},...S.listeners]}};if(w===n.TaskCollisionStrategy.RESOLVE_THIS)return S.listeners=[...S.listeners,{resolve:m,reject:y}],{canceled:!1}}if(p.onTaskCollision){if(T=p.onTaskCollision(S.task),T===n.TaskCollisionStrategy.KEEP_OTHER)return{canceled:!0};if(T===n.TaskCollisionStrategy.KEEP_THIS){this._removeTaskAt(b--),c(S,this.createCanceledError());continue}else{if(T===n.TaskCollisionStrategy.RESOLVE_OTHER)return S.listeners=[...S.listeners,{resolve:m,reject:y}],{canceled:!1};if(T===n.TaskCollisionStrategy.RESOLVE_THIS)return this._removeTaskAt(b--),{canceled:!1,task:{task:p,state:l.PENDING,listeners:[{resolve:m,reject:y},...S.listeners]}}}}if(!(w===n.TaskCollisionStrategy.KEEP_BOTH&&T===n.TaskCollisionStrategy.KEEP_BOTH))return{canceled:!0}}return{canceled:!1,task:{task:p,state:l.PENDING,listeners:[{resolve:m,reject:y}]}}}};return Fi.default=d,Fi}var hE;function DF(){return hE||(hE=1,(function(t){var e=xl&&xl.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(t,"__esModule",{value:!0}),t.mutexEquality=t.mutexBitwiseAnd=t.SchedulerError=t.TaskCollisionStrategy=t.Scheduler=void 0;const n=e(RF());t.Scheduler=n.default;const r=Rk();Object.defineProperty(t,"TaskCollisionStrategy",{enumerable:!0,get:function(){return r.TaskCollisionStrategy}});const i=e(Dk());t.SchedulerError=i.default;const o=Ik();Object.defineProperty(t,"mutexBitwiseAnd",{enumerable:!0,get:function(){return o.mutexBitwiseAnd}}),Object.defineProperty(t,"mutexEquality",{enumerable:!0,get:function(){return o.mutexEquality}})})(xl)),xl}var IF=DF(),Us=function(t){return this instanceof Us?(this.v=t,this):new Us(t)},LF=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof Us?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};function mi(t,e,n,r){return LF(this,arguments,function*(){const o=n?.perPage||t.defaultLimit;if(o>t.maxLimit)throw new Error(`perPage option cannot exceed maximum value of ${t.maxLimit}`);const l=n?.concurrency||1;if(l>10)throw new Error("concurrency option cannot exceed maximum value of 10");const c=yield Us(e({limit:o,offset:0}));for(const m of c.data)yield yield Us(m);const d=c.meta.total_count,f=new IF.Scheduler(l),p=[];for(let m=o;m<d;m+=o)p.push(f.enqueue(()=>e({limit:o,offset:m})));for(;p.length>0;){const m=yield Us(p.shift());for(const y of m.data)yield yield Us(r?Gl(y):y)}})}function yi(t){t&&"page"in t&&console.warn("Passing a `page` query param on paged iterators has no effect: use the `perPage` option instead.")}const Lk="__ARRAY_INDEX__";function jF(t){return t.reduce((e,n,r)=>r===0?n:n===Lk?`${e}[]`:`${e}[${n}]`,"")}function BF(t){if(typeof t=="number"||typeof t=="string")return t.toString();if(t===!0)return"true";if(t===!1)return"false";throw`Don't know how to serialize param value ${JSON.stringify(t)}`}function Eg(t,e=[]){const n=[];if(typeof t=="number"||typeof t=="string"||typeof t=="boolean")n.push([jF(e),BF(t)]);else if(typeof t=="object"){if(Array.isArray(t))for(const r of t)for(const i of Eg(r,[...e,Lk]))n.push(i);else if(t)for(const[r,i]of Object.entries(t))for(const o of Eg(i,[...e,r]))n.push(o)}return n}var zF=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})};const PF=typeof window<"u"&&typeof window.document<"u",UF=5;var sr;(function(t){t[t.NONE=0]="NONE",t[t.BASIC=1]="BASIC",t[t.BODY=2]="BODY",t[t.BODY_AND_HEADERS=3]="BODY_AND_HEADERS"})(sr||(sr={}));function qF(t){const e={};return t.forEach((n,r)=>{e[r]=n}),e}function pE(t,e,n,r,i,o,l){return{request:{url:e,method:t,headers:n,body:r},response:{status:i.status,statusText:i.statusText,headers:qF(i.headers),body:o},preCallStack:l}}function $F(t,e,n,r,i){return{request:{url:e,method:t,headers:n,body:r},preCallStack:i}}function FF(t,e,n,r,i,o,l){return{request:{url:e,method:t,headers:n,body:r},response:{status:i,statusText:"N/A",headers:{},body:o},preCallStack:l}}function HF(t){return typeof t=="object"&&!!t&&"code"in t}function VF(t){return Object.fromEntries(Object.entries(t).map(([e,n])=>[e.toLowerCase(),n]))}let mE=1;function KF(t){const e=t||(typeof fetch>"u"?void 0:fetch)||(typeof globalThis>"u"?void 0:globalThis.fetch);if(typeof e>"u")throw new Error("fetch() is not available: either polyfill it globally, or provide it as fetchFn option.");return e}function Od(t){var e;return zF(this,void 0,void 0,function*(){const n=mE;mE+=1;const r=KF(t.fetchFn),i=t.preCallStack,o=t.userAgent||"@datocms/rest-client-utils",l=t.retryCount||1,c=t.logLevel||sr.NONE,d="autoRetry"in t?t.autoRetry:!0,f=t.logFn||(()=>!0),p=Object.assign({"content-type":"application/json",accept:"application/json",authorization:`Bearer ${t.apiToken}`,"user-agent":o},t.extraHeaders?VF(t.extraHeaders):{});PF&&delete p["user-agent"];const m=t.baseUrl.replace(/\/$/,""),y=t.body?JSON.stringify(t.body,null,2):void 0,b=t.queryParams&&Object.keys(t.queryParams).length>0?`?${new URLSearchParams(Eg(t.queryParams)).toString()}`:"",S=`${m}${t.url}${b}`;if(c>=sr.BASIC){if(f(`[${n}] ${t.method} ${S}`),c>=sr.BODY_AND_HEADERS)for(const[w,T]of Object.entries(p||{}))f(`[${n}] ${w}: ${T}`);c>=sr.BODY&&y&&f(`[${n}] ${y}`)}try{const w=Su(r(S,{method:t.method,headers:p,body:y})),T=setTimeout(()=>{w.cancel()},t.requestTimeout||3e4),M=yield w;clearTimeout(T);const k=M.headers.get("Content-Type"),j=k&&!k.includes("application/json");if(M.status===429||j){if(!d||j&&t.method!=="GET")throw new is(pE(t.method,S,p,t.body,M,void 0,i));const A=M.headers.has("X-RateLimit-Reset")?Number.parseInt(M.headers.get("X-RateLimit-Reset"),10):l;return c>=sr.BASIC&&(M.status===429?f(`[${n}] Rate limit exceeded, wait ${A} seconds then retry...`):f(`[${n}] Invalid response content type "${k}" (status ${M.status}). Wait ${A} seconds then retry...`)),yield Ad(A*1e3),Od(Object.assign(Object.assign({},t),{retryCount:l+1}))}if(c>=sr.BASIC&&(f(`[${n}] Status: ${M.status} (${M.statusText})`),c>=sr.BODY_AND_HEADERS))for(const A of["x-api-version","x-environment","x-queue-time","x-ratelimit-remaining","x-request-id","cf-ray"]){const U=M.headers.get(A);U&&f(`[${n}] ${A}: ${U}`)}let I=M.status===204?void 0:yield M.json();if(c>=sr.BODY&&I&&f(`[${n}] ${JSON.stringify(I,null,2)}`),M.status===202){const A=yield t.fetchJobResult(I.data.id);if(A.status<200||A.status>=300)throw new is(FF(t.method,S,p,t.body,A.status,A.payload,i));I=A.payload}if(M.status>=200&&M.status<300)return I;const O=new is(pE(t.method,S,p,t.body,M,I,i)),P=(e=O.errors.find(A=>A.attributes.transient))===null||e===void 0?void 0:e.attributes.code;if(d&&P)return c>=sr.BASIC&&f(`[${n}] ${P}, wait ${l} seconds then retry...`),yield Ad(l*1e3),Od(Object.assign(Object.assign({},t),{retryCount:l+1}));throw O}catch(w){if(w instanceof vu||HF(w)&&w.code.includes("ETIMEDOUT")){if(d&&l<UF)return c>=sr.BASIC&&f(`[${n}] Timeout error, wait ${l} seconds then retry...`),yield Ad(l*1e3),Od(Object.assign(Object.assign({},t),{retryCount:l+1}));throw new kF($F(t.method,S,p,t.body,i))}throw w}})}var jk=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};function Nd(t){return typeof t=="object"&&!!t&&"id"in t&&"type"in t}function py(t){return Array.isArray(t)&&t.every(Nd)}function Se(t,e){if(typeof t!="object"||!t)throw new Error("Invalid body!");if(Array.isArray(t))return{data:t.map(f=>{var p;return(p=Se(f,e))===null||p===void 0?void 0:p.data})};const n=t,{id:r,type:i,meta:o}=n,l=jk(n,["id","type","meta"]),c={},d={};if(e.attributes==="*")for(const[f,p]of Object.entries(l))if(e.relationships.includes(f))if(Nd(p)){const{id:m,type:y}=p;d[f]={data:{id:m,type:y}}}else py(p)?d[f]={data:p.map(({id:m,type:y})=>({id:m,type:y}))}:d[f]={data:null};else c[f]=p;else if(e.relationships==="*")for(const[f,p]of Object.entries(l))if(e.attributes.includes(f))c[f]=p;else if(Nd(p)){const{id:m,type:y}=p;d[f]={data:{id:m,type:y}}}else py(p)?d[f]={data:p.map(({id:m,type:y})=>({id:m,type:y}))}:d[f]={data:null};else{for(const[f,p]of Object.entries(l))if(e.attributes.includes(f))c[f]=p;else if(e.relationships.includes(f))if(Nd(p)){const{id:m,type:y}=p;d[f]={data:{id:m,type:y}}}else py(p)?d[f]={data:p.map(({id:m,type:y})=>({id:m,type:y}))}:d[f]={data:null};e.attributes.includes("type")&&(c.type=i)}return{data:Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({},r||e.id?{id:r||e.id}:{}),{type:e.type}),Object.keys(c).length>0?{attributes:c}:{}),Object.keys(d).length>0?{relationships:d}:{}),o?{meta:o}:{})}}function Mg(t){if(Array.isArray(t))return t.map(Mg);if(t&&typeof t=="object"){const e={};for(const[n,r]of Object.entries(t))n!=="__itemTypeId"&&(e[n]=Mg(r));return e}return t}function yE(t){if(!t||typeof t!="object")return t;const{__itemTypeId:e}=t,n=jk(t,["__itemTypeId"]),r={};for(const[i,o]of Object.entries(n))r[i]=Mg(o);return r}function Sd(t){return!t||!("data"in t)?t:Array.isArray(t.data)?Object.assign(Object.assign({},t),{data:t.data.map(yE)}):Object.assign(Object.assign({},t),{data:yE(t.data)})}function J(t){return typeof t=="string"?t:t.id}class ze{constructor(e){this.client=e}}class Bk extends ze{create(e){return this.rawCreate(Se(e,{type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_search_indexes","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","can_access_search_index_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions","positive_search_index_permissions","negative_search_index_permissions"],relationships:["inherits_permissions_from"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/roles",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"role",attributes:["name","can_edit_favicon","can_edit_site","can_edit_schema","can_manage_menu","can_edit_environment","can_promote_environments","environments_access","can_manage_users","can_manage_shared_filters","can_manage_search_indexes","can_manage_upload_collections","can_manage_build_triggers","can_manage_webhooks","can_manage_environments","can_manage_sso","can_access_audit_log","can_manage_workflows","can_manage_access_tokens","can_perform_site_search","can_access_build_events_log","can_access_search_index_events_log","positive_item_type_permissions","negative_item_type_permissions","positive_upload_permissions","negative_upload_permissions","positive_build_trigger_permissions","negative_build_trigger_permissions","positive_search_index_permissions","negative_search_index_permissions"],relationships:["inherits_permissions_from"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/roles/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/roles"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/roles/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/roles/${e}`})}duplicate(e){return this.rawDuplicate(J(e)).then(n=>z(n))}rawDuplicate(e){return this.client.request({method:"POST",url:`/roles/${e}/duplicate`})}}Bk.TYPE="role";var GF=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})};function gE(t,e){return t==null&&e==null?!0:t===e}function YF(t,e){for(const n in t)if(!gE(t[n],e[n]))return!1;for(const n in e)if(!gE(t[n],e[n]))return!1;return!0}function wd(t,e,n,r){if(!e)return t;const{add:i,remove:o}=e;return[...o?o.reduce((l,c)=>{const d=Object.assign(Object.assign({},c),{environment:n}),f=l.find(p=>YF(p,d));if(!f)throw new Error(`Cannot find rule ${JSON.stringify(d)} to remove in ${r}!`);return l.filter(p=>p!==f)},t):t,...i?i.map(l=>Object.assign({environment:n},l)):[]]}class QF extends Bk{updateCurrentEnvironmentPermissions(e,n){return GF(this,void 0,void 0,function*(){const r=this.client.config.environment||(yield this.client.environments.list()).find(d=>d.meta.primary).id,i=yield this.find(e),o=!!(n.positive_item_type_permissions||n.negative_item_type_permissions),l=!!(n.positive_upload_permissions||n.negative_upload_permissions),c=Object.assign(Object.assign({},o?{positive_item_type_permissions:wd(i.positive_item_type_permissions,n.positive_item_type_permissions,r,"positive_item_type_permissions"),negative_item_type_permissions:wd(i.negative_item_type_permissions,n.negative_item_type_permissions,r,"negative_item_type_permissions")}:{}),l?{positive_upload_permissions:wd(i.positive_upload_permissions,n.positive_upload_permissions,r,"positive_upload_permissions"),negative_upload_permissions:wd(i.negative_upload_permissions,n.negative_upload_permissions,r,"negative_upload_permissions")}:{});return this.update(e,c)})}}class zk extends ze{update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"user",attributes:["is_active"],relationships:["role"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/users/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/users"})}find(e,n){return this.rawFind(J(e),n).then(r=>z(r))}rawFind(e,n){return this.client.request({method:"GET",url:`/users/${e}`,queryParams:n})}findMe(e){return this.rawFindMe(e).then(n=>z(n))}rawFindMe(e){return this.client.request({method:"GET",url:"/users/me",queryParams:e})}destroy(e,n){return this.rawDestroy(J(e),n).then(r=>z(r))}rawDestroy(e,n){return this.client.request({method:"DELETE",url:`/users/${e}`,queryParams:n})}}zk.TYPE="user";class Pk extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/sso-users"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/sso-users/${e}`})}copyUsers(){return this.rawCopyUsers().then(e=>z(e))}rawCopyUsers(){return this.client.request({method:"POST",url:"/sso-users/copy-users"})}destroy(e,n){return this.rawDestroy(J(e),n).then(r=>z(r))}rawDestroy(e,n){return this.client.request({method:"DELETE",url:`/sso-users/${e}`,queryParams:n})}}Pk.TYPE="sso_user";class Uk extends ze{query(e){return this.rawQuery(Se(e,{type:"audit_log_query",attributes:["filter","next_token","detailed_log"],relationships:[]})).then(n=>z(n))}rawQuery(e){return this.client.request({method:"POST",url:"/audit-log-events/query",body:e})}}Uk.TYPE="audit_log_event";class qk extends ze{create(e){return this.rawCreate(Se(e,{type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/menu-items",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"menu_item",attributes:["label","external_url","position","open_in_new_tab"],relationships:["item_type","item_type_filter","parent"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/menu-items/${e}`,body:n})}list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/menu-items",queryParams:e})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/menu-items/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/menu-items/${e}`})}reorder(e){return this.rawReorder(Se(e,{type:"menu_item",attributes:["position"],relationships:["parent"]})).then(n=>z(n))}rawReorder(e){return this.client.request({method:"POST",url:"/menu-items/reorder",body:e})}}qk.TYPE="menu_item";class $k extends ze{create(e){return this.rawCreate(Se(e,{type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/schema-menu-items",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"schema_menu_item",attributes:["label","position","kind"],relationships:["item_type","parent","children"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/schema-menu-items/${e}`,body:n})}list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/schema-menu-items",queryParams:e})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/schema-menu-items/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/schema-menu-items/${e}`})}reorder(e){return this.rawReorder(Se(e,{type:"schema_menu_item",attributes:["position"],relationships:["parent"]})).then(n=>z(n))}rawReorder(e){return this.client.request({method:"POST",url:"/schema-menu-items/reorder",body:e})}}$k.TYPE="schema_menu_item";class Fk extends ze{create(e){return this.rawCreate(Se(e,{type:"upload_collection",attributes:["label","position"],relationships:["parent"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-collections",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"upload_collection",attributes:["label","position"],relationships:["parent","children"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/upload-collections/${e}`,body:n})}list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/upload-collections",queryParams:e})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/upload-collections/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/upload-collections/${e}`})}reorder(e){return this.rawReorder(Se(e,{type:"upload_collection",attributes:["position"],relationships:["parent"]})).then(n=>z(n))}rawReorder(e){return this.client.request({method:"POST",url:"/upload-collections/reorder",body:e})}}Fk.TYPE="upload_collection";class Hk extends ze{create(e,n){return this.rawCreate(Se(e,{type:"item_type",attributes:["name","api_key","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","collection_appeareance","collection_appearance","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]}),n).then(r=>z(r))}rawCreate(e,n){return this.client.request({method:"POST",url:"/item-types",body:e,queryParams:n})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"item_type",attributes:["name","api_key","collection_appeareance","collection_appearance","singleton","all_locales_required","sortable","modular_block","draft_mode_active","draft_saving_active","tree","ordering_direction","ordering_meta","has_singleton_item","hint","inverse_relationships_enabled"],relationships:["ordering_field","presentation_title_field","presentation_image_field","title_field","image_preview_field","excerpt_field","workflow"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/item-types/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/item-types"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/item-types/${e}`})}duplicate(e){return this.rawDuplicate(J(e)).then(n=>z(n))}rawDuplicate(e){return this.client.request({method:"POST",url:`/item-types/${e}/duplicate`})}destroy(e,n){return this.rawDestroy(J(e),n).then(r=>z(r))}rawDestroy(e,n){return this.client.request({method:"DELETE",url:`/item-types/${e}`,queryParams:n})}referencing(e){return this.rawReferencing(J(e)).then(n=>z(n))}rawReferencing(e){return this.client.request({method:"GET",url:`/item-types/${e}/referencing`})}rawReorderFieldsAndFieldsets(e,n){return this.client.request({method:"POST",url:`/item-types/${e}/reorder-fields-and-fieldsets`,body:n})}}Hk.TYPE="item_type";class Vk extends ze{create(e,n){return this.rawCreate(J(e),Se(n,{type:"field",attributes:["label","field_type","api_key","localized","validators","appeareance","appearance","position","hint","default_value","deep_filtering_enabled"],relationships:["fieldset"]})).then(r=>z(r))}rawCreate(e,n){return this.client.request({method:"POST",url:`/item-types/${e}/fields`,body:n})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"field",attributes:["default_value","label","api_key","localized","validators","appeareance","appearance","position","field_type","hint","deep_filtering_enabled"],relationships:["fieldset"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/fields/${e}`,body:n})}list(e){return this.rawList(J(e)).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields`})}referencing(e){return this.rawReferencing(J(e)).then(n=>z(n))}rawReferencing(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields/referencing`})}related(e){return this.rawRelated(J(e)).then(n=>z(n))}rawRelated(e){return this.client.request({method:"GET",url:`/item-types/${e}/fields/related`})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/fields/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/fields/${e}`})}duplicate(e){return this.rawDuplicate(J(e)).then(n=>z(n))}rawDuplicate(e){return this.client.request({method:"POST",url:`/fields/${e}/duplicate`})}}Vk.TYPE="field";class Kk extends ze{create(e,n){return this.rawCreate(J(e),Se(n,{type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(r=>z(r))}rawCreate(e,n){return this.client.request({method:"POST",url:`/item-types/${e}/fieldsets`,body:n})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"fieldset",attributes:["title","hint","position","collapsible","start_collapsed"],relationships:[]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/fieldsets/${e}`,body:n})}list(e){return this.rawList(J(e)).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:`/item-types/${e}/fieldsets`})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/fieldsets/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/fieldsets/${e}`})}}Kk.TYPE="fieldset";class Gk extends ze{create(e){return this.rawCreate(Se(e,{type:"email_credentials",attributes:["email","password","otp_code"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/sessions",body:e})}}Gk.TYPE="session";class Yk extends ze{create(e){return this.rawCreate(Se(e,{type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/access_tokens",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"access_token",attributes:["name","can_access_cda","can_access_cda_preview","can_access_cma"],relationships:["role"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/access_tokens/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/access_tokens"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/access_tokens/${e}`})}regenerateToken(e){return this.rawRegenerateToken(J(e)).then(n=>z(n))}rawRegenerateToken(e){return this.client.request({method:"POST",url:`/access_tokens/${e}/regenerate_token`})}destroy(e,n){return this.rawDestroy(J(e),n).then(r=>z(r))}rawDestroy(e,n){return this.client.request({method:"DELETE",url:`/access_tokens/${e}`,queryParams:n})}}Yk.TYPE="access_token";class Qk extends ze{create(e){return this.rawCreate(Se(e,{type:"plugin",attributes:["package_name","name","description","url","permissions","plugin_type","field_types","parameter_definitions","package_version"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/plugins",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"plugin",attributes:["name","description","url","parameters","package_version","permissions"],relationships:[]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/plugins/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/plugins"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/plugins/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/plugins/${e}`})}fields(e){return this.rawFields(J(e)).then(n=>z(n))}rawFields(e){return this.client.request({method:"GET",url:`/plugins/${e}/fields`})}}Qk.TYPE="plugin";class Xk extends ze{find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/job-results/${e}`})}}Xk.TYPE="job_result";class Jk extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/subscription-limits"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/subscription-limits/${e}`})}}Jk.TYPE="subscription_limit";class Wk extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/subscription-features"})}}Wk.TYPE="subscription_feature";var XF=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},sa=function(t){return this instanceof sa?(this.v=t,this):new sa(t)},JF=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof sa?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class Zk extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/build-events",queryParams:e})}listPagedIterator(e,n){return JF(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=XF(this.rawListPagedIterator(e,n)),p;p=yield sa(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield sa(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield sa(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/build-events/${e}`})}}Zk.TYPE="build_event";var WF=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},oa=function(t){return this instanceof oa?(this.v=t,this):new oa(t)},ZF=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof oa?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class eA extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/search-index-events",queryParams:e})}listPagedIterator(e,n){return ZF(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=WF(this.rawListPagedIterator(e,n)),p;p=yield oa(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield oa(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield oa(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/search-index-events/${e}`})}}eA.TYPE="search_index_event";var e7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},aa=function(t){return this instanceof aa?(this.v=t,this):new aa(t)},t7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof aa?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class tA extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/items",queryParams:e}).then(or)}listPagedIterator(e,n){return t7(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=e7(this.rawListPagedIterator(e,n)),p;p=yield aa(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield aa(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield aa(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n,!0)}validateExisting(e,n){return this.rawValidateExisting(J(e),Se(n,{id:J(e),type:"item",attributes:"*",relationships:["item_type","creator"]}))}rawValidateExisting(e,n){return this.client.request({method:"POST",url:`/items/${e}/validate`,body:Sd(n)})}validateNew(e){return this.rawValidateNew(Se(e,{type:"item",attributes:"*",relationships:["item_type","creator"]}))}rawValidateNew(e){return this.client.request({method:"POST",url:"/items/validate",body:Sd(e)})}create(e){return this.rawCreate(Se(e,{type:"item",attributes:"*",relationships:["item_type","creator"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/items",body:Sd(e)}).then(or)}duplicate(e){return this.rawDuplicate(J(e)).then(n=>z(n))}rawDuplicate(e){return this.client.request({method:"POST",url:`/items/${e}/duplicate`}).then(or)}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"item",attributes:"*",relationships:["item_type","creator"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/items/${e}`,body:Sd(n)}).then(or)}references(e,n){return this.rawReferences(J(e),n).then(r=>z(r))}rawReferences(e,n){return this.client.request({method:"GET",url:`/items/${e}/references`,queryParams:n}).then(or)}find(e,n){return this.rawFind(J(e),n).then(r=>z(r))}rawFind(e,n){return this.client.request({method:"GET",url:`/items/${e}`,queryParams:n}).then(or)}currentVsPublishedState(e){return this.rawCurrentVsPublishedState(J(e)).then(n=>z(n))}rawCurrentVsPublishedState(e){return this.client.request({method:"GET",url:`/items/${e}/current-vs-published-state`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}`}).then(or)}publish(e,n,r){return this.rawPublish(J(e),n?Se(n,{type:"selective_publish_operation",attributes:["content_in_locales","non_localized_content"],relationships:[]}):null,r).then(i=>z(i))}rawPublish(e,n,r){return this.client.request({method:"PUT",url:`/items/${e}/publish`,body:n,queryParams:r}).then(or)}unpublish(e,n,r){return this.rawUnpublish(J(e),n?Se(n,{type:"selective_unpublish_operation",attributes:["content_in_locales"],relationships:[]}):null,r).then(i=>z(i))}rawUnpublish(e,n,r){return this.client.request({method:"PUT",url:`/items/${e}/unpublish`,body:n,queryParams:r}).then(or)}bulkPublish(e){return this.rawBulkPublish(Se(e,{type:"item_bulk_publish_operation",attributes:[],relationships:["items"]})).then(n=>z(n))}rawBulkPublish(e){return this.client.request({method:"POST",url:"/items/bulk/publish",body:e})}bulkUnpublish(e){return this.rawBulkUnpublish(Se(e,{type:"item_bulk_unpublish_operation",attributes:[],relationships:["items"]})).then(n=>z(n))}rawBulkUnpublish(e){return this.client.request({method:"POST",url:"/items/bulk/unpublish",body:e})}bulkDestroy(e){return this.rawBulkDestroy(Se(e,{type:"item_bulk_destroy_operation",attributes:[],relationships:["items"]})).then(n=>z(n))}rawBulkDestroy(e){return this.client.request({method:"POST",url:"/items/bulk/destroy",body:e})}bulkMoveToStage(e){return this.rawBulkMoveToStage(Se(e,{type:"item_bulk_move_to_stage_operation",attributes:["stage"],relationships:["items"]})).then(n=>z(n))}rawBulkMoveToStage(e){return this.client.request({method:"POST",url:"/items/bulk/move-to-stage",body:e})}}tA.TYPE="item";var n7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},la=function(t){return this instanceof la?(this.v=t,this):new la(t)},r7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof la?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class nA extends ze{restore(e){return this.rawRestore(J(e)).then(n=>z(n))}rawRestore(e){return this.client.request({method:"POST",url:`/versions/${e}/restore`})}list(e,n){return this.rawList(J(e),n).then(r=>z(r))}rawList(e,n){return this.client.request({method:"GET",url:`/items/${e}/versions`,queryParams:n})}listPagedIterator(e,n,r){return r7(this,arguments,function*(){var o,l,c,d;try{for(var f=!0,p=n7(this.rawListPagedIterator(J(e),n,r)),m;m=yield la(p.next()),o=m.done,!o;){d=m.value,f=!1;try{yield yield la(wr(d))}finally{f=!0}}}catch(y){l={error:y}}finally{try{!f&&!o&&(c=p.return)&&(yield la(c.call(p)))}finally{if(l)throw l.error}}})}rawListPagedIterator(e,n,r){return yi(n),mi({defaultLimit:15,maxLimit:50},i=>this.rawList(e,Object.assign(Object.assign({},n),{page:i})),r)}find(e,n){return this.rawFind(J(e),n).then(r=>z(r))}rawFind(e,n){return this.client.request({method:"GET",url:`/versions/${e}`,queryParams:n})}}nA.TYPE="item_version";var i7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},ua=function(t){return this instanceof ua?(this.v=t,this):new ua(t)},s7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof ua?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};let N0=class extends ze{create(e){return this.rawCreate(Se(e,{type:"upload",attributes:["path","copyright","author","notes","default_field_metadata","tags"],relationships:["upload_collection"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/uploads",body:e})}list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/uploads",queryParams:e})}listPagedIterator(e,n){return s7(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=i7(this.rawListPagedIterator(e,n)),p;p=yield ua(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield ua(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield ua(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/uploads/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/uploads/${e}`})}update(e,n,r){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"upload",attributes:["path","basename","copyright","author","notes","tags","default_field_metadata"],relationships:["creator","upload_collection"]}),r).then(i=>z(i))}rawUpdate(e,n,r){return this.client.request({method:"PUT",url:`/uploads/${e}`,body:n,queryParams:r})}references(e,n){return this.rawReferences(J(e),n).then(r=>z(r))}rawReferences(e,n){return this.client.request({method:"GET",url:`/uploads/${e}/references`,queryParams:n}).then(or)}bulkTag(e){return this.rawBulkTag(Se(e,{type:"upload_bulk_tag_operation",attributes:["tags"],relationships:["uploads"]})).then(n=>z(n))}rawBulkTag(e){return this.client.request({method:"POST",url:"/uploads/bulk/tag",body:e})}bulkSetUploadCollection(e){return this.rawBulkSetUploadCollection(Se(e,{type:"upload_bulk_set_upload_collection_operation",attributes:[],relationships:["upload_collection","uploads"]})).then(n=>z(n))}rawBulkSetUploadCollection(e){return this.client.request({method:"POST",url:"/uploads/bulk/set-upload-collection",body:e})}bulkDestroy(e){return this.rawBulkDestroy(Se(e,{type:"upload_bulk_destroy_operation",attributes:[],relationships:["uploads"]})).then(n=>z(n))}rawBulkDestroy(e){return this.client.request({method:"POST",url:"/uploads/bulk/destroy",body:e})}};N0.TYPE="upload";class rA extends ze{create(e){return this.rawCreate(Se(e,{type:"upload_request",attributes:["filename"],relationships:["upload_collection"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-requests",body:e})}}rA.TYPE="upload_request";class iA extends ze{create(e,n){return this.rawCreate(J(e),Se(n,{type:"upload_track",attributes:["url_or_upload_request_id","type","name","language_code","closed_captions"],relationships:[]})).then(r=>z(r))}rawCreate(e,n){return this.client.request({method:"POST",url:`/uploads/${e}/tracks`,body:n})}list(e){return this.rawList(J(e)).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:`/uploads/${e}/tracks`})}destroy(e,n){return this.rawDestroy(J(e),J(n)).then(r=>z(r))}rawDestroy(e,n){return this.client.request({method:"DELETE",url:`/uploads/${e}/tracks/${n}`})}generateSubtitles(e,n){return this.rawGenerateSubtitles(J(e),Se(n,{type:"upload_track",attributes:["name","language_code"],relationships:[]})).then(r=>z(r))}rawGenerateSubtitles(e,n){return this.client.request({method:"POST",url:`/uploads/${e}/tracks/generate-subtitles`,body:n})}}iA.TYPE="upload_track";class sA extends ze{create(e,n){return this.rawCreate(J(e),Se(n,{type:"scheduled_publication",attributes:["publication_scheduled_at","selective_publication"],relationships:[]})).then(r=>z(r))}rawCreate(e,n){return this.client.request({method:"POST",url:`/items/${e}/scheduled-publication`,body:n})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}/scheduled-publication`}).then(or)}}sA.TYPE="scheduled_publication";class oA extends ze{create(e,n){return this.rawCreate(J(e),Se(n,{type:"scheduled_unpublishing",attributes:["unpublishing_scheduled_at","content_in_locales"],relationships:[]})).then(r=>z(r))}rawCreate(e,n){return this.client.request({method:"POST",url:`/items/${e}/scheduled-unpublishing`,body:n})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/items/${e}/scheduled-unpublishing`}).then(or)}}oA.TYPE="scheduled_unpublishing";var o7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},ca=function(t){return this instanceof ca?(this.v=t,this):new ca(t)},a7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof ca?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class aA extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/search-results",queryParams:e})}listPagedIterator(e,n){return a7(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=o7(this.rawListPagedIterator(e,n)),p;p=yield ca(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield ca(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield ca(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:20,maxLimit:100},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}}aA.TYPE="search_result";class lA extends ze{fork(e,n,r){return this.rawFork(J(e),Se(n,{id:J(e),type:"environment",attributes:[],relationships:[]}),r).then(i=>z(i))}rawFork(e,n,r){return this.client.request({method:"POST",url:`/environments/${e}/fork`,body:n,queryParams:r})}promote(e){return this.rawPromote(J(e)).then(n=>z(n))}rawPromote(e){return this.client.request({method:"PUT",url:`/environments/${e}/promote`})}rename(e,n){return this.rawRename(J(e),Se(n,{id:J(e),type:"environment",attributes:[],relationships:[]})).then(r=>z(r))}rawRename(e,n){return this.client.request({method:"PUT",url:`/environments/${e}/rename`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/environments"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/environments/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/environments/${e}`})}}lA.TYPE="environment";class uA extends ze{find(){return this.rawFind().then(e=>z(e))}rawFind(){return this.client.request({method:"GET",url:"/maintenance-mode"})}activate(e){return this.rawActivate(e).then(n=>z(n))}rawActivate(e){return this.client.request({method:"PUT",url:"/maintenance-mode/activate",queryParams:e})}deactivate(){return this.rawDeactivate().then(e=>z(e))}rawDeactivate(){return this.client.request({method:"PUT",url:"/maintenance-mode/deactivate"})}}uA.TYPE="maintenance_mode";class cA extends ze{create(e){return this.rawCreate(Se(e,{type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/webhooks",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"webhook",attributes:["name","url","custom_payload","headers","events","http_basic_user","http_basic_password","enabled","payload_api_version","nested_items_in_payload","auto_retry"],relationships:[]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/webhooks/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/webhooks"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/webhooks/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/webhooks/${e}`})}}cA.TYPE="webhook";var l7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},da=function(t){return this instanceof da?(this.v=t,this):new da(t)},u7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof da?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class dA extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/webhook_calls",queryParams:e})}listPagedIterator(e,n){return u7(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=l7(this.rawListPagedIterator(e,n)),p;p=yield da(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield da(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield da(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:30,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/webhook_calls/${e}`})}resendWebhook(e){return this.rawResendWebhook(J(e))}rawResendWebhook(e){return this.client.request({method:"POST",url:`/webhook_calls/${e}/resend_webhook`})}}dA.TYPE="webhook_call";class fA extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/build-triggers"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/build-triggers/${e}`})}create(e){return this.rawCreate(Se(e,{type:"build_trigger",attributes:["name","webhook_token","adapter","indexing_enabled","enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/build-triggers",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"build_trigger",attributes:["name","adapter","indexing_enabled","enabled","frontend_url","autotrigger_on_scheduled_publications","adapter_settings"],relationships:[]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/build-triggers/${e}`,body:n})}trigger(e){return this.rawTrigger(J(e))}rawTrigger(e){return this.client.request({method:"POST",url:`/build-triggers/${e}/trigger`})}abort(e){return this.rawAbort(J(e))}rawAbort(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}/abort`})}abortIndexing(e){return this.rawAbortIndexing(J(e))}rawAbortIndexing(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}/abort_indexing`})}reindex(e){return this.rawReindex(J(e))}rawReindex(e){return this.client.request({method:"PUT",url:`/build-triggers/${e}/reindex`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/build-triggers/${e}`})}}fA.TYPE="build_trigger";class hA extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/search-indexes"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/search-indexes/${e}`})}create(e){return this.rawCreate(Se(e,{type:"search_index",attributes:["name","enabled","frontend_url","user_agent_suffix"],relationships:["build_triggers"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/search-indexes",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"search_index",attributes:["name","enabled","frontend_url","user_agent_suffix"],relationships:["build_triggers"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/search-indexes/${e}`,body:n})}trigger(e){return this.rawTrigger(J(e))}rawTrigger(e){return this.client.request({method:"POST",url:`/search-indexes/${e}/trigger`})}abort(e){return this.rawAbort(J(e))}rawAbort(e){return this.client.request({method:"DELETE",url:`/search-indexes/${e}/abort`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/search-indexes/${e}`})}}hA.TYPE="search_index";class pA extends ze{create(e){return this.rawCreate(Se(e,{type:"item_type_filter",attributes:["name","filter","columns","order_by","shared"],relationships:["item_type"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/item-type-filters",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"item_type_filter",attributes:["name","columns","order_by","shared","filter"],relationships:["item_type"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/item-type-filters/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/item-type-filters"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/item-type-filters/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/item-type-filters/${e}`})}}pA.TYPE="item_type_filter";class mA extends ze{create(e){return this.rawCreate(Se(e,{type:"upload_filter",attributes:["name","filter","shared"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-filters",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"upload_filter",attributes:["name","shared","filter"],relationships:[]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/upload-filters/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/upload-filters"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/upload-filters/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/upload-filters/${e}`})}}mA.TYPE="upload_filter";class yA extends ze{create(e){return this.rawCreate(Se(e,{type:"site_invitation",attributes:["email"],relationships:["role"]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/site-invitations",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"site_invitation",attributes:[],relationships:["role"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/site-invitations/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/site-invitations"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/site-invitations/${e}`})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/site-invitations/${e}`})}resend(e){return this.rawResend(J(e)).then(n=>z(n))}rawResend(e){return this.client.request({method:"POST",url:`/site-invitations/${e}/resend`})}}yA.TYPE="site_invitation";class gA extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/editing-sessions"})}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/editing-sessions/${e}`,body:n})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/editing-sessions/${e}`})}}gA.TYPE="editing_session";class bA extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/sso-groups"})}copyRoles(e){return this.rawCopyRoles(J(e)).then(n=>z(n))}rawCopyRoles(e){return this.client.request({method:"POST",url:`/sso-groups/${e}/copy-roles`})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"sso_group",attributes:["priority"],relationships:["role"]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/sso-groups/${e}`,body:n})}destroy(e){return this.rawDestroy(J(e)).then(n=>z(n))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/sso-groups/${e}`})}}bA.TYPE="sso_group";class vA extends ze{find(){return this.rawFind().then(e=>z(e))}rawFind(){return this.client.request({method:"GET",url:"/sso-settings"})}generateToken(){return this.rawGenerateToken().then(e=>z(e))}rawGenerateToken(){return this.client.request({method:"PUT",url:"/sso-settings/generate-token"})}update(e){return this.rawUpdate(Se(e,{type:"sso_settings",attributes:["idp_saml_metadata_url","idp_saml_metadata_xml"],relationships:["default_role"]})).then(n=>z(n))}rawUpdate(e){return this.client.request({method:"PUT",url:"/sso-settings",body:e})}}vA.TYPE="sso_settings";class SA extends ze{find(e){return this.rawFind(e).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:"/emoji-suggestions",queryParams:e})}}SA.TYPE="emoji_suggestions";class wA extends ze{find(){return this.rawFind().then(e=>z(e))}rawFind(){return this.client.request({method:"GET",url:"/white-label-settings"})}update(e){return this.rawUpdate(Se(e,{type:"white_label_settings",attributes:["custom_i18n_messages_template_url"],relationships:[]})).then(n=>z(n))}rawUpdate(e){return this.client.request({method:"PUT",url:"/white-label-settings",body:e})}}wA.TYPE="white_label_settings";class _A extends ze{find(){return this.rawFind().then(e=>z(e))}rawFind(){return this.client.request({method:"GET",url:"/public-info"})}}_A.TYPE="public_info";class TA extends ze{list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/daily-site-usages"})}}TA.TYPE="daily_usage";class EA extends ze{find(e,n){return this.rawFind(J(e),n).then(r=>z(r))}rawFind(e,n){return this.client.request({method:"GET",url:`/usage-log-counters/${e}`,queryParams:n})}}EA.TYPE="usage_counter";var c7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},fa=function(t){return this instanceof fa?(this.v=t,this):new fa(t)},d7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof fa?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class MA extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/upload-tags",queryParams:e})}listPagedIterator(e,n){return d7(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=c7(this.rawListPagedIterator(e,n)),p;p=yield fa(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield fa(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield fa(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:50,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}create(e){return this.rawCreate(Se(e,{type:"upload_tag",attributes:["name"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/upload-tags",body:e})}}MA.TYPE="upload_tag";var f7=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(o){n[o]=t[o]&&function(l){return new Promise(function(c,d){l=t[o](l),i(c,d,l.done,l.value)})}}function i(o,l,c,d){Promise.resolve(d).then(function(f){o({value:f,done:c})},l)}},ha=function(t){return this instanceof ha?(this.v=t,this):new ha(t)},h7=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),i,o=[];return i={},l("next"),l("throw"),l("return"),i[Symbol.asyncIterator]=function(){return this},i;function l(y){r[y]&&(i[y]=function(b){return new Promise(function(S,w){o.push([y,b,S,w])>1||c(y,b)})})}function c(y,b){try{d(r[y](b))}catch(S){m(o[0][3],S)}}function d(y){y.value instanceof ha?Promise.resolve(y.value.v).then(f,p):m(o[0][2],y)}function f(y){c("next",y)}function p(y){c("throw",y)}function m(y,b){y(b),o.shift(),o.length&&c(o[0][0],o[0][1])}};class xA extends ze{list(e){return this.rawList(e).then(n=>z(n))}rawList(e){return this.client.request({method:"GET",url:"/upload-smart-tags",queryParams:e})}listPagedIterator(e,n){return h7(this,arguments,function*(){var i,o,l,c;try{for(var d=!0,f=f7(this.rawListPagedIterator(e,n)),p;p=yield ha(f.next()),i=p.done,!i;){c=p.value,d=!1;try{yield yield ha(wr(c))}finally{d=!0}}}catch(m){o={error:m}}finally{try{!d&&!i&&(l=f.return)&&(yield ha(l.call(f)))}finally{if(o)throw o.error}}})}rawListPagedIterator(e,n){return yi(e),mi({defaultLimit:50,maxLimit:500},r=>this.rawList(Object.assign(Object.assign({},e),{page:r})),n)}}xA.TYPE="upload_smart_tag";class CA extends ze{find(e){return this.rawFind(e).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:"/site",queryParams:e})}update(e){return this.rawUpdate(Se(e,{type:"site",attributes:["no_index","favicon","global_seo","name","theme","locales","timezone","require_2fa","ip_tracking_enabled","force_use_of_sandbox_environments"],relationships:["sso_default_role"]})).then(n=>z(n))}rawUpdate(e){return this.client.request({method:"PUT",url:"/site",body:e})}activateImprovedTimezoneManagement(){return this.rawActivateImprovedTimezoneManagement().then(e=>z(e))}rawActivateImprovedTimezoneManagement(){return this.client.request({method:"PUT",url:"/site/activate-improved-timezone-management"})}activateImprovedHexManagement(){return this.rawActivateImprovedHexManagement().then(e=>z(e))}rawActivateImprovedHexManagement(){return this.client.request({method:"PUT",url:"/site/activate-improved-hex-management"})}activateImprovedGqlMultilocaleFields(){return this.rawActivateImprovedGqlMultilocaleFields().then(e=>z(e))}rawActivateImprovedGqlMultilocaleFields(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-multilocale-fields"})}activateImprovedGqlVisibilityControl(){return this.rawActivateImprovedGqlVisibilityControl().then(e=>z(e))}rawActivateImprovedGqlVisibilityControl(){return this.client.request({method:"PUT",url:"/site/activate-improved-gql-visibility-control"})}activateImprovedBooleanFields(){return this.rawActivateImprovedBooleanFields().then(e=>z(e))}rawActivateImprovedBooleanFields(){return this.client.request({method:"PUT",url:"/site/activate-improved-boolean-fields"})}activateDraftModeAsDefault(){return this.rawActivateDraftModeAsDefault().then(e=>z(e))}rawActivateDraftModeAsDefault(){return this.client.request({method:"PUT",url:"/site/activate-draft-mode-as-default"})}activateImprovedValidationAtPublishing(){return this.rawActivateImprovedValidationAtPublishing().then(e=>z(e))}rawActivateImprovedValidationAtPublishing(){return this.client.request({method:"PUT",url:"/site/activate-improved-validation-at-publishing"})}activateImprovedExposureOfInlineBlocksInCda(){return this.rawActivateImprovedExposureOfInlineBlocksInCda().then(e=>z(e))}rawActivateImprovedExposureOfInlineBlocksInCda(){return this.client.request({method:"PUT",url:"/site/activate-improved-exposure-of-inline-blocks-in-cda"})}activateImprovedItemsListing(){return this.rawActivateImprovedItemsListing().then(e=>z(e))}rawActivateImprovedItemsListing(){return this.client.request({method:"PUT",url:"/site/activate-improved-items-listing"})}activateMillisecondsInDatetime(){return this.rawActivateMillisecondsInDatetime().then(e=>z(e))}rawActivateMillisecondsInDatetime(){return this.client.request({method:"PUT",url:"/site/activate-milliseconds-in-datetime"})}updateAssetsCdnDefaultSettings(e){return this.rawUpdateAssetsCdnDefaultSettings(Se(e,{type:"assets-cdn-default-settings",attributes:["assets_cdn_default_settings"],relationships:[]})).then(n=>z(n))}rawUpdateAssetsCdnDefaultSettings(e){return this.client.request({method:"PUT",url:"/site/assets-cdn-default-settings",body:e})}}CA.TYPE="site";class kA extends ze{create(e){return this.rawCreate(Se(e,{type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(n=>z(n))}rawCreate(e){return this.client.request({method:"POST",url:"/workflows",body:e})}update(e,n){return this.rawUpdate(J(e),Se(n,{id:J(e),type:"workflow",attributes:["name","api_key","stages"],relationships:[]})).then(r=>z(r))}rawUpdate(e,n){return this.client.request({method:"PUT",url:`/workflows/${e}`,body:n})}list(){return this.rawList().then(e=>z(e))}rawList(){return this.client.request({method:"GET",url:"/workflows"})}find(e){return this.rawFind(J(e)).then(n=>z(n))}rawFind(e){return this.client.request({method:"GET",url:`/workflows/${e}`})}destroy(e){return this.rawDestroy(J(e))}rawDestroy(e){return this.client.request({method:"DELETE",url:`/workflows/${e}`})}}kA.TYPE="workflow";var p7=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})};let AA=class OA{constructor(e){this.config=e,this.roles=new QF(this),this.users=new zk(this),this.ssoUsers=new Pk(this),this.auditLogEvents=new Uk(this),this.menuItems=new qk(this),this.schemaMenuItems=new $k(this),this.uploadCollections=new Fk(this),this.itemTypes=new Hk(this),this.fields=new Vk(this),this.fieldsets=new Kk(this),this.session=new Gk(this),this.accessTokens=new Yk(this),this.plugins=new Qk(this),this.jobResults=new Xk(this),this.subscriptionLimits=new Jk(this),this.subscriptionFeatures=new Wk(this),this.buildEvents=new Zk(this),this.searchIndexEvents=new eA(this),this.items=new tA(this),this.itemVersions=new nA(this),this.uploads=new N0(this),this.uploadRequest=new rA(this),this.uploadTracks=new iA(this),this.scheduledPublication=new sA(this),this.scheduledUnpublishing=new oA(this),this.searchResults=new aA(this),this.environments=new lA(this),this.maintenanceMode=new uA(this),this.webhooks=new cA(this),this.webhookCalls=new dA(this),this.buildTriggers=new fA(this),this.searchIndexes=new hA(this),this.itemTypeFilters=new pA(this),this.uploadFilters=new mA(this),this.siteInvitations=new yA(this),this.editingSessions=new gA(this),this.ssoGroups=new bA(this),this.ssoSettings=new vA(this),this.emojiSuggestions=new SA(this),this.whiteLabelSettings=new wA(this),this.publicInfo=new _A(this),this.dailyUsages=new TA(this),this.usageCounters=new EA(this),this.uploadTags=new MA(this),this.uploadSmartTags=new xA(this),this.site=new CA(this),this.workflows=new kA(this)}get baseUrl(){return this.config.baseUrl||OA.defaultBaseUrl}request(e){return Od(Object.assign(Object.assign(Object.assign({},this.config),e),{logFn:this.config.logFn||console.log,userAgent:"@datocms/cma-client v5.3.0",baseUrl:this.baseUrl,preCallStack:new Error().stack,extraHeaders:Object.assign(Object.assign(Object.assign({},this.config.extraHeaders||{}),this.config.environment?{"X-Environment":this.config.environment}:{}),{"X-API-Version":"3"}),fetchJobResult:n=>this.jobResultsFetcher?this.jobResultsFetcher(n):OF(()=>this.jobResults.find(n))}))}eventsChannelName(){return p7(this,void 0,void 0,function*(){if(this.cachedEventsChannelName)return this.cachedEventsChannelName;const{data:e}=yield this.site.rawFind();return this.cachedEventsChannelName=this.config.environment?`private-site-${e.id}-environment-${this.config.environment}`:`private-site-${e.id}`,this.cachedEventsChannelName})}};AA.defaultBaseUrl="https://site-api.datocms.com";function m7(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"link":return e.validators.item_item_type.item_types;case"links":return e.validators.items_item_type.item_types;case"structured_text":return e.validators.structured_text_links.item_types;default:return[]}}function my(t){const e="attributes"in t?t.attributes:t;switch(e.field_type){case"single_block":return e.validators.single_block_blocks.item_types;case"rich_text":return e.validators.rich_text_blocks.item_types;case"structured_text":return[...e.validators.structured_text_blocks.item_types,...e.validators.structured_text_inline_blocks?e.validators.structured_text_inline_blocks.item_types:[]];default:return[]}}var Ze=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})};class y7{constructor(e){this.itemTypesPromise=null,this.itemTypesByApiKey=new Map,this.itemTypesById=new Map,this.fieldsByItemType=new Map,this.fieldsetsByItemType=new Map,this.pluginsPromise=null,this.pluginsById=new Map,this.pluginsByPackageName=new Map,this.prefetchPromise=null,this.client=e}loadItemTypes(){return Ze(this,void 0,void 0,function*(){return this.itemTypesPromise||(this.itemTypesPromise=Ze(this,void 0,void 0,function*(){const{data:e}=yield this.client.itemTypes.rawList();for(const n of e)this.itemTypesByApiKey.set(n.attributes.api_key,n),this.itemTypesById.set(n.id,n);return e})),this.itemTypesPromise})}getAllItemTypes(){return Ze(this,void 0,void 0,function*(){const e=yield this.getAllRawItemTypes();return z({data:e})})}getAllRawItemTypes(){return Ze(this,void 0,void 0,function*(){return yield this.loadItemTypes()})}getAllModels(){return Ze(this,void 0,void 0,function*(){const e=yield this.getAllRawModels();return z({data:e})})}getAllRawModels(){return Ze(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>!n.attributes.modular_block)})}getAllBlockModels(){return Ze(this,void 0,void 0,function*(){const e=yield this.getAllRawBlockModels();return z({data:e})})}getAllRawBlockModels(){return Ze(this,void 0,void 0,function*(){return(yield this.loadItemTypes()).filter(n=>n.attributes.modular_block)})}getItemTypeByApiKey(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeByApiKey(e);return z({data:n})})}getRawItemTypeByApiKey(e){return Ze(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesByApiKey.get(e);if(!n)throw new Error(`Item type with API key '${e}' not found`);return n})}getItemTypeById(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeById(e);return z({data:n})})}getRawItemTypeById(e){return Ze(this,void 0,void 0,function*(){yield this.loadItemTypes();const n=this.itemTypesById.get(e);if(!n)throw new Error(`Item type with ID '${e}' not found`);return n})}getItemTypeFields(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFields(e);return z({data:n})})}getRawItemTypeFields(e){return Ze(this,void 0,void 0,function*(){const n=this.fieldsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fields.rawList(e.id);return this.fieldsByItemType.set(e.id,r),r})}getItemTypeFieldsets(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawItemTypeFieldsets(e);return z({data:n})})}getRawItemTypeFieldsets(e){return Ze(this,void 0,void 0,function*(){const n=this.fieldsetsByItemType.get(e.id);if(n)return n;const{data:r}=yield this.client.fieldsets.rawList(e.id);return this.fieldsetsByItemType.set(e.id,r),r})}loadPlugins(){return Ze(this,void 0,void 0,function*(){return this.pluginsPromise||(this.pluginsPromise=Ze(this,void 0,void 0,function*(){const{data:e}=yield this.client.plugins.rawList();for(const n of e)this.pluginsById.set(n.id,n),n.attributes.package_name&&this.pluginsByPackageName.set(n.attributes.package_name,n);return e})),this.pluginsPromise})}getAllPlugins(){return Ze(this,void 0,void 0,function*(){const e=yield this.getAllRawPlugins();return z({data:e})})}getAllRawPlugins(){return Ze(this,void 0,void 0,function*(){return yield this.loadPlugins()})}getPluginById(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawPluginById(e);return z({data:n})})}getRawPluginById(e){return Ze(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsById.get(e);if(!n)throw new Error(`Plugin with ID '${e}' not found`);return n})}getPluginByPackageName(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawPluginByPackageName(e);return z({data:n})})}getRawPluginByPackageName(e){return Ze(this,void 0,void 0,function*(){yield this.loadPlugins();const n=this.pluginsByPackageName.get(e);if(!n)throw new Error(`Plugin with package name '${e}' not found`);return n})}prefetchAllModelsAndFields(){return Ze(this,void 0,void 0,function*(){if(this.prefetchPromise)return this.prefetchPromise;const e=()=>Ze(this,void 0,void 0,function*(){const{included:n}=yield this.client.site.rawFind({include:"item_types,item_types.fields"});if(!n)return;const r=n.filter(l=>l.type==="item_type"),i=n.filter(l=>l.type==="field");this.itemTypesPromise=Promise.resolve(r);for(const l of r)this.itemTypesByApiKey.set(l.attributes.api_key,l),this.itemTypesById.set(l.id,l);const o=new Map;for(const l of i){const c=l.relationships.item_type.data.id;o.has(c)||o.set(c,[]),o.get(c).push(l)}for(const[l,c]of o)this.fieldsByItemType.set(l,c)});return this.prefetchPromise=e(),this.prefetchPromise})}getRawModelsEmbeddingBlocks(e){return Ze(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set(e.map(l=>l.id)),i=[],o=(l,c=new Set)=>Ze(this,void 0,void 0,function*(){if(c.has(l.id))return!1;c.add(l.id);const d=yield this.getRawItemTypeFields(l);for(const f of d){const p=my(f);if(p.some(y=>r.has(y)))return!0;const m=p.map(y=>n.find(b=>b.id===y));for(const y of m)if(yield o(y,new Set(c)))return!0}return!1});for(const l of n)(yield o(l))&&i.push(l);return i})}getModelsEmbeddingBlocks(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawModelsEmbeddingBlocks(e);return z({data:n})})}getRawNestedBlocks(e){return Ze(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,i=[],o=(l,c=new Set)=>Ze(this,void 0,void 0,function*(){if(c.has(l.id))return;c.add(l.id);const d=yield this.getRawItemTypeFields(l);for(const f of d){const p=my(f);for(const m of p)if(!r.has(m)){r.add(m);const y=n.find(b=>b.id===m);y&&(i.push(y),yield o(y,new Set(c)))}}});for(const l of e)yield o(l);return i})}getNestedBlocks(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawNestedBlocks(e);return z({data:n})})}getRawNestedModels(e){return Ze(this,void 0,void 0,function*(){yield this.prefetchAllModelsAndFields();const n=yield this.getAllRawItemTypes(),r=new Set,i=[],o=(l,c=new Set)=>Ze(this,void 0,void 0,function*(){if(c.has(l.id))return;c.add(l.id);const d=yield this.getRawItemTypeFields(l);for(const f of d){const p=m7(f);for(const y of p)if(!r.has(y)){r.add(y);const b=n.find(S=>S.id===y);b&&i.push(b)}const m=my(f);for(const y of m){const b=n.find(S=>S.id===y);b&&(yield o(b,new Set(c)))}}});for(const l of e)yield o(l);return i})}getNestedModels(e){return Ze(this,void 0,void 0,function*(){const n=yield this.getRawNestedModels(e);return z({data:n})})}}function g7(t,e,{onProgress:n,additionalHeaders:r}={}){const i=new XMLHttpRequest;return Su(new Promise((o,l)=>{if(n&&i.upload&&(i.upload.onprogress=c=>{c.lengthComputable&&n({type:"UPLOADING_FILE",payload:{progress:Math.round(c.loaded/c.total*100)}})}),i.onreadystatechange=()=>{i.readyState===4&&(i.status===200?o():l(new Error(`Status ${i.status}`)))},i.addEventListener("error",l,!1),i.open("PUT",e,!0),r)for(const[c,d]of Object.entries(r))i.setRequestHeader(c,d);i.send(t)}),()=>{i.onreadystatechange=null,i.abort()})}var b7=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})};function bE(t,e,n={}){const r=n.filename||("name"in e?e.name:void 0);if(!r)throw new Error("Missing filename, please provide it as an option!");let i=!1,o;return Su(()=>b7(this,void 0,void 0,function*(){n.onProgress&&n?.onProgress({type:"REQUESTING_UPLOAD_URL",payload:{filename:r}});const{id:l,url:c,request_headers:d}=yield t.uploadRequest.create({filename:r});if(i)throw new vu;return n.onProgress&&n.onProgress({type:"UPLOADING_FILE",payload:{progress:0}}),o=g7(e,c,Object.assign(Object.assign({},n),{additionalHeaders:d})),yield o,l}),()=>{o?o.cancel():i=!0})}var vE=function(t,e,n,r){function i(o){return o instanceof n?o:new n(function(l){l(o)})}return new(n||(n=Promise))(function(o,l){function c(p){try{f(r.next(p))}catch(m){l(m)}}function d(p){try{f(r.throw(p))}catch(m){l(m)}}function f(p){p.done?o(p.value):i(p.value).then(c,d)}f((r=r.apply(t,e||[])).next())})},SE=function(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n};class v7 extends N0{createFromFileOrBlob(e){let n=!1,r;return Su(()=>vE(this,void 0,void 0,function*(){if(n)throw new vu;const{fileOrBlob:i,filename:o,onProgress:l}=e,c=SE(e,["fileOrBlob","filename","onProgress"]);r=bE(this.client,i,{filename:o,onProgress:l});const d=yield r;return l&&l({type:"CREATING_UPLOAD_OBJECT"}),this.create(Object.assign(Object.assign({},c),{path:d}))}),()=>{r?r.cancel():n=!0})}updateFromFileOrBlob(e,n){let r=!1,i;return Su(()=>vE(this,void 0,void 0,function*(){if(r)throw new vu;const{fileOrBlob:o,filename:l,onProgress:c}=n,d=SE(n,["fileOrBlob","filename","onProgress"]);i=bE(this.client,o,{filename:l,onProgress:c});const f=yield i;return c&&c({type:"CREATING_UPLOAD_OBJECT"}),this.update(e,Object.assign(Object.assign({},d),{path:f}))}),()=>{i?i.cancel():r=!0})}}class S7 extends AA{constructor(e){super(e),this.uploads=new v7(this)}}function R0(t){return new S7(t)}function xg(t,e){return t.find(n=>n.id===e)}function w7(t,e){return t.replies?.find(n=>n.id===e)}function D0(t,e,n,r){if(n){const o=xg(t,n);if(!o)return pn(`${r.operationName}: parent ${n} not found - parent may have been deleted by another user`),{success:!1,result:{comments:t,status:"failed_parent_missing",failureReason:r.parentMissingReason}};const l=w7(o,e);return l?{success:!0,isReply:!0,parent:o,target:l}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(pn(`${r.operationName}: reply ${e} not found in parent ${n}`),{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}const i=xg(t,e);return i?{success:!0,isReply:!1,target:i}:r.targetNotFoundIsIdempotent?{success:!1,result:{comments:t,status:"no_op_idempotent"}}:(pn(`${r.operationName}: comment ${e} not found`),{success:!1,result:{comments:t,status:"failed_target_missing",failureReason:r.targetMissingReason}})}function NA(t,e,n,r){return n?t.map(i=>i.id===n?{...i,replies:i.replies?.map(o=>o.id===e?r(o):o)}:i):t.map(i=>i.id===e?r(i):i)}function yy(t,e){switch(e.type){case"ADD_COMMENT":return _7(t,e);case"DELETE_COMMENT":return T7(t,e);case"EDIT_COMMENT":return E7(t,e);case"UPVOTE_COMMENT":return M7(t,e);case"ADD_REPLY":return x7(t,e)}}function _7(t,e){return t.some(n=>n.id===e.comment.id)?{comments:t,status:"no_op_idempotent"}:{comments:[e.comment,...t],status:"applied"}}function T7(t,e){const n=D0(t,e.id,e.parentCommentId,{operationName:"DELETE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:"The comment was deleted by another user.",targetNotFoundIsIdempotent:!0});return n.success?n.isReply?{comments:t.map(i=>i.id===e.parentCommentId?{...i,replies:i.replies?.filter(o=>o.id!==e.id)}:i),status:"applied"}:{comments:t.filter(r=>r.id!==e.id),status:"applied"}:n.result}function E7(t,e){const n=D0(t,e.id,e.parentCommentId,{operationName:"EDIT_COMMENT",parentMissingReason:"Your edit could not be saved because the comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply you were editing was deleted by another user.":"The comment you were editing was deleted by another user."});return n.success?{comments:NA(t,e.id,e.parentCommentId,i=>({...i,content:e.newContent})),status:"applied"}:n.result}function M7(t,e){const n=D0(t,e.id,e.parentCommentId,{operationName:"UPVOTE_COMMENT",parentMissingReason:"The comment thread was deleted by another user.",targetMissingReason:e.parentCommentId?"The reply was deleted by another user.":"The comment was deleted by another user."});if(!n.success)return n.result;const r=o=>{const l=o.includes(e.userId);return e.action==="add"?l?o:[...o,e.userId]:o.filter(c=>c!==e.userId)};return{comments:NA(t,e.id,e.parentCommentId,o=>({...o,upvoterIds:r(o.upvoterIds)})),status:"applied"}}function x7(t,e){const n=xg(t,e.parentCommentId);return n?n.replies?.some(i=>i.id===e.reply.id)?{comments:t,status:"no_op_idempotent"}:{comments:t.map(i=>i.id!==e.parentCommentId?i:{...i,replies:[e.reply,...i.replies??[]]}),status:"applied"}:(pn(`ADD_REPLY: parent ${e.parentCommentId} not found - user's reply content is lost`),{comments:t,status:"failed_parent_missing",failureReason:"Your reply could not be saved because the comment was deleted by another user."})}const C7=t=>new Promise(e=>setTimeout(e,t));function k7(t,e,n,r=!1){const i=e*Math.pow(2,t),o=r?Math.random()*100:0;return Math.min(i+o,n)}function ln(t){const e={type:t.type};switch(t.type){case"ADD_COMMENT":return{...e,commentId:t.comment.id};case"DELETE_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"EDIT_COMMENT":return{...e,id:t.id,parentCommentId:t.parentCommentId};case"UPVOTE_COMMENT":return{...e,id:t.id,action:t.action,parentCommentId:t.parentCommentId};case"ADD_REPLY":return{...e,parentCommentId:t.parentCommentId,replyId:t.reply.id};default:return e}}function A7({client:t,commentRecordId:e,commentsModelId:n,modelId:r,recordId:i,ctx:o,onRecordCreated:l,resolveCommentsModelId:c}){const d=C.useRef([]),[f,p]=C.useState(!1),[m,y]=C.useState(0),b=C.useRef(!0),[S,w]=C.useState({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null}),T=C.useCallback(()=>{b.current&&w({isRetrying:!1,operationType:null,retryCount:0,message:null,wasTerminated:!1,terminationReason:null})},[]),M=C.useCallback(($,ie)=>{b.current&&w({isRetrying:!0,operationType:$,retryCount:ie,message:Rn.VERSION_CONFLICT_RETRYING,wasTerminated:!1,terminationReason:null})},[]),[k,j]=C.useState(!1),I=C.useRef(null),O=C.useRef(e);O.current=e;const P=C.useRef(n);P.current=n,C.useEffect(()=>(b.current=!0,()=>{b.current=!1,d.current=[],I.current&&clearTimeout(I.current)}),[]);const A=C.useCallback(()=>{I.current&&clearTimeout(I.current),b.current&&(j(!0),Be("Comment sync cooldown started",{durationMs:Ls.SYNC_COOLDOWN_MS,modelId:r,recordId:i}),I.current=setTimeout(()=>{b.current&&(j(!1),I.current=null,Be("Comment sync cooldown ended",{modelId:r,recordId:i}))},Ls.SYNC_COOLDOWN_MS))},[r,i]),U=C.useCallback($=>{b.current&&o.alert($)},[o]),H=C.useCallback($=>{b.current&&y($)},[]),se=C.useCallback($=>{b.current&&p($)},[]),re=C.useCallback(()=>!t||!i?(U(Rn.SAVE_FAILED),T(),!1):!0,[U,T,t,i]),te=C.useCallback(async $=>{if(!t||!i||!b.current)return Be("Skipped queued comment operation before execution",{hasClient:!!t,isMounted:b.current,modelId:r,op:ln($),recordId:i}),!1;let ie=0;const me=Date.now();for(;;)try{if(!b.current)return!1;const ye=O.current;let N=P.current;if(N||(Be("Resolving comments model ID for queued operation",{modelId:r,op:ln($),recordId:i}),N=await c(),P.current=N,Be("Resolved comments model ID for queued operation",{commentsModelId:N,modelId:r,op:ln($),recordId:i})),!N)return tt("Failed to resolve comments model ID before saving comment operation",void 0,{modelId:r,op:ln($),recordId:i}),U(Rn.SAVE_FAILED),T(),!1;if(Be("Executing queued comment operation",{attempt:ie+1,commentRecordId:ye,commentsModelId:N,modelId:r,op:ln($),recordId:i}),!ye){const we=await t.items.list({filter:{type:N,fields:{model_id:{eq:r},record_id:{eq:i}}},page:{limit:1}});if(we.length>0){const nt=we[0];Be("Using existing comments record for queued operation",{commentRecordId:nt.id,modelId:r,op:ln($),recordId:i});const pe=Df(nt.content),Me=yy(pe,$);return Me.status==="failed_parent_missing"||Me.status==="failed_target_missing"?(Be("Skipping queued comment operation due to missing target",{modelId:r,op:ln($),recordId:i,status:Me.status}),Me.failureReason&&U(Me.failureReason),T(),!1):(await t.items.update(nt.id,{content:JSON.stringify(Me.comments),meta:{current_version:nt.meta.current_version}}),Be("Queued comment operation saved",{commentRecordId:nt.id,modelId:r,op:ln($),recordId:i}),l(nt.id),A(),T(),!0)}const ve=yy([],$),je=await t.items.create({item_type:{type:"item_type",id:N},model_id:r,record_id:i,content:JSON.stringify(ve.comments)});return Be("Created comments record for queued operation",{commentRecordId:je.id,modelId:r,op:ln($),recordId:i}),l(je.id),A(),T(),!0}const Q=await t.items.find(ye),ce=Df(Q.content),le=yy(ce,$);return le.status==="failed_parent_missing"||le.status==="failed_target_missing"?(Be("Skipping queued comment operation due to missing target",{commentRecordId:ye,modelId:r,op:ln($),recordId:i,status:le.status}),le.failureReason&&U(le.failureReason),T(),!1):(await t.items.update(ye,{content:JSON.stringify(le.comments),meta:{current_version:Q.meta.current_version}}),Be("Queued comment operation saved",{commentRecordId:ye,modelId:r,op:ln($),recordId:i}),A(),T(),!0)}catch(ye){if(!b.current)return!1;if(ye instanceof is&&ye.findError("STALE_ITEM_VERSION")){if(ie++,ie>=Jw.MAX_ATTEMPTS)return tt("Retry terminated: max attempts reached for version conflict:",ln($),{attempt:ie}),U(Rn.MAX_RETRIES_EXCEEDED),b.current&&w({isRetrying:!1,operationType:$.type,retryCount:ie,message:Rn.MAX_RETRIES_EXCEEDED,wasTerminated:!0,terminationReason:"max_attempts"}),!1;if(Date.now()-me>=Jw.MAX_DURATION_MS)return tt("Retry terminated: timeout reached for version conflict:",ln($),{attempt:ie,durationMs:Date.now()-me}),U(Rn.OPERATION_TIMEOUT),b.current&&w({isRetrying:!1,operationType:$.type,retryCount:ie,message:Rn.OPERATION_TIMEOUT,wasTerminated:!0,terminationReason:"timeout"}),!1;M($.type,ie);const N=k7(ie,Ls.VERSION_CONFLICT_BACKOFF_BASE,Ls.VERSION_CONFLICT_BACKOFF_MAX);if(Be("Retrying queued comment operation after version conflict",{attempt:ie,backoffDelayMs:N,modelId:r,op:ln($),recordId:i}),await C7(N),!b.current)return!1;continue}return tt("Failed to save comment operation:",ye,{op:ln($)}),U(Rn.SAVE_FAILED),T(),!1}},[U,t,r,i,l,A,T,M,c]),Z=C.useRef(!1),G=C.useCallback(async()=>{if(!(Z.current||d.current.length===0||!t)){Z.current=!0,se(!0);try{for(Be("Processing queued comment operations",{modelId:r,pendingCount:d.current.length,recordId:i});d.current.length>0;){const $=d.current[0],ie=await te($);if(Be("Finished queued comment operation",{modelId:r,op:ln($),persisted:ie,recordId:i,remainingQueueLength:Math.max(d.current.length-1,0)}),d.current.shift(),H(d.current.length),!b.current)return}}catch($){tt("Unexpected error in processQueue - operation removed from queue:",$),d.current.shift(),H(d.current.length)}finally{Z.current=!1,se(!1)}}},[t,te,r,i,se,H]);return{enqueue:C.useCallback($=>re()?(d.current.push($),Be("Queued comment operation",{modelId:r,op:ln($),pendingCount:d.current.length,recordId:i}),H(d.current.length),G(),!0):!1,[re,r,G,i,H]),pendingCount:m,isProcessing:f,isSyncAllowed:m===0&&!k,retryState:S}}function ar(t){return typeof t=="string"?t:null}function Wf(t){const e=t.indexOf("@");return e>0?t.slice(0,e):t}function O7(t,e=48){return{id:t.id,email:t.attributes.email,name:t.attributes.full_name??Wf(t.attributes.email),avatarUrl:rs(t.attributes.email,e)}}function N7(t,e=48){const n=t.attributes.username,r=t.attributes.first_name??"",i=t.attributes.last_name??"",o=[r,i].filter(Boolean).join(" ")||Wf(n),c=n.includes("@")?rs(n,e):null;return{id:t.id,email:n,name:o,avatarUrl:c}}function R7(t,e=48){const n=t.attributes??{};if(t.type==="account"){const i=ar(t.email)??ar(n.email)??"",o=ar(t.first_name)??ar(n.first_name)??"",l=ar(t.last_name)??ar(n.last_name)??"",c=[o,l].filter(Boolean).join(" ")||Wf(i)||"Account Owner";return{id:String(t.id),email:i,name:c,avatarUrl:i?rs(i,e):null}}const r=ar(t.name)??ar(n.name)??"Organization";return{id:String(t.id),email:"",name:r,avatarUrl:null}}const D7="__user_id:",I7="__";function L7(t){return`${D7}${t}${I7}`}function RA(t){const e=t.attributes,n=t.id,r=ar(e.email),i=r??L7(n),o=ar(e.full_name)??ar(e.name)??(r?Wf(r):"User");return{id:n,email:i,name:o}}function j7(t,e=48){const{id:n,email:r,name:i}=RA(t),o=ar(t.attributes.email);return{id:n,email:r,name:i,avatarUrl:o?rs(o,e):null}}function wE(t,e,n){const{enabled:r=!0,operationName:i,errorContext:o,onError:l,onSuccess:c}=n,[d,f]=C.useState(null),[p,m]=C.useState(!1),[y,b]=C.useState(null),[S,w]=C.useState(0),T=C.useRef(0),M=C.useCallback(()=>{b(null),w(k=>k+1)},[]);return C.useEffect(()=>{if(!r){m(!1);return}const k=++T.current;let j=!0;return m(!0),t().then(I=>{if(j&&k===T.current&&(f(I),b(null),m(!1),c))try{c(I)}catch(O){tt(`onSuccess callback for "${i}" threw an error`,O,o)}}).catch(I=>{if(!j||k!==T.current)return;const O=Ak(I),P=kk(O);if(tt(`Failed to ${i}`,I,o),b({source:i,message:P.message}),m(!1),l)try{l(O)}catch(A){tt(`onError callback for "${i}" threw an error`,A,o)}}),()=>{j=!1}},[r,S,...e]),{data:d,isLoading:p,error:y,retry:M}}function B7(t,e={}){const{loadFields:n=!1}=e,r=C.useMemo(()=>iE(t.itemTypes).map(U=>U.id).sort().join(","),[t.itemTypes]),i=C.useMemo(()=>iE(t.itemTypes).map(U=>({id:U.id,apiKey:U.attributes.api_key,name:U.attributes.name,isBlockModel:U.attributes.modular_block})),[r]),o=t.itemType.id,l=t.site.id,c=C.useMemo(()=>t.site.attributes.locales.join(","),[t.site.attributes.locales]),d=C.useMemo(()=>JSON.stringify(t.formValues??{}),[t.formValues]),f=C.useCallback(async()=>v$(t),[t,d,c]),{data:p,error:m,retry:y}=wE(f,[o,d,c],{enabled:n,operationName:"load fields",errorContext:{itemTypeId:o}}),b=t.currentUser.id,S=C.useCallback(async()=>{const A=await Promise.allSettled([t.loadUsers(),t.loadSsoUsers()]),U=A[0].status==="fulfilled"?A[0].value:[],H=A[1].status==="fulfilled"?A[1].value:[];if(A[0].status==="rejected"&&tt("Failed to load regular users",A[0].reason,{siteId:l}),A[1].status==="rejected"&&tt("Failed to load SSO users",A[1].reason,{siteId:l}),A[0].status==="rejected"&&A[1].status==="rejected")throw new Error("Failed to load users. Please check your connection and try again.");const se=[];for(const R of U){const $=O7(R,48);se.push({user:$,userType:"user"})}for(const R of H){const $=N7(R,48);se.push({user:$,userType:"sso"})}const re=R7(t.owner,48),te=t.owner.type==="organization"?"org":"account";if(se.some(R=>R.user.id===re.id)||se.unshift({user:re,userType:te}),!se.some(R=>R.user.id===t.currentUser.id)){const R=j7(t.currentUser,48);se.unshift({user:R,userType:"user"})}return{allUsers:se.map(R=>R.user),typedUsers:se}},[l,b]),{data:w,error:T,retry:M}=wE(S,[l],{enabled:!0,operationName:"load users",errorContext:{siteId:l}}),k=C.useCallback(()=>{y(),M()},[y,M]),j=m||T,I=C.useMemo(()=>w?.allUsers??[],[w]),O=C.useMemo(()=>w?.typedUsers??[],[w]),P=C.useMemo(()=>p??[],[p]);return{projectUsers:I,projectModels:i,modelFields:P,loadError:j,retry:k,typedUsers:O}}function z7({composerRef:t,canMentionModels:e=!0,handleAssetTrigger:n,handleRecordTrigger:r}){const i=C.useCallback(()=>{t.current&&(t.current.insertText("/user "),t.current.focus())},[t]),o=C.useCallback(()=>{t.current&&(t.current.insertText("/field "),t.current.focus())},[t]),l=C.useCallback(()=>{e&&t.current&&(t.current.insertText("/model "),t.current.focus())},[t,e]),c=C.useCallback(()=>{n?.()},[n]),d=C.useCallback(()=>{r?.()},[r]);return{handleUserToolbarClick:i,handleFieldToolbarClick:o,handleModelToolbarClick:l,handleAssetToolbarClick:c,handleRecordToolbarClick:d}}function P7(t){const{realTimeEnabled:e,cdaToken:n,client:r,commentsModelId:i,isSyncAllowed:o,currentUserId:l,onOrphanedDraft:c,onBeforeSync:d,onAfterSync:f}=t,p=t.ctx.itemType.id,m=t.ctx.item?.id??"",y=!!t.ctx.item?.id,b=gF({ctx:t.ctx,realTimeEnabled:e,cdaToken:n,client:r,commentsModelId:i,isSyncAllowed:o,query:U$,variables:{modelId:p,recordId:m},filterParams:{modelId:p,recordId:m},subscriptionEnabled:y,onCommentRecordIdChange:t.onCommentRecordIdChange,currentUserId:l,onOrphanedDraft:c,onBeforeSync:d,onAfterSync:f});return{comments:b.comments,setComments:b.setComments,isLoading:b.isLoading,error:b.error,errorInfo:b.errorInfo,status:b.status,retry:b.retry,isAutoReconnecting:b.isAutoReconnecting,fullResult:b}}function U7(t){return t.length===0?!0:!t.some(e=>e.type==="text"?e.content.trim().length>0:e.type==="mention")}function DA(t){return t.trim().length>0}function _E(t,e,n){return n?t.filter(r=>r!==e):[...t,e]}function TE(t,e,n){return n?t.map(r=>r.id===n?{...r,replies:r.replies?.filter(i=>i.id!==e)}:r):t.filter(r=>r.id!==e)}function q7(t,e,n,r){const i=_0(n);return r?t.map(o=>o.id===r?{...o,replies:o.replies?.map(l=>l.id===e?{...l,content:i}:l)}:o):t.map(o=>o.id===e?{...o,content:i}:o)}function $7(t,e,n,r,i){return i?t.map(o=>o.id===i?{...o,replies:o.replies?.map(l=>l.id===e?{...l,upvoterIds:_E(l.upvoterIds,n,r)}:l)}:o):t.map(o=>o.id===e?{...o,upvoterIds:_E(o.upvoterIds,n,r)}:o)}function EE(t,e,n){if(!DA(e))throw new Error("Cannot create comment: author ID is required");const r=crypto.randomUUID(),i=new Date().toISOString(),o=_0(t);return n?{id:r,dateISO:i,content:o,authorId:e,upvoterIds:[],parentCommentId:n}:{id:r,dateISO:i,content:o,authorId:e,upvoterIds:[],replies:[]}}function F7(t,e,n){return n?t.find(i=>i.id===n)?.replies?.find(i=>i.id===e)??null:t.find(r=>r.id===e)??null}function H7({userId:t,comments:e,setComments:n,enqueue:r,composerSegments:i,setComposerSegments:o,pendingNewReplies:l,insertPosition:c="prepend",replyInsertPosition:d=c,ctx:f}){const p=C.useCallback(()=>{if(U7(i))return!1;if(!DA(t))return f?.alert(Rn.MISSING_USER_INFO),!1;if(f&&!f.item?.id)return f.alert(Rn.SAVE_RECORD_FIRST),!1;const w=EE(i,t);return r({type:"ADD_COMMENT",comment:w})?(n(c==="prepend"?M=>[w,...M]:M=>[...M,w]),o([]),!0):!1},[i,f,t,n,r,o,c]),m=C.useCallback((w,T)=>l.current?.has(w)??!1?(l.current?.delete(w),n(j=>TE(j,w,T)),!0):r({type:"DELETE_COMMENT",id:w,parentCommentId:T})?(n(j=>TE(j,w,T)),!0):!1,[n,r,l]),y=C.useCallback((w,T,M)=>{const k=l.current?.has(w)??!1,j=F7(e,w,M),I=_0(T);if(k&&M){const O={id:w,dateISO:j?.dateISO??new Date().toISOString(),content:I,authorId:t,upvoterIds:[],parentCommentId:M};if(!r({type:"ADD_REPLY",parentCommentId:M,reply:O}))return!1;l.current?.delete(w)}else if(!r({type:"EDIT_COMMENT",id:w,newContent:I,parentCommentId:M}))return!1;return n(O=>q7(O,w,T,M)),!0},[t,e,n,r,l]),b=C.useCallback((w,T,M)=>r({type:"UPVOTE_COMMENT",id:w,action:T?"remove":"add",userId:t,parentCommentId:M})?(n(j=>$7(j,w,t,T,M)),!0):!1,[t,n,r]),S=C.useCallback(w=>{const T=EE([],t,w);return l.current?.add(T.id),n(M=>M.map(k=>k.id!==w?k:d==="prepend"?{...k,replies:[T,...k.replies??[]]}:{...k,replies:[...k.replies??[],T]})),!0},[t,n,l,d]);return{submitNewComment:p,deleteComment:m,editComment:y,upvoteComment:b,replyComment:S}}function IA(t,e,n,r){const i=d=>d.environment===n&&(d.action==="all"||d.action==="read"),o=d=>i(d)&&(!r||r(d));return t.some(o)?!e.some(o):!1}function V7(t){const e=t.currentRole,n=e.attributes.positive_upload_permissions||[],r=e.attributes.negative_upload_permissions||[];return IA(n,r,t.environment)}function K7(t){return t.currentRole.meta.final_permissions.can_edit_schema}function G7(t,e){const n=t.currentRole,r=n.attributes.positive_item_type_permissions||[],i=n.attributes.negative_item_type_permissions||[],o=l=>l.item_type===null||l.item_type===e;return IA(r,i,t.environment,o)}function Y7(t,e){return e.filter(n=>G7(t,n.id))}function Q7(t,e){const n=C.useMemo(()=>V7(t),[t.currentRole,t.environment]),r=C.useMemo(()=>K7(t),[t.currentRole]),i=C.useMemo(()=>Y7(t,e),[t.currentRole,t.environment,e]);return{canMentionAssets:n,canMentionModels:r,readableModels:i}}function Rd(t){return`Record #${t}`}function LA(t,e,n,r,i,o,l){const c=Rd(t);if(l)return i;const d=n.presentationTitleFieldId??n.titleFieldId;if(!d)return c;const f=r.find(y=>y.id===d);if(!f)return c;const p=e[f.apiKey];if(p==null)return c;const m=Jf(p,o);return m!==p&&m?String(m):typeof p=="object"&&!Array.isArray(p)?c:String(p)}const ME=new WeakMap;function X7(t){let e=ME.get(t);return e||(e=new y7(t),ME.set(t,e)),e}const Lf=new Map,J7=300*1e3;let jA=0;function W7(t){if(Date.now()-jA>J7){Lf.clear();return}return Lf.get(t)}function xE(t,e){Lf.size===0&&(jA=Date.now()),Lf.set(t,e)}async function Z7(t,e,n){const r=new Map,i=new Map;for(const f of e)i.set(f.recordId,f);const o=[];for(const{recordId:f,modelId:p}of i.values()){const m=W7(f);m?r.set(f,m):o.push({recordId:f,modelId:p})}if(o.length===0)return r;const l=new Map;for(const{recordId:f,modelId:p}of o){const m=l.get(p)??[];m.push(f),l.set(p,m)}const c=X7(t),d=Array.from(l.entries()).map(async([f,p])=>{try{const m=await c.getItemTypeById(f),y=m.name,b=m.singleton??!1;if(b){for(const k of p){const j={title:y,modelName:y,isSingleton:b};r.set(k,j),xE(k,j)}return}const w=(await c.getItemTypeFields(m)).map(k=>({id:k.id,apiKey:k.api_key})),T={presentationTitleFieldId:m.presentation_title_field?.id??null,titleFieldId:m.title_field?.id??null},M=100;for(let k=0;k<p.length;k+=M){const j=p.slice(k,k+M);try{const I=await t.items.list({filter:{type:f,ids:j.join(",")},page:{limit:M}}),O=new Map(I.map(P=>[P.id,P]));for(const P of j){const A=O.get(P);if(!A){r.set(P,{title:Rd(P),modelName:y,isSingleton:!1});continue}const H={title:LA(P,A,T,w,y,n,b),modelName:y,isSingleton:b};r.set(P,H),xE(P,H)}}catch(I){tt("Failed to batch fetch records:",I,{modelId:f,batchIds:j});for(const O of j)r.set(O,{title:Rd(O),modelName:y,isSingleton:!1})}}}catch(m){tt("Failed to process model for titles:",m,{modelId:f});for(const y of p)r.set(y,{title:Rd(y),modelName:"Unknown",isSingleton:!1})}});return await Promise.all(d),r}function gy(t){return typeof t=="object"&&t!==null&&"upload_id"in t&&typeof t.upload_id=="string"}function eH(t,e,n,r,i){if(!e)return`Record #${t.id}`;const o={presentationTitleFieldId:e.relationships.presentation_title_field.data?.id??null,titleFieldId:e.relationships.title_field.data?.id??null},l=n.map(d=>({id:d.id,apiKey:d.attributes.api_key})),c=e.attributes.singleton??!1;return LA(t.id,t.attributes,o,l,r,i,c)}function CE(t,e){if(t==null)return null;const r=!Array.isArray(t)&&gy(t)?t:Jf(t,e);if(!r)return null;if(Array.isArray(r)){const i=r[0];return gy(i)?i.upload_id:null}return gy(r)?r.upload_id:null}const tH=48;async function kE(t,e){try{const n=await t.uploads.find(e),r=n.mime_type??"",i=n.url??"";return Mk(r,i,n.mux_playback_id,tH)}catch(n){return tt("Failed to fetch thumbnail for upload:",n,{uploadId:e}),null}}async function nH(t,e,n,r,i){if(!e||!i||e.attributes.collection_appearance==="compact")return null;const l=e.relationships.presentation_image_field.data?.id,c=e.relationships.image_preview_field.data?.id,d=l??c;if(d){const m=n.find(y=>y.id===d);if(m){const y=m.attributes.api_key,b=CE(t.attributes[y],r);if(b){const S=await kE(i,b);if(S)return S}}}const p=[...n].sort((m,y)=>(m.attributes.position??0)-(y.attributes.position??0)).find(m=>{const y=m.attributes.field_type;return y==="file"||y==="gallery"});if(p){const m=p.attributes.api_key,y=CE(t.attributes[m],r);if(y)return await kE(i,y)}return null}async function BA(t,e,n,r,i,o,l){const c=n?.attributes.singleton??!1,d=eH(t,n,r,e.name,i),f=await nH(t,n,r,i,o),p=l??Ud(e.name).emoji;return{type:"record",id:t.id,title:d,modelId:e.id,modelApiKey:e.apiKey,modelName:e.name,modelEmoji:p,thumbnailUrl:f,isSingleton:c}}function zA(t){const e=t.attributes.mime_type??"application/octet-stream",n=t.attributes.url??"",r=Mk(e,n,t.attributes.mux_playback_id);return{type:"asset",id:t.id,filename:t.attributes.filename,url:n,thumbnailUrl:r,mimeType:e}}function rH(t){return"current"in t?t.current:t}async function Cg(t,e,n){const{maxRetries:r=5,delayMs:i=100}={};for(let o=0;o<r;o++){await new Promise(l=>setTimeout(l,i));try{const l=rH(t);if(l)return l.focus(),l.insertMention(e),!0;o<r-1&&pn(`insertMentionWithRetry: composer null on attempt ${o+1}/${r}, retrying...`,{mentionType:e.type})}catch(l){if(o===r-1)throw tt("insertMentionWithRetry: all retry attempts failed",l,{mentionType:e.type,maxRetries:r}),l;pn(`insertMentionWithRetry: error on attempt ${o+1}/${r}, retrying...`,{mentionType:e.type,error:l instanceof Error?l.message:String(l)})}}return pn("insertMentionWithRetry: all attempts exhausted, composer remained unavailable",{mentionType:e.type,maxRetries:r}),!1}function iH({ctx:t,client:e,canMentionAssets:n}){const[r,i]=C.useState(!1),o=C.useRef(null),l=C.useCallback(async(d,f)=>{if(d==="asset"&&n){o.current=f.current,i(!0);try{const p=await t.selectUpload({multiple:!1});if(!p){o.current?.focus();return}const m=zA(p);await Cg(o,m)}catch(p){tt("Reply asset picker error:",p),t.alert(Rn.ASSET_PICKER_FAILED),o.current?.focus()}finally{i(!1),o.current=null}}},[t,n]),c=C.useCallback(async(d,f)=>{const p=f.current;if(!p){pn("No valid composer target for record mention from comment, aborting");return}i(!0);try{const m=await t.selectItem(d.id,{multiple:!1});if(!m){p.focus();return}const y=t.itemTypes[d.id];let b=[];if(y)try{b=await t.loadItemTypeFields(d.id)}catch(T){tt("Failed to load item type fields for record mention",T,{modelId:d.id})}const S=t.site.attributes.locales[0]??"en",w=await BA({id:m.id,attributes:m.attributes},{id:d.id,apiKey:d.apiKey,name:d.name,isBlockModel:d.isBlockModel},y,b,S,e);await Cg(f,w)}catch(m){tt("Reply record picker error:",m),t.alert(Rn.RECORD_PICKER_FAILED)}finally{i(!1)}},[t,e]);return{isPickerInProgress:r,handleReplyPickerRequest:l,handleRecordModelSelectFromComment:c}}function AE(t,e){const n=e.find(r=>r.id===t);return n?{id:n.id,email:n.email,name:n.name,avatarUrl:n.avatarUrl??(n.email?rs(n.email,48):null)}:{id:t,email:"",name:"Unknown User",avatarUrl:null}}function sH(t,e){const n=e.find(r=>r.id===t.id);return n?{type:"user",id:n.id,name:n.name,email:n.email,avatarUrl:n.avatarUrl}:null}function oH(t,e){const n=e.find(r=>r.id===t.id);return n?{type:"model",id:n.id,apiKey:n.apiKey,name:n.name,isBlockModel:n.isBlockModel}:null}function aH(t,e){const n=e.find(o=>o.fieldPath===t.fieldPath);if(n)return{type:"field",apiKey:n.apiKey,label:n.label,localized:n.localized,fieldPath:n.fieldPath,locale:t.locale,fieldType:n.fieldType};const r=t.fieldPath.split("."),i=r[r.length-1]||t.fieldPath;return{type:"field",apiKey:i,label:i,localized:!!t.locale,fieldPath:t.fieldPath,locale:t.locale,fieldType:void 0}}function lH(t,e,n){return{type:"record",id:t,title:n.title,modelId:n.modelId,modelApiKey:n.modelApiKey,modelName:n.modelName,modelEmoji:n.modelEmoji,thumbnailUrl:n.thumbnailUrl,isSingleton:n.isSingleton}}function uH(t,e){return{type:"record",id:t,title:`Record #${t}`,modelId:e,modelApiKey:"unknown",modelName:"Unknown",modelEmoji:null,thumbnailUrl:null,isSingleton:!1}}function cH(t,e){return{type:"asset",id:t,filename:e.filename,url:e.url,thumbnailUrl:e.thumbnailUrl,mimeType:e.mimeType}}function dH(t){return{type:"asset",id:t,filename:`Asset #${t}`,url:"",thumbnailUrl:null,mimeType:"application/octet-stream"}}function fH(t,e){return t.startsWith("image/")?`${e}?w=300&fit=max&auto=format&dpr=2&q=80`:null}function hH(t){const{client:e,projectUsers:n,projectModels:r,modelFields:i,itemTypes:o,mainLocale:l}=t,[c,d]=C.useState(!1),f=C.useRef({records:new Map,assets:new Map}),p=C.useRef(new Set),m=C.useRef(new Set),[y,b]=C.useState(0),S=C.useCallback(O=>{switch(O.type){case"user":return sH(O,n);case"model":return oH(O,r);case"field":return aH(O,i);case"record":{const P=f.current.records.get(O.id);return P&&P!=="loading"&&P!=="error"?lH(O.id,O.modelId,P):uH(O.id,O.modelId)}case"asset":{const P=f.current.assets.get(O.id);return P&&P!=="loading"&&P!=="error"?cH(O.id,P):dH(O.id)}default:return null}},[n,r,i]),w=C.useCallback(O=>{if(O.type==="text")return O;const P=S(O.mention);return P?{type:"mention",mention:P}:{type:"text",content:"[deleted mention]"}},[S]),T=C.useCallback(O=>{const P=O.content.map(w),A=AE(O.authorId,n),U=O.upvoterIds.map(H=>AE(H,n));return{id:O.id,dateISO:O.dateISO,content:P,author:A,upvoters:U,replies:O.replies?.map(H=>T(H)),parentCommentId:O.parentCommentId}},[w,n]),M=C.useCallback(O=>{const P=[],A=[],U=new Set,H=new Set,se=te=>{for(const Z of te)if(Z.type==="mention"){if(Z.mention.type==="record"){const G=f.current.records.get(Z.mention.id);(!G||G==="error")&&!p.current.has(Z.mention.id)&&!U.has(Z.mention.id)&&(P.push({id:Z.mention.id,modelId:Z.mention.modelId}),U.add(Z.mention.id))}else if(Z.mention.type==="asset"){const G=f.current.assets.get(Z.mention.id);(!G||G==="error")&&!m.current.has(Z.mention.id)&&!H.has(Z.mention.id)&&(A.push(Z.mention.id),H.add(Z.mention.id))}}},re=te=>{for(const Z of te)se(Z.content),Z.replies&&re(Z.replies)};return re(O),{recordsToFetch:P,assetsToFetch:A}},[]),k=C.useCallback(async(O,P)=>{if(e&&!(O.length===0&&P.length===0)){d(!0);for(const A of O)p.current.add(A.id),f.current.records.set(A.id,"loading");for(const A of P)m.current.add(A),f.current.assets.set(A,"loading");try{if(O.length>0){const U=await Z7(e,O.map(H=>({recordId:H.id,modelId:H.modelId})),l);for(const H of O){const se=U.get(H.id),re=Object.values(o).find(te=>te?.id===H.modelId);if(se){const{emoji:te}=Ud(se.modelName);f.current.records.set(H.id,{id:H.id,title:se.title,modelId:H.modelId,modelApiKey:re?.attributes.api_key??"unknown",modelName:se.modelName,modelEmoji:te,thumbnailUrl:null,isSingleton:se.isSingleton})}else f.current.records.set(H.id,"error");p.current.delete(H.id)}}const A=P.map(async U=>{try{const H=await e.uploads.find(U);f.current.assets.set(U,{id:U,filename:H.filename??H.basename??`Asset #${U}`,url:H.url,thumbnailUrl:fH(H.mime_type??"",H.url),mimeType:H.mime_type??"application/octet-stream"})}catch(H){tt("Failed to fetch asset",H,{assetId:U}),f.current.assets.set(U,"error")}finally{m.current.delete(U)}});await Promise.all(A)}catch(A){tt("Failed to fetch async entities",A);for(const U of O)p.current.delete(U.id),f.current.records.get(U.id)==="loading"&&f.current.records.set(U.id,"error");for(const U of P)m.current.delete(U),f.current.assets.get(U)==="loading"&&f.current.assets.set(U,"error")}finally{d(!1),b(A=>A+1)}}},[e,l,o]),j=C.useCallback(O=>{const{recordsToFetch:P,assetsToFetch:A}=M(O);P.length===0&&A.length===0||k(P,A)},[M,k]),I=C.useCallback(O=>O.map(T),[T]);return{prefetchEntities:j,resolveComments:I,isResolving:c,cacheVersion:y}}const pH=C.createContext(null);function mH({children:t,canMentionFields:e=!0,canMentionAssets:n=!1,canMentionModels:r=!0}){const i=C.useMemo(()=>({canMentionFields:e,canMentionAssets:n,canMentionModels:r}),[e,n,r]);return E.jsx(pH.Provider,{value:i,children:t})}function yH(t){return t?R0({apiToken:t}):null}const li={cdaToken:"",commentsModelIdsByEnvironment:{},debugLoggingEnabled:!1,migrationCompleted:!1,realTimeUpdatesEnabled:!0};function gH(t,e){return typeof t=="string"?t:e}function PA(t,e){return gH(t,e).trim()}function pa(t,e){return typeof t=="boolean"?t:e}function UA(t){return!t||typeof t!="object"||Array.isArray(t)?{}:Object.fromEntries(Object.entries(t).flatMap(([e,n])=>{if(typeof n!="string")return[];const r=n.trim();return r?[[e,r]]:[]}))}function Yl(t){if(!t||typeof t!="object")return{...li};const e=t;return{cdaToken:PA(e.cdaToken,li.cdaToken),commentsModelIdsByEnvironment:UA(e.commentsModelIdsByEnvironment),debugLoggingEnabled:pa(e.debugLoggingEnabled,li.debugLoggingEnabled),migrationCompleted:pa(e.migrationCompleted,li.migrationCompleted),realTimeUpdatesEnabled:pa(e.realTimeUpdatesEnabled,li.realTimeUpdatesEnabled)}}function kg(t){return{cdaToken:PA(t.cdaToken,li.cdaToken),commentsModelIdsByEnvironment:UA(t.commentsModelIdsByEnvironment),debugLoggingEnabled:pa(t.debugLoggingEnabled,li.debugLoggingEnabled),migrationCompleted:pa(t.migrationCompleted,li.migrationCompleted),realTimeUpdatesEnabled:pa(t.realTimeUpdatesEnabled,li.realTimeUpdatesEnabled)}}function bH(t,e){return t.commentsModelIdsByEnvironment[e]??null}function vH(t,e,n){return kg({...t,commentsModelIdsByEnvironment:{...t.commentsModelIdsByEnvironment,[e]:n}})}const SH=[{label:"Model ID",api_key:Am.MODEL_ID,field_type:"string",validators:{required:{}}},{label:"Record ID",api_key:Am.RECORD_ID,field_type:"string",validators:{required:{},unique:{}}},{label:"Content",api_key:Am.CONTENT,field_type:"json",validators:{required:{}}}];async function OE(t){return(await t.itemTypes.list()).find(n=>n.api_key===ai)??null}async function wH(t,e,n,r){if(r.some(i=>i.api_key===n.api_key))return r;try{const i=await t.fields.create(e,n);return[...r,i]}catch(i){const o=await t.fields.list(e);if(o.some(l=>l.api_key===n.api_key))return o;throw i}}async function _H(t,e){let n=await t.fields.list(e);for(const r of SH)n=await wH(t,e,r,n)}async function qA(t){let e=await OE(t);if(!e)try{e=await t.itemTypes.create({name:"Project Comment",api_key:ai,draft_mode_active:!1})}catch(n){if(e=await OE(t),!e)throw n}return await _H(t,e.id),e.id}async function TH(t){if(!t.currentUserAccessToken)return null;const e=R0({apiToken:t.currentUserAccessToken});return qA(e)}const EH=({ctx:t})=>{const{id:e}=RA(t.currentUser),[n,r]=C.useState([]),i=C.useRef(null),o=C.useRef(new Set),[l,c]=C.useState(!1),[d,f]=C.useState(null),p=t.currentUserAccessToken,m=Yl(t.plugin.attributes.parameters),y=m.realTimeUpdatesEnabled,b=m.cdaToken,S=y&&!!b,w=bH(m,t.environment);C.useEffect(()=>{Be("Comments sidebar initialized",{hasCdaToken:!!b,mode:S?"realtime":"cma-fallback",modelId:t.itemType.id,realTimeEnabled:S,realTimeRequested:y,recordId:t.item?.id??null})},[b,t.item?.id,t.itemType.id,S,y]);const T=C.useMemo(()=>yH(p),[p]),{projectUsers:M,projectModels:k,modelFields:j,typedUsers:I}=B7(t,{loadFields:!0}),{canMentionAssets:O,canMentionModels:P,readableModels:A}=Q7(t,k),U=t.site.attributes.locales[0]??"en",{prefetchEntities:H,resolveComments:se,cacheVersion:re}=hH({client:T,projectUsers:M,projectModels:k,modelFields:j,itemTypes:t.itemTypes,mainLocale:U}),[te,Z]=C.useState(()=>Dl(t.itemTypes)?.id??w);C.useEffect(()=>{const he=Dl(t.itemTypes)?.id??w;he&&he!==te&&Z(he)},[te,t.itemTypes,w]),C.useEffect(()=>{Be("Comments model resolution state",{activeCommentsModelId:te,contextCommentsModelId:Dl(t.itemTypes)?.id??null,hasClient:!!T,storedCommentsModelId:w})},[T,te,t.itemTypes,w]);const G=C.useCallback(async()=>{const he=Dl(t.itemTypes)?.id;if(he)return Be("Using comments model ID from loaded item types",{commentsModelId:he}),he!==te&&Z(he),he;if(T)try{Be("Ensuring comments model via CMA client",{environment:t.environment});const Ce=await qA(T);return Z(Ve=>Ve===Ce?Ve:Ce),Be("Ensured comments model via CMA client",{commentsModelId:Ce,environment:t.environment}),Ce}catch(Ce){if(!w)throw Ce;Be("Falling back to stored comments model ID in sidebar",{environment:t.environment,errorMessage:Ce instanceof Error?Ce.message:String(Ce)})}return w?(Be("Using stored comments model ID from plugin parameters",{commentsModelId:w,environment:t.environment}),w!==te&&Z(w),w):(Be("Comments model ID could not be resolved",{environment:t.environment,hasClient:!!T}),null)},[T,te,t.environment,t.itemTypes,w]);C.useEffect(()=>{if(te||!T)return;let he=!1;return G().catch(Ce=>{he||tt("Failed to resolve comments model in sidebar",Ce,{environment:t.environment})}),()=>{he=!0}},[T,te,t.environment,G]);const[fe,R]=C.useState(null),{enqueue:$,pendingCount:ie,isSyncAllowed:me,retryState:ye}=A7({client:T,commentRecordId:fe,commentsModelId:te,modelId:t.itemType.id,recordId:t.item?.id,ctx:t,onRecordCreated:R,resolveCommentsModelId:G}),N=C.useCallback(()=>{t.alert("The comment you were replying to was deleted by another user.")},[t]),{comments:Q,setComments:ce,isLoading:le,error:we,errorInfo:ve,status:je,retry:nt,isAutoReconnecting:pe}=P7({ctx:t,realTimeEnabled:S,cdaToken:b,client:T,commentsModelId:te,isSyncAllowed:me,onCommentRecordIdChange:R,currentUserId:e,onOrphanedDraft:N});C.useEffect(()=>{d===null&&Q.length>0&&f(Math.max(0,Q.length-km))},[Q.length,d]);const Me=C.useMemo(()=>{const he=d??Math.max(0,Q.length-km),Ce=Q.length-he;return Q.slice(0,Ce)},[Q,d]);C.useEffect(()=>{H(Me)},[Me,H]);const wt=C.useMemo(()=>se(Me),[Me,se,re]),Ne=(d??0)>0,{submitNewComment:Re,deleteComment:De,editComment:pt,upvoteComment:it,replyComment:lt}=H7({ctx:t,userId:e,comments:Q,setComments:ce,enqueue:$,composerSegments:n,setComposerSegments:r,pendingNewReplies:o}),ft=C.useCallback(async()=>{if(O)try{const he=await t.selectUpload({multiple:!1});if(!he)return;const Ce=zA(he);i.current?.insertMention(Ce)}catch(he){tt("Asset picker error:",he),t.alert(Rn.ASSET_PICKER_FAILED)}},[t,O]),st=C.useCallback(()=>{c(!0)},[]),xe=C.useCallback(()=>{c(!1),i.current?.focus()},[]),{isPickerInProgress:bn,handleReplyPickerRequest:hr,handleRecordModelSelectFromComment:_r}=iH({ctx:t,client:T,canMentionAssets:O}),Qe=C.useCallback(async he=>{c(!1);const Ce=i.current;if(!Ce){pn("No valid composer target for record mention, aborting");return}try{const Ve=await t.selectItem(he.id,{multiple:!1});if(!Ve){Ce?.focus();return}const rt=t.itemTypes[he.id];let Gt=[];if(rt)try{Gt=await t.loadItemTypeFields(he.id)}catch(Zf){tt("Failed to load item type fields for record mention",Zf,{modelId:he.id})}const Ke=t.site.attributes.locales[0]??"en",ku=await BA({id:Ve.id,attributes:Ve.attributes},{id:he.id,apiKey:he.apiKey,name:he.name,isBlockModel:he.isBlockModel},rt,Gt,Ke,T);await Cg(Ce,ku)}catch(Ve){tt("Record picker error:",Ve),t.alert(Rn.RECORD_PICKER_FAILED)}},[t,T]),{handleUserToolbarClick:Vn,handleFieldToolbarClick:Tr,handleModelToolbarClick:Lr,handleAssetToolbarClick:ue,handleRecordToolbarClick:ae}=z7({composerRef:i,canMentionModels:P,handleAssetTrigger:ft,handleRecordTrigger:st}),be=C.useMemo(()=>ia(n),[n]);if(S&&je===_g.CONNECTING||!S&&le)return E.jsx(_d,{ctx:t,children:E.jsx("div",{className:ht.loading,children:E.jsx(wy,{})})});if(we){const he=kk(we);return E.jsx(_d,{ctx:t,children:E.jsxs("div",{className:ht.error,role:"alert",children:[E.jsx("p",{children:"Error loading comments"}),E.jsx("span",{children:he.message})]})})}return E.jsx(_d,{ctx:t,children:E.jsx(d5,{projectUsers:M,projectModels:k,modelFields:j,currentUserId:e,typedUsers:I,children:E.jsx(mH,{canMentionFields:!0,canMentionAssets:O,canMentionModels:P,children:E.jsxs("div",{className:ht.container,children:[!pe&&E.jsx("div",{className:ht.header,children:E.jsx(aE,{subscriptionStatus:je,subscriptionError:ve?.message??null,retryState:ye,onRetry:nt,realTimeEnabled:S,isAutoReconnecting:!1})}),y&&!b&&E.jsxs("div",{className:ht.warning,children:[E.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"currentColor",role:"img","aria-labelledby":"warningIconTitle",children:[E.jsx("title",{id:"warningIconTitle",children:"Warning"}),E.jsx("path",{d:"M8.982 1.566a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767L8.982 1.566zM8 5c.535 0 .954.462.9.995l-.35 3.507a.552.552 0 0 1-1.1 0L7.1 5.995A.905.905 0 0 1 8 5zm.002 6a1 1 0 1 1 0 2 1 1 0 0 1 0-2z"})]}),E.jsx("span",{children:"Realtime updates disabled. Configure a CDA token in plugin settings."})]}),E.jsx("div",{className:ht.composer,children:E.jsxs(xk,{fallbackMessage:"Unable to load editor. Please refresh.",children:[pe&&E.jsx(aE,{subscriptionStatus:je,subscriptionError:null,retryState:ye,onRetry:nt,realTimeEnabled:S,isAutoReconnecting:!0,variant:"banner"}),E.jsxs("div",{className:ht.composerInputWrapper,children:[E.jsx(A0,{ref:i,segments:n,onSegmentsChange:r,onSubmit:Re,placeholder:`Add a comment...
181
+ Type / for commands`,projectUsers:M,modelFields:j,projectModels:k,canMentionAssets:O,canMentionModels:P,canMentionFields:!0,onAssetTrigger:ft,onRecordTrigger:st,autoFocus:!1,ctx:t}),l&&E.jsx(PE,{models:A,onSelect:Qe,onClose:xe}),E.jsx($E,{onUserClick:Vn,onFieldClick:Tr,onRecordClick:ae,onAssetClick:ue,onModelClick:Lr,onSendClick:Re,isSendDisabled:be||ie>0,canMentionAssets:O,canMentionModels:P})]})]})}),E.jsx(X$,{comments:wt,hasMoreComments:Ne,onLoadMore:()=>f(he=>Math.max(0,(he??0)-km)),currentUserId:e,modelFields:j,projectUsers:M,projectModels:k,deleteComment:De,editComment:pt,upvoteComment:it,replyComment:lt,onPickerRequest:hr,onRecordModelSelect:_r,readableModels:A,canMentionAssets:O,canMentionModels:P,ctx:t,isPickerActive:bn})]})})})})},MH="_container_1edot_23",xH="_intro_1edot_29",CH="_successBox_1edot_36",kH="_successIcon_1edot_49",AH="_warningBox_1edot_63",OH="_warningIcon_1edot_76",NH="_formField_1edot_90",RH="_buttonRow_1edot_94",DH="_section_1edot_99",IH="_advancedSettings_1edot_103",LH="_advancedSettingsContent_1edot_107",jH="_nestedSection_1edot_111",BH="_sectionTitle_1edot_115",zH="_description_1edot_124",PH="_code_1edot_130",UH="_migrationActions_1edot_143",qH="_migrationModels_1edot_149",$H="_migrationSubtitle_1edot_156",FH="_modelList_1edot_163",HH="_modelItem_1edot_169",VH="_modelName_1edot_181",KH="_modelApiKey_1edot_186",GH="_progressContainer_1edot_194",YH="_progressHeader_1edot_201",QH="_progressBar_1edot_209",XH="_progressFill_1edot_216",JH="_resultsContainer_1edot_225",WH="_resultsGrid_1edot_232",ZH="_resultItem_1edot_239",e9="_resultNumber_1edot_247",t9="_resultLabel_1edot_254",n9="_errorList_1edot_261",r9="_errorBox_1edot_288",i9="_errorIcon_1edot_301",s9="_dangerBox_1edot_317",o9="_dangerIcon_1edot_330",a9="_cleanupSection_1edot_337",l9="_confirmDialog_1edot_343",u9="_confirmActions_1edot_357",c9="_scanProgressContainer_1edot_364",d9="_scanProgressHeader_1edot_372",f9="_scanPhaseLabel_1edot_379",h9="_scanProgressCount_1edot_385",p9="_scanDetails_1edot_391",m9="_scanCurrentModel_1edot_400",y9="_scanFoundCounter_1edot_411",_e={container:MH,intro:xH,successBox:CH,successIcon:kH,warningBox:AH,warningIcon:OH,formField:NH,buttonRow:RH,section:DH,advancedSettings:IH,advancedSettingsContent:LH,nestedSection:jH,sectionTitle:BH,description:zH,code:PH,migrationActions:UH,migrationModels:qH,migrationSubtitle:$H,modelList:FH,modelItem:HH,modelName:VH,modelApiKey:KH,progressContainer:GH,progressHeader:YH,progressBar:QH,progressFill:XH,resultsContainer:JH,resultsGrid:WH,resultItem:ZH,resultNumber:e9,resultLabel:t9,errorList:n9,errorBox:r9,errorIcon:i9,dangerBox:s9,dangerIcon:o9,cleanupSection:a9,confirmDialog:l9,confirmActions:u9,scanProgressContainer:c9,scanProgressHeader:d9,scanPhaseLabel:f9,scanProgressCount:h9,scanDetails:p9,scanCurrentModel:m9,scanFoundCounter:y9};function g9(t){return Array.isArray(t)?t.flatMap(e=>typeof e=="string"?e:e&&typeof e=="object"&&typeof e.email=="string"?e.email:[]):[]}function $A(t){if(!t||typeof t!="object")return!1;const e=t;return!(!!e.author&&typeof e.author=="object"&&typeof e.author.email=="string")||typeof e.dateISO!="string"||e.usersWhoUpvoted!==void 0&&!Array.isArray(e.usersWhoUpvoted)?!1:e.replies!==void 0?Array.isArray(e.replies)?e.replies.every(r=>$A(r)):!1:!0}function FA(t){const{parentCommentISO:e,author:n,usersWhoUpvoted:r,replies:i,...o}=t;return{...o,authorEmail:n.email,upvoterEmails:g9(r),replies:i?.map(FA),...e!==void 0&&{parentCommentId:e}}}function b9(t){return $A(t)?FA(t):null}function HA(t){return!t.id||t.id===t.dateISO?!0:/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}/.test(t.id)}function VA(t){return HA(t)||t.replies?.some(e=>VA(e))===!0}function KA(t,e=new Map){const n=t.id??t.dateISO,r=HA(t),i=r?crypto.randomUUID():n;r&&n&&e.set(n,i);let o=t.parentCommentId;t.parentCommentId&&e.has(t.parentCommentId)&&(o=e.get(t.parentCommentId));const l=t.replies?.map(c=>{const d={...c,parentCommentId:c.parentCommentId===n?i:c.parentCommentId};return KA(d,e)});return{...t,id:i,...o!==void 0&&{parentCommentId:o},...l&&{replies:l}}}function v9(t){if(!t.some(i=>VA(i)))return{comments:t,wasMigrated:!1};const n=new Map;return{comments:t.map(i=>KA(i,n)),wasMigrated:!0}}const S9=({ctx:t})=>{const e=Yl(t.plugin.attributes.parameters),n={cdaToken:e.cdaToken,debugLoggingEnabled:e.debugLoggingEnabled,realTimeEnabled:e.realTimeUpdatesEnabled},[r,i]=C.useState(n.cdaToken),[o,l]=C.useState(n.debugLoggingEnabled),[c,d]=C.useState(n.realTimeEnabled),[f,p]=C.useState(n),[m,y]=C.useState(!1),[b,S]=C.useState(e.migrationCompleted),[w,T]=C.useState(e.migrationCompleted?"completed":"idle"),[M,k]=C.useState([]),[j,I]=C.useState(null),[O,P]=C.useState(null),[A,U]=C.useState(null),[H,se]=C.useState(!1),[re,te]=C.useState(!1),[Z,G]=C.useState(!1),[fe,R]=C.useState(null),[$,ie]=C.useState([]),me=C.useRef(!1),ye=w==="scanning"||w==="migrating"||w==="error"||O!==null||M.length>0||$.length>0||re;C.useEffect(()=>(me.current=!0,()=>{me.current=!1}),[]),C.useEffect(()=>{ye&&G(!0)},[ye]),C.useEffect(()=>{kd(o)},[o]);const N=r.trim(),Q=f.cdaToken!==N||f.debugLoggingEnabled!==o||f.realTimeEnabled!==c,ce=async()=>{y(!0);try{if(Be("Saving plugin settings",{debugLoggingEnabled:o,hasCdaToken:!!N,migrationCompleted:b,realTimeEnabled:c}),await t.updatePluginParameters(kg({cdaToken:N,commentsModelIdsByEnvironment:e.commentsModelIdsByEnvironment,debugLoggingEnabled:o,realTimeUpdatesEnabled:c,migrationCompleted:b})),!me.current)return;p({cdaToken:N,debugLoggingEnabled:o,realTimeEnabled:c}),i(N),Be("Plugin settings saved",{debugLoggingEnabled:o,hasCdaToken:!!N,migrationCompleted:b,realTimeEnabled:c}),t.notice("Settings saved successfully!")}catch(pe){if(!me.current)return;t.alert(`Failed to save settings: ${pe instanceof Error?pe.message:"Unknown error"}`)}finally{me.current&&y(!1)}},le=C.useCallback(()=>t.currentUserAccessToken?R0({apiToken:t.currentUserAccessToken}):null,[t.currentUserAccessToken]),we=C.useCallback(async()=>{Be("Scanning models for legacy comments",{totalModels:Object.values(t.itemTypes).filter(pe=>pe!==void 0&&pe.attributes.api_key!==ai).length}),T("scanning"),U(null),k([]),ie([]),R({phase:"scanning-fields",scannedModels:0,totalModels:Object.values(t.itemTypes).filter(pe=>pe!==void 0&&pe.attributes.api_key!==ai).length,foundCount:0});try{const pe=Object.values(t.itemTypes).filter(De=>De!==void 0),Me=[],wt=[],Ne=pe.filter(De=>De.attributes.api_key!==ai);let Re=0;for(const De of Ne){if(!me.current)return;R({phase:"scanning-fields",currentModel:De.attributes.name,scannedModels:Re,totalModels:Ne.length,foundCount:Me.length});try{const it=(await t.loadItemTypeFields(De.id)).find(lt=>lt.attributes.api_key==="comment_log");it&&Me.push({modelId:De.id,modelName:De.attributes.name,modelApiKey:De.attributes.api_key,fieldId:it.id})}catch(pt){wt.push(`${De.attributes.name} (${De.attributes.api_key}) could not be inspected`),pn(`Failed to load fields for model ${De.attributes.name}`,{modelId:De.id,error:pt})}if(Re++,!me.current)return;R({phase:"scanning-fields",currentModel:De.attributes.name,scannedModels:Re,totalModels:Ne.length,foundCount:Me.length})}if(!me.current)return;k(Me),ie(wt),R(null),Be("Legacy comment scan completed",{foundModels:Me.length,inspectionErrors:wt.length}),wt.length>0?(T("idle"),await t.notice(`Scan completed with ${wt.length} inspection error(s). Review the details below before migrating.`)):Me.length===0?(T("idle"),await t.notice("No legacy comment_log fields found. Nothing to migrate!")):(T("idle"),await t.notice(`Found ${Me.length} model(s) with comment_log fields.`))}catch(pe){if(!me.current)return;Be("Legacy comment scan failed",{message:pe instanceof Error?pe.message:"Unknown error during scan"}),T("error"),R(null),U(pe instanceof Error?pe.message:"Unknown error during scan")}},[t]),ve=C.useCallback(async()=>{const pe=le();if(!pe){t.alert("Unable to access API. Please ensure you have proper permissions.");return}if(M.length===0){t.alert("No models to migrate. Please scan first.");return}T("migrating"),U(null),P(null);const Me={success:0,skipped:0,failed:0,errors:[],warnings:[]};try{Be("Starting legacy comment migration",{modelsToMigrate:M.length});const wt=Object.values(t.itemTypes).find(Re=>Re?.attributes.api_key===ai);if(!wt)throw new Error("project_comment model not found. Please reload the plugin to create it.");let Ne=0;for(const Re of M){if(!me.current)return;I({currentModel:Re.modelName,currentRecord:0,totalRecords:0,processedModels:Ne,totalModels:M.length});const De=[];for await(const lt of pe.items.listPagedIterator({filter:{type:Re.modelApiKey}}))De.push({id:lt.id,comment_log:lt.comment_log});let pt=0;const it=De.length;for(const lt of De){if(!me.current)return;pt++,I({currentModel:Re.modelName,currentRecord:pt,totalRecords:it,processedModels:Ne,totalModels:M.length});const ft=lt.comment_log;if(!ft)continue;let st;if(typeof ft=="string")try{const Qe=JSON.parse(ft);if(!Array.isArray(Qe))continue;st=Qe}catch(Qe){pn("Skipping record with invalid JSON comment_log",{recordId:lt.id,error:Qe});continue}else if(Array.isArray(ft))st=ft;else continue;if(st.length===0)continue;const xe=st.flatMap(Qe=>{const Vn=b9(Qe);return Vn?[Vn]:[]}),bn=st.length-xe.length;if(bn>0&&Me.warnings.push({recordId:lt.id,modelName:Re.modelName,message:bn===st.length?"All legacy comments were malformed and were skipped.":`${bn} malformed legacy comment(s) were skipped during migration.`}),xe.length===0){Me.failed++,Me.errors.push(`Record ${lt.id} in ${Re.modelName}: all legacy comments were malformed`);continue}const{comments:hr}=v9(xe);if((await pe.items.list({filter:{type:ai,fields:{model_id:{eq:Re.modelId},record_id:{eq:lt.id}}}})).length>0){Me.skipped++;continue}try{await pe.items.create({item_type:{type:"item_type",id:wt.id},model_id:Re.modelId,record_id:lt.id,content:JSON.stringify(hr)}),Me.success++}catch(Qe){Me.failed++,Me.errors.push(`Record ${lt.id} in ${Re.modelName}: ${Qe instanceof Error?Qe.message:"Unknown error"}`)}pt%10===0&&await new Promise(Qe=>setTimeout(Qe,100))}Ne++}if(!me.current)return;if(P(Me),I(null),Be("Legacy comment migration completed",{failed:Me.failed,skipped:Me.skipped,success:Me.success,warnings:Me.warnings.length}),Me.failed===0){if(T("completed"),await t.updatePluginParameters(kg({cdaToken:N,commentsModelIdsByEnvironment:e.commentsModelIdsByEnvironment,debugLoggingEnabled:o,realTimeUpdatesEnabled:c,migrationCompleted:!0})),!me.current)return;S(!0),p({cdaToken:N,debugLoggingEnabled:o,realTimeEnabled:c}),i(N),await t.notice("Migration completed successfully!")}else T("completed"),await t.notice(`Migration completed with ${Me.failed} error(s). Check details below.`)}catch(wt){if(!me.current)return;Be("Legacy comment migration failed",{message:wt instanceof Error?wt.message:"Unknown error during migration"}),T("error"),U(wt instanceof Error?wt.message:"Unknown error during migration"),I(null)}},[t,o,le,M,c,N]),je=C.useCallback(async()=>{const pe=le();if(!pe){t.alert("Unable to access API. Please ensure you have proper permissions.");return}se(!0),te(!1);try{Be("Deleting legacy comment_log fields",{fieldsToDelete:M.length});for(const Me of M){if(!me.current)return;await pe.fields.destroy(Me.fieldId)}if(!me.current)return;k([]),Be("Legacy comment_log field cleanup completed"),await t.notice("Old comment_log fields have been deleted successfully!")}catch(Me){if(!me.current)return;Be("Legacy comment_log field cleanup failed",{message:Me instanceof Error?Me.message:"Unknown error"}),t.alert(`Error deleting fields: ${Me instanceof Error?Me.message:"Unknown error"}`)}finally{me.current&&se(!1)}},[t,le,M]),nt=()=>E.jsxs("div",{children:[E.jsx("h3",{className:_e.migrationSubtitle,children:"Migration from Legacy System"}),E.jsxs("p",{className:_e.description,children:["If you were using an older version of this plugin that stored comments in a"," ",E.jsx("code",{className:_e.code,children:"comment_log"})," field on each model, you can migrate those comments to the new centralized system."]}),w==="idle"&&M.length>0&&E.jsxs("div",{className:_e.warningBox,children:[E.jsx("div",{className:_e.warningIcon,children:"!"}),E.jsxs("div",{children:[E.jsx("strong",{children:"Important:"})," Please ensure no one is editing comments during the migration process to avoid data loss."]})]}),w!=="completed"&&E.jsx("div",{className:_e.migrationActions,children:E.jsx(Fo,{buttonType:"muted",onClick:we,disabled:w==="scanning"||w==="migrating",children:w==="scanning"?E.jsxs(E.Fragment,{children:[E.jsx(wy,{size:16})," Scanning..."]}):"Scan for Legacy Comments"})}),w==="scanning"&&fe&&E.jsxs("div",{className:_e.scanProgressContainer,children:[E.jsxs("div",{className:_e.scanProgressHeader,children:[E.jsx("span",{className:_e.scanPhaseLabel,children:"Checking model fields..."}),E.jsxs("span",{className:_e.scanProgressCount,children:[fe.scannedModels," / ",fe.totalModels]})]}),E.jsxs(E.Fragment,{children:[E.jsx("div",{className:_e.progressBar,children:E.jsx("div",{className:_e.progressFill,style:{width:`${fe.totalModels>0?fe.scannedModels/fe.totalModels*100:0}%`}})}),E.jsxs("div",{className:_e.scanDetails,children:[fe.currentModel&&E.jsxs("span",{className:_e.scanCurrentModel,children:["Checking: ",E.jsx("strong",{children:fe.currentModel})]}),E.jsxs("span",{className:_e.scanFoundCounter,children:[fe.foundCount," legacy field",fe.foundCount!==1?"s":""," found"]})]})]})]}),$.length>0&&E.jsxs("div",{className:_e.errorList,children:[E.jsx("h4",{children:"Models not inspected"}),E.jsx("ul",{children:$.map(pe=>E.jsx("li",{children:pe},pe))})]}),M.length>0&&w!=="migrating"&&E.jsxs("div",{className:_e.migrationModels,children:[E.jsxs("h3",{className:_e.migrationSubtitle,children:["Found ",M.length," model(s) with comment_log field:"]}),E.jsx("ul",{className:_e.modelList,children:M.map(pe=>E.jsxs("li",{className:_e.modelItem,children:[E.jsx("span",{className:_e.modelName,children:pe.modelName}),E.jsxs("span",{className:_e.modelApiKey,children:["(",pe.modelApiKey,")"]})]},pe.modelId))}),w!=="completed"&&E.jsx("div",{className:_e.migrationActions,children:E.jsx(Fo,{buttonType:"primary",onClick:ve,children:"Start Migration"})})]}),w==="migrating"&&j&&E.jsxs("div",{className:_e.progressContainer,children:[E.jsxs("div",{className:_e.progressHeader,children:[E.jsxs("span",{children:["Migrating: ",j.currentModel," (",j.processedModels+1,"/",j.totalModels," models)"]}),E.jsxs("span",{children:["Record ",j.currentRecord,"/",j.totalRecords]})]}),E.jsx("div",{className:_e.progressBar,children:E.jsx("div",{className:_e.progressFill,style:{width:`${j.totalRecords>0?j.currentRecord/j.totalRecords*100:0}%`}})})]}),w==="error"&&A&&E.jsxs("div",{className:_e.errorBox,children:[E.jsx("div",{className:_e.errorIcon,children:"✕"}),E.jsxs("div",{children:[E.jsx("strong",{children:"Error:"})," ",A]})]}),O&&E.jsxs("div",{className:_e.resultsContainer,children:[E.jsx("h3",{className:_e.migrationSubtitle,children:"Migration Results"}),E.jsxs("div",{className:_e.resultsGrid,children:[E.jsxs("div",{className:_e.resultItem,children:[E.jsx("span",{className:_e.resultNumber,children:O.success}),E.jsx("span",{className:_e.resultLabel,children:"Migrated"})]}),E.jsxs("div",{className:_e.resultItem,children:[E.jsx("span",{className:_e.resultNumber,children:O.skipped}),E.jsx("span",{className:_e.resultLabel,children:"Skipped (already migrated)"})]}),E.jsxs("div",{className:_e.resultItem,children:[E.jsx("span",{className:_e.resultNumber,children:O.failed}),E.jsx("span",{className:_e.resultLabel,children:"Failed"})]})]}),O.errors.length>0&&E.jsxs("div",{className:_e.errorList,children:[E.jsx("h4",{children:"Errors:"}),E.jsxs("ul",{children:[O.errors.slice(0,10).map(pe=>E.jsx("li",{children:pe},pe)),O.errors.length>10&&E.jsxs("li",{children:["...and ",O.errors.length-10," more errors"]})]})]}),O.warnings.length>0&&E.jsxs("div",{className:_e.errorList,children:[E.jsx("h4",{children:"Warnings:"}),E.jsxs("ul",{children:[O.warnings.slice(0,10).map(pe=>E.jsxs("li",{children:[pe.modelName," / ",pe.recordId,": ",pe.message]},`${pe.modelName}-${pe.recordId}-${pe.message}`)),O.warnings.length>10&&E.jsxs("li",{children:["...and ",O.warnings.length-10," more warnings"]})]})]})]}),w==="completed"&&M.length>0&&E.jsxs("div",{className:_e.cleanupSection,children:[E.jsx("h3",{className:_e.migrationSubtitle,children:"Cleanup Old Fields"}),E.jsxs("p",{className:_e.description,children:["After verifying the migration was successful, you can optionally delete the old ",E.jsx("code",{className:_e.code,children:"comment_log"})," fields from your models."]}),E.jsxs("div",{className:_e.dangerBox,children:[E.jsx("div",{className:_e.dangerIcon,children:"⚠️"}),E.jsxs("div",{children:[E.jsx("strong",{children:"Warning:"})," This action is irreversible. Only proceed if you have verified that all comments were migrated successfully."]})]}),re?E.jsxs("div",{className:_e.confirmDialog,children:[E.jsxs("p",{children:["Are you sure you want to delete ",M.length," comment_log field(s)?"]}),E.jsxs("div",{className:_e.confirmActions,children:[E.jsx(Fo,{buttonType:"negative",onClick:je,disabled:H,children:H?E.jsxs(E.Fragment,{children:[E.jsx(wy,{size:16})," Deleting..."]}):"Yes, Delete Fields"}),E.jsx(Fo,{buttonType:"muted",onClick:()=>te(!1),disabled:H,children:"Cancel"})]})]}):E.jsx("div",{className:_e.migrationActions,children:E.jsx(Fo,{buttonType:"negative",onClick:()=>te(!0),disabled:H,children:"Delete Old comment_log Fields"})})]}),w==="completed"&&M.length===0&&E.jsxs("div",{className:_e.successBox,children:[E.jsx("div",{className:_e.successIcon,children:"✓"}),E.jsxs("div",{children:[E.jsx("strong",{children:"Migration complete!"})," All comments have been migrated to the new system and old fields have been cleaned up."]})]})]});return E.jsx(_d,{ctx:t,children:E.jsxs("div",{className:_e.container,children:[E.jsxs("p",{className:_e.intro,children:["This plugin adds a ",E.jsx("strong",{children:"sidebar panel"})," to every record for threaded discussions. Use rich mentions to reference users, fields, records, assets, and models directly in your comments with slash commands (type / to see all options)."]}),E.jsxs("div",{className:_e.section,children:[E.jsx("h2",{className:_e.sectionTitle,children:"Configuration"}),E.jsx("p",{className:_e.description,children:"Configure how record comments synchronize across users. Real-time updates are recommended for the best collaborative experience."}),E.jsx("div",{className:_e.formField,children:E.jsx(rw,{id:"realtime-toggle",name:"realtime-toggle",label:"Enable Real-Time Updates (Recommended)",hint:"When enabled, comments update instantly across all users. Requires a Content Delivery API token.",value:c,onChange:pe=>d(pe)})}),c&&E.jsx("div",{className:_e.formField,children:E.jsx(R2,{id:"cda-token",name:"cda-token",label:"Content Delivery API Token",hint:"You can find this in Project Settings → API Tokens. Use a token with read access.",value:r,onChange:pe=>i(pe),textInputProps:{monospaced:!0}})}),E.jsx("div",{className:_e.advancedSettings,children:E.jsx(g2,{title:"Advanced settings",collapsible:{isOpen:Z,onToggle:()=>G(pe=>!pe)},children:E.jsxs("div",{className:_e.advancedSettingsContent,children:[E.jsx("div",{className:_e.formField,children:E.jsx(rw,{id:"debug-logging-toggle",name:"debug-logging-toggle",label:"Enable Debug logging",hint:"When enabled, the plugin writes detailed browser-console diagnostics for troubleshooting.",value:o,onChange:pe=>l(pe)})}),E.jsx("div",{className:_e.nestedSection,children:nt()})]})})}),E.jsx("div",{className:_e.buttonRow,children:E.jsx(Fo,{buttonType:"primary",onClick:ce,disabled:m||!Q||c&&!N,children:m?"Saving...":"Save Settings"})})]})]})})},w9={locale:"en",long:{year:{previous:"last year",current:"this year",next:"next year",past:{one:"{0} year ago",other:"{0} years ago"},future:{one:"in {0} year",other:"in {0} years"}},quarter:{previous:"last quarter",current:"this quarter",next:"next quarter",past:{one:"{0} quarter ago",other:"{0} quarters ago"},future:{one:"in {0} quarter",other:"in {0} quarters"}},month:{previous:"last month",current:"this month",next:"next month",past:{one:"{0} month ago",other:"{0} months ago"},future:{one:"in {0} month",other:"in {0} months"}},week:{previous:"last week",current:"this week",next:"next week",past:{one:"{0} week ago",other:"{0} weeks ago"},future:{one:"in {0} week",other:"in {0} weeks"}},day:{previous:"yesterday",current:"today",next:"tomorrow",past:{one:"{0} day ago",other:"{0} days ago"},future:{one:"in {0} day",other:"in {0} days"}},hour:{current:"this hour",past:{one:"{0} hour ago",other:"{0} hours ago"},future:{one:"in {0} hour",other:"in {0} hours"}},minute:{current:"this minute",past:{one:"{0} minute ago",other:"{0} minutes ago"},future:{one:"in {0} minute",other:"in {0} minutes"}},second:{current:"now",past:{one:"{0} second ago",other:"{0} seconds ago"},future:{one:"in {0} second",other:"in {0} seconds"}}},short:{year:{previous:"last yr.",current:"this yr.",next:"next yr.",past:"{0} yr. ago",future:"in {0} yr."},quarter:{previous:"last qtr.",current:"this qtr.",next:"next qtr.",past:{one:"{0} qtr. ago",other:"{0} qtrs. ago"},future:{one:"in {0} qtr.",other:"in {0} qtrs."}},month:{previous:"last mo.",current:"this mo.",next:"next mo.",past:"{0} mo. ago",future:"in {0} mo."},week:{previous:"last wk.",current:"this wk.",next:"next wk.",past:"{0} wk. ago",future:"in {0} wk."},day:{previous:"yesterday",current:"today",next:"tomorrow",past:{one:"{0} day ago",other:"{0} days ago"},future:{one:"in {0} day",other:"in {0} days"}},hour:{current:"this hour",past:"{0} hr. ago",future:"in {0} hr."},minute:{current:"this minute",past:"{0} min. ago",future:"in {0} min."},second:{current:"now",past:"{0} sec. ago",future:"in {0} sec."}},narrow:{year:{previous:"last yr.",current:"this yr.",next:"next yr.",past:"{0}y ago",future:"in {0}y"},quarter:{previous:"last qtr.",current:"this qtr.",next:"next qtr.",past:"{0}q ago",future:"in {0}q"},month:{previous:"last mo.",current:"this mo.",next:"next mo.",past:"{0}mo ago",future:"in {0}mo"},week:{previous:"last wk.",current:"this wk.",next:"next wk.",past:"{0}w ago",future:"in {0}w"},day:{previous:"yesterday",current:"today",next:"tomorrow",past:"{0}d ago",future:"in {0}d"},hour:{current:"this hour",past:"{0}h ago",future:"in {0}h"},minute:{current:"this minute",past:"{0}m ago",future:"in {0}m"},second:{current:"now",past:"{0}s ago",future:"in {0}s"}},now:{now:{current:"now",future:"in a moment",past:"just now"}},mini:{year:"{0}yr",month:"{0}mo",week:"{0}wk",day:"{0}d",hour:"{0}h",minute:"{0}m",second:"{0}s",now:"now"},"short-time":{year:"{0} yr.",month:"{0} mo.",week:"{0} wk.",day:{one:"{0} day",other:"{0} days"},hour:"{0} hr.",minute:"{0} min.",second:"{0} sec."},"long-time":{year:{one:"{0} year",other:"{0} years"},month:{one:"{0} month",other:"{0} months"},week:{one:"{0} week",other:"{0} weeks"},day:{one:"{0} day",other:"{0} days"},hour:{one:"{0} hour",other:"{0} hours"},minute:{one:"{0} minute",other:"{0} minutes"},second:{one:"{0} second",other:"{0} seconds"}}};In.addDefaultLocale(w9);LR({async onBoot(t){const e=Yl(t.plugin.attributes.parameters);kd(e.debugLoggingEnabled);try{const n=await TH(t);if(n&&e.commentsModelIdsByEnvironment[t.environment]!==n)try{await t.updatePluginParameters(vH(e,t.environment,n))}catch(r){tt("Failed to persist comments model ID during plugin boot",r,{environment:t.environment})}}catch(n){tt("Failed to ensure comments model exists during plugin boot",n,{hasAccessToken:!!t.currentUserAccessToken}),t.notice("Comments plugin initialization warning: Unable to verify comment storage. If this is your first time using the plugin, please check your permissions.")}},renderConfigScreen(t){kd(Yl(t.plugin.attributes.parameters).debugLoggingEnabled),WS(E.jsx(S9,{ctx:t}))},itemFormSidebars(){return[{id:Xw.SIDEBAR,label:"Comments"}]},renderItemFormSidebar(t,e){kd(Yl(e.plugin.attributes.parameters).debugLoggingEnabled),t===Xw.SIDEBAR&&WS(E.jsx(c5,{ctx:e,children:E.jsx(EH,{ctx:e})}))}});