diff --git a/js/dist/shinychat.js b/js/dist/shinychat.js index 5166c7b44..eb230e175 100644 --- a/js/dist/shinychat.js +++ b/js/dist/shinychat.js @@ -4,38 +4,38 @@ * MIT License * https://posit-dev.github.io/shinychat/ */ -var r6=Object.create;var jm=Object.defineProperty;var i6=Object.getOwnPropertyDescriptor;var a6=Object.getOwnPropertyNames;var o6=Object.getPrototypeOf,s6=Object.prototype.hasOwnProperty;var wt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),wf=(e,t)=>{for(var n in t)jm(e,n,{get:t[n],enumerable:!0})},l6=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of a6(t))!s6.call(e,i)&&i!==n&&jm(e,i,{get:()=>t[i],enumerable:!(r=i6(t,i))||r.enumerable});return e};var q=(e,t,n)=>(n=e!=null?r6(o6(e)):{},l6(t||!e||!e.__esModule?jm(n,"default",{value:e,enumerable:!0}):n,e));var MS=wt(ut=>{"use strict";function Zm(e,t){var n=e.length;e.push(t);e:for(;0>>1,i=e[r];if(0>>1;rMf(s,n))lMf(u,s)?(e[r]=u,e[l]=n,r=l):(e[r]=s,e[o]=n,r=o);else if(lMf(u,n))e[r]=u,e[l]=n,r=l;else break e}}return t}function Mf(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}ut.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(SS=performance,ut.unstable_now=function(){return SS.now()}):(Xm=Date,_S=Xm.now(),ut.unstable_now=function(){return Xm.now()-_S});var SS,Xm,_S,hi=[],ta=[],u6=1,cr=null,un=3,Jm=!1,ru=!1,iu=!1,eg=!1,CS=typeof setTimeout=="function"?setTimeout:null,NS=typeof clearTimeout=="function"?clearTimeout:null,xS=typeof setImmediate<"u"?setImmediate:null;function Of(e){for(var t=Vr(ta);t!==null;){if(t.callback===null)Rf(ta);else if(t.startTime<=e)Rf(ta),t.sortIndex=t.expirationTime,Zm(hi,t);else break;t=Vr(ta)}}function tg(e){if(iu=!1,Of(e),!ru)if(Vr(hi)!==null)ru=!0,ys||(ys=!0,Es());else{var t=Vr(ta);t!==null&&ng(tg,t.startTime-e)}}var ys=!1,au=-1,vS=5,kS=-1;function wS(){return eg?!0:!(ut.unstable_now()-kSe&&wS());){var r=cr.callback;if(typeof r=="function"){cr.callback=null,un=cr.priorityLevel;var i=r(cr.expirationTime<=e);if(e=ut.unstable_now(),typeof i=="function"){cr.callback=i,Of(e),t=!0;break t}cr===Vr(hi)&&Rf(hi),Of(e)}else Rf(hi);cr=Vr(hi)}if(cr!==null)t=!0;else{var a=Vr(ta);a!==null&&ng(tg,a.startTime-e),t=!1}}break e}finally{cr=null,un=n,Jm=!1}t=void 0}}finally{t?Es():ys=!1}}}var Es;typeof xS=="function"?Es=function(){xS(Wm)}:typeof MessageChannel<"u"?(Qm=new MessageChannel,AS=Qm.port2,Qm.port1.onmessage=Wm,Es=function(){AS.postMessage(null)}):Es=function(){CS(Wm,0)};var Qm,AS;function ng(e,t){au=CS(function(){e(ut.unstable_now())},t)}ut.unstable_IdlePriority=5;ut.unstable_ImmediatePriority=1;ut.unstable_LowPriority=4;ut.unstable_NormalPriority=3;ut.unstable_Profiling=null;ut.unstable_UserBlockingPriority=2;ut.unstable_cancelCallback=function(e){e.callback=null};ut.unstable_forceFrameRate=function(e){0>e||125r?(e.sortIndex=n,Zm(ta,e),Vr(hi)===null&&e===Vr(ta)&&(iu?(NS(au),au=-1):iu=!0,ng(tg,n-r))):(e.sortIndex=i,Zm(hi,e),ru||Jm||(ru=!0,ys||(ys=!0,Es()))),e};ut.unstable_shouldYield=wS;ut.unstable_wrapCallback=function(e){var t=un;return function(){var n=un;un=t;try{return e.apply(this,arguments)}finally{un=n}}}});var RS=wt(($W,OS)=>{"use strict";OS.exports=MS()});var VS=wt(_e=>{"use strict";var ag=Symbol.for("react.transitional.element"),c6=Symbol.for("react.portal"),f6=Symbol.for("react.fragment"),d6=Symbol.for("react.strict_mode"),h6=Symbol.for("react.profiler"),p6=Symbol.for("react.consumer"),m6=Symbol.for("react.context"),g6=Symbol.for("react.forward_ref"),b6=Symbol.for("react.suspense"),E6=Symbol.for("react.memo"),PS=Symbol.for("react.lazy"),y6=Symbol.for("react.activity"),DS=Symbol.iterator;function T6(e){return e===null||typeof e!="object"?null:(e=DS&&e[DS]||e["@@iterator"],typeof e=="function"?e:null)}var US={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},HS=Object.assign,zS={};function Ss(e,t,n){this.props=e,this.context=t,this.refs=zS,this.updater=n||US}Ss.prototype.isReactComponent={};Ss.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Ss.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function FS(){}FS.prototype=Ss.prototype;function og(e,t,n){this.props=e,this.context=t,this.refs=zS,this.updater=n||US}var sg=og.prototype=new FS;sg.constructor=og;HS(sg,Ss.prototype);sg.isPureReactComponent=!0;var IS=Array.isArray;function ig(){}var tt={H:null,A:null,T:null,S:null},qS=Object.prototype.hasOwnProperty;function lg(e,t,n){var r=n.ref;return{$$typeof:ag,type:e,key:t,ref:r!==void 0?r:null,props:n}}function S6(e,t){return lg(e.type,t,e.props)}function ug(e){return typeof e=="object"&&e!==null&&e.$$typeof===ag}function _6(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var LS=/\/+/g;function rg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?_6(""+e.key):t.toString(36)}function x6(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ig,ig):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ts(e,t,n,r,i){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ag:case c6:o=!0;break;case PS:return o=e._init,Ts(o(e._payload),t,n,r,i)}}if(o)return i=i(e),o=r===""?"."+rg(e,0):r,IS(i)?(n="",o!=null&&(n=o.replace(LS,"$&/")+"/"),Ts(i,t,n,"",function(u){return u})):i!=null&&(ug(i)&&(i=S6(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(LS,"$&/")+"/")+o)),t.push(i)),1;o=0;var s=r===""?".":r+":";if(IS(e))for(var l=0;l{"use strict";GS.exports=VS()});var KS=wt(Sn=>{"use strict";var N6=me();function YS(e){var t="https://react.dev/errors/"+e;if(1{"use strict";function $S(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($S)}catch(e){console.error(e)}}$S(),jS.exports=KS()});var oN=wt(ah=>{"use strict";var Ht=RS(),Tx=me(),w6=io();function G(e){var t="https://react.dev/errors/"+e;if(1ks||(e.current=jg[ks],jg[ks]=null,ks--)}function We(e,t){ks++,jg[ks]=e.current,e.current=t}var $r=jr(null),Ru=jr(null),pa=jr(null),pd=jr(null);function md(e,t){switch(We(pa,t),We(Ru,e),We($r,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rx(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rx(t),e=KC(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Vt($r),We($r,e)}function Ks(){Vt($r),Vt(Ru),Vt(pa)}function Xg(e){e.memoizedState!==null&&We(pd,e);var t=$r.current,n=KC(t,e.type);t!==n&&(We(Ru,e),We($r,n))}function gd(e){Ru.current===e&&(Vt($r),Vt(Ru)),pd.current===e&&(Vt(pd),Vu._currentValue=co)}var cg,QS;function oo(e){if(cg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);cg=t&&t[1]||"",QS=-1()=>(t||e((t={exports:{}}).exports,t),t.exports),wf=(e,t)=>{for(var n in t)jm(e,n,{get:t[n],enumerable:!0})},u6=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of o6(t))!l6.call(e,i)&&i!==n&&jm(e,i,{get:()=>t[i],enumerable:!(r=a6(t,i))||r.enumerable});return e};var q=(e,t,n)=>(n=e!=null?i6(s6(e)):{},u6(t||!e||!e.__esModule?jm(n,"default",{value:e,enumerable:!0}):n,e));var MS=wt(ut=>{"use strict";function Zm(e,t){var n=e.length;e.push(t);e:for(;0>>1,i=e[r];if(0>>1;rMf(s,n))lMf(u,s)?(e[r]=u,e[l]=n,r=l):(e[r]=s,e[o]=n,r=o);else if(lMf(u,n))e[r]=u,e[l]=n,r=l;else break e}}return t}function Mf(e,t){var n=e.sortIndex-t.sortIndex;return n!==0?n:e.id-t.id}ut.unstable_now=void 0;typeof performance=="object"&&typeof performance.now=="function"?(SS=performance,ut.unstable_now=function(){return SS.now()}):(Xm=Date,_S=Xm.now(),ut.unstable_now=function(){return Xm.now()-_S});var SS,Xm,_S,hi=[],ta=[],c6=1,cr=null,un=3,Jm=!1,ru=!1,iu=!1,eg=!1,CS=typeof setTimeout=="function"?setTimeout:null,NS=typeof clearTimeout=="function"?clearTimeout:null,xS=typeof setImmediate<"u"?setImmediate:null;function Of(e){for(var t=Vr(ta);t!==null;){if(t.callback===null)Rf(ta);else if(t.startTime<=e)Rf(ta),t.sortIndex=t.expirationTime,Zm(hi,t);else break;t=Vr(ta)}}function tg(e){if(iu=!1,Of(e),!ru)if(Vr(hi)!==null)ru=!0,ys||(ys=!0,Es());else{var t=Vr(ta);t!==null&&ng(tg,t.startTime-e)}}var ys=!1,au=-1,vS=5,kS=-1;function wS(){return eg?!0:!(ut.unstable_now()-kSe&&wS());){var r=cr.callback;if(typeof r=="function"){cr.callback=null,un=cr.priorityLevel;var i=r(cr.expirationTime<=e);if(e=ut.unstable_now(),typeof i=="function"){cr.callback=i,Of(e),t=!0;break t}cr===Vr(hi)&&Rf(hi),Of(e)}else Rf(hi);cr=Vr(hi)}if(cr!==null)t=!0;else{var a=Vr(ta);a!==null&&ng(tg,a.startTime-e),t=!1}}break e}finally{cr=null,un=n,Jm=!1}t=void 0}}finally{t?Es():ys=!1}}}var Es;typeof xS=="function"?Es=function(){xS(Wm)}:typeof MessageChannel<"u"?(Qm=new MessageChannel,AS=Qm.port2,Qm.port1.onmessage=Wm,Es=function(){AS.postMessage(null)}):Es=function(){CS(Wm,0)};var Qm,AS;function ng(e,t){au=CS(function(){e(ut.unstable_now())},t)}ut.unstable_IdlePriority=5;ut.unstable_ImmediatePriority=1;ut.unstable_LowPriority=4;ut.unstable_NormalPriority=3;ut.unstable_Profiling=null;ut.unstable_UserBlockingPriority=2;ut.unstable_cancelCallback=function(e){e.callback=null};ut.unstable_forceFrameRate=function(e){0>e||125r?(e.sortIndex=n,Zm(ta,e),Vr(hi)===null&&e===Vr(ta)&&(iu?(NS(au),au=-1):iu=!0,ng(tg,n-r))):(e.sortIndex=i,Zm(hi,e),ru||Jm||(ru=!0,ys||(ys=!0,Es()))),e};ut.unstable_shouldYield=wS;ut.unstable_wrapCallback=function(e){var t=un;return function(){var n=un;un=t;try{return e.apply(this,arguments)}finally{un=n}}}});var RS=wt((WW,OS)=>{"use strict";OS.exports=MS()});var VS=wt(_e=>{"use strict";var ag=Symbol.for("react.transitional.element"),f6=Symbol.for("react.portal"),d6=Symbol.for("react.fragment"),h6=Symbol.for("react.strict_mode"),p6=Symbol.for("react.profiler"),m6=Symbol.for("react.consumer"),g6=Symbol.for("react.context"),b6=Symbol.for("react.forward_ref"),E6=Symbol.for("react.suspense"),y6=Symbol.for("react.memo"),PS=Symbol.for("react.lazy"),T6=Symbol.for("react.activity"),DS=Symbol.iterator;function S6(e){return e===null||typeof e!="object"?null:(e=DS&&e[DS]||e["@@iterator"],typeof e=="function"?e:null)}var US={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},HS=Object.assign,zS={};function Ss(e,t,n){this.props=e,this.context=t,this.refs=zS,this.updater=n||US}Ss.prototype.isReactComponent={};Ss.prototype.setState=function(e,t){if(typeof e!="object"&&typeof e!="function"&&e!=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,e,t,"setState")};Ss.prototype.forceUpdate=function(e){this.updater.enqueueForceUpdate(this,e,"forceUpdate")};function FS(){}FS.prototype=Ss.prototype;function og(e,t,n){this.props=e,this.context=t,this.refs=zS,this.updater=n||US}var sg=og.prototype=new FS;sg.constructor=og;HS(sg,Ss.prototype);sg.isPureReactComponent=!0;var IS=Array.isArray;function ig(){}var tt={H:null,A:null,T:null,S:null},qS=Object.prototype.hasOwnProperty;function lg(e,t,n){var r=n.ref;return{$$typeof:ag,type:e,key:t,ref:r!==void 0?r:null,props:n}}function _6(e,t){return lg(e.type,t,e.props)}function ug(e){return typeof e=="object"&&e!==null&&e.$$typeof===ag}function x6(e){var t={"=":"=0",":":"=2"};return"$"+e.replace(/[=:]/g,function(n){return t[n]})}var LS=/\/+/g;function rg(e,t){return typeof e=="object"&&e!==null&&e.key!=null?x6(""+e.key):t.toString(36)}function A6(e){switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:switch(typeof e.status=="string"?e.then(ig,ig):(e.status="pending",e.then(function(t){e.status==="pending"&&(e.status="fulfilled",e.value=t)},function(t){e.status==="pending"&&(e.status="rejected",e.reason=t)})),e.status){case"fulfilled":return e.value;case"rejected":throw e.reason}}throw e}function Ts(e,t,n,r,i){var a=typeof e;(a==="undefined"||a==="boolean")&&(e=null);var o=!1;if(e===null)o=!0;else switch(a){case"bigint":case"string":case"number":o=!0;break;case"object":switch(e.$$typeof){case ag:case f6:o=!0;break;case PS:return o=e._init,Ts(o(e._payload),t,n,r,i)}}if(o)return i=i(e),o=r===""?"."+rg(e,0):r,IS(i)?(n="",o!=null&&(n=o.replace(LS,"$&/")+"/"),Ts(i,t,n,"",function(u){return u})):i!=null&&(ug(i)&&(i=_6(i,n+(i.key==null||e&&e.key===i.key?"":(""+i.key).replace(LS,"$&/")+"/")+o)),t.push(i)),1;o=0;var s=r===""?".":r+":";if(IS(e))for(var l=0;l{"use strict";GS.exports=VS()});var KS=wt(Sn=>{"use strict";var v6=me();function YS(e){var t="https://react.dev/errors/"+e;if(1{"use strict";function $S(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE($S)}catch(e){console.error(e)}}$S(),jS.exports=KS()});var oN=wt(ah=>{"use strict";var Ht=RS(),Tx=me(),M6=io();function G(e){var t="https://react.dev/errors/"+e;if(1ks||(e.current=jg[ks],jg[ks]=null,ks--)}function We(e,t){ks++,jg[ks]=e.current,e.current=t}var $r=jr(null),Ru=jr(null),pa=jr(null),pd=jr(null);function md(e,t){switch(We(pa,t),We(Ru,e),We($r,null),t.nodeType){case 9:case 11:e=(e=t.documentElement)&&(e=e.namespaceURI)?rx(e):0;break;default:if(e=t.tagName,t=t.namespaceURI)t=rx(t),e=KC(t,e);else switch(e){case"svg":e=1;break;case"math":e=2;break;default:e=0}}Vt($r),We($r,e)}function Ks(){Vt($r),Vt(Ru),Vt(pa)}function Xg(e){e.memoizedState!==null&&We(pd,e);var t=$r.current,n=KC(t,e.type);t!==n&&(We(Ru,e),We($r,n))}function gd(e){Ru.current===e&&(Vt($r),Vt(Ru)),pd.current===e&&(Vt(pd),Vu._currentValue=co)}var cg,QS;function oo(e){if(cg===void 0)try{throw Error()}catch(n){var t=n.stack.trim().match(/\n( *(at )?)/);cg=t&&t[1]||"",QS=-1)":-1i||l[r]!==u[i]){var c=` -`+l[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=i);break}}}finally{fg=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?oo(n):""}function I6(e,t){switch(e.tag){case 26:case 27:case 5:return oo(e.type);case 16:return oo("Lazy");case 13:return e.child!==t&&t!==null?oo("Suspense Fallback"):oo("Suspense");case 19:return oo("SuspenseList");case 0:case 15:return dg(e.type,!1);case 11:return dg(e.type.render,!1);case 1:return dg(e.type,!0);case 31:return oo("Activity");default:return""}}function ZS(e){try{var t="",n=null;do t+=I6(e,n),n=e,e=e.return;while(e);return t}catch(r){return` +`+l[r].replace(" at new "," at ");return e.displayName&&c.includes("")&&(c=c.replace("",e.displayName)),c}while(1<=r&&0<=i);break}}}finally{fg=!1,Error.prepareStackTrace=n}return(n=e?e.displayName||e.name:"")?oo(n):""}function L6(e,t){switch(e.tag){case 26:case 27:case 5:return oo(e.type);case 16:return oo("Lazy");case 13:return e.child!==t&&t!==null?oo("Suspense Fallback"):oo("Suspense");case 19:return oo("SuspenseList");case 0:case 15:return dg(e.type,!1);case 11:return dg(e.type.render,!1);case 1:return dg(e.type,!0);case 31:return oo("Activity");default:return""}}function ZS(e){try{var t="",n=null;do t+=L6(e,n),n=e,e=e.return;while(e);return t}catch(r){return` Error generating stack: `+r.message+` -`+r.stack}}var Wg=Object.prototype.hasOwnProperty,z0=Ht.unstable_scheduleCallback,hg=Ht.unstable_cancelCallback,L6=Ht.unstable_shouldYield,B6=Ht.unstable_requestPaint,nr=Ht.unstable_now,P6=Ht.unstable_getCurrentPriorityLevel,vx=Ht.unstable_ImmediatePriority,kx=Ht.unstable_UserBlockingPriority,bd=Ht.unstable_NormalPriority,U6=Ht.unstable_LowPriority,wx=Ht.unstable_IdlePriority,H6=Ht.log,z6=Ht.unstable_setDisableYieldValue,$u=null,rr=null;function ua(e){if(typeof H6=="function"&&z6(e),rr&&typeof rr.setStrictMode=="function")try{rr.setStrictMode($u,e)}catch{}}var ir=Math.clz32?Math.clz32:V6,F6=Math.log,q6=Math.LN2;function V6(e){return e>>>=0,e===0?32:31-(F6(e)/q6|0)|0}var Bf=256,Pf=262144,Uf=4194304;function so(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Vd(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~a,r!==0?i=so(r):(o&=s,o!==0?i=so(o):n||(n=s&~e,n!==0&&(i=so(n))))):(s=r&~a,s!==0?i=so(s):o!==0?i=so(o):n||(n=r&~e,n!==0&&(i=so(n)))),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&(n&4194048)!==0)?t:i}function ju(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function G6(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Mx(){var e=Uf;return Uf<<=1,(Uf&62914560)===0&&(Uf=4194304),e}function pg(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xu(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function Y6(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Q6=/[\n"\\]/g;function mr(e){return e.replace(Q6,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jg(e,t,n,r,i,a,o,s){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+dr(t)):e.value!==""+dr(t)&&(e.value=""+dr(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?e0(e,o,dr(t)):n!=null?e0(e,o,dr(n)):r!=null&&e.removeAttribute("value"),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+dr(s):e.removeAttribute("name")}function Hx(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.type=a),t!=null||n!=null){if(!(a!=="submit"&&a!=="reset"||t!=null)){Zg(e);return}n=n!=null?""+dr(n):"",t=t!=null?""+dr(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Zg(e)}function e0(e,t,n){t==="number"&&Ed(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zs(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),n0=!1;if(vi)try{_s={},Object.defineProperty(_s,"passive",{get:function(){n0=!0}}),window.addEventListener("test",_s,_s),window.removeEventListener("test",_s,_s)}catch{n0=!1}var _s,ca=null,K0=null,td=null;function Gx(){if(td)return td;var e,t=K0,n=t.length,r,i="value"in ca?ca.value:ca.textContent,a=i.length;for(e=0;e=yu),u_=" ",c_=!1;function Kx(e,t){switch(e){case"keyup":return C4.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $x(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Os=!1;function v4(e,t){switch(e){case"compositionend":return $x(t);case"keypress":return t.which!==32?null:(c_=!0,u_);case"textInput":return e=t.data,e===u_&&c_?null:e;default:return null}}function k4(e,t){if(Os)return e==="compositionend"||!j0&&Kx(e,t)?(e=Gx(),td=K0=ca=null,Os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=p_(n)}}function Qx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zx(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ed(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ed(e.document)}return t}function X0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var B4=vi&&"documentMode"in document&&11>=document.documentMode,Rs=null,r0=null,Su=null,i0=!1;function g_(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;i0||Rs==null||Rs!==Ed(r)||(r=Rs,"selectionStart"in r&&X0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Su&&Lu(Su,r)||(Su=r,r=Bd(r0,"onSelect"),0>=o,i-=o,Gr=1<<32-ir(t)+i|n<R?(L=M,M=null):L=M.sibling;var A=d(g,M,T[R],S);if(A===null){M===null&&(M=L);break}e&&M&&A.alternate===null&&t(g,M),y=a(A,y,R),x===null?v=A:x.sibling=A,x=A,M=L}if(R===T.length)return n(g,M),De&&yi(g,R),v;if(M===null){for(;RR?(L=M,M=null):L=M.sibling;var H=d(g,M,A.value,S);if(H===null){M===null&&(M=L);break}e&&M&&H.alternate===null&&t(g,M),y=a(H,y,R),x===null?v=H:x.sibling=H,x=H,M=L}if(A.done)return n(g,M),De&&yi(g,R),v;if(M===null){for(;!A.done;R++,A=T.next())A=f(g,A.value,S),A!==null&&(y=a(A,y,R),x===null?v=A:x.sibling=A,x=A);return De&&yi(g,R),v}for(M=r(M);!A.done;R++,A=T.next())A=h(M,g,R,A.value,S),A!==null&&(e&&A.alternate!==null&&M.delete(A.key===null?R:A.key),y=a(A,y,R),x===null?v=A:x.sibling=A,x=A);return e&&M.forEach(function(Y){return t(g,Y)}),De&&yi(g,R),v}function E(g,y,T,S){if(typeof T=="object"&&T!==null&&T.type===vs&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case Lf:e:{for(var v=T.key;y!==null;){if(y.key===v){if(v=T.type,v===vs){if(y.tag===7){n(g,y.sibling),S=i(y,T.props.children),S.return=g,g=S;break e}}else if(y.elementType===v||typeof v=="object"&&v!==null&&v.$$typeof===ra&&lo(v)===y.type){n(g,y.sibling),S=i(y,T.props),uu(S,T),S.return=g,g=S;break e}n(g,y);break}else t(g,y);y=y.sibling}T.type===vs?(S=fo(T.props.children,g.mode,S,T.key),S.return=g,g=S):(S=rd(T.type,T.key,T.props,null,g.mode,S),uu(S,T),S.return=g,g=S)}return o(g);case pu:e:{for(v=T.key;y!==null;){if(y.key===v)if(y.tag===4&&y.stateNode.containerInfo===T.containerInfo&&y.stateNode.implementation===T.implementation){n(g,y.sibling),S=i(y,T.children||[]),S.return=g,g=S;break e}else{n(g,y);break}else t(g,y);y=y.sibling}S=_g(T,g.mode,S),S.return=g,g=S}return o(g);case ra:return T=lo(T),E(g,y,T,S)}if(mu(T))return m(g,y,T,S);if(su(T)){if(v=su(T),typeof v!="function")throw Error(G(150));return T=v.call(T),b(g,y,T,S)}if(typeof T.then=="function")return E(g,y,Gf(T),S);if(T.$$typeof===Si)return E(g,y,Vf(g,T),S);Yf(g,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,y!==null&&y.tag===6?(n(g,y.sibling),S=i(y,T),S.return=g,g=S):(n(g,y),S=Sg(T,g.mode,S),S.return=g,g=S),o(g)):n(g,y)}return function(g,y,T,S){try{Uu=0;var v=E(g,y,T,S);return Vs=null,v}catch(M){if(M===ol||M===Xd)throw M;var x=er(29,M,null,g.mode);return x.lanes=S,x.return=g,x}finally{}}}var Eo=hA(!0),pA=hA(!1),ia=!1;function ib(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function f0(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Le&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Td(e),aA(e,null,n),t}return jd(e,r,t,n),Td(e)}function xu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rx(e,n)}}function Ag(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var d0=!1;function Au(){if(d0){var e=qs;if(e!==null)throw e}}function Cu(e,t,n,r){d0=!1;var i=e.updateQueue;ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?a=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==o&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(a!==null){var f=i.baseState;o=0,c=u=l=null,s=a;do{var d=s.lane&-536870913,h=d!==s.lane;if(h?(Me&d)===d:(r&d)===d){d!==0&&d===Xs&&(d0=!0),c!==null&&(c=c.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var m=e,b=s;d=t;var E=n;switch(b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(E,f,d);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,d=typeof m=="function"?m.call(E,f,d):m,d==null)break e;f=it({},f,d);break e;case 2:ia=!0}}d=s.callback,d!==null&&(e.flags|=64,h&&(e.flags|=8192),h=i.callbacks,h===null?i.callbacks=[d]:h.push(d))}else h={lane:d,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=h,l=f):c=c.next=h,o|=d;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;h=s,s=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);c===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,a===null&&(i.shared.lanes=0),Na|=o,e.lanes=o,e.memoizedState=f}}function mA(e,t){if(typeof e!="function")throw Error(G(191,e));e.call(t)}function gA(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=ge.T,s={};ge.T=s,bb(e,!1,t,n);try{var l=i(),u=ge.S;if(u!==null&&u(s,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=Y4(l,r);Nu(e,t,c,ar(e))}else Nu(e,t,r,ar(e))}catch(f){Nu(e,t,{then:function(){},status:"rejected",reason:f},ar())}finally{Be.p=a,o!==null&&s.types!==null&&(o.types=s.types),ge.T=o}}function Q4(){}function b0(e,t,n,r){if(e.tag!==5)throw Error(G(476));var i=FA(e).queue;zA(e,i,t,co,n===null?Q4:function(){return qA(e),n(r)})}function FA(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:co,baseState:co,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:co},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function qA(e){var t=FA(e);t.next===null&&(t=e.alternate.memoizedState),Nu(e,t.next.queue,{},ar())}function gb(){return tn(Vu)}function VA(){return Ct().memoizedState}function GA(){return Ct().memoizedState}function Z4(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ar();e=ga(n);var r=ba(t,e,n);r!==null&&(In(r,t,n),xu(r,t,n)),t={cache:tb()},e.payload=t;return}t=t.return}}function J4(e,t,n){var r=ar();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Jd(e)?KA(t,n):(n=Q0(e,t,n,r),n!==null&&(In(n,e,r),$A(n,t,r)))}function YA(e,t,n){var r=ar();Nu(e,t,n,r)}function Nu(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jd(e))KA(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,or(s,o))return jd(e,t,i,0),je===null&&$d(),!1}catch{}finally{}if(n=Q0(e,t,i,r),n!==null)return In(n,e,r),$A(n,t,r),!0}return!1}function bb(e,t,n,r){if(r={lane:2,revertLane:Nb(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Jd(e)){if(t)throw Error(G(479))}else t=Q0(e,n,r,2),t!==null&&In(t,e,2)}function Jd(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function KA(e,t){Gs=Nd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $A(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rx(e,n)}}var zu={readContext:tn,use:Qd,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};zu.useEffectEvent=bt;var jA={readContext:tn,use:Qd,useCallback:function(e,t){return _n().memoizedState=[e,t===void 0?null:t],e},useContext:tn,useEffect:O_,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,od(4194308,4,LA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return od(4194308,4,e,t)},useInsertionEffect:function(e,t){od(4,2,e,t)},useMemo:function(e,t){var n=_n();t=t===void 0?null:t;var r=e();if(yo){ua(!0);try{e()}finally{ua(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=_n();if(n!==void 0){var i=n(t);if(yo){ua(!0);try{n(t)}finally{ua(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=J4.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=_n();return e={current:e},t.memoizedState=e},useState:function(e){e=m0(e);var t=e.queue,n=YA.bind(null,Ae,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:pb,useDeferredValue:function(e,t){var n=_n();return mb(n,e,t)},useTransition:function(){var e=m0(!1);return e=zA.bind(null,Ae,e.queue,!0,!1),_n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ae,i=_n();if(De){if(n===void 0)throw Error(G(407));n=n()}else{if(n=t(),je===null)throw Error(G(349));(Me&127)!==0||SA(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,O_(xA.bind(null,r,a,e),[e]),r.flags|=2048,Qs(9,{destroy:void 0},_A.bind(null,r,a,n,t),null),n},useId:function(){var e=_n(),t=je.identifierPrefix;if(De){var n=Yr,r=Gr;n=(r&~(1<<32-ir(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=vd++,0<\/script>",a=a.removeChild(a.firstChild);break;case"select":a=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}a[Jt]=t,a[Ln]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;e:switch(nn(a,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&mi(t)}}return nt(t),Rg(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&mi(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(G(166));if(e=pa.current,xs(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=en,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Jt]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||YC(e.nodeValue,n)),e||Aa(t,!0)}else e=Pd(e).createTextNode(r),e[Jt]=t,t.stateNode=e}return nt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=xs(t),n!==null){if(e===null){if(!r)throw Error(G(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(G(557));e[Jt]=t}else go(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nt(t),e=!1}else n=xg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Jn(t),t):(Jn(t),null);if((t.flags&128)!==0)throw Error(G(558))}return nt(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=xs(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(G(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(G(317));i[Jt]=t}else go(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nt(t),i=!1}else i=xg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Jn(t),t):(Jn(t),null)}return Jn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Kf(t,t.updateQueue),nt(t),null);case 4:return Ks(),e===null&&vb(t.stateNode.containerInfo),nt(t),null;case 10:return Ci(t.type),nt(t),null;case 19:if(Vt(At),r=t.memoizedState,r===null)return nt(t),null;if(i=(t.flags&128)!==0,a=r.rendering,a===null)if(i)cu(r,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=Cd(e),a!==null){for(t.flags|=128,cu(r,!1),e=a.updateQueue,t.updateQueue=e,Kf(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oA(n,e),n=n.sibling;return We(At,At.current&1|2),De&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&nr()>Od&&(t.flags|=128,i=!0,cu(r,!1),t.lanes=4194304)}else{if(!i)if(e=Cd(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Kf(t,e),cu(r,!0),r.tail===null&&r.tailMode==="hidden"&&!a.alternate&&!De)return nt(t),null}else 2*nr()-r.renderingStartTime>Od&&n!==536870912&&(t.flags|=128,i=!0,cu(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e!==null?e.sibling=a:t.child=a,r.last=a)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=nr(),e.sibling=null,n=At.current,We(At,i?n&1|2:n&1),De&&yi(t,r.treeForkCount),e):(nt(t),null);case 22:case 23:return Jn(t),ab(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),n=t.updateQueue,n!==null&&Kf(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Vt(ho),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ci(Rt),nt(t),null;case 25:return null;case 30:return null}throw Error(G(156,t.tag))}function iB(e,t){switch(eb(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ci(Rt),Ks(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gd(t),null;case 31:if(t.memoizedState!==null){if(Jn(t),t.alternate===null)throw Error(G(340));go()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(G(340));go()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vt(At),null;case 4:return Ks(),null;case 10:return Ci(t.type),null;case 22:case 23:return Jn(t),ab(),e!==null&&Vt(ho),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ci(Rt),null;case 25:return null;default:return null}}function oC(e,t){switch(eb(t),t.tag){case 3:Ci(Rt),Ks();break;case 26:case 27:case 5:gd(t);break;case 4:Ks();break;case 31:t.memoizedState!==null&&Jn(t);break;case 13:Jn(t);break;case 19:Vt(At);break;case 10:Ci(t.type);break;case 22:case 23:Jn(t),ab(),e!==null&&Vt(ho);break;case 24:Ci(Rt)}}function ec(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(s){Fe(t,t.return,s)}}function Ca(e,t,n){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var l=n,u=s;try{u()}catch(c){Fe(i,l,c)}}}r=r.next}while(r!==a)}}catch(c){Fe(t,t.return,c)}}function sC(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{gA(t,n)}catch(r){Fe(e,e.return,r)}}}function lC(e,t,n){n.props=To(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Fe(e,t,r)}}function vu(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(i){Fe(e,t,i)}}function Kr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){Fe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Fe(e,t,i)}else n.current=null}function uC(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(i){Fe(e,e.return,i)}}function Dg(e,t,n){try{var r=e.stateNode;AB(r,e.type,n,t),r[Ln]=t}catch(i){Fe(e,e.return,i)}}function cC(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ka(e.type)||e.tag===4}function Ig(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ka(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=_i));else if(r!==4&&(r===27&&ka(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(_0(e,t,n),e=e.sibling;e!==null;)_0(e,t,n),e=e.sibling}function Md(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&ka(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Md(e,t,n),e=e.sibling;e!==null;)Md(e,t,n),e=e.sibling}function fC(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);nn(t,r,n),t[Jt]=e,t[Ln]=n}catch(a){Fe(e,e.return,a)}}var Ti=!1,Ot=!1,Lg=!1,G_=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function aB(e,t){if(e=e.containerInfo,w0=Fd,e=Zx(e),X0(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,s=-1,l=-1,u=0,c=0,f=e,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(s=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===i&&(s=o),d===a&&++c===r&&(l=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(M0={focusedElem:e,selectionRange:n},Fd=!1,Ft=t;Ft!==null;)if(t=Ft,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ft=e;else for(;Ft!==null;){switch(t=Ft,a=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),nn(a,r,n),a[Jt]=e,qt(a),r=a;break e;case"link":var o=dx("link","href",i).get(r+(n.href||""));if(o){for(var s=0;sE&&(o=E,E=b,b=o);var g=m_(s,b),y=m_(s,E);if(g&&y&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==y.node||h.focusOffset!==y.offset)){var T=f.createRange();T.setStart(g.node,g.offset),h.removeAllRanges(),b>E?(h.addRange(T),h.extend(y.node,y.offset)):(T.setEnd(y.node,y.offset),h.addRange(T))}}}}for(f=[],h=s;h=h.parentNode;)h.nodeType===1&&f.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;sn?32:n,ge.T=null,n=C0,C0=null;var a=ya,o=Ni;if(Ut=0,Js=ya=null,Ni=0,(Le&6)!==0)throw Error(G(331));var s=Le;if(Le|=4,_C(a.current),yC(a,a.current,o,n),Le=s,tc(0,!1),rr&&typeof rr.onPostCommitFiberRoot=="function")try{rr.onPostCommitFiberRoot($u,a)}catch{}return!0}finally{Be.p=i,ge.T=r,PC(e,t)}}function j_(e,t,n){t=gr(n,t),t=y0(e.stateNode,t,2),e=ba(e,t,2),e!==null&&(Xu(e,2),Xr(e))}function Fe(e,t,n){if(e.tag===3)j_(e,e,n);else for(;t!==null;){if(t.tag===3){j_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ea===null||!Ea.has(r))){e=gr(n,e),n=JA(2),r=ba(t,n,2),r!==null&&(eC(n,r,t,e),Xu(r,2),Xr(r));break}}t=t.return}}function Pg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new lB;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(xb=!0,i.add(n),e=hB.bind(null,e,t,n),t.then(e,e))}function hB(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,je===e&&(Me&n)===n&&(Et===4||Et===3&&(Me&62914560)===Me&&300>nr()-eh?(Le&2)===0&&el(e,0):Ab|=n,Zs===Me&&(Zs=0)),Xr(e)}function HC(e,t){t===0&&(t=Mx()),e=Ao(e,t),e!==null&&(Xu(e,t),Xr(e))}function pB(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),HC(e,n)}function mB(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(G(314))}r!==null&&r.delete(t),HC(e,n)}function gB(e,t){return z0(e,t)}var Id=null,Ns=null,v0=!1,Ld=!1,Ug=!1,ha=0;function Xr(e){e!==Ns&&e.next===null&&(Ns===null?Id=Ns=e:Ns=Ns.next=e),Ld=!0,v0||(v0=!0,EB())}function tc(e,t){if(!Ug&&Ld){Ug=!0;do for(var n=!1,r=Id;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-ir(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,X_(r,a))}else a=Me,a=Vd(r,r===je?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(a&3)===0||ju(r,a)||(n=!0,X_(r,a));r=r.next}while(n);Ug=!1}}function bB(){zC()}function zC(){Ld=v0=!1;var e=0;ha!==0&&NB()&&(e=ha);for(var t=nr(),n=null,r=Id;r!==null;){var i=r.next,a=FC(r,t);a===0?(r.next=null,n===null?Id=i:n.next=i,i===null&&(Ns=n)):(n=r,(e!==0||(a&3)!==0)&&(Ld=!0)),r=i}Ut!==0&&Ut!==5||tc(e,!1),ha!==0&&(ha=0)}function FC(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var c=l.transferSize,f=l.initiatorType;c&&nx(f)&&(l=l.responseEnd,o+=c*(l"u"?null:document;function WC(e,t,n){var r=ll;if(r&&typeof t=="string"&&t){var i=mr(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),ux.has(i)||(ux.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),nn(t,"link",e),qt(t),r.head.appendChild(t)))}}function LB(e){Ri.D(e),WC("dns-prefetch",e,null)}function BB(e,t){Ri.C(e,t),WC("preconnect",e,t)}function PB(e,t,n){Ri.L(e,t,n);var r=ll;if(r&&e&&t){var i='link[rel="preload"][as="'+mr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+mr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+mr(n.imageSizes)+'"]')):i+='[href="'+mr(e)+'"]';var a=i;switch(t){case"style":a=tl(e);break;case"script":a=ul(e)}Tr.has(a)||(e=it({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Tr.set(a,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(nc(a))||t==="script"&&r.querySelector(rc(a))||(t=r.createElement("link"),nn(t,"link",e),qt(t),r.head.appendChild(t)))}}function UB(e,t){Ri.m(e,t);var n=ll;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+mr(r)+'"][href="'+mr(e)+'"]',a=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=ul(e)}if(!Tr.has(a)&&(e=it({rel:"modulepreload",href:e},t),Tr.set(a,e),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(rc(a)))return}r=n.createElement("link"),nn(r,"link",e),qt(r),n.head.appendChild(r)}}}function HB(e,t,n){Ri.S(e,t,n);var r=ll;if(r&&e){var i=Hs(r).hoistableStyles,a=tl(e);t=t||"default";var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(nc(a)))s.loading=5;else{e=it({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Tr.get(a))&&kb(e,n);var l=o=r.createElement("link");qt(l),nn(l,"link",e),l._p=new Promise(function(u,c){l.onload=u,l.onerror=c}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,cd(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:s},i.set(a,o)}}}function zB(e,t){Ri.X(e,t);var n=ll;if(n&&e){var r=Hs(n).hoistableScripts,i=ul(e),a=r.get(i);a||(a=n.querySelector(rc(i)),a||(e=it({src:e,async:!0},t),(t=Tr.get(i))&&wb(e,t),a=n.createElement("script"),qt(a),nn(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},r.set(i,a))}}function FB(e,t){Ri.M(e,t);var n=ll;if(n&&e){var r=Hs(n).hoistableScripts,i=ul(e),a=r.get(i);a||(a=n.querySelector(rc(i)),a||(e=it({src:e,async:!0,type:"module"},t),(t=Tr.get(i))&&wb(e,t),a=n.createElement("script"),qt(a),nn(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},r.set(i,a))}}function cx(e,t,n,r){var i=(i=pa.current)?Ud(i):null;if(!i)throw Error(G(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=tl(n.href),n=Hs(i).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=tl(n.href);var a=Hs(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(nc(e)))&&!a._p&&(o.instance=a,o.state.loading=5),Tr.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Tr.set(e,n),a||qB(i,e,n,o.state))),t&&r===null)throw Error(G(528,""));return o}if(t&&r!==null)throw Error(G(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ul(n),n=Hs(i).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(G(444,e))}}function tl(e){return'href="'+mr(e)+'"'}function nc(e){return'link[rel="stylesheet"]['+e+"]"}function QC(e){return it({},e,{"data-precedence":e.precedence,precedence:null})}function qB(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),nn(t,"link",n),qt(t),e.head.appendChild(t))}function ul(e){return'[src="'+mr(e)+'"]'}function rc(e){return"script[async]"+e}function fx(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+mr(n.href)+'"]');if(r)return t.instance=r,qt(r),r;var i=it({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),qt(r),nn(r,"style",i),cd(r,n.precedence,e),t.instance=r;case"stylesheet":i=tl(n.href);var a=e.querySelector(nc(i));if(a)return t.state.loading|=4,t.instance=a,qt(a),a;r=QC(n),(i=Tr.get(i))&&kb(r,i),a=(e.ownerDocument||e).createElement("link"),qt(a);var o=a;return o._p=new Promise(function(s,l){o.onload=s,o.onerror=l}),nn(a,"link",r),t.state.loading|=4,cd(a,n.precedence,e),t.instance=a;case"script":return a=ul(n.src),(i=e.querySelector(rc(a)))?(t.instance=i,qt(i),i):(r=n,(i=Tr.get(a))&&(r=it({},n),wb(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),qt(i),nn(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(G(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,cd(r,n.precedence,e));return t.instance}function cd(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,a=i,o=0;o title"):null)}function VB(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ZC(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function GB(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=tl(r.href),a=t.querySelector(nc(i));if(a){t=a._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Hd.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,qt(a);return}a=t.ownerDocument||t,r=QC(r),(i=Tr.get(i))&&kb(r,i),a=a.createElement("link"),qt(a);var o=a;o._p=new Promise(function(s,l){o.onload=s,o.onerror=l}),nn(a,"link",r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Hd.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var qg=0;function YB(e,t){return e.stylesheets&&e.count===0&&dd(e,e.stylesheets),0qg?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Hd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dd(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zd=null;function dd(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zd=new Map,t.forEach(KB,e),zd=null,Hd.call(e))}function KB(e,t){if(!(t.state.loading&4)){var n=zd.get(e);if(n)var r=n.get(null);else{n=new Map,zd.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a{"use strict";function sN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sN)}catch(e){console.error(e)}}sN(),lN.exports=oN()});var nv=wt((TJ,tv)=>{"use strict";var QN=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,cP=/\n/g,fP=/^\s*/,dP=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,hP=/^:\s*/,pP=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,mP=/^[;\s]*/,gP=/^\s+|\s+$/g,bP=` -`,ZN="/",JN="*",wo="",EP="comment",yP="declaration";function TP(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var b=m.match(cP);b&&(n+=b.length);var E=m.lastIndexOf(bP);r=~E?m.length-E:r+m.length}function a(){var m={line:n,column:r};return function(b){return b.position=new o(m),u(),b}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(m){var b=new Error(t.source+":"+n+":"+r+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(m){var b=m.exec(e);if(b){var E=b[0];return i(E),e=e.slice(E.length),b}}function u(){l(fP)}function c(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=a();if(!(ZN!=e.charAt(0)||JN!=e.charAt(1))){for(var b=2;wo!=e.charAt(b)&&(JN!=e.charAt(b)||ZN!=e.charAt(b+1));)++b;if(b+=2,wo===e.charAt(b-1))return s("End of comment missing");var E=e.slice(2,b-2);return r+=2,i(E),e=e.slice(b),r+=2,m({type:EP,comment:E})}}function d(){var m=a(),b=l(dP);if(b){if(f(),!l(hP))return s("property missing ':'");var E=l(pP),g=m({type:yP,property:ev(b[0].replace(QN,wo)),value:E?ev(E[0].replace(QN,wo)):wo});return l(mP),g}}function h(){var m=[];c(m);for(var b;b=d();)b!==!1&&(m.push(b),c(m));return m}return u(),h()}function ev(e){return e?e.replace(gP,wo):wo}tv.exports=TP});var rv=wt(sc=>{"use strict";var SP=sc&&sc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sc,"__esModule",{value:!0});sc.default=xP;var _P=SP(nv());function xP(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,_P.default)(e),i=typeof t=="function";return r.forEach(a=>{if(a.type!=="declaration")return;let{property:o,value:s}=a;i?t(o,s,a):s&&(n=n||{},n[o]=s)}),n}});var av=wt(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.camelCase=void 0;var AP=/^--[a-zA-Z0-9_-]+$/,CP=/-([a-z])/g,NP=/^[^-]+$/,vP=/^-(webkit|moz|ms|o|khtml)-/,kP=/^-(ms)-/,wP=function(e){return!e||NP.test(e)||AP.test(e)},MP=function(e,t){return t.toUpperCase()},iv=function(e,t){return"".concat(t,"-")},OP=function(e,t){return t===void 0&&(t={}),wP(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(kP,iv):e=e.replace(vP,iv),e.replace(CP,MP))};xh.camelCase=OP});var sv=wt((oE,ov)=>{"use strict";var RP=oE&&oE.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},DP=RP(rv()),IP=av();function aE(e,t){var n={};return!e||typeof e!="string"||(0,DP.default)(e,function(r,i){r&&i&&(n[(0,IP.camelCase)(r,t)]=i)}),n}aE.default=aE;ov.exports=aE});var Av=wt(Ch=>{"use strict";var s8=Symbol.for("react.transitional.element"),l8=Symbol.for("react.fragment");function xv(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:s8,type:e,key:r,ref:t!==void 0?t:null,props:n}}Ch.Fragment=l8;Ch.jsx=xv;Ch.jsxs=xv});var ne=wt((gee,Cv)=>{"use strict";Cv.exports=Av()});var Pk=wt((one,Bk)=>{"use strict";var jh=Object.prototype.hasOwnProperty,Lk=Object.prototype.toString,wk=Object.defineProperty,Mk=Object.getOwnPropertyDescriptor,Ok=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Lk.call(t)==="[object Array]"},Rk=function(t){if(!t||Lk.call(t)!=="[object Object]")return!1;var n=jh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&jh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||jh.call(t,i)},Dk=function(t,n){wk&&n.name==="__proto__"?wk(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Ik=function(t,n){if(n==="__proto__")if(jh.call(t,n)){if(Mk)return Mk(t,n).value}else return;return t[n]};Bk.exports=function e(){var t,n,r,i,a,o,s=arguments[0],l=1,u=arguments.length,c=!1;for(typeof s=="boolean"&&(c=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l{function cO(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&cO(n)}),e}var kp=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function fO(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Va(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var Fq="",iO=e=>!!e.scope,qq=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`},i1=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=fO(t)}openNode(t){if(!iO(t))return;let n=qq(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){iO(t)&&(this.buffer+=Fq)}value(){return this.buffer}span(t){this.buffer+=``}},aO=(e={})=>{let t={children:[]};return Object.assign(t,e),t},a1=class e{constructor(){this.rootNode=aO(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=aO({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},o1=class extends a1{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new i1(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Vc(e){return e?typeof e=="string"?e:e.source:null}function dO(e){return Vo("(?=",e,")")}function Vq(e){return Vo("(?:",e,")*")}function Gq(e){return Vo("(?:",e,")?")}function Vo(...e){return e.map(n=>Vc(n)).join("")}function Yq(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function l1(...e){return"("+(Yq(e).capture?"":"?:")+e.map(r=>Vc(r)).join("|")+")"}function hO(e){return new RegExp(e.toString()+"|").exec("").length-1}function Kq(e,t){let n=e&&e.exec(t);return n&&n.index===0}var $q=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function u1(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let i=n,a=Vc(r),o="";for(;a.length>0;){let s=$q.exec(a);if(!s){o+=a;break}o+=a.substring(0,s.index),a=a.substring(s.index+s[0].length),s[0][0]==="\\"&&s[1]?o+="\\"+String(Number(s[1])+i):(o+=s[0],s[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(t)}var jq=/\b\B/,pO="[a-zA-Z]\\w*",c1="[a-zA-Z_]\\w*",mO="\\b\\d+(\\.\\d+)?",gO="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",bO="\\b(0b[01]+)",Xq="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Wq=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=Vo(t,/.*\b/,e.binary,/\b.*/)),Va({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Gc={begin:"\\\\[\\s\\S]",relevance:0},Qq={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Gc]},Zq={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Gc]},Jq={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Mp=function(e,t,n={}){let r=Va({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=l1("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Vo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},eV=Mp("//","$"),tV=Mp("/\\*","\\*/"),nV=Mp("#","$"),rV={scope:"number",begin:mO,relevance:0},iV={scope:"number",begin:gO,relevance:0},aV={scope:"number",begin:bO,relevance:0},oV={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Gc,{begin:/\[/,end:/\]/,relevance:0,contains:[Gc]}]},sV={scope:"title",begin:pO,relevance:0},lV={scope:"title",begin:c1,relevance:0},uV={begin:"\\.\\s*"+c1,relevance:0},cV=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},vp=Object.freeze({__proto__:null,APOS_STRING_MODE:Qq,BACKSLASH_ESCAPE:Gc,BINARY_NUMBER_MODE:aV,BINARY_NUMBER_RE:bO,COMMENT:Mp,C_BLOCK_COMMENT_MODE:tV,C_LINE_COMMENT_MODE:eV,C_NUMBER_MODE:iV,C_NUMBER_RE:gO,END_SAME_AS_BEGIN:cV,HASH_COMMENT_MODE:nV,IDENT_RE:pO,MATCH_NOTHING_RE:jq,METHOD_GUARD:uV,NUMBER_MODE:rV,NUMBER_RE:mO,PHRASAL_WORDS_MODE:Jq,QUOTE_STRING_MODE:Zq,REGEXP_MODE:oV,RE_STARTERS_RE:Xq,SHEBANG:Wq,TITLE_MODE:sV,UNDERSCORE_IDENT_RE:c1,UNDERSCORE_TITLE_MODE:lV});function fV(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function dV(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function hV(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=fV,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function pV(e,t){Array.isArray(e.illegal)&&(e.illegal=l1(...e.illegal))}function mV(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function gV(e,t){e.relevance===void 0&&(e.relevance=1)}var bV=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Vo(n.beforeMatch,dO(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},EV=["of","and","for","in","not","or","if","then","parent","list","value"],yV="keyword";function EO(e,t,n=yV){let r=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(a){Object.assign(r,EO(e[a],t,a))}),r;function i(a,o){t&&(o=o.map(s=>s.toLowerCase())),o.forEach(function(s){let l=s.split("|");r[l[0]]=[a,TV(l[0],l[1])]})}}function TV(e,t){return t?Number(t):SV(e)?0:1}function SV(e){return EV.includes(e.toLowerCase())}var oO={},qo=e=>{console.error(e)},sO=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ol=(e,t)=>{oO[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),oO[`${e}/${t}`]=!0)},wp=new Error;function yO(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let s=1;s<=t.length;s++)o[s+r]=i[s],a[s+r]=!0,r+=hO(t[s-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function _V(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw qo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),wp;if(typeof e.beginScope!="object"||e.beginScope===null)throw qo("beginScope must be object"),wp;yO(e,e.begin,{key:"beginScope"}),e.begin=u1(e.begin,{joinWith:""})}}function xV(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw qo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),wp;if(typeof e.endScope!="object"||e.endScope===null)throw qo("endScope must be object"),wp;yO(e,e.end,{key:"endScope"}),e.end=u1(e.end,{joinWith:""})}}function AV(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function CV(e){AV(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),_V(e),xV(e)}function NV(e){function t(o,s){return new RegExp(Vc(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(s?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(s,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,s]),this.matchAt+=hO(s)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let s=this.regexes.map(l=>l[1]);this.matcherRe=t(u1(s,{joinWith:"|"}),!0),this.lastIndex=0}exec(s){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(s);if(!l)return null;let u=l.findIndex((f,d)=>d>0&&f!==void 0),c=this.matchIndexes[u];return l.splice(0,u),Object.assign(l,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(s){if(this.multiRegexes[s])return this.multiRegexes[s];let l=new n;return this.rules.slice(s).forEach(([u,c])=>l.addRule(u,c)),l.compile(),this.multiRegexes[s]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(s,l){this.rules.push([s,l]),l.type==="begin"&&this.count++}exec(s){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let u=l.exec(s);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){let c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(s)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(o){let s=new r;return o.contains.forEach(l=>s.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&s.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&s.addRule(o.illegal,{type:"illegal"}),s}function a(o,s){let l=o;if(o.isCompiled)return l;[dV,mV,CV,bV].forEach(c=>c(o,s)),e.compilerExtensions.forEach(c=>c(o,s)),o.__beforeBegin=null,[hV,pV,gV].forEach(c=>c(o,s)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=EO(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(u,!0),s&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Vc(l.end)||"",o.endsWithParent&&s.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+s.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(c){return vV(c==="self"?o:c)})),o.contains.forEach(function(c){a(c,l)}),o.starts&&a(o.starts,s),l.matcher=i(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Va(e.classNameAliases||{}),a(e)}function TO(e){return e?e.endsWithParent||TO(e.starts):!1}function vV(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Va(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:TO(e)?Va(e,{starts:e.starts?Va(e.starts):null}):Object.isFrozen(e)?Va(e):e}var kV="11.11.1",s1=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},r1=fO,lO=Va,uO=Symbol("nomatch"),wV=7,SO=function(e){let t=Object.create(null),n=Object.create(null),r=[],i=!0,a="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]},s={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:o1};function l(D){return s.noHighlightRe.test(D)}function u(D){let B=D.className+" ";B+=D.parentNode?D.parentNode.className:"";let K=s.languageDetectRe.exec(B);if(K){let F=R(K[1]);return F||(sO(a.replace("{}",K[1])),sO("Falling back to no-highlight mode for this block.",D)),F?K[1]:"no-highlight"}return B.split(/\s+/).find(F=>l(F)||R(F))}function c(D,B,K){let F="",N="";typeof B=="object"?(F=D,K=B.ignoreIllegals,N=B.language):(Ol("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ol("10.7.0",`Please use highlight(code, options) instead. -https://github.com/highlightjs/highlight.js/issues/2277`),N=D,F=B),K===void 0&&(K=!0);let ae={code:F,language:N};V("before:highlight",ae);let ce=ae.result?ae.result:f(ae.language,ae.code,K);return ce.code=ae.code,V("after:highlight",ce),ce}function f(D,B,K,F){let N=Object.create(null);function ae(O,P){return O.keywords[P]}function ce(){if(!ue.keywords){$e.addText(X);return}let O=0;ue.keywordPatternRe.lastIndex=0;let P=ue.keywordPatternRe.exec(X),J="";for(;P;){J+=X.substring(O,P.index);let ie=ee.case_insensitive?P[0].toLowerCase():P[0],ye=ae(ue,ie);if(ye){let[xt,fi]=ye;if($e.addText(J),J="",N[ie]=(N[ie]||0)+1,N[ie]<=wV&&(Se+=fi),xt.startsWith("_"))J+=P[0];else{let wr=ee.classNameAliases[xt]||xt;be(P[0],wr)}}else J+=P[0];O=ue.keywordPatternRe.lastIndex,P=ue.keywordPatternRe.exec(X)}J+=X.substring(O),$e.addText(J)}function k(){if(X==="")return;let O=null;if(typeof ue.subLanguage=="string"){if(!t[ue.subLanguage]){$e.addText(X);return}O=f(ue.subLanguage,X,!0,Wn[ue.subLanguage]),Wn[ue.subLanguage]=O._top}else O=h(X,ue.subLanguage.length?ue.subLanguage:null);ue.relevance>0&&(Se+=O.relevance),$e.__addSublanguage(O._emitter,O.language)}function Te(){ue.subLanguage!=null?k():ce(),X=""}function be(O,P){O!==""&&($e.startScope(P),$e.addText(O),$e.endScope())}function He(O,P){let J=1,ie=P.length-1;for(;J<=ie;){if(!O._emit[J]){J++;continue}let ye=ee.classNameAliases[O[J]]||O[J],xt=P[J];ye?be(xt,ye):(X=xt,ce(),X=""),J++}}function et(O,P){return O.scope&&typeof O.scope=="string"&&$e.openNode(ee.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(be(X,ee.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),X=""):O.beginScope._multi&&(He(O.beginScope,P),X="")),ue=Object.create(O,{parent:{value:ue}}),ue}function Ee(O,P,J){let ie=Kq(O.endRe,J);if(ie){if(O["on:end"]){let ye=new kp(O);O["on:end"](P,ye),ye.isMatchIgnored&&(ie=!1)}if(ie){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return Ee(O.parent,P,J)}function lt(O){return ue.matcher.regexIndex===0?(X+=O[0],1):(yn=!0,0)}function Ve(O){let P=O[0],J=O.rule,ie=new kp(J),ye=[J.__beforeBegin,J["on:begin"]];for(let xt of ye)if(xt&&(xt(O,ie),ie.isMatchIgnored))return lt(P);return J.skip?X+=P:(J.excludeBegin&&(X+=P),Te(),!J.returnBegin&&!J.excludeBegin&&(X=P)),et(J,O),J.returnBegin?0:P.length}function St(O){let P=O[0],J=B.substring(O.index),ie=Ee(ue,O,J);if(!ie)return uO;let ye=ue;ue.endScope&&ue.endScope._wrap?(Te(),be(P,ue.endScope._wrap)):ue.endScope&&ue.endScope._multi?(Te(),He(ue.endScope,O)):ye.skip?X+=P:(ye.returnEnd||ye.excludeEnd||(X+=P),Te(),ye.excludeEnd&&(X=P));do ue.scope&&$e.closeNode(),!ue.skip&&!ue.subLanguage&&(Se+=ue.relevance),ue=ue.parent;while(ue!==ie.parent);return ie.starts&&et(ie.starts,O),ye.returnEnd?0:P.length}function Pt(){let O=[];for(let P=ue;P!==ee;P=P.parent)P.scope&&O.unshift(P.scope);O.forEach(P=>$e.openNode(P))}let wn={};function qr(O,P){let J=P&&P[0];if(X+=O,J==null)return Te(),0;if(wn.type==="begin"&&P.type==="end"&&wn.index===P.index&&J===""){if(X+=B.slice(P.index,P.index+1),!i){let ie=new Error(`0 width match regex (${D})`);throw ie.languageName=D,ie.badRule=wn.rule,ie}return 1}if(wn=P,P.type==="begin")return Ve(P);if(P.type==="illegal"&&!K){let ie=new Error('Illegal lexeme "'+J+'" for mode "'+(ue.scope||"")+'"');throw ie.mode=ue,ie}else if(P.type==="end"){let ie=St(P);if(ie!==uO)return ie}if(P.type==="illegal"&&J==="")return X+=` -`,1;if(gt>1e5&>>P.index*3)throw new Error("potential infinite loop, way more iterations than matches");return X+=J,J.length}let ee=R(D);if(!ee)throw qo(a.replace("{}",D)),new Error('Unknown language: "'+D+'"');let se=NV(ee),_t="",ue=F||se,Wn={},$e=new s.__emitter(s);Pt();let X="",Se=0,Ne=0,gt=0,yn=!1;try{if(ee.__emitTokens)ee.__emitTokens(B,$e);else{for(ue.matcher.considerAll();;){gt++,yn?yn=!1:ue.matcher.considerAll(),ue.matcher.lastIndex=Ne;let O=ue.matcher.exec(B);if(!O)break;let P=B.substring(Ne,O.index),J=qr(P,O);Ne=O.index+J}qr(B.substring(Ne))}return $e.finalize(),_t=$e.toHTML(),{language:D,value:_t,relevance:Se,illegal:!1,_emitter:$e,_top:ue}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:D,value:r1(B),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:Ne,context:B.slice(Ne-100,Ne+100),mode:O.mode,resultSoFar:_t},_emitter:$e};if(i)return{language:D,value:r1(B),illegal:!1,relevance:0,errorRaised:O,_emitter:$e,_top:ue};throw O}}function d(D){let B={value:r1(D),illegal:!1,relevance:0,_top:o,_emitter:new s.__emitter(s)};return B._emitter.addText(D),B}function h(D,B){B=B||s.languages||Object.keys(t);let K=d(D),F=B.filter(R).filter(A).map(Te=>f(Te,D,!1));F.unshift(K);let N=F.sort((Te,be)=>{if(Te.relevance!==be.relevance)return be.relevance-Te.relevance;if(Te.language&&be.language){if(R(Te.language).supersetOf===be.language)return 1;if(R(be.language).supersetOf===Te.language)return-1}return 0}),[ae,ce]=N,k=ae;return k.secondBest=ce,k}function m(D,B,K){let F=B&&n[B]||K;D.classList.add("hljs"),D.classList.add(`language-${F}`)}function b(D){let B=null,K=u(D);if(l(K))return;if(V("before:highlightElement",{el:D,language:K}),D.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",D);return}if(D.children.length>0&&(s.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(D)),s.throwUnescapedHTML))throw new s1("One of your code blocks includes unescaped HTML.",D.innerHTML);B=D;let F=B.textContent,N=K?c(F,{language:K,ignoreIllegals:!0}):h(F);D.innerHTML=N.value,D.dataset.highlighted="yes",m(D,K,N.language),D.result={language:N.language,re:N.relevance,relevance:N.relevance},N.secondBest&&(D.secondBest={language:N.secondBest.language,relevance:N.secondBest.relevance}),V("after:highlightElement",{el:D,result:N,text:F})}function E(D){s=lO(s,D)}let g=()=>{S(),Ol("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){S(),Ol("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let T=!1;function S(){function D(){S()}if(document.readyState==="loading"){T||window.addEventListener("DOMContentLoaded",D,!1),T=!0;return}document.querySelectorAll(s.cssSelector).forEach(b)}function v(D,B){let K=null;try{K=B(e)}catch(F){if(qo("Language definition for '{}' could not be registered.".replace("{}",D)),i)qo(F);else throw F;K=o}K.name||(K.name=D),t[D]=K,K.rawDefinition=B.bind(null,e),K.aliases&&L(K.aliases,{languageName:D})}function x(D){delete t[D];for(let B of Object.keys(n))n[B]===D&&delete n[B]}function M(){return Object.keys(t)}function R(D){return D=(D||"").toLowerCase(),t[D]||t[n[D]]}function L(D,{languageName:B}){typeof D=="string"&&(D=[D]),D.forEach(K=>{n[K.toLowerCase()]=B})}function A(D){let B=R(D);return B&&!B.disableAutodetect}function H(D){D["before:highlightBlock"]&&!D["before:highlightElement"]&&(D["before:highlightElement"]=B=>{D["before:highlightBlock"](Object.assign({block:B.el},B))}),D["after:highlightBlock"]&&!D["after:highlightElement"]&&(D["after:highlightElement"]=B=>{D["after:highlightBlock"](Object.assign({block:B.el},B))})}function Y(D){H(D),r.push(D)}function z(D){let B=r.indexOf(D);B!==-1&&r.splice(B,1)}function V(D,B){let K=D;r.forEach(function(F){F[K]&&F[K](B)})}function $(D){return Ol("10.7.0","highlightBlock will be removed entirely in v12.0"),Ol("10.7.0","Please use highlightElement now."),b(D)}Object.assign(e,{highlight:c,highlightAuto:h,highlightAll:S,highlightElement:b,highlightBlock:$,configure:E,initHighlighting:g,initHighlightingOnLoad:y,registerLanguage:v,unregisterLanguage:x,listLanguages:M,getLanguage:R,registerAliases:L,autoDetection:A,inherit:lO,addPlugin:Y,removePlugin:z}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=kV,e.regex={concat:Vo,lookahead:dO,either:l1,optional:Gq,anyNumberOfTimes:Vq};for(let D in vp)typeof vp[D]=="object"&&cO(vp[D]);return Object.assign(e,vp),e},Rl=SO({});Rl.newInstance=()=>SO({});_O.exports=Rl;Rl.HighlightJS=Rl;Rl.default=Rl});var CR=wt(AR=>{"use strict";var Ll=me();function aG(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var oG=typeof Object.is=="function"?Object.is:aG,sG=Ll.useState,lG=Ll.useEffect,uG=Ll.useLayoutEffect,cG=Ll.useDebugValue;function fG(e,t){var n=t(),r=sG({inst:{value:n,getSnapshot:t}}),i=r[0].inst,a=r[1];return uG(function(){i.value=n,i.getSnapshot=t,C1(i)&&a({inst:i})},[e,n,t]),lG(function(){return C1(i)&&a({inst:i}),e(function(){C1(i)&&a({inst:i})})},[e]),cG(n),n}function C1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!oG(e,n)}catch{return!0}}function dG(e,t){return t()}var hG=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?dG:fG;AR.useSyncExternalStore=Ll.useSyncExternalStore!==void 0?Ll.useSyncExternalStore:hG});var Vp=wt((Ope,NR)=>{"use strict";NR.exports=CR()});var j3=wt($3=>{"use strict";var Dm=me(),DX=Vp();function IX(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var LX=typeof Object.is=="function"?Object.is:IX,BX=DX.useSyncExternalStore,PX=Dm.useRef,UX=Dm.useEffect,HX=Dm.useMemo,zX=Dm.useDebugValue;$3.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=PX(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=HX(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&o.hasValue){var m=o.value;if(i(m,h))return f=m}return f=h}if(m=f,LX(c,h))return m;var b=r(h);return i!==void 0&&i(m,b)?(c=h,m):(c=h,f=b)}var u=!1,c,f,d=n===void 0?null:n;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,n,r,i]);var s=BX(e,a[0],a[1]);return UX(function(){o.hasValue=!0,o.value=s},[s]),zX(s),s}});var W3=wt((Vge,X3)=>{"use strict";X3.exports=j3()});var XL=q(oh(),1),WL=q(me(),1);var mt=q(me(),1);var lr=q(me(),1);function Sr(){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return`${t[0]}${t[1]}${t[2]}${t[3]}-${t[4]}${t[5]}-${t[6]}${t[7]}-${t[8]}${t[9]}-${t[10]}${t[11]}${t[12]}${t[13]}${t[14]}${t[15]}`}var wa={messages:[],streamingMessage:null,greeting:null,inputDisabled:!1,inputPlaceholder:"Enter a message...",cancelRequested:!1,enableCancel:!1,enableCancelExplicit:!1,enableUpload:!1,enableUploadExplicit:!1,hiddenToolRequests:new Set,slashCommands:[],history:{enabled:!1,conversations:[],activeId:null}};function uN(e){let t=[];for(let i of e.segments)t.push(...mN(i.content,i.content_type));let n=e.attachments??[],r=t.filter(i=>i.type==="content").map(i=>i.content).join("");return{id:e.id??Sr(),role:e.role,content:r,streaming:!1,icon:e.icon,...n.length>0?{attachments:n}:{},blocks:t,siblings:e.siblings}}function sh(e){return e.filter(t=>!t.isPlaceholder)}function ic(e,t){return t?[...e??[],...t]:e}function lh(e){return e?.options.persistent!==!0&&e?.status==="visible"?{...e,status:"dismissing"}:e}function cN(e,t,n){return e?.status==="dismissed"||!t&&n?"dismissed":"visible"}var Bb=/\n?([\s\S]*?)\n?<\/thinking>\n*/g;function mN(e,t){if(t==="thinking")return[{type:"thinking",content:e,streaming:!1}];if(t!=="markdown")return[{type:"content",content:e,contentType:t}];let n=[],r=/^(`{3,}|~{3,}).*\n([\s\S]*?)^\1\s*$/gm;for(let u of e.matchAll(r))n.push([u.index,u.index+u[0].length]);let i=/`[^`\n]+`/g;for(let u of e.matchAll(i))n.push([u.index,u.index+u[0].length]);function a(u){return n.some(([c,f])=>u>=c&&u(t=i,` +`+r.stack}}var Wg=Object.prototype.hasOwnProperty,z0=Ht.unstable_scheduleCallback,hg=Ht.unstable_cancelCallback,B6=Ht.unstable_shouldYield,P6=Ht.unstable_requestPaint,nr=Ht.unstable_now,U6=Ht.unstable_getCurrentPriorityLevel,vx=Ht.unstable_ImmediatePriority,kx=Ht.unstable_UserBlockingPriority,bd=Ht.unstable_NormalPriority,H6=Ht.unstable_LowPriority,wx=Ht.unstable_IdlePriority,z6=Ht.log,F6=Ht.unstable_setDisableYieldValue,$u=null,rr=null;function ua(e){if(typeof z6=="function"&&F6(e),rr&&typeof rr.setStrictMode=="function")try{rr.setStrictMode($u,e)}catch{}}var ir=Math.clz32?Math.clz32:G6,q6=Math.log,V6=Math.LN2;function G6(e){return e>>>=0,e===0?32:31-(q6(e)/V6|0)|0}var Bf=256,Pf=262144,Uf=4194304;function so(e){var t=e&42;if(t!==0)return t;switch(e&-e){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 e&261888;case 262144:case 524288:case 1048576:case 2097152:return e&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return e&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return e}}function Vd(e,t,n){var r=e.pendingLanes;if(r===0)return 0;var i=0,a=e.suspendedLanes,o=e.pingedLanes;e=e.warmLanes;var s=r&134217727;return s!==0?(r=s&~a,r!==0?i=so(r):(o&=s,o!==0?i=so(o):n||(n=s&~e,n!==0&&(i=so(n))))):(s=r&~a,s!==0?i=so(s):o!==0?i=so(o):n||(n=r&~e,n!==0&&(i=so(n)))),i===0?0:t!==0&&t!==i&&(t&a)===0&&(a=i&-i,n=t&-t,a>=n||a===32&&(n&4194048)!==0)?t:i}function ju(e,t){return(e.pendingLanes&~(e.suspendedLanes&~e.pingedLanes)&t)===0}function Y6(e,t){switch(e){case 1:case 2:case 4:case 8:case 64:return t+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 t+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 Mx(){var e=Uf;return Uf<<=1,(Uf&62914560)===0&&(Uf=4194304),e}function pg(e){for(var t=[],n=0;31>n;n++)t.push(e);return t}function Xu(e,t){e.pendingLanes|=t,t!==268435456&&(e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0)}function K6(e,t,n,r,i,a){var o=e.pendingLanes;e.pendingLanes=n,e.suspendedLanes=0,e.pingedLanes=0,e.warmLanes=0,e.expiredLanes&=n,e.entangledLanes&=n,e.errorRecoveryDisabledLanes&=n,e.shellSuspendCounter=0;var s=e.entanglements,l=e.expirationTimes,u=e.hiddenUpdates;for(n=o&~n;0"u")return null;try{return e.activeElement||e.body}catch{return e.body}}var Z6=/[\n"\\]/g;function mr(e){return e.replace(Z6,function(t){return"\\"+t.charCodeAt(0).toString(16)+" "})}function Jg(e,t,n,r,i,a,o,s){e.name="",o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"?e.type=o:e.removeAttribute("type"),t!=null?o==="number"?(t===0&&e.value===""||e.value!=t)&&(e.value=""+dr(t)):e.value!==""+dr(t)&&(e.value=""+dr(t)):o!=="submit"&&o!=="reset"||e.removeAttribute("value"),t!=null?e0(e,o,dr(t)):n!=null?e0(e,o,dr(n)):r!=null&&e.removeAttribute("value"),i==null&&a!=null&&(e.defaultChecked=!!a),i!=null&&(e.checked=i&&typeof i!="function"&&typeof i!="symbol"),s!=null&&typeof s!="function"&&typeof s!="symbol"&&typeof s!="boolean"?e.name=""+dr(s):e.removeAttribute("name")}function Hx(e,t,n,r,i,a,o,s){if(a!=null&&typeof a!="function"&&typeof a!="symbol"&&typeof a!="boolean"&&(e.type=a),t!=null||n!=null){if(!(a!=="submit"&&a!=="reset"||t!=null)){Zg(e);return}n=n!=null?""+dr(n):"",t=t!=null?""+dr(t):n,s||t===e.value||(e.value=t),e.defaultValue=t}r=r??i,r=typeof r!="function"&&typeof r!="symbol"&&!!r,e.checked=s?e.checked:!!r,e.defaultChecked=!!r,o!=null&&typeof o!="function"&&typeof o!="symbol"&&typeof o!="boolean"&&(e.name=o),Zg(e)}function e0(e,t,n){t==="number"&&Ed(e.ownerDocument)===e||e.defaultValue===""+n||(e.defaultValue=""+n)}function zs(e,t,n,r){if(e=e.options,t){t={};for(var i=0;i"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),n0=!1;if(vi)try{_s={},Object.defineProperty(_s,"passive",{get:function(){n0=!0}}),window.addEventListener("test",_s,_s),window.removeEventListener("test",_s,_s)}catch{n0=!1}var _s,ca=null,K0=null,td=null;function Gx(){if(td)return td;var e,t=K0,n=t.length,r,i="value"in ca?ca.value:ca.textContent,a=i.length;for(e=0;e=yu),u_=" ",c_=!1;function Kx(e,t){switch(e){case"keyup":return N4.indexOf(t.keyCode)!==-1;case"keydown":return t.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function $x(e){return e=e.detail,typeof e=="object"&&"data"in e?e.data:null}var Os=!1;function k4(e,t){switch(e){case"compositionend":return $x(t);case"keypress":return t.which!==32?null:(c_=!0,u_);case"textInput":return e=t.data,e===u_&&c_?null:e;default:return null}}function w4(e,t){if(Os)return e==="compositionend"||!j0&&Kx(e,t)?(e=Gx(),td=K0=ca=null,Os=!1,e):null;switch(e){case"paste":return null;case"keypress":if(!(t.ctrlKey||t.altKey||t.metaKey)||t.ctrlKey&&t.altKey){if(t.char&&1=t)return{node:n,offset:t-e};e=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=p_(n)}}function Qx(e,t){return e&&t?e===t?!0:e&&e.nodeType===3?!1:t&&t.nodeType===3?Qx(e,t.parentNode):"contains"in e?e.contains(t):e.compareDocumentPosition?!!(e.compareDocumentPosition(t)&16):!1:!1}function Zx(e){e=e!=null&&e.ownerDocument!=null&&e.ownerDocument.defaultView!=null?e.ownerDocument.defaultView:window;for(var t=Ed(e.document);t instanceof e.HTMLIFrameElement;){try{var n=typeof t.contentWindow.location.href=="string"}catch{n=!1}if(n)e=t.contentWindow;else break;t=Ed(e.document)}return t}function X0(e){var t=e&&e.nodeName&&e.nodeName.toLowerCase();return t&&(t==="input"&&(e.type==="text"||e.type==="search"||e.type==="tel"||e.type==="url"||e.type==="password")||t==="textarea"||e.contentEditable==="true")}var P4=vi&&"documentMode"in document&&11>=document.documentMode,Rs=null,r0=null,Su=null,i0=!1;function g_(e,t,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;i0||Rs==null||Rs!==Ed(r)||(r=Rs,"selectionStart"in r&&X0(r)?r={start:r.selectionStart,end:r.selectionEnd}:(r=(r.ownerDocument&&r.ownerDocument.defaultView||window).getSelection(),r={anchorNode:r.anchorNode,anchorOffset:r.anchorOffset,focusNode:r.focusNode,focusOffset:r.focusOffset}),Su&&Lu(Su,r)||(Su=r,r=Bd(r0,"onSelect"),0>=o,i-=o,Gr=1<<32-ir(t)+i|n<R?(L=M,M=null):L=M.sibling;var A=d(g,M,T[R],S);if(A===null){M===null&&(M=L);break}e&&M&&A.alternate===null&&t(g,M),y=a(A,y,R),x===null?v=A:x.sibling=A,x=A,M=L}if(R===T.length)return n(g,M),De&&yi(g,R),v;if(M===null){for(;RR?(L=M,M=null):L=M.sibling;var H=d(g,M,A.value,S);if(H===null){M===null&&(M=L);break}e&&M&&H.alternate===null&&t(g,M),y=a(H,y,R),x===null?v=H:x.sibling=H,x=H,M=L}if(A.done)return n(g,M),De&&yi(g,R),v;if(M===null){for(;!A.done;R++,A=T.next())A=f(g,A.value,S),A!==null&&(y=a(A,y,R),x===null?v=A:x.sibling=A,x=A);return De&&yi(g,R),v}for(M=r(M);!A.done;R++,A=T.next())A=h(M,g,R,A.value,S),A!==null&&(e&&A.alternate!==null&&M.delete(A.key===null?R:A.key),y=a(A,y,R),x===null?v=A:x.sibling=A,x=A);return e&&M.forEach(function(Y){return t(g,Y)}),De&&yi(g,R),v}function E(g,y,T,S){if(typeof T=="object"&&T!==null&&T.type===vs&&T.key===null&&(T=T.props.children),typeof T=="object"&&T!==null){switch(T.$$typeof){case Lf:e:{for(var v=T.key;y!==null;){if(y.key===v){if(v=T.type,v===vs){if(y.tag===7){n(g,y.sibling),S=i(y,T.props.children),S.return=g,g=S;break e}}else if(y.elementType===v||typeof v=="object"&&v!==null&&v.$$typeof===ra&&lo(v)===y.type){n(g,y.sibling),S=i(y,T.props),uu(S,T),S.return=g,g=S;break e}n(g,y);break}else t(g,y);y=y.sibling}T.type===vs?(S=fo(T.props.children,g.mode,S,T.key),S.return=g,g=S):(S=rd(T.type,T.key,T.props,null,g.mode,S),uu(S,T),S.return=g,g=S)}return o(g);case pu:e:{for(v=T.key;y!==null;){if(y.key===v)if(y.tag===4&&y.stateNode.containerInfo===T.containerInfo&&y.stateNode.implementation===T.implementation){n(g,y.sibling),S=i(y,T.children||[]),S.return=g,g=S;break e}else{n(g,y);break}else t(g,y);y=y.sibling}S=_g(T,g.mode,S),S.return=g,g=S}return o(g);case ra:return T=lo(T),E(g,y,T,S)}if(mu(T))return m(g,y,T,S);if(su(T)){if(v=su(T),typeof v!="function")throw Error(G(150));return T=v.call(T),b(g,y,T,S)}if(typeof T.then=="function")return E(g,y,Gf(T),S);if(T.$$typeof===Si)return E(g,y,Vf(g,T),S);Yf(g,T)}return typeof T=="string"&&T!==""||typeof T=="number"||typeof T=="bigint"?(T=""+T,y!==null&&y.tag===6?(n(g,y.sibling),S=i(y,T),S.return=g,g=S):(n(g,y),S=Sg(T,g.mode,S),S.return=g,g=S),o(g)):n(g,y)}return function(g,y,T,S){try{Uu=0;var v=E(g,y,T,S);return Vs=null,v}catch(M){if(M===ol||M===Xd)throw M;var x=er(29,M,null,g.mode);return x.lanes=S,x.return=g,x}finally{}}}var Eo=hA(!0),pA=hA(!1),ia=!1;function ib(e){e.updateQueue={baseState:e.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function f0(e,t){e=e.updateQueue,t.updateQueue===e&&(t.updateQueue={baseState:e.baseState,firstBaseUpdate:e.firstBaseUpdate,lastBaseUpdate:e.lastBaseUpdate,shared:e.shared,callbacks:null})}function ga(e){return{lane:e,tag:0,payload:null,callback:null,next:null}}function ba(e,t,n){var r=e.updateQueue;if(r===null)return null;if(r=r.shared,(Le&2)!==0){var i=r.pending;return i===null?t.next=t:(t.next=i.next,i.next=t),r.pending=t,t=Td(e),aA(e,null,n),t}return jd(e,r,t,n),Td(e)}function xu(e,t,n){if(t=t.updateQueue,t!==null&&(t=t.shared,(n&4194048)!==0)){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rx(e,n)}}function Ag(e,t){var n=e.updateQueue,r=e.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var i=null,a=null;if(n=n.firstBaseUpdate,n!==null){do{var o={lane:n.lane,tag:n.tag,payload:n.payload,callback:null,next:null};a===null?i=a=o:a=a.next=o,n=n.next}while(n!==null);a===null?i=a=t:a=a.next=t}else i=a=t;n={baseState:r.baseState,firstBaseUpdate:i,lastBaseUpdate:a,shared:r.shared,callbacks:r.callbacks},e.updateQueue=n;return}e=n.lastBaseUpdate,e===null?n.firstBaseUpdate=t:e.next=t,n.lastBaseUpdate=t}var d0=!1;function Au(){if(d0){var e=qs;if(e!==null)throw e}}function Cu(e,t,n,r){d0=!1;var i=e.updateQueue;ia=!1;var a=i.firstBaseUpdate,o=i.lastBaseUpdate,s=i.shared.pending;if(s!==null){i.shared.pending=null;var l=s,u=l.next;l.next=null,o===null?a=u:o.next=u,o=l;var c=e.alternate;c!==null&&(c=c.updateQueue,s=c.lastBaseUpdate,s!==o&&(s===null?c.firstBaseUpdate=u:s.next=u,c.lastBaseUpdate=l))}if(a!==null){var f=i.baseState;o=0,c=u=l=null,s=a;do{var d=s.lane&-536870913,h=d!==s.lane;if(h?(Me&d)===d:(r&d)===d){d!==0&&d===Xs&&(d0=!0),c!==null&&(c=c.next={lane:0,tag:s.tag,payload:s.payload,callback:null,next:null});e:{var m=e,b=s;d=t;var E=n;switch(b.tag){case 1:if(m=b.payload,typeof m=="function"){f=m.call(E,f,d);break e}f=m;break e;case 3:m.flags=m.flags&-65537|128;case 0:if(m=b.payload,d=typeof m=="function"?m.call(E,f,d):m,d==null)break e;f=it({},f,d);break e;case 2:ia=!0}}d=s.callback,d!==null&&(e.flags|=64,h&&(e.flags|=8192),h=i.callbacks,h===null?i.callbacks=[d]:h.push(d))}else h={lane:d,tag:s.tag,payload:s.payload,callback:s.callback,next:null},c===null?(u=c=h,l=f):c=c.next=h,o|=d;if(s=s.next,s===null){if(s=i.shared.pending,s===null)break;h=s,s=h.next,h.next=null,i.lastBaseUpdate=h,i.shared.pending=null}}while(!0);c===null&&(l=f),i.baseState=l,i.firstBaseUpdate=u,i.lastBaseUpdate=c,a===null&&(i.shared.lanes=0),Na|=o,e.lanes=o,e.memoizedState=f}}function mA(e,t){if(typeof e!="function")throw Error(G(191,e));e.call(t)}function gA(e,t){var n=e.callbacks;if(n!==null)for(e.callbacks=null,e=0;ea?a:8;var o=ge.T,s={};ge.T=s,bb(e,!1,t,n);try{var l=i(),u=ge.S;if(u!==null&&u(s,l),l!==null&&typeof l=="object"&&typeof l.then=="function"){var c=K4(l,r);Nu(e,t,c,ar(e))}else Nu(e,t,r,ar(e))}catch(f){Nu(e,t,{then:function(){},status:"rejected",reason:f},ar())}finally{Be.p=a,o!==null&&s.types!==null&&(o.types=s.types),ge.T=o}}function Z4(){}function b0(e,t,n,r){if(e.tag!==5)throw Error(G(476));var i=FA(e).queue;zA(e,i,t,co,n===null?Z4:function(){return qA(e),n(r)})}function FA(e){var t=e.memoizedState;if(t!==null)return t;t={memoizedState:co,baseState:co,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:co},next:null};var n={};return t.next={memoizedState:n,baseState:n,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:wi,lastRenderedState:n},next:null},e.memoizedState=t,e=e.alternate,e!==null&&(e.memoizedState=t),t}function qA(e){var t=FA(e);t.next===null&&(t=e.alternate.memoizedState),Nu(e,t.next.queue,{},ar())}function gb(){return tn(Vu)}function VA(){return Ct().memoizedState}function GA(){return Ct().memoizedState}function J4(e){for(var t=e.return;t!==null;){switch(t.tag){case 24:case 3:var n=ar();e=ga(n);var r=ba(t,e,n);r!==null&&(In(r,t,n),xu(r,t,n)),t={cache:tb()},e.payload=t;return}t=t.return}}function eB(e,t,n){var r=ar();n={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null},Jd(e)?KA(t,n):(n=Q0(e,t,n,r),n!==null&&(In(n,e,r),$A(n,t,r)))}function YA(e,t,n){var r=ar();Nu(e,t,n,r)}function Nu(e,t,n,r){var i={lane:r,revertLane:0,gesture:null,action:n,hasEagerState:!1,eagerState:null,next:null};if(Jd(e))KA(t,i);else{var a=e.alternate;if(e.lanes===0&&(a===null||a.lanes===0)&&(a=t.lastRenderedReducer,a!==null))try{var o=t.lastRenderedState,s=a(o,n);if(i.hasEagerState=!0,i.eagerState=s,or(s,o))return jd(e,t,i,0),je===null&&$d(),!1}catch{}finally{}if(n=Q0(e,t,i,r),n!==null)return In(n,e,r),$A(n,t,r),!0}return!1}function bb(e,t,n,r){if(r={lane:2,revertLane:Nb(),gesture:null,action:r,hasEagerState:!1,eagerState:null,next:null},Jd(e)){if(t)throw Error(G(479))}else t=Q0(e,n,r,2),t!==null&&In(t,e,2)}function Jd(e){var t=e.alternate;return e===Ae||t!==null&&t===Ae}function KA(e,t){Gs=Nd=!0;var n=e.pending;n===null?t.next=t:(t.next=n.next,n.next=t),e.pending=t}function $A(e,t,n){if((n&4194048)!==0){var r=t.lanes;r&=e.pendingLanes,n|=r,t.lanes=n,Rx(e,n)}}var zu={readContext:tn,use:Qd,useCallback:bt,useContext:bt,useEffect:bt,useImperativeHandle:bt,useLayoutEffect:bt,useInsertionEffect:bt,useMemo:bt,useReducer:bt,useRef:bt,useState:bt,useDebugValue:bt,useDeferredValue:bt,useTransition:bt,useSyncExternalStore:bt,useId:bt,useHostTransitionStatus:bt,useFormState:bt,useActionState:bt,useOptimistic:bt,useMemoCache:bt,useCacheRefresh:bt};zu.useEffectEvent=bt;var jA={readContext:tn,use:Qd,useCallback:function(e,t){return _n().memoizedState=[e,t===void 0?null:t],e},useContext:tn,useEffect:O_,useImperativeHandle:function(e,t,n){n=n!=null?n.concat([e]):null,od(4194308,4,LA.bind(null,t,e),n)},useLayoutEffect:function(e,t){return od(4194308,4,e,t)},useInsertionEffect:function(e,t){od(4,2,e,t)},useMemo:function(e,t){var n=_n();t=t===void 0?null:t;var r=e();if(yo){ua(!0);try{e()}finally{ua(!1)}}return n.memoizedState=[r,t],r},useReducer:function(e,t,n){var r=_n();if(n!==void 0){var i=n(t);if(yo){ua(!0);try{n(t)}finally{ua(!1)}}}else i=t;return r.memoizedState=r.baseState=i,e={pending:null,lanes:0,dispatch:null,lastRenderedReducer:e,lastRenderedState:i},r.queue=e,e=e.dispatch=eB.bind(null,Ae,e),[r.memoizedState,e]},useRef:function(e){var t=_n();return e={current:e},t.memoizedState=e},useState:function(e){e=m0(e);var t=e.queue,n=YA.bind(null,Ae,t);return t.dispatch=n,[e.memoizedState,n]},useDebugValue:pb,useDeferredValue:function(e,t){var n=_n();return mb(n,e,t)},useTransition:function(){var e=m0(!1);return e=zA.bind(null,Ae,e.queue,!0,!1),_n().memoizedState=e,[!1,e]},useSyncExternalStore:function(e,t,n){var r=Ae,i=_n();if(De){if(n===void 0)throw Error(G(407));n=n()}else{if(n=t(),je===null)throw Error(G(349));(Me&127)!==0||SA(r,t,n)}i.memoizedState=n;var a={value:n,getSnapshot:t};return i.queue=a,O_(xA.bind(null,r,a,e),[e]),r.flags|=2048,Qs(9,{destroy:void 0},_A.bind(null,r,a,n,t),null),n},useId:function(){var e=_n(),t=je.identifierPrefix;if(De){var n=Yr,r=Gr;n=(r&~(1<<32-ir(r)-1)).toString(32)+n,t="_"+t+"R_"+n,n=vd++,0<\/script>",a=a.removeChild(a.firstChild);break;case"select":a=typeof r.is=="string"?o.createElement("select",{is:r.is}):o.createElement("select"),r.multiple?a.multiple=!0:r.size&&(a.size=r.size);break;default:a=typeof r.is=="string"?o.createElement(i,{is:r.is}):o.createElement(i)}}a[Jt]=t,a[Ln]=r;e:for(o=t.child;o!==null;){if(o.tag===5||o.tag===6)a.appendChild(o.stateNode);else if(o.tag!==4&&o.tag!==27&&o.child!==null){o.child.return=o,o=o.child;continue}if(o===t)break e;for(;o.sibling===null;){if(o.return===null||o.return===t)break e;o=o.return}o.sibling.return=o.return,o=o.sibling}t.stateNode=a;e:switch(nn(a,i,r),i){case"button":case"input":case"select":case"textarea":r=!!r.autoFocus;break e;case"img":r=!0;break e;default:r=!1}r&&mi(t)}}return nt(t),Rg(t,t.type,e===null?null:e.memoizedProps,t.pendingProps,n),null;case 6:if(e&&t.stateNode!=null)e.memoizedProps!==r&&mi(t);else{if(typeof r!="string"&&t.stateNode===null)throw Error(G(166));if(e=pa.current,xs(t)){if(e=t.stateNode,n=t.memoizedProps,r=null,i=en,i!==null)switch(i.tag){case 27:case 5:r=i.memoizedProps}e[Jt]=t,e=!!(e.nodeValue===n||r!==null&&r.suppressHydrationWarning===!0||YC(e.nodeValue,n)),e||Aa(t,!0)}else e=Pd(e).createTextNode(r),e[Jt]=t,t.stateNode=e}return nt(t),null;case 31:if(n=t.memoizedState,e===null||e.memoizedState!==null){if(r=xs(t),n!==null){if(e===null){if(!r)throw Error(G(318));if(e=t.memoizedState,e=e!==null?e.dehydrated:null,!e)throw Error(G(557));e[Jt]=t}else go(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nt(t),e=!1}else n=xg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=n),e=!0;if(!e)return t.flags&256?(Jn(t),t):(Jn(t),null);if((t.flags&128)!==0)throw Error(G(558))}return nt(t),null;case 13:if(r=t.memoizedState,e===null||e.memoizedState!==null&&e.memoizedState.dehydrated!==null){if(i=xs(t),r!==null&&r.dehydrated!==null){if(e===null){if(!i)throw Error(G(318));if(i=t.memoizedState,i=i!==null?i.dehydrated:null,!i)throw Error(G(317));i[Jt]=t}else go(),(t.flags&128)===0&&(t.memoizedState=null),t.flags|=4;nt(t),i=!1}else i=xg(),e!==null&&e.memoizedState!==null&&(e.memoizedState.hydrationErrors=i),i=!0;if(!i)return t.flags&256?(Jn(t),t):(Jn(t),null)}return Jn(t),(t.flags&128)!==0?(t.lanes=n,t):(n=r!==null,e=e!==null&&e.memoizedState!==null,n&&(r=t.child,i=null,r.alternate!==null&&r.alternate.memoizedState!==null&&r.alternate.memoizedState.cachePool!==null&&(i=r.alternate.memoizedState.cachePool.pool),a=null,r.memoizedState!==null&&r.memoizedState.cachePool!==null&&(a=r.memoizedState.cachePool.pool),a!==i&&(r.flags|=2048)),n!==e&&n&&(t.child.flags|=8192),Kf(t,t.updateQueue),nt(t),null);case 4:return Ks(),e===null&&vb(t.stateNode.containerInfo),nt(t),null;case 10:return Ci(t.type),nt(t),null;case 19:if(Vt(At),r=t.memoizedState,r===null)return nt(t),null;if(i=(t.flags&128)!==0,a=r.rendering,a===null)if(i)cu(r,!1);else{if(Et!==0||e!==null&&(e.flags&128)!==0)for(e=t.child;e!==null;){if(a=Cd(e),a!==null){for(t.flags|=128,cu(r,!1),e=a.updateQueue,t.updateQueue=e,Kf(t,e),t.subtreeFlags=0,e=n,n=t.child;n!==null;)oA(n,e),n=n.sibling;return We(At,At.current&1|2),De&&yi(t,r.treeForkCount),t.child}e=e.sibling}r.tail!==null&&nr()>Od&&(t.flags|=128,i=!0,cu(r,!1),t.lanes=4194304)}else{if(!i)if(e=Cd(a),e!==null){if(t.flags|=128,i=!0,e=e.updateQueue,t.updateQueue=e,Kf(t,e),cu(r,!0),r.tail===null&&r.tailMode==="hidden"&&!a.alternate&&!De)return nt(t),null}else 2*nr()-r.renderingStartTime>Od&&n!==536870912&&(t.flags|=128,i=!0,cu(r,!1),t.lanes=4194304);r.isBackwards?(a.sibling=t.child,t.child=a):(e=r.last,e!==null?e.sibling=a:t.child=a,r.last=a)}return r.tail!==null?(e=r.tail,r.rendering=e,r.tail=e.sibling,r.renderingStartTime=nr(),e.sibling=null,n=At.current,We(At,i?n&1|2:n&1),De&&yi(t,r.treeForkCount),e):(nt(t),null);case 22:case 23:return Jn(t),ab(),r=t.memoizedState!==null,e!==null?e.memoizedState!==null!==r&&(t.flags|=8192):r&&(t.flags|=8192),r?(n&536870912)!==0&&(t.flags&128)===0&&(nt(t),t.subtreeFlags&6&&(t.flags|=8192)):nt(t),n=t.updateQueue,n!==null&&Kf(t,n.retryQueue),n=null,e!==null&&e.memoizedState!==null&&e.memoizedState.cachePool!==null&&(n=e.memoizedState.cachePool.pool),r=null,t.memoizedState!==null&&t.memoizedState.cachePool!==null&&(r=t.memoizedState.cachePool.pool),r!==n&&(t.flags|=2048),e!==null&&Vt(ho),null;case 24:return n=null,e!==null&&(n=e.memoizedState.cache),t.memoizedState.cache!==n&&(t.flags|=2048),Ci(Rt),nt(t),null;case 25:return null;case 30:return null}throw Error(G(156,t.tag))}function aB(e,t){switch(eb(t),t.tag){case 1:return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 3:return Ci(Rt),Ks(),e=t.flags,(e&65536)!==0&&(e&128)===0?(t.flags=e&-65537|128,t):null;case 26:case 27:case 5:return gd(t),null;case 31:if(t.memoizedState!==null){if(Jn(t),t.alternate===null)throw Error(G(340));go()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 13:if(Jn(t),e=t.memoizedState,e!==null&&e.dehydrated!==null){if(t.alternate===null)throw Error(G(340));go()}return e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 19:return Vt(At),null;case 4:return Ks(),null;case 10:return Ci(t.type),null;case 22:case 23:return Jn(t),ab(),e!==null&&Vt(ho),e=t.flags,e&65536?(t.flags=e&-65537|128,t):null;case 24:return Ci(Rt),null;case 25:return null;default:return null}}function oC(e,t){switch(eb(t),t.tag){case 3:Ci(Rt),Ks();break;case 26:case 27:case 5:gd(t);break;case 4:Ks();break;case 31:t.memoizedState!==null&&Jn(t);break;case 13:Jn(t);break;case 19:Vt(At);break;case 10:Ci(t.type);break;case 22:case 23:Jn(t),ab(),e!==null&&Vt(ho);break;case 24:Ci(Rt)}}function ec(e,t){try{var n=t.updateQueue,r=n!==null?n.lastEffect:null;if(r!==null){var i=r.next;n=i;do{if((n.tag&e)===e){r=void 0;var a=n.create,o=n.inst;r=a(),o.destroy=r}n=n.next}while(n!==i)}}catch(s){Fe(t,t.return,s)}}function Ca(e,t,n){try{var r=t.updateQueue,i=r!==null?r.lastEffect:null;if(i!==null){var a=i.next;r=a;do{if((r.tag&e)===e){var o=r.inst,s=o.destroy;if(s!==void 0){o.destroy=void 0,i=t;var l=n,u=s;try{u()}catch(c){Fe(i,l,c)}}}r=r.next}while(r!==a)}}catch(c){Fe(t,t.return,c)}}function sC(e){var t=e.updateQueue;if(t!==null){var n=e.stateNode;try{gA(t,n)}catch(r){Fe(e,e.return,r)}}}function lC(e,t,n){n.props=To(e.type,e.memoizedProps),n.state=e.memoizedState;try{n.componentWillUnmount()}catch(r){Fe(e,t,r)}}function vu(e,t){try{var n=e.ref;if(n!==null){switch(e.tag){case 26:case 27:case 5:var r=e.stateNode;break;case 30:r=e.stateNode;break;default:r=e.stateNode}typeof n=="function"?e.refCleanup=n(r):n.current=r}}catch(i){Fe(e,t,i)}}function Kr(e,t){var n=e.ref,r=e.refCleanup;if(n!==null)if(typeof r=="function")try{r()}catch(i){Fe(e,t,i)}finally{e.refCleanup=null,e=e.alternate,e!=null&&(e.refCleanup=null)}else if(typeof n=="function")try{n(null)}catch(i){Fe(e,t,i)}else n.current=null}function uC(e){var t=e.type,n=e.memoizedProps,r=e.stateNode;try{e:switch(t){case"button":case"input":case"select":case"textarea":n.autoFocus&&r.focus();break e;case"img":n.src?r.src=n.src:n.srcSet&&(r.srcset=n.srcSet)}}catch(i){Fe(e,e.return,i)}}function Dg(e,t,n){try{var r=e.stateNode;CB(r,e.type,n,t),r[Ln]=t}catch(i){Fe(e,e.return,i)}}function cC(e){return e.tag===5||e.tag===3||e.tag===26||e.tag===27&&ka(e.type)||e.tag===4}function Ig(e){e:for(;;){for(;e.sibling===null;){if(e.return===null||cC(e.return))return null;e=e.return}for(e.sibling.return=e.return,e=e.sibling;e.tag!==5&&e.tag!==6&&e.tag!==18;){if(e.tag===27&&ka(e.type)||e.flags&2||e.child===null||e.tag===4)continue e;e.child.return=e,e=e.child}if(!(e.flags&2))return e.stateNode}}function _0(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?(n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n).insertBefore(e,t):(t=n.nodeType===9?n.body:n.nodeName==="HTML"?n.ownerDocument.body:n,t.appendChild(e),n=n._reactRootContainer,n!=null||t.onclick!==null||(t.onclick=_i));else if(r!==4&&(r===27&&ka(e.type)&&(n=e.stateNode,t=null),e=e.child,e!==null))for(_0(e,t,n),e=e.sibling;e!==null;)_0(e,t,n),e=e.sibling}function Md(e,t,n){var r=e.tag;if(r===5||r===6)e=e.stateNode,t?n.insertBefore(e,t):n.appendChild(e);else if(r!==4&&(r===27&&ka(e.type)&&(n=e.stateNode),e=e.child,e!==null))for(Md(e,t,n),e=e.sibling;e!==null;)Md(e,t,n),e=e.sibling}function fC(e){var t=e.stateNode,n=e.memoizedProps;try{for(var r=e.type,i=t.attributes;i.length;)t.removeAttributeNode(i[0]);nn(t,r,n),t[Jt]=e,t[Ln]=n}catch(a){Fe(e,e.return,a)}}var Ti=!1,Ot=!1,Lg=!1,G_=typeof WeakSet=="function"?WeakSet:Set,Ft=null;function oB(e,t){if(e=e.containerInfo,w0=Fd,e=Zx(e),X0(e)){if("selectionStart"in e)var n={start:e.selectionStart,end:e.selectionEnd};else e:{n=(n=e.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var i=r.anchorOffset,a=r.focusNode;r=r.focusOffset;try{n.nodeType,a.nodeType}catch{n=null;break e}var o=0,s=-1,l=-1,u=0,c=0,f=e,d=null;t:for(;;){for(var h;f!==n||i!==0&&f.nodeType!==3||(s=o+i),f!==a||r!==0&&f.nodeType!==3||(l=o+r),f.nodeType===3&&(o+=f.nodeValue.length),(h=f.firstChild)!==null;)d=f,f=h;for(;;){if(f===e)break t;if(d===n&&++u===i&&(s=o),d===a&&++c===r&&(l=o),(h=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=h}n=s===-1||l===-1?null:{start:s,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(M0={focusedElem:e,selectionRange:n},Fd=!1,Ft=t;Ft!==null;)if(t=Ft,e=t.child,(t.subtreeFlags&1028)!==0&&e!==null)e.return=t,Ft=e;else for(;Ft!==null;){switch(t=Ft,a=t.alternate,e=t.flags,t.tag){case 0:if((e&4)!==0&&(e=t.updateQueue,e=e!==null?e.events:null,e!==null))for(n=0;n title"))),nn(a,r,n),a[Jt]=e,qt(a),r=a;break e;case"link":var o=dx("link","href",i).get(r+(n.href||""));if(o){for(var s=0;sE&&(o=E,E=b,b=o);var g=m_(s,b),y=m_(s,E);if(g&&y&&(h.rangeCount!==1||h.anchorNode!==g.node||h.anchorOffset!==g.offset||h.focusNode!==y.node||h.focusOffset!==y.offset)){var T=f.createRange();T.setStart(g.node,g.offset),h.removeAllRanges(),b>E?(h.addRange(T),h.extend(y.node,y.offset)):(T.setEnd(y.node,y.offset),h.addRange(T))}}}}for(f=[],h=s;h=h.parentNode;)h.nodeType===1&&f.push({element:h,left:h.scrollLeft,top:h.scrollTop});for(typeof s.focus=="function"&&s.focus(),s=0;sn?32:n,ge.T=null,n=C0,C0=null;var a=ya,o=Ni;if(Ut=0,Js=ya=null,Ni=0,(Le&6)!==0)throw Error(G(331));var s=Le;if(Le|=4,_C(a.current),yC(a,a.current,o,n),Le=s,tc(0,!1),rr&&typeof rr.onPostCommitFiberRoot=="function")try{rr.onPostCommitFiberRoot($u,a)}catch{}return!0}finally{Be.p=i,ge.T=r,PC(e,t)}}function j_(e,t,n){t=gr(n,t),t=y0(e.stateNode,t,2),e=ba(e,t,2),e!==null&&(Xu(e,2),Xr(e))}function Fe(e,t,n){if(e.tag===3)j_(e,e,n);else for(;t!==null;){if(t.tag===3){j_(t,e,n);break}else if(t.tag===1){var r=t.stateNode;if(typeof t.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(Ea===null||!Ea.has(r))){e=gr(n,e),n=JA(2),r=ba(t,n,2),r!==null&&(eC(n,r,t,e),Xu(r,2),Xr(r));break}}t=t.return}}function Pg(e,t,n){var r=e.pingCache;if(r===null){r=e.pingCache=new uB;var i=new Set;r.set(t,i)}else i=r.get(t),i===void 0&&(i=new Set,r.set(t,i));i.has(n)||(xb=!0,i.add(n),e=pB.bind(null,e,t,n),t.then(e,e))}function pB(e,t,n){var r=e.pingCache;r!==null&&r.delete(t),e.pingedLanes|=e.suspendedLanes&n,e.warmLanes&=~n,je===e&&(Me&n)===n&&(Et===4||Et===3&&(Me&62914560)===Me&&300>nr()-eh?(Le&2)===0&&el(e,0):Ab|=n,Zs===Me&&(Zs=0)),Xr(e)}function HC(e,t){t===0&&(t=Mx()),e=Ao(e,t),e!==null&&(Xu(e,t),Xr(e))}function mB(e){var t=e.memoizedState,n=0;t!==null&&(n=t.retryLane),HC(e,n)}function gB(e,t){var n=0;switch(e.tag){case 31:case 13:var r=e.stateNode,i=e.memoizedState;i!==null&&(n=i.retryLane);break;case 19:r=e.stateNode;break;case 22:r=e.stateNode._retryCache;break;default:throw Error(G(314))}r!==null&&r.delete(t),HC(e,n)}function bB(e,t){return z0(e,t)}var Id=null,Ns=null,v0=!1,Ld=!1,Ug=!1,ha=0;function Xr(e){e!==Ns&&e.next===null&&(Ns===null?Id=Ns=e:Ns=Ns.next=e),Ld=!0,v0||(v0=!0,yB())}function tc(e,t){if(!Ug&&Ld){Ug=!0;do for(var n=!1,r=Id;r!==null;){if(!t)if(e!==0){var i=r.pendingLanes;if(i===0)var a=0;else{var o=r.suspendedLanes,s=r.pingedLanes;a=(1<<31-ir(42|e)+1)-1,a&=i&~(o&~s),a=a&201326741?a&201326741|1:a?a|2:0}a!==0&&(n=!0,X_(r,a))}else a=Me,a=Vd(r,r===je?a:0,r.cancelPendingCommit!==null||r.timeoutHandle!==-1),(a&3)===0||ju(r,a)||(n=!0,X_(r,a));r=r.next}while(n);Ug=!1}}function EB(){zC()}function zC(){Ld=v0=!1;var e=0;ha!==0&&vB()&&(e=ha);for(var t=nr(),n=null,r=Id;r!==null;){var i=r.next,a=FC(r,t);a===0?(r.next=null,n===null?Id=i:n.next=i,i===null&&(Ns=n)):(n=r,(e!==0||(a&3)!==0)&&(Ld=!0)),r=i}Ut!==0&&Ut!==5||tc(e,!1),ha!==0&&(ha=0)}function FC(e,t){for(var n=e.suspendedLanes,r=e.pingedLanes,i=e.expirationTimes,a=e.pendingLanes&-62914561;0s)break;var c=l.transferSize,f=l.initiatorType;c&&nx(f)&&(l=l.responseEnd,o+=c*(l"u"?null:document;function WC(e,t,n){var r=ll;if(r&&typeof t=="string"&&t){var i=mr(t);i='link[rel="'+e+'"][href="'+i+'"]',typeof n=="string"&&(i+='[crossorigin="'+n+'"]'),ux.has(i)||(ux.add(i),e={rel:e,crossOrigin:n,href:t},r.querySelector(i)===null&&(t=r.createElement("link"),nn(t,"link",e),qt(t),r.head.appendChild(t)))}}function BB(e){Ri.D(e),WC("dns-prefetch",e,null)}function PB(e,t){Ri.C(e,t),WC("preconnect",e,t)}function UB(e,t,n){Ri.L(e,t,n);var r=ll;if(r&&e&&t){var i='link[rel="preload"][as="'+mr(t)+'"]';t==="image"&&n&&n.imageSrcSet?(i+='[imagesrcset="'+mr(n.imageSrcSet)+'"]',typeof n.imageSizes=="string"&&(i+='[imagesizes="'+mr(n.imageSizes)+'"]')):i+='[href="'+mr(e)+'"]';var a=i;switch(t){case"style":a=tl(e);break;case"script":a=ul(e)}Tr.has(a)||(e=it({rel:"preload",href:t==="image"&&n&&n.imageSrcSet?void 0:e,as:t},n),Tr.set(a,e),r.querySelector(i)!==null||t==="style"&&r.querySelector(nc(a))||t==="script"&&r.querySelector(rc(a))||(t=r.createElement("link"),nn(t,"link",e),qt(t),r.head.appendChild(t)))}}function HB(e,t){Ri.m(e,t);var n=ll;if(n&&e){var r=t&&typeof t.as=="string"?t.as:"script",i='link[rel="modulepreload"][as="'+mr(r)+'"][href="'+mr(e)+'"]',a=i;switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":a=ul(e)}if(!Tr.has(a)&&(e=it({rel:"modulepreload",href:e},t),Tr.set(a,e),n.querySelector(i)===null)){switch(r){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(n.querySelector(rc(a)))return}r=n.createElement("link"),nn(r,"link",e),qt(r),n.head.appendChild(r)}}}function zB(e,t,n){Ri.S(e,t,n);var r=ll;if(r&&e){var i=Hs(r).hoistableStyles,a=tl(e);t=t||"default";var o=i.get(a);if(!o){var s={loading:0,preload:null};if(o=r.querySelector(nc(a)))s.loading=5;else{e=it({rel:"stylesheet",href:e,"data-precedence":t},n),(n=Tr.get(a))&&kb(e,n);var l=o=r.createElement("link");qt(l),nn(l,"link",e),l._p=new Promise(function(u,c){l.onload=u,l.onerror=c}),l.addEventListener("load",function(){s.loading|=1}),l.addEventListener("error",function(){s.loading|=2}),s.loading|=4,cd(o,t,r)}o={type:"stylesheet",instance:o,count:1,state:s},i.set(a,o)}}}function FB(e,t){Ri.X(e,t);var n=ll;if(n&&e){var r=Hs(n).hoistableScripts,i=ul(e),a=r.get(i);a||(a=n.querySelector(rc(i)),a||(e=it({src:e,async:!0},t),(t=Tr.get(i))&&wb(e,t),a=n.createElement("script"),qt(a),nn(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},r.set(i,a))}}function qB(e,t){Ri.M(e,t);var n=ll;if(n&&e){var r=Hs(n).hoistableScripts,i=ul(e),a=r.get(i);a||(a=n.querySelector(rc(i)),a||(e=it({src:e,async:!0,type:"module"},t),(t=Tr.get(i))&&wb(e,t),a=n.createElement("script"),qt(a),nn(a,"link",e),n.head.appendChild(a)),a={type:"script",instance:a,count:1,state:null},r.set(i,a))}}function cx(e,t,n,r){var i=(i=pa.current)?Ud(i):null;if(!i)throw Error(G(446));switch(e){case"meta":case"title":return null;case"style":return typeof n.precedence=="string"&&typeof n.href=="string"?(t=tl(n.href),n=Hs(i).hoistableStyles,r=n.get(t),r||(r={type:"style",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};case"link":if(n.rel==="stylesheet"&&typeof n.href=="string"&&typeof n.precedence=="string"){e=tl(n.href);var a=Hs(i).hoistableStyles,o=a.get(e);if(o||(i=i.ownerDocument||i,o={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},a.set(e,o),(a=i.querySelector(nc(e)))&&!a._p&&(o.instance=a,o.state.loading=5),Tr.has(e)||(n={rel:"preload",as:"style",href:n.href,crossOrigin:n.crossOrigin,integrity:n.integrity,media:n.media,hrefLang:n.hrefLang,referrerPolicy:n.referrerPolicy},Tr.set(e,n),a||VB(i,e,n,o.state))),t&&r===null)throw Error(G(528,""));return o}if(t&&r!==null)throw Error(G(529,""));return null;case"script":return t=n.async,n=n.src,typeof n=="string"&&t&&typeof t!="function"&&typeof t!="symbol"?(t=ul(n),n=Hs(i).hoistableScripts,r=n.get(t),r||(r={type:"script",instance:null,count:0,state:null},n.set(t,r)),r):{type:"void",instance:null,count:0,state:null};default:throw Error(G(444,e))}}function tl(e){return'href="'+mr(e)+'"'}function nc(e){return'link[rel="stylesheet"]['+e+"]"}function QC(e){return it({},e,{"data-precedence":e.precedence,precedence:null})}function VB(e,t,n,r){e.querySelector('link[rel="preload"][as="style"]['+t+"]")?r.loading=1:(t=e.createElement("link"),r.preload=t,t.addEventListener("load",function(){return r.loading|=1}),t.addEventListener("error",function(){return r.loading|=2}),nn(t,"link",n),qt(t),e.head.appendChild(t))}function ul(e){return'[src="'+mr(e)+'"]'}function rc(e){return"script[async]"+e}function fx(e,t,n){if(t.count++,t.instance===null)switch(t.type){case"style":var r=e.querySelector('style[data-href~="'+mr(n.href)+'"]');if(r)return t.instance=r,qt(r),r;var i=it({},n,{"data-href":n.href,"data-precedence":n.precedence,href:null,precedence:null});return r=(e.ownerDocument||e).createElement("style"),qt(r),nn(r,"style",i),cd(r,n.precedence,e),t.instance=r;case"stylesheet":i=tl(n.href);var a=e.querySelector(nc(i));if(a)return t.state.loading|=4,t.instance=a,qt(a),a;r=QC(n),(i=Tr.get(i))&&kb(r,i),a=(e.ownerDocument||e).createElement("link"),qt(a);var o=a;return o._p=new Promise(function(s,l){o.onload=s,o.onerror=l}),nn(a,"link",r),t.state.loading|=4,cd(a,n.precedence,e),t.instance=a;case"script":return a=ul(n.src),(i=e.querySelector(rc(a)))?(t.instance=i,qt(i),i):(r=n,(i=Tr.get(a))&&(r=it({},n),wb(r,i)),e=e.ownerDocument||e,i=e.createElement("script"),qt(i),nn(i,"link",r),e.head.appendChild(i),t.instance=i);case"void":return null;default:throw Error(G(443,t.type))}else t.type==="stylesheet"&&(t.state.loading&4)===0&&(r=t.instance,t.state.loading|=4,cd(r,n.precedence,e));return t.instance}function cd(e,t,n){for(var r=n.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),i=r.length?r[r.length-1]:null,a=i,o=0;o title"):null)}function GB(e,t,n){if(n===1||t.itemProp!=null)return!1;switch(e){case"meta":case"title":return!0;case"style":if(typeof t.precedence!="string"||typeof t.href!="string"||t.href==="")break;return!0;case"link":if(typeof t.rel!="string"||typeof t.href!="string"||t.href===""||t.onLoad||t.onError)break;switch(t.rel){case"stylesheet":return e=t.disabled,typeof t.precedence=="string"&&e==null;default:return!0}case"script":if(t.async&&typeof t.async!="function"&&typeof t.async!="symbol"&&!t.onLoad&&!t.onError&&t.src&&typeof t.src=="string")return!0}return!1}function ZC(e){return!(e.type==="stylesheet"&&(e.state.loading&3)===0)}function YB(e,t,n,r){if(n.type==="stylesheet"&&(typeof r.media!="string"||matchMedia(r.media).matches!==!1)&&(n.state.loading&4)===0){if(n.instance===null){var i=tl(r.href),a=t.querySelector(nc(i));if(a){t=a._p,t!==null&&typeof t=="object"&&typeof t.then=="function"&&(e.count++,e=Hd.bind(e),t.then(e,e)),n.state.loading|=4,n.instance=a,qt(a);return}a=t.ownerDocument||t,r=QC(r),(i=Tr.get(i))&&kb(r,i),a=a.createElement("link"),qt(a);var o=a;o._p=new Promise(function(s,l){o.onload=s,o.onerror=l}),nn(a,"link",r),n.instance=a}e.stylesheets===null&&(e.stylesheets=new Map),e.stylesheets.set(n,t),(t=n.state.preload)&&(n.state.loading&3)===0&&(e.count++,n=Hd.bind(e),t.addEventListener("load",n),t.addEventListener("error",n))}}var qg=0;function KB(e,t){return e.stylesheets&&e.count===0&&dd(e,e.stylesheets),0qg?50:800)+t);return e.unsuspend=n,function(){e.unsuspend=null,clearTimeout(r),clearTimeout(i)}}:null}function Hd(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)dd(this,this.stylesheets);else if(this.unsuspend){var e=this.unsuspend;this.unsuspend=null,e()}}}var zd=null;function dd(e,t){e.stylesheets=null,e.unsuspend!==null&&(e.count++,zd=new Map,t.forEach($B,e),zd=null,Hd.call(e))}function $B(e,t){if(!(t.state.loading&4)){var n=zd.get(e);if(n)var r=n.get(null);else{n=new Map,zd.set(e,n);for(var i=e.querySelectorAll("link[data-precedence],style[data-precedence]"),a=0;a{"use strict";function sN(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(sN)}catch(e){console.error(e)}}sN(),lN.exports=oN()});var nv=wt((xJ,tv)=>{"use strict";var QN=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,fP=/\n/g,dP=/^\s*/,hP=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,pP=/^:\s*/,mP=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,gP=/^[;\s]*/,bP=/^\s+|\s+$/g,EP=` +`,ZN="/",JN="*",wo="",yP="comment",TP="declaration";function SP(e,t){if(typeof e!="string")throw new TypeError("First argument must be a string");if(!e)return[];t=t||{};var n=1,r=1;function i(m){var b=m.match(fP);b&&(n+=b.length);var E=m.lastIndexOf(EP);r=~E?m.length-E:r+m.length}function a(){var m={line:n,column:r};return function(b){return b.position=new o(m),u(),b}}function o(m){this.start=m,this.end={line:n,column:r},this.source=t.source}o.prototype.content=e;function s(m){var b=new Error(t.source+":"+n+":"+r+": "+m);if(b.reason=m,b.filename=t.source,b.line=n,b.column=r,b.source=e,!t.silent)throw b}function l(m){var b=m.exec(e);if(b){var E=b[0];return i(E),e=e.slice(E.length),b}}function u(){l(dP)}function c(m){var b;for(m=m||[];b=f();)b!==!1&&m.push(b);return m}function f(){var m=a();if(!(ZN!=e.charAt(0)||JN!=e.charAt(1))){for(var b=2;wo!=e.charAt(b)&&(JN!=e.charAt(b)||ZN!=e.charAt(b+1));)++b;if(b+=2,wo===e.charAt(b-1))return s("End of comment missing");var E=e.slice(2,b-2);return r+=2,i(E),e=e.slice(b),r+=2,m({type:yP,comment:E})}}function d(){var m=a(),b=l(hP);if(b){if(f(),!l(pP))return s("property missing ':'");var E=l(mP),g=m({type:TP,property:ev(b[0].replace(QN,wo)),value:E?ev(E[0].replace(QN,wo)):wo});return l(gP),g}}function h(){var m=[];c(m);for(var b;b=d();)b!==!1&&(m.push(b),c(m));return m}return u(),h()}function ev(e){return e?e.replace(bP,wo):wo}tv.exports=SP});var rv=wt(sc=>{"use strict";var _P=sc&&sc.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(sc,"__esModule",{value:!0});sc.default=AP;var xP=_P(nv());function AP(e,t){let n=null;if(!e||typeof e!="string")return n;let r=(0,xP.default)(e),i=typeof t=="function";return r.forEach(a=>{if(a.type!=="declaration")return;let{property:o,value:s}=a;i?t(o,s,a):s&&(n=n||{},n[o]=s)}),n}});var av=wt(xh=>{"use strict";Object.defineProperty(xh,"__esModule",{value:!0});xh.camelCase=void 0;var CP=/^--[a-zA-Z0-9_-]+$/,NP=/-([a-z])/g,vP=/^[^-]+$/,kP=/^-(webkit|moz|ms|o|khtml)-/,wP=/^-(ms)-/,MP=function(e){return!e||vP.test(e)||CP.test(e)},OP=function(e,t){return t.toUpperCase()},iv=function(e,t){return"".concat(t,"-")},RP=function(e,t){return t===void 0&&(t={}),MP(e)?e:(e=e.toLowerCase(),t.reactCompat?e=e.replace(wP,iv):e=e.replace(kP,iv),e.replace(NP,OP))};xh.camelCase=RP});var sv=wt((oE,ov)=>{"use strict";var DP=oE&&oE.__importDefault||function(e){return e&&e.__esModule?e:{default:e}},IP=DP(rv()),LP=av();function aE(e,t){var n={};return!e||typeof e!="string"||(0,IP.default)(e,function(r,i){r&&i&&(n[(0,LP.camelCase)(r,t)]=i)}),n}aE.default=aE;ov.exports=aE});var Av=wt(Ch=>{"use strict";var l8=Symbol.for("react.transitional.element"),u8=Symbol.for("react.fragment");function xv(e,t,n){var r=null;if(n!==void 0&&(r=""+n),t.key!==void 0&&(r=""+t.key),"key"in t){n={};for(var i in t)i!=="key"&&(n[i]=t[i])}else n=t;return t=n.ref,{$$typeof:l8,type:e,key:r,ref:t!==void 0?t:null,props:n}}Ch.Fragment=u8;Ch.jsx=xv;Ch.jsxs=xv});var ne=wt((yee,Cv)=>{"use strict";Cv.exports=Av()});var Pk=wt((une,Bk)=>{"use strict";var jh=Object.prototype.hasOwnProperty,Lk=Object.prototype.toString,wk=Object.defineProperty,Mk=Object.getOwnPropertyDescriptor,Ok=function(t){return typeof Array.isArray=="function"?Array.isArray(t):Lk.call(t)==="[object Array]"},Rk=function(t){if(!t||Lk.call(t)!=="[object Object]")return!1;var n=jh.call(t,"constructor"),r=t.constructor&&t.constructor.prototype&&jh.call(t.constructor.prototype,"isPrototypeOf");if(t.constructor&&!n&&!r)return!1;var i;for(i in t);return typeof i>"u"||jh.call(t,i)},Dk=function(t,n){wk&&n.name==="__proto__"?wk(t,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):t[n.name]=n.newValue},Ik=function(t,n){if(n==="__proto__")if(jh.call(t,n)){if(Mk)return Mk(t,n).value}else return;return t[n]};Bk.exports=function e(){var t,n,r,i,a,o,s=arguments[0],l=1,u=arguments.length,c=!1;for(typeof s=="boolean"&&(c=s,s=arguments[1]||{},l=2),(s==null||typeof s!="object"&&typeof s!="function")&&(s={});l{function cO(e){return e instanceof Map?e.clear=e.delete=e.set=function(){throw new Error("map is read-only")}:e instanceof Set&&(e.add=e.clear=e.delete=function(){throw new Error("set is read-only")}),Object.freeze(e),Object.getOwnPropertyNames(e).forEach(t=>{let n=e[t],r=typeof n;(r==="object"||r==="function")&&!Object.isFrozen(n)&&cO(n)}),e}var kp=class{constructor(t){t.data===void 0&&(t.data={}),this.data=t.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}};function fO(e){return e.replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/'/g,"'")}function Va(e,...t){let n=Object.create(null);for(let r in e)n[r]=e[r];return t.forEach(function(r){for(let i in r)n[i]=r[i]}),n}var qq="",iO=e=>!!e.scope,Vq=(e,{prefix:t})=>{if(e.startsWith("language:"))return e.replace("language:","language-");if(e.includes(".")){let n=e.split(".");return[`${t}${n.shift()}`,...n.map((r,i)=>`${r}${"_".repeat(i+1)}`)].join(" ")}return`${t}${e}`},i1=class{constructor(t,n){this.buffer="",this.classPrefix=n.classPrefix,t.walk(this)}addText(t){this.buffer+=fO(t)}openNode(t){if(!iO(t))return;let n=Vq(t.scope,{prefix:this.classPrefix});this.span(n)}closeNode(t){iO(t)&&(this.buffer+=qq)}value(){return this.buffer}span(t){this.buffer+=``}},aO=(e={})=>{let t={children:[]};return Object.assign(t,e),t},a1=class e{constructor(){this.rootNode=aO(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(t){this.top.children.push(t)}openNode(t){let n=aO({scope:t});this.add(n),this.stack.push(n)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(t){return this.constructor._walk(t,this.rootNode)}static _walk(t,n){return typeof n=="string"?t.addText(n):n.children&&(t.openNode(n),n.children.forEach(r=>this._walk(t,r)),t.closeNode(n)),t}static _collapse(t){typeof t!="string"&&t.children&&(t.children.every(n=>typeof n=="string")?t.children=[t.children.join("")]:t.children.forEach(n=>{e._collapse(n)}))}},o1=class extends a1{constructor(t){super(),this.options=t}addText(t){t!==""&&this.add(t)}startScope(t){this.openNode(t)}endScope(){this.closeNode()}__addSublanguage(t,n){let r=t.root;n&&(r.scope=`language:${n}`),this.add(r)}toHTML(){return new i1(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}};function Vc(e){return e?typeof e=="string"?e:e.source:null}function dO(e){return Vo("(?=",e,")")}function Gq(e){return Vo("(?:",e,")*")}function Yq(e){return Vo("(?:",e,")?")}function Vo(...e){return e.map(n=>Vc(n)).join("")}function Kq(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function l1(...e){return"("+(Kq(e).capture?"":"?:")+e.map(r=>Vc(r)).join("|")+")"}function hO(e){return new RegExp(e.toString()+"|").exec("").length-1}function $q(e,t){let n=e&&e.exec(t);return n&&n.index===0}var jq=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function u1(e,{joinWith:t}){let n=0;return e.map(r=>{n+=1;let i=n,a=Vc(r),o="";for(;a.length>0;){let s=jq.exec(a);if(!s){o+=a;break}o+=a.substring(0,s.index),a=a.substring(s.index+s[0].length),s[0][0]==="\\"&&s[1]?o+="\\"+String(Number(s[1])+i):(o+=s[0],s[0]==="("&&n++)}return o}).map(r=>`(${r})`).join(t)}var Xq=/\b\B/,pO="[a-zA-Z]\\w*",c1="[a-zA-Z_]\\w*",mO="\\b\\d+(\\.\\d+)?",gO="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",bO="\\b(0b[01]+)",Wq="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",Qq=(e={})=>{let t=/^#![ ]*\//;return e.binary&&(e.begin=Vo(t,/.*\b/,e.binary,/\b.*/)),Va({scope:"meta",begin:t,end:/$/,relevance:0,"on:begin":(n,r)=>{n.index!==0&&r.ignoreMatch()}},e)},Gc={begin:"\\\\[\\s\\S]",relevance:0},Zq={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[Gc]},Jq={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[Gc]},eV={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},Mp=function(e,t,n={}){let r=Va({scope:"comment",begin:e,end:t,contains:[]},n);r.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});let i=l1("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return r.contains.push({begin:Vo(/[ ]+/,"(",i,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),r},tV=Mp("//","$"),nV=Mp("/\\*","\\*/"),rV=Mp("#","$"),iV={scope:"number",begin:mO,relevance:0},aV={scope:"number",begin:gO,relevance:0},oV={scope:"number",begin:bO,relevance:0},sV={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[Gc,{begin:/\[/,end:/\]/,relevance:0,contains:[Gc]}]},lV={scope:"title",begin:pO,relevance:0},uV={scope:"title",begin:c1,relevance:0},cV={begin:"\\.\\s*"+c1,relevance:0},fV=function(e){return Object.assign(e,{"on:begin":(t,n)=>{n.data._beginMatch=t[1]},"on:end":(t,n)=>{n.data._beginMatch!==t[1]&&n.ignoreMatch()}})},vp=Object.freeze({__proto__:null,APOS_STRING_MODE:Zq,BACKSLASH_ESCAPE:Gc,BINARY_NUMBER_MODE:oV,BINARY_NUMBER_RE:bO,COMMENT:Mp,C_BLOCK_COMMENT_MODE:nV,C_LINE_COMMENT_MODE:tV,C_NUMBER_MODE:aV,C_NUMBER_RE:gO,END_SAME_AS_BEGIN:fV,HASH_COMMENT_MODE:rV,IDENT_RE:pO,MATCH_NOTHING_RE:Xq,METHOD_GUARD:cV,NUMBER_MODE:iV,NUMBER_RE:mO,PHRASAL_WORDS_MODE:eV,QUOTE_STRING_MODE:Jq,REGEXP_MODE:sV,RE_STARTERS_RE:Wq,SHEBANG:Qq,TITLE_MODE:lV,UNDERSCORE_IDENT_RE:c1,UNDERSCORE_TITLE_MODE:uV});function dV(e,t){e.input[e.index-1]==="."&&t.ignoreMatch()}function hV(e,t){e.className!==void 0&&(e.scope=e.className,delete e.className)}function pV(e,t){t&&e.beginKeywords&&(e.begin="\\b("+e.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",e.__beforeBegin=dV,e.keywords=e.keywords||e.beginKeywords,delete e.beginKeywords,e.relevance===void 0&&(e.relevance=0))}function mV(e,t){Array.isArray(e.illegal)&&(e.illegal=l1(...e.illegal))}function gV(e,t){if(e.match){if(e.begin||e.end)throw new Error("begin & end are not supported with match");e.begin=e.match,delete e.match}}function bV(e,t){e.relevance===void 0&&(e.relevance=1)}var EV=(e,t)=>{if(!e.beforeMatch)return;if(e.starts)throw new Error("beforeMatch cannot be used with starts");let n=Object.assign({},e);Object.keys(e).forEach(r=>{delete e[r]}),e.keywords=n.keywords,e.begin=Vo(n.beforeMatch,dO(n.begin)),e.starts={relevance:0,contains:[Object.assign(n,{endsParent:!0})]},e.relevance=0,delete n.beforeMatch},yV=["of","and","for","in","not","or","if","then","parent","list","value"],TV="keyword";function EO(e,t,n=TV){let r=Object.create(null);return typeof e=="string"?i(n,e.split(" ")):Array.isArray(e)?i(n,e):Object.keys(e).forEach(function(a){Object.assign(r,EO(e[a],t,a))}),r;function i(a,o){t&&(o=o.map(s=>s.toLowerCase())),o.forEach(function(s){let l=s.split("|");r[l[0]]=[a,SV(l[0],l[1])]})}}function SV(e,t){return t?Number(t):_V(e)?0:1}function _V(e){return yV.includes(e.toLowerCase())}var oO={},qo=e=>{console.error(e)},sO=(e,...t)=>{console.log(`WARN: ${e}`,...t)},Ol=(e,t)=>{oO[`${e}/${t}`]||(console.log(`Deprecated as of ${e}. ${t}`),oO[`${e}/${t}`]=!0)},wp=new Error;function yO(e,t,{key:n}){let r=0,i=e[n],a={},o={};for(let s=1;s<=t.length;s++)o[s+r]=i[s],a[s+r]=!0,r+=hO(t[s-1]);e[n]=o,e[n]._emit=a,e[n]._multi=!0}function xV(e){if(Array.isArray(e.begin)){if(e.skip||e.excludeBegin||e.returnBegin)throw qo("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),wp;if(typeof e.beginScope!="object"||e.beginScope===null)throw qo("beginScope must be object"),wp;yO(e,e.begin,{key:"beginScope"}),e.begin=u1(e.begin,{joinWith:""})}}function AV(e){if(Array.isArray(e.end)){if(e.skip||e.excludeEnd||e.returnEnd)throw qo("skip, excludeEnd, returnEnd not compatible with endScope: {}"),wp;if(typeof e.endScope!="object"||e.endScope===null)throw qo("endScope must be object"),wp;yO(e,e.end,{key:"endScope"}),e.end=u1(e.end,{joinWith:""})}}function CV(e){e.scope&&typeof e.scope=="object"&&e.scope!==null&&(e.beginScope=e.scope,delete e.scope)}function NV(e){CV(e),typeof e.beginScope=="string"&&(e.beginScope={_wrap:e.beginScope}),typeof e.endScope=="string"&&(e.endScope={_wrap:e.endScope}),xV(e),AV(e)}function vV(e){function t(o,s){return new RegExp(Vc(o),"m"+(e.case_insensitive?"i":"")+(e.unicodeRegex?"u":"")+(s?"g":""))}class n{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(s,l){l.position=this.position++,this.matchIndexes[this.matchAt]=l,this.regexes.push([l,s]),this.matchAt+=hO(s)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);let s=this.regexes.map(l=>l[1]);this.matcherRe=t(u1(s,{joinWith:"|"}),!0),this.lastIndex=0}exec(s){this.matcherRe.lastIndex=this.lastIndex;let l=this.matcherRe.exec(s);if(!l)return null;let u=l.findIndex((f,d)=>d>0&&f!==void 0),c=this.matchIndexes[u];return l.splice(0,u),Object.assign(l,c)}}class r{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(s){if(this.multiRegexes[s])return this.multiRegexes[s];let l=new n;return this.rules.slice(s).forEach(([u,c])=>l.addRule(u,c)),l.compile(),this.multiRegexes[s]=l,l}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(s,l){this.rules.push([s,l]),l.type==="begin"&&this.count++}exec(s){let l=this.getMatcher(this.regexIndex);l.lastIndex=this.lastIndex;let u=l.exec(s);if(this.resumingScanAtSamePosition()&&!(u&&u.index===this.lastIndex)){let c=this.getMatcher(0);c.lastIndex=this.lastIndex+1,u=c.exec(s)}return u&&(this.regexIndex+=u.position+1,this.regexIndex===this.count&&this.considerAll()),u}}function i(o){let s=new r;return o.contains.forEach(l=>s.addRule(l.begin,{rule:l,type:"begin"})),o.terminatorEnd&&s.addRule(o.terminatorEnd,{type:"end"}),o.illegal&&s.addRule(o.illegal,{type:"illegal"}),s}function a(o,s){let l=o;if(o.isCompiled)return l;[hV,gV,NV,EV].forEach(c=>c(o,s)),e.compilerExtensions.forEach(c=>c(o,s)),o.__beforeBegin=null,[pV,mV,bV].forEach(c=>c(o,s)),o.isCompiled=!0;let u=null;return typeof o.keywords=="object"&&o.keywords.$pattern&&(o.keywords=Object.assign({},o.keywords),u=o.keywords.$pattern,delete o.keywords.$pattern),u=u||/\w+/,o.keywords&&(o.keywords=EO(o.keywords,e.case_insensitive)),l.keywordPatternRe=t(u,!0),s&&(o.begin||(o.begin=/\B|\b/),l.beginRe=t(l.begin),!o.end&&!o.endsWithParent&&(o.end=/\B|\b/),o.end&&(l.endRe=t(l.end)),l.terminatorEnd=Vc(l.end)||"",o.endsWithParent&&s.terminatorEnd&&(l.terminatorEnd+=(o.end?"|":"")+s.terminatorEnd)),o.illegal&&(l.illegalRe=t(o.illegal)),o.contains||(o.contains=[]),o.contains=[].concat(...o.contains.map(function(c){return kV(c==="self"?o:c)})),o.contains.forEach(function(c){a(c,l)}),o.starts&&a(o.starts,s),l.matcher=i(l),l}if(e.compilerExtensions||(e.compilerExtensions=[]),e.contains&&e.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return e.classNameAliases=Va(e.classNameAliases||{}),a(e)}function TO(e){return e?e.endsWithParent||TO(e.starts):!1}function kV(e){return e.variants&&!e.cachedVariants&&(e.cachedVariants=e.variants.map(function(t){return Va(e,{variants:null},t)})),e.cachedVariants?e.cachedVariants:TO(e)?Va(e,{starts:e.starts?Va(e.starts):null}):Object.isFrozen(e)?Va(e):e}var wV="11.11.1",s1=class extends Error{constructor(t,n){super(t),this.name="HTMLInjectionError",this.html=n}},r1=fO,lO=Va,uO=Symbol("nomatch"),MV=7,SO=function(e){let t=Object.create(null),n=Object.create(null),r=[],i=!0,a="Could not find the language '{}', did you forget to load/include a language module?",o={disableAutodetect:!0,name:"Plain text",contains:[]},s={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:o1};function l(D){return s.noHighlightRe.test(D)}function u(D){let B=D.className+" ";B+=D.parentNode?D.parentNode.className:"";let K=s.languageDetectRe.exec(B);if(K){let F=R(K[1]);return F||(sO(a.replace("{}",K[1])),sO("Falling back to no-highlight mode for this block.",D)),F?K[1]:"no-highlight"}return B.split(/\s+/).find(F=>l(F)||R(F))}function c(D,B,K){let F="",N="";typeof B=="object"?(F=D,K=B.ignoreIllegals,N=B.language):(Ol("10.7.0","highlight(lang, code, ...args) has been deprecated."),Ol("10.7.0",`Please use highlight(code, options) instead. +https://github.com/highlightjs/highlight.js/issues/2277`),N=D,F=B),K===void 0&&(K=!0);let ae={code:F,language:N};V("before:highlight",ae);let ce=ae.result?ae.result:f(ae.language,ae.code,K);return ce.code=ae.code,V("after:highlight",ce),ce}function f(D,B,K,F){let N=Object.create(null);function ae(O,P){return O.keywords[P]}function ce(){if(!ue.keywords){$e.addText(X);return}let O=0;ue.keywordPatternRe.lastIndex=0;let P=ue.keywordPatternRe.exec(X),J="";for(;P;){J+=X.substring(O,P.index);let ie=ee.case_insensitive?P[0].toLowerCase():P[0],ye=ae(ue,ie);if(ye){let[xt,fi]=ye;if($e.addText(J),J="",N[ie]=(N[ie]||0)+1,N[ie]<=MV&&(Se+=fi),xt.startsWith("_"))J+=P[0];else{let wr=ee.classNameAliases[xt]||xt;be(P[0],wr)}}else J+=P[0];O=ue.keywordPatternRe.lastIndex,P=ue.keywordPatternRe.exec(X)}J+=X.substring(O),$e.addText(J)}function k(){if(X==="")return;let O=null;if(typeof ue.subLanguage=="string"){if(!t[ue.subLanguage]){$e.addText(X);return}O=f(ue.subLanguage,X,!0,Wn[ue.subLanguage]),Wn[ue.subLanguage]=O._top}else O=h(X,ue.subLanguage.length?ue.subLanguage:null);ue.relevance>0&&(Se+=O.relevance),$e.__addSublanguage(O._emitter,O.language)}function Te(){ue.subLanguage!=null?k():ce(),X=""}function be(O,P){O!==""&&($e.startScope(P),$e.addText(O),$e.endScope())}function He(O,P){let J=1,ie=P.length-1;for(;J<=ie;){if(!O._emit[J]){J++;continue}let ye=ee.classNameAliases[O[J]]||O[J],xt=P[J];ye?be(xt,ye):(X=xt,ce(),X=""),J++}}function et(O,P){return O.scope&&typeof O.scope=="string"&&$e.openNode(ee.classNameAliases[O.scope]||O.scope),O.beginScope&&(O.beginScope._wrap?(be(X,ee.classNameAliases[O.beginScope._wrap]||O.beginScope._wrap),X=""):O.beginScope._multi&&(He(O.beginScope,P),X="")),ue=Object.create(O,{parent:{value:ue}}),ue}function Ee(O,P,J){let ie=$q(O.endRe,J);if(ie){if(O["on:end"]){let ye=new kp(O);O["on:end"](P,ye),ye.isMatchIgnored&&(ie=!1)}if(ie){for(;O.endsParent&&O.parent;)O=O.parent;return O}}if(O.endsWithParent)return Ee(O.parent,P,J)}function lt(O){return ue.matcher.regexIndex===0?(X+=O[0],1):(yn=!0,0)}function Ve(O){let P=O[0],J=O.rule,ie=new kp(J),ye=[J.__beforeBegin,J["on:begin"]];for(let xt of ye)if(xt&&(xt(O,ie),ie.isMatchIgnored))return lt(P);return J.skip?X+=P:(J.excludeBegin&&(X+=P),Te(),!J.returnBegin&&!J.excludeBegin&&(X=P)),et(J,O),J.returnBegin?0:P.length}function St(O){let P=O[0],J=B.substring(O.index),ie=Ee(ue,O,J);if(!ie)return uO;let ye=ue;ue.endScope&&ue.endScope._wrap?(Te(),be(P,ue.endScope._wrap)):ue.endScope&&ue.endScope._multi?(Te(),He(ue.endScope,O)):ye.skip?X+=P:(ye.returnEnd||ye.excludeEnd||(X+=P),Te(),ye.excludeEnd&&(X=P));do ue.scope&&$e.closeNode(),!ue.skip&&!ue.subLanguage&&(Se+=ue.relevance),ue=ue.parent;while(ue!==ie.parent);return ie.starts&&et(ie.starts,O),ye.returnEnd?0:P.length}function Pt(){let O=[];for(let P=ue;P!==ee;P=P.parent)P.scope&&O.unshift(P.scope);O.forEach(P=>$e.openNode(P))}let wn={};function qr(O,P){let J=P&&P[0];if(X+=O,J==null)return Te(),0;if(wn.type==="begin"&&P.type==="end"&&wn.index===P.index&&J===""){if(X+=B.slice(P.index,P.index+1),!i){let ie=new Error(`0 width match regex (${D})`);throw ie.languageName=D,ie.badRule=wn.rule,ie}return 1}if(wn=P,P.type==="begin")return Ve(P);if(P.type==="illegal"&&!K){let ie=new Error('Illegal lexeme "'+J+'" for mode "'+(ue.scope||"")+'"');throw ie.mode=ue,ie}else if(P.type==="end"){let ie=St(P);if(ie!==uO)return ie}if(P.type==="illegal"&&J==="")return X+=` +`,1;if(gt>1e5&>>P.index*3)throw new Error("potential infinite loop, way more iterations than matches");return X+=J,J.length}let ee=R(D);if(!ee)throw qo(a.replace("{}",D)),new Error('Unknown language: "'+D+'"');let se=vV(ee),_t="",ue=F||se,Wn={},$e=new s.__emitter(s);Pt();let X="",Se=0,Ne=0,gt=0,yn=!1;try{if(ee.__emitTokens)ee.__emitTokens(B,$e);else{for(ue.matcher.considerAll();;){gt++,yn?yn=!1:ue.matcher.considerAll(),ue.matcher.lastIndex=Ne;let O=ue.matcher.exec(B);if(!O)break;let P=B.substring(Ne,O.index),J=qr(P,O);Ne=O.index+J}qr(B.substring(Ne))}return $e.finalize(),_t=$e.toHTML(),{language:D,value:_t,relevance:Se,illegal:!1,_emitter:$e,_top:ue}}catch(O){if(O.message&&O.message.includes("Illegal"))return{language:D,value:r1(B),illegal:!0,relevance:0,_illegalBy:{message:O.message,index:Ne,context:B.slice(Ne-100,Ne+100),mode:O.mode,resultSoFar:_t},_emitter:$e};if(i)return{language:D,value:r1(B),illegal:!1,relevance:0,errorRaised:O,_emitter:$e,_top:ue};throw O}}function d(D){let B={value:r1(D),illegal:!1,relevance:0,_top:o,_emitter:new s.__emitter(s)};return B._emitter.addText(D),B}function h(D,B){B=B||s.languages||Object.keys(t);let K=d(D),F=B.filter(R).filter(A).map(Te=>f(Te,D,!1));F.unshift(K);let N=F.sort((Te,be)=>{if(Te.relevance!==be.relevance)return be.relevance-Te.relevance;if(Te.language&&be.language){if(R(Te.language).supersetOf===be.language)return 1;if(R(be.language).supersetOf===Te.language)return-1}return 0}),[ae,ce]=N,k=ae;return k.secondBest=ce,k}function m(D,B,K){let F=B&&n[B]||K;D.classList.add("hljs"),D.classList.add(`language-${F}`)}function b(D){let B=null,K=u(D);if(l(K))return;if(V("before:highlightElement",{el:D,language:K}),D.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",D);return}if(D.children.length>0&&(s.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(D)),s.throwUnescapedHTML))throw new s1("One of your code blocks includes unescaped HTML.",D.innerHTML);B=D;let F=B.textContent,N=K?c(F,{language:K,ignoreIllegals:!0}):h(F);D.innerHTML=N.value,D.dataset.highlighted="yes",m(D,K,N.language),D.result={language:N.language,re:N.relevance,relevance:N.relevance},N.secondBest&&(D.secondBest={language:N.secondBest.language,relevance:N.secondBest.relevance}),V("after:highlightElement",{el:D,result:N,text:F})}function E(D){s=lO(s,D)}let g=()=>{S(),Ol("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function y(){S(),Ol("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let T=!1;function S(){function D(){S()}if(document.readyState==="loading"){T||window.addEventListener("DOMContentLoaded",D,!1),T=!0;return}document.querySelectorAll(s.cssSelector).forEach(b)}function v(D,B){let K=null;try{K=B(e)}catch(F){if(qo("Language definition for '{}' could not be registered.".replace("{}",D)),i)qo(F);else throw F;K=o}K.name||(K.name=D),t[D]=K,K.rawDefinition=B.bind(null,e),K.aliases&&L(K.aliases,{languageName:D})}function x(D){delete t[D];for(let B of Object.keys(n))n[B]===D&&delete n[B]}function M(){return Object.keys(t)}function R(D){return D=(D||"").toLowerCase(),t[D]||t[n[D]]}function L(D,{languageName:B}){typeof D=="string"&&(D=[D]),D.forEach(K=>{n[K.toLowerCase()]=B})}function A(D){let B=R(D);return B&&!B.disableAutodetect}function H(D){D["before:highlightBlock"]&&!D["before:highlightElement"]&&(D["before:highlightElement"]=B=>{D["before:highlightBlock"](Object.assign({block:B.el},B))}),D["after:highlightBlock"]&&!D["after:highlightElement"]&&(D["after:highlightElement"]=B=>{D["after:highlightBlock"](Object.assign({block:B.el},B))})}function Y(D){H(D),r.push(D)}function z(D){let B=r.indexOf(D);B!==-1&&r.splice(B,1)}function V(D,B){let K=D;r.forEach(function(F){F[K]&&F[K](B)})}function $(D){return Ol("10.7.0","highlightBlock will be removed entirely in v12.0"),Ol("10.7.0","Please use highlightElement now."),b(D)}Object.assign(e,{highlight:c,highlightAuto:h,highlightAll:S,highlightElement:b,highlightBlock:$,configure:E,initHighlighting:g,initHighlightingOnLoad:y,registerLanguage:v,unregisterLanguage:x,listLanguages:M,getLanguage:R,registerAliases:L,autoDetection:A,inherit:lO,addPlugin:Y,removePlugin:z}),e.debugMode=function(){i=!1},e.safeMode=function(){i=!0},e.versionString=wV,e.regex={concat:Vo,lookahead:dO,either:l1,optional:Yq,anyNumberOfTimes:Gq};for(let D in vp)typeof vp[D]=="object"&&cO(vp[D]);return Object.assign(e,vp),e},Rl=SO({});Rl.newInstance=()=>SO({});_O.exports=Rl;Rl.HighlightJS=Rl;Rl.default=Rl});var NR=wt(CR=>{"use strict";var Ll=me();function lG(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var uG=typeof Object.is=="function"?Object.is:lG,cG=Ll.useState,fG=Ll.useEffect,dG=Ll.useLayoutEffect,hG=Ll.useDebugValue;function pG(e,t){var n=t(),r=cG({inst:{value:n,getSnapshot:t}}),i=r[0].inst,a=r[1];return dG(function(){i.value=n,i.getSnapshot=t,C1(i)&&a({inst:i})},[e,n,t]),fG(function(){return C1(i)&&a({inst:i}),e(function(){C1(i)&&a({inst:i})})},[e]),hG(n),n}function C1(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!uG(e,n)}catch{return!0}}function mG(e,t){return t()}var gG=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?mG:pG;CR.useSyncExternalStore=Ll.useSyncExternalStore!==void 0?Ll.useSyncExternalStore:gG});var Vp=wt((Bpe,vR)=>{"use strict";vR.exports=NR()});var X3=wt(j3=>{"use strict";var Dm=me(),BX=Vp();function PX(e,t){return e===t&&(e!==0||1/e===1/t)||e!==e&&t!==t}var UX=typeof Object.is=="function"?Object.is:PX,HX=BX.useSyncExternalStore,zX=Dm.useRef,FX=Dm.useEffect,qX=Dm.useMemo,VX=Dm.useDebugValue;j3.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var a=zX(null);if(a.current===null){var o={hasValue:!1,value:null};a.current=o}else o=a.current;a=qX(function(){function l(h){if(!u){if(u=!0,c=h,h=r(h),i!==void 0&&o.hasValue){var m=o.value;if(i(m,h))return f=m}return f=h}if(m=f,UX(c,h))return m;var b=r(h);return i!==void 0&&i(m,b)?(c=h,m):(c=h,f=b)}var u=!1,c,f,d=n===void 0?null:n;return[function(){return l(t())},d===null?void 0:function(){return l(d())}]},[t,n,r,i]);var s=HX(e,a[0],a[1]);return FX(function(){o.hasValue=!0,o.value=s},[s]),VX(s),s}});var Q3=wt((jge,W3)=>{"use strict";W3.exports=X3()});var WL=q(oh(),1),QL=q(me(),1);var mt=q(me(),1);var lr=q(me(),1);function Sr(){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=Array.from(e,n=>n.toString(16).padStart(2,"0"));return`${t[0]}${t[1]}${t[2]}${t[3]}-${t[4]}${t[5]}-${t[6]}${t[7]}-${t[8]}${t[9]}-${t[10]}${t[11]}${t[12]}${t[13]}${t[14]}${t[15]}`}var wa={messages:[],streamingMessage:null,greeting:null,inputDisabled:!1,inputPlaceholder:"Enter a message...",cancelRequested:!1,enableCancel:!1,enableCancelExplicit:!1,enableUpload:!1,enableUploadExplicit:!1,hiddenToolRequests:new Set,slashCommands:[],history:{enabled:!1,conversations:[],activeId:null}};function uN(e){let t=[];for(let i of e.segments)t.push(...mN(i.content,i.content_type));let n=e.attachments??[],r=t.filter(i=>i.type==="content").map(i=>i.content).join("");return{id:e.id??Sr(),role:e.role,content:r,streaming:!1,icon:e.icon,...n.length>0?{attachments:n}:{},blocks:t,siblings:e.siblings}}function sh(e){return e.filter(t=>!t.isPlaceholder)}function ic(e,t){return t?[...e??[],...t]:e}function lh(e){return e?.options.persistent!==!0&&e?.status==="visible"?{...e,status:"dismissing"}:e}function cN(e,t,n){return e?.status==="dismissed"||!t&&n?"dismissed":"visible"}var Bb=/\n?([\s\S]*?)\n?<\/thinking>\n*/g;function mN(e,t){if(t==="thinking")return[{type:"thinking",content:e,streaming:!1}];if(t!=="markdown")return[{type:"content",content:e,contentType:t}];let n=[],r=/^(`{3,}|~{3,}).*\n([\s\S]*?)^\1\s*$/gm;for(let u of e.matchAll(r))n.push([u.index,u.index+u[0].length]);let i=/`[^`\n]+`/g;for(let u of e.matchAll(i))n.push([u.index,u.index+u[0].length]);function a(u){return n.some(([c,f])=>u>=c&&u(t=i,`
${i}
`)),topic:t}}var fN=` `,Ib="",dN=` -`,Lb="",t5=/^(`{3,}|~{3,})[^\n]*(\n|$)/m;function n5(e){let t=e[0];return new RegExp(`^${t}{${e.length},}[ \\t]*(?:\\n|$)`,"m")}function r5(e){if(e.length===0)return!0;let t=e[e.length-1];return t.type==="thinking"?!0:t.content===""||t.content.endsWith(` -`)}function i5(e,t,n){let r=t.tagBuffer+e,i=t.insideThinkingTag?"thinking":t.insideFence?"fence":"outside",a=t.fenceMarker,o=t.tagBuffer?!0:n,s=[],l="";for(;r.length>0;)if(i==="outside"){let u=t5.exec(r),c=u!==null&&(u.index>0||o),f=r.indexOf(fN),d=f===-1?r.indexOf(Ib):-1,h=f!==-1?f:d,m=f!==-1?fN:Ib;if(c&&(h===-1||u.index`,Lb="
",n5=/^(`{3,}|~{3,})[^\n]*(\n|$)/m;function r5(e){let t=e[0];return new RegExp(`^${t}{${e.length},}[ \\t]*(?:\\n|$)`,"m")}function i5(e){if(e.length===0)return!0;let t=e[e.length-1];return t.type==="thinking"?!0:t.content===""||t.content.endsWith(` +`)}function a5(e,t,n){let r=t.tagBuffer+e,i=t.insideThinkingTag?"thinking":t.insideFence?"fence":"outside",a=t.fenceMarker,o=t.tagBuffer?!0:n,s=[],l="";for(;r.length>0;)if(i==="outside"){let u=n5.exec(r),c=u!==null&&(u.index>0||o),f=r.indexOf(fN),d=f===-1?r.indexOf(Ib):-1,h=f!==-1?f:d,m=f!==-1?fN:Ib;if(c&&(h===-1||u.index0&&g.trim()===""&&(g.includes(` `)||o)?(l=r.slice(r.length-E),g&&s.push({type:"content",text:g}),r=""):(s.push({type:"content",text:r}),o=r.endsWith(` -`),r="")}}else if(i==="fence"){let c=n5(a).exec(r);if(c!==null){let f=r.slice(0,c.index+c[0].length);f&&s.push({type:"content",text:f}),o=f.endsWith(` +`),r="")}}else if(i==="fence"){let c=r5(a).exec(r);if(c!==null){let f=r.slice(0,c.index+c[0].length);f&&s.push({type:"content",text:f}),o=f.endsWith(` `),i="outside",a="",r=r.slice(c.index+c[0].length)}else s.push({type:"content",text:r}),o=r.endsWith(` `),r=""}else{let u=r.indexOf(dN),c=u===-1?r.indexOf(Lb):-1,f=u!==-1?u:c,d=u!==-1?dN:Lb;if(f!==-1){let h=r.slice(0,f);h&&s.push({type:"thinking",text:h}),i="outside",o=!0,r=r.slice(f+d.length),r.startsWith(` `)&&(r=r.slice(1)),r.startsWith(` -`)&&(r=r.slice(1))}else{let h=hN(r,Lb);if(h>0){l=r.slice(r.length-h);let m=r.slice(0,r.length-h);m&&s.push({type:"thinking",text:m}),r=""}else s.push({type:"thinking",text:r}),r=""}}return{segments:s,state:{insideThinkingTag:i==="thinking",tagBuffer:l,insideFence:i==="fence",fenceMarker:a}}}function hN(e,t){for(let n=Math.min(t.length-1,e.length);n>0;n--)if(e.endsWith(t.slice(0,n)))return n;return 0}var gN=/(.*?)<\/topic>/g,a5=/<(?:t(?:o(?:p(?:i(?:c(?:>[^<]*)?)?)?)?)?)?\s*$/,o5=/<(?:\/(?:t(?:o(?:p(?:i(?:c(?:>)?)?)?)?)?)?)?\s*$/;function uh(e,t){let n=t+e,r=null;n=n.replace(gN,(l,u)=>(r=u,` +`)&&(r=r.slice(1))}else{let h=hN(r,Lb);if(h>0){l=r.slice(r.length-h);let m=r.slice(0,r.length-h);m&&s.push({type:"thinking",text:m}),r=""}else s.push({type:"thinking",text:r}),r=""}}return{segments:s,state:{insideThinkingTag:i==="thinking",tagBuffer:l,insideFence:i==="fence",fenceMarker:a}}}function hN(e,t){for(let n=Math.min(t.length-1,e.length);n>0;n--)if(e.endsWith(t.slice(0,n)))return n;return 0}var gN=/(.*?)<\/topic>/g,o5=/<(?:t(?:o(?:p(?:i(?:c(?:>[^<]*)?)?)?)?)?)?\s*$/,s5=/<(?:\/(?:t(?:o(?:p(?:i(?:c(?:>)?)?)?)?)?)?)?\s*$/;function uh(e,t){let n=t+e,r=null;n=n.replace(gN,(l,u)=>(r=u,`
${u}
-`));let i="",a=a5.exec(n),o=o5.exec(n),s=a&&o?a.index>o.index?a:o:a||o;return s&&s[0]&&(i=s[0],n=n.slice(0,s.index)),{cleaned:n,topic:r,buffer:i}}function bN(e,t){switch(t.type){case"INPUT_SENT":{let n={id:Sr(),role:"user",content:t.content,streaming:!1,...t.attachments&&t.attachments.length>0?{attachments:t.attachments}:{},blocks:[{type:"content",content:t.content,contentType:"markdown"}]};if(t.awaitResponse===!1)return{...e,messages:[...e.messages,n],greeting:lh(e.greeting)};let r={id:Sr(),role:"assistant",content:"",streaming:!1,isPlaceholder:!0,blocks:[]};return{...e,messages:[...e.messages,n,r],inputDisabled:!0,greeting:lh(e.greeting)}}case"message":{let n=sh(e.messages),r=uN(t.message);return t.html_deps&&(r.htmlDeps=t.html_deps),{...e,messages:[...n,r],streamingMessage:null,inputDisabled:!1,greeting:lh(e.greeting)}}case"chunk_start":{let n=sh(e.messages),r=uN(t.message);return r.streaming=!0,r.blocks=r.blocks.map(i=>i.type==="thinking"?{...i,streaming:!0}:i),t.html_deps&&(r.htmlDeps=t.html_deps),{...e,messages:n,streamingMessage:r,inputDisabled:!0,greeting:lh(e.greeting)}}case"chunk":{let n=e.streamingMessage;if(!n||!n.streaming)return e;let r=t.content_type,i=n.blocks[n.blocks.length-1],a=(i?.type==="content"?i.contentType:void 0)??"markdown";if(r==="thinking"){let u=[...n.blocks],c=i?.type==="thinking"&&i.streaming?i:null;if(c){let{cleaned:f,topic:d,buffer:h}=uh(t.content,c.topicBuffer??"");u[u.length-1]={...c,content:c.content+f,topicBuffer:h,...d!==null?{topic:d}:{}}}else{let{cleaned:f,topic:d,buffer:h}=uh(t.content,"");u.push({type:"thinking",content:f,topicBuffer:h,streaming:!0,startedAt:Date.now(),...d!==null?{topic:d}:{}})}return{...e,streamingMessage:{...n,blocks:u,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}let o=r??a;if(n.insideThinkingTag||n.tagBuffer||n.insideFence||t.content.includes("<")||t.content.includes("```")||t.content.includes("~~~")){let u={insideThinkingTag:n.insideThinkingTag??!1,tagBuffer:n.tagBuffer??"",insideFence:n.insideFence??!1,fenceMarker:n.fenceMarker??""},{segments:c,state:f}=i5(t.content,u,r5(n.blocks)),d=!!(n.insideThinkingTag||n.tagBuffer||n.insideFence),h=c.some(E=>E.type==="thinking"),m=f.insideThinkingTag,b=f.insideFence!==(n.insideFence??!1);if(d||h||m||b){let E=[...n.blocks];for(let y of c)if(y.type==="thinking"){let T=E[E.length-1];if(T?.type==="thinking"&&T.streaming){let{cleaned:S,topic:v,buffer:x}=uh(y.text,T.topicBuffer??"");E[E.length-1]={...T,content:T.content+S,topicBuffer:x,...v!==null?{topic:v}:{}}}else{let{cleaned:S,topic:v,buffer:x}=uh(y.text,"");E.push({type:"thinking",content:S,topicBuffer:x,streaming:!0,startedAt:Date.now(),...v!==null?{topic:v}:{}})}}else{let T=E[E.length-1];T?.type==="thinking"&&T.streaming&&(E[E.length-1]={...T,content:T.content+(T.topicBuffer??""),topicBuffer:"",streaming:!1,durationMs:T.startedAt?Date.now()-T.startedAt:void 0});let S=E[E.length-1];S?.type==="content"&&S.contentType===o?E[E.length-1]={...S,content:S.content+y.text}:y.text&&E.push({type:"content",content:y.text,contentType:o})}let g=E.filter(y=>y.type==="content").map(y=>y.content).join("");return{...e,streamingMessage:{...n,content:g,blocks:E,insideThinkingTag:f.insideThinkingTag,tagBuffer:f.tagBuffer,insideFence:f.insideFence,fenceMarker:f.fenceMarker,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}if(f.tagBuffer)return{...e,streamingMessage:{...n,insideThinkingTag:f.insideThinkingTag,tagBuffer:f.tagBuffer,insideFence:f.insideFence,fenceMarker:f.fenceMarker,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}let s=[...n.blocks];if(i?.type==="thinking"&&i.streaming&&(s[s.length-1]={...i,content:i.content+(i.topicBuffer??""),topicBuffer:"",streaming:!1,durationMs:i.startedAt?Date.now()-i.startedAt:void 0}),t.operation==="replace"){let u=s.filter(c=>c.type==="thinking");return u.push({type:"content",content:t.content,contentType:o}),{...e,streamingMessage:{...n,content:t.content,blocks:u,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}else{let u=s[s.length-1];u?.type==="content"&&u.contentType===o?s[s.length-1]={...u,content:u.content+t.content}:s.push({type:"content",content:t.content,contentType:o})}let l=s.filter(u=>u.type==="content").map(u=>u.content).join("");return{...e,streamingMessage:{...n,content:l,blocks:s,insideThinkingTag:!1,tagBuffer:"",htmlDeps:ic(n.htmlDeps,t.html_deps)}}}case"chunk_end":{let n=e.streamingMessage;if(!n||!n.streaming){if(e.cancelRequested){let a=sh(e.messages),o={id:Sr(),role:"assistant",content:"",streaming:!1,cancelled:!0,blocks:[]};return{...e,messages:[...a,o],streamingMessage:null,inputDisabled:!1,cancelRequested:!1}}return e}let r=pN(n),i=e.cancelRequested?{...r,cancelled:!0}:r;return{...e,messages:[...e.messages,i],streamingMessage:null,inputDisabled:!1,cancelRequested:!1}}case"CANCEL_REQUESTED":return{...e,cancelRequested:!0};case"update_cancel":return e.enableCancelExplicit?e:{...e,enableCancel:t.enable_cancel};case"update_upload":return e.enableUploadExplicit?e:{...e,enableUpload:t.enable_upload};case"clear":{let n=t.greeting?null:e.greeting?{...e.greeting,status:"visible"}:null;return{...wa,inputPlaceholder:e.inputPlaceholder,greeting:n,enableCancel:e.enableCancel,enableCancelExplicit:e.enableCancelExplicit,slashCommands:e.slashCommands,enableUpload:e.enableUpload,enableUploadExplicit:e.enableUploadExplicit,history:e.history}}case"update_input":return{...e,inputPlaceholder:t.placeholder??e.inputPlaceholder};case"remove_loading":{let n=sh(e.messages);if(e.streamingMessage){let r=pN(e.streamingMessage),i=e.cancelRequested?{...r,cancelled:!0}:r;n.push(i)}return{...e,messages:n,streamingMessage:null,inputDisabled:!1,cancelRequested:!1}}case"hide_tool_request":{if(e.hiddenToolRequests.has(t.requestId))return e;let n=new Set(e.hiddenToolRequests);return n.add(t.requestId),{...e,hiddenToolRequests:n}}case"greeting":{let n=t.options.persistent===!0,r=cN(e.greeting,n,e.messages.length>0);return{...e,greeting:{content:t.content,contentType:t.content_type,streaming:!1,status:r,options:t.options,blocks:[{type:"content",content:t.content,contentType:t.content_type}]}}}case"greeting_start":{let n=t.options.persistent===!0,r=cN(e.greeting,n,e.messages.length>0);return{...e,greeting:{content:t.content,contentType:t.content_type,streaming:!0,status:r,options:t.options,blocks:t.content?[{type:"content",content:t.content,contentType:t.content_type}]:[]}}}case"greeting_dismissed":{let n=e.greeting;return!n||n.status!=="dismissing"?e:{...e,greeting:{...n,status:"dismissed"}}}case"greeting_chunk":{let n=e.greeting;if(!n||!n.streaming)return e;let r=t.content_type??n.contentType,i;if(t.operation==="replace")i=[{type:"content",content:t.content,contentType:r}];else{let o=[...n.blocks],s=o[o.length-1];s&&s.contentType===r?(o[o.length-1]={...s,content:s.content+t.content},i=o):i=[...o,{type:"content",content:t.content,contentType:r}]}let a=i.map(o=>o.content).join("");return{...e,greeting:{...n,content:a,contentType:r,blocks:i}}}case"greeting_end":{let n=e.greeting;return n?.streaming?n.content?{...e,greeting:{...n,streaming:!1}}:{...e,greeting:null}:e}case"greeting_clear":return{...e,greeting:null};case"update_slash_commands":return{...e,slashCommands:t.commands};case"history_update":return{...e,history:{enabled:t.enabled,conversations:t.conversations,activeId:t.active_id}};case"history_navigate":return e;case"update_siblings":{let n=e.messages.map((r,i)=>{let a=t.data[i];return a?{...r,siblings:a}:r.siblings?{...r,siblings:void 0}:r});return{...e,messages:n}}default:{let n=t;return e}}}function s5(e){return e.type==="thinking"?{content:e.content,content_type:"thinking"}:{content:e.content,content_type:e.contentType}}function Pb(e){return e.messages.filter(t=>!t.isPlaceholder&&!t.streaming).map(t=>{let n={role:t.role,segments:t.blocks.map(s5)};return t.attachments&&t.attachments.length>0&&(n.attachments=t.attachments),t.htmlDeps&&t.htmlDeps.length>0&&(n.htmlDeps=t.htmlDeps),n})}function pN(e){let t=[];for(let r of e.blocks)r.type==="thinking"&&r.streaming?t.push({...r,content:r.content+(r.topicBuffer??""),topicBuffer:"",streaming:!1,durationMs:r.startedAt?Date.now()-r.startedAt:void 0}):r.type==="content"&&Bb.test(r.content)?(Bb.lastIndex=0,t.push(...mN(r.content,r.contentType))):t.push(r);let n=t.filter(r=>r.type==="content").map(r=>r.content).join("");return{...e,content:n,streaming:!1,blocks:t}}var Ma=(0,lr.createContext)(null),Ub=(0,lr.createContext)(null);function EN(){return(0,lr.useContext)(Ub)}var l5={hiddenToolRequests:wa.hiddenToolRequests},Hb=(0,lr.createContext)(l5),No=(0,lr.createContext)(null),zb=(0,lr.createContext)(null),Fb=(0,lr.createContext)([]);function yN(){return(0,lr.useContext)(Hb)}function ch(){let e=(0,lr.useContext)(No);if(!e)throw new Error("useChatDispatch must be used within a ChatDispatchContext.Provider");return e}function TN(){let e=(0,lr.useContext)(zb);if(e===null)throw new Error("useChatSubmit must be used within a ChatSubmitContext.Provider");return e}function SN(){return(0,lr.useContext)(Fb)}var qb="shinychat-current",u5="shinychat_conversation_id";function _N(){try{return new URLSearchParams(window.location.search).get(u5)}catch{return null}}function xN(e){try{return localStorage.getItem(`${qb}:${e}`)}catch{return null}}function Vb(e,t){try{t===null?localStorage.removeItem(`${qb}:${e}`):localStorage.setItem(`${qb}:${e}`,t)}catch{}}function AN(e,t=!1){let n=e??window.location.pathname;if(t){window.location.assign(n);return}history.replaceState(null,"",n)}var st=q(me(),1),GL=q(io(),1);var rn=q(me(),1);var c5={damping:.7,stiffness:.05,mass:1.25},f5=70,d5=1e3/60,h5=350,fh=!1;globalThis.document?.addEventListener("mousedown",()=>{fh=!0});globalThis.document?.addEventListener("mouseup",()=>{fh=!1});globalThis.document?.addEventListener("click",()=>{fh=!1});var dh=(e={})=>{let[t,n]=(0,rn.useState)(!1),[r,i]=(0,rn.useState)(e.initial!==!1),[a,o]=(0,rn.useState)(!1),s=(0,rn.useRef)(null);s.current=e;let l=(0,rn.useCallback)(()=>{if(!fh)return!1;let y=window.getSelection();if(!y||!y.rangeCount)return!1;let T=y.getRangeAt(0);return T.commonAncestorContainer.contains(E.current)||E.current?.contains(T.commonAncestorContainer)},[]),u=(0,rn.useCallback)(y=>{f.isAtBottom=y,i(y)},[]),c=(0,rn.useCallback)(y=>{f.escapedFromLock=y,n(y)},[]),f=(0,rn.useMemo)(()=>{let y;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return E.current?.scrollTop??0},set scrollTop(T){E.current&&(E.current.scrollTop=T,f.ignoreScrollToTop=E.current.scrollTop)},get targetScrollTop(){return!E.current||!g.current?0:E.current.scrollHeight-1-E.current.clientHeight},get calculatedTargetScrollTop(){if(!E.current||!g.current)return 0;let{targetScrollTop:T}=this;if(!e.targetScrollTop)return T;if(y?.targetScrollTop===T)return y.calculatedScrollTop;let S=Math.max(Math.min(e.targetScrollTop(T,{scrollElement:E.current,contentElement:g.current}),T),0);return y={targetScrollTop:T,calculatedScrollTop:S},requestAnimationFrame(()=>{y=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=f5}}},[]),d=(0,rn.useCallback)((y={})=>{typeof y=="string"&&(y={animation:y}),y.preserveScrollPosition||u(!0);let T=Date.now()+(Number(y.wait)||0),S=Yb(s.current,y.animation),{ignoreEscapes:v=!1}=y,x,M=f.calculatedTargetScrollTop;y.duration instanceof Promise?y.duration.finally(()=>{x=Date.now()}):x=T+(y.duration??0);let R=async()=>{let L=new Promise(requestAnimationFrame).then(()=>{if(!f.isAtBottom)return f.animation=void 0,!1;let{scrollTop:A}=f,H=performance.now(),Y=(H-(f.lastTick??H))/d5;if(f.animation||(f.animation={behavior:S,promise:L,ignoreEscapes:v}),f.animation.behavior===S&&(f.lastTick=H),l()||T>Date.now())return R();if(ADate.now()?(M=f.calculatedTargetScrollTop,R()):(f.animation=void 0,f.scrollTop(requestAnimationFrame(()=>{f.animation||(f.lastTick=void 0,f.velocity=0)}),A))};return y.wait!==!0&&(f.animation=void 0),f.animation?.behavior===S?f.animation.promise:R()},[u,l,f]),h=(0,rn.useCallback)(()=>{c(!0),u(!1)},[c,u]),m=(0,rn.useCallback)(({target:y})=>{if(y!==E.current)return;let{scrollTop:T,ignoreScrollToTop:S}=f,{lastScrollTop:v=T}=f;f.lastScrollTop=T,f.ignoreScrollToTop=void 0,S&&S>T&&(v=S),o(f.isNearBottom),setTimeout(()=>{if(f.resizeDifference||T===S)return;if(l()){c(!0),u(!1);return}let x=T>v,M=T{let S=y;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===E.current&&T<0&&E.current.scrollHeight>E.current.clientHeight&&!f.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,f]),E=CN(y=>{E.current?.removeEventListener("scroll",m),E.current?.removeEventListener("wheel",b),y?.addEventListener("scroll",m,{passive:!0}),y?.addEventListener("wheel",b,{passive:!0})},[]),g=CN(y=>{if(f.resizeObserver?.disconnect(),!y)return;let T;f.resizeObserver=new ResizeObserver(([S])=>{let{height:v}=S.contentRect,x=v-(T??v);if(f.resizeDifference=x,f.scrollTop>f.targetScrollTop&&(f.scrollTop=f.targetScrollTop),o(f.isNearBottom),x>=0){let M=Yb(s.current,T?s.current.resize:s.current.initial);d({animation:M,wait:!0,preserveScrollPosition:!0,duration:M==="instant"?void 0:h5})}else f.isNearBottom&&(c(!1),u(!0));T=v,requestAnimationFrame(()=>{setTimeout(()=>{f.resizeDifference===x&&(f.resizeDifference=0)},1)})}),f.resizeObserver?.observe(y)},[]);return{contentRef:g,scrollRef:E,scrollToBottom:d,stopScroll:h,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:f}};function CN(e,t){let n=(0,rn.useCallback)(r=>(n.current=r,e(r)),t);return n}var Gb=new Map;function Yb(...e){let t={...c5},n=!1;for(let i of e){if(i==="instant"){n=!0;continue}typeof i=="object"&&(n=!1,t.damping=i.damping??t.damping,t.stiffness=i.stiffness??t.stiffness,t.mass=i.mass??t.mass)}let r=JSON.stringify(t);return Gb.has(r)||Gb.set(r,Object.freeze(t)),n?"instant":Gb.get(r)}var gs=q(me(),1);var Je=q(me(),1);var zi=q(me(),1);var hh=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Di=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Di.prototype.normal={};Di.prototype.property={};Di.prototype.space=void 0;function Kb(e,t){let n={},r={};for(let i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Di(n,r,t)}function Ii(e){return e.toLowerCase()}var Gt=class{constructor(t,n){this.attribute=n,this.property=t}};Gt.prototype.attribute="";Gt.prototype.booleanish=!1;Gt.prototype.boolean=!1;Gt.prototype.commaOrSpaceSeparated=!1;Gt.prototype.commaSeparated=!1;Gt.prototype.defined=!1;Gt.prototype.mustUseProperty=!1;Gt.prototype.number=!1;Gt.prototype.overloadedBoolean=!1;Gt.prototype.property="";Gt.prototype.spaceSeparated=!1;Gt.prototype.space=void 0;var ac={};wf(ac,{boolean:()=>xe,booleanish:()=>yt,commaOrSpaceSeparated:()=>Pn,commaSeparated:()=>Oa,number:()=>Z,overloadedBoolean:()=>ph,spaceSeparated:()=>qe});var p5=0,xe=vo(),yt=vo(),ph=vo(),Z=vo(),qe=vo(),Oa=vo(),Pn=vo();function vo(){return 2**++p5}var $b=Object.keys(ac),ko=class extends Gt{constructor(t,n,r,i){let a=-1;if(super(t,n),NN(this,"space",i),typeof r=="number")for(;++a<$b.length;){let o=$b[a];NN(this,$b[a],(r&ac[o])===ac[o])}}};ko.prototype.defined=!0;function NN(e,t,n){n&&(e[t]=n)}function _r(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ko(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ii(r)]=r,n[Ii(a.attribute)]=r}return new Di(t,n,e.space)}var jb=_r({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:qe,ariaCurrent:null,ariaDescribedBy:qe,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:qe,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:qe,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qe,ariaLevel:Z,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:qe,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:qe,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:yt,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mh(e,t){return t in e?e[t]:t}function gh(e,t){return mh(e,t.toLowerCase())}var vN=_r({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oa,acceptCharset:qe,accessKey:qe,action:null,allow:null,allowFullScreen:xe,allowPaymentRequest:xe,allowUserMedia:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:qe,autoFocus:xe,autoPlay:xe,blocking:qe,capture:null,charSet:null,checked:xe,cite:null,className:qe,cols:Z,colSpan:null,content:null,contentEditable:yt,controls:xe,controlsList:qe,coords:Z|Oa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:ph,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:qe,height:Z,hidden:ph,high:Z,href:null,hrefLang:null,htmlFor:qe,httpEquiv:qe,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:qe,itemRef:qe,itemScope:xe,itemType:qe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:xe,optimum:Z,pattern:null,ping:qe,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:qe,required:xe,reversed:xe,rows:Z,rowSpan:Z,sandbox:qe,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:yt,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qe,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xe,disableRemotePlayback:xe,prefix:null,property:null,results:Z,security:null,unselectable:null},space:"html",transform:gh});var kN=_r({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Pn,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:qe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oa,g2:Oa,glyphName:Oa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:Pn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Pn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Pn,rev:Pn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Pn,requiredFeatures:Pn,requiredFonts:Pn,requiredFormats:Pn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:Pn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Pn,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Pn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mh});var Xb=_r({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var Wb=_r({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gh});var Qb=_r({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Zb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var m5=/[A-Z]/g,wN=/-[a-z]/g,g5=/^data[-\w.:]+$/i;function Dr(e,t){let n=Ii(t),r=t,i=Gt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&g5.test(t)){if(t.charAt(4)==="-"){let a=t.slice(5).replace(wN,E5);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=t.slice(4);if(!wN.test(a)){let o=a.replace(m5,b5);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=ko}return new i(r,t)}function b5(e){return"-"+e.toLowerCase()}function E5(e){return e.charAt(1).toUpperCase()}var Ir=Kb([jb,vN,Xb,Wb,Qb],"html"),cn=Kb([jb,kN,Xb,Wb,Qb],"svg");var MN={}.hasOwnProperty;function cl(e,t){let n=t||{};function r(i,...a){let o=r.invalid,s=r.handlers;if(i&&MN.call(i,e)){let l=String(i[e]);o=MN.call(s,l)?s[l]:r.unknown}if(o)return o.call(this,i,...a)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var y5=/["&'<>`]/g,T5=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,S5=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,_5=/[|\\{}()[\]^$+*?.]/g,ON=new WeakMap;function RN(e,t){if(e=e.replace(t.subset?x5(t.subset):y5,r),t.subset||t.escapeOnly)return e;return e.replace(T5,n).replace(S5,r);function n(i,a,o){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),t)}function r(i,a,o){return t.format(i.charCodeAt(0),o.charCodeAt(a+1),t)}}function x5(e){let t=ON.get(e);return t||(t=A5(e),ON.set(e,t)),t}function A5(e){let t=[],n=-1;for(;++n",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var BN=["cent","copy","divide","gt","lt","not","para","times"];var PN={}.hasOwnProperty,Jb={},Eh;for(Eh in bh)PN.call(bh,Eh)&&(Jb[bh[Eh]]=Eh);var v5=/[^\dA-Za-z]/;function UN(e,t,n,r){let i=String.fromCharCode(e);if(PN.call(Jb,i)){let a=Jb[i],o="&"+a;return n&&LN.includes(a)&&!BN.includes(a)&&(!r||t&&t!==61&&v5.test(String.fromCharCode(t)))?o:o+";"}return""}function HN(e,t,n){let r=DN(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=UN(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let a=IN(e,t,n.omitOptionalSemicolons);a.length|^->||--!>|"],M5=["<",">"];function zN(e,t,n,r){return r.settings.bogusComments?"":"";function i(a){return Li(a,Object.assign({},r.settings.characterReferences,{subset:M5}))}}function FN(e,t,n,r){return""}function fl(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function eE(e){let t=[],n=String(e||""),r=n.indexOf(","),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let o=n.slice(i,r).trim();(o||!a)&&t.push(o),i=r+1,r=n.indexOf(",",i)}return t}function dl(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function tE(e){let t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function hl(e){return e.join(" ").trim()}var O5=/[ \t\n\f\r]/g;function Bi(e){return typeof e=="object"?e.type==="text"?qN(e.value):!1:qN(e)}function qN(e){return e.replace(O5,"")===""}var Nt=VN(1),nE=VN(-1),R5=[];function VN(e){return t;function t(n,r,i){let a=n?n.children:R5,o=(r||0)+e,s=a[o];if(!i)for(;s&&Bi(s);)o+=e,s=a[o];return s}}var D5={}.hasOwnProperty;function yh(e){return t;function t(n,r,i){return D5.call(e,n.tagName)&&e[n.tagName](n,r,i)}}var oc=yh({body:L5,caption:rE,colgroup:rE,dd:H5,dt:U5,head:rE,html:I5,li:P5,optgroup:z5,option:F5,p:B5,rp:GN,rt:GN,tbody:V5,td:YN,tfoot:G5,th:YN,thead:q5,tr:Y5});function rE(e,t,n){let r=Nt(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Bi(r.value.charAt(0)))}function I5(e,t,n){let r=Nt(n,t);return!r||r.type!=="comment"}function L5(e,t,n){let r=Nt(n,t);return!r||r.type!=="comment"}function B5(e,t,n){let r=Nt(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function P5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&r.tagName==="li"}function U5(e,t,n){let r=Nt(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function H5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function GN(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function z5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function F5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function q5(e,t,n){let r=Nt(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function V5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function G5(e,t,n){return!Nt(n,t)}function Y5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function YN(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var KN=yh({body:j5,colgroup:X5,head:$5,html:K5,tbody:W5});function K5(e){let t=Nt(e,-1);return!t||t.type!=="comment"}function $5(e){let t=new Set;for(let r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}let n=e.children[0];return!n||n.type==="element"}function j5(e){let t=Nt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Bi(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function X5(e,t,n){let r=nE(n,t),i=Nt(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&oc(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function W5(e,t,n){let r=nE(n,t),i=Nt(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&oc(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var Th={name:[[` +`));let i="",a=o5.exec(n),o=s5.exec(n),s=a&&o?a.index>o.index?a:o:a||o;return s&&s[0]&&(i=s[0],n=n.slice(0,s.index)),{cleaned:n,topic:r,buffer:i}}function bN(e,t){switch(t.type){case"INPUT_SENT":{let n={id:Sr(),role:"user",content:t.content,streaming:!1,...t.attachments&&t.attachments.length>0?{attachments:t.attachments}:{},blocks:[{type:"content",content:t.content,contentType:"markdown"}]};if(t.awaitResponse===!1)return{...e,messages:[...e.messages,n],greeting:lh(e.greeting)};let r={id:Sr(),role:"assistant",content:"",streaming:!1,isPlaceholder:!0,blocks:[]};return{...e,messages:[...e.messages,n,r],inputDisabled:!0,greeting:lh(e.greeting)}}case"message":{let n=sh(e.messages),r=uN(t.message);return t.html_deps&&(r.htmlDeps=t.html_deps),{...e,messages:[...n,r],streamingMessage:null,inputDisabled:!1,greeting:lh(e.greeting)}}case"chunk_start":{let n=sh(e.messages),r=uN(t.message);return r.streaming=!0,r.blocks=r.blocks.map(i=>i.type==="thinking"?{...i,streaming:!0}:i),t.html_deps&&(r.htmlDeps=t.html_deps),{...e,messages:n,streamingMessage:r,inputDisabled:!0,greeting:lh(e.greeting)}}case"chunk":{let n=e.streamingMessage;if(!n||!n.streaming)return e;let r=t.content_type,i=n.blocks[n.blocks.length-1],a=(i?.type==="content"?i.contentType:void 0)??"markdown";if(r==="thinking"){let u=[...n.blocks],c=i?.type==="thinking"&&i.streaming?i:null;if(c){let{cleaned:f,topic:d,buffer:h}=uh(t.content,c.topicBuffer??"");u[u.length-1]={...c,content:c.content+f,topicBuffer:h,...d!==null?{topic:d}:{}}}else{let{cleaned:f,topic:d,buffer:h}=uh(t.content,"");u.push({type:"thinking",content:f,topicBuffer:h,streaming:!0,startedAt:Date.now(),...d!==null?{topic:d}:{}})}return{...e,streamingMessage:{...n,blocks:u,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}let o=r??a;if(n.insideThinkingTag||n.tagBuffer||n.insideFence||t.content.includes("<")||t.content.includes("```")||t.content.includes("~~~")){let u={insideThinkingTag:n.insideThinkingTag??!1,tagBuffer:n.tagBuffer??"",insideFence:n.insideFence??!1,fenceMarker:n.fenceMarker??""},{segments:c,state:f}=a5(t.content,u,i5(n.blocks)),d=!!(n.insideThinkingTag||n.tagBuffer||n.insideFence),h=c.some(E=>E.type==="thinking"),m=f.insideThinkingTag,b=f.insideFence!==(n.insideFence??!1);if(d||h||m||b){let E=[...n.blocks];for(let y of c)if(y.type==="thinking"){let T=E[E.length-1];if(T?.type==="thinking"&&T.streaming){let{cleaned:S,topic:v,buffer:x}=uh(y.text,T.topicBuffer??"");E[E.length-1]={...T,content:T.content+S,topicBuffer:x,...v!==null?{topic:v}:{}}}else{let{cleaned:S,topic:v,buffer:x}=uh(y.text,"");E.push({type:"thinking",content:S,topicBuffer:x,streaming:!0,startedAt:Date.now(),...v!==null?{topic:v}:{}})}}else{let T=E[E.length-1];T?.type==="thinking"&&T.streaming&&(E[E.length-1]={...T,content:T.content+(T.topicBuffer??""),topicBuffer:"",streaming:!1,durationMs:T.startedAt?Date.now()-T.startedAt:void 0});let S=E[E.length-1];S?.type==="content"&&S.contentType===o?E[E.length-1]={...S,content:S.content+y.text}:y.text&&E.push({type:"content",content:y.text,contentType:o})}let g=E.filter(y=>y.type==="content").map(y=>y.content).join("");return{...e,streamingMessage:{...n,content:g,blocks:E,insideThinkingTag:f.insideThinkingTag,tagBuffer:f.tagBuffer,insideFence:f.insideFence,fenceMarker:f.fenceMarker,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}if(f.tagBuffer)return{...e,streamingMessage:{...n,insideThinkingTag:f.insideThinkingTag,tagBuffer:f.tagBuffer,insideFence:f.insideFence,fenceMarker:f.fenceMarker,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}let s=[...n.blocks];if(i?.type==="thinking"&&i.streaming&&(s[s.length-1]={...i,content:i.content+(i.topicBuffer??""),topicBuffer:"",streaming:!1,durationMs:i.startedAt?Date.now()-i.startedAt:void 0}),t.operation==="replace"){let u=s.filter(c=>c.type==="thinking");return u.push({type:"content",content:t.content,contentType:o}),{...e,streamingMessage:{...n,content:t.content,blocks:u,htmlDeps:ic(n.htmlDeps,t.html_deps)}}}else{let u=s[s.length-1];u?.type==="content"&&u.contentType===o?s[s.length-1]={...u,content:u.content+t.content}:s.push({type:"content",content:t.content,contentType:o})}let l=s.filter(u=>u.type==="content").map(u=>u.content).join("");return{...e,streamingMessage:{...n,content:l,blocks:s,insideThinkingTag:!1,tagBuffer:"",htmlDeps:ic(n.htmlDeps,t.html_deps)}}}case"chunk_end":{let n=e.streamingMessage;if(!n||!n.streaming){if(e.cancelRequested){let a=sh(e.messages),o={id:Sr(),role:"assistant",content:"",streaming:!1,cancelled:!0,blocks:[]};return{...e,messages:[...a,o],streamingMessage:null,inputDisabled:!1,cancelRequested:!1}}return e}let r=pN(n),i=e.cancelRequested?{...r,cancelled:!0}:r;return{...e,messages:[...e.messages,i],streamingMessage:null,inputDisabled:!1,cancelRequested:!1}}case"CANCEL_REQUESTED":return{...e,cancelRequested:!0};case"update_cancel":return e.enableCancelExplicit?e:{...e,enableCancel:t.enable_cancel};case"update_upload":return e.enableUploadExplicit?e:{...e,enableUpload:t.enable_upload};case"clear":{let n=t.greeting?null:e.greeting?{...e.greeting,status:"visible"}:null;return{...wa,inputPlaceholder:e.inputPlaceholder,greeting:n,enableCancel:e.enableCancel,enableCancelExplicit:e.enableCancelExplicit,slashCommands:e.slashCommands,enableUpload:e.enableUpload,enableUploadExplicit:e.enableUploadExplicit,history:e.history}}case"update_input":return{...e,inputPlaceholder:t.placeholder??e.inputPlaceholder};case"remove_loading":{let n=sh(e.messages);if(e.streamingMessage){let r=pN(e.streamingMessage),i=e.cancelRequested?{...r,cancelled:!0}:r;n.push(i)}return{...e,messages:n,streamingMessage:null,inputDisabled:!1,cancelRequested:!1}}case"hide_tool_request":{if(e.hiddenToolRequests.has(t.requestId))return e;let n=new Set(e.hiddenToolRequests);return n.add(t.requestId),{...e,hiddenToolRequests:n}}case"greeting":{let n=t.options.persistent===!0,r=cN(e.greeting,n,e.messages.length>0);return{...e,greeting:{content:t.content,contentType:t.content_type,streaming:!1,status:r,options:t.options,blocks:[{type:"content",content:t.content,contentType:t.content_type}]}}}case"greeting_start":{let n=t.options.persistent===!0,r=cN(e.greeting,n,e.messages.length>0);return{...e,greeting:{content:t.content,contentType:t.content_type,streaming:!0,status:r,options:t.options,blocks:t.content?[{type:"content",content:t.content,contentType:t.content_type}]:[]}}}case"greeting_dismissed":{let n=e.greeting;return!n||n.status!=="dismissing"?e:{...e,greeting:{...n,status:"dismissed"}}}case"greeting_chunk":{let n=e.greeting;if(!n||!n.streaming)return e;let r=t.content_type??n.contentType,i;if(t.operation==="replace")i=[{type:"content",content:t.content,contentType:r}];else{let o=[...n.blocks],s=o[o.length-1];s&&s.contentType===r?(o[o.length-1]={...s,content:s.content+t.content},i=o):i=[...o,{type:"content",content:t.content,contentType:r}]}let a=i.map(o=>o.content).join("");return{...e,greeting:{...n,content:a,contentType:r,blocks:i}}}case"greeting_end":{let n=e.greeting;return n?.streaming?n.content?{...e,greeting:{...n,streaming:!1}}:{...e,greeting:null}:e}case"greeting_clear":return{...e,greeting:null};case"update_slash_commands":return{...e,slashCommands:t.commands};case"history_update":return{...e,history:{enabled:t.enabled,conversations:t.conversations,activeId:t.active_id}};case"history_navigate":return e;case"update_siblings":{let n=e.messages.map((r,i)=>{let a=t.data[i];return a?{...r,siblings:a}:r.siblings?{...r,siblings:void 0}:r});return{...e,messages:n}}default:{let n=t;return e}}}function l5(e){return e.type==="thinking"?{content:e.content,content_type:"thinking"}:{content:e.content,content_type:e.contentType}}function Pb(e){return e.messages.filter(t=>!t.isPlaceholder&&!t.streaming&&!t.fromMarkup).map(t=>{let n={role:t.role,segments:t.blocks.map(l5)};return t.attachments&&t.attachments.length>0&&(n.attachments=t.attachments),t.htmlDeps&&t.htmlDeps.length>0&&(n.htmlDeps=t.htmlDeps),n})}function pN(e){let t=[];for(let r of e.blocks)r.type==="thinking"&&r.streaming?t.push({...r,content:r.content+(r.topicBuffer??""),topicBuffer:"",streaming:!1,durationMs:r.startedAt?Date.now()-r.startedAt:void 0}):r.type==="content"&&Bb.test(r.content)?(Bb.lastIndex=0,t.push(...mN(r.content,r.contentType))):t.push(r);let n=t.filter(r=>r.type==="content").map(r=>r.content).join("");return{...e,content:n,streaming:!1,blocks:t}}var Ma=(0,lr.createContext)(null),Ub=(0,lr.createContext)(null);function EN(){return(0,lr.useContext)(Ub)}var u5={hiddenToolRequests:wa.hiddenToolRequests},Hb=(0,lr.createContext)(u5),No=(0,lr.createContext)(null),zb=(0,lr.createContext)(null),Fb=(0,lr.createContext)([]);function yN(){return(0,lr.useContext)(Hb)}function ch(){let e=(0,lr.useContext)(No);if(!e)throw new Error("useChatDispatch must be used within a ChatDispatchContext.Provider");return e}function TN(){let e=(0,lr.useContext)(zb);if(e===null)throw new Error("useChatSubmit must be used within a ChatSubmitContext.Provider");return e}function SN(){return(0,lr.useContext)(Fb)}var qb="shinychat-current",c5="shinychat_conversation_id";function _N(){try{return new URLSearchParams(window.location.search).get(c5)}catch{return null}}function xN(e){try{return localStorage.getItem(`${qb}:${e}`)}catch{return null}}function Vb(e,t){try{t===null?localStorage.removeItem(`${qb}:${e}`):localStorage.setItem(`${qb}:${e}`,t)}catch{}}function AN(e,t=!1){let n=e??window.location.pathname;if(t){window.location.assign(n);return}history.replaceState(null,"",n)}var st=q(me(),1),YL=q(io(),1);var rn=q(me(),1);var f5={damping:.7,stiffness:.05,mass:1.25},d5=70,h5=1e3/60,p5=350,fh=!1;globalThis.document?.addEventListener("mousedown",()=>{fh=!0});globalThis.document?.addEventListener("mouseup",()=>{fh=!1});globalThis.document?.addEventListener("click",()=>{fh=!1});var dh=(e={})=>{let[t,n]=(0,rn.useState)(!1),[r,i]=(0,rn.useState)(e.initial!==!1),[a,o]=(0,rn.useState)(!1),s=(0,rn.useRef)(null);s.current=e;let l=(0,rn.useCallback)(()=>{if(!fh)return!1;let y=window.getSelection();if(!y||!y.rangeCount)return!1;let T=y.getRangeAt(0);return T.commonAncestorContainer.contains(E.current)||E.current?.contains(T.commonAncestorContainer)},[]),u=(0,rn.useCallback)(y=>{f.isAtBottom=y,i(y)},[]),c=(0,rn.useCallback)(y=>{f.escapedFromLock=y,n(y)},[]),f=(0,rn.useMemo)(()=>{let y;return{escapedFromLock:t,isAtBottom:r,resizeDifference:0,accumulated:0,velocity:0,listeners:new Set,get scrollTop(){return E.current?.scrollTop??0},set scrollTop(T){E.current&&(E.current.scrollTop=T,f.ignoreScrollToTop=E.current.scrollTop)},get targetScrollTop(){return!E.current||!g.current?0:E.current.scrollHeight-1-E.current.clientHeight},get calculatedTargetScrollTop(){if(!E.current||!g.current)return 0;let{targetScrollTop:T}=this;if(!e.targetScrollTop)return T;if(y?.targetScrollTop===T)return y.calculatedScrollTop;let S=Math.max(Math.min(e.targetScrollTop(T,{scrollElement:E.current,contentElement:g.current}),T),0);return y={targetScrollTop:T,calculatedScrollTop:S},requestAnimationFrame(()=>{y=void 0}),S},get scrollDifference(){return this.calculatedTargetScrollTop-this.scrollTop},get isNearBottom(){return this.scrollDifference<=d5}}},[]),d=(0,rn.useCallback)((y={})=>{typeof y=="string"&&(y={animation:y}),y.preserveScrollPosition||u(!0);let T=Date.now()+(Number(y.wait)||0),S=Yb(s.current,y.animation),{ignoreEscapes:v=!1}=y,x,M=f.calculatedTargetScrollTop;y.duration instanceof Promise?y.duration.finally(()=>{x=Date.now()}):x=T+(y.duration??0);let R=async()=>{let L=new Promise(requestAnimationFrame).then(()=>{if(!f.isAtBottom)return f.animation=void 0,!1;let{scrollTop:A}=f,H=performance.now(),Y=(H-(f.lastTick??H))/h5;if(f.animation||(f.animation={behavior:S,promise:L,ignoreEscapes:v}),f.animation.behavior===S&&(f.lastTick=H),l()||T>Date.now())return R();if(ADate.now()?(M=f.calculatedTargetScrollTop,R()):(f.animation=void 0,f.scrollTop(requestAnimationFrame(()=>{f.animation||(f.lastTick=void 0,f.velocity=0)}),A))};return y.wait!==!0&&(f.animation=void 0),f.animation?.behavior===S?f.animation.promise:R()},[u,l,f]),h=(0,rn.useCallback)(()=>{c(!0),u(!1)},[c,u]),m=(0,rn.useCallback)(({target:y})=>{if(y!==E.current)return;let{scrollTop:T,ignoreScrollToTop:S}=f,{lastScrollTop:v=T}=f;f.lastScrollTop=T,f.ignoreScrollToTop=void 0,S&&S>T&&(v=S),o(f.isNearBottom),setTimeout(()=>{if(f.resizeDifference||T===S)return;if(l()){c(!0),u(!1);return}let x=T>v,M=T{let S=y;for(;!["scroll","auto"].includes(getComputedStyle(S).overflow);){if(!S.parentElement)return;S=S.parentElement}S===E.current&&T<0&&E.current.scrollHeight>E.current.clientHeight&&!f.animation?.ignoreEscapes&&(c(!0),u(!1))},[c,u,f]),E=CN(y=>{E.current?.removeEventListener("scroll",m),E.current?.removeEventListener("wheel",b),y?.addEventListener("scroll",m,{passive:!0}),y?.addEventListener("wheel",b,{passive:!0})},[]),g=CN(y=>{if(f.resizeObserver?.disconnect(),!y)return;let T;f.resizeObserver=new ResizeObserver(([S])=>{let{height:v}=S.contentRect,x=v-(T??v);if(f.resizeDifference=x,f.scrollTop>f.targetScrollTop&&(f.scrollTop=f.targetScrollTop),o(f.isNearBottom),x>=0){let M=Yb(s.current,T?s.current.resize:s.current.initial);d({animation:M,wait:!0,preserveScrollPosition:!0,duration:M==="instant"?void 0:p5})}else f.isNearBottom&&(c(!1),u(!0));T=v,requestAnimationFrame(()=>{setTimeout(()=>{f.resizeDifference===x&&(f.resizeDifference=0)},1)})}),f.resizeObserver?.observe(y)},[]);return{contentRef:g,scrollRef:E,scrollToBottom:d,stopScroll:h,isAtBottom:r||a,isNearBottom:a,escapedFromLock:t,state:f}};function CN(e,t){let n=(0,rn.useCallback)(r=>(n.current=r,e(r)),t);return n}var Gb=new Map;function Yb(...e){let t={...f5},n=!1;for(let i of e){if(i==="instant"){n=!0;continue}typeof i=="object"&&(n=!1,t.damping=i.damping??t.damping,t.stiffness=i.stiffness??t.stiffness,t.mass=i.mass??t.mass)}let r=JSON.stringify(t);return Gb.has(r)||Gb.set(r,Object.freeze(t)),n?"instant":Gb.get(r)}var gs=q(me(),1);var Je=q(me(),1);var zi=q(me(),1);var hh=["area","base","basefont","bgsound","br","col","command","embed","frame","hr","image","img","input","keygen","link","meta","param","source","track","wbr"];var Di=class{constructor(t,n,r){this.normal=n,this.property=t,r&&(this.space=r)}};Di.prototype.normal={};Di.prototype.property={};Di.prototype.space=void 0;function Kb(e,t){let n={},r={};for(let i of e)Object.assign(n,i.property),Object.assign(r,i.normal);return new Di(n,r,t)}function Ii(e){return e.toLowerCase()}var Gt=class{constructor(t,n){this.attribute=n,this.property=t}};Gt.prototype.attribute="";Gt.prototype.booleanish=!1;Gt.prototype.boolean=!1;Gt.prototype.commaOrSpaceSeparated=!1;Gt.prototype.commaSeparated=!1;Gt.prototype.defined=!1;Gt.prototype.mustUseProperty=!1;Gt.prototype.number=!1;Gt.prototype.overloadedBoolean=!1;Gt.prototype.property="";Gt.prototype.spaceSeparated=!1;Gt.prototype.space=void 0;var ac={};wf(ac,{boolean:()=>xe,booleanish:()=>yt,commaOrSpaceSeparated:()=>Pn,commaSeparated:()=>Oa,number:()=>Z,overloadedBoolean:()=>ph,spaceSeparated:()=>qe});var m5=0,xe=vo(),yt=vo(),ph=vo(),Z=vo(),qe=vo(),Oa=vo(),Pn=vo();function vo(){return 2**++m5}var $b=Object.keys(ac),ko=class extends Gt{constructor(t,n,r,i){let a=-1;if(super(t,n),NN(this,"space",i),typeof r=="number")for(;++a<$b.length;){let o=$b[a];NN(this,$b[a],(r&ac[o])===ac[o])}}};ko.prototype.defined=!0;function NN(e,t,n){n&&(e[t]=n)}function _r(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new ko(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[Ii(r)]=r,n[Ii(a.attribute)]=r}return new Di(t,n,e.space)}var jb=_r({properties:{ariaActiveDescendant:null,ariaAtomic:yt,ariaAutoComplete:null,ariaBusy:yt,ariaChecked:yt,ariaColCount:Z,ariaColIndex:Z,ariaColSpan:Z,ariaControls:qe,ariaCurrent:null,ariaDescribedBy:qe,ariaDetails:null,ariaDisabled:yt,ariaDropEffect:qe,ariaErrorMessage:null,ariaExpanded:yt,ariaFlowTo:qe,ariaGrabbed:yt,ariaHasPopup:null,ariaHidden:yt,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:qe,ariaLevel:Z,ariaLive:null,ariaModal:yt,ariaMultiLine:yt,ariaMultiSelectable:yt,ariaOrientation:null,ariaOwns:qe,ariaPlaceholder:null,ariaPosInSet:Z,ariaPressed:yt,ariaReadOnly:yt,ariaRelevant:null,ariaRequired:yt,ariaRoleDescription:qe,ariaRowCount:Z,ariaRowIndex:Z,ariaRowSpan:Z,ariaSelected:yt,ariaSetSize:Z,ariaSort:null,ariaValueMax:Z,ariaValueMin:Z,ariaValueNow:Z,ariaValueText:null,role:null},transform(e,t){return t==="role"?t:"aria-"+t.slice(4).toLowerCase()}});function mh(e,t){return t in e?e[t]:t}function gh(e,t){return mh(e,t.toLowerCase())}var vN=_r({attributes:{acceptcharset:"accept-charset",classname:"class",htmlfor:"for",httpequiv:"http-equiv"},mustUseProperty:["checked","multiple","muted","selected"],properties:{abbr:null,accept:Oa,acceptCharset:qe,accessKey:qe,action:null,allow:null,allowFullScreen:xe,allowPaymentRequest:xe,allowUserMedia:xe,alt:null,as:null,async:xe,autoCapitalize:null,autoComplete:qe,autoFocus:xe,autoPlay:xe,blocking:qe,capture:null,charSet:null,checked:xe,cite:null,className:qe,cols:Z,colSpan:null,content:null,contentEditable:yt,controls:xe,controlsList:qe,coords:Z|Oa,crossOrigin:null,data:null,dateTime:null,decoding:null,default:xe,defer:xe,dir:null,dirName:null,disabled:xe,download:ph,draggable:yt,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:xe,formTarget:null,headers:qe,height:Z,hidden:ph,high:Z,href:null,hrefLang:null,htmlFor:qe,httpEquiv:qe,id:null,imageSizes:null,imageSrcSet:null,inert:xe,inputMode:null,integrity:null,is:null,isMap:xe,itemId:null,itemProp:qe,itemRef:qe,itemScope:xe,itemType:qe,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:xe,low:Z,manifest:null,max:null,maxLength:Z,media:null,method:null,min:null,minLength:Z,multiple:xe,muted:xe,name:null,nonce:null,noModule:xe,noValidate:xe,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:xe,optimum:Z,pattern:null,ping:qe,placeholder:null,playsInline:xe,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:xe,referrerPolicy:null,rel:qe,required:xe,reversed:xe,rows:Z,rowSpan:Z,sandbox:qe,scope:null,scoped:xe,seamless:xe,selected:xe,shadowRootClonable:xe,shadowRootDelegatesFocus:xe,shadowRootMode:null,shape:null,size:Z,sizes:null,slot:null,span:Z,spellCheck:yt,src:null,srcDoc:null,srcLang:null,srcSet:null,start:Z,step:null,style:null,tabIndex:Z,target:null,title:null,translate:null,type:null,typeMustMatch:xe,useMap:null,value:yt,width:Z,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:qe,axis:null,background:null,bgColor:null,border:Z,borderColor:null,bottomMargin:Z,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:xe,declare:xe,event:null,face:null,frame:null,frameBorder:null,hSpace:Z,leftMargin:Z,link:null,longDesc:null,lowSrc:null,marginHeight:Z,marginWidth:Z,noResize:xe,noHref:xe,noShade:xe,noWrap:xe,object:null,profile:null,prompt:null,rev:null,rightMargin:Z,rules:null,scheme:null,scrolling:yt,standby:null,summary:null,text:null,topMargin:Z,valueType:null,version:null,vAlign:null,vLink:null,vSpace:Z,allowTransparency:null,autoCorrect:null,autoSave:null,disablePictureInPicture:xe,disableRemotePlayback:xe,prefix:null,property:null,results:Z,security:null,unselectable:null},space:"html",transform:gh});var kN=_r({attributes:{accentHeight:"accent-height",alignmentBaseline:"alignment-baseline",arabicForm:"arabic-form",baselineShift:"baseline-shift",capHeight:"cap-height",className:"class",clipPath:"clip-path",clipRule:"clip-rule",colorInterpolation:"color-interpolation",colorInterpolationFilters:"color-interpolation-filters",colorProfile:"color-profile",colorRendering:"color-rendering",crossOrigin:"crossorigin",dataType:"datatype",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",hrefLang:"hreflang",horizAdvX:"horiz-adv-x",horizOriginX:"horiz-origin-x",horizOriginY:"horiz-origin-y",imageRendering:"image-rendering",letterSpacing:"letter-spacing",lightingColor:"lighting-color",markerEnd:"marker-end",markerMid:"marker-mid",markerStart:"marker-start",navDown:"nav-down",navDownLeft:"nav-down-left",navDownRight:"nav-down-right",navLeft:"nav-left",navNext:"nav-next",navPrev:"nav-prev",navRight:"nav-right",navUp:"nav-up",navUpLeft:"nav-up-left",navUpRight:"nav-up-right",onAbort:"onabort",onActivate:"onactivate",onAfterPrint:"onafterprint",onBeforePrint:"onbeforeprint",onBegin:"onbegin",onCancel:"oncancel",onCanPlay:"oncanplay",onCanPlayThrough:"oncanplaythrough",onChange:"onchange",onClick:"onclick",onClose:"onclose",onCopy:"oncopy",onCueChange:"oncuechange",onCut:"oncut",onDblClick:"ondblclick",onDrag:"ondrag",onDragEnd:"ondragend",onDragEnter:"ondragenter",onDragExit:"ondragexit",onDragLeave:"ondragleave",onDragOver:"ondragover",onDragStart:"ondragstart",onDrop:"ondrop",onDurationChange:"ondurationchange",onEmptied:"onemptied",onEnd:"onend",onEnded:"onended",onError:"onerror",onFocus:"onfocus",onFocusIn:"onfocusin",onFocusOut:"onfocusout",onHashChange:"onhashchange",onInput:"oninput",onInvalid:"oninvalid",onKeyDown:"onkeydown",onKeyPress:"onkeypress",onKeyUp:"onkeyup",onLoad:"onload",onLoadedData:"onloadeddata",onLoadedMetadata:"onloadedmetadata",onLoadStart:"onloadstart",onMessage:"onmessage",onMouseDown:"onmousedown",onMouseEnter:"onmouseenter",onMouseLeave:"onmouseleave",onMouseMove:"onmousemove",onMouseOut:"onmouseout",onMouseOver:"onmouseover",onMouseUp:"onmouseup",onMouseWheel:"onmousewheel",onOffline:"onoffline",onOnline:"ononline",onPageHide:"onpagehide",onPageShow:"onpageshow",onPaste:"onpaste",onPause:"onpause",onPlay:"onplay",onPlaying:"onplaying",onPopState:"onpopstate",onProgress:"onprogress",onRateChange:"onratechange",onRepeat:"onrepeat",onReset:"onreset",onResize:"onresize",onScroll:"onscroll",onSeeked:"onseeked",onSeeking:"onseeking",onSelect:"onselect",onShow:"onshow",onStalled:"onstalled",onStorage:"onstorage",onSubmit:"onsubmit",onSuspend:"onsuspend",onTimeUpdate:"ontimeupdate",onToggle:"ontoggle",onUnload:"onunload",onVolumeChange:"onvolumechange",onWaiting:"onwaiting",onZoom:"onzoom",overlinePosition:"overline-position",overlineThickness:"overline-thickness",paintOrder:"paint-order",panose1:"panose-1",pointerEvents:"pointer-events",referrerPolicy:"referrerpolicy",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",tabIndex:"tabindex",textAnchor:"text-anchor",textDecoration:"text-decoration",textRendering:"text-rendering",transformOrigin:"transform-origin",typeOf:"typeof",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",xHeight:"x-height",playbackOrder:"playbackorder",timelineBegin:"timelinebegin"},properties:{about:Pn,accentHeight:Z,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:Z,amplitude:Z,arabicForm:null,ascent:Z,attributeName:null,attributeType:null,azimuth:Z,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:Z,by:null,calcMode:null,capHeight:Z,className:qe,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:Z,diffuseConstant:Z,direction:null,display:null,dur:null,divisor:Z,dominantBaseline:null,download:xe,dx:null,dy:null,edgeMode:null,editable:null,elevation:Z,enableBackground:null,end:null,event:null,exponent:Z,externalResourcesRequired:null,fill:null,fillOpacity:Z,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Oa,g2:Oa,glyphName:Oa,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:Z,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:Z,horizOriginX:Z,horizOriginY:Z,id:null,ideographic:Z,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:Z,k:Z,k1:Z,k2:Z,k3:Z,k4:Z,kernelMatrix:Pn,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:Z,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:Z,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:Z,overlineThickness:Z,paintOrder:null,panose1:null,path:null,pathLength:Z,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:qe,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:Z,pointsAtY:Z,pointsAtZ:Z,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Pn,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Pn,rev:Pn,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Pn,requiredFeatures:Pn,requiredFonts:Pn,requiredFormats:Pn,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:Z,specularExponent:Z,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:Z,strikethroughThickness:Z,string:null,stroke:null,strokeDashArray:Pn,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:Z,strokeOpacity:Z,strokeWidth:null,style:null,surfaceScale:Z,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Pn,tabIndex:Z,tableValues:null,target:null,targetX:Z,targetY:Z,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Pn,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:Z,underlineThickness:Z,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:Z,values:null,vAlphabetic:Z,vMathematical:Z,vectorEffect:null,vHanging:Z,vIdeographic:Z,version:null,vertAdvY:Z,vertOriginX:Z,vertOriginY:Z,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:Z,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:"svg",transform:mh});var Xb=_r({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:"xlink",transform(e,t){return"xlink:"+t.slice(5).toLowerCase()}});var Wb=_r({attributes:{xmlnsxlink:"xmlns:xlink"},properties:{xmlnsXLink:null,xmlns:null},space:"xmlns",transform:gh});var Qb=_r({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:"xml",transform(e,t){return"xml:"+t.slice(3).toLowerCase()}});var Zb={classId:"classID",dataType:"datatype",itemId:"itemID",strokeDashArray:"strokeDasharray",strokeDashOffset:"strokeDashoffset",strokeLineCap:"strokeLinecap",strokeLineJoin:"strokeLinejoin",strokeMiterLimit:"strokeMiterlimit",typeOf:"typeof",xLinkActuate:"xlinkActuate",xLinkArcRole:"xlinkArcrole",xLinkHref:"xlinkHref",xLinkRole:"xlinkRole",xLinkShow:"xlinkShow",xLinkTitle:"xlinkTitle",xLinkType:"xlinkType",xmlnsXLink:"xmlnsXlink"};var g5=/[A-Z]/g,wN=/-[a-z]/g,b5=/^data[-\w.:]+$/i;function Dr(e,t){let n=Ii(t),r=t,i=Gt;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)==="data"&&b5.test(t)){if(t.charAt(4)==="-"){let a=t.slice(5).replace(wN,y5);r="data"+a.charAt(0).toUpperCase()+a.slice(1)}else{let a=t.slice(4);if(!wN.test(a)){let o=a.replace(g5,E5);o.charAt(0)!=="-"&&(o="-"+o),t="data"+o}}i=ko}return new i(r,t)}function E5(e){return"-"+e.toLowerCase()}function y5(e){return e.charAt(1).toUpperCase()}var Ir=Kb([jb,vN,Xb,Wb,Qb],"html"),cn=Kb([jb,kN,Xb,Wb,Qb],"svg");var MN={}.hasOwnProperty;function cl(e,t){let n=t||{};function r(i,...a){let o=r.invalid,s=r.handlers;if(i&&MN.call(i,e)){let l=String(i[e]);o=MN.call(s,l)?s[l]:r.unknown}if(o)return o.call(this,i,...a)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var T5=/["&'<>`]/g,S5=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,_5=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,x5=/[|\\{}()[\]^$+*?.]/g,ON=new WeakMap;function RN(e,t){if(e=e.replace(t.subset?A5(t.subset):T5,r),t.subset||t.escapeOnly)return e;return e.replace(S5,n).replace(_5,r);function n(i,a,o){return t.format((i.charCodeAt(0)-55296)*1024+i.charCodeAt(1)-56320+65536,o.charCodeAt(a+2),t)}function r(i,a,o){return t.format(i.charCodeAt(0),o.charCodeAt(a+1),t)}}function A5(e){let t=ON.get(e);return t||(t=C5(e),ON.set(e,t)),t}function C5(e){let t=[],n=-1;for(;++n",OElig:"\u0152",oelig:"\u0153",Scaron:"\u0160",scaron:"\u0161",Yuml:"\u0178",circ:"\u02C6",tilde:"\u02DC",ensp:"\u2002",emsp:"\u2003",thinsp:"\u2009",zwnj:"\u200C",zwj:"\u200D",lrm:"\u200E",rlm:"\u200F",ndash:"\u2013",mdash:"\u2014",lsquo:"\u2018",rsquo:"\u2019",sbquo:"\u201A",ldquo:"\u201C",rdquo:"\u201D",bdquo:"\u201E",dagger:"\u2020",Dagger:"\u2021",permil:"\u2030",lsaquo:"\u2039",rsaquo:"\u203A",euro:"\u20AC"};var BN=["cent","copy","divide","gt","lt","not","para","times"];var PN={}.hasOwnProperty,Jb={},Eh;for(Eh in bh)PN.call(bh,Eh)&&(Jb[bh[Eh]]=Eh);var k5=/[^\dA-Za-z]/;function UN(e,t,n,r){let i=String.fromCharCode(e);if(PN.call(Jb,i)){let a=Jb[i],o="&"+a;return n&&LN.includes(a)&&!BN.includes(a)&&(!r||t&&t!==61&&k5.test(String.fromCharCode(t)))?o:o+";"}return""}function HN(e,t,n){let r=DN(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=UN(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let a=IN(e,t,n.omitOptionalSemicolons);a.length|^->||--!>|"],O5=["<",">"];function zN(e,t,n,r){return r.settings.bogusComments?"":"";function i(a){return Li(a,Object.assign({},r.settings.characterReferences,{subset:O5}))}}function FN(e,t,n,r){return""}function fl(e,t){let n=String(e);if(typeof t!="string")throw new TypeError("Expected character");let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function eE(e){let t=[],n=String(e||""),r=n.indexOf(","),i=0,a=!1;for(;!a;){r===-1&&(r=n.length,a=!0);let o=n.slice(i,r).trim();(o||!a)&&t.push(o),i=r+1,r=n.indexOf(",",i)}return t}function dl(e,t){let n=t||{};return(e[e.length-1]===""?[...e,""]:e).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}function tE(e){let t=String(e||"").trim();return t?t.split(/[ \t\n\r\f]+/g):[]}function hl(e){return e.join(" ").trim()}var R5=/[ \t\n\f\r]/g;function Bi(e){return typeof e=="object"?e.type==="text"?qN(e.value):!1:qN(e)}function qN(e){return e.replace(R5,"")===""}var Nt=VN(1),nE=VN(-1),D5=[];function VN(e){return t;function t(n,r,i){let a=n?n.children:D5,o=(r||0)+e,s=a[o];if(!i)for(;s&&Bi(s);)o+=e,s=a[o];return s}}var I5={}.hasOwnProperty;function yh(e){return t;function t(n,r,i){return I5.call(e,n.tagName)&&e[n.tagName](n,r,i)}}var oc=yh({body:B5,caption:rE,colgroup:rE,dd:z5,dt:H5,head:rE,html:L5,li:U5,optgroup:F5,option:q5,p:P5,rp:GN,rt:GN,tbody:G5,td:YN,tfoot:Y5,th:YN,thead:V5,tr:K5});function rE(e,t,n){let r=Nt(n,t,!0);return!r||r.type!=="comment"&&!(r.type==="text"&&Bi(r.value.charAt(0)))}function L5(e,t,n){let r=Nt(n,t);return!r||r.type!=="comment"}function B5(e,t,n){let r=Nt(n,t);return!r||r.type!=="comment"}function P5(e,t,n){let r=Nt(n,t);return r?r.type==="element"&&(r.tagName==="address"||r.tagName==="article"||r.tagName==="aside"||r.tagName==="blockquote"||r.tagName==="details"||r.tagName==="div"||r.tagName==="dl"||r.tagName==="fieldset"||r.tagName==="figcaption"||r.tagName==="figure"||r.tagName==="footer"||r.tagName==="form"||r.tagName==="h1"||r.tagName==="h2"||r.tagName==="h3"||r.tagName==="h4"||r.tagName==="h5"||r.tagName==="h6"||r.tagName==="header"||r.tagName==="hgroup"||r.tagName==="hr"||r.tagName==="main"||r.tagName==="menu"||r.tagName==="nav"||r.tagName==="ol"||r.tagName==="p"||r.tagName==="pre"||r.tagName==="section"||r.tagName==="table"||r.tagName==="ul"):!n||!(n.type==="element"&&(n.tagName==="a"||n.tagName==="audio"||n.tagName==="del"||n.tagName==="ins"||n.tagName==="map"||n.tagName==="noscript"||n.tagName==="video"))}function U5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&r.tagName==="li"}function H5(e,t,n){let r=Nt(n,t);return!!(r&&r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd"))}function z5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="dt"||r.tagName==="dd")}function GN(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="rp"||r.tagName==="rt")}function F5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&r.tagName==="optgroup"}function q5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="option"||r.tagName==="optgroup")}function V5(e,t,n){let r=Nt(n,t);return!!(r&&r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot"))}function G5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="tbody"||r.tagName==="tfoot")}function Y5(e,t,n){return!Nt(n,t)}function K5(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&r.tagName==="tr"}function YN(e,t,n){let r=Nt(n,t);return!r||r.type==="element"&&(r.tagName==="td"||r.tagName==="th")}var KN=yh({body:X5,colgroup:W5,head:j5,html:$5,tbody:Q5});function $5(e){let t=Nt(e,-1);return!t||t.type!=="comment"}function j5(e){let t=new Set;for(let r of e.children)if(r.type==="element"&&(r.tagName==="base"||r.tagName==="title")){if(t.has(r.tagName))return!1;t.add(r.tagName)}let n=e.children[0];return!n||n.type==="element"}function X5(e){let t=Nt(e,-1,!0);return!t||t.type!=="comment"&&!(t.type==="text"&&Bi(t.value.charAt(0)))&&!(t.type==="element"&&(t.tagName==="meta"||t.tagName==="link"||t.tagName==="script"||t.tagName==="style"||t.tagName==="template"))}function W5(e,t,n){let r=nE(n,t),i=Nt(e,-1,!0);return n&&r&&r.type==="element"&&r.tagName==="colgroup"&&oc(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="col")}function Q5(e,t,n){let r=nE(n,t),i=Nt(e,-1);return n&&r&&r.type==="element"&&(r.tagName==="thead"||r.tagName==="tbody")&&oc(r,n.children.indexOf(r),n)?!1:!!(i&&i.type==="element"&&i.tagName==="tr")}var Th={name:[[` \f\r &/=>`.split(""),` \f\r "&'/=>\``.split("")],[`\0 \f\r "&'/<=>`.split(""),`\0 @@ -43,65 +43,65 @@ https://github.com/highlightjs/highlight.js/issues/2277`),N=D,F=B),K===void 0&&( \f\r &>`.split(""),`\0 \f\r "&'<=>\``.split("")],[`\0 \f\r "&'<=>\``.split(""),`\0 -\f\r "&'<=>\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function $N(e,t,n,r){let i=r.schema,a=i.space==="svg"?!1:r.settings.omitOptionalTags,o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],l;i.space==="html"&&e.tagName==="svg"&&(r.schema=cn);let u=Q5(r,e.properties),c=r.all(i.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=i,c&&(o=!1),(u||!a||!KN(e,t,n))&&(s.push("<",e.tagName,u?" "+u:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!o&&(!a||!oc(e,t,n))&&s.push(""),s.join("")}function Q5(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let a=Z5(e,i,t[i]);a&&n.push(a)}}for(;++rfl(n,e.alternative)&&(o=e.alternative),s=o+Li(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?Th.single:Th.double)[i][a],attribute:!0}))+o),l+(s&&"="+s))}var J5=["<","&"];function Sh(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Li(e.value,Object.assign({},r.settings.characterReferences,{subset:J5}))}function jN(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Sh(e,t,n,r)}function XN(e,t,n,r){return r.all(e)}var WN=cl("type",{invalid:eP,unknown:tP,handlers:{comment:zN,doctype:FN,element:$N,raw:jN,root:XN,text:Sh}});function eP(e){throw new Error("Expected node, not `"+e+"`")}function tP(e){let t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}var nP={},rP={},iP=[];function iE(e,t){let n=t||nP,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:aP,all:oP,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||hh,characterReferences:n.characterReferences||rP,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?cn:Ir,quote:r,alternative:i}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function aP(e,t,n){return WN(e,t,n,this)}function oP(e){let t=[],n=e&&e.children||iP,r=-1;for(;++r0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function lc(e){let t=Un(e),n=Mo(e);if(t&&n)return{start:t,end:n}}function Ra(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uv(e.position):"start"in e||"end"in e?uv(e):"line"in e||"column"in e?sE(e):""}function sE(e){return cv(e&&e.line)+":"+cv(e&&e.column)}function uv(e){return sE(e&&e.start)+"-"+sE(e&&e.end)}function cv(e){return e&&typeof e=="number"?e:1}var vt=class extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(o=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){let l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Ra(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;var lE={}.hasOwnProperty,LP=new Map,BP=/[A-Z]/g,PP=new Set(["table","tbody","thead","tfoot","tr"]),UP=new Set(["td","th"]),dv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=KP(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=YP(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?cn:Ir,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=hv(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function hv(e,t,n){if(t.type==="element")return HP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return zP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return qP(e,t,n);if(t.type==="mdxjsEsm")return FP(e,t);if(t.type==="root")return VP(e,t,n);if(t.type==="text")return GP(e,t)}function HP(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=cn,e.schema=i),e.ancestors.push(t);let a=mv(e,t.tagName,!1),o=$P(e,t),s=fE(e,t);return PP.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Bi(l):!0})),pv(e,o,a,t),cE(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function zP(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}uc(e,t.position)}function FP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);uc(e,t.position)}function qP(e,t,n){let r=e.schema,i=r;t.name==="svg"&&r.space==="html"&&(i=cn,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:mv(e,t.name,!0),o=jP(e,t),s=fE(e,t);return pv(e,o,a,t),cE(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function VP(e,t,n){let r={};return cE(r,fE(e,t)),e.create(t,e.Fragment,r,n)}function GP(e,t){return t.value}function pv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cE(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function YP(e,t,n){return r;function r(i,a,o,s){let u=Array.isArray(o.children)?n:t;return s?u(a,o,s):u(a,o)}}function KP(e,t){return n;function n(r,i,a,o){let s=Array.isArray(a.children),l=Un(r);return t(i,a,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function $P(e,t){let n={},r,i;for(i in t.properties)if(i!=="children"&&lE.call(t.properties,i)){let a=XP(e,i,t.properties[i]);if(a){let[o,s]=a;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&UP.has(t.tagName)?r=s:n[o]=s}}if(r){let a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function jP(e,t){let n={};for(let r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){let a=r.data.estree.body[0];a.type;let o=a.expression;o.type;let s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else uc(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){let s=r.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else uc(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function fE(e,t){let n=[],r=-1,i=e.passKeys?new Map:LP;for(;++r-1&&a<=t.length){let o=0;for(;;){let s=n[o];if(s===void 0){let l=yv(t,n[o-1]);s=l===-1?t.length+1:l+1,n[o]=s}if(s>a)return{line:o+1,column:a-(o>0?n[o-1]:0)+1,offset:a};o++}}}function i(a){if(a&&typeof a.line=="number"&&typeof a.column=="number"&&!Number.isNaN(a.line)&&!Number.isNaN(a.column)){for(;n.length1?n[a.line-2]:0)+a.column-1;if(o=55296&&e<=57343}function Nv(e){return e>=56320&&e<=57343}function vv(e,t){return(e-55296)*1024+9216+t}function vh(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function kh(e){return e>=64976&&e<=65007||u8.has(e)}var U;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(U||(U={}));var f8=65536,wh=class{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=f8,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){let{line:r,col:i,offset:a}=this,o=i+n,s=a+n;return{code:t,startLine:r,endLine:r,startCol:o,endCol:o,startOffset:s,endOffset:s}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){let n=this.html.charCodeAt(this.pos+1);if(Nv(n))return this.pos++,this._addGap(),vv(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,_.EOF;return this._err(U.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,_.EOF;let r=this.html.charCodeAt(n);return r===_.CARRIAGE_RETURN?_.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,_.EOF;let t=this.html.charCodeAt(this.pos);return t===_.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,_.LINE_FEED):t===_.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Nh(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===_.LINE_FEED||t===_.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){vh(t)?this._err(U.controlCharacterInInputStream):kh(t)&&this._err(U.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.posOe,getTokenAttr:()=>fc});var Oe;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(Oe||(Oe={}));function fc(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Mh=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(e=>e.charCodeAt(0)));var yE,d8=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),kv=(yE=String.fromCodePoint)!==null&&yE!==void 0?yE:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function TE(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=d8.get(e))!==null&&t!==void 0?t:e}var Kt;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Kt||(Kt={}));var p8=32,Ia;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Ia||(Ia={}));function SE(e){return e>=Kt.ZERO&&e<=Kt.NINE}function m8(e){return e>=Kt.UPPER_A&&e<=Kt.UPPER_F||e>=Kt.LOWER_A&&e<=Kt.LOWER_F}function g8(e){return e>=Kt.UPPER_A&&e<=Kt.UPPER_Z||e>=Kt.LOWER_A&&e<=Kt.LOWER_Z||SE(e)}function b8(e){return e===Kt.EQUALS||g8(e)}var Yt;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Yt||(Yt={}));var Qr;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Qr||(Qr={}));var Oh=class{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Yt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Qr.Strict}startEntity(t){this.decodeMode=t,this.state=Yt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Yt.EntityStart:return t.charCodeAt(n)===Kt.NUM?(this.state=Yt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Yt.NamedEntity,this.stateNamedEntity(t,n));case Yt.NumericStart:return this.stateNumericStart(t,n);case Yt.NumericDecimal:return this.stateNumericDecimal(t,n);case Yt.NumericHex:return this.stateNumericHex(t,n);case Yt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|p8)===Kt.LOWER_X?(this.state=Yt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Yt.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){let a=r-n;this.result=this.result*Math.pow(i,a)+Number.parseInt(t.substr(n,a),i),this.consumed+=a}}stateNumericHex(t,n){let r=n;for(;n>14;for(;n>14,a!==0){if(o===Kt.SEMI)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);this.decodeMode!==Qr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;let{result:n,decodeTree:r}=this,i=(r[n]&Ia.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){let{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~Ia.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case Yt.NamedEntity:return this.result!==0&&(this.decodeMode!==Qr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Yt.NumericDecimal:return this.emitNumericEntity(0,2);case Yt.NumericHex:return this.emitNumericEntity(0,3);case Yt.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Yt.EntityStart:return 0}}};function E8(e,t,n,r){let i=(t&Ia.BRANCH_LENGTH)>>7,a=t&Ia.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let l=r-a;return l<0||l>=i?-1:e[n+l]-1}let o=n,s=o+i-1;for(;o<=s;){let l=o+s>>>1,u=e[l];if(ur)s=l-1;else return e[l+i]}return-1}var dc={};wf(dc,{ATTRS:()=>Zr,DOCUMENT_MODE:()=>fn,NS:()=>j,NUMBERED_HEADERS:()=>ml,SPECIAL_ELEMENTS:()=>_E,TAG_ID:()=>p,TAG_NAMES:()=>I,getTagID:()=>La,hasUnescapedText:()=>wv});var j;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(j||(j={}));var Zr;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Zr||(Zr={}));var fn;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(fn||(fn={}));var I;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(I||(I={}));var p;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(p||(p={}));var y8=new Map([[I.A,p.A],[I.ADDRESS,p.ADDRESS],[I.ANNOTATION_XML,p.ANNOTATION_XML],[I.APPLET,p.APPLET],[I.AREA,p.AREA],[I.ARTICLE,p.ARTICLE],[I.ASIDE,p.ASIDE],[I.B,p.B],[I.BASE,p.BASE],[I.BASEFONT,p.BASEFONT],[I.BGSOUND,p.BGSOUND],[I.BIG,p.BIG],[I.BLOCKQUOTE,p.BLOCKQUOTE],[I.BODY,p.BODY],[I.BR,p.BR],[I.BUTTON,p.BUTTON],[I.CAPTION,p.CAPTION],[I.CENTER,p.CENTER],[I.CODE,p.CODE],[I.COL,p.COL],[I.COLGROUP,p.COLGROUP],[I.DD,p.DD],[I.DESC,p.DESC],[I.DETAILS,p.DETAILS],[I.DIALOG,p.DIALOG],[I.DIR,p.DIR],[I.DIV,p.DIV],[I.DL,p.DL],[I.DT,p.DT],[I.EM,p.EM],[I.EMBED,p.EMBED],[I.FIELDSET,p.FIELDSET],[I.FIGCAPTION,p.FIGCAPTION],[I.FIGURE,p.FIGURE],[I.FONT,p.FONT],[I.FOOTER,p.FOOTER],[I.FOREIGN_OBJECT,p.FOREIGN_OBJECT],[I.FORM,p.FORM],[I.FRAME,p.FRAME],[I.FRAMESET,p.FRAMESET],[I.H1,p.H1],[I.H2,p.H2],[I.H3,p.H3],[I.H4,p.H4],[I.H5,p.H5],[I.H6,p.H6],[I.HEAD,p.HEAD],[I.HEADER,p.HEADER],[I.HGROUP,p.HGROUP],[I.HR,p.HR],[I.HTML,p.HTML],[I.I,p.I],[I.IMG,p.IMG],[I.IMAGE,p.IMAGE],[I.INPUT,p.INPUT],[I.IFRAME,p.IFRAME],[I.KEYGEN,p.KEYGEN],[I.LABEL,p.LABEL],[I.LI,p.LI],[I.LINK,p.LINK],[I.LISTING,p.LISTING],[I.MAIN,p.MAIN],[I.MALIGNMARK,p.MALIGNMARK],[I.MARQUEE,p.MARQUEE],[I.MATH,p.MATH],[I.MENU,p.MENU],[I.META,p.META],[I.MGLYPH,p.MGLYPH],[I.MI,p.MI],[I.MO,p.MO],[I.MN,p.MN],[I.MS,p.MS],[I.MTEXT,p.MTEXT],[I.NAV,p.NAV],[I.NOBR,p.NOBR],[I.NOFRAMES,p.NOFRAMES],[I.NOEMBED,p.NOEMBED],[I.NOSCRIPT,p.NOSCRIPT],[I.OBJECT,p.OBJECT],[I.OL,p.OL],[I.OPTGROUP,p.OPTGROUP],[I.OPTION,p.OPTION],[I.P,p.P],[I.PARAM,p.PARAM],[I.PLAINTEXT,p.PLAINTEXT],[I.PRE,p.PRE],[I.RB,p.RB],[I.RP,p.RP],[I.RT,p.RT],[I.RTC,p.RTC],[I.RUBY,p.RUBY],[I.S,p.S],[I.SCRIPT,p.SCRIPT],[I.SEARCH,p.SEARCH],[I.SECTION,p.SECTION],[I.SELECT,p.SELECT],[I.SOURCE,p.SOURCE],[I.SMALL,p.SMALL],[I.SPAN,p.SPAN],[I.STRIKE,p.STRIKE],[I.STRONG,p.STRONG],[I.STYLE,p.STYLE],[I.SUB,p.SUB],[I.SUMMARY,p.SUMMARY],[I.SUP,p.SUP],[I.TABLE,p.TABLE],[I.TBODY,p.TBODY],[I.TEMPLATE,p.TEMPLATE],[I.TEXTAREA,p.TEXTAREA],[I.TFOOT,p.TFOOT],[I.TD,p.TD],[I.TH,p.TH],[I.THEAD,p.THEAD],[I.TITLE,p.TITLE],[I.TR,p.TR],[I.TRACK,p.TRACK],[I.TT,p.TT],[I.U,p.U],[I.UL,p.UL],[I.SVG,p.SVG],[I.VAR,p.VAR],[I.WBR,p.WBR],[I.XMP,p.XMP]]);function La(e){var t;return(t=y8.get(e))!==null&&t!==void 0?t:p.UNKNOWN}var W=p,_E={[j.HTML]:new Set([W.ADDRESS,W.APPLET,W.AREA,W.ARTICLE,W.ASIDE,W.BASE,W.BASEFONT,W.BGSOUND,W.BLOCKQUOTE,W.BODY,W.BR,W.BUTTON,W.CAPTION,W.CENTER,W.COL,W.COLGROUP,W.DD,W.DETAILS,W.DIR,W.DIV,W.DL,W.DT,W.EMBED,W.FIELDSET,W.FIGCAPTION,W.FIGURE,W.FOOTER,W.FORM,W.FRAME,W.FRAMESET,W.H1,W.H2,W.H3,W.H4,W.H5,W.H6,W.HEAD,W.HEADER,W.HGROUP,W.HR,W.HTML,W.IFRAME,W.IMG,W.INPUT,W.LI,W.LINK,W.LISTING,W.MAIN,W.MARQUEE,W.MENU,W.META,W.NAV,W.NOEMBED,W.NOFRAMES,W.NOSCRIPT,W.OBJECT,W.OL,W.P,W.PARAM,W.PLAINTEXT,W.PRE,W.SCRIPT,W.SECTION,W.SELECT,W.SOURCE,W.STYLE,W.SUMMARY,W.TABLE,W.TBODY,W.TD,W.TEMPLATE,W.TEXTAREA,W.TFOOT,W.TH,W.THEAD,W.TITLE,W.TR,W.TRACK,W.UL,W.WBR,W.XMP]),[j.MATHML]:new Set([W.MI,W.MO,W.MN,W.MS,W.MTEXT,W.ANNOTATION_XML]),[j.SVG]:new Set([W.TITLE,W.FOREIGN_OBJECT,W.DESC]),[j.XLINK]:new Set,[j.XML]:new Set,[j.XMLNS]:new Set},ml=new Set([W.H1,W.H2,W.H3,W.H4,W.H5,W.H6]),T8=new Set([I.STYLE,I.SCRIPT,I.XMP,I.IFRAME,I.NOEMBED,I.NOFRAMES,I.PLAINTEXT]);function wv(e,t){return T8.has(e)||t&&e===I.NOSCRIPT}var C;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(C||(C={}));var ft={DATA:C.DATA,RCDATA:C.RCDATA,RAWTEXT:C.RAWTEXT,SCRIPT_DATA:C.SCRIPT_DATA,PLAINTEXT:C.PLAINTEXT,CDATA_SECTION:C.CDATA_SECTION};function S8(e){return e>=_.DIGIT_0&&e<=_.DIGIT_9}function hc(e){return e>=_.LATIN_CAPITAL_A&&e<=_.LATIN_CAPITAL_Z}function _8(e){return e>=_.LATIN_SMALL_A&&e<=_.LATIN_SMALL_Z}function Ba(e){return _8(e)||hc(e)}function Mv(e){return Ba(e)||S8(e)}function Rh(e){return e+32}function Rv(e){return e===_.SPACE||e===_.LINE_FEED||e===_.TABULATION||e===_.FORM_FEED}function Ov(e){return Rv(e)||e===_.SOLIDUS||e===_.GREATER_THAN_SIGN}function x8(e){return e===_.NULL?U.nullCharacterReference:e>1114111?U.characterReferenceOutsideUnicodeRange:Nh(e)?U.surrogateCharacterReference:kh(e)?U.noncharacterCharacterReference:vh(e)||e===_.CARRIAGE_RETURN?U.controlCharacterReference:null}var pc=class{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=C.DATA,this.returnState=C.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new wh(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Oh(Mh,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(U.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(U.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{let i=x8(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(U.endTagWithAttributes),t.selfClosing&&this._err(U.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Oe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Oe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Oe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){let t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Oe.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){let n=Rv(t)?Oe.WHITESPACE_CHARACTER:t===_.NULL?Oe.NULL_CHARACTER:Oe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Oe.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=C.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Qr.Attribute:Qr.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===C.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===C.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===C.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case C.DATA:{this._stateData(t);break}case C.RCDATA:{this._stateRcdata(t);break}case C.RAWTEXT:{this._stateRawtext(t);break}case C.SCRIPT_DATA:{this._stateScriptData(t);break}case C.PLAINTEXT:{this._statePlaintext(t);break}case C.TAG_OPEN:{this._stateTagOpen(t);break}case C.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case C.TAG_NAME:{this._stateTagName(t);break}case C.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case C.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case C.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case C.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case C.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case C.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case C.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case C.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case C.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case C.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case C.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case C.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case C.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case C.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case C.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case C.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case C.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case C.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case C.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case C.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case C.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case C.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case C.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case C.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case C.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case C.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case C.BOGUS_COMMENT:{this._stateBogusComment(t);break}case C.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case C.COMMENT_START:{this._stateCommentStart(t);break}case C.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case C.COMMENT:{this._stateComment(t);break}case C.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case C.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case C.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case C.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case C.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case C.COMMENT_END:{this._stateCommentEnd(t);break}case C.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case C.DOCTYPE:{this._stateDoctype(t);break}case C.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case C.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case C.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case C.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case C.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case C.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case C.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case C.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case C.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case C.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case C.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case C.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case C.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case C.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case C.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case C.CDATA_SECTION:{this._stateCdataSection(t);break}case C.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case C.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case C.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case C.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case _.LESS_THAN_SIGN:{this.state=C.TAG_OPEN;break}case _.AMPERSAND:{this._startCharacterReference();break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitCodePoint(t);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case _.AMPERSAND:{this._startCharacterReference();break}case _.LESS_THAN_SIGN:{this.state=C.RCDATA_LESS_THAN_SIGN;break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case _.LESS_THAN_SIGN:{this.state=C.RAWTEXT_LESS_THAN_SIGN;break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case _.LESS_THAN_SIGN:{this.state=C.SCRIPT_DATA_LESS_THAN_SIGN;break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ba(t))this._createStartTagToken(),this.state=C.TAG_NAME,this._stateTagName(t);else switch(t){case _.EXCLAMATION_MARK:{this.state=C.MARKUP_DECLARATION_OPEN;break}case _.SOLIDUS:{this.state=C.END_TAG_OPEN;break}case _.QUESTION_MARK:{this._err(U.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=C.BOGUS_COMMENT,this._stateBogusComment(t);break}case _.EOF:{this._err(U.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=C.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ba(t))this._createEndTagToken(),this.state=C.TAG_NAME,this._stateTagName(t);else switch(t){case _.GREATER_THAN_SIGN:{this._err(U.missingEndTagName),this.state=C.DATA;break}case _.EOF:{this._err(U.eofBeforeTagName),this._emitChars("");break}case _.NULL:{this._err(U.unexpectedNullCharacter),this.state=C.SCRIPT_DATA_ESCAPED,this._emitChars(Qe);break}case _.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=C.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===_.SOLIDUS?this.state=C.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ba(t)?(this._emitChars("<"),this.state=C.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=C.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ba(t)?(this.state=C.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case _.NULL:{this._err(U.unexpectedNullCharacter),this.state=C.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Qe);break}case _.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=C.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===_.SOLIDUS?(this.state=C.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=C.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(xn.SCRIPT,!1)&&Ov(this.preprocessor.peek(xn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){let r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){let i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==j.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){let n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){let r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(k8,j.HTML)}clearBackToTableBodyContext(){this.clearBackTo(v8,j.HTML)}clearBackToTableRowContext(){this.clearBackTo(N8,j.HTML)}remove(t){let n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===p.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){let n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===p.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){let i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case j.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case j.SVG:{if(Lv.has(i))return!1;break}case j.MATHML:{if(Iv.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Dh)}hasInListItemScope(t){return this.hasInDynamicScope(t,A8)}hasInButtonScope(t){return this.hasInDynamicScope(t,C8)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){let n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case j.HTML:{if(ml.has(n))return!0;if(Dh.has(n))return!1;break}case j.SVG:{if(Lv.has(n))return!1;break}case j.MATHML:{if(Iv.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===j.HTML)switch(this.tagIDs[n]){case t:return!0;case p.TABLE:case p.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===j.HTML)switch(this.tagIDs[t]){case p.TBODY:case p.THEAD:case p.TFOOT:return!0;case p.TABLE:case p.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===j.HTML)switch(this.tagIDs[n]){case t:return!0;case p.OPTION:case p.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Bv.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Dv.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Dv.has(this.currentTagId);)this.pop()}};var Lr;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Lr||(Lr={}));var Pv={type:Lr.Marker},Lh=class{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){let r=[],i=n.length,a=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let s=0;s[o.name,o.value])),a=0;for(let o=0;oi.get(l.name)===l.value)&&(a+=1,a>=3&&this.entries.splice(s.idx,1))}}insertMarker(){this.entries.unshift(Pv)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Lr.Element,element:t,token:n})}insertElementAfterBookmark(t,n){let r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Lr.Element,element:t,token:n})}removeEntry(t){let n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){let t=this.entries.indexOf(Pv);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){let n=this.entries.find(r=>r.type===Lr.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Lr.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Lr.Element&&n.element===t)}};var Br={createDocument(){return{nodeName:"#document",mode:fn.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(a=>a.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{let a={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};Br.appendChild(e,a)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Br.isTextNode(n)){n.value+=t;return}}Br.appendChild(e,Br.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Br.isTextNode(r)?r.value+=t:Br.insertBefore(e,Br.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function qv(e){return e.name===Hv&&e.publicId===null&&(e.systemId===null||e.systemId===M8)}function Vv(e){if(e.name!==Hv)return fn.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===O8)return fn.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),D8.has(n))return fn.QUIRKS;let r=t===null?R8:zv;if(Uv(n,r))return fn.QUIRKS;if(r=t===null?Fv:I8,Uv(n,r))return fn.LIMITED_QUIRKS}return fn.NO_QUIRKS}var Gv={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},B8="definitionurl",P8="definitionURL",U8=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),H8=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:j.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:j.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:j.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:j.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:j.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:j.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:j.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:j.XML}],["xml:space",{prefix:"xml",name:"space",namespace:j.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:j.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:j.XMLNS}]]),z8=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),F8=new Set([p.B,p.BIG,p.BLOCKQUOTE,p.BODY,p.BR,p.CENTER,p.CODE,p.DD,p.DIV,p.DL,p.DT,p.EM,p.EMBED,p.H1,p.H2,p.H3,p.H4,p.H5,p.H6,p.HEAD,p.HR,p.I,p.IMG,p.LI,p.LISTING,p.MENU,p.META,p.NOBR,p.OL,p.P,p.PRE,p.RUBY,p.S,p.SMALL,p.SPAN,p.STRONG,p.STRIKE,p.SUB,p.SUP,p.TABLE,p.TT,p.U,p.UL,p.VAR]);function Yv(e){let t=e.tagID;return t===p.FONT&&e.attrs.some(({name:r})=>r===Zr.COLOR||r===Zr.SIZE||r===Zr.FACE)||F8.has(t)}function xE(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let a,o;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,o=this.fragmentContextID):{current:a,currentTagId:o}=this.openElements,this._setContextModes(a,o)}}_setContextModes(t,n){let r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===j.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,j.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=w.TEXT}switchToPlaintextParsing(){this.insertionMode=w.TEXT,this.originalInsertionMode=w.IN_BODY,this.tokenizer.state=ft.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===I.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==j.HTML))switch(this.fragmentContextID){case p.TITLE:case p.TEXTAREA:{this.tokenizer.state=ft.RCDATA;break}case p.STYLE:case p.XMP:case p.IFRAME:case p.NOEMBED:case p.NOFRAMES:case p.NOSCRIPT:{this.tokenizer.state=ft.RAWTEXT;break}case p.SCRIPT:{this.tokenizer.state=ft.SCRIPT_DATA;break}case p.PLAINTEXT:{this.tokenizer.state=ft.PLAINTEXT;break}default:}}_setDocumentType(t){let n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){let o=this.treeAdapter.getChildNodes(this.document).find(s=>this.treeAdapter.isDocumentTypeNode(s));o&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){let r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{let r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){let r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){let r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){let r=this.treeAdapter.createElement(t,j.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){let n=this.treeAdapter.createElement(t.tagName,j.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){let t=this.treeAdapter.createElement(I.HTML,j.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,p.HTML)}_appendCommentNode(t,n){let r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;let i=this.treeAdapter.getChildNodes(n),a=r?i.lastIndexOf(r):i.length,o=i[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){let{endLine:l,endCol:u,endOffset:c}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:l,endCol:u,endOffset:c})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){let r=n.location,i=this.treeAdapter.getTagName(t),a=n.type===Oe.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,a)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===p.SVG&&this.treeAdapter.getTagName(n)===I.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===j.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===p.MGLYPH||t.tagID===p.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,j.HTML)}_processToken(t){switch(t.type){case Oe.CHARACTER:{this.onCharacter(t);break}case Oe.NULL_CHARACTER:{this.onNullCharacter(t);break}case Oe.COMMENT:{this.onComment(t);break}case Oe.DOCTYPE:{this.onDoctype(t);break}case Oe.START_TAG:{this._processStartTag(t);break}case Oe.END_TAG:{this.onEndTag(t);break}case Oe.EOF:{this.onEof(t);break}case Oe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){let i=this.treeAdapter.getNamespaceURI(n),a=this.treeAdapter.getAttrList(n);return $v(t,i,a,r)}_reconstructActiveFormattingElements(){let t=this.activeFormattingElements.entries.length;if(t){let n=this.activeFormattingElements.entries.findIndex(i=>i.type===Lr.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){let a=this.activeFormattingElements.entries[i];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=w.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(p.P),this.openElements.popUntilTagNamePopped(p.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case p.TR:{this.insertionMode=w.IN_ROW;return}case p.TBODY:case p.THEAD:case p.TFOOT:{this.insertionMode=w.IN_TABLE_BODY;return}case p.CAPTION:{this.insertionMode=w.IN_CAPTION;return}case p.COLGROUP:{this.insertionMode=w.IN_COLUMN_GROUP;return}case p.TABLE:{this.insertionMode=w.IN_TABLE;return}case p.BODY:{this.insertionMode=w.IN_BODY;return}case p.FRAMESET:{this.insertionMode=w.IN_FRAMESET;return}case p.SELECT:{this._resetInsertionModeForSelect(t);return}case p.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case p.HTML:{this.insertionMode=this.headElement?w.AFTER_HEAD:w.BEFORE_HEAD;return}case p.TD:case p.TH:{if(t>0){this.insertionMode=w.IN_CELL;return}break}case p.HEAD:{if(t>0){this.insertionMode=w.IN_HEAD;return}break}}this.insertionMode=w.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){let r=this.openElements.tagIDs[n];if(r===p.TEMPLATE)break;if(r===p.TABLE){this.insertionMode=w.IN_SELECT_IN_TABLE;return}}this.insertionMode=w.IN_SELECT}_isElementCausesFosterParenting(t){return Zv.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){let n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case p.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===j.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case p.TABLE:{let r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){let n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){let r=this.treeAdapter.getNamespaceURI(t);return _E[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){xU(this,t);return}switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{bc(this,t);break}case w.BEFORE_HEAD:{Ec(this,t);break}case w.IN_HEAD:{yc(this,t);break}case w.IN_HEAD_NO_SCRIPT:{Tc(this,t);break}case w.AFTER_HEAD:{Sc(this,t);break}case w.IN_BODY:case w.IN_CAPTION:case w.IN_CELL:case w.IN_TEMPLATE:{ek(this,t);break}case w.TEXT:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case w.IN_TABLE:case w.IN_TABLE_BODY:case w.IN_ROW:{CE(this,t);break}case w.IN_TABLE_TEXT:{ok(this,t);break}case w.IN_COLUMN_GROUP:{Uh(this,t);break}case w.AFTER_BODY:{Hh(this,t);break}case w.AFTER_AFTER_BODY:{Ph(this,t);break}default:}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){_U(this,t);return}switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{bc(this,t);break}case w.BEFORE_HEAD:{Ec(this,t);break}case w.IN_HEAD:{yc(this,t);break}case w.IN_HEAD_NO_SCRIPT:{Tc(this,t);break}case w.AFTER_HEAD:{Sc(this,t);break}case w.TEXT:{this._insertCharacters(t);break}case w.IN_TABLE:case w.IN_TABLE_BODY:case w.IN_ROW:{CE(this,t);break}case w.IN_COLUMN_GROUP:{Uh(this,t);break}case w.AFTER_BODY:{Hh(this,t);break}case w.AFTER_AFTER_BODY:{Ph(this,t);break}default:}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){NE(this,t);return}switch(this.insertionMode){case w.INITIAL:case w.BEFORE_HTML:case w.BEFORE_HEAD:case w.IN_HEAD:case w.IN_HEAD_NO_SCRIPT:case w.AFTER_HEAD:case w.IN_BODY:case w.IN_TABLE:case w.IN_CAPTION:case w.IN_COLUMN_GROUP:case w.IN_TABLE_BODY:case w.IN_ROW:case w.IN_CELL:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:case w.IN_TEMPLATE:case w.IN_FRAMESET:case w.AFTER_FRAMESET:{NE(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.AFTER_BODY:{e9(this,t);break}case w.AFTER_AFTER_BODY:case w.AFTER_AFTER_FRAMESET:{t9(this,t);break}default:}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case w.INITIAL:{n9(this,t);break}case w.BEFORE_HEAD:case w.IN_HEAD:case w.IN_HEAD_NO_SCRIPT:case w.AFTER_HEAD:{this._err(t,U.misplacedDoctype);break}case w.IN_TABLE_TEXT:{gc(this,t);break}default:}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,U.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?AU(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{r9(this,t);break}case w.BEFORE_HEAD:{a9(this,t);break}case w.IN_HEAD:{Pr(this,t);break}case w.IN_HEAD_NO_SCRIPT:{l9(this,t);break}case w.AFTER_HEAD:{c9(this,t);break}case w.IN_BODY:{dn(this,t);break}case w.IN_TABLE:{gl(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.IN_CAPTION:{oU(this,t);break}case w.IN_COLUMN_GROUP:{ME(this,t);break}case w.IN_TABLE_BODY:{qh(this,t);break}case w.IN_ROW:{Vh(this,t);break}case w.IN_CELL:{uU(this,t);break}case w.IN_SELECT:{uk(this,t);break}case w.IN_SELECT_IN_TABLE:{fU(this,t);break}case w.IN_TEMPLATE:{hU(this,t);break}case w.AFTER_BODY:{mU(this,t);break}case w.IN_FRAMESET:{gU(this,t);break}case w.AFTER_FRAMESET:{EU(this,t);break}case w.AFTER_AFTER_BODY:{TU(this,t);break}case w.AFTER_AFTER_FRAMESET:{SU(this,t);break}default:}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?CU(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{i9(this,t);break}case w.BEFORE_HEAD:{o9(this,t);break}case w.IN_HEAD:{s9(this,t);break}case w.IN_HEAD_NO_SCRIPT:{u9(this,t);break}case w.AFTER_HEAD:{f9(this,t);break}case w.IN_BODY:{Fh(this,t);break}case w.TEXT:{W9(this,t);break}case w.IN_TABLE:{_c(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.IN_CAPTION:{sU(this,t);break}case w.IN_COLUMN_GROUP:{lU(this,t);break}case w.IN_TABLE_BODY:{vE(this,t);break}case w.IN_ROW:{lk(this,t);break}case w.IN_CELL:{cU(this,t);break}case w.IN_SELECT:{ck(this,t);break}case w.IN_SELECT_IN_TABLE:{dU(this,t);break}case w.IN_TEMPLATE:{pU(this,t);break}case w.AFTER_BODY:{dk(this,t);break}case w.IN_FRAMESET:{bU(this,t);break}case w.AFTER_FRAMESET:{yU(this,t);break}case w.AFTER_AFTER_BODY:{Ph(this,t);break}default:}}onEof(t){switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{bc(this,t);break}case w.BEFORE_HEAD:{Ec(this,t);break}case w.IN_HEAD:{yc(this,t);break}case w.IN_HEAD_NO_SCRIPT:{Tc(this,t);break}case w.AFTER_HEAD:{Sc(this,t);break}case w.IN_BODY:case w.IN_TABLE:case w.IN_CAPTION:case w.IN_COLUMN_GROUP:case w.IN_TABLE_BODY:case w.IN_ROW:case w.IN_CELL:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:{ik(this,t);break}case w.TEXT:{Q9(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.IN_TEMPLATE:{fk(this,t);break}case w.AFTER_BODY:case w.IN_FRAMESET:case w.AFTER_FRAMESET:case w.AFTER_AFTER_BODY:case w.AFTER_AFTER_FRAMESET:{wE(this,t);break}default:}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===_.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case w.IN_HEAD:case w.IN_HEAD_NO_SCRIPT:case w.AFTER_HEAD:case w.TEXT:case w.IN_COLUMN_GROUP:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:case w.IN_FRAMESET:case w.AFTER_FRAMESET:{this._insertCharacters(t);break}case w.IN_BODY:case w.IN_CAPTION:case w.IN_CELL:case w.IN_TEMPLATE:case w.AFTER_BODY:case w.AFTER_AFTER_BODY:case w.AFTER_AFTER_FRAMESET:{Jv(this,t);break}case w.IN_TABLE:case w.IN_TABLE_BODY:case w.IN_ROW:{CE(this,t);break}case w.IN_TABLE_TEXT:{ak(this,t);break}default:}}};function j8(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):rk(e,t),n}function X8(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function W8(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let s=e.activeFormattingElements.getElementEntry(o),l=s&&a>=K8;!s||l?(l&&e.activeFormattingElements.removeEntry(s),e.openElements.remove(o)):(o=Q8(e,s),r===t&&(e.activeFormattingElements.bookmark=s),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Q8(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function Z8(e,t,n){let r=e.treeAdapter.getTagName(t),i=La(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{let a=e.treeAdapter.getNamespaceURI(t);i===p.TEMPLATE&&a===j.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function J8(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function kE(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let r=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){let a=e.openElements.items[1],o=e.treeAdapter.getNodeSourceCodeLocation(a);o&&!o.endTag&&e._setEndLocation(a,t)}}}}function n9(e,t){e._setDocumentType(t);let n=t.forceQuirks?fn.QUIRKS:Vv(t);qv(t)||e._err(t,U.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=w.BEFORE_HTML}function mc(e,t){e._err(t,U.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,fn.QUIRKS),e.insertionMode=w.BEFORE_HTML,e._processToken(t)}function r9(e,t){t.tagID===p.HTML?(e._insertElement(t,j.HTML),e.insertionMode=w.BEFORE_HEAD):bc(e,t)}function i9(e,t){let n=t.tagID;(n===p.HTML||n===p.HEAD||n===p.BODY||n===p.BR)&&bc(e,t)}function bc(e,t){e._insertFakeRootElement(),e.insertionMode=w.BEFORE_HEAD,e._processToken(t)}function a9(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.HEAD:{e._insertElement(t,j.HTML),e.headElement=e.openElements.current,e.insertionMode=w.IN_HEAD;break}default:Ec(e,t)}}function o9(e,t){let n=t.tagID;n===p.HEAD||n===p.BODY||n===p.HTML||n===p.BR?Ec(e,t):e._err(t,U.endTagWithoutMatchingOpenElement)}function Ec(e,t){e._insertFakeElement(I.HEAD,p.HEAD),e.headElement=e.openElements.current,e.insertionMode=w.IN_HEAD,e._processToken(t)}function Pr(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.BASE:case p.BASEFONT:case p.BGSOUND:case p.LINK:case p.META:{e._appendElement(t,j.HTML),t.ackSelfClosing=!0;break}case p.TITLE:{e._switchToTextParsing(t,ft.RCDATA);break}case p.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ft.RAWTEXT):(e._insertElement(t,j.HTML),e.insertionMode=w.IN_HEAD_NO_SCRIPT);break}case p.NOFRAMES:case p.STYLE:{e._switchToTextParsing(t,ft.RAWTEXT);break}case p.SCRIPT:{e._switchToTextParsing(t,ft.SCRIPT_DATA);break}case p.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=w.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(w.IN_TEMPLATE);break}case p.HEAD:{e._err(t,U.misplacedStartTagForHeadElement);break}default:yc(e,t)}}function s9(e,t){switch(t.tagID){case p.HEAD:{e.openElements.pop(),e.insertionMode=w.AFTER_HEAD;break}case p.BODY:case p.BR:case p.HTML:{yc(e,t);break}case p.TEMPLATE:{Oo(e,t);break}default:e._err(t,U.endTagWithoutMatchingOpenElement)}}function Oo(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==p.TEMPLATE&&e._err(t,U.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(p.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,U.endTagWithoutMatchingOpenElement)}function yc(e,t){e.openElements.pop(),e.insertionMode=w.AFTER_HEAD,e._processToken(t)}function l9(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.BASEFONT:case p.BGSOUND:case p.HEAD:case p.LINK:case p.META:case p.NOFRAMES:case p.STYLE:{Pr(e,t);break}case p.NOSCRIPT:{e._err(t,U.nestedNoscriptInHead);break}default:Tc(e,t)}}function u9(e,t){switch(t.tagID){case p.NOSCRIPT:{e.openElements.pop(),e.insertionMode=w.IN_HEAD;break}case p.BR:{Tc(e,t);break}default:e._err(t,U.endTagWithoutMatchingOpenElement)}}function Tc(e,t){let n=t.type===Oe.EOF?U.openElementsLeftAfterEof:U.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=w.IN_HEAD,e._processToken(t)}function c9(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.BODY:{e._insertElement(t,j.HTML),e.framesetOk=!1,e.insertionMode=w.IN_BODY;break}case p.FRAMESET:{e._insertElement(t,j.HTML),e.insertionMode=w.IN_FRAMESET;break}case p.BASE:case p.BASEFONT:case p.BGSOUND:case p.LINK:case p.META:case p.NOFRAMES:case p.SCRIPT:case p.STYLE:case p.TEMPLATE:case p.TITLE:{e._err(t,U.abandonedHeadElementChild),e.openElements.push(e.headElement,p.HEAD),Pr(e,t),e.openElements.remove(e.headElement);break}case p.HEAD:{e._err(t,U.misplacedStartTagForHeadElement);break}default:Sc(e,t)}}function f9(e,t){switch(t.tagID){case p.BODY:case p.HTML:case p.BR:{Sc(e,t);break}case p.TEMPLATE:{Oo(e,t);break}default:e._err(t,U.endTagWithoutMatchingOpenElement)}}function Sc(e,t){e._insertFakeElement(I.BODY,p.BODY),e.insertionMode=w.IN_BODY,zh(e,t)}function zh(e,t){switch(t.type){case Oe.CHARACTER:{ek(e,t);break}case Oe.WHITESPACE_CHARACTER:{Jv(e,t);break}case Oe.COMMENT:{NE(e,t);break}case Oe.START_TAG:{dn(e,t);break}case Oe.END_TAG:{Fh(e,t);break}case Oe.EOF:{ik(e,t);break}default:}}function Jv(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function ek(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function d9(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function h9(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function p9(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_FRAMESET)}function m9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML)}function g9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&ml.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,j.HTML)}function b9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function E9(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),n||(e.formElement=e.openElements.current))}function y9(e,t){e.framesetOk=!1;let n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){let i=e.openElements.tagIDs[r];if(n===p.LI&&i===p.LI||(n===p.DD||n===p.DT)&&(i===p.DD||i===p.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==p.ADDRESS&&i!==p.DIV&&i!==p.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML)}function T9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),e.tokenizer.state=ft.PLAINTEXT}function S9(e,t){e.openElements.hasInScope(p.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(p.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.framesetOk=!1}function _9(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(I.A);n&&(kE(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function x9(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function A9(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(p.NOBR)&&(kE(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,j.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function C9(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function N9(e,t){e.treeAdapter.getDocumentMode(e.document)!==fn.QUIRKS&&e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),e.framesetOk=!1,e.insertionMode=w.IN_TABLE}function tk(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,j.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function nk(e){let t=fc(e,Zr.TYPE);return t!=null&&t.toLowerCase()===G8}function v9(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,j.HTML),nk(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function k9(e,t){e._appendElement(t,j.HTML),t.ackSelfClosing=!0}function w9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._appendElement(t,j.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function M9(e,t){t.tagName=I.IMG,t.tagID=p.IMG,tk(e,t)}function O9(e,t){e._insertElement(t,j.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ft.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=w.TEXT}function R9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ft.RAWTEXT)}function D9(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ft.RAWTEXT)}function Wv(e,t){e._switchToTextParsing(t,ft.RAWTEXT)}function I9(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===w.IN_TABLE||e.insertionMode===w.IN_CAPTION||e.insertionMode===w.IN_TABLE_BODY||e.insertionMode===w.IN_ROW||e.insertionMode===w.IN_CELL?w.IN_SELECT_IN_TABLE:w.IN_SELECT}function L9(e,t){e.openElements.currentTagId===p.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML)}function B9(e,t){e.openElements.hasInScope(p.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,j.HTML)}function P9(e,t){e.openElements.hasInScope(p.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(p.RTC),e._insertElement(t,j.HTML)}function U9(e,t){e._reconstructActiveFormattingElements(),xE(t),Bh(t),t.selfClosing?e._appendElement(t,j.MATHML):e._insertElement(t,j.MATHML),t.ackSelfClosing=!0}function H9(e,t){e._reconstructActiveFormattingElements(),AE(t),Bh(t),t.selfClosing?e._appendElement(t,j.SVG):e._insertElement(t,j.SVG),t.ackSelfClosing=!0}function Qv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML)}function dn(e,t){switch(t.tagID){case p.I:case p.S:case p.B:case p.U:case p.EM:case p.TT:case p.BIG:case p.CODE:case p.FONT:case p.SMALL:case p.STRIKE:case p.STRONG:{x9(e,t);break}case p.A:{_9(e,t);break}case p.H1:case p.H2:case p.H3:case p.H4:case p.H5:case p.H6:{g9(e,t);break}case p.P:case p.DL:case p.OL:case p.UL:case p.DIV:case p.DIR:case p.NAV:case p.MAIN:case p.MENU:case p.ASIDE:case p.CENTER:case p.FIGURE:case p.FOOTER:case p.HEADER:case p.HGROUP:case p.DIALOG:case p.DETAILS:case p.ADDRESS:case p.ARTICLE:case p.SEARCH:case p.SECTION:case p.SUMMARY:case p.FIELDSET:case p.BLOCKQUOTE:case p.FIGCAPTION:{m9(e,t);break}case p.LI:case p.DD:case p.DT:{y9(e,t);break}case p.BR:case p.IMG:case p.WBR:case p.AREA:case p.EMBED:case p.KEYGEN:{tk(e,t);break}case p.HR:{w9(e,t);break}case p.RB:case p.RTC:{B9(e,t);break}case p.RT:case p.RP:{P9(e,t);break}case p.PRE:case p.LISTING:{b9(e,t);break}case p.XMP:{R9(e,t);break}case p.SVG:{H9(e,t);break}case p.HTML:{d9(e,t);break}case p.BASE:case p.LINK:case p.META:case p.STYLE:case p.TITLE:case p.SCRIPT:case p.BGSOUND:case p.BASEFONT:case p.TEMPLATE:{Pr(e,t);break}case p.BODY:{h9(e,t);break}case p.FORM:{E9(e,t);break}case p.NOBR:{A9(e,t);break}case p.MATH:{U9(e,t);break}case p.TABLE:{N9(e,t);break}case p.INPUT:{v9(e,t);break}case p.PARAM:case p.TRACK:case p.SOURCE:{k9(e,t);break}case p.IMAGE:{M9(e,t);break}case p.BUTTON:{S9(e,t);break}case p.APPLET:case p.OBJECT:case p.MARQUEE:{C9(e,t);break}case p.IFRAME:{D9(e,t);break}case p.SELECT:{I9(e,t);break}case p.OPTION:case p.OPTGROUP:{L9(e,t);break}case p.NOEMBED:case p.NOFRAMES:{Wv(e,t);break}case p.FRAMESET:{p9(e,t);break}case p.TEXTAREA:{O9(e,t);break}case p.NOSCRIPT:{e.options.scriptingEnabled?Wv(e,t):Qv(e,t);break}case p.PLAINTEXT:{T9(e,t);break}case p.COL:case p.TH:case p.TD:case p.TR:case p.HEAD:case p.FRAME:case p.TBODY:case p.TFOOT:case p.THEAD:case p.CAPTION:case p.COLGROUP:break;default:Qv(e,t)}}function z9(e,t){if(e.openElements.hasInScope(p.BODY)&&(e.insertionMode=w.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function F9(e,t){e.openElements.hasInScope(p.BODY)&&(e.insertionMode=w.AFTER_BODY,dk(e,t))}function q9(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function V9(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(p.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(p.FORM):n&&e.openElements.remove(n))}function G9(e){e.openElements.hasInButtonScope(p.P)||e._insertFakeElement(I.P,p.P),e._closePElement()}function Y9(e){e.openElements.hasInListItemScope(p.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(p.LI),e.openElements.popUntilTagNamePopped(p.LI))}function K9(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function $9(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function j9(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function X9(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(I.BR,p.BR),e.openElements.pop(),e.framesetOk=!1}function rk(e,t){let n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){let a=e.openElements.items[i],o=e.openElements.tagIDs[i];if(r===o&&(r!==p.UNKNOWN||e.treeAdapter.getTagName(a)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(a,o))break}}function Fh(e,t){switch(t.tagID){case p.A:case p.B:case p.I:case p.S:case p.U:case p.EM:case p.TT:case p.BIG:case p.CODE:case p.FONT:case p.NOBR:case p.SMALL:case p.STRIKE:case p.STRONG:{kE(e,t);break}case p.P:{G9(e);break}case p.DL:case p.UL:case p.OL:case p.DIR:case p.DIV:case p.NAV:case p.PRE:case p.MAIN:case p.MENU:case p.ASIDE:case p.BUTTON:case p.CENTER:case p.FIGURE:case p.FOOTER:case p.HEADER:case p.HGROUP:case p.DIALOG:case p.ADDRESS:case p.ARTICLE:case p.DETAILS:case p.SEARCH:case p.SECTION:case p.SUMMARY:case p.LISTING:case p.FIELDSET:case p.BLOCKQUOTE:case p.FIGCAPTION:{q9(e,t);break}case p.LI:{Y9(e);break}case p.DD:case p.DT:{K9(e,t);break}case p.H1:case p.H2:case p.H3:case p.H4:case p.H5:case p.H6:{$9(e);break}case p.BR:{X9(e);break}case p.BODY:{z9(e,t);break}case p.HTML:{F9(e,t);break}case p.FORM:{V9(e);break}case p.APPLET:case p.OBJECT:case p.MARQUEE:{j9(e,t);break}case p.TEMPLATE:{Oo(e,t);break}default:rk(e,t)}}function ik(e,t){e.tmplInsertionModeStack.length>0?fk(e,t):wE(e,t)}function W9(e,t){var n;t.tagID===p.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Q9(e,t){e._err(t,U.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function CE(e,t){if(e.openElements.currentTagId!==void 0&&Zv.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=w.IN_TABLE_TEXT,t.type){case Oe.CHARACTER:{ok(e,t);break}case Oe.WHITESPACE_CHARACTER:{ak(e,t);break}}else xc(e,t)}function Z9(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_CAPTION}function J9(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_COLUMN_GROUP}function eU(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(I.COLGROUP,p.COLGROUP),e.insertionMode=w.IN_COLUMN_GROUP,ME(e,t)}function tU(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_TABLE_BODY}function nU(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(I.TBODY,p.TBODY),e.insertionMode=w.IN_TABLE_BODY,qh(e,t)}function rU(e,t){e.openElements.hasInTableScope(p.TABLE)&&(e.openElements.popUntilTagNamePopped(p.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function iU(e,t){nk(t)?e._appendElement(t,j.HTML):xc(e,t),t.ackSelfClosing=!0}function aU(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,j.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function gl(e,t){switch(t.tagID){case p.TD:case p.TH:case p.TR:{nU(e,t);break}case p.STYLE:case p.SCRIPT:case p.TEMPLATE:{Pr(e,t);break}case p.COL:{eU(e,t);break}case p.FORM:{aU(e,t);break}case p.TABLE:{rU(e,t);break}case p.TBODY:case p.TFOOT:case p.THEAD:{tU(e,t);break}case p.INPUT:{iU(e,t);break}case p.CAPTION:{Z9(e,t);break}case p.COLGROUP:{J9(e,t);break}default:xc(e,t)}}function _c(e,t){switch(t.tagID){case p.TABLE:{e.openElements.hasInTableScope(p.TABLE)&&(e.openElements.popUntilTagNamePopped(p.TABLE),e._resetInsertionMode());break}case p.TEMPLATE:{Oo(e,t);break}case p.BODY:case p.CAPTION:case p.COL:case p.COLGROUP:case p.HTML:case p.TBODY:case p.TD:case p.TFOOT:case p.TH:case p.THEAD:case p.TR:break;default:xc(e,t)}}function xc(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,zh(e,t),e.fosterParentingEnabled=n}function ak(e,t){e.pendingCharacterTokens.push(t)}function ok(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function gc(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===p.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===p.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===p.OPTGROUP&&e.openElements.pop();break}case p.OPTION:{e.openElements.currentTagId===p.OPTION&&e.openElements.pop();break}case p.SELECT:{e.openElements.hasInSelectScope(p.SELECT)&&(e.openElements.popUntilTagNamePopped(p.SELECT),e._resetInsertionMode());break}case p.TEMPLATE:{Oo(e,t);break}default:}}function fU(e,t){let n=t.tagID;n===p.CAPTION||n===p.TABLE||n===p.TBODY||n===p.TFOOT||n===p.THEAD||n===p.TR||n===p.TD||n===p.TH?(e.openElements.popUntilTagNamePopped(p.SELECT),e._resetInsertionMode(),e._processStartTag(t)):uk(e,t)}function dU(e,t){let n=t.tagID;n===p.CAPTION||n===p.TABLE||n===p.TBODY||n===p.TFOOT||n===p.THEAD||n===p.TR||n===p.TD||n===p.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(p.SELECT),e._resetInsertionMode(),e.onEndTag(t)):ck(e,t)}function hU(e,t){switch(t.tagID){case p.BASE:case p.BASEFONT:case p.BGSOUND:case p.LINK:case p.META:case p.NOFRAMES:case p.SCRIPT:case p.STYLE:case p.TEMPLATE:case p.TITLE:{Pr(e,t);break}case p.CAPTION:case p.COLGROUP:case p.TBODY:case p.TFOOT:case p.THEAD:{e.tmplInsertionModeStack[0]=w.IN_TABLE,e.insertionMode=w.IN_TABLE,gl(e,t);break}case p.COL:{e.tmplInsertionModeStack[0]=w.IN_COLUMN_GROUP,e.insertionMode=w.IN_COLUMN_GROUP,ME(e,t);break}case p.TR:{e.tmplInsertionModeStack[0]=w.IN_TABLE_BODY,e.insertionMode=w.IN_TABLE_BODY,qh(e,t);break}case p.TD:case p.TH:{e.tmplInsertionModeStack[0]=w.IN_ROW,e.insertionMode=w.IN_ROW,Vh(e,t);break}default:e.tmplInsertionModeStack[0]=w.IN_BODY,e.insertionMode=w.IN_BODY,dn(e,t)}}function pU(e,t){t.tagID===p.TEMPLATE&&Oo(e,t)}function fk(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(p.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):wE(e,t)}function mU(e,t){t.tagID===p.HTML?dn(e,t):Hh(e,t)}function dk(e,t){var n;if(t.tagID===p.HTML){if(e.fragmentContext||(e.insertionMode=w.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===p.HTML){e._setEndLocation(e.openElements.items[0],t);let r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Hh(e,t)}function Hh(e,t){e.insertionMode=w.IN_BODY,zh(e,t)}function gU(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.FRAMESET:{e._insertElement(t,j.HTML);break}case p.FRAME:{e._appendElement(t,j.HTML),t.ackSelfClosing=!0;break}case p.NOFRAMES:{Pr(e,t);break}default:}}function bU(e,t){t.tagID===p.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==p.FRAMESET&&(e.insertionMode=w.AFTER_FRAMESET))}function EU(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.NOFRAMES:{Pr(e,t);break}default:}}function yU(e,t){t.tagID===p.HTML&&(e.insertionMode=w.AFTER_AFTER_FRAMESET)}function TU(e,t){t.tagID===p.HTML?dn(e,t):Ph(e,t)}function Ph(e,t){e.insertionMode=w.IN_BODY,zh(e,t)}function SU(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.NOFRAMES:{Pr(e,t);break}default:}}function _U(e,t){t.chars=Qe,e._insertCharacters(t)}function xU(e,t){e._insertCharacters(t),e.framesetOk=!1}function hk(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==j.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function AU(e,t){if(Yv(t))hk(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===j.MATHML?xE(t):r===j.SVG&&(Kv(t),AE(t)),Bh(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function CU(e,t){if(t.tagID===p.P||t.tagID===p.BR){hk(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===j.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}var ete=String.prototype.codePointAt==null?(e,t)=>(e.charCodeAt(t)&64512)===55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t):(e,t)=>e.codePointAt(t);var ste=new Set([I.AREA,I.BASE,I.BASEFONT,I.BGSOUND,I.BR,I.COL,I.EMBED,I.FRAME,I.HR,I.IMG,I.INPUT,I.KEYGEN,I.LINK,I.META,I.PARAM,I.SOURCE,I.TRACK,I.WBR]);function pk(e,t,n){typeof e=="string"&&(n=t,t=e,e=null);let r=Pa.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}var Ur={basename:NU,dirname:vU,extname:kU,join:wU,sep:"/"};function NU(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ac(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function vU(e){if(Ac(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function kU(e){Ac(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function wU(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function OU(e,t){let n="",r=0,i=-1,a=0,o=-1,s,l;for(;++o<=e.length;){if(o2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,a=0;continue}}else if(n.length>0){n="",r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ac(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var mk={cwd:RU};function RU(){return"/"}function bl(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function gk(e){if(typeof e=="string")e=new URL(e);else if(!bl(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return DU(e)}function DU(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let t=e.pathname,n=-1;for(;++n":""))+")"})}return d;function d(){let h=Ek,m,b,E;if((!t||a(l,u,c[c.length-1]||void 0))&&(h=zU(n(l,c)),h[0]===Do))return h;if("children"in l&&l.children){let g=l;if(g.children&&h[0]!==ei)for(b=(r?g.children.length:-1)+o,E=c.concat(g);b>-1&&bi||n!==-1&&t>n||r!==-1&&t>r||qU.test(e.slice(0,t)))}function IE(e){ht(e,"element",t=>{for(let[n,r]of Object.entries(FU)){if(r!==null&&!r.includes(t.tagName))continue;let i=t.properties?.[n];typeof i=="string"&&!VU(i)&&(t.properties[n]="")}})}var El="dataPending";function Kh(e){return typeof e=="string"?e.split(/\s+/).includes("suggestion"):Array.isArray(e)?e.includes("suggestion"):!1}function Nc(e){return e?e.map(t=>t.type==="text"?t.value:t.type==="element"?Nc(t.children):"").join("").trim():""}function yl(e){if(e.type!=="element")return!1;let t=e.properties;return t?Kh(t.className)||"dataSuggestion"in t:!1}var GU="markdown-stream-dot";function YU(){return{type:"element",tagName:"svg",properties:{width:12,height:12,viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:[GU],style:"margin-left:.25em;margin-top:-.25em",ariaHidden:"true"},children:[{type:"element",tagName:"circle",properties:{cx:6,cy:6,r:6},children:[]}]}}var KU=new Set(["p","div","pre","ul","ol"]),$U=new Set(["p","h1","h2","h3","h4","h5","h6","li","code"]);function jU(e){return e.type==="text"?/\S/.test(e.value):!1}function XU(e){return e.tagName!=="ul"&&e.tagName!=="ol"?!1:e.properties!=null&&El in e.properties}function yk(e){if(e.children.length===0)return e;let t=WU(e),n={...e,children:[...e.children]},r=n.children;for(let i=0;i=0;l--){let u=i[l];if(u.type!=="doctype"&&(u.type==="element"||jU(u))){a=l,o=u;break}}if(!o||o.type!=="element")return t;let s=o.tagName;if(KU.has(s)){if(t.push({index:a}),XU(o))return t;n=o;continue}return $U.has(s)&&t.push({index:a}),t}return t}function Tk(e){return e.type==="text"&&e.value.trim()!==""}function $h(e){return e.filter(t=>t.type==="element"||t.type==="text"&&t.value.trim()!=="")}function Sk(e){let t=e.children;if(t.some(Tk))return!1;let n=t.filter(r=>r.type==="element");if(n.length===0)return!1;for(let r of n){if(r.tagName!=="li")return!1;let i=r.children;if(i.some(Tk))return!1;let a=$h(i).filter(s=>s.type==="element");if(a.length!==1)return!1;let o=a[0];if(!o||!yl(o))return!1}return!0}function LE(e,...t){let n;Array.isArray(e)?n=[...e]:typeof e=="string"&&e.trim()!==""?n=e.split(/\s+/).filter(Boolean):n=[];for(let r of t)n.includes(r)||n.push(r);return n}function QU(e,...t){let n;return Array.isArray(e)?n=[...e]:typeof e=="string"&&e.trim()!==""?n=e.split(/\s+/).filter(Boolean):n=[],n.filter(r=>!t.includes(String(r)))}function _k(e,t){return{type:"element",tagName:"div",properties:{className:[e]},children:t}}function ZU(e,t){return _k(e,[{type:"text",value:t}])}function xk(e,t){let n=["shiny-chat-suggestion-list"];t&&n.push("shiny-chat-suggestion-list--ordered"),e.properties.className=LE(e.properties.className,...n),e.properties.role="list";let r=0;for(let i of e.children){if(i.type!=="element"||i.tagName!=="li")continue;let a=i.children,o=$h(a).find(yl),s=Nc(o.children),l=o.properties.title,u=typeof l=="string"&&l.trim()!==""?l.trim():null,c=u?ZU("shiny-chat-suggestion-list-item-title",u):null,f=_k("shiny-chat-suggestion-list-item-body",o.children);o.children=c?[c,f]:[f],o.properties.className=LE(o.properties.className,"shiny-chat-suggestion-list-item");let d=o.properties.dataSuggestion;if(typeof d=="string"&&d!==""||(o.properties.dataSuggestion=s),t){let b=r+1;o.properties.ariaLabel=u?`Use chat suggestion #${b}: ${u} \u2014 ${s}`:`Use chat suggestion #${b}: ${s}`}else o.properties.ariaLabel=u?`Use chat suggestion: ${u} \u2014 ${s}`:`Use chat suggestion: ${s}`;let h=o.properties.style,m=`--_card-index:${r}`;o.properties.style=typeof h=="string"&&h!==""?`${m};${h}`:m,delete o.properties.title,i.properties.role="listitem",r++}}var JU=/^\s*<(s(p(a(n(\s[^>]*)?)?)?)?)?$/i;function eH(e){let n=e.children.filter(s=>s.type==="element");if(n.length===0)return!1;let r=n[n.length-1];if(r.tagName!=="li")return!1;let i=n.slice(0,-1),a=!1;for(let s of i){if(s.tagName!=="li")return!1;let l=s.children,u=$h(l);if(u.length!==0){if(u.length===1&&yl(u[0])){a=!0;continue}return!1}}let o=$h(r.children);if(o.length!==0){if(o.length===1&&yl(o[0]))a=!0;else if(!(o.length===1&&o[0].type==="text"&&JU.test(o[0].value)))return!1}return a||n.length===1}function tH(e,t){let n=["shiny-chat-suggestion-list"];t&&n.push("shiny-chat-suggestion-list--ordered"),e.properties.className=LE(e.properties.className,...n),e.properties[El]=""}function nH(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.type==="element")return n}return null}var BE=()=>e=>{let t=nH(e.children);for(let n of e.children){if(n.type!=="element")continue;let r=n;if(!(r.tagName!=="ul"&&r.tagName!=="ol")){if(r===t){eH(r)&&tH(r,r.tagName==="ol");continue}Sk(r)&&xk(r,r.tagName==="ol")}}};function rH(e){return{...e,properties:{...e.properties},children:e.children.map(n=>{if(n.type!=="element"||n.tagName!=="li")return n;let r=n;return{...r,properties:{...r.properties},children:r.children.map(a=>{if(!yl(a))return a;let o=a;return{...o,properties:{...o.properties},children:[...o.children]}})}})}}function Ak(e){let t=[];for(let r=0;r(0,Tl.jsx)(e,typeof e=="string"?Ck(e,t):t,n),oH=(e,t,n)=>(0,Tl.jsxs)(e,typeof e=="string"?Ck(e,t):t,n);function Nk(e,t){let n=new Ro(e),r=t.runSync(t.parse(n),n);return IE(r),r}function vk(e,t){let n=cc(pk(e));return t.runSync(n),IE(n),n}function kk(e,t){let{tagToComponentMap:n,streaming:r}=t,i=r?e:Ak(e),a=r?yk(i):i;return uE(a,{Fragment:Tl.Fragment,jsx:aH,jsxs:oH,components:n,passKeys:!0,passNode:!0,ignoreInvalidStyle:!0})}function PE(e){if(e)throw e}var Wh=q(Pk(),1);function vc(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function UE(){let e=[],t={run:n,use:r};return t;function n(...i){let a=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...u){let c=e[++a],f=-1;if(l){o(l);return}for(;++fo.length,l;s&&o.push(i);try{l=e.apply(this,o)}catch(u){let c=u;if(s&&n)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){n||(n=!0,t(o,...s))}function a(o){i(null,o)}}var Hk=function(e){let r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a};var sH={}.hasOwnProperty,qE=class e extends Hk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=UE()}copy(){let t=new e,n=-1;for(;++n0){let[h,...m]=c,b=r[d][1];vc(b)&&vc(h)&&(h=(0,Wh.default)(!0,b,h)),r[d]=[u,h,...m]}}}},kc=new qE().freeze();function HE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function FE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zk(e){if(!vc(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Fk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Xh(e){return lH(e)?e:new Ro(e)}function lH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function uH(e){return typeof e=="string"||cH(e)}function cH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var fH={};function Io(e,t){let n=t||fH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Vk(e,r,i)}function Vk(e,t,n){if(dH(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qk(e.children,t,n)}return Array.isArray(e)?qk(e,t,n):""}function qk(e,t,n){let r=[],i=-1;for(;++ii?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(kt(e,e.length,0,t),e):t}var Yk={}.hasOwnProperty;function Qh(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function hn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var zt=Ua(/[A-Za-z]/),Tt=Ua(/[\dA-Za-z]/),Kk=Ua(/[#-'*+\--9=?A-Z^-~]/);function Lo(e){return e!==null&&(e<32||e===127)}var wc=Ua(/\d/),$k=Ua(/[\dA-Fa-f]/),jk=Ua(/[!-/:-@[-`{-~]/);function te(e){return e!==null&&e<-2}function ve(e){return e!==null&&(e<0||e===32)}function he(e){return e===-2||e===-1||e===32}var Bo=Ua(/\p{P}|\p{S}/u),ti=Ua(/\s/);function Ua(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function xr(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function de(e,t,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return he(l)?(e.enter(n),s(l)):t(l)}function s(l){return he(l)&&a++o))return;let M=t.events.length,R=M,L,A;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(L){A=t.events[R][1].end;break}L=!0}for(g(r),x=M;xT;){let v=n[S];t.containerState=v[1],v[0].exit.call(t,e)}n.length=T}function y(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function bH(e,t,n){return de(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pi(e){if(e===null||ve(e)||ti(e))return 1;if(Bo(e))return 2}function Ha(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let f={...e[r][1].end},d={...e[n][1].start};Zk(f,-l),Zk(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},a={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=An(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=An(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",a,t]]),u=An(u,Ha(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=An(u,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=An(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,kt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&he(x)?de(e,y,"linePrefix",a+1)(x):y(x)}function y(x){return x===null||te(x)?e.check(Jk,b,S)(x):(e.enter("codeFlowValue"),T(x))}function T(x){return x===null||te(x)?(e.exit("codeFlowValue"),y(x)):(e.consume(x),T)}function S(x){return e.exit("codeFenced"),t(x)}function v(x,M,R){let L=0;return A;function A($){return x.enter("lineEnding"),x.consume($),x.exit("lineEnding"),H}function H($){return x.enter("codeFencedFence"),he($)?de(x,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):Y($)}function Y($){return $===s?(x.enter("codeFencedFenceSequence"),z($)):R($)}function z($){return $===s?(L++,x.consume($),z):L>=o?(x.exit("codeFencedFenceSequence"),he($)?de(x,V,"whitespace")($):V($)):R($)}function V($){return $===null||te($)?(x.exit("codeFencedFence"),M($)):R($)}}}function kH(e,t,n){let r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}var Oc={name:"codeIndented",tokenize:MH},wH={partial:!0,tokenize:OH};function MH(e,t,n){let r=this;return i;function i(u){return e.enter("codeIndented"),de(e,a,"linePrefix",5)(u)}function a(u){let c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):te(u)?e.attempt(wH,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||te(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function OH(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):de(e,a,"linePrefix",5)(o)}function a(o){let s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):te(o)?i(o):n(o)}}var GE={name:"codeText",previous:DH,resolve:RH,tokenize:IH};function RH(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){let i=n||0;this.setCursor(Math.trunc(t));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Rc(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Rc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Rc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ap(e,t,n,r,i,a,o,s,l){let u=l||Number.POSITIVE_INFINITY,c=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(g),e.exit(a),d):g===null||g===32||g===41||Lo(g)?n(g):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),b(g))}function d(g){return g===62?(e.enter(a),e.consume(g),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(s),d(g)):g===null||g===60||te(g)?n(g):(e.consume(g),g===92?m:h)}function m(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function b(g){return!c&&(g===null||g===41||ve(g))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(g)):c999||h===null||h===91||h===93&&!l||h===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(a),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):te(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||te(h)||s++>999?(e.exit("chunkString"),c(h)):(e.consume(h),l||(l=!he(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(e.consume(h),s++,f):f(h)}}function sp(e,t,n,r,i,a){let o;return s;function s(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,l):n(d)}function l(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(e.enter(a),u(d))}function u(d){return d===o?(e.exit(a),l(o)):d===null?n(d):te(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),de(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===o||d===null||te(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:c)}function f(d){return d===o||d===92?(e.consume(d),c):c(d)}}function Po(e,t){let n;return r;function r(i){return te(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):he(i)?de(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}var KE={name:"definition",tokenize:FH},zH={partial:!0,tokenize:qH};function FH(e,t,n){let r=this,i;return a;function a(h){return e.enter("definition"),o(h)}function o(h){return op.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function s(h){return i=hn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ve(h)?Po(e,u)(h):u(h)}function u(h){return ap(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(zH,f,f)(h)}function f(h){return he(h)?de(e,d,"whitespace")(h):d(h)}function d(h){return h===null||te(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function qH(e,t,n){return r;function r(s){return ve(s)?Po(e,i)(s):n(s)}function i(s){return sp(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return he(s)?de(e,o,"whitespace")(s):o(s)}function o(s){return s===null||te(s)?t(s):n(s)}}var $E={name:"hardBreakEscape",tokenize:VH};function VH(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return te(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}var jE={name:"headingAtx",resolve:GH,tokenize:YH};function GH(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},kt(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function YH(e,t,n){let r=0;return i;function i(c){return e.enter("atxHeading"),a(c)}function a(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||ve(c)?(e.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||te(c)?(e.exit("atxHeading"),t(c)):he(c)?de(e,s,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||ve(c)?(e.exit("atxHeadingText"),s(c)):(e.consume(c),u)}}var e2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],XE=["pre","script","style","textarea"];var WE={concrete:!0,name:"htmlFlow",resolveTo:jH,tokenize:XH},KH={partial:!0,tokenize:QH},$H={partial:!0,tokenize:WH};function jH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function XH(e,t,n){let r=this,i,a,o,s,l;return u;function u(k){return c(k)}function c(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),f}function f(k){return k===33?(e.consume(k),d):k===47?(e.consume(k),a=!0,b):k===63?(e.consume(k),i=3,r.interrupt?t:N):zt(k)?(e.consume(k),o=String.fromCharCode(k),E):n(k)}function d(k){return k===45?(e.consume(k),i=2,h):k===91?(e.consume(k),i=5,s=0,m):zt(k)?(e.consume(k),i=4,r.interrupt?t:N):n(k)}function h(k){return k===45?(e.consume(k),r.interrupt?t:N):n(k)}function m(k){let Te="CDATA[";return k===Te.charCodeAt(s++)?(e.consume(k),s===Te.length?r.interrupt?t:Y:m):n(k)}function b(k){return zt(k)?(e.consume(k),o=String.fromCharCode(k),E):n(k)}function E(k){if(k===null||k===47||k===62||ve(k)){let Te=k===47,be=o.toLowerCase();return!Te&&!a&&XE.includes(be)?(i=1,r.interrupt?t(k):Y(k)):e2.includes(o.toLowerCase())?(i=6,Te?(e.consume(k),g):r.interrupt?t(k):Y(k)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):a?y(k):T(k))}return k===45||Tt(k)?(e.consume(k),o+=String.fromCharCode(k),E):n(k)}function g(k){return k===62?(e.consume(k),r.interrupt?t:Y):n(k)}function y(k){return he(k)?(e.consume(k),y):A(k)}function T(k){return k===47?(e.consume(k),A):k===58||k===95||zt(k)?(e.consume(k),S):he(k)?(e.consume(k),T):A(k)}function S(k){return k===45||k===46||k===58||k===95||Tt(k)?(e.consume(k),S):v(k)}function v(k){return k===61?(e.consume(k),x):he(k)?(e.consume(k),v):T(k)}function x(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,M):he(k)?(e.consume(k),x):R(k)}function M(k){return k===l?(e.consume(k),l=null,L):k===null||te(k)?n(k):(e.consume(k),M)}function R(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||ve(k)?v(k):(e.consume(k),R)}function L(k){return k===47||k===62||he(k)?T(k):n(k)}function A(k){return k===62?(e.consume(k),H):n(k)}function H(k){return k===null||te(k)?Y(k):he(k)?(e.consume(k),H):n(k)}function Y(k){return k===45&&i===2?(e.consume(k),D):k===60&&i===1?(e.consume(k),B):k===62&&i===4?(e.consume(k),ae):k===63&&i===3?(e.consume(k),N):k===93&&i===5?(e.consume(k),F):te(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check(KH,ce,z)(k)):k===null||te(k)?(e.exit("htmlFlowData"),z(k)):(e.consume(k),Y)}function z(k){return e.check($H,V,ce)(k)}function V(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),$}function $(k){return k===null||te(k)?z(k):(e.enter("htmlFlowData"),Y(k))}function D(k){return k===45?(e.consume(k),N):Y(k)}function B(k){return k===47?(e.consume(k),o="",K):Y(k)}function K(k){if(k===62){let Te=o.toLowerCase();return XE.includes(Te)?(e.consume(k),ae):Y(k)}return zt(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),K):Y(k)}function F(k){return k===93?(e.consume(k),N):Y(k)}function N(k){return k===62?(e.consume(k),ae):k===45&&i===2?(e.consume(k),N):Y(k)}function ae(k){return k===null||te(k)?(e.exit("htmlFlowData"),ce(k)):(e.consume(k),ae)}function ce(k){return e.exit("htmlFlow"),t(k)}}function WH(e,t,n){let r=this;return i;function i(o){return te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function QH(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ni,t,n)}}var QE={name:"htmlText",tokenize:ZH};function ZH(e,t,n){let r=this,i,a,o;return s;function s(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),u):N===47?(e.consume(N),v):N===63?(e.consume(N),T):zt(N)?(e.consume(N),R):n(N)}function u(N){return N===45?(e.consume(N),c):N===91?(e.consume(N),a=0,m):zt(N)?(e.consume(N),y):n(N)}function c(N){return N===45?(e.consume(N),h):n(N)}function f(N){return N===null?n(N):N===45?(e.consume(N),d):te(N)?(o=f,B(N)):(e.consume(N),f)}function d(N){return N===45?(e.consume(N),h):f(N)}function h(N){return N===62?D(N):N===45?d(N):f(N)}function m(N){let ae="CDATA[";return N===ae.charCodeAt(a++)?(e.consume(N),a===ae.length?b:m):n(N)}function b(N){return N===null?n(N):N===93?(e.consume(N),E):te(N)?(o=b,B(N)):(e.consume(N),b)}function E(N){return N===93?(e.consume(N),g):b(N)}function g(N){return N===62?D(N):N===93?(e.consume(N),g):b(N)}function y(N){return N===null||N===62?D(N):te(N)?(o=y,B(N)):(e.consume(N),y)}function T(N){return N===null?n(N):N===63?(e.consume(N),S):te(N)?(o=T,B(N)):(e.consume(N),T)}function S(N){return N===62?D(N):T(N)}function v(N){return zt(N)?(e.consume(N),x):n(N)}function x(N){return N===45||Tt(N)?(e.consume(N),x):M(N)}function M(N){return te(N)?(o=M,B(N)):he(N)?(e.consume(N),M):D(N)}function R(N){return N===45||Tt(N)?(e.consume(N),R):N===47||N===62||ve(N)?L(N):n(N)}function L(N){return N===47?(e.consume(N),D):N===58||N===95||zt(N)?(e.consume(N),A):te(N)?(o=L,B(N)):he(N)?(e.consume(N),L):D(N)}function A(N){return N===45||N===46||N===58||N===95||Tt(N)?(e.consume(N),A):H(N)}function H(N){return N===61?(e.consume(N),Y):te(N)?(o=H,B(N)):he(N)?(e.consume(N),H):L(N)}function Y(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),i=N,z):te(N)?(o=Y,B(N)):he(N)?(e.consume(N),Y):(e.consume(N),V)}function z(N){return N===i?(e.consume(N),i=void 0,$):N===null?n(N):te(N)?(o=z,B(N)):(e.consume(N),z)}function V(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||ve(N)?L(N):(e.consume(N),V)}function $(N){return N===47||N===62||ve(N)?L(N):n(N)}function D(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function B(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),K}function K(N){return he(N)?de(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):F(N)}function F(N){return e.enter("htmlTextData"),o(N)}}var Uo={name:"labelEnd",resolveAll:nz,resolveTo:rz,tokenize:iz},JH={tokenize:az},ez={tokenize:oz},tz={tokenize:sz};function nz(e){let t=-1,n=[];for(;++t=3&&(u===null||te(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),he(u)?de(e,s,"whitespace")(u):s(u))}}var pn={continuation:{tokenize:mz},exit:bz,name:"list",tokenize:pz},dz={partial:!0,tokenize:Ez},hz={partial:!0,tokenize:gz};function pz(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(h){let m=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:wc(h)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Ho,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return wc(h)&&++o<10?(e.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(ni,r.interrupt?n:c,e.attempt(dz,d,f))}function c(h){return r.containerState.initialBlankLine=!0,a++,d(h)}function f(h){return he(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function mz(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ni,i,a);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,de(e,t,"listItemIndent",r.containerState.size+1)(s)}function a(s){return r.containerState.furtherBlankLines||!he(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(hz,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,de(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function gz(e,t,n){let r=this;return de(e,i,"listItemIndent",r.containerState.size+1);function i(a){let o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function bz(e){e.exit(this.containerState.type)}function Ez(e,t,n){let r=this;return de(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let o=r.events[r.events.length-1];return!he(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}var lp={name:"setextUnderline",resolveTo:yz,tokenize:Tz};function yz(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Tz(e,t,n){let r=this,i;return a;function a(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),he(u)?de(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||te(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}var t2={tokenize:Sz};function Sz(e){let t=this,n=e.attempt(ni,r,e.attempt(this.parser.constructs.flowInitial,i,de(e,e.attempt(this.parser.constructs.flow,i,e.attempt(YE,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var n2={resolveAll:o2()},r2=a2("string"),i2=a2("text");function a2(e){return{resolveAll:o2(e==="text"?_z:void 0),tokenize:t};function t(n){let r=this,i=this.parser.constructs[e],a=n.attempt(i,o,s);return o;function o(c){return u(c)?a(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),a(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;let f=i[c],d=-1;if(f)for(;++dMz,contentInitial:()=>Az,disable:()=>Oz,document:()=>xz,flow:()=>Nz,flowInitial:()=>Cz,insideSpan:()=>wz,string:()=>vz,text:()=>kz});var xz={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:Jh},Az={91:KE},Cz={[-2]:Oc,[-1]:Oc,32:Oc},Nz={35:jE,42:Ho,45:[lp,Ho],60:WE,61:lp,95:Ho,96:np,126:np},vz={38:tp,92:ep},kz={[-5]:Dc,[-4]:Dc,[-3]:Dc,33:ZE,38:tp,42:Mc,60:[VE,QE],91:JE,92:[$E,ep],93:Uo,95:Mc,96:GE},wz={null:[Mc,n2]},Mz={null:[42,95]},Oz={null:[]};function s2(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l=!0,u={attempt:L(M),check:L(R),consume:S,enter:v,exit:x,interrupt:L(R,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:E,parser:e,previous:null,sliceSerialize:m,sliceStream:b,write:h},f=t.tokenize.call(c,u),d;return t.resolveAll&&a.push(t),c;function h(z){return o=An(o,z),y(),o[o.length-1]!==null?[]:(A(t,0),c.events=Ha(a,c.events,c),c.events)}function m(z,V){return Dz(b(z),V)}function b(z){return Rz(o,z)}function E(){let{_bufferIndex:z,_index:V,line:$,column:D,offset:B}=r;return{_bufferIndex:z,_index:V,line:$,column:D,offset:B}}function g(z){i[z.line]=z.column,Y()}function y(){let z;for(;r._index-1){let s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Dz(e,t){let n=-1,r=[],i;for(;++n\``.split("")]],single:[["&'".split(""),"\"&'`".split("")],["\0&'".split(""),"\0\"&'`".split("")]],double:[['"&'.split(""),"\"&'`".split("")],['\0"&'.split(""),"\0\"&'`".split("")]]};function $N(e,t,n,r){let i=r.schema,a=i.space==="svg"?!1:r.settings.omitOptionalTags,o=i.space==="svg"?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],l;i.space==="html"&&e.tagName==="svg"&&(r.schema=cn);let u=Z5(r,e.properties),c=r.all(i.space==="html"&&e.tagName==="template"?e.content:e);return r.schema=i,c&&(o=!1),(u||!a||!KN(e,t,n))&&(s.push("<",e.tagName,u?" "+u:""),o&&(i.space==="svg"||r.settings.closeSelfClosing)&&(l=u.charAt(u.length-1),(!r.settings.tightSelfClosing||l==="/"||l&&l!=='"'&&l!=="'")&&s.push(" "),s.push("/")),s.push(">")),s.push(c),!o&&(!a||!oc(e,t,n))&&s.push(""),s.join("")}function Z5(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let a=J5(e,i,t[i]);a&&n.push(a)}}for(;++rfl(n,e.alternative)&&(o=e.alternative),s=o+Li(n,Object.assign({},e.settings.characterReferences,{subset:(o==="'"?Th.single:Th.double)[i][a],attribute:!0}))+o),l+(s&&"="+s))}var eP=["<","&"];function Sh(e,t,n,r){return n&&n.type==="element"&&(n.tagName==="script"||n.tagName==="style")?e.value:Li(e.value,Object.assign({},r.settings.characterReferences,{subset:eP}))}function jN(e,t,n,r){return r.settings.allowDangerousHtml?e.value:Sh(e,t,n,r)}function XN(e,t,n,r){return r.all(e)}var WN=cl("type",{invalid:tP,unknown:nP,handlers:{comment:zN,doctype:FN,element:$N,raw:jN,root:XN,text:Sh}});function tP(e){throw new Error("Expected node, not `"+e+"`")}function nP(e){let t=e;throw new Error("Cannot compile unknown node `"+t.type+"`")}var rP={},iP={},aP=[];function iE(e,t){let n=t||rP,r=n.quote||'"',i=r==='"'?"'":'"';if(r!=='"'&&r!=="'")throw new Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:oP,all:sP,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||hh,characterReferences:n.characterReferences||iP,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space==="svg"?cn:Ir,quote:r,alternative:i}.one(Array.isArray(e)?{type:"root",children:e}:e,void 0,void 0)}function oP(e,t,n){return WN(e,t,n,this)}function sP(e){let t=[],n=e&&e.children||aP,r=-1;for(;++r0&&typeof r.column=="number"&&r.column>0)return{line:r.line,column:r.column,offset:typeof r.offset=="number"&&r.offset>-1?r.offset:void 0}}}function lc(e){let t=Un(e),n=Mo(e);if(t&&n)return{start:t,end:n}}function Ra(e){return!e||typeof e!="object"?"":"position"in e||"type"in e?uv(e.position):"start"in e||"end"in e?uv(e):"line"in e||"column"in e?sE(e):""}function sE(e){return cv(e&&e.line)+":"+cv(e&&e.column)}function uv(e){return sE(e&&e.start)+"-"+sE(e&&e.end)}function cv(e){return e&&typeof e=="number"?e:1}var vt=class extends Error{constructor(t,n,r){super(),typeof n=="string"&&(r=n,n=void 0);let i="",a={},o=!1;if(n&&("line"in n&&"column"in n?a={place:n}:"start"in n&&"end"in n?a={place:n}:"type"in n?a={ancestors:[n],place:n.position}:a={...n}),typeof t=="string"?i=t:!a.cause&&t&&(o=!0,i=t.message,a.cause=t),!a.ruleId&&!a.source&&typeof r=="string"){let l=r.indexOf(":");l===-1?a.ruleId=r:(a.source=r.slice(0,l),a.ruleId=r.slice(l+1))}if(!a.place&&a.ancestors&&a.ancestors){let l=a.ancestors[a.ancestors.length-1];l&&(a.place=l.position)}let s=a.place&&"start"in a.place?a.place.start:a.place;this.ancestors=a.ancestors||void 0,this.cause=a.cause||void 0,this.column=s?s.column:void 0,this.fatal=void 0,this.file="",this.message=i,this.line=s?s.line:void 0,this.name=Ra(a.place)||"1:1",this.place=a.place||void 0,this.reason=this.message,this.ruleId=a.ruleId||void 0,this.source=a.source||void 0,this.stack=o&&a.cause&&typeof a.cause.stack=="string"?a.cause.stack:"",this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};vt.prototype.file="";vt.prototype.name="";vt.prototype.reason="";vt.prototype.message="";vt.prototype.stack="";vt.prototype.column=void 0;vt.prototype.line=void 0;vt.prototype.ancestors=void 0;vt.prototype.cause=void 0;vt.prototype.fatal=void 0;vt.prototype.place=void 0;vt.prototype.ruleId=void 0;vt.prototype.source=void 0;var lE={}.hasOwnProperty,BP=new Map,PP=/[A-Z]/g,UP=new Set(["table","tbody","thead","tfoot","tr"]),HP=new Set(["td","th"]),dv="https://github.com/syntax-tree/hast-util-to-jsx-runtime";function uE(e,t){if(!t||t.Fragment===void 0)throw new TypeError("Expected `Fragment` in options");let n=t.filePath||void 0,r;if(t.development){if(typeof t.jsxDEV!="function")throw new TypeError("Expected `jsxDEV` in options when `development: true`");r=$P(n,t.jsxDEV)}else{if(typeof t.jsx!="function")throw new TypeError("Expected `jsx` in production options");if(typeof t.jsxs!="function")throw new TypeError("Expected `jsxs` in production options");r=KP(n,t.jsx,t.jsxs)}let i={Fragment:t.Fragment,ancestors:[],components:t.components||{},create:r,elementAttributeNameCase:t.elementAttributeNameCase||"react",evaluater:t.createEvaluater?t.createEvaluater():void 0,filePath:n,ignoreInvalidStyle:t.ignoreInvalidStyle||!1,passKeys:t.passKeys!==!1,passNode:t.passNode||!1,schema:t.space==="svg"?cn:Ir,stylePropertyNameCase:t.stylePropertyNameCase||"dom",tableCellAlignToStyle:t.tableCellAlignToStyle!==!1},a=hv(i,e,void 0);return a&&typeof a!="string"?a:i.create(e,i.Fragment,{children:a||void 0},void 0)}function hv(e,t,n){if(t.type==="element")return zP(e,t,n);if(t.type==="mdxFlowExpression"||t.type==="mdxTextExpression")return FP(e,t);if(t.type==="mdxJsxFlowElement"||t.type==="mdxJsxTextElement")return VP(e,t,n);if(t.type==="mdxjsEsm")return qP(e,t);if(t.type==="root")return GP(e,t,n);if(t.type==="text")return YP(e,t)}function zP(e,t,n){let r=e.schema,i=r;t.tagName.toLowerCase()==="svg"&&r.space==="html"&&(i=cn,e.schema=i),e.ancestors.push(t);let a=mv(e,t.tagName,!1),o=jP(e,t),s=fE(e,t);return UP.has(t.tagName)&&(s=s.filter(function(l){return typeof l=="string"?!Bi(l):!0})),pv(e,o,a,t),cE(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function FP(e,t){if(t.data&&t.data.estree&&e.evaluater){let r=t.data.estree.body[0];return r.type,e.evaluater.evaluateExpression(r.expression)}uc(e,t.position)}function qP(e,t){if(t.data&&t.data.estree&&e.evaluater)return e.evaluater.evaluateProgram(t.data.estree);uc(e,t.position)}function VP(e,t,n){let r=e.schema,i=r;t.name==="svg"&&r.space==="html"&&(i=cn,e.schema=i),e.ancestors.push(t);let a=t.name===null?e.Fragment:mv(e,t.name,!0),o=XP(e,t),s=fE(e,t);return pv(e,o,a,t),cE(o,s),e.ancestors.pop(),e.schema=r,e.create(t,a,o,n)}function GP(e,t,n){let r={};return cE(r,fE(e,t)),e.create(t,e.Fragment,r,n)}function YP(e,t){return t.value}function pv(e,t,n,r){typeof n!="string"&&n!==e.Fragment&&e.passNode&&(t.node=r)}function cE(e,t){if(t.length>0){let n=t.length>1?t:t[0];n&&(e.children=n)}}function KP(e,t,n){return r;function r(i,a,o,s){let u=Array.isArray(o.children)?n:t;return s?u(a,o,s):u(a,o)}}function $P(e,t){return n;function n(r,i,a,o){let s=Array.isArray(a.children),l=Un(r);return t(i,a,o,s,{columnNumber:l?l.column-1:void 0,fileName:e,lineNumber:l?l.line:void 0},void 0)}}function jP(e,t){let n={},r,i;for(i in t.properties)if(i!=="children"&&lE.call(t.properties,i)){let a=WP(e,i,t.properties[i]);if(a){let[o,s]=a;e.tableCellAlignToStyle&&o==="align"&&typeof s=="string"&&HP.has(t.tagName)?r=s:n[o]=s}}if(r){let a=n.style||(n.style={});a[e.stylePropertyNameCase==="css"?"text-align":"textAlign"]=r}return n}function XP(e,t){let n={};for(let r of t.attributes)if(r.type==="mdxJsxExpressionAttribute")if(r.data&&r.data.estree&&e.evaluater){let a=r.data.estree.body[0];a.type;let o=a.expression;o.type;let s=o.properties[0];s.type,Object.assign(n,e.evaluater.evaluateExpression(s.argument))}else uc(e,t.position);else{let i=r.name,a;if(r.value&&typeof r.value=="object")if(r.value.data&&r.value.data.estree&&e.evaluater){let s=r.value.data.estree.body[0];s.type,a=e.evaluater.evaluateExpression(s.expression)}else uc(e,t.position);else a=r.value===null?!0:r.value;n[i]=a}return n}function fE(e,t){let n=[],r=-1,i=e.passKeys?new Map:BP;for(;++r-1&&a<=t.length){let o=0;for(;;){let s=n[o];if(s===void 0){let l=yv(t,n[o-1]);s=l===-1?t.length+1:l+1,n[o]=s}if(s>a)return{line:o+1,column:a-(o>0?n[o-1]:0)+1,offset:a};o++}}}function i(a){if(a&&typeof a.line=="number"&&typeof a.column=="number"&&!Number.isNaN(a.line)&&!Number.isNaN(a.column)){for(;n.length1?n[a.line-2]:0)+a.column-1;if(o=55296&&e<=57343}function Nv(e){return e>=56320&&e<=57343}function vv(e,t){return(e-55296)*1024+9216+t}function vh(e){return e!==32&&e!==10&&e!==13&&e!==9&&e!==12&&e>=1&&e<=31||e>=127&&e<=159}function kh(e){return e>=64976&&e<=65007||c8.has(e)}var U;(function(e){e.controlCharacterInInputStream="control-character-in-input-stream",e.noncharacterInInputStream="noncharacter-in-input-stream",e.surrogateInInputStream="surrogate-in-input-stream",e.nonVoidHtmlElementStartTagWithTrailingSolidus="non-void-html-element-start-tag-with-trailing-solidus",e.endTagWithAttributes="end-tag-with-attributes",e.endTagWithTrailingSolidus="end-tag-with-trailing-solidus",e.unexpectedSolidusInTag="unexpected-solidus-in-tag",e.unexpectedNullCharacter="unexpected-null-character",e.unexpectedQuestionMarkInsteadOfTagName="unexpected-question-mark-instead-of-tag-name",e.invalidFirstCharacterOfTagName="invalid-first-character-of-tag-name",e.unexpectedEqualsSignBeforeAttributeName="unexpected-equals-sign-before-attribute-name",e.missingEndTagName="missing-end-tag-name",e.unexpectedCharacterInAttributeName="unexpected-character-in-attribute-name",e.unknownNamedCharacterReference="unknown-named-character-reference",e.missingSemicolonAfterCharacterReference="missing-semicolon-after-character-reference",e.unexpectedCharacterAfterDoctypeSystemIdentifier="unexpected-character-after-doctype-system-identifier",e.unexpectedCharacterInUnquotedAttributeValue="unexpected-character-in-unquoted-attribute-value",e.eofBeforeTagName="eof-before-tag-name",e.eofInTag="eof-in-tag",e.missingAttributeValue="missing-attribute-value",e.missingWhitespaceBetweenAttributes="missing-whitespace-between-attributes",e.missingWhitespaceAfterDoctypePublicKeyword="missing-whitespace-after-doctype-public-keyword",e.missingWhitespaceBetweenDoctypePublicAndSystemIdentifiers="missing-whitespace-between-doctype-public-and-system-identifiers",e.missingWhitespaceAfterDoctypeSystemKeyword="missing-whitespace-after-doctype-system-keyword",e.missingQuoteBeforeDoctypePublicIdentifier="missing-quote-before-doctype-public-identifier",e.missingQuoteBeforeDoctypeSystemIdentifier="missing-quote-before-doctype-system-identifier",e.missingDoctypePublicIdentifier="missing-doctype-public-identifier",e.missingDoctypeSystemIdentifier="missing-doctype-system-identifier",e.abruptDoctypePublicIdentifier="abrupt-doctype-public-identifier",e.abruptDoctypeSystemIdentifier="abrupt-doctype-system-identifier",e.cdataInHtmlContent="cdata-in-html-content",e.incorrectlyOpenedComment="incorrectly-opened-comment",e.eofInScriptHtmlCommentLikeText="eof-in-script-html-comment-like-text",e.eofInDoctype="eof-in-doctype",e.nestedComment="nested-comment",e.abruptClosingOfEmptyComment="abrupt-closing-of-empty-comment",e.eofInComment="eof-in-comment",e.incorrectlyClosedComment="incorrectly-closed-comment",e.eofInCdata="eof-in-cdata",e.absenceOfDigitsInNumericCharacterReference="absence-of-digits-in-numeric-character-reference",e.nullCharacterReference="null-character-reference",e.surrogateCharacterReference="surrogate-character-reference",e.characterReferenceOutsideUnicodeRange="character-reference-outside-unicode-range",e.controlCharacterReference="control-character-reference",e.noncharacterCharacterReference="noncharacter-character-reference",e.missingWhitespaceBeforeDoctypeName="missing-whitespace-before-doctype-name",e.missingDoctypeName="missing-doctype-name",e.invalidCharacterSequenceAfterDoctypeName="invalid-character-sequence-after-doctype-name",e.duplicateAttribute="duplicate-attribute",e.nonConformingDoctype="non-conforming-doctype",e.missingDoctype="missing-doctype",e.misplacedDoctype="misplaced-doctype",e.endTagWithoutMatchingOpenElement="end-tag-without-matching-open-element",e.closingOfElementWithOpenChildElements="closing-of-element-with-open-child-elements",e.disallowedContentInNoscriptInHead="disallowed-content-in-noscript-in-head",e.openElementsLeftAfterEof="open-elements-left-after-eof",e.abandonedHeadElementChild="abandoned-head-element-child",e.misplacedStartTagForHeadElement="misplaced-start-tag-for-head-element",e.nestedNoscriptInHead="nested-noscript-in-head",e.eofInElementThatCanContainOnlyText="eof-in-element-that-can-contain-only-text"})(U||(U={}));var d8=65536,wh=class{constructor(t){this.handler=t,this.html="",this.pos=-1,this.lastGapPos=-2,this.gapStack=[],this.skipNextNewLine=!1,this.lastChunkWritten=!1,this.endOfChunkHit=!1,this.bufferWaterline=d8,this.isEol=!1,this.lineStartPos=0,this.droppedBufferSize=0,this.line=1,this.lastErrOffset=-1}get col(){return this.pos-this.lineStartPos+ +(this.lastGapPos!==this.pos)}get offset(){return this.droppedBufferSize+this.pos}getError(t,n){let{line:r,col:i,offset:a}=this,o=i+n,s=a+n;return{code:t,startLine:r,endLine:r,startCol:o,endCol:o,startOffset:s,endOffset:s}}_err(t){this.handler.onParseError&&this.lastErrOffset!==this.offset&&(this.lastErrOffset=this.offset,this.handler.onParseError(this.getError(t,0)))}_addGap(){this.gapStack.push(this.lastGapPos),this.lastGapPos=this.pos}_processSurrogate(t){if(this.pos!==this.html.length-1){let n=this.html.charCodeAt(this.pos+1);if(Nv(n))return this.pos++,this._addGap(),vv(t,n)}else if(!this.lastChunkWritten)return this.endOfChunkHit=!0,_.EOF;return this._err(U.surrogateInInputStream),t}willDropParsedChunk(){return this.pos>this.bufferWaterline}dropParsedChunk(){this.willDropParsedChunk()&&(this.html=this.html.substring(this.pos),this.lineStartPos-=this.pos,this.droppedBufferSize+=this.pos,this.pos=0,this.lastGapPos=-2,this.gapStack.length=0)}write(t,n){this.html.length>0?this.html+=t:this.html=t,this.endOfChunkHit=!1,this.lastChunkWritten=n}insertHtmlAtCurrentPos(t){this.html=this.html.substring(0,this.pos+1)+t+this.html.substring(this.pos+1),this.endOfChunkHit=!1}startsWith(t,n){if(this.pos+t.length>this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,!1;if(n)return this.html.startsWith(t,this.pos);for(let r=0;r=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,_.EOF;let r=this.html.charCodeAt(n);return r===_.CARRIAGE_RETURN?_.LINE_FEED:r}advance(){if(this.pos++,this.isEol&&(this.isEol=!1,this.line++,this.lineStartPos=this.pos),this.pos>=this.html.length)return this.endOfChunkHit=!this.lastChunkWritten,_.EOF;let t=this.html.charCodeAt(this.pos);return t===_.CARRIAGE_RETURN?(this.isEol=!0,this.skipNextNewLine=!0,_.LINE_FEED):t===_.LINE_FEED&&(this.isEol=!0,this.skipNextNewLine)?(this.line--,this.skipNextNewLine=!1,this._addGap(),this.advance()):(this.skipNextNewLine=!1,Nh(t)&&(t=this._processSurrogate(t)),this.handler.onParseError===null||t>31&&t<127||t===_.LINE_FEED||t===_.CARRIAGE_RETURN||t>159&&t<64976||this._checkForProblematicCharacters(t),t)}_checkForProblematicCharacters(t){vh(t)?this._err(U.controlCharacterInInputStream):kh(t)&&this._err(U.noncharacterInInputStream)}retreat(t){for(this.pos-=t;this.posOe,getTokenAttr:()=>fc});var Oe;(function(e){e[e.CHARACTER=0]="CHARACTER",e[e.NULL_CHARACTER=1]="NULL_CHARACTER",e[e.WHITESPACE_CHARACTER=2]="WHITESPACE_CHARACTER",e[e.START_TAG=3]="START_TAG",e[e.END_TAG=4]="END_TAG",e[e.COMMENT=5]="COMMENT",e[e.DOCTYPE=6]="DOCTYPE",e[e.EOF=7]="EOF",e[e.HIBERNATION=8]="HIBERNATION"})(Oe||(Oe={}));function fc(e,t){for(let n=e.attrs.length-1;n>=0;n--)if(e.attrs[n].name===t)return e.attrs[n].value;return null}var Mh=new Uint16Array('\u1D41<\xD5\u0131\u028A\u049D\u057B\u05D0\u0675\u06DE\u07A2\u07D6\u080F\u0A4A\u0A91\u0DA1\u0E6D\u0F09\u0F26\u10CA\u1228\u12E1\u1415\u149D\u14C3\u14DF\u1525\0\0\0\0\0\0\u156B\u16CD\u198D\u1C12\u1DDD\u1F7E\u2060\u21B0\u228D\u23C0\u23FB\u2442\u2824\u2912\u2D08\u2E48\u2FCE\u3016\u32BA\u3639\u37AC\u38FE\u3A28\u3A71\u3AE0\u3B2E\u0800EMabcfglmnoprstu\\bfms\x7F\x84\x8B\x90\x95\x98\xA6\xB3\xB9\xC8\xCFlig\u803B\xC6\u40C6P\u803B&\u4026cute\u803B\xC1\u40C1reve;\u4102\u0100iyx}rc\u803B\xC2\u40C2;\u4410r;\uC000\u{1D504}rave\u803B\xC0\u40C0pha;\u4391acr;\u4100d;\u6A53\u0100gp\x9D\xA1on;\u4104f;\uC000\u{1D538}plyFunction;\u6061ing\u803B\xC5\u40C5\u0100cs\xBE\xC3r;\uC000\u{1D49C}ign;\u6254ilde\u803B\xC3\u40C3ml\u803B\xC4\u40C4\u0400aceforsu\xE5\xFB\xFE\u0117\u011C\u0122\u0127\u012A\u0100cr\xEA\xF2kslash;\u6216\u0176\xF6\xF8;\u6AE7ed;\u6306y;\u4411\u0180crt\u0105\u010B\u0114ause;\u6235noullis;\u612Ca;\u4392r;\uC000\u{1D505}pf;\uC000\u{1D539}eve;\u42D8c\xF2\u0113mpeq;\u624E\u0700HOacdefhilorsu\u014D\u0151\u0156\u0180\u019E\u01A2\u01B5\u01B7\u01BA\u01DC\u0215\u0273\u0278\u027Ecy;\u4427PY\u803B\xA9\u40A9\u0180cpy\u015D\u0162\u017Aute;\u4106\u0100;i\u0167\u0168\u62D2talDifferentialD;\u6145leys;\u612D\u0200aeio\u0189\u018E\u0194\u0198ron;\u410Cdil\u803B\xC7\u40C7rc;\u4108nint;\u6230ot;\u410A\u0100dn\u01A7\u01ADilla;\u40B8terDot;\u40B7\xF2\u017Fi;\u43A7rcle\u0200DMPT\u01C7\u01CB\u01D1\u01D6ot;\u6299inus;\u6296lus;\u6295imes;\u6297o\u0100cs\u01E2\u01F8kwiseContourIntegral;\u6232eCurly\u0100DQ\u0203\u020FoubleQuote;\u601Duote;\u6019\u0200lnpu\u021E\u0228\u0247\u0255on\u0100;e\u0225\u0226\u6237;\u6A74\u0180git\u022F\u0236\u023Aruent;\u6261nt;\u622FourIntegral;\u622E\u0100fr\u024C\u024E;\u6102oduct;\u6210nterClockwiseContourIntegral;\u6233oss;\u6A2Fcr;\uC000\u{1D49E}p\u0100;C\u0284\u0285\u62D3ap;\u624D\u0580DJSZacefios\u02A0\u02AC\u02B0\u02B4\u02B8\u02CB\u02D7\u02E1\u02E6\u0333\u048D\u0100;o\u0179\u02A5trahd;\u6911cy;\u4402cy;\u4405cy;\u440F\u0180grs\u02BF\u02C4\u02C7ger;\u6021r;\u61A1hv;\u6AE4\u0100ay\u02D0\u02D5ron;\u410E;\u4414l\u0100;t\u02DD\u02DE\u6207a;\u4394r;\uC000\u{1D507}\u0100af\u02EB\u0327\u0100cm\u02F0\u0322ritical\u0200ADGT\u0300\u0306\u0316\u031Ccute;\u40B4o\u0174\u030B\u030D;\u42D9bleAcute;\u42DDrave;\u4060ilde;\u42DCond;\u62C4ferentialD;\u6146\u0470\u033D\0\0\0\u0342\u0354\0\u0405f;\uC000\u{1D53B}\u0180;DE\u0348\u0349\u034D\u40A8ot;\u60DCqual;\u6250ble\u0300CDLRUV\u0363\u0372\u0382\u03CF\u03E2\u03F8ontourIntegra\xEC\u0239o\u0274\u0379\0\0\u037B\xBB\u0349nArrow;\u61D3\u0100eo\u0387\u03A4ft\u0180ART\u0390\u0396\u03A1rrow;\u61D0ightArrow;\u61D4e\xE5\u02CAng\u0100LR\u03AB\u03C4eft\u0100AR\u03B3\u03B9rrow;\u67F8ightArrow;\u67FAightArrow;\u67F9ight\u0100AT\u03D8\u03DErrow;\u61D2ee;\u62A8p\u0241\u03E9\0\0\u03EFrrow;\u61D1ownArrow;\u61D5erticalBar;\u6225n\u0300ABLRTa\u0412\u042A\u0430\u045E\u047F\u037Crrow\u0180;BU\u041D\u041E\u0422\u6193ar;\u6913pArrow;\u61F5reve;\u4311eft\u02D2\u043A\0\u0446\0\u0450ightVector;\u6950eeVector;\u695Eector\u0100;B\u0459\u045A\u61BDar;\u6956ight\u01D4\u0467\0\u0471eeVector;\u695Fector\u0100;B\u047A\u047B\u61C1ar;\u6957ee\u0100;A\u0486\u0487\u62A4rrow;\u61A7\u0100ct\u0492\u0497r;\uC000\u{1D49F}rok;\u4110\u0800NTacdfglmopqstux\u04BD\u04C0\u04C4\u04CB\u04DE\u04E2\u04E7\u04EE\u04F5\u0521\u052F\u0536\u0552\u055D\u0560\u0565G;\u414AH\u803B\xD0\u40D0cute\u803B\xC9\u40C9\u0180aiy\u04D2\u04D7\u04DCron;\u411Arc\u803B\xCA\u40CA;\u442Dot;\u4116r;\uC000\u{1D508}rave\u803B\xC8\u40C8ement;\u6208\u0100ap\u04FA\u04FEcr;\u4112ty\u0253\u0506\0\0\u0512mallSquare;\u65FBerySmallSquare;\u65AB\u0100gp\u0526\u052Aon;\u4118f;\uC000\u{1D53C}silon;\u4395u\u0100ai\u053C\u0549l\u0100;T\u0542\u0543\u6A75ilde;\u6242librium;\u61CC\u0100ci\u0557\u055Ar;\u6130m;\u6A73a;\u4397ml\u803B\xCB\u40CB\u0100ip\u056A\u056Fsts;\u6203onentialE;\u6147\u0280cfios\u0585\u0588\u058D\u05B2\u05CCy;\u4424r;\uC000\u{1D509}lled\u0253\u0597\0\0\u05A3mallSquare;\u65FCerySmallSquare;\u65AA\u0370\u05BA\0\u05BF\0\0\u05C4f;\uC000\u{1D53D}All;\u6200riertrf;\u6131c\xF2\u05CB\u0600JTabcdfgorst\u05E8\u05EC\u05EF\u05FA\u0600\u0612\u0616\u061B\u061D\u0623\u066C\u0672cy;\u4403\u803B>\u403Emma\u0100;d\u05F7\u05F8\u4393;\u43DCreve;\u411E\u0180eiy\u0607\u060C\u0610dil;\u4122rc;\u411C;\u4413ot;\u4120r;\uC000\u{1D50A};\u62D9pf;\uC000\u{1D53E}eater\u0300EFGLST\u0635\u0644\u064E\u0656\u065B\u0666qual\u0100;L\u063E\u063F\u6265ess;\u62DBullEqual;\u6267reater;\u6AA2ess;\u6277lantEqual;\u6A7Eilde;\u6273cr;\uC000\u{1D4A2};\u626B\u0400Aacfiosu\u0685\u068B\u0696\u069B\u069E\u06AA\u06BE\u06CARDcy;\u442A\u0100ct\u0690\u0694ek;\u42C7;\u405Eirc;\u4124r;\u610ClbertSpace;\u610B\u01F0\u06AF\0\u06B2f;\u610DizontalLine;\u6500\u0100ct\u06C3\u06C5\xF2\u06A9rok;\u4126mp\u0144\u06D0\u06D8ownHum\xF0\u012Fqual;\u624F\u0700EJOacdfgmnostu\u06FA\u06FE\u0703\u0707\u070E\u071A\u071E\u0721\u0728\u0744\u0778\u078B\u078F\u0795cy;\u4415lig;\u4132cy;\u4401cute\u803B\xCD\u40CD\u0100iy\u0713\u0718rc\u803B\xCE\u40CE;\u4418ot;\u4130r;\u6111rave\u803B\xCC\u40CC\u0180;ap\u0720\u072F\u073F\u0100cg\u0734\u0737r;\u412AinaryI;\u6148lie\xF3\u03DD\u01F4\u0749\0\u0762\u0100;e\u074D\u074E\u622C\u0100gr\u0753\u0758ral;\u622Bsection;\u62C2isible\u0100CT\u076C\u0772omma;\u6063imes;\u6062\u0180gpt\u077F\u0783\u0788on;\u412Ef;\uC000\u{1D540}a;\u4399cr;\u6110ilde;\u4128\u01EB\u079A\0\u079Ecy;\u4406l\u803B\xCF\u40CF\u0280cfosu\u07AC\u07B7\u07BC\u07C2\u07D0\u0100iy\u07B1\u07B5rc;\u4134;\u4419r;\uC000\u{1D50D}pf;\uC000\u{1D541}\u01E3\u07C7\0\u07CCr;\uC000\u{1D4A5}rcy;\u4408kcy;\u4404\u0380HJacfos\u07E4\u07E8\u07EC\u07F1\u07FD\u0802\u0808cy;\u4425cy;\u440Cppa;\u439A\u0100ey\u07F6\u07FBdil;\u4136;\u441Ar;\uC000\u{1D50E}pf;\uC000\u{1D542}cr;\uC000\u{1D4A6}\u0580JTaceflmost\u0825\u0829\u082C\u0850\u0863\u09B3\u09B8\u09C7\u09CD\u0A37\u0A47cy;\u4409\u803B<\u403C\u0280cmnpr\u0837\u083C\u0841\u0844\u084Dute;\u4139bda;\u439Bg;\u67EAlacetrf;\u6112r;\u619E\u0180aey\u0857\u085C\u0861ron;\u413Ddil;\u413B;\u441B\u0100fs\u0868\u0970t\u0500ACDFRTUVar\u087E\u08A9\u08B1\u08E0\u08E6\u08FC\u092F\u095B\u0390\u096A\u0100nr\u0883\u088FgleBracket;\u67E8row\u0180;BR\u0899\u089A\u089E\u6190ar;\u61E4ightArrow;\u61C6eiling;\u6308o\u01F5\u08B7\0\u08C3bleBracket;\u67E6n\u01D4\u08C8\0\u08D2eeVector;\u6961ector\u0100;B\u08DB\u08DC\u61C3ar;\u6959loor;\u630Aight\u0100AV\u08EF\u08F5rrow;\u6194ector;\u694E\u0100er\u0901\u0917e\u0180;AV\u0909\u090A\u0910\u62A3rrow;\u61A4ector;\u695Aiangle\u0180;BE\u0924\u0925\u0929\u62B2ar;\u69CFqual;\u62B4p\u0180DTV\u0937\u0942\u094CownVector;\u6951eeVector;\u6960ector\u0100;B\u0956\u0957\u61BFar;\u6958ector\u0100;B\u0965\u0966\u61BCar;\u6952ight\xE1\u039Cs\u0300EFGLST\u097E\u098B\u0995\u099D\u09A2\u09ADqualGreater;\u62DAullEqual;\u6266reater;\u6276ess;\u6AA1lantEqual;\u6A7Dilde;\u6272r;\uC000\u{1D50F}\u0100;e\u09BD\u09BE\u62D8ftarrow;\u61DAidot;\u413F\u0180npw\u09D4\u0A16\u0A1Bg\u0200LRlr\u09DE\u09F7\u0A02\u0A10eft\u0100AR\u09E6\u09ECrrow;\u67F5ightArrow;\u67F7ightArrow;\u67F6eft\u0100ar\u03B3\u0A0Aight\xE1\u03BFight\xE1\u03CAf;\uC000\u{1D543}er\u0100LR\u0A22\u0A2CeftArrow;\u6199ightArrow;\u6198\u0180cht\u0A3E\u0A40\u0A42\xF2\u084C;\u61B0rok;\u4141;\u626A\u0400acefiosu\u0A5A\u0A5D\u0A60\u0A77\u0A7C\u0A85\u0A8B\u0A8Ep;\u6905y;\u441C\u0100dl\u0A65\u0A6FiumSpace;\u605Flintrf;\u6133r;\uC000\u{1D510}nusPlus;\u6213pf;\uC000\u{1D544}c\xF2\u0A76;\u439C\u0480Jacefostu\u0AA3\u0AA7\u0AAD\u0AC0\u0B14\u0B19\u0D91\u0D97\u0D9Ecy;\u440Acute;\u4143\u0180aey\u0AB4\u0AB9\u0ABEron;\u4147dil;\u4145;\u441D\u0180gsw\u0AC7\u0AF0\u0B0Eative\u0180MTV\u0AD3\u0ADF\u0AE8ediumSpace;\u600Bhi\u0100cn\u0AE6\u0AD8\xEB\u0AD9eryThi\xEE\u0AD9ted\u0100GL\u0AF8\u0B06reaterGreate\xF2\u0673essLes\xF3\u0A48Line;\u400Ar;\uC000\u{1D511}\u0200Bnpt\u0B22\u0B28\u0B37\u0B3Areak;\u6060BreakingSpace;\u40A0f;\u6115\u0680;CDEGHLNPRSTV\u0B55\u0B56\u0B6A\u0B7C\u0BA1\u0BEB\u0C04\u0C5E\u0C84\u0CA6\u0CD8\u0D61\u0D85\u6AEC\u0100ou\u0B5B\u0B64ngruent;\u6262pCap;\u626DoubleVerticalBar;\u6226\u0180lqx\u0B83\u0B8A\u0B9Bement;\u6209ual\u0100;T\u0B92\u0B93\u6260ilde;\uC000\u2242\u0338ists;\u6204reater\u0380;EFGLST\u0BB6\u0BB7\u0BBD\u0BC9\u0BD3\u0BD8\u0BE5\u626Fqual;\u6271ullEqual;\uC000\u2267\u0338reater;\uC000\u226B\u0338ess;\u6279lantEqual;\uC000\u2A7E\u0338ilde;\u6275ump\u0144\u0BF2\u0BFDownHump;\uC000\u224E\u0338qual;\uC000\u224F\u0338e\u0100fs\u0C0A\u0C27tTriangle\u0180;BE\u0C1A\u0C1B\u0C21\u62EAar;\uC000\u29CF\u0338qual;\u62ECs\u0300;EGLST\u0C35\u0C36\u0C3C\u0C44\u0C4B\u0C58\u626Equal;\u6270reater;\u6278ess;\uC000\u226A\u0338lantEqual;\uC000\u2A7D\u0338ilde;\u6274ested\u0100GL\u0C68\u0C79reaterGreater;\uC000\u2AA2\u0338essLess;\uC000\u2AA1\u0338recedes\u0180;ES\u0C92\u0C93\u0C9B\u6280qual;\uC000\u2AAF\u0338lantEqual;\u62E0\u0100ei\u0CAB\u0CB9verseElement;\u620CghtTriangle\u0180;BE\u0CCB\u0CCC\u0CD2\u62EBar;\uC000\u29D0\u0338qual;\u62ED\u0100qu\u0CDD\u0D0CuareSu\u0100bp\u0CE8\u0CF9set\u0100;E\u0CF0\u0CF3\uC000\u228F\u0338qual;\u62E2erset\u0100;E\u0D03\u0D06\uC000\u2290\u0338qual;\u62E3\u0180bcp\u0D13\u0D24\u0D4Eset\u0100;E\u0D1B\u0D1E\uC000\u2282\u20D2qual;\u6288ceeds\u0200;EST\u0D32\u0D33\u0D3B\u0D46\u6281qual;\uC000\u2AB0\u0338lantEqual;\u62E1ilde;\uC000\u227F\u0338erset\u0100;E\u0D58\u0D5B\uC000\u2283\u20D2qual;\u6289ilde\u0200;EFT\u0D6E\u0D6F\u0D75\u0D7F\u6241qual;\u6244ullEqual;\u6247ilde;\u6249erticalBar;\u6224cr;\uC000\u{1D4A9}ilde\u803B\xD1\u40D1;\u439D\u0700Eacdfgmoprstuv\u0DBD\u0DC2\u0DC9\u0DD5\u0DDB\u0DE0\u0DE7\u0DFC\u0E02\u0E20\u0E22\u0E32\u0E3F\u0E44lig;\u4152cute\u803B\xD3\u40D3\u0100iy\u0DCE\u0DD3rc\u803B\xD4\u40D4;\u441Eblac;\u4150r;\uC000\u{1D512}rave\u803B\xD2\u40D2\u0180aei\u0DEE\u0DF2\u0DF6cr;\u414Cga;\u43A9cron;\u439Fpf;\uC000\u{1D546}enCurly\u0100DQ\u0E0E\u0E1AoubleQuote;\u601Cuote;\u6018;\u6A54\u0100cl\u0E27\u0E2Cr;\uC000\u{1D4AA}ash\u803B\xD8\u40D8i\u016C\u0E37\u0E3Cde\u803B\xD5\u40D5es;\u6A37ml\u803B\xD6\u40D6er\u0100BP\u0E4B\u0E60\u0100ar\u0E50\u0E53r;\u603Eac\u0100ek\u0E5A\u0E5C;\u63DEet;\u63B4arenthesis;\u63DC\u0480acfhilors\u0E7F\u0E87\u0E8A\u0E8F\u0E92\u0E94\u0E9D\u0EB0\u0EFCrtialD;\u6202y;\u441Fr;\uC000\u{1D513}i;\u43A6;\u43A0usMinus;\u40B1\u0100ip\u0EA2\u0EADncareplan\xE5\u069Df;\u6119\u0200;eio\u0EB9\u0EBA\u0EE0\u0EE4\u6ABBcedes\u0200;EST\u0EC8\u0EC9\u0ECF\u0EDA\u627Aqual;\u6AAFlantEqual;\u627Cilde;\u627Eme;\u6033\u0100dp\u0EE9\u0EEEuct;\u620Fortion\u0100;a\u0225\u0EF9l;\u621D\u0100ci\u0F01\u0F06r;\uC000\u{1D4AB};\u43A8\u0200Ufos\u0F11\u0F16\u0F1B\u0F1FOT\u803B"\u4022r;\uC000\u{1D514}pf;\u611Acr;\uC000\u{1D4AC}\u0600BEacefhiorsu\u0F3E\u0F43\u0F47\u0F60\u0F73\u0FA7\u0FAA\u0FAD\u1096\u10A9\u10B4\u10BEarr;\u6910G\u803B\xAE\u40AE\u0180cnr\u0F4E\u0F53\u0F56ute;\u4154g;\u67EBr\u0100;t\u0F5C\u0F5D\u61A0l;\u6916\u0180aey\u0F67\u0F6C\u0F71ron;\u4158dil;\u4156;\u4420\u0100;v\u0F78\u0F79\u611Cerse\u0100EU\u0F82\u0F99\u0100lq\u0F87\u0F8Eement;\u620Builibrium;\u61CBpEquilibrium;\u696Fr\xBB\u0F79o;\u43A1ght\u0400ACDFTUVa\u0FC1\u0FEB\u0FF3\u1022\u1028\u105B\u1087\u03D8\u0100nr\u0FC6\u0FD2gleBracket;\u67E9row\u0180;BL\u0FDC\u0FDD\u0FE1\u6192ar;\u61E5eftArrow;\u61C4eiling;\u6309o\u01F5\u0FF9\0\u1005bleBracket;\u67E7n\u01D4\u100A\0\u1014eeVector;\u695Dector\u0100;B\u101D\u101E\u61C2ar;\u6955loor;\u630B\u0100er\u102D\u1043e\u0180;AV\u1035\u1036\u103C\u62A2rrow;\u61A6ector;\u695Biangle\u0180;BE\u1050\u1051\u1055\u62B3ar;\u69D0qual;\u62B5p\u0180DTV\u1063\u106E\u1078ownVector;\u694FeeVector;\u695Cector\u0100;B\u1082\u1083\u61BEar;\u6954ector\u0100;B\u1091\u1092\u61C0ar;\u6953\u0100pu\u109B\u109Ef;\u611DndImplies;\u6970ightarrow;\u61DB\u0100ch\u10B9\u10BCr;\u611B;\u61B1leDelayed;\u69F4\u0680HOacfhimoqstu\u10E4\u10F1\u10F7\u10FD\u1119\u111E\u1151\u1156\u1161\u1167\u11B5\u11BB\u11BF\u0100Cc\u10E9\u10EEHcy;\u4429y;\u4428FTcy;\u442Ccute;\u415A\u0280;aeiy\u1108\u1109\u110E\u1113\u1117\u6ABCron;\u4160dil;\u415Erc;\u415C;\u4421r;\uC000\u{1D516}ort\u0200DLRU\u112A\u1134\u113E\u1149ownArrow\xBB\u041EeftArrow\xBB\u089AightArrow\xBB\u0FDDpArrow;\u6191gma;\u43A3allCircle;\u6218pf;\uC000\u{1D54A}\u0272\u116D\0\0\u1170t;\u621Aare\u0200;ISU\u117B\u117C\u1189\u11AF\u65A1ntersection;\u6293u\u0100bp\u118F\u119Eset\u0100;E\u1197\u1198\u628Fqual;\u6291erset\u0100;E\u11A8\u11A9\u6290qual;\u6292nion;\u6294cr;\uC000\u{1D4AE}ar;\u62C6\u0200bcmp\u11C8\u11DB\u1209\u120B\u0100;s\u11CD\u11CE\u62D0et\u0100;E\u11CD\u11D5qual;\u6286\u0100ch\u11E0\u1205eeds\u0200;EST\u11ED\u11EE\u11F4\u11FF\u627Bqual;\u6AB0lantEqual;\u627Dilde;\u627FTh\xE1\u0F8C;\u6211\u0180;es\u1212\u1213\u1223\u62D1rset\u0100;E\u121C\u121D\u6283qual;\u6287et\xBB\u1213\u0580HRSacfhiors\u123E\u1244\u1249\u1255\u125E\u1271\u1276\u129F\u12C2\u12C8\u12D1ORN\u803B\xDE\u40DEADE;\u6122\u0100Hc\u124E\u1252cy;\u440By;\u4426\u0100bu\u125A\u125C;\u4009;\u43A4\u0180aey\u1265\u126A\u126Fron;\u4164dil;\u4162;\u4422r;\uC000\u{1D517}\u0100ei\u127B\u1289\u01F2\u1280\0\u1287efore;\u6234a;\u4398\u0100cn\u128E\u1298kSpace;\uC000\u205F\u200ASpace;\u6009lde\u0200;EFT\u12AB\u12AC\u12B2\u12BC\u623Cqual;\u6243ullEqual;\u6245ilde;\u6248pf;\uC000\u{1D54B}ipleDot;\u60DB\u0100ct\u12D6\u12DBr;\uC000\u{1D4AF}rok;\u4166\u0AE1\u12F7\u130E\u131A\u1326\0\u132C\u1331\0\0\0\0\0\u1338\u133D\u1377\u1385\0\u13FF\u1404\u140A\u1410\u0100cr\u12FB\u1301ute\u803B\xDA\u40DAr\u0100;o\u1307\u1308\u619Fcir;\u6949r\u01E3\u1313\0\u1316y;\u440Eve;\u416C\u0100iy\u131E\u1323rc\u803B\xDB\u40DB;\u4423blac;\u4170r;\uC000\u{1D518}rave\u803B\xD9\u40D9acr;\u416A\u0100di\u1341\u1369er\u0100BP\u1348\u135D\u0100ar\u134D\u1350r;\u405Fac\u0100ek\u1357\u1359;\u63DFet;\u63B5arenthesis;\u63DDon\u0100;P\u1370\u1371\u62C3lus;\u628E\u0100gp\u137B\u137Fon;\u4172f;\uC000\u{1D54C}\u0400ADETadps\u1395\u13AE\u13B8\u13C4\u03E8\u13D2\u13D7\u13F3rrow\u0180;BD\u1150\u13A0\u13A4ar;\u6912ownArrow;\u61C5ownArrow;\u6195quilibrium;\u696Eee\u0100;A\u13CB\u13CC\u62A5rrow;\u61A5own\xE1\u03F3er\u0100LR\u13DE\u13E8eftArrow;\u6196ightArrow;\u6197i\u0100;l\u13F9\u13FA\u43D2on;\u43A5ing;\u416Ecr;\uC000\u{1D4B0}ilde;\u4168ml\u803B\xDC\u40DC\u0480Dbcdefosv\u1427\u142C\u1430\u1433\u143E\u1485\u148A\u1490\u1496ash;\u62ABar;\u6AEBy;\u4412ash\u0100;l\u143B\u143C\u62A9;\u6AE6\u0100er\u1443\u1445;\u62C1\u0180bty\u144C\u1450\u147Aar;\u6016\u0100;i\u144F\u1455cal\u0200BLST\u1461\u1465\u146A\u1474ar;\u6223ine;\u407Ceparator;\u6758ilde;\u6240ThinSpace;\u600Ar;\uC000\u{1D519}pf;\uC000\u{1D54D}cr;\uC000\u{1D4B1}dash;\u62AA\u0280cefos\u14A7\u14AC\u14B1\u14B6\u14BCirc;\u4174dge;\u62C0r;\uC000\u{1D51A}pf;\uC000\u{1D54E}cr;\uC000\u{1D4B2}\u0200fios\u14CB\u14D0\u14D2\u14D8r;\uC000\u{1D51B};\u439Epf;\uC000\u{1D54F}cr;\uC000\u{1D4B3}\u0480AIUacfosu\u14F1\u14F5\u14F9\u14FD\u1504\u150F\u1514\u151A\u1520cy;\u442Fcy;\u4407cy;\u442Ecute\u803B\xDD\u40DD\u0100iy\u1509\u150Drc;\u4176;\u442Br;\uC000\u{1D51C}pf;\uC000\u{1D550}cr;\uC000\u{1D4B4}ml;\u4178\u0400Hacdefos\u1535\u1539\u153F\u154B\u154F\u155D\u1560\u1564cy;\u4416cute;\u4179\u0100ay\u1544\u1549ron;\u417D;\u4417ot;\u417B\u01F2\u1554\0\u155BoWidt\xE8\u0AD9a;\u4396r;\u6128pf;\u6124cr;\uC000\u{1D4B5}\u0BE1\u1583\u158A\u1590\0\u15B0\u15B6\u15BF\0\0\0\0\u15C6\u15DB\u15EB\u165F\u166D\0\u1695\u169B\u16B2\u16B9\0\u16BEcute\u803B\xE1\u40E1reve;\u4103\u0300;Ediuy\u159C\u159D\u15A1\u15A3\u15A8\u15AD\u623E;\uC000\u223E\u0333;\u623Frc\u803B\xE2\u40E2te\u80BB\xB4\u0306;\u4430lig\u803B\xE6\u40E6\u0100;r\xB2\u15BA;\uC000\u{1D51E}rave\u803B\xE0\u40E0\u0100ep\u15CA\u15D6\u0100fp\u15CF\u15D4sym;\u6135\xE8\u15D3ha;\u43B1\u0100ap\u15DFc\u0100cl\u15E4\u15E7r;\u4101g;\u6A3F\u0264\u15F0\0\0\u160A\u0280;adsv\u15FA\u15FB\u15FF\u1601\u1607\u6227nd;\u6A55;\u6A5Clope;\u6A58;\u6A5A\u0380;elmrsz\u1618\u1619\u161B\u161E\u163F\u164F\u1659\u6220;\u69A4e\xBB\u1619sd\u0100;a\u1625\u1626\u6221\u0461\u1630\u1632\u1634\u1636\u1638\u163A\u163C\u163E;\u69A8;\u69A9;\u69AA;\u69AB;\u69AC;\u69AD;\u69AE;\u69AFt\u0100;v\u1645\u1646\u621Fb\u0100;d\u164C\u164D\u62BE;\u699D\u0100pt\u1654\u1657h;\u6222\xBB\xB9arr;\u637C\u0100gp\u1663\u1667on;\u4105f;\uC000\u{1D552}\u0380;Eaeiop\u12C1\u167B\u167D\u1682\u1684\u1687\u168A;\u6A70cir;\u6A6F;\u624Ad;\u624Bs;\u4027rox\u0100;e\u12C1\u1692\xF1\u1683ing\u803B\xE5\u40E5\u0180cty\u16A1\u16A6\u16A8r;\uC000\u{1D4B6};\u402Amp\u0100;e\u12C1\u16AF\xF1\u0288ilde\u803B\xE3\u40E3ml\u803B\xE4\u40E4\u0100ci\u16C2\u16C8onin\xF4\u0272nt;\u6A11\u0800Nabcdefiklnoprsu\u16ED\u16F1\u1730\u173C\u1743\u1748\u1778\u177D\u17E0\u17E6\u1839\u1850\u170D\u193D\u1948\u1970ot;\u6AED\u0100cr\u16F6\u171Ek\u0200ceps\u1700\u1705\u170D\u1713ong;\u624Cpsilon;\u43F6rime;\u6035im\u0100;e\u171A\u171B\u623Dq;\u62CD\u0176\u1722\u1726ee;\u62BDed\u0100;g\u172C\u172D\u6305e\xBB\u172Drk\u0100;t\u135C\u1737brk;\u63B6\u0100oy\u1701\u1741;\u4431quo;\u601E\u0280cmprt\u1753\u175B\u1761\u1764\u1768aus\u0100;e\u010A\u0109ptyv;\u69B0s\xE9\u170Cno\xF5\u0113\u0180ahw\u176F\u1771\u1773;\u43B2;\u6136een;\u626Cr;\uC000\u{1D51F}g\u0380costuvw\u178D\u179D\u17B3\u17C1\u17D5\u17DB\u17DE\u0180aiu\u1794\u1796\u179A\xF0\u0760rc;\u65EFp\xBB\u1371\u0180dpt\u17A4\u17A8\u17ADot;\u6A00lus;\u6A01imes;\u6A02\u0271\u17B9\0\0\u17BEcup;\u6A06ar;\u6605riangle\u0100du\u17CD\u17D2own;\u65BDp;\u65B3plus;\u6A04e\xE5\u1444\xE5\u14ADarow;\u690D\u0180ako\u17ED\u1826\u1835\u0100cn\u17F2\u1823k\u0180lst\u17FA\u05AB\u1802ozenge;\u69EBriangle\u0200;dlr\u1812\u1813\u1818\u181D\u65B4own;\u65BEeft;\u65C2ight;\u65B8k;\u6423\u01B1\u182B\0\u1833\u01B2\u182F\0\u1831;\u6592;\u65914;\u6593ck;\u6588\u0100eo\u183E\u184D\u0100;q\u1843\u1846\uC000=\u20E5uiv;\uC000\u2261\u20E5t;\u6310\u0200ptwx\u1859\u185E\u1867\u186Cf;\uC000\u{1D553}\u0100;t\u13CB\u1863om\xBB\u13CCtie;\u62C8\u0600DHUVbdhmptuv\u1885\u1896\u18AA\u18BB\u18D7\u18DB\u18EC\u18FF\u1905\u190A\u1910\u1921\u0200LRlr\u188E\u1890\u1892\u1894;\u6557;\u6554;\u6556;\u6553\u0280;DUdu\u18A1\u18A2\u18A4\u18A6\u18A8\u6550;\u6566;\u6569;\u6564;\u6567\u0200LRlr\u18B3\u18B5\u18B7\u18B9;\u655D;\u655A;\u655C;\u6559\u0380;HLRhlr\u18CA\u18CB\u18CD\u18CF\u18D1\u18D3\u18D5\u6551;\u656C;\u6563;\u6560;\u656B;\u6562;\u655Fox;\u69C9\u0200LRlr\u18E4\u18E6\u18E8\u18EA;\u6555;\u6552;\u6510;\u650C\u0280;DUdu\u06BD\u18F7\u18F9\u18FB\u18FD;\u6565;\u6568;\u652C;\u6534inus;\u629Flus;\u629Eimes;\u62A0\u0200LRlr\u1919\u191B\u191D\u191F;\u655B;\u6558;\u6518;\u6514\u0380;HLRhlr\u1930\u1931\u1933\u1935\u1937\u1939\u193B\u6502;\u656A;\u6561;\u655E;\u653C;\u6524;\u651C\u0100ev\u0123\u1942bar\u803B\xA6\u40A6\u0200ceio\u1951\u1956\u195A\u1960r;\uC000\u{1D4B7}mi;\u604Fm\u0100;e\u171A\u171Cl\u0180;bh\u1968\u1969\u196B\u405C;\u69C5sub;\u67C8\u016C\u1974\u197El\u0100;e\u1979\u197A\u6022t\xBB\u197Ap\u0180;Ee\u012F\u1985\u1987;\u6AAE\u0100;q\u06DC\u06DB\u0CE1\u19A7\0\u19E8\u1A11\u1A15\u1A32\0\u1A37\u1A50\0\0\u1AB4\0\0\u1AC1\0\0\u1B21\u1B2E\u1B4D\u1B52\0\u1BFD\0\u1C0C\u0180cpr\u19AD\u19B2\u19DDute;\u4107\u0300;abcds\u19BF\u19C0\u19C4\u19CA\u19D5\u19D9\u6229nd;\u6A44rcup;\u6A49\u0100au\u19CF\u19D2p;\u6A4Bp;\u6A47ot;\u6A40;\uC000\u2229\uFE00\u0100eo\u19E2\u19E5t;\u6041\xEE\u0693\u0200aeiu\u19F0\u19FB\u1A01\u1A05\u01F0\u19F5\0\u19F8s;\u6A4Don;\u410Ddil\u803B\xE7\u40E7rc;\u4109ps\u0100;s\u1A0C\u1A0D\u6A4Cm;\u6A50ot;\u410B\u0180dmn\u1A1B\u1A20\u1A26il\u80BB\xB8\u01ADptyv;\u69B2t\u8100\xA2;e\u1A2D\u1A2E\u40A2r\xE4\u01B2r;\uC000\u{1D520}\u0180cei\u1A3D\u1A40\u1A4Dy;\u4447ck\u0100;m\u1A47\u1A48\u6713ark\xBB\u1A48;\u43C7r\u0380;Ecefms\u1A5F\u1A60\u1A62\u1A6B\u1AA4\u1AAA\u1AAE\u65CB;\u69C3\u0180;el\u1A69\u1A6A\u1A6D\u42C6q;\u6257e\u0261\u1A74\0\0\u1A88rrow\u0100lr\u1A7C\u1A81eft;\u61BAight;\u61BB\u0280RSacd\u1A92\u1A94\u1A96\u1A9A\u1A9F\xBB\u0F47;\u64C8st;\u629Birc;\u629Aash;\u629Dnint;\u6A10id;\u6AEFcir;\u69C2ubs\u0100;u\u1ABB\u1ABC\u6663it\xBB\u1ABC\u02EC\u1AC7\u1AD4\u1AFA\0\u1B0Aon\u0100;e\u1ACD\u1ACE\u403A\u0100;q\xC7\xC6\u026D\u1AD9\0\0\u1AE2a\u0100;t\u1ADE\u1ADF\u402C;\u4040\u0180;fl\u1AE8\u1AE9\u1AEB\u6201\xEE\u1160e\u0100mx\u1AF1\u1AF6ent\xBB\u1AE9e\xF3\u024D\u01E7\u1AFE\0\u1B07\u0100;d\u12BB\u1B02ot;\u6A6Dn\xF4\u0246\u0180fry\u1B10\u1B14\u1B17;\uC000\u{1D554}o\xE4\u0254\u8100\xA9;s\u0155\u1B1Dr;\u6117\u0100ao\u1B25\u1B29rr;\u61B5ss;\u6717\u0100cu\u1B32\u1B37r;\uC000\u{1D4B8}\u0100bp\u1B3C\u1B44\u0100;e\u1B41\u1B42\u6ACF;\u6AD1\u0100;e\u1B49\u1B4A\u6AD0;\u6AD2dot;\u62EF\u0380delprvw\u1B60\u1B6C\u1B77\u1B82\u1BAC\u1BD4\u1BF9arr\u0100lr\u1B68\u1B6A;\u6938;\u6935\u0270\u1B72\0\0\u1B75r;\u62DEc;\u62DFarr\u0100;p\u1B7F\u1B80\u61B6;\u693D\u0300;bcdos\u1B8F\u1B90\u1B96\u1BA1\u1BA5\u1BA8\u622Arcap;\u6A48\u0100au\u1B9B\u1B9Ep;\u6A46p;\u6A4Aot;\u628Dr;\u6A45;\uC000\u222A\uFE00\u0200alrv\u1BB5\u1BBF\u1BDE\u1BE3rr\u0100;m\u1BBC\u1BBD\u61B7;\u693Cy\u0180evw\u1BC7\u1BD4\u1BD8q\u0270\u1BCE\0\0\u1BD2re\xE3\u1B73u\xE3\u1B75ee;\u62CEedge;\u62CFen\u803B\xA4\u40A4earrow\u0100lr\u1BEE\u1BF3eft\xBB\u1B80ight\xBB\u1BBDe\xE4\u1BDD\u0100ci\u1C01\u1C07onin\xF4\u01F7nt;\u6231lcty;\u632D\u0980AHabcdefhijlorstuwz\u1C38\u1C3B\u1C3F\u1C5D\u1C69\u1C75\u1C8A\u1C9E\u1CAC\u1CB7\u1CFB\u1CFF\u1D0D\u1D7B\u1D91\u1DAB\u1DBB\u1DC6\u1DCDr\xF2\u0381ar;\u6965\u0200glrs\u1C48\u1C4D\u1C52\u1C54ger;\u6020eth;\u6138\xF2\u1133h\u0100;v\u1C5A\u1C5B\u6010\xBB\u090A\u016B\u1C61\u1C67arow;\u690Fa\xE3\u0315\u0100ay\u1C6E\u1C73ron;\u410F;\u4434\u0180;ao\u0332\u1C7C\u1C84\u0100gr\u02BF\u1C81r;\u61CAtseq;\u6A77\u0180glm\u1C91\u1C94\u1C98\u803B\xB0\u40B0ta;\u43B4ptyv;\u69B1\u0100ir\u1CA3\u1CA8sht;\u697F;\uC000\u{1D521}ar\u0100lr\u1CB3\u1CB5\xBB\u08DC\xBB\u101E\u0280aegsv\u1CC2\u0378\u1CD6\u1CDC\u1CE0m\u0180;os\u0326\u1CCA\u1CD4nd\u0100;s\u0326\u1CD1uit;\u6666amma;\u43DDin;\u62F2\u0180;io\u1CE7\u1CE8\u1CF8\u40F7de\u8100\xF7;o\u1CE7\u1CF0ntimes;\u62C7n\xF8\u1CF7cy;\u4452c\u026F\u1D06\0\0\u1D0Arn;\u631Eop;\u630D\u0280lptuw\u1D18\u1D1D\u1D22\u1D49\u1D55lar;\u4024f;\uC000\u{1D555}\u0280;emps\u030B\u1D2D\u1D37\u1D3D\u1D42q\u0100;d\u0352\u1D33ot;\u6251inus;\u6238lus;\u6214quare;\u62A1blebarwedg\xE5\xFAn\u0180adh\u112E\u1D5D\u1D67ownarrow\xF3\u1C83arpoon\u0100lr\u1D72\u1D76ef\xF4\u1CB4igh\xF4\u1CB6\u0162\u1D7F\u1D85karo\xF7\u0F42\u026F\u1D8A\0\0\u1D8Ern;\u631Fop;\u630C\u0180cot\u1D98\u1DA3\u1DA6\u0100ry\u1D9D\u1DA1;\uC000\u{1D4B9};\u4455l;\u69F6rok;\u4111\u0100dr\u1DB0\u1DB4ot;\u62F1i\u0100;f\u1DBA\u1816\u65BF\u0100ah\u1DC0\u1DC3r\xF2\u0429a\xF2\u0FA6angle;\u69A6\u0100ci\u1DD2\u1DD5y;\u445Fgrarr;\u67FF\u0900Dacdefglmnopqrstux\u1E01\u1E09\u1E19\u1E38\u0578\u1E3C\u1E49\u1E61\u1E7E\u1EA5\u1EAF\u1EBD\u1EE1\u1F2A\u1F37\u1F44\u1F4E\u1F5A\u0100Do\u1E06\u1D34o\xF4\u1C89\u0100cs\u1E0E\u1E14ute\u803B\xE9\u40E9ter;\u6A6E\u0200aioy\u1E22\u1E27\u1E31\u1E36ron;\u411Br\u0100;c\u1E2D\u1E2E\u6256\u803B\xEA\u40EAlon;\u6255;\u444Dot;\u4117\u0100Dr\u1E41\u1E45ot;\u6252;\uC000\u{1D522}\u0180;rs\u1E50\u1E51\u1E57\u6A9Aave\u803B\xE8\u40E8\u0100;d\u1E5C\u1E5D\u6A96ot;\u6A98\u0200;ils\u1E6A\u1E6B\u1E72\u1E74\u6A99nters;\u63E7;\u6113\u0100;d\u1E79\u1E7A\u6A95ot;\u6A97\u0180aps\u1E85\u1E89\u1E97cr;\u4113ty\u0180;sv\u1E92\u1E93\u1E95\u6205et\xBB\u1E93p\u01001;\u1E9D\u1EA4\u0133\u1EA1\u1EA3;\u6004;\u6005\u6003\u0100gs\u1EAA\u1EAC;\u414Bp;\u6002\u0100gp\u1EB4\u1EB8on;\u4119f;\uC000\u{1D556}\u0180als\u1EC4\u1ECE\u1ED2r\u0100;s\u1ECA\u1ECB\u62D5l;\u69E3us;\u6A71i\u0180;lv\u1EDA\u1EDB\u1EDF\u43B5on\xBB\u1EDB;\u43F5\u0200csuv\u1EEA\u1EF3\u1F0B\u1F23\u0100io\u1EEF\u1E31rc\xBB\u1E2E\u0269\u1EF9\0\0\u1EFB\xED\u0548ant\u0100gl\u1F02\u1F06tr\xBB\u1E5Dess\xBB\u1E7A\u0180aei\u1F12\u1F16\u1F1Als;\u403Dst;\u625Fv\u0100;D\u0235\u1F20D;\u6A78parsl;\u69E5\u0100Da\u1F2F\u1F33ot;\u6253rr;\u6971\u0180cdi\u1F3E\u1F41\u1EF8r;\u612Fo\xF4\u0352\u0100ah\u1F49\u1F4B;\u43B7\u803B\xF0\u40F0\u0100mr\u1F53\u1F57l\u803B\xEB\u40EBo;\u60AC\u0180cip\u1F61\u1F64\u1F67l;\u4021s\xF4\u056E\u0100eo\u1F6C\u1F74ctatio\xEE\u0559nential\xE5\u0579\u09E1\u1F92\0\u1F9E\0\u1FA1\u1FA7\0\0\u1FC6\u1FCC\0\u1FD3\0\u1FE6\u1FEA\u2000\0\u2008\u205Allingdotse\xF1\u1E44y;\u4444male;\u6640\u0180ilr\u1FAD\u1FB3\u1FC1lig;\u8000\uFB03\u0269\u1FB9\0\0\u1FBDg;\u8000\uFB00ig;\u8000\uFB04;\uC000\u{1D523}lig;\u8000\uFB01lig;\uC000fj\u0180alt\u1FD9\u1FDC\u1FE1t;\u666Dig;\u8000\uFB02ns;\u65B1of;\u4192\u01F0\u1FEE\0\u1FF3f;\uC000\u{1D557}\u0100ak\u05BF\u1FF7\u0100;v\u1FFC\u1FFD\u62D4;\u6AD9artint;\u6A0D\u0100ao\u200C\u2055\u0100cs\u2011\u2052\u03B1\u201A\u2030\u2038\u2045\u2048\0\u2050\u03B2\u2022\u2025\u2027\u202A\u202C\0\u202E\u803B\xBD\u40BD;\u6153\u803B\xBC\u40BC;\u6155;\u6159;\u615B\u01B3\u2034\0\u2036;\u6154;\u6156\u02B4\u203E\u2041\0\0\u2043\u803B\xBE\u40BE;\u6157;\u615C5;\u6158\u01B6\u204C\0\u204E;\u615A;\u615D8;\u615El;\u6044wn;\u6322cr;\uC000\u{1D4BB}\u0880Eabcdefgijlnorstv\u2082\u2089\u209F\u20A5\u20B0\u20B4\u20F0\u20F5\u20FA\u20FF\u2103\u2112\u2138\u0317\u213E\u2152\u219E\u0100;l\u064D\u2087;\u6A8C\u0180cmp\u2090\u2095\u209Dute;\u41F5ma\u0100;d\u209C\u1CDA\u43B3;\u6A86reve;\u411F\u0100iy\u20AA\u20AErc;\u411D;\u4433ot;\u4121\u0200;lqs\u063E\u0642\u20BD\u20C9\u0180;qs\u063E\u064C\u20C4lan\xF4\u0665\u0200;cdl\u0665\u20D2\u20D5\u20E5c;\u6AA9ot\u0100;o\u20DC\u20DD\u6A80\u0100;l\u20E2\u20E3\u6A82;\u6A84\u0100;e\u20EA\u20ED\uC000\u22DB\uFE00s;\u6A94r;\uC000\u{1D524}\u0100;g\u0673\u061Bmel;\u6137cy;\u4453\u0200;Eaj\u065A\u210C\u210E\u2110;\u6A92;\u6AA5;\u6AA4\u0200Eaes\u211B\u211D\u2129\u2134;\u6269p\u0100;p\u2123\u2124\u6A8Arox\xBB\u2124\u0100;q\u212E\u212F\u6A88\u0100;q\u212E\u211Bim;\u62E7pf;\uC000\u{1D558}\u0100ci\u2143\u2146r;\u610Am\u0180;el\u066B\u214E\u2150;\u6A8E;\u6A90\u8300>;cdlqr\u05EE\u2160\u216A\u216E\u2173\u2179\u0100ci\u2165\u2167;\u6AA7r;\u6A7Aot;\u62D7Par;\u6995uest;\u6A7C\u0280adels\u2184\u216A\u2190\u0656\u219B\u01F0\u2189\0\u218Epro\xF8\u209Er;\u6978q\u0100lq\u063F\u2196les\xF3\u2088i\xED\u066B\u0100en\u21A3\u21ADrtneqq;\uC000\u2269\uFE00\xC5\u21AA\u0500Aabcefkosy\u21C4\u21C7\u21F1\u21F5\u21FA\u2218\u221D\u222F\u2268\u227Dr\xF2\u03A0\u0200ilmr\u21D0\u21D4\u21D7\u21DBrs\xF0\u1484f\xBB\u2024il\xF4\u06A9\u0100dr\u21E0\u21E4cy;\u444A\u0180;cw\u08F4\u21EB\u21EFir;\u6948;\u61ADar;\u610Firc;\u4125\u0180alr\u2201\u220E\u2213rts\u0100;u\u2209\u220A\u6665it\xBB\u220Alip;\u6026con;\u62B9r;\uC000\u{1D525}s\u0100ew\u2223\u2229arow;\u6925arow;\u6926\u0280amopr\u223A\u223E\u2243\u225E\u2263rr;\u61FFtht;\u623Bk\u0100lr\u2249\u2253eftarrow;\u61A9ightarrow;\u61AAf;\uC000\u{1D559}bar;\u6015\u0180clt\u226F\u2274\u2278r;\uC000\u{1D4BD}as\xE8\u21F4rok;\u4127\u0100bp\u2282\u2287ull;\u6043hen\xBB\u1C5B\u0AE1\u22A3\0\u22AA\0\u22B8\u22C5\u22CE\0\u22D5\u22F3\0\0\u22F8\u2322\u2367\u2362\u237F\0\u2386\u23AA\u23B4cute\u803B\xED\u40ED\u0180;iy\u0771\u22B0\u22B5rc\u803B\xEE\u40EE;\u4438\u0100cx\u22BC\u22BFy;\u4435cl\u803B\xA1\u40A1\u0100fr\u039F\u22C9;\uC000\u{1D526}rave\u803B\xEC\u40EC\u0200;ino\u073E\u22DD\u22E9\u22EE\u0100in\u22E2\u22E6nt;\u6A0Ct;\u622Dfin;\u69DCta;\u6129lig;\u4133\u0180aop\u22FE\u231A\u231D\u0180cgt\u2305\u2308\u2317r;\u412B\u0180elp\u071F\u230F\u2313in\xE5\u078Ear\xF4\u0720h;\u4131f;\u62B7ed;\u41B5\u0280;cfot\u04F4\u232C\u2331\u233D\u2341are;\u6105in\u0100;t\u2338\u2339\u621Eie;\u69DDdo\xF4\u2319\u0280;celp\u0757\u234C\u2350\u235B\u2361al;\u62BA\u0100gr\u2355\u2359er\xF3\u1563\xE3\u234Darhk;\u6A17rod;\u6A3C\u0200cgpt\u236F\u2372\u2376\u237By;\u4451on;\u412Ff;\uC000\u{1D55A}a;\u43B9uest\u803B\xBF\u40BF\u0100ci\u238A\u238Fr;\uC000\u{1D4BE}n\u0280;Edsv\u04F4\u239B\u239D\u23A1\u04F3;\u62F9ot;\u62F5\u0100;v\u23A6\u23A7\u62F4;\u62F3\u0100;i\u0777\u23AElde;\u4129\u01EB\u23B8\0\u23BCcy;\u4456l\u803B\xEF\u40EF\u0300cfmosu\u23CC\u23D7\u23DC\u23E1\u23E7\u23F5\u0100iy\u23D1\u23D5rc;\u4135;\u4439r;\uC000\u{1D527}ath;\u4237pf;\uC000\u{1D55B}\u01E3\u23EC\0\u23F1r;\uC000\u{1D4BF}rcy;\u4458kcy;\u4454\u0400acfghjos\u240B\u2416\u2422\u2427\u242D\u2431\u2435\u243Bppa\u0100;v\u2413\u2414\u43BA;\u43F0\u0100ey\u241B\u2420dil;\u4137;\u443Ar;\uC000\u{1D528}reen;\u4138cy;\u4445cy;\u445Cpf;\uC000\u{1D55C}cr;\uC000\u{1D4C0}\u0B80ABEHabcdefghjlmnoprstuv\u2470\u2481\u2486\u248D\u2491\u250E\u253D\u255A\u2580\u264E\u265E\u2665\u2679\u267D\u269A\u26B2\u26D8\u275D\u2768\u278B\u27C0\u2801\u2812\u0180art\u2477\u247A\u247Cr\xF2\u09C6\xF2\u0395ail;\u691Barr;\u690E\u0100;g\u0994\u248B;\u6A8Bar;\u6962\u0963\u24A5\0\u24AA\0\u24B1\0\0\0\0\0\u24B5\u24BA\0\u24C6\u24C8\u24CD\0\u24F9ute;\u413Amptyv;\u69B4ra\xEE\u084Cbda;\u43BBg\u0180;dl\u088E\u24C1\u24C3;\u6991\xE5\u088E;\u6A85uo\u803B\xAB\u40ABr\u0400;bfhlpst\u0899\u24DE\u24E6\u24E9\u24EB\u24EE\u24F1\u24F5\u0100;f\u089D\u24E3s;\u691Fs;\u691D\xEB\u2252p;\u61ABl;\u6939im;\u6973l;\u61A2\u0180;ae\u24FF\u2500\u2504\u6AABil;\u6919\u0100;s\u2509\u250A\u6AAD;\uC000\u2AAD\uFE00\u0180abr\u2515\u2519\u251Drr;\u690Crk;\u6772\u0100ak\u2522\u252Cc\u0100ek\u2528\u252A;\u407B;\u405B\u0100es\u2531\u2533;\u698Bl\u0100du\u2539\u253B;\u698F;\u698D\u0200aeuy\u2546\u254B\u2556\u2558ron;\u413E\u0100di\u2550\u2554il;\u413C\xEC\u08B0\xE2\u2529;\u443B\u0200cqrs\u2563\u2566\u256D\u257Da;\u6936uo\u0100;r\u0E19\u1746\u0100du\u2572\u2577har;\u6967shar;\u694Bh;\u61B2\u0280;fgqs\u258B\u258C\u0989\u25F3\u25FF\u6264t\u0280ahlrt\u2598\u25A4\u25B7\u25C2\u25E8rrow\u0100;t\u0899\u25A1a\xE9\u24F6arpoon\u0100du\u25AF\u25B4own\xBB\u045Ap\xBB\u0966eftarrows;\u61C7ight\u0180ahs\u25CD\u25D6\u25DErrow\u0100;s\u08F4\u08A7arpoon\xF3\u0F98quigarro\xF7\u21F0hreetimes;\u62CB\u0180;qs\u258B\u0993\u25FAlan\xF4\u09AC\u0280;cdgs\u09AC\u260A\u260D\u261D\u2628c;\u6AA8ot\u0100;o\u2614\u2615\u6A7F\u0100;r\u261A\u261B\u6A81;\u6A83\u0100;e\u2622\u2625\uC000\u22DA\uFE00s;\u6A93\u0280adegs\u2633\u2639\u263D\u2649\u264Bppro\xF8\u24C6ot;\u62D6q\u0100gq\u2643\u2645\xF4\u0989gt\xF2\u248C\xF4\u099Bi\xED\u09B2\u0180ilr\u2655\u08E1\u265Asht;\u697C;\uC000\u{1D529}\u0100;E\u099C\u2663;\u6A91\u0161\u2669\u2676r\u0100du\u25B2\u266E\u0100;l\u0965\u2673;\u696Alk;\u6584cy;\u4459\u0280;acht\u0A48\u2688\u268B\u2691\u2696r\xF2\u25C1orne\xF2\u1D08ard;\u696Bri;\u65FA\u0100io\u269F\u26A4dot;\u4140ust\u0100;a\u26AC\u26AD\u63B0che\xBB\u26AD\u0200Eaes\u26BB\u26BD\u26C9\u26D4;\u6268p\u0100;p\u26C3\u26C4\u6A89rox\xBB\u26C4\u0100;q\u26CE\u26CF\u6A87\u0100;q\u26CE\u26BBim;\u62E6\u0400abnoptwz\u26E9\u26F4\u26F7\u271A\u272F\u2741\u2747\u2750\u0100nr\u26EE\u26F1g;\u67ECr;\u61FDr\xEB\u08C1g\u0180lmr\u26FF\u270D\u2714eft\u0100ar\u09E6\u2707ight\xE1\u09F2apsto;\u67FCight\xE1\u09FDparrow\u0100lr\u2725\u2729ef\xF4\u24EDight;\u61AC\u0180afl\u2736\u2739\u273Dr;\u6985;\uC000\u{1D55D}us;\u6A2Dimes;\u6A34\u0161\u274B\u274Fst;\u6217\xE1\u134E\u0180;ef\u2757\u2758\u1800\u65CAnge\xBB\u2758ar\u0100;l\u2764\u2765\u4028t;\u6993\u0280achmt\u2773\u2776\u277C\u2785\u2787r\xF2\u08A8orne\xF2\u1D8Car\u0100;d\u0F98\u2783;\u696D;\u600Eri;\u62BF\u0300achiqt\u2798\u279D\u0A40\u27A2\u27AE\u27BBquo;\u6039r;\uC000\u{1D4C1}m\u0180;eg\u09B2\u27AA\u27AC;\u6A8D;\u6A8F\u0100bu\u252A\u27B3o\u0100;r\u0E1F\u27B9;\u601Arok;\u4142\u8400<;cdhilqr\u082B\u27D2\u2639\u27DC\u27E0\u27E5\u27EA\u27F0\u0100ci\u27D7\u27D9;\u6AA6r;\u6A79re\xE5\u25F2mes;\u62C9arr;\u6976uest;\u6A7B\u0100Pi\u27F5\u27F9ar;\u6996\u0180;ef\u2800\u092D\u181B\u65C3r\u0100du\u2807\u280Dshar;\u694Ahar;\u6966\u0100en\u2817\u2821rtneqq;\uC000\u2268\uFE00\xC5\u281E\u0700Dacdefhilnopsu\u2840\u2845\u2882\u288E\u2893\u28A0\u28A5\u28A8\u28DA\u28E2\u28E4\u0A83\u28F3\u2902Dot;\u623A\u0200clpr\u284E\u2852\u2863\u287Dr\u803B\xAF\u40AF\u0100et\u2857\u2859;\u6642\u0100;e\u285E\u285F\u6720se\xBB\u285F\u0100;s\u103B\u2868to\u0200;dlu\u103B\u2873\u2877\u287Bow\xEE\u048Cef\xF4\u090F\xF0\u13D1ker;\u65AE\u0100oy\u2887\u288Cmma;\u6A29;\u443Cash;\u6014asuredangle\xBB\u1626r;\uC000\u{1D52A}o;\u6127\u0180cdn\u28AF\u28B4\u28C9ro\u803B\xB5\u40B5\u0200;acd\u1464\u28BD\u28C0\u28C4s\xF4\u16A7ir;\u6AF0ot\u80BB\xB7\u01B5us\u0180;bd\u28D2\u1903\u28D3\u6212\u0100;u\u1D3C\u28D8;\u6A2A\u0163\u28DE\u28E1p;\u6ADB\xF2\u2212\xF0\u0A81\u0100dp\u28E9\u28EEels;\u62A7f;\uC000\u{1D55E}\u0100ct\u28F8\u28FDr;\uC000\u{1D4C2}pos\xBB\u159D\u0180;lm\u2909\u290A\u290D\u43BCtimap;\u62B8\u0C00GLRVabcdefghijlmoprstuvw\u2942\u2953\u297E\u2989\u2998\u29DA\u29E9\u2A15\u2A1A\u2A58\u2A5D\u2A83\u2A95\u2AA4\u2AA8\u2B04\u2B07\u2B44\u2B7F\u2BAE\u2C34\u2C67\u2C7C\u2CE9\u0100gt\u2947\u294B;\uC000\u22D9\u0338\u0100;v\u2950\u0BCF\uC000\u226B\u20D2\u0180elt\u295A\u2972\u2976ft\u0100ar\u2961\u2967rrow;\u61CDightarrow;\u61CE;\uC000\u22D8\u0338\u0100;v\u297B\u0C47\uC000\u226A\u20D2ightarrow;\u61CF\u0100Dd\u298E\u2993ash;\u62AFash;\u62AE\u0280bcnpt\u29A3\u29A7\u29AC\u29B1\u29CCla\xBB\u02DEute;\u4144g;\uC000\u2220\u20D2\u0280;Eiop\u0D84\u29BC\u29C0\u29C5\u29C8;\uC000\u2A70\u0338d;\uC000\u224B\u0338s;\u4149ro\xF8\u0D84ur\u0100;a\u29D3\u29D4\u666El\u0100;s\u29D3\u0B38\u01F3\u29DF\0\u29E3p\u80BB\xA0\u0B37mp\u0100;e\u0BF9\u0C00\u0280aeouy\u29F4\u29FE\u2A03\u2A10\u2A13\u01F0\u29F9\0\u29FB;\u6A43on;\u4148dil;\u4146ng\u0100;d\u0D7E\u2A0Aot;\uC000\u2A6D\u0338p;\u6A42;\u443Dash;\u6013\u0380;Aadqsx\u0B92\u2A29\u2A2D\u2A3B\u2A41\u2A45\u2A50rr;\u61D7r\u0100hr\u2A33\u2A36k;\u6924\u0100;o\u13F2\u13F0ot;\uC000\u2250\u0338ui\xF6\u0B63\u0100ei\u2A4A\u2A4Ear;\u6928\xED\u0B98ist\u0100;s\u0BA0\u0B9Fr;\uC000\u{1D52B}\u0200Eest\u0BC5\u2A66\u2A79\u2A7C\u0180;qs\u0BBC\u2A6D\u0BE1\u0180;qs\u0BBC\u0BC5\u2A74lan\xF4\u0BE2i\xED\u0BEA\u0100;r\u0BB6\u2A81\xBB\u0BB7\u0180Aap\u2A8A\u2A8D\u2A91r\xF2\u2971rr;\u61AEar;\u6AF2\u0180;sv\u0F8D\u2A9C\u0F8C\u0100;d\u2AA1\u2AA2\u62FC;\u62FAcy;\u445A\u0380AEadest\u2AB7\u2ABA\u2ABE\u2AC2\u2AC5\u2AF6\u2AF9r\xF2\u2966;\uC000\u2266\u0338rr;\u619Ar;\u6025\u0200;fqs\u0C3B\u2ACE\u2AE3\u2AEFt\u0100ar\u2AD4\u2AD9rro\xF7\u2AC1ightarro\xF7\u2A90\u0180;qs\u0C3B\u2ABA\u2AEAlan\xF4\u0C55\u0100;s\u0C55\u2AF4\xBB\u0C36i\xED\u0C5D\u0100;r\u0C35\u2AFEi\u0100;e\u0C1A\u0C25i\xE4\u0D90\u0100pt\u2B0C\u2B11f;\uC000\u{1D55F}\u8180\xAC;in\u2B19\u2B1A\u2B36\u40ACn\u0200;Edv\u0B89\u2B24\u2B28\u2B2E;\uC000\u22F9\u0338ot;\uC000\u22F5\u0338\u01E1\u0B89\u2B33\u2B35;\u62F7;\u62F6i\u0100;v\u0CB8\u2B3C\u01E1\u0CB8\u2B41\u2B43;\u62FE;\u62FD\u0180aor\u2B4B\u2B63\u2B69r\u0200;ast\u0B7B\u2B55\u2B5A\u2B5Flle\xEC\u0B7Bl;\uC000\u2AFD\u20E5;\uC000\u2202\u0338lint;\u6A14\u0180;ce\u0C92\u2B70\u2B73u\xE5\u0CA5\u0100;c\u0C98\u2B78\u0100;e\u0C92\u2B7D\xF1\u0C98\u0200Aait\u2B88\u2B8B\u2B9D\u2BA7r\xF2\u2988rr\u0180;cw\u2B94\u2B95\u2B99\u619B;\uC000\u2933\u0338;\uC000\u219D\u0338ghtarrow\xBB\u2B95ri\u0100;e\u0CCB\u0CD6\u0380chimpqu\u2BBD\u2BCD\u2BD9\u2B04\u0B78\u2BE4\u2BEF\u0200;cer\u0D32\u2BC6\u0D37\u2BC9u\xE5\u0D45;\uC000\u{1D4C3}ort\u026D\u2B05\0\0\u2BD6ar\xE1\u2B56m\u0100;e\u0D6E\u2BDF\u0100;q\u0D74\u0D73su\u0100bp\u2BEB\u2BED\xE5\u0CF8\xE5\u0D0B\u0180bcp\u2BF6\u2C11\u2C19\u0200;Ees\u2BFF\u2C00\u0D22\u2C04\u6284;\uC000\u2AC5\u0338et\u0100;e\u0D1B\u2C0Bq\u0100;q\u0D23\u2C00c\u0100;e\u0D32\u2C17\xF1\u0D38\u0200;Ees\u2C22\u2C23\u0D5F\u2C27\u6285;\uC000\u2AC6\u0338et\u0100;e\u0D58\u2C2Eq\u0100;q\u0D60\u2C23\u0200gilr\u2C3D\u2C3F\u2C45\u2C47\xEC\u0BD7lde\u803B\xF1\u40F1\xE7\u0C43iangle\u0100lr\u2C52\u2C5Ceft\u0100;e\u0C1A\u2C5A\xF1\u0C26ight\u0100;e\u0CCB\u2C65\xF1\u0CD7\u0100;m\u2C6C\u2C6D\u43BD\u0180;es\u2C74\u2C75\u2C79\u4023ro;\u6116p;\u6007\u0480DHadgilrs\u2C8F\u2C94\u2C99\u2C9E\u2CA3\u2CB0\u2CB6\u2CD3\u2CE3ash;\u62ADarr;\u6904p;\uC000\u224D\u20D2ash;\u62AC\u0100et\u2CA8\u2CAC;\uC000\u2265\u20D2;\uC000>\u20D2nfin;\u69DE\u0180Aet\u2CBD\u2CC1\u2CC5rr;\u6902;\uC000\u2264\u20D2\u0100;r\u2CCA\u2CCD\uC000<\u20D2ie;\uC000\u22B4\u20D2\u0100At\u2CD8\u2CDCrr;\u6903rie;\uC000\u22B5\u20D2im;\uC000\u223C\u20D2\u0180Aan\u2CF0\u2CF4\u2D02rr;\u61D6r\u0100hr\u2CFA\u2CFDk;\u6923\u0100;o\u13E7\u13E5ear;\u6927\u1253\u1A95\0\0\0\0\0\0\0\0\0\0\0\0\0\u2D2D\0\u2D38\u2D48\u2D60\u2D65\u2D72\u2D84\u1B07\0\0\u2D8D\u2DAB\0\u2DC8\u2DCE\0\u2DDC\u2E19\u2E2B\u2E3E\u2E43\u0100cs\u2D31\u1A97ute\u803B\xF3\u40F3\u0100iy\u2D3C\u2D45r\u0100;c\u1A9E\u2D42\u803B\xF4\u40F4;\u443E\u0280abios\u1AA0\u2D52\u2D57\u01C8\u2D5Alac;\u4151v;\u6A38old;\u69BClig;\u4153\u0100cr\u2D69\u2D6Dir;\u69BF;\uC000\u{1D52C}\u036F\u2D79\0\0\u2D7C\0\u2D82n;\u42DBave\u803B\xF2\u40F2;\u69C1\u0100bm\u2D88\u0DF4ar;\u69B5\u0200acit\u2D95\u2D98\u2DA5\u2DA8r\xF2\u1A80\u0100ir\u2D9D\u2DA0r;\u69BEoss;\u69BBn\xE5\u0E52;\u69C0\u0180aei\u2DB1\u2DB5\u2DB9cr;\u414Dga;\u43C9\u0180cdn\u2DC0\u2DC5\u01CDron;\u43BF;\u69B6pf;\uC000\u{1D560}\u0180ael\u2DD4\u2DD7\u01D2r;\u69B7rp;\u69B9\u0380;adiosv\u2DEA\u2DEB\u2DEE\u2E08\u2E0D\u2E10\u2E16\u6228r\xF2\u1A86\u0200;efm\u2DF7\u2DF8\u2E02\u2E05\u6A5Dr\u0100;o\u2DFE\u2DFF\u6134f\xBB\u2DFF\u803B\xAA\u40AA\u803B\xBA\u40BAgof;\u62B6r;\u6A56lope;\u6A57;\u6A5B\u0180clo\u2E1F\u2E21\u2E27\xF2\u2E01ash\u803B\xF8\u40F8l;\u6298i\u016C\u2E2F\u2E34de\u803B\xF5\u40F5es\u0100;a\u01DB\u2E3As;\u6A36ml\u803B\xF6\u40F6bar;\u633D\u0AE1\u2E5E\0\u2E7D\0\u2E80\u2E9D\0\u2EA2\u2EB9\0\0\u2ECB\u0E9C\0\u2F13\0\0\u2F2B\u2FBC\0\u2FC8r\u0200;ast\u0403\u2E67\u2E72\u0E85\u8100\xB6;l\u2E6D\u2E6E\u40B6le\xEC\u0403\u0269\u2E78\0\0\u2E7Bm;\u6AF3;\u6AFDy;\u443Fr\u0280cimpt\u2E8B\u2E8F\u2E93\u1865\u2E97nt;\u4025od;\u402Eil;\u6030enk;\u6031r;\uC000\u{1D52D}\u0180imo\u2EA8\u2EB0\u2EB4\u0100;v\u2EAD\u2EAE\u43C6;\u43D5ma\xF4\u0A76ne;\u660E\u0180;tv\u2EBF\u2EC0\u2EC8\u43C0chfork\xBB\u1FFD;\u43D6\u0100au\u2ECF\u2EDFn\u0100ck\u2ED5\u2EDDk\u0100;h\u21F4\u2EDB;\u610E\xF6\u21F4s\u0480;abcdemst\u2EF3\u2EF4\u1908\u2EF9\u2EFD\u2F04\u2F06\u2F0A\u2F0E\u402Bcir;\u6A23ir;\u6A22\u0100ou\u1D40\u2F02;\u6A25;\u6A72n\u80BB\xB1\u0E9Dim;\u6A26wo;\u6A27\u0180ipu\u2F19\u2F20\u2F25ntint;\u6A15f;\uC000\u{1D561}nd\u803B\xA3\u40A3\u0500;Eaceinosu\u0EC8\u2F3F\u2F41\u2F44\u2F47\u2F81\u2F89\u2F92\u2F7E\u2FB6;\u6AB3p;\u6AB7u\xE5\u0ED9\u0100;c\u0ECE\u2F4C\u0300;acens\u0EC8\u2F59\u2F5F\u2F66\u2F68\u2F7Eppro\xF8\u2F43urlye\xF1\u0ED9\xF1\u0ECE\u0180aes\u2F6F\u2F76\u2F7Approx;\u6AB9qq;\u6AB5im;\u62E8i\xED\u0EDFme\u0100;s\u2F88\u0EAE\u6032\u0180Eas\u2F78\u2F90\u2F7A\xF0\u2F75\u0180dfp\u0EEC\u2F99\u2FAF\u0180als\u2FA0\u2FA5\u2FAAlar;\u632Eine;\u6312urf;\u6313\u0100;t\u0EFB\u2FB4\xEF\u0EFBrel;\u62B0\u0100ci\u2FC0\u2FC5r;\uC000\u{1D4C5};\u43C8ncsp;\u6008\u0300fiopsu\u2FDA\u22E2\u2FDF\u2FE5\u2FEB\u2FF1r;\uC000\u{1D52E}pf;\uC000\u{1D562}rime;\u6057cr;\uC000\u{1D4C6}\u0180aeo\u2FF8\u3009\u3013t\u0100ei\u2FFE\u3005rnion\xF3\u06B0nt;\u6A16st\u0100;e\u3010\u3011\u403F\xF1\u1F19\xF4\u0F14\u0A80ABHabcdefhilmnoprstux\u3040\u3051\u3055\u3059\u30E0\u310E\u312B\u3147\u3162\u3172\u318E\u3206\u3215\u3224\u3229\u3258\u326E\u3272\u3290\u32B0\u32B7\u0180art\u3047\u304A\u304Cr\xF2\u10B3\xF2\u03DDail;\u691Car\xF2\u1C65ar;\u6964\u0380cdenqrt\u3068\u3075\u3078\u307F\u308F\u3094\u30CC\u0100eu\u306D\u3071;\uC000\u223D\u0331te;\u4155i\xE3\u116Emptyv;\u69B3g\u0200;del\u0FD1\u3089\u308B\u308D;\u6992;\u69A5\xE5\u0FD1uo\u803B\xBB\u40BBr\u0580;abcfhlpstw\u0FDC\u30AC\u30AF\u30B7\u30B9\u30BC\u30BE\u30C0\u30C3\u30C7\u30CAp;\u6975\u0100;f\u0FE0\u30B4s;\u6920;\u6933s;\u691E\xEB\u225D\xF0\u272El;\u6945im;\u6974l;\u61A3;\u619D\u0100ai\u30D1\u30D5il;\u691Ao\u0100;n\u30DB\u30DC\u6236al\xF3\u0F1E\u0180abr\u30E7\u30EA\u30EEr\xF2\u17E5rk;\u6773\u0100ak\u30F3\u30FDc\u0100ek\u30F9\u30FB;\u407D;\u405D\u0100es\u3102\u3104;\u698Cl\u0100du\u310A\u310C;\u698E;\u6990\u0200aeuy\u3117\u311C\u3127\u3129ron;\u4159\u0100di\u3121\u3125il;\u4157\xEC\u0FF2\xE2\u30FA;\u4440\u0200clqs\u3134\u3137\u313D\u3144a;\u6937dhar;\u6969uo\u0100;r\u020E\u020Dh;\u61B3\u0180acg\u314E\u315F\u0F44l\u0200;ips\u0F78\u3158\u315B\u109Cn\xE5\u10BBar\xF4\u0FA9t;\u65AD\u0180ilr\u3169\u1023\u316Esht;\u697D;\uC000\u{1D52F}\u0100ao\u3177\u3186r\u0100du\u317D\u317F\xBB\u047B\u0100;l\u1091\u3184;\u696C\u0100;v\u318B\u318C\u43C1;\u43F1\u0180gns\u3195\u31F9\u31FCht\u0300ahlrst\u31A4\u31B0\u31C2\u31D8\u31E4\u31EErrow\u0100;t\u0FDC\u31ADa\xE9\u30C8arpoon\u0100du\u31BB\u31BFow\xEE\u317Ep\xBB\u1092eft\u0100ah\u31CA\u31D0rrow\xF3\u0FEAarpoon\xF3\u0551ightarrows;\u61C9quigarro\xF7\u30CBhreetimes;\u62CCg;\u42DAingdotse\xF1\u1F32\u0180ahm\u320D\u3210\u3213r\xF2\u0FEAa\xF2\u0551;\u600Foust\u0100;a\u321E\u321F\u63B1che\xBB\u321Fmid;\u6AEE\u0200abpt\u3232\u323D\u3240\u3252\u0100nr\u3237\u323Ag;\u67EDr;\u61FEr\xEB\u1003\u0180afl\u3247\u324A\u324Er;\u6986;\uC000\u{1D563}us;\u6A2Eimes;\u6A35\u0100ap\u325D\u3267r\u0100;g\u3263\u3264\u4029t;\u6994olint;\u6A12ar\xF2\u31E3\u0200achq\u327B\u3280\u10BC\u3285quo;\u603Ar;\uC000\u{1D4C7}\u0100bu\u30FB\u328Ao\u0100;r\u0214\u0213\u0180hir\u3297\u329B\u32A0re\xE5\u31F8mes;\u62CAi\u0200;efl\u32AA\u1059\u1821\u32AB\u65B9tri;\u69CEluhar;\u6968;\u611E\u0D61\u32D5\u32DB\u32DF\u332C\u3338\u3371\0\u337A\u33A4\0\0\u33EC\u33F0\0\u3428\u3448\u345A\u34AD\u34B1\u34CA\u34F1\0\u3616\0\0\u3633cute;\u415Bqu\xEF\u27BA\u0500;Eaceinpsy\u11ED\u32F3\u32F5\u32FF\u3302\u330B\u330F\u331F\u3326\u3329;\u6AB4\u01F0\u32FA\0\u32FC;\u6AB8on;\u4161u\xE5\u11FE\u0100;d\u11F3\u3307il;\u415Frc;\u415D\u0180Eas\u3316\u3318\u331B;\u6AB6p;\u6ABAim;\u62E9olint;\u6A13i\xED\u1204;\u4441ot\u0180;be\u3334\u1D47\u3335\u62C5;\u6A66\u0380Aacmstx\u3346\u334A\u3357\u335B\u335E\u3363\u336Drr;\u61D8r\u0100hr\u3350\u3352\xEB\u2228\u0100;o\u0A36\u0A34t\u803B\xA7\u40A7i;\u403Bwar;\u6929m\u0100in\u3369\xF0nu\xF3\xF1t;\u6736r\u0100;o\u3376\u2055\uC000\u{1D530}\u0200acoy\u3382\u3386\u3391\u33A0rp;\u666F\u0100hy\u338B\u338Fcy;\u4449;\u4448rt\u026D\u3399\0\0\u339Ci\xE4\u1464ara\xEC\u2E6F\u803B\xAD\u40AD\u0100gm\u33A8\u33B4ma\u0180;fv\u33B1\u33B2\u33B2\u43C3;\u43C2\u0400;deglnpr\u12AB\u33C5\u33C9\u33CE\u33D6\u33DE\u33E1\u33E6ot;\u6A6A\u0100;q\u12B1\u12B0\u0100;E\u33D3\u33D4\u6A9E;\u6AA0\u0100;E\u33DB\u33DC\u6A9D;\u6A9Fe;\u6246lus;\u6A24arr;\u6972ar\xF2\u113D\u0200aeit\u33F8\u3408\u340F\u3417\u0100ls\u33FD\u3404lsetm\xE9\u336Ahp;\u6A33parsl;\u69E4\u0100dl\u1463\u3414e;\u6323\u0100;e\u341C\u341D\u6AAA\u0100;s\u3422\u3423\u6AAC;\uC000\u2AAC\uFE00\u0180flp\u342E\u3433\u3442tcy;\u444C\u0100;b\u3438\u3439\u402F\u0100;a\u343E\u343F\u69C4r;\u633Ff;\uC000\u{1D564}a\u0100dr\u344D\u0402es\u0100;u\u3454\u3455\u6660it\xBB\u3455\u0180csu\u3460\u3479\u349F\u0100au\u3465\u346Fp\u0100;s\u1188\u346B;\uC000\u2293\uFE00p\u0100;s\u11B4\u3475;\uC000\u2294\uFE00u\u0100bp\u347F\u348F\u0180;es\u1197\u119C\u3486et\u0100;e\u1197\u348D\xF1\u119D\u0180;es\u11A8\u11AD\u3496et\u0100;e\u11A8\u349D\xF1\u11AE\u0180;af\u117B\u34A6\u05B0r\u0165\u34AB\u05B1\xBB\u117Car\xF2\u1148\u0200cemt\u34B9\u34BE\u34C2\u34C5r;\uC000\u{1D4C8}tm\xEE\xF1i\xEC\u3415ar\xE6\u11BE\u0100ar\u34CE\u34D5r\u0100;f\u34D4\u17BF\u6606\u0100an\u34DA\u34EDight\u0100ep\u34E3\u34EApsilo\xEE\u1EE0h\xE9\u2EAFs\xBB\u2852\u0280bcmnp\u34FB\u355E\u1209\u358B\u358E\u0480;Edemnprs\u350E\u350F\u3511\u3515\u351E\u3523\u352C\u3531\u3536\u6282;\u6AC5ot;\u6ABD\u0100;d\u11DA\u351Aot;\u6AC3ult;\u6AC1\u0100Ee\u3528\u352A;\u6ACB;\u628Alus;\u6ABFarr;\u6979\u0180eiu\u353D\u3552\u3555t\u0180;en\u350E\u3545\u354Bq\u0100;q\u11DA\u350Feq\u0100;q\u352B\u3528m;\u6AC7\u0100bp\u355A\u355C;\u6AD5;\u6AD3c\u0300;acens\u11ED\u356C\u3572\u3579\u357B\u3326ppro\xF8\u32FAurlye\xF1\u11FE\xF1\u11F3\u0180aes\u3582\u3588\u331Bppro\xF8\u331Aq\xF1\u3317g;\u666A\u0680123;Edehlmnps\u35A9\u35AC\u35AF\u121C\u35B2\u35B4\u35C0\u35C9\u35D5\u35DA\u35DF\u35E8\u35ED\u803B\xB9\u40B9\u803B\xB2\u40B2\u803B\xB3\u40B3;\u6AC6\u0100os\u35B9\u35BCt;\u6ABEub;\u6AD8\u0100;d\u1222\u35C5ot;\u6AC4s\u0100ou\u35CF\u35D2l;\u67C9b;\u6AD7arr;\u697Bult;\u6AC2\u0100Ee\u35E4\u35E6;\u6ACC;\u628Blus;\u6AC0\u0180eiu\u35F4\u3609\u360Ct\u0180;en\u121C\u35FC\u3602q\u0100;q\u1222\u35B2eq\u0100;q\u35E7\u35E4m;\u6AC8\u0100bp\u3611\u3613;\u6AD4;\u6AD6\u0180Aan\u361C\u3620\u362Drr;\u61D9r\u0100hr\u3626\u3628\xEB\u222E\u0100;o\u0A2B\u0A29war;\u692Alig\u803B\xDF\u40DF\u0BE1\u3651\u365D\u3660\u12CE\u3673\u3679\0\u367E\u36C2\0\0\0\0\0\u36DB\u3703\0\u3709\u376C\0\0\0\u3787\u0272\u3656\0\0\u365Bget;\u6316;\u43C4r\xEB\u0E5F\u0180aey\u3666\u366B\u3670ron;\u4165dil;\u4163;\u4442lrec;\u6315r;\uC000\u{1D531}\u0200eiko\u3686\u369D\u36B5\u36BC\u01F2\u368B\0\u3691e\u01004f\u1284\u1281a\u0180;sv\u3698\u3699\u369B\u43B8ym;\u43D1\u0100cn\u36A2\u36B2k\u0100as\u36A8\u36AEppro\xF8\u12C1im\xBB\u12ACs\xF0\u129E\u0100as\u36BA\u36AE\xF0\u12C1rn\u803B\xFE\u40FE\u01EC\u031F\u36C6\u22E7es\u8180\xD7;bd\u36CF\u36D0\u36D8\u40D7\u0100;a\u190F\u36D5r;\u6A31;\u6A30\u0180eps\u36E1\u36E3\u3700\xE1\u2A4D\u0200;bcf\u0486\u36EC\u36F0\u36F4ot;\u6336ir;\u6AF1\u0100;o\u36F9\u36FC\uC000\u{1D565}rk;\u6ADA\xE1\u3362rime;\u6034\u0180aip\u370F\u3712\u3764d\xE5\u1248\u0380adempst\u3721\u374D\u3740\u3751\u3757\u375C\u375Fngle\u0280;dlqr\u3730\u3731\u3736\u3740\u3742\u65B5own\xBB\u1DBBeft\u0100;e\u2800\u373E\xF1\u092E;\u625Cight\u0100;e\u32AA\u374B\xF1\u105Aot;\u65ECinus;\u6A3Alus;\u6A39b;\u69CDime;\u6A3Bezium;\u63E2\u0180cht\u3772\u377D\u3781\u0100ry\u3777\u377B;\uC000\u{1D4C9};\u4446cy;\u445Brok;\u4167\u0100io\u378B\u378Ex\xF4\u1777head\u0100lr\u3797\u37A0eftarro\xF7\u084Fightarrow\xBB\u0F5D\u0900AHabcdfghlmoprstuw\u37D0\u37D3\u37D7\u37E4\u37F0\u37FC\u380E\u381C\u3823\u3834\u3851\u385D\u386B\u38A9\u38CC\u38D2\u38EA\u38F6r\xF2\u03EDar;\u6963\u0100cr\u37DC\u37E2ute\u803B\xFA\u40FA\xF2\u1150r\u01E3\u37EA\0\u37EDy;\u445Eve;\u416D\u0100iy\u37F5\u37FArc\u803B\xFB\u40FB;\u4443\u0180abh\u3803\u3806\u380Br\xF2\u13ADlac;\u4171a\xF2\u13C3\u0100ir\u3813\u3818sht;\u697E;\uC000\u{1D532}rave\u803B\xF9\u40F9\u0161\u3827\u3831r\u0100lr\u382C\u382E\xBB\u0957\xBB\u1083lk;\u6580\u0100ct\u3839\u384D\u026F\u383F\0\0\u384Arn\u0100;e\u3845\u3846\u631Cr\xBB\u3846op;\u630Fri;\u65F8\u0100al\u3856\u385Acr;\u416B\u80BB\xA8\u0349\u0100gp\u3862\u3866on;\u4173f;\uC000\u{1D566}\u0300adhlsu\u114B\u3878\u387D\u1372\u3891\u38A0own\xE1\u13B3arpoon\u0100lr\u3888\u388Cef\xF4\u382Digh\xF4\u382Fi\u0180;hl\u3899\u389A\u389C\u43C5\xBB\u13FAon\xBB\u389Aparrows;\u61C8\u0180cit\u38B0\u38C4\u38C8\u026F\u38B6\0\0\u38C1rn\u0100;e\u38BC\u38BD\u631Dr\xBB\u38BDop;\u630Eng;\u416Fri;\u65F9cr;\uC000\u{1D4CA}\u0180dir\u38D9\u38DD\u38E2ot;\u62F0lde;\u4169i\u0100;f\u3730\u38E8\xBB\u1813\u0100am\u38EF\u38F2r\xF2\u38A8l\u803B\xFC\u40FCangle;\u69A7\u0780ABDacdeflnoprsz\u391C\u391F\u3929\u392D\u39B5\u39B8\u39BD\u39DF\u39E4\u39E8\u39F3\u39F9\u39FD\u3A01\u3A20r\xF2\u03F7ar\u0100;v\u3926\u3927\u6AE8;\u6AE9as\xE8\u03E1\u0100nr\u3932\u3937grt;\u699C\u0380eknprst\u34E3\u3946\u394B\u3952\u395D\u3964\u3996app\xE1\u2415othin\xE7\u1E96\u0180hir\u34EB\u2EC8\u3959op\xF4\u2FB5\u0100;h\u13B7\u3962\xEF\u318D\u0100iu\u3969\u396Dgm\xE1\u33B3\u0100bp\u3972\u3984setneq\u0100;q\u397D\u3980\uC000\u228A\uFE00;\uC000\u2ACB\uFE00setneq\u0100;q\u398F\u3992\uC000\u228B\uFE00;\uC000\u2ACC\uFE00\u0100hr\u399B\u399Fet\xE1\u369Ciangle\u0100lr\u39AA\u39AFeft\xBB\u0925ight\xBB\u1051y;\u4432ash\xBB\u1036\u0180elr\u39C4\u39D2\u39D7\u0180;be\u2DEA\u39CB\u39CFar;\u62BBq;\u625Alip;\u62EE\u0100bt\u39DC\u1468a\xF2\u1469r;\uC000\u{1D533}tr\xE9\u39AEsu\u0100bp\u39EF\u39F1\xBB\u0D1C\xBB\u0D59pf;\uC000\u{1D567}ro\xF0\u0EFBtr\xE9\u39B4\u0100cu\u3A06\u3A0Br;\uC000\u{1D4CB}\u0100bp\u3A10\u3A18n\u0100Ee\u3980\u3A16\xBB\u397En\u0100Ee\u3992\u3A1E\xBB\u3990igzag;\u699A\u0380cefoprs\u3A36\u3A3B\u3A56\u3A5B\u3A54\u3A61\u3A6Airc;\u4175\u0100di\u3A40\u3A51\u0100bg\u3A45\u3A49ar;\u6A5Fe\u0100;q\u15FA\u3A4F;\u6259erp;\u6118r;\uC000\u{1D534}pf;\uC000\u{1D568}\u0100;e\u1479\u3A66at\xE8\u1479cr;\uC000\u{1D4CC}\u0AE3\u178E\u3A87\0\u3A8B\0\u3A90\u3A9B\0\0\u3A9D\u3AA8\u3AAB\u3AAF\0\0\u3AC3\u3ACE\0\u3AD8\u17DC\u17DFtr\xE9\u17D1r;\uC000\u{1D535}\u0100Aa\u3A94\u3A97r\xF2\u03C3r\xF2\u09F6;\u43BE\u0100Aa\u3AA1\u3AA4r\xF2\u03B8r\xF2\u09EBa\xF0\u2713is;\u62FB\u0180dpt\u17A4\u3AB5\u3ABE\u0100fl\u3ABA\u17A9;\uC000\u{1D569}im\xE5\u17B2\u0100Aa\u3AC7\u3ACAr\xF2\u03CEr\xF2\u0A01\u0100cq\u3AD2\u17B8r;\uC000\u{1D4CD}\u0100pt\u17D6\u3ADCr\xE9\u17D4\u0400acefiosu\u3AF0\u3AFD\u3B08\u3B0C\u3B11\u3B15\u3B1B\u3B21c\u0100uy\u3AF6\u3AFBte\u803B\xFD\u40FD;\u444F\u0100iy\u3B02\u3B06rc;\u4177;\u444Bn\u803B\xA5\u40A5r;\uC000\u{1D536}cy;\u4457pf;\uC000\u{1D56A}cr;\uC000\u{1D4CE}\u0100cm\u3B26\u3B29y;\u444El\u803B\xFF\u40FF\u0500acdefhiosw\u3B42\u3B48\u3B54\u3B58\u3B64\u3B69\u3B6D\u3B74\u3B7A\u3B80cute;\u417A\u0100ay\u3B4D\u3B52ron;\u417E;\u4437ot;\u417C\u0100et\u3B5D\u3B61tr\xE6\u155Fa;\u43B6r;\uC000\u{1D537}cy;\u4436grarr;\u61DDpf;\uC000\u{1D56B}cr;\uC000\u{1D4CF}\u0100jn\u3B85\u3B87;\u600Dj;\u600C'.split("").map(e=>e.charCodeAt(0)));var yE,h8=new Map([[0,65533],[128,8364],[130,8218],[131,402],[132,8222],[133,8230],[134,8224],[135,8225],[136,710],[137,8240],[138,352],[139,8249],[140,338],[142,381],[145,8216],[146,8217],[147,8220],[148,8221],[149,8226],[150,8211],[151,8212],[152,732],[153,8482],[154,353],[155,8250],[156,339],[158,382],[159,376]]),kv=(yE=String.fromCodePoint)!==null&&yE!==void 0?yE:function(e){let t="";return e>65535&&(e-=65536,t+=String.fromCharCode(e>>>10&1023|55296),e=56320|e&1023),t+=String.fromCharCode(e),t};function TE(e){var t;return e>=55296&&e<=57343||e>1114111?65533:(t=h8.get(e))!==null&&t!==void 0?t:e}var Kt;(function(e){e[e.NUM=35]="NUM",e[e.SEMI=59]="SEMI",e[e.EQUALS=61]="EQUALS",e[e.ZERO=48]="ZERO",e[e.NINE=57]="NINE",e[e.LOWER_A=97]="LOWER_A",e[e.LOWER_F=102]="LOWER_F",e[e.LOWER_X=120]="LOWER_X",e[e.LOWER_Z=122]="LOWER_Z",e[e.UPPER_A=65]="UPPER_A",e[e.UPPER_F=70]="UPPER_F",e[e.UPPER_Z=90]="UPPER_Z"})(Kt||(Kt={}));var m8=32,Ia;(function(e){e[e.VALUE_LENGTH=49152]="VALUE_LENGTH",e[e.BRANCH_LENGTH=16256]="BRANCH_LENGTH",e[e.JUMP_TABLE=127]="JUMP_TABLE"})(Ia||(Ia={}));function SE(e){return e>=Kt.ZERO&&e<=Kt.NINE}function g8(e){return e>=Kt.UPPER_A&&e<=Kt.UPPER_F||e>=Kt.LOWER_A&&e<=Kt.LOWER_F}function b8(e){return e>=Kt.UPPER_A&&e<=Kt.UPPER_Z||e>=Kt.LOWER_A&&e<=Kt.LOWER_Z||SE(e)}function E8(e){return e===Kt.EQUALS||b8(e)}var Yt;(function(e){e[e.EntityStart=0]="EntityStart",e[e.NumericStart=1]="NumericStart",e[e.NumericDecimal=2]="NumericDecimal",e[e.NumericHex=3]="NumericHex",e[e.NamedEntity=4]="NamedEntity"})(Yt||(Yt={}));var Qr;(function(e){e[e.Legacy=0]="Legacy",e[e.Strict=1]="Strict",e[e.Attribute=2]="Attribute"})(Qr||(Qr={}));var Oh=class{constructor(t,n,r){this.decodeTree=t,this.emitCodePoint=n,this.errors=r,this.state=Yt.EntityStart,this.consumed=1,this.result=0,this.treeIndex=0,this.excess=1,this.decodeMode=Qr.Strict}startEntity(t){this.decodeMode=t,this.state=Yt.EntityStart,this.result=0,this.treeIndex=0,this.excess=1,this.consumed=1}write(t,n){switch(this.state){case Yt.EntityStart:return t.charCodeAt(n)===Kt.NUM?(this.state=Yt.NumericStart,this.consumed+=1,this.stateNumericStart(t,n+1)):(this.state=Yt.NamedEntity,this.stateNamedEntity(t,n));case Yt.NumericStart:return this.stateNumericStart(t,n);case Yt.NumericDecimal:return this.stateNumericDecimal(t,n);case Yt.NumericHex:return this.stateNumericHex(t,n);case Yt.NamedEntity:return this.stateNamedEntity(t,n)}}stateNumericStart(t,n){return n>=t.length?-1:(t.charCodeAt(n)|m8)===Kt.LOWER_X?(this.state=Yt.NumericHex,this.consumed+=1,this.stateNumericHex(t,n+1)):(this.state=Yt.NumericDecimal,this.stateNumericDecimal(t,n))}addToNumericResult(t,n,r,i){if(n!==r){let a=r-n;this.result=this.result*Math.pow(i,a)+Number.parseInt(t.substr(n,a),i),this.consumed+=a}}stateNumericHex(t,n){let r=n;for(;n>14;for(;n>14,a!==0){if(o===Kt.SEMI)return this.emitNamedEntityData(this.treeIndex,a,this.consumed+this.excess);this.decodeMode!==Qr.Strict&&(this.result=this.treeIndex,this.consumed+=this.excess,this.excess=0)}}return-1}emitNotTerminatedNamedEntity(){var t;let{result:n,decodeTree:r}=this,i=(r[n]&Ia.VALUE_LENGTH)>>14;return this.emitNamedEntityData(n,i,this.consumed),(t=this.errors)===null||t===void 0||t.missingSemicolonAfterCharacterReference(),this.consumed}emitNamedEntityData(t,n,r){let{decodeTree:i}=this;return this.emitCodePoint(n===1?i[t]&~Ia.VALUE_LENGTH:i[t+1],r),n===3&&this.emitCodePoint(i[t+2],r),r}end(){var t;switch(this.state){case Yt.NamedEntity:return this.result!==0&&(this.decodeMode!==Qr.Attribute||this.result===this.treeIndex)?this.emitNotTerminatedNamedEntity():0;case Yt.NumericDecimal:return this.emitNumericEntity(0,2);case Yt.NumericHex:return this.emitNumericEntity(0,3);case Yt.NumericStart:return(t=this.errors)===null||t===void 0||t.absenceOfDigitsInNumericCharacterReference(this.consumed),0;case Yt.EntityStart:return 0}}};function y8(e,t,n,r){let i=(t&Ia.BRANCH_LENGTH)>>7,a=t&Ia.JUMP_TABLE;if(i===0)return a!==0&&r===a?n:-1;if(a){let l=r-a;return l<0||l>=i?-1:e[n+l]-1}let o=n,s=o+i-1;for(;o<=s;){let l=o+s>>>1,u=e[l];if(ur)s=l-1;else return e[l+i]}return-1}var dc={};wf(dc,{ATTRS:()=>Zr,DOCUMENT_MODE:()=>fn,NS:()=>j,NUMBERED_HEADERS:()=>ml,SPECIAL_ELEMENTS:()=>_E,TAG_ID:()=>p,TAG_NAMES:()=>I,getTagID:()=>La,hasUnescapedText:()=>wv});var j;(function(e){e.HTML="http://www.w3.org/1999/xhtml",e.MATHML="http://www.w3.org/1998/Math/MathML",e.SVG="http://www.w3.org/2000/svg",e.XLINK="http://www.w3.org/1999/xlink",e.XML="http://www.w3.org/XML/1998/namespace",e.XMLNS="http://www.w3.org/2000/xmlns/"})(j||(j={}));var Zr;(function(e){e.TYPE="type",e.ACTION="action",e.ENCODING="encoding",e.PROMPT="prompt",e.NAME="name",e.COLOR="color",e.FACE="face",e.SIZE="size"})(Zr||(Zr={}));var fn;(function(e){e.NO_QUIRKS="no-quirks",e.QUIRKS="quirks",e.LIMITED_QUIRKS="limited-quirks"})(fn||(fn={}));var I;(function(e){e.A="a",e.ADDRESS="address",e.ANNOTATION_XML="annotation-xml",e.APPLET="applet",e.AREA="area",e.ARTICLE="article",e.ASIDE="aside",e.B="b",e.BASE="base",e.BASEFONT="basefont",e.BGSOUND="bgsound",e.BIG="big",e.BLOCKQUOTE="blockquote",e.BODY="body",e.BR="br",e.BUTTON="button",e.CAPTION="caption",e.CENTER="center",e.CODE="code",e.COL="col",e.COLGROUP="colgroup",e.DD="dd",e.DESC="desc",e.DETAILS="details",e.DIALOG="dialog",e.DIR="dir",e.DIV="div",e.DL="dl",e.DT="dt",e.EM="em",e.EMBED="embed",e.FIELDSET="fieldset",e.FIGCAPTION="figcaption",e.FIGURE="figure",e.FONT="font",e.FOOTER="footer",e.FOREIGN_OBJECT="foreignObject",e.FORM="form",e.FRAME="frame",e.FRAMESET="frameset",e.H1="h1",e.H2="h2",e.H3="h3",e.H4="h4",e.H5="h5",e.H6="h6",e.HEAD="head",e.HEADER="header",e.HGROUP="hgroup",e.HR="hr",e.HTML="html",e.I="i",e.IMG="img",e.IMAGE="image",e.INPUT="input",e.IFRAME="iframe",e.KEYGEN="keygen",e.LABEL="label",e.LI="li",e.LINK="link",e.LISTING="listing",e.MAIN="main",e.MALIGNMARK="malignmark",e.MARQUEE="marquee",e.MATH="math",e.MENU="menu",e.META="meta",e.MGLYPH="mglyph",e.MI="mi",e.MO="mo",e.MN="mn",e.MS="ms",e.MTEXT="mtext",e.NAV="nav",e.NOBR="nobr",e.NOFRAMES="noframes",e.NOEMBED="noembed",e.NOSCRIPT="noscript",e.OBJECT="object",e.OL="ol",e.OPTGROUP="optgroup",e.OPTION="option",e.P="p",e.PARAM="param",e.PLAINTEXT="plaintext",e.PRE="pre",e.RB="rb",e.RP="rp",e.RT="rt",e.RTC="rtc",e.RUBY="ruby",e.S="s",e.SCRIPT="script",e.SEARCH="search",e.SECTION="section",e.SELECT="select",e.SOURCE="source",e.SMALL="small",e.SPAN="span",e.STRIKE="strike",e.STRONG="strong",e.STYLE="style",e.SUB="sub",e.SUMMARY="summary",e.SUP="sup",e.TABLE="table",e.TBODY="tbody",e.TEMPLATE="template",e.TEXTAREA="textarea",e.TFOOT="tfoot",e.TD="td",e.TH="th",e.THEAD="thead",e.TITLE="title",e.TR="tr",e.TRACK="track",e.TT="tt",e.U="u",e.UL="ul",e.SVG="svg",e.VAR="var",e.WBR="wbr",e.XMP="xmp"})(I||(I={}));var p;(function(e){e[e.UNKNOWN=0]="UNKNOWN",e[e.A=1]="A",e[e.ADDRESS=2]="ADDRESS",e[e.ANNOTATION_XML=3]="ANNOTATION_XML",e[e.APPLET=4]="APPLET",e[e.AREA=5]="AREA",e[e.ARTICLE=6]="ARTICLE",e[e.ASIDE=7]="ASIDE",e[e.B=8]="B",e[e.BASE=9]="BASE",e[e.BASEFONT=10]="BASEFONT",e[e.BGSOUND=11]="BGSOUND",e[e.BIG=12]="BIG",e[e.BLOCKQUOTE=13]="BLOCKQUOTE",e[e.BODY=14]="BODY",e[e.BR=15]="BR",e[e.BUTTON=16]="BUTTON",e[e.CAPTION=17]="CAPTION",e[e.CENTER=18]="CENTER",e[e.CODE=19]="CODE",e[e.COL=20]="COL",e[e.COLGROUP=21]="COLGROUP",e[e.DD=22]="DD",e[e.DESC=23]="DESC",e[e.DETAILS=24]="DETAILS",e[e.DIALOG=25]="DIALOG",e[e.DIR=26]="DIR",e[e.DIV=27]="DIV",e[e.DL=28]="DL",e[e.DT=29]="DT",e[e.EM=30]="EM",e[e.EMBED=31]="EMBED",e[e.FIELDSET=32]="FIELDSET",e[e.FIGCAPTION=33]="FIGCAPTION",e[e.FIGURE=34]="FIGURE",e[e.FONT=35]="FONT",e[e.FOOTER=36]="FOOTER",e[e.FOREIGN_OBJECT=37]="FOREIGN_OBJECT",e[e.FORM=38]="FORM",e[e.FRAME=39]="FRAME",e[e.FRAMESET=40]="FRAMESET",e[e.H1=41]="H1",e[e.H2=42]="H2",e[e.H3=43]="H3",e[e.H4=44]="H4",e[e.H5=45]="H5",e[e.H6=46]="H6",e[e.HEAD=47]="HEAD",e[e.HEADER=48]="HEADER",e[e.HGROUP=49]="HGROUP",e[e.HR=50]="HR",e[e.HTML=51]="HTML",e[e.I=52]="I",e[e.IMG=53]="IMG",e[e.IMAGE=54]="IMAGE",e[e.INPUT=55]="INPUT",e[e.IFRAME=56]="IFRAME",e[e.KEYGEN=57]="KEYGEN",e[e.LABEL=58]="LABEL",e[e.LI=59]="LI",e[e.LINK=60]="LINK",e[e.LISTING=61]="LISTING",e[e.MAIN=62]="MAIN",e[e.MALIGNMARK=63]="MALIGNMARK",e[e.MARQUEE=64]="MARQUEE",e[e.MATH=65]="MATH",e[e.MENU=66]="MENU",e[e.META=67]="META",e[e.MGLYPH=68]="MGLYPH",e[e.MI=69]="MI",e[e.MO=70]="MO",e[e.MN=71]="MN",e[e.MS=72]="MS",e[e.MTEXT=73]="MTEXT",e[e.NAV=74]="NAV",e[e.NOBR=75]="NOBR",e[e.NOFRAMES=76]="NOFRAMES",e[e.NOEMBED=77]="NOEMBED",e[e.NOSCRIPT=78]="NOSCRIPT",e[e.OBJECT=79]="OBJECT",e[e.OL=80]="OL",e[e.OPTGROUP=81]="OPTGROUP",e[e.OPTION=82]="OPTION",e[e.P=83]="P",e[e.PARAM=84]="PARAM",e[e.PLAINTEXT=85]="PLAINTEXT",e[e.PRE=86]="PRE",e[e.RB=87]="RB",e[e.RP=88]="RP",e[e.RT=89]="RT",e[e.RTC=90]="RTC",e[e.RUBY=91]="RUBY",e[e.S=92]="S",e[e.SCRIPT=93]="SCRIPT",e[e.SEARCH=94]="SEARCH",e[e.SECTION=95]="SECTION",e[e.SELECT=96]="SELECT",e[e.SOURCE=97]="SOURCE",e[e.SMALL=98]="SMALL",e[e.SPAN=99]="SPAN",e[e.STRIKE=100]="STRIKE",e[e.STRONG=101]="STRONG",e[e.STYLE=102]="STYLE",e[e.SUB=103]="SUB",e[e.SUMMARY=104]="SUMMARY",e[e.SUP=105]="SUP",e[e.TABLE=106]="TABLE",e[e.TBODY=107]="TBODY",e[e.TEMPLATE=108]="TEMPLATE",e[e.TEXTAREA=109]="TEXTAREA",e[e.TFOOT=110]="TFOOT",e[e.TD=111]="TD",e[e.TH=112]="TH",e[e.THEAD=113]="THEAD",e[e.TITLE=114]="TITLE",e[e.TR=115]="TR",e[e.TRACK=116]="TRACK",e[e.TT=117]="TT",e[e.U=118]="U",e[e.UL=119]="UL",e[e.SVG=120]="SVG",e[e.VAR=121]="VAR",e[e.WBR=122]="WBR",e[e.XMP=123]="XMP"})(p||(p={}));var T8=new Map([[I.A,p.A],[I.ADDRESS,p.ADDRESS],[I.ANNOTATION_XML,p.ANNOTATION_XML],[I.APPLET,p.APPLET],[I.AREA,p.AREA],[I.ARTICLE,p.ARTICLE],[I.ASIDE,p.ASIDE],[I.B,p.B],[I.BASE,p.BASE],[I.BASEFONT,p.BASEFONT],[I.BGSOUND,p.BGSOUND],[I.BIG,p.BIG],[I.BLOCKQUOTE,p.BLOCKQUOTE],[I.BODY,p.BODY],[I.BR,p.BR],[I.BUTTON,p.BUTTON],[I.CAPTION,p.CAPTION],[I.CENTER,p.CENTER],[I.CODE,p.CODE],[I.COL,p.COL],[I.COLGROUP,p.COLGROUP],[I.DD,p.DD],[I.DESC,p.DESC],[I.DETAILS,p.DETAILS],[I.DIALOG,p.DIALOG],[I.DIR,p.DIR],[I.DIV,p.DIV],[I.DL,p.DL],[I.DT,p.DT],[I.EM,p.EM],[I.EMBED,p.EMBED],[I.FIELDSET,p.FIELDSET],[I.FIGCAPTION,p.FIGCAPTION],[I.FIGURE,p.FIGURE],[I.FONT,p.FONT],[I.FOOTER,p.FOOTER],[I.FOREIGN_OBJECT,p.FOREIGN_OBJECT],[I.FORM,p.FORM],[I.FRAME,p.FRAME],[I.FRAMESET,p.FRAMESET],[I.H1,p.H1],[I.H2,p.H2],[I.H3,p.H3],[I.H4,p.H4],[I.H5,p.H5],[I.H6,p.H6],[I.HEAD,p.HEAD],[I.HEADER,p.HEADER],[I.HGROUP,p.HGROUP],[I.HR,p.HR],[I.HTML,p.HTML],[I.I,p.I],[I.IMG,p.IMG],[I.IMAGE,p.IMAGE],[I.INPUT,p.INPUT],[I.IFRAME,p.IFRAME],[I.KEYGEN,p.KEYGEN],[I.LABEL,p.LABEL],[I.LI,p.LI],[I.LINK,p.LINK],[I.LISTING,p.LISTING],[I.MAIN,p.MAIN],[I.MALIGNMARK,p.MALIGNMARK],[I.MARQUEE,p.MARQUEE],[I.MATH,p.MATH],[I.MENU,p.MENU],[I.META,p.META],[I.MGLYPH,p.MGLYPH],[I.MI,p.MI],[I.MO,p.MO],[I.MN,p.MN],[I.MS,p.MS],[I.MTEXT,p.MTEXT],[I.NAV,p.NAV],[I.NOBR,p.NOBR],[I.NOFRAMES,p.NOFRAMES],[I.NOEMBED,p.NOEMBED],[I.NOSCRIPT,p.NOSCRIPT],[I.OBJECT,p.OBJECT],[I.OL,p.OL],[I.OPTGROUP,p.OPTGROUP],[I.OPTION,p.OPTION],[I.P,p.P],[I.PARAM,p.PARAM],[I.PLAINTEXT,p.PLAINTEXT],[I.PRE,p.PRE],[I.RB,p.RB],[I.RP,p.RP],[I.RT,p.RT],[I.RTC,p.RTC],[I.RUBY,p.RUBY],[I.S,p.S],[I.SCRIPT,p.SCRIPT],[I.SEARCH,p.SEARCH],[I.SECTION,p.SECTION],[I.SELECT,p.SELECT],[I.SOURCE,p.SOURCE],[I.SMALL,p.SMALL],[I.SPAN,p.SPAN],[I.STRIKE,p.STRIKE],[I.STRONG,p.STRONG],[I.STYLE,p.STYLE],[I.SUB,p.SUB],[I.SUMMARY,p.SUMMARY],[I.SUP,p.SUP],[I.TABLE,p.TABLE],[I.TBODY,p.TBODY],[I.TEMPLATE,p.TEMPLATE],[I.TEXTAREA,p.TEXTAREA],[I.TFOOT,p.TFOOT],[I.TD,p.TD],[I.TH,p.TH],[I.THEAD,p.THEAD],[I.TITLE,p.TITLE],[I.TR,p.TR],[I.TRACK,p.TRACK],[I.TT,p.TT],[I.U,p.U],[I.UL,p.UL],[I.SVG,p.SVG],[I.VAR,p.VAR],[I.WBR,p.WBR],[I.XMP,p.XMP]]);function La(e){var t;return(t=T8.get(e))!==null&&t!==void 0?t:p.UNKNOWN}var W=p,_E={[j.HTML]:new Set([W.ADDRESS,W.APPLET,W.AREA,W.ARTICLE,W.ASIDE,W.BASE,W.BASEFONT,W.BGSOUND,W.BLOCKQUOTE,W.BODY,W.BR,W.BUTTON,W.CAPTION,W.CENTER,W.COL,W.COLGROUP,W.DD,W.DETAILS,W.DIR,W.DIV,W.DL,W.DT,W.EMBED,W.FIELDSET,W.FIGCAPTION,W.FIGURE,W.FOOTER,W.FORM,W.FRAME,W.FRAMESET,W.H1,W.H2,W.H3,W.H4,W.H5,W.H6,W.HEAD,W.HEADER,W.HGROUP,W.HR,W.HTML,W.IFRAME,W.IMG,W.INPUT,W.LI,W.LINK,W.LISTING,W.MAIN,W.MARQUEE,W.MENU,W.META,W.NAV,W.NOEMBED,W.NOFRAMES,W.NOSCRIPT,W.OBJECT,W.OL,W.P,W.PARAM,W.PLAINTEXT,W.PRE,W.SCRIPT,W.SECTION,W.SELECT,W.SOURCE,W.STYLE,W.SUMMARY,W.TABLE,W.TBODY,W.TD,W.TEMPLATE,W.TEXTAREA,W.TFOOT,W.TH,W.THEAD,W.TITLE,W.TR,W.TRACK,W.UL,W.WBR,W.XMP]),[j.MATHML]:new Set([W.MI,W.MO,W.MN,W.MS,W.MTEXT,W.ANNOTATION_XML]),[j.SVG]:new Set([W.TITLE,W.FOREIGN_OBJECT,W.DESC]),[j.XLINK]:new Set,[j.XML]:new Set,[j.XMLNS]:new Set},ml=new Set([W.H1,W.H2,W.H3,W.H4,W.H5,W.H6]),S8=new Set([I.STYLE,I.SCRIPT,I.XMP,I.IFRAME,I.NOEMBED,I.NOFRAMES,I.PLAINTEXT]);function wv(e,t){return S8.has(e)||t&&e===I.NOSCRIPT}var C;(function(e){e[e.DATA=0]="DATA",e[e.RCDATA=1]="RCDATA",e[e.RAWTEXT=2]="RAWTEXT",e[e.SCRIPT_DATA=3]="SCRIPT_DATA",e[e.PLAINTEXT=4]="PLAINTEXT",e[e.TAG_OPEN=5]="TAG_OPEN",e[e.END_TAG_OPEN=6]="END_TAG_OPEN",e[e.TAG_NAME=7]="TAG_NAME",e[e.RCDATA_LESS_THAN_SIGN=8]="RCDATA_LESS_THAN_SIGN",e[e.RCDATA_END_TAG_OPEN=9]="RCDATA_END_TAG_OPEN",e[e.RCDATA_END_TAG_NAME=10]="RCDATA_END_TAG_NAME",e[e.RAWTEXT_LESS_THAN_SIGN=11]="RAWTEXT_LESS_THAN_SIGN",e[e.RAWTEXT_END_TAG_OPEN=12]="RAWTEXT_END_TAG_OPEN",e[e.RAWTEXT_END_TAG_NAME=13]="RAWTEXT_END_TAG_NAME",e[e.SCRIPT_DATA_LESS_THAN_SIGN=14]="SCRIPT_DATA_LESS_THAN_SIGN",e[e.SCRIPT_DATA_END_TAG_OPEN=15]="SCRIPT_DATA_END_TAG_OPEN",e[e.SCRIPT_DATA_END_TAG_NAME=16]="SCRIPT_DATA_END_TAG_NAME",e[e.SCRIPT_DATA_ESCAPE_START=17]="SCRIPT_DATA_ESCAPE_START",e[e.SCRIPT_DATA_ESCAPE_START_DASH=18]="SCRIPT_DATA_ESCAPE_START_DASH",e[e.SCRIPT_DATA_ESCAPED=19]="SCRIPT_DATA_ESCAPED",e[e.SCRIPT_DATA_ESCAPED_DASH=20]="SCRIPT_DATA_ESCAPED_DASH",e[e.SCRIPT_DATA_ESCAPED_DASH_DASH=21]="SCRIPT_DATA_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN=22]="SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_OPEN=23]="SCRIPT_DATA_ESCAPED_END_TAG_OPEN",e[e.SCRIPT_DATA_ESCAPED_END_TAG_NAME=24]="SCRIPT_DATA_ESCAPED_END_TAG_NAME",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_START=25]="SCRIPT_DATA_DOUBLE_ESCAPE_START",e[e.SCRIPT_DATA_DOUBLE_ESCAPED=26]="SCRIPT_DATA_DOUBLE_ESCAPED",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH=27]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH=28]="SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH",e[e.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN=29]="SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN",e[e.SCRIPT_DATA_DOUBLE_ESCAPE_END=30]="SCRIPT_DATA_DOUBLE_ESCAPE_END",e[e.BEFORE_ATTRIBUTE_NAME=31]="BEFORE_ATTRIBUTE_NAME",e[e.ATTRIBUTE_NAME=32]="ATTRIBUTE_NAME",e[e.AFTER_ATTRIBUTE_NAME=33]="AFTER_ATTRIBUTE_NAME",e[e.BEFORE_ATTRIBUTE_VALUE=34]="BEFORE_ATTRIBUTE_VALUE",e[e.ATTRIBUTE_VALUE_DOUBLE_QUOTED=35]="ATTRIBUTE_VALUE_DOUBLE_QUOTED",e[e.ATTRIBUTE_VALUE_SINGLE_QUOTED=36]="ATTRIBUTE_VALUE_SINGLE_QUOTED",e[e.ATTRIBUTE_VALUE_UNQUOTED=37]="ATTRIBUTE_VALUE_UNQUOTED",e[e.AFTER_ATTRIBUTE_VALUE_QUOTED=38]="AFTER_ATTRIBUTE_VALUE_QUOTED",e[e.SELF_CLOSING_START_TAG=39]="SELF_CLOSING_START_TAG",e[e.BOGUS_COMMENT=40]="BOGUS_COMMENT",e[e.MARKUP_DECLARATION_OPEN=41]="MARKUP_DECLARATION_OPEN",e[e.COMMENT_START=42]="COMMENT_START",e[e.COMMENT_START_DASH=43]="COMMENT_START_DASH",e[e.COMMENT=44]="COMMENT",e[e.COMMENT_LESS_THAN_SIGN=45]="COMMENT_LESS_THAN_SIGN",e[e.COMMENT_LESS_THAN_SIGN_BANG=46]="COMMENT_LESS_THAN_SIGN_BANG",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH=47]="COMMENT_LESS_THAN_SIGN_BANG_DASH",e[e.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH=48]="COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH",e[e.COMMENT_END_DASH=49]="COMMENT_END_DASH",e[e.COMMENT_END=50]="COMMENT_END",e[e.COMMENT_END_BANG=51]="COMMENT_END_BANG",e[e.DOCTYPE=52]="DOCTYPE",e[e.BEFORE_DOCTYPE_NAME=53]="BEFORE_DOCTYPE_NAME",e[e.DOCTYPE_NAME=54]="DOCTYPE_NAME",e[e.AFTER_DOCTYPE_NAME=55]="AFTER_DOCTYPE_NAME",e[e.AFTER_DOCTYPE_PUBLIC_KEYWORD=56]="AFTER_DOCTYPE_PUBLIC_KEYWORD",e[e.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER=57]="BEFORE_DOCTYPE_PUBLIC_IDENTIFIER",e[e.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED=58]="DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED=59]="DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_PUBLIC_IDENTIFIER=60]="AFTER_DOCTYPE_PUBLIC_IDENTIFIER",e[e.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS=61]="BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS",e[e.AFTER_DOCTYPE_SYSTEM_KEYWORD=62]="AFTER_DOCTYPE_SYSTEM_KEYWORD",e[e.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER=63]="BEFORE_DOCTYPE_SYSTEM_IDENTIFIER",e[e.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED=64]="DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED",e[e.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED=65]="DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED",e[e.AFTER_DOCTYPE_SYSTEM_IDENTIFIER=66]="AFTER_DOCTYPE_SYSTEM_IDENTIFIER",e[e.BOGUS_DOCTYPE=67]="BOGUS_DOCTYPE",e[e.CDATA_SECTION=68]="CDATA_SECTION",e[e.CDATA_SECTION_BRACKET=69]="CDATA_SECTION_BRACKET",e[e.CDATA_SECTION_END=70]="CDATA_SECTION_END",e[e.CHARACTER_REFERENCE=71]="CHARACTER_REFERENCE",e[e.AMBIGUOUS_AMPERSAND=72]="AMBIGUOUS_AMPERSAND"})(C||(C={}));var ft={DATA:C.DATA,RCDATA:C.RCDATA,RAWTEXT:C.RAWTEXT,SCRIPT_DATA:C.SCRIPT_DATA,PLAINTEXT:C.PLAINTEXT,CDATA_SECTION:C.CDATA_SECTION};function _8(e){return e>=_.DIGIT_0&&e<=_.DIGIT_9}function hc(e){return e>=_.LATIN_CAPITAL_A&&e<=_.LATIN_CAPITAL_Z}function x8(e){return e>=_.LATIN_SMALL_A&&e<=_.LATIN_SMALL_Z}function Ba(e){return x8(e)||hc(e)}function Mv(e){return Ba(e)||_8(e)}function Rh(e){return e+32}function Rv(e){return e===_.SPACE||e===_.LINE_FEED||e===_.TABULATION||e===_.FORM_FEED}function Ov(e){return Rv(e)||e===_.SOLIDUS||e===_.GREATER_THAN_SIGN}function A8(e){return e===_.NULL?U.nullCharacterReference:e>1114111?U.characterReferenceOutsideUnicodeRange:Nh(e)?U.surrogateCharacterReference:kh(e)?U.noncharacterCharacterReference:vh(e)||e===_.CARRIAGE_RETURN?U.controlCharacterReference:null}var pc=class{constructor(t,n){this.options=t,this.handler=n,this.paused=!1,this.inLoop=!1,this.inForeignNode=!1,this.lastStartTagName="",this.active=!1,this.state=C.DATA,this.returnState=C.DATA,this.entityStartPos=0,this.consumedAfterSnapshot=-1,this.currentCharacterToken=null,this.currentToken=null,this.currentAttr={name:"",value:""},this.preprocessor=new wh(n),this.currentLocation=this.getCurrentLocation(-1),this.entityDecoder=new Oh(Mh,(r,i)=>{this.preprocessor.pos=this.entityStartPos+i-1,this._flushCodePointConsumedAsCharacterReference(r)},n.onParseError?{missingSemicolonAfterCharacterReference:()=>{this._err(U.missingSemicolonAfterCharacterReference,1)},absenceOfDigitsInNumericCharacterReference:r=>{this._err(U.absenceOfDigitsInNumericCharacterReference,this.entityStartPos-this.preprocessor.pos+r)},validateNumericCharacterReference:r=>{let i=A8(r);i&&this._err(i,1)}}:void 0)}_err(t,n=0){var r,i;(i=(r=this.handler).onParseError)===null||i===void 0||i.call(r,this.preprocessor.getError(t,n))}getCurrentLocation(t){return this.options.sourceCodeLocationInfo?{startLine:this.preprocessor.line,startCol:this.preprocessor.col-t,startOffset:this.preprocessor.offset-t,endLine:-1,endCol:-1,endOffset:-1}:null}_runParsingLoop(){if(!this.inLoop){for(this.inLoop=!0;this.active&&!this.paused;){this.consumedAfterSnapshot=0;let t=this._consume();this._ensureHibernation()||this._callState(t)}this.inLoop=!1}}pause(){this.paused=!0}resume(t){if(!this.paused)throw new Error("Parser was already resumed");this.paused=!1,!this.inLoop&&(this._runParsingLoop(),this.paused||t?.())}write(t,n,r){this.active=!0,this.preprocessor.write(t,n),this._runParsingLoop(),this.paused||r?.()}insertHtmlAtCurrentPos(t){this.active=!0,this.preprocessor.insertHtmlAtCurrentPos(t),this._runParsingLoop()}_ensureHibernation(){return this.preprocessor.endOfChunkHit?(this.preprocessor.retreat(this.consumedAfterSnapshot),this.consumedAfterSnapshot=0,this.active=!1,!0):!1}_consume(){return this.consumedAfterSnapshot++,this.preprocessor.advance()}_advanceBy(t){this.consumedAfterSnapshot+=t;for(let n=0;n0&&this._err(U.endTagWithAttributes),t.selfClosing&&this._err(U.endTagWithTrailingSolidus),this.handler.onEndTag(t)),this.preprocessor.dropParsedChunk()}emitCurrentComment(t){this.prepareToken(t),this.handler.onComment(t),this.preprocessor.dropParsedChunk()}emitCurrentDoctype(t){this.prepareToken(t),this.handler.onDoctype(t),this.preprocessor.dropParsedChunk()}_emitCurrentCharacterToken(t){if(this.currentCharacterToken){switch(t&&this.currentCharacterToken.location&&(this.currentCharacterToken.location.endLine=t.startLine,this.currentCharacterToken.location.endCol=t.startCol,this.currentCharacterToken.location.endOffset=t.startOffset),this.currentCharacterToken.type){case Oe.CHARACTER:{this.handler.onCharacter(this.currentCharacterToken);break}case Oe.NULL_CHARACTER:{this.handler.onNullCharacter(this.currentCharacterToken);break}case Oe.WHITESPACE_CHARACTER:{this.handler.onWhitespaceCharacter(this.currentCharacterToken);break}}this.currentCharacterToken=null}}_emitEOFToken(){let t=this.getCurrentLocation(0);t&&(t.endLine=t.startLine,t.endCol=t.startCol,t.endOffset=t.startOffset),this._emitCurrentCharacterToken(t),this.handler.onEof({type:Oe.EOF,location:t}),this.active=!1}_appendCharToCurrentCharacterToken(t,n){if(this.currentCharacterToken)if(this.currentCharacterToken.type===t){this.currentCharacterToken.chars+=n;return}else this.currentLocation=this.getCurrentLocation(0),this._emitCurrentCharacterToken(this.currentLocation),this.preprocessor.dropParsedChunk();this._createCharacterToken(t,n)}_emitCodePoint(t){let n=Rv(t)?Oe.WHITESPACE_CHARACTER:t===_.NULL?Oe.NULL_CHARACTER:Oe.CHARACTER;this._appendCharToCurrentCharacterToken(n,String.fromCodePoint(t))}_emitChars(t){this._appendCharToCurrentCharacterToken(Oe.CHARACTER,t)}_startCharacterReference(){this.returnState=this.state,this.state=C.CHARACTER_REFERENCE,this.entityStartPos=this.preprocessor.pos,this.entityDecoder.startEntity(this._isCharacterReferenceInAttribute()?Qr.Attribute:Qr.Legacy)}_isCharacterReferenceInAttribute(){return this.returnState===C.ATTRIBUTE_VALUE_DOUBLE_QUOTED||this.returnState===C.ATTRIBUTE_VALUE_SINGLE_QUOTED||this.returnState===C.ATTRIBUTE_VALUE_UNQUOTED}_flushCodePointConsumedAsCharacterReference(t){this._isCharacterReferenceInAttribute()?this.currentAttr.value+=String.fromCodePoint(t):this._emitCodePoint(t)}_callState(t){switch(this.state){case C.DATA:{this._stateData(t);break}case C.RCDATA:{this._stateRcdata(t);break}case C.RAWTEXT:{this._stateRawtext(t);break}case C.SCRIPT_DATA:{this._stateScriptData(t);break}case C.PLAINTEXT:{this._statePlaintext(t);break}case C.TAG_OPEN:{this._stateTagOpen(t);break}case C.END_TAG_OPEN:{this._stateEndTagOpen(t);break}case C.TAG_NAME:{this._stateTagName(t);break}case C.RCDATA_LESS_THAN_SIGN:{this._stateRcdataLessThanSign(t);break}case C.RCDATA_END_TAG_OPEN:{this._stateRcdataEndTagOpen(t);break}case C.RCDATA_END_TAG_NAME:{this._stateRcdataEndTagName(t);break}case C.RAWTEXT_LESS_THAN_SIGN:{this._stateRawtextLessThanSign(t);break}case C.RAWTEXT_END_TAG_OPEN:{this._stateRawtextEndTagOpen(t);break}case C.RAWTEXT_END_TAG_NAME:{this._stateRawtextEndTagName(t);break}case C.SCRIPT_DATA_LESS_THAN_SIGN:{this._stateScriptDataLessThanSign(t);break}case C.SCRIPT_DATA_END_TAG_OPEN:{this._stateScriptDataEndTagOpen(t);break}case C.SCRIPT_DATA_END_TAG_NAME:{this._stateScriptDataEndTagName(t);break}case C.SCRIPT_DATA_ESCAPE_START:{this._stateScriptDataEscapeStart(t);break}case C.SCRIPT_DATA_ESCAPE_START_DASH:{this._stateScriptDataEscapeStartDash(t);break}case C.SCRIPT_DATA_ESCAPED:{this._stateScriptDataEscaped(t);break}case C.SCRIPT_DATA_ESCAPED_DASH:{this._stateScriptDataEscapedDash(t);break}case C.SCRIPT_DATA_ESCAPED_DASH_DASH:{this._stateScriptDataEscapedDashDash(t);break}case C.SCRIPT_DATA_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataEscapedLessThanSign(t);break}case C.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:{this._stateScriptDataEscapedEndTagOpen(t);break}case C.SCRIPT_DATA_ESCAPED_END_TAG_NAME:{this._stateScriptDataEscapedEndTagName(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPE_START:{this._stateScriptDataDoubleEscapeStart(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED:{this._stateScriptDataDoubleEscaped(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED_DASH:{this._stateScriptDataDoubleEscapedDash(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED_DASH_DASH:{this._stateScriptDataDoubleEscapedDashDash(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPED_LESS_THAN_SIGN:{this._stateScriptDataDoubleEscapedLessThanSign(t);break}case C.SCRIPT_DATA_DOUBLE_ESCAPE_END:{this._stateScriptDataDoubleEscapeEnd(t);break}case C.BEFORE_ATTRIBUTE_NAME:{this._stateBeforeAttributeName(t);break}case C.ATTRIBUTE_NAME:{this._stateAttributeName(t);break}case C.AFTER_ATTRIBUTE_NAME:{this._stateAfterAttributeName(t);break}case C.BEFORE_ATTRIBUTE_VALUE:{this._stateBeforeAttributeValue(t);break}case C.ATTRIBUTE_VALUE_DOUBLE_QUOTED:{this._stateAttributeValueDoubleQuoted(t);break}case C.ATTRIBUTE_VALUE_SINGLE_QUOTED:{this._stateAttributeValueSingleQuoted(t);break}case C.ATTRIBUTE_VALUE_UNQUOTED:{this._stateAttributeValueUnquoted(t);break}case C.AFTER_ATTRIBUTE_VALUE_QUOTED:{this._stateAfterAttributeValueQuoted(t);break}case C.SELF_CLOSING_START_TAG:{this._stateSelfClosingStartTag(t);break}case C.BOGUS_COMMENT:{this._stateBogusComment(t);break}case C.MARKUP_DECLARATION_OPEN:{this._stateMarkupDeclarationOpen(t);break}case C.COMMENT_START:{this._stateCommentStart(t);break}case C.COMMENT_START_DASH:{this._stateCommentStartDash(t);break}case C.COMMENT:{this._stateComment(t);break}case C.COMMENT_LESS_THAN_SIGN:{this._stateCommentLessThanSign(t);break}case C.COMMENT_LESS_THAN_SIGN_BANG:{this._stateCommentLessThanSignBang(t);break}case C.COMMENT_LESS_THAN_SIGN_BANG_DASH:{this._stateCommentLessThanSignBangDash(t);break}case C.COMMENT_LESS_THAN_SIGN_BANG_DASH_DASH:{this._stateCommentLessThanSignBangDashDash(t);break}case C.COMMENT_END_DASH:{this._stateCommentEndDash(t);break}case C.COMMENT_END:{this._stateCommentEnd(t);break}case C.COMMENT_END_BANG:{this._stateCommentEndBang(t);break}case C.DOCTYPE:{this._stateDoctype(t);break}case C.BEFORE_DOCTYPE_NAME:{this._stateBeforeDoctypeName(t);break}case C.DOCTYPE_NAME:{this._stateDoctypeName(t);break}case C.AFTER_DOCTYPE_NAME:{this._stateAfterDoctypeName(t);break}case C.AFTER_DOCTYPE_PUBLIC_KEYWORD:{this._stateAfterDoctypePublicKeyword(t);break}case C.BEFORE_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateBeforeDoctypePublicIdentifier(t);break}case C.DOCTYPE_PUBLIC_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypePublicIdentifierDoubleQuoted(t);break}case C.DOCTYPE_PUBLIC_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypePublicIdentifierSingleQuoted(t);break}case C.AFTER_DOCTYPE_PUBLIC_IDENTIFIER:{this._stateAfterDoctypePublicIdentifier(t);break}case C.BETWEEN_DOCTYPE_PUBLIC_AND_SYSTEM_IDENTIFIERS:{this._stateBetweenDoctypePublicAndSystemIdentifiers(t);break}case C.AFTER_DOCTYPE_SYSTEM_KEYWORD:{this._stateAfterDoctypeSystemKeyword(t);break}case C.BEFORE_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateBeforeDoctypeSystemIdentifier(t);break}case C.DOCTYPE_SYSTEM_IDENTIFIER_DOUBLE_QUOTED:{this._stateDoctypeSystemIdentifierDoubleQuoted(t);break}case C.DOCTYPE_SYSTEM_IDENTIFIER_SINGLE_QUOTED:{this._stateDoctypeSystemIdentifierSingleQuoted(t);break}case C.AFTER_DOCTYPE_SYSTEM_IDENTIFIER:{this._stateAfterDoctypeSystemIdentifier(t);break}case C.BOGUS_DOCTYPE:{this._stateBogusDoctype(t);break}case C.CDATA_SECTION:{this._stateCdataSection(t);break}case C.CDATA_SECTION_BRACKET:{this._stateCdataSectionBracket(t);break}case C.CDATA_SECTION_END:{this._stateCdataSectionEnd(t);break}case C.CHARACTER_REFERENCE:{this._stateCharacterReference();break}case C.AMBIGUOUS_AMPERSAND:{this._stateAmbiguousAmpersand(t);break}default:throw new Error("Unknown state")}}_stateData(t){switch(t){case _.LESS_THAN_SIGN:{this.state=C.TAG_OPEN;break}case _.AMPERSAND:{this._startCharacterReference();break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitCodePoint(t);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRcdata(t){switch(t){case _.AMPERSAND:{this._startCharacterReference();break}case _.LESS_THAN_SIGN:{this.state=C.RCDATA_LESS_THAN_SIGN;break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateRawtext(t){switch(t){case _.LESS_THAN_SIGN:{this.state=C.RAWTEXT_LESS_THAN_SIGN;break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateScriptData(t){switch(t){case _.LESS_THAN_SIGN:{this.state=C.SCRIPT_DATA_LESS_THAN_SIGN;break}case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_statePlaintext(t){switch(t){case _.NULL:{this._err(U.unexpectedNullCharacter),this._emitChars(Qe);break}case _.EOF:{this._emitEOFToken();break}default:this._emitCodePoint(t)}}_stateTagOpen(t){if(Ba(t))this._createStartTagToken(),this.state=C.TAG_NAME,this._stateTagName(t);else switch(t){case _.EXCLAMATION_MARK:{this.state=C.MARKUP_DECLARATION_OPEN;break}case _.SOLIDUS:{this.state=C.END_TAG_OPEN;break}case _.QUESTION_MARK:{this._err(U.unexpectedQuestionMarkInsteadOfTagName),this._createCommentToken(1),this.state=C.BOGUS_COMMENT,this._stateBogusComment(t);break}case _.EOF:{this._err(U.eofBeforeTagName),this._emitChars("<"),this._emitEOFToken();break}default:this._err(U.invalidFirstCharacterOfTagName),this._emitChars("<"),this.state=C.DATA,this._stateData(t)}}_stateEndTagOpen(t){if(Ba(t))this._createEndTagToken(),this.state=C.TAG_NAME,this._stateTagName(t);else switch(t){case _.GREATER_THAN_SIGN:{this._err(U.missingEndTagName),this.state=C.DATA;break}case _.EOF:{this._err(U.eofBeforeTagName),this._emitChars("");break}case _.NULL:{this._err(U.unexpectedNullCharacter),this.state=C.SCRIPT_DATA_ESCAPED,this._emitChars(Qe);break}case _.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=C.SCRIPT_DATA_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataEscapedLessThanSign(t){t===_.SOLIDUS?this.state=C.SCRIPT_DATA_ESCAPED_END_TAG_OPEN:Ba(t)?(this._emitChars("<"),this.state=C.SCRIPT_DATA_DOUBLE_ESCAPE_START,this._stateScriptDataDoubleEscapeStart(t)):(this._emitChars("<"),this.state=C.SCRIPT_DATA_ESCAPED,this._stateScriptDataEscaped(t))}_stateScriptDataEscapedEndTagOpen(t){Ba(t)?(this.state=C.SCRIPT_DATA_ESCAPED_END_TAG_NAME,this._stateScriptDataEscapedEndTagName(t)):(this._emitChars("");break}case _.NULL:{this._err(U.unexpectedNullCharacter),this.state=C.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitChars(Qe);break}case _.EOF:{this._err(U.eofInScriptHtmlCommentLikeText),this._emitEOFToken();break}default:this.state=C.SCRIPT_DATA_DOUBLE_ESCAPED,this._emitCodePoint(t)}}_stateScriptDataDoubleEscapedLessThanSign(t){t===_.SOLIDUS?(this.state=C.SCRIPT_DATA_DOUBLE_ESCAPE_END,this._emitChars("/")):(this.state=C.SCRIPT_DATA_DOUBLE_ESCAPED,this._stateScriptDataDoubleEscaped(t))}_stateScriptDataDoubleEscapeEnd(t){if(this.preprocessor.startsWith(xn.SCRIPT,!1)&&Ov(this.preprocessor.peek(xn.SCRIPT.length))){this._emitCodePoint(t);for(let n=0;n0&&this._isInTemplate()&&this.tmplCount--,this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!0)}replace(t,n){let r=this._indexOf(t);this.items[r]=n,r===this.stackTop&&(this.current=n)}insertAfter(t,n,r){let i=this._indexOf(t)+1;this.items.splice(i,0,n),this.tagIDs.splice(i,0,r),this.stackTop++,i===this.stackTop&&this._updateCurrentElement(),this.current&&this.currentTagId!==void 0&&this.handler.onItemPush(this.current,this.currentTagId,i===this.stackTop)}popUntilTagNamePopped(t){let n=this.stackTop+1;do n=this.tagIDs.lastIndexOf(t,n-1);while(n>0&&this.treeAdapter.getNamespaceURI(this.items[n])!==j.HTML);this.shortenToLength(Math.max(n,0))}shortenToLength(t){for(;this.stackTop>=t;){let n=this.current;this.tmplCount>0&&this._isInTemplate()&&(this.tmplCount-=1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(n,this.stackTop=0;r--)if(t.has(this.tagIDs[r])&&this.treeAdapter.getNamespaceURI(this.items[r])===n)return r;return-1}clearBackTo(t,n){let r=this._indexOfTagNames(t,n);this.shortenToLength(r+1)}clearBackToTableContext(){this.clearBackTo(w8,j.HTML)}clearBackToTableBodyContext(){this.clearBackTo(k8,j.HTML)}clearBackToTableRowContext(){this.clearBackTo(v8,j.HTML)}remove(t){let n=this._indexOf(t);n>=0&&(n===this.stackTop?this.pop():(this.items.splice(n,1),this.tagIDs.splice(n,1),this.stackTop--,this._updateCurrentElement(),this.handler.onItemPop(t,!1)))}tryPeekProperlyNestedBodyElement(){return this.stackTop>=1&&this.tagIDs[1]===p.BODY?this.items[1]:null}contains(t){return this._indexOf(t)>-1}getCommonAncestor(t){let n=this._indexOf(t)-1;return n>=0?this.items[n]:null}isRootHtmlElementCurrent(){return this.stackTop===0&&this.tagIDs[0]===p.HTML}hasInDynamicScope(t,n){for(let r=this.stackTop;r>=0;r--){let i=this.tagIDs[r];switch(this.treeAdapter.getNamespaceURI(this.items[r])){case j.HTML:{if(i===t)return!0;if(n.has(i))return!1;break}case j.SVG:{if(Lv.has(i))return!1;break}case j.MATHML:{if(Iv.has(i))return!1;break}}}return!0}hasInScope(t){return this.hasInDynamicScope(t,Dh)}hasInListItemScope(t){return this.hasInDynamicScope(t,C8)}hasInButtonScope(t){return this.hasInDynamicScope(t,N8)}hasNumberedHeaderInScope(){for(let t=this.stackTop;t>=0;t--){let n=this.tagIDs[t];switch(this.treeAdapter.getNamespaceURI(this.items[t])){case j.HTML:{if(ml.has(n))return!0;if(Dh.has(n))return!1;break}case j.SVG:{if(Lv.has(n))return!1;break}case j.MATHML:{if(Iv.has(n))return!1;break}}}return!0}hasInTableScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===j.HTML)switch(this.tagIDs[n]){case t:return!0;case p.TABLE:case p.HTML:return!1}return!0}hasTableBodyContextInTableScope(){for(let t=this.stackTop;t>=0;t--)if(this.treeAdapter.getNamespaceURI(this.items[t])===j.HTML)switch(this.tagIDs[t]){case p.TBODY:case p.THEAD:case p.TFOOT:return!0;case p.TABLE:case p.HTML:return!1}return!0}hasInSelectScope(t){for(let n=this.stackTop;n>=0;n--)if(this.treeAdapter.getNamespaceURI(this.items[n])===j.HTML)switch(this.tagIDs[n]){case t:return!0;case p.OPTION:case p.OPTGROUP:break;default:return!1}return!0}generateImpliedEndTags(){for(;this.currentTagId!==void 0&&Bv.has(this.currentTagId);)this.pop()}generateImpliedEndTagsThoroughly(){for(;this.currentTagId!==void 0&&Dv.has(this.currentTagId);)this.pop()}generateImpliedEndTagsWithExclusion(t){for(;this.currentTagId!==void 0&&this.currentTagId!==t&&Dv.has(this.currentTagId);)this.pop()}};var Lr;(function(e){e[e.Marker=0]="Marker",e[e.Element=1]="Element"})(Lr||(Lr={}));var Pv={type:Lr.Marker},Lh=class{constructor(t){this.treeAdapter=t,this.entries=[],this.bookmark=null}_getNoahArkConditionCandidates(t,n){let r=[],i=n.length,a=this.treeAdapter.getTagName(t),o=this.treeAdapter.getNamespaceURI(t);for(let s=0;s[o.name,o.value])),a=0;for(let o=0;oi.get(l.name)===l.value)&&(a+=1,a>=3&&this.entries.splice(s.idx,1))}}insertMarker(){this.entries.unshift(Pv)}pushElement(t,n){this._ensureNoahArkCondition(t),this.entries.unshift({type:Lr.Element,element:t,token:n})}insertElementAfterBookmark(t,n){let r=this.entries.indexOf(this.bookmark);this.entries.splice(r,0,{type:Lr.Element,element:t,token:n})}removeEntry(t){let n=this.entries.indexOf(t);n!==-1&&this.entries.splice(n,1)}clearToLastMarker(){let t=this.entries.indexOf(Pv);t===-1?this.entries.length=0:this.entries.splice(0,t+1)}getElementEntryInScopeWithTagName(t){let n=this.entries.find(r=>r.type===Lr.Marker||this.treeAdapter.getTagName(r.element)===t);return n&&n.type===Lr.Element?n:null}getElementEntry(t){return this.entries.find(n=>n.type===Lr.Element&&n.element===t)}};var Br={createDocument(){return{nodeName:"#document",mode:fn.NO_QUIRKS,childNodes:[]}},createDocumentFragment(){return{nodeName:"#document-fragment",childNodes:[]}},createElement(e,t,n){return{nodeName:e,tagName:e,attrs:n,namespaceURI:t,childNodes:[],parentNode:null}},createCommentNode(e){return{nodeName:"#comment",data:e,parentNode:null}},createTextNode(e){return{nodeName:"#text",value:e,parentNode:null}},appendChild(e,t){e.childNodes.push(t),t.parentNode=e},insertBefore(e,t,n){let r=e.childNodes.indexOf(n);e.childNodes.splice(r,0,t),t.parentNode=e},setTemplateContent(e,t){e.content=t},getTemplateContent(e){return e.content},setDocumentType(e,t,n,r){let i=e.childNodes.find(a=>a.nodeName==="#documentType");if(i)i.name=t,i.publicId=n,i.systemId=r;else{let a={nodeName:"#documentType",name:t,publicId:n,systemId:r,parentNode:null};Br.appendChild(e,a)}},setDocumentMode(e,t){e.mode=t},getDocumentMode(e){return e.mode},detachNode(e){if(e.parentNode){let t=e.parentNode.childNodes.indexOf(e);e.parentNode.childNodes.splice(t,1),e.parentNode=null}},insertText(e,t){if(e.childNodes.length>0){let n=e.childNodes[e.childNodes.length-1];if(Br.isTextNode(n)){n.value+=t;return}}Br.appendChild(e,Br.createTextNode(t))},insertTextBefore(e,t,n){let r=e.childNodes[e.childNodes.indexOf(n)-1];r&&Br.isTextNode(r)?r.value+=t:Br.insertBefore(e,Br.createTextNode(t),n)},adoptAttributes(e,t){let n=new Set(e.attrs.map(r=>r.name));for(let r=0;re.startsWith(n))}function qv(e){return e.name===Hv&&e.publicId===null&&(e.systemId===null||e.systemId===O8)}function Vv(e){if(e.name!==Hv)return fn.QUIRKS;let{systemId:t}=e;if(t&&t.toLowerCase()===R8)return fn.QUIRKS;let{publicId:n}=e;if(n!==null){if(n=n.toLowerCase(),I8.has(n))return fn.QUIRKS;let r=t===null?D8:zv;if(Uv(n,r))return fn.QUIRKS;if(r=t===null?Fv:L8,Uv(n,r))return fn.LIMITED_QUIRKS}return fn.NO_QUIRKS}var Gv={TEXT_HTML:"text/html",APPLICATION_XML:"application/xhtml+xml"},P8="definitionurl",U8="definitionURL",H8=new Map(["attributeName","attributeType","baseFrequency","baseProfile","calcMode","clipPathUnits","diffuseConstant","edgeMode","filterUnits","glyphRef","gradientTransform","gradientUnits","kernelMatrix","kernelUnitLength","keyPoints","keySplines","keyTimes","lengthAdjust","limitingConeAngle","markerHeight","markerUnits","markerWidth","maskContentUnits","maskUnits","numOctaves","pathLength","patternContentUnits","patternTransform","patternUnits","pointsAtX","pointsAtY","pointsAtZ","preserveAlpha","preserveAspectRatio","primitiveUnits","refX","refY","repeatCount","repeatDur","requiredExtensions","requiredFeatures","specularConstant","specularExponent","spreadMethod","startOffset","stdDeviation","stitchTiles","surfaceScale","systemLanguage","tableValues","targetX","targetY","textLength","viewBox","viewTarget","xChannelSelector","yChannelSelector","zoomAndPan"].map(e=>[e.toLowerCase(),e])),z8=new Map([["xlink:actuate",{prefix:"xlink",name:"actuate",namespace:j.XLINK}],["xlink:arcrole",{prefix:"xlink",name:"arcrole",namespace:j.XLINK}],["xlink:href",{prefix:"xlink",name:"href",namespace:j.XLINK}],["xlink:role",{prefix:"xlink",name:"role",namespace:j.XLINK}],["xlink:show",{prefix:"xlink",name:"show",namespace:j.XLINK}],["xlink:title",{prefix:"xlink",name:"title",namespace:j.XLINK}],["xlink:type",{prefix:"xlink",name:"type",namespace:j.XLINK}],["xml:lang",{prefix:"xml",name:"lang",namespace:j.XML}],["xml:space",{prefix:"xml",name:"space",namespace:j.XML}],["xmlns",{prefix:"",name:"xmlns",namespace:j.XMLNS}],["xmlns:xlink",{prefix:"xmlns",name:"xlink",namespace:j.XMLNS}]]),F8=new Map(["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","textPath"].map(e=>[e.toLowerCase(),e])),q8=new Set([p.B,p.BIG,p.BLOCKQUOTE,p.BODY,p.BR,p.CENTER,p.CODE,p.DD,p.DIV,p.DL,p.DT,p.EM,p.EMBED,p.H1,p.H2,p.H3,p.H4,p.H5,p.H6,p.HEAD,p.HR,p.I,p.IMG,p.LI,p.LISTING,p.MENU,p.META,p.NOBR,p.OL,p.P,p.PRE,p.RUBY,p.S,p.SMALL,p.SPAN,p.STRONG,p.STRIKE,p.SUB,p.SUP,p.TABLE,p.TT,p.U,p.UL,p.VAR]);function Yv(e){let t=e.tagID;return t===p.FONT&&e.attrs.some(({name:r})=>r===Zr.COLOR||r===Zr.SIZE||r===Zr.FACE)||q8.has(t)}function xE(e){for(let t=0;t0&&this._setContextModes(t,n)}onItemPop(t,n){var r,i;if(this.options.sourceCodeLocationInfo&&this._setEndLocation(t,this.currentToken),(i=(r=this.treeAdapter).onItemPop)===null||i===void 0||i.call(r,t,this.openElements.current),n){let a,o;this.openElements.stackTop===0&&this.fragmentContext?(a=this.fragmentContext,o=this.fragmentContextID):{current:a,currentTagId:o}=this.openElements,this._setContextModes(a,o)}}_setContextModes(t,n){let r=t===this.document||t&&this.treeAdapter.getNamespaceURI(t)===j.HTML;this.currentNotInHTML=!r,this.tokenizer.inForeignNode=!r&&t!==void 0&&n!==void 0&&!this._isIntegrationPoint(n,t)}_switchToTextParsing(t,n){this._insertElement(t,j.HTML),this.tokenizer.state=n,this.originalInsertionMode=this.insertionMode,this.insertionMode=w.TEXT}switchToPlaintextParsing(){this.insertionMode=w.TEXT,this.originalInsertionMode=w.IN_BODY,this.tokenizer.state=ft.PLAINTEXT}_getAdjustedCurrentElement(){return this.openElements.stackTop===0&&this.fragmentContext?this.fragmentContext:this.openElements.current}_findFormInFragmentContext(){let t=this.fragmentContext;for(;t;){if(this.treeAdapter.getTagName(t)===I.FORM){this.formElement=t;break}t=this.treeAdapter.getParentNode(t)}}_initTokenizerForFragmentParsing(){if(!(!this.fragmentContext||this.treeAdapter.getNamespaceURI(this.fragmentContext)!==j.HTML))switch(this.fragmentContextID){case p.TITLE:case p.TEXTAREA:{this.tokenizer.state=ft.RCDATA;break}case p.STYLE:case p.XMP:case p.IFRAME:case p.NOEMBED:case p.NOFRAMES:case p.NOSCRIPT:{this.tokenizer.state=ft.RAWTEXT;break}case p.SCRIPT:{this.tokenizer.state=ft.SCRIPT_DATA;break}case p.PLAINTEXT:{this.tokenizer.state=ft.PLAINTEXT;break}default:}}_setDocumentType(t){let n=t.name||"",r=t.publicId||"",i=t.systemId||"";if(this.treeAdapter.setDocumentType(this.document,n,r,i),t.location){let o=this.treeAdapter.getChildNodes(this.document).find(s=>this.treeAdapter.isDocumentTypeNode(s));o&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}}_attachElementToTree(t,n){if(this.options.sourceCodeLocationInfo){let r=n&&{...n,startTag:n};this.treeAdapter.setNodeSourceCodeLocation(t,r)}if(this._shouldFosterParentOnInsertion())this._fosterParentElement(t);else{let r=this.openElements.currentTmplContentOrNode;this.treeAdapter.appendChild(r??this.document,t)}}_appendElement(t,n){let r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location)}_insertElement(t,n){let r=this.treeAdapter.createElement(t.tagName,n,t.attrs);this._attachElementToTree(r,t.location),this.openElements.push(r,t.tagID)}_insertFakeElement(t,n){let r=this.treeAdapter.createElement(t,j.HTML,[]);this._attachElementToTree(r,null),this.openElements.push(r,n)}_insertTemplate(t){let n=this.treeAdapter.createElement(t.tagName,j.HTML,t.attrs),r=this.treeAdapter.createDocumentFragment();this.treeAdapter.setTemplateContent(n,r),this._attachElementToTree(n,t.location),this.openElements.push(n,t.tagID),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,null)}_insertFakeRootElement(){let t=this.treeAdapter.createElement(I.HTML,j.HTML,[]);this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(t,null),this.treeAdapter.appendChild(this.openElements.current,t),this.openElements.push(t,p.HTML)}_appendCommentNode(t,n){let r=this.treeAdapter.createCommentNode(t.data);this.treeAdapter.appendChild(n,r),this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(r,t.location)}_insertCharacters(t){let n,r;if(this._shouldFosterParentOnInsertion()?({parent:n,beforeElement:r}=this._findFosterParentingLocation(),r?this.treeAdapter.insertTextBefore(n,t.chars,r):this.treeAdapter.insertText(n,t.chars)):(n=this.openElements.currentTmplContentOrNode,this.treeAdapter.insertText(n,t.chars)),!t.location)return;let i=this.treeAdapter.getChildNodes(n),a=r?i.lastIndexOf(r):i.length,o=i[a-1];if(this.treeAdapter.getNodeSourceCodeLocation(o)){let{endLine:l,endCol:u,endOffset:c}=t.location;this.treeAdapter.updateNodeSourceCodeLocation(o,{endLine:l,endCol:u,endOffset:c})}else this.options.sourceCodeLocationInfo&&this.treeAdapter.setNodeSourceCodeLocation(o,t.location)}_adoptNodes(t,n){for(let r=this.treeAdapter.getFirstChild(t);r;r=this.treeAdapter.getFirstChild(t))this.treeAdapter.detachNode(r),this.treeAdapter.appendChild(n,r)}_setEndLocation(t,n){if(this.treeAdapter.getNodeSourceCodeLocation(t)&&n.location){let r=n.location,i=this.treeAdapter.getTagName(t),a=n.type===Oe.END_TAG&&i===n.tagName?{endTag:{...r},endLine:r.endLine,endCol:r.endCol,endOffset:r.endOffset}:{endLine:r.startLine,endCol:r.startCol,endOffset:r.startOffset};this.treeAdapter.updateNodeSourceCodeLocation(t,a)}}shouldProcessStartTagTokenInForeignContent(t){if(!this.currentNotInHTML)return!1;let n,r;return this.openElements.stackTop===0&&this.fragmentContext?(n=this.fragmentContext,r=this.fragmentContextID):{current:n,currentTagId:r}=this.openElements,t.tagID===p.SVG&&this.treeAdapter.getTagName(n)===I.ANNOTATION_XML&&this.treeAdapter.getNamespaceURI(n)===j.MATHML?!1:this.tokenizer.inForeignNode||(t.tagID===p.MGLYPH||t.tagID===p.MALIGNMARK)&&r!==void 0&&!this._isIntegrationPoint(r,n,j.HTML)}_processToken(t){switch(t.type){case Oe.CHARACTER:{this.onCharacter(t);break}case Oe.NULL_CHARACTER:{this.onNullCharacter(t);break}case Oe.COMMENT:{this.onComment(t);break}case Oe.DOCTYPE:{this.onDoctype(t);break}case Oe.START_TAG:{this._processStartTag(t);break}case Oe.END_TAG:{this.onEndTag(t);break}case Oe.EOF:{this.onEof(t);break}case Oe.WHITESPACE_CHARACTER:{this.onWhitespaceCharacter(t);break}}}_isIntegrationPoint(t,n,r){let i=this.treeAdapter.getNamespaceURI(n),a=this.treeAdapter.getAttrList(n);return $v(t,i,a,r)}_reconstructActiveFormattingElements(){let t=this.activeFormattingElements.entries.length;if(t){let n=this.activeFormattingElements.entries.findIndex(i=>i.type===Lr.Marker||this.openElements.contains(i.element)),r=n===-1?t-1:n-1;for(let i=r;i>=0;i--){let a=this.activeFormattingElements.entries[i];this._insertElement(a.token,this.treeAdapter.getNamespaceURI(a.element)),a.element=this.openElements.current}}}_closeTableCell(){this.openElements.generateImpliedEndTags(),this.openElements.popUntilTableCellPopped(),this.activeFormattingElements.clearToLastMarker(),this.insertionMode=w.IN_ROW}_closePElement(){this.openElements.generateImpliedEndTagsWithExclusion(p.P),this.openElements.popUntilTagNamePopped(p.P)}_resetInsertionMode(){for(let t=this.openElements.stackTop;t>=0;t--)switch(t===0&&this.fragmentContext?this.fragmentContextID:this.openElements.tagIDs[t]){case p.TR:{this.insertionMode=w.IN_ROW;return}case p.TBODY:case p.THEAD:case p.TFOOT:{this.insertionMode=w.IN_TABLE_BODY;return}case p.CAPTION:{this.insertionMode=w.IN_CAPTION;return}case p.COLGROUP:{this.insertionMode=w.IN_COLUMN_GROUP;return}case p.TABLE:{this.insertionMode=w.IN_TABLE;return}case p.BODY:{this.insertionMode=w.IN_BODY;return}case p.FRAMESET:{this.insertionMode=w.IN_FRAMESET;return}case p.SELECT:{this._resetInsertionModeForSelect(t);return}case p.TEMPLATE:{this.insertionMode=this.tmplInsertionModeStack[0];return}case p.HTML:{this.insertionMode=this.headElement?w.AFTER_HEAD:w.BEFORE_HEAD;return}case p.TD:case p.TH:{if(t>0){this.insertionMode=w.IN_CELL;return}break}case p.HEAD:{if(t>0){this.insertionMode=w.IN_HEAD;return}break}}this.insertionMode=w.IN_BODY}_resetInsertionModeForSelect(t){if(t>0)for(let n=t-1;n>0;n--){let r=this.openElements.tagIDs[n];if(r===p.TEMPLATE)break;if(r===p.TABLE){this.insertionMode=w.IN_SELECT_IN_TABLE;return}}this.insertionMode=w.IN_SELECT}_isElementCausesFosterParenting(t){return Zv.has(t)}_shouldFosterParentOnInsertion(){return this.fosterParentingEnabled&&this.openElements.currentTagId!==void 0&&this._isElementCausesFosterParenting(this.openElements.currentTagId)}_findFosterParentingLocation(){for(let t=this.openElements.stackTop;t>=0;t--){let n=this.openElements.items[t];switch(this.openElements.tagIDs[t]){case p.TEMPLATE:{if(this.treeAdapter.getNamespaceURI(n)===j.HTML)return{parent:this.treeAdapter.getTemplateContent(n),beforeElement:null};break}case p.TABLE:{let r=this.treeAdapter.getParentNode(n);return r?{parent:r,beforeElement:n}:{parent:this.openElements.items[t-1],beforeElement:null}}default:}}return{parent:this.openElements.items[0],beforeElement:null}}_fosterParentElement(t){let n=this._findFosterParentingLocation();n.beforeElement?this.treeAdapter.insertBefore(n.parent,t,n.beforeElement):this.treeAdapter.appendChild(n.parent,t)}_isSpecialElement(t,n){let r=this.treeAdapter.getNamespaceURI(t);return _E[r].has(n)}onCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){AU(this,t);return}switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{bc(this,t);break}case w.BEFORE_HEAD:{Ec(this,t);break}case w.IN_HEAD:{yc(this,t);break}case w.IN_HEAD_NO_SCRIPT:{Tc(this,t);break}case w.AFTER_HEAD:{Sc(this,t);break}case w.IN_BODY:case w.IN_CAPTION:case w.IN_CELL:case w.IN_TEMPLATE:{ek(this,t);break}case w.TEXT:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:{this._insertCharacters(t);break}case w.IN_TABLE:case w.IN_TABLE_BODY:case w.IN_ROW:{CE(this,t);break}case w.IN_TABLE_TEXT:{ok(this,t);break}case w.IN_COLUMN_GROUP:{Uh(this,t);break}case w.AFTER_BODY:{Hh(this,t);break}case w.AFTER_AFTER_BODY:{Ph(this,t);break}default:}}onNullCharacter(t){if(this.skipNextNewLine=!1,this.tokenizer.inForeignNode){xU(this,t);return}switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{bc(this,t);break}case w.BEFORE_HEAD:{Ec(this,t);break}case w.IN_HEAD:{yc(this,t);break}case w.IN_HEAD_NO_SCRIPT:{Tc(this,t);break}case w.AFTER_HEAD:{Sc(this,t);break}case w.TEXT:{this._insertCharacters(t);break}case w.IN_TABLE:case w.IN_TABLE_BODY:case w.IN_ROW:{CE(this,t);break}case w.IN_COLUMN_GROUP:{Uh(this,t);break}case w.AFTER_BODY:{Hh(this,t);break}case w.AFTER_AFTER_BODY:{Ph(this,t);break}default:}}onComment(t){if(this.skipNextNewLine=!1,this.currentNotInHTML){NE(this,t);return}switch(this.insertionMode){case w.INITIAL:case w.BEFORE_HTML:case w.BEFORE_HEAD:case w.IN_HEAD:case w.IN_HEAD_NO_SCRIPT:case w.AFTER_HEAD:case w.IN_BODY:case w.IN_TABLE:case w.IN_CAPTION:case w.IN_COLUMN_GROUP:case w.IN_TABLE_BODY:case w.IN_ROW:case w.IN_CELL:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:case w.IN_TEMPLATE:case w.IN_FRAMESET:case w.AFTER_FRAMESET:{NE(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.AFTER_BODY:{t9(this,t);break}case w.AFTER_AFTER_BODY:case w.AFTER_AFTER_FRAMESET:{n9(this,t);break}default:}}onDoctype(t){switch(this.skipNextNewLine=!1,this.insertionMode){case w.INITIAL:{r9(this,t);break}case w.BEFORE_HEAD:case w.IN_HEAD:case w.IN_HEAD_NO_SCRIPT:case w.AFTER_HEAD:{this._err(t,U.misplacedDoctype);break}case w.IN_TABLE_TEXT:{gc(this,t);break}default:}}onStartTag(t){this.skipNextNewLine=!1,this.currentToken=t,this._processStartTag(t),t.selfClosing&&!t.ackSelfClosing&&this._err(t,U.nonVoidHtmlElementStartTagWithTrailingSolidus)}_processStartTag(t){this.shouldProcessStartTagTokenInForeignContent(t)?CU(this,t):this._startTagOutsideForeignContent(t)}_startTagOutsideForeignContent(t){switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{i9(this,t);break}case w.BEFORE_HEAD:{o9(this,t);break}case w.IN_HEAD:{Pr(this,t);break}case w.IN_HEAD_NO_SCRIPT:{u9(this,t);break}case w.AFTER_HEAD:{f9(this,t);break}case w.IN_BODY:{dn(this,t);break}case w.IN_TABLE:{gl(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.IN_CAPTION:{sU(this,t);break}case w.IN_COLUMN_GROUP:{ME(this,t);break}case w.IN_TABLE_BODY:{qh(this,t);break}case w.IN_ROW:{Vh(this,t);break}case w.IN_CELL:{cU(this,t);break}case w.IN_SELECT:{uk(this,t);break}case w.IN_SELECT_IN_TABLE:{dU(this,t);break}case w.IN_TEMPLATE:{pU(this,t);break}case w.AFTER_BODY:{gU(this,t);break}case w.IN_FRAMESET:{bU(this,t);break}case w.AFTER_FRAMESET:{yU(this,t);break}case w.AFTER_AFTER_BODY:{SU(this,t);break}case w.AFTER_AFTER_FRAMESET:{_U(this,t);break}default:}}onEndTag(t){this.skipNextNewLine=!1,this.currentToken=t,this.currentNotInHTML?NU(this,t):this._endTagOutsideForeignContent(t)}_endTagOutsideForeignContent(t){switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{a9(this,t);break}case w.BEFORE_HEAD:{s9(this,t);break}case w.IN_HEAD:{l9(this,t);break}case w.IN_HEAD_NO_SCRIPT:{c9(this,t);break}case w.AFTER_HEAD:{d9(this,t);break}case w.IN_BODY:{Fh(this,t);break}case w.TEXT:{Q9(this,t);break}case w.IN_TABLE:{_c(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.IN_CAPTION:{lU(this,t);break}case w.IN_COLUMN_GROUP:{uU(this,t);break}case w.IN_TABLE_BODY:{vE(this,t);break}case w.IN_ROW:{lk(this,t);break}case w.IN_CELL:{fU(this,t);break}case w.IN_SELECT:{ck(this,t);break}case w.IN_SELECT_IN_TABLE:{hU(this,t);break}case w.IN_TEMPLATE:{mU(this,t);break}case w.AFTER_BODY:{dk(this,t);break}case w.IN_FRAMESET:{EU(this,t);break}case w.AFTER_FRAMESET:{TU(this,t);break}case w.AFTER_AFTER_BODY:{Ph(this,t);break}default:}}onEof(t){switch(this.insertionMode){case w.INITIAL:{mc(this,t);break}case w.BEFORE_HTML:{bc(this,t);break}case w.BEFORE_HEAD:{Ec(this,t);break}case w.IN_HEAD:{yc(this,t);break}case w.IN_HEAD_NO_SCRIPT:{Tc(this,t);break}case w.AFTER_HEAD:{Sc(this,t);break}case w.IN_BODY:case w.IN_TABLE:case w.IN_CAPTION:case w.IN_COLUMN_GROUP:case w.IN_TABLE_BODY:case w.IN_ROW:case w.IN_CELL:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:{ik(this,t);break}case w.TEXT:{Z9(this,t);break}case w.IN_TABLE_TEXT:{gc(this,t);break}case w.IN_TEMPLATE:{fk(this,t);break}case w.AFTER_BODY:case w.IN_FRAMESET:case w.AFTER_FRAMESET:case w.AFTER_AFTER_BODY:case w.AFTER_AFTER_FRAMESET:{wE(this,t);break}default:}}onWhitespaceCharacter(t){if(this.skipNextNewLine&&(this.skipNextNewLine=!1,t.chars.charCodeAt(0)===_.LINE_FEED)){if(t.chars.length===1)return;t.chars=t.chars.substr(1)}if(this.tokenizer.inForeignNode){this._insertCharacters(t);return}switch(this.insertionMode){case w.IN_HEAD:case w.IN_HEAD_NO_SCRIPT:case w.AFTER_HEAD:case w.TEXT:case w.IN_COLUMN_GROUP:case w.IN_SELECT:case w.IN_SELECT_IN_TABLE:case w.IN_FRAMESET:case w.AFTER_FRAMESET:{this._insertCharacters(t);break}case w.IN_BODY:case w.IN_CAPTION:case w.IN_CELL:case w.IN_TEMPLATE:case w.AFTER_BODY:case w.AFTER_AFTER_BODY:case w.AFTER_AFTER_FRAMESET:{Jv(this,t);break}case w.IN_TABLE:case w.IN_TABLE_BODY:case w.IN_ROW:{CE(this,t);break}case w.IN_TABLE_TEXT:{ak(this,t);break}default:}}};function X8(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(t.tagName);return n?e.openElements.contains(n.element)?e.openElements.hasInScope(t.tagID)||(n=null):(e.activeFormattingElements.removeEntry(n),n=null):rk(e,t),n}function W8(e,t){let n=null,r=e.openElements.stackTop;for(;r>=0;r--){let i=e.openElements.items[r];if(i===t.element)break;e._isSpecialElement(i,e.openElements.tagIDs[r])&&(n=i)}return n||(e.openElements.shortenToLength(Math.max(r,0)),e.activeFormattingElements.removeEntry(t)),n}function Q8(e,t,n){let r=t,i=e.openElements.getCommonAncestor(t);for(let a=0,o=i;o!==n;a++,o=i){i=e.openElements.getCommonAncestor(o);let s=e.activeFormattingElements.getElementEntry(o),l=s&&a>=$8;!s||l?(l&&e.activeFormattingElements.removeEntry(s),e.openElements.remove(o)):(o=Z8(e,s),r===t&&(e.activeFormattingElements.bookmark=s),e.treeAdapter.detachNode(r),e.treeAdapter.appendChild(o,r),r=o)}return r}function Z8(e,t){let n=e.treeAdapter.getNamespaceURI(t.element),r=e.treeAdapter.createElement(t.token.tagName,n,t.token.attrs);return e.openElements.replace(t.element,r),t.element=r,r}function J8(e,t,n){let r=e.treeAdapter.getTagName(t),i=La(r);if(e._isElementCausesFosterParenting(i))e._fosterParentElement(n);else{let a=e.treeAdapter.getNamespaceURI(t);i===p.TEMPLATE&&a===j.HTML&&(t=e.treeAdapter.getTemplateContent(t)),e.treeAdapter.appendChild(t,n)}}function e9(e,t,n){let r=e.treeAdapter.getNamespaceURI(n.element),{token:i}=n,a=e.treeAdapter.createElement(i.tagName,r,i.attrs);e._adoptNodes(t,a),e.treeAdapter.appendChild(t,a),e.activeFormattingElements.insertElementAfterBookmark(a,i),e.activeFormattingElements.removeEntry(n),e.openElements.remove(n.element),e.openElements.insertAfter(t,a,i.tagID)}function kE(e,t){for(let n=0;n=n;r--)e._setEndLocation(e.openElements.items[r],t);if(!e.fragmentContext&&e.openElements.stackTop>=0){let r=e.openElements.items[0],i=e.treeAdapter.getNodeSourceCodeLocation(r);if(i&&!i.endTag&&(e._setEndLocation(r,t),e.openElements.stackTop>=1)){let a=e.openElements.items[1],o=e.treeAdapter.getNodeSourceCodeLocation(a);o&&!o.endTag&&e._setEndLocation(a,t)}}}}function r9(e,t){e._setDocumentType(t);let n=t.forceQuirks?fn.QUIRKS:Vv(t);qv(t)||e._err(t,U.nonConformingDoctype),e.treeAdapter.setDocumentMode(e.document,n),e.insertionMode=w.BEFORE_HTML}function mc(e,t){e._err(t,U.missingDoctype,!0),e.treeAdapter.setDocumentMode(e.document,fn.QUIRKS),e.insertionMode=w.BEFORE_HTML,e._processToken(t)}function i9(e,t){t.tagID===p.HTML?(e._insertElement(t,j.HTML),e.insertionMode=w.BEFORE_HEAD):bc(e,t)}function a9(e,t){let n=t.tagID;(n===p.HTML||n===p.HEAD||n===p.BODY||n===p.BR)&&bc(e,t)}function bc(e,t){e._insertFakeRootElement(),e.insertionMode=w.BEFORE_HEAD,e._processToken(t)}function o9(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.HEAD:{e._insertElement(t,j.HTML),e.headElement=e.openElements.current,e.insertionMode=w.IN_HEAD;break}default:Ec(e,t)}}function s9(e,t){let n=t.tagID;n===p.HEAD||n===p.BODY||n===p.HTML||n===p.BR?Ec(e,t):e._err(t,U.endTagWithoutMatchingOpenElement)}function Ec(e,t){e._insertFakeElement(I.HEAD,p.HEAD),e.headElement=e.openElements.current,e.insertionMode=w.IN_HEAD,e._processToken(t)}function Pr(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.BASE:case p.BASEFONT:case p.BGSOUND:case p.LINK:case p.META:{e._appendElement(t,j.HTML),t.ackSelfClosing=!0;break}case p.TITLE:{e._switchToTextParsing(t,ft.RCDATA);break}case p.NOSCRIPT:{e.options.scriptingEnabled?e._switchToTextParsing(t,ft.RAWTEXT):(e._insertElement(t,j.HTML),e.insertionMode=w.IN_HEAD_NO_SCRIPT);break}case p.NOFRAMES:case p.STYLE:{e._switchToTextParsing(t,ft.RAWTEXT);break}case p.SCRIPT:{e._switchToTextParsing(t,ft.SCRIPT_DATA);break}case p.TEMPLATE:{e._insertTemplate(t),e.activeFormattingElements.insertMarker(),e.framesetOk=!1,e.insertionMode=w.IN_TEMPLATE,e.tmplInsertionModeStack.unshift(w.IN_TEMPLATE);break}case p.HEAD:{e._err(t,U.misplacedStartTagForHeadElement);break}default:yc(e,t)}}function l9(e,t){switch(t.tagID){case p.HEAD:{e.openElements.pop(),e.insertionMode=w.AFTER_HEAD;break}case p.BODY:case p.BR:case p.HTML:{yc(e,t);break}case p.TEMPLATE:{Oo(e,t);break}default:e._err(t,U.endTagWithoutMatchingOpenElement)}}function Oo(e,t){e.openElements.tmplCount>0?(e.openElements.generateImpliedEndTagsThoroughly(),e.openElements.currentTagId!==p.TEMPLATE&&e._err(t,U.closingOfElementWithOpenChildElements),e.openElements.popUntilTagNamePopped(p.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode()):e._err(t,U.endTagWithoutMatchingOpenElement)}function yc(e,t){e.openElements.pop(),e.insertionMode=w.AFTER_HEAD,e._processToken(t)}function u9(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.BASEFONT:case p.BGSOUND:case p.HEAD:case p.LINK:case p.META:case p.NOFRAMES:case p.STYLE:{Pr(e,t);break}case p.NOSCRIPT:{e._err(t,U.nestedNoscriptInHead);break}default:Tc(e,t)}}function c9(e,t){switch(t.tagID){case p.NOSCRIPT:{e.openElements.pop(),e.insertionMode=w.IN_HEAD;break}case p.BR:{Tc(e,t);break}default:e._err(t,U.endTagWithoutMatchingOpenElement)}}function Tc(e,t){let n=t.type===Oe.EOF?U.openElementsLeftAfterEof:U.disallowedContentInNoscriptInHead;e._err(t,n),e.openElements.pop(),e.insertionMode=w.IN_HEAD,e._processToken(t)}function f9(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.BODY:{e._insertElement(t,j.HTML),e.framesetOk=!1,e.insertionMode=w.IN_BODY;break}case p.FRAMESET:{e._insertElement(t,j.HTML),e.insertionMode=w.IN_FRAMESET;break}case p.BASE:case p.BASEFONT:case p.BGSOUND:case p.LINK:case p.META:case p.NOFRAMES:case p.SCRIPT:case p.STYLE:case p.TEMPLATE:case p.TITLE:{e._err(t,U.abandonedHeadElementChild),e.openElements.push(e.headElement,p.HEAD),Pr(e,t),e.openElements.remove(e.headElement);break}case p.HEAD:{e._err(t,U.misplacedStartTagForHeadElement);break}default:Sc(e,t)}}function d9(e,t){switch(t.tagID){case p.BODY:case p.HTML:case p.BR:{Sc(e,t);break}case p.TEMPLATE:{Oo(e,t);break}default:e._err(t,U.endTagWithoutMatchingOpenElement)}}function Sc(e,t){e._insertFakeElement(I.BODY,p.BODY),e.insertionMode=w.IN_BODY,zh(e,t)}function zh(e,t){switch(t.type){case Oe.CHARACTER:{ek(e,t);break}case Oe.WHITESPACE_CHARACTER:{Jv(e,t);break}case Oe.COMMENT:{NE(e,t);break}case Oe.START_TAG:{dn(e,t);break}case Oe.END_TAG:{Fh(e,t);break}case Oe.EOF:{ik(e,t);break}default:}}function Jv(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t)}function ek(e,t){e._reconstructActiveFormattingElements(),e._insertCharacters(t),e.framesetOk=!1}function h9(e,t){e.openElements.tmplCount===0&&e.treeAdapter.adoptAttributes(e.openElements.items[0],t.attrs)}function p9(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e.openElements.tmplCount===0&&(e.framesetOk=!1,e.treeAdapter.adoptAttributes(n,t.attrs))}function m9(e,t){let n=e.openElements.tryPeekProperlyNestedBodyElement();e.framesetOk&&n&&(e.treeAdapter.detachNode(n),e.openElements.popAllUpToHtmlElement(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_FRAMESET)}function g9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML)}function b9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e.openElements.currentTagId!==void 0&&ml.has(e.openElements.currentTagId)&&e.openElements.pop(),e._insertElement(t,j.HTML)}function E9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),e.skipNextNewLine=!0,e.framesetOk=!1}function y9(e,t){let n=e.openElements.tmplCount>0;(!e.formElement||n)&&(e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),n||(e.formElement=e.openElements.current))}function T9(e,t){e.framesetOk=!1;let n=t.tagID;for(let r=e.openElements.stackTop;r>=0;r--){let i=e.openElements.tagIDs[r];if(n===p.LI&&i===p.LI||(n===p.DD||n===p.DT)&&(i===p.DD||i===p.DT)){e.openElements.generateImpliedEndTagsWithExclusion(i),e.openElements.popUntilTagNamePopped(i);break}if(i!==p.ADDRESS&&i!==p.DIV&&i!==p.P&&e._isSpecialElement(e.openElements.items[r],i))break}e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML)}function S9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),e.tokenizer.state=ft.PLAINTEXT}function _9(e,t){e.openElements.hasInScope(p.BUTTON)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(p.BUTTON)),e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.framesetOk=!1}function x9(e,t){let n=e.activeFormattingElements.getElementEntryInScopeWithTagName(I.A);n&&(kE(e,t),e.openElements.remove(n.element),e.activeFormattingElements.removeEntry(n)),e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function A9(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function C9(e,t){e._reconstructActiveFormattingElements(),e.openElements.hasInScope(p.NOBR)&&(kE(e,t),e._reconstructActiveFormattingElements()),e._insertElement(t,j.HTML),e.activeFormattingElements.pushElement(e.openElements.current,t)}function N9(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.activeFormattingElements.insertMarker(),e.framesetOk=!1}function v9(e,t){e.treeAdapter.getDocumentMode(e.document)!==fn.QUIRKS&&e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._insertElement(t,j.HTML),e.framesetOk=!1,e.insertionMode=w.IN_TABLE}function tk(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,j.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function nk(e){let t=fc(e,Zr.TYPE);return t!=null&&t.toLowerCase()===Y8}function k9(e,t){e._reconstructActiveFormattingElements(),e._appendElement(t,j.HTML),nk(t)||(e.framesetOk=!1),t.ackSelfClosing=!0}function w9(e,t){e._appendElement(t,j.HTML),t.ackSelfClosing=!0}function M9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._appendElement(t,j.HTML),e.framesetOk=!1,t.ackSelfClosing=!0}function O9(e,t){t.tagName=I.IMG,t.tagID=p.IMG,tk(e,t)}function R9(e,t){e._insertElement(t,j.HTML),e.skipNextNewLine=!0,e.tokenizer.state=ft.RCDATA,e.originalInsertionMode=e.insertionMode,e.framesetOk=!1,e.insertionMode=w.TEXT}function D9(e,t){e.openElements.hasInButtonScope(p.P)&&e._closePElement(),e._reconstructActiveFormattingElements(),e.framesetOk=!1,e._switchToTextParsing(t,ft.RAWTEXT)}function I9(e,t){e.framesetOk=!1,e._switchToTextParsing(t,ft.RAWTEXT)}function Wv(e,t){e._switchToTextParsing(t,ft.RAWTEXT)}function L9(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML),e.framesetOk=!1,e.insertionMode=e.insertionMode===w.IN_TABLE||e.insertionMode===w.IN_CAPTION||e.insertionMode===w.IN_TABLE_BODY||e.insertionMode===w.IN_ROW||e.insertionMode===w.IN_CELL?w.IN_SELECT_IN_TABLE:w.IN_SELECT}function B9(e,t){e.openElements.currentTagId===p.OPTION&&e.openElements.pop(),e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML)}function P9(e,t){e.openElements.hasInScope(p.RUBY)&&e.openElements.generateImpliedEndTags(),e._insertElement(t,j.HTML)}function U9(e,t){e.openElements.hasInScope(p.RUBY)&&e.openElements.generateImpliedEndTagsWithExclusion(p.RTC),e._insertElement(t,j.HTML)}function H9(e,t){e._reconstructActiveFormattingElements(),xE(t),Bh(t),t.selfClosing?e._appendElement(t,j.MATHML):e._insertElement(t,j.MATHML),t.ackSelfClosing=!0}function z9(e,t){e._reconstructActiveFormattingElements(),AE(t),Bh(t),t.selfClosing?e._appendElement(t,j.SVG):e._insertElement(t,j.SVG),t.ackSelfClosing=!0}function Qv(e,t){e._reconstructActiveFormattingElements(),e._insertElement(t,j.HTML)}function dn(e,t){switch(t.tagID){case p.I:case p.S:case p.B:case p.U:case p.EM:case p.TT:case p.BIG:case p.CODE:case p.FONT:case p.SMALL:case p.STRIKE:case p.STRONG:{A9(e,t);break}case p.A:{x9(e,t);break}case p.H1:case p.H2:case p.H3:case p.H4:case p.H5:case p.H6:{b9(e,t);break}case p.P:case p.DL:case p.OL:case p.UL:case p.DIV:case p.DIR:case p.NAV:case p.MAIN:case p.MENU:case p.ASIDE:case p.CENTER:case p.FIGURE:case p.FOOTER:case p.HEADER:case p.HGROUP:case p.DIALOG:case p.DETAILS:case p.ADDRESS:case p.ARTICLE:case p.SEARCH:case p.SECTION:case p.SUMMARY:case p.FIELDSET:case p.BLOCKQUOTE:case p.FIGCAPTION:{g9(e,t);break}case p.LI:case p.DD:case p.DT:{T9(e,t);break}case p.BR:case p.IMG:case p.WBR:case p.AREA:case p.EMBED:case p.KEYGEN:{tk(e,t);break}case p.HR:{M9(e,t);break}case p.RB:case p.RTC:{P9(e,t);break}case p.RT:case p.RP:{U9(e,t);break}case p.PRE:case p.LISTING:{E9(e,t);break}case p.XMP:{D9(e,t);break}case p.SVG:{z9(e,t);break}case p.HTML:{h9(e,t);break}case p.BASE:case p.LINK:case p.META:case p.STYLE:case p.TITLE:case p.SCRIPT:case p.BGSOUND:case p.BASEFONT:case p.TEMPLATE:{Pr(e,t);break}case p.BODY:{p9(e,t);break}case p.FORM:{y9(e,t);break}case p.NOBR:{C9(e,t);break}case p.MATH:{H9(e,t);break}case p.TABLE:{v9(e,t);break}case p.INPUT:{k9(e,t);break}case p.PARAM:case p.TRACK:case p.SOURCE:{w9(e,t);break}case p.IMAGE:{O9(e,t);break}case p.BUTTON:{_9(e,t);break}case p.APPLET:case p.OBJECT:case p.MARQUEE:{N9(e,t);break}case p.IFRAME:{I9(e,t);break}case p.SELECT:{L9(e,t);break}case p.OPTION:case p.OPTGROUP:{B9(e,t);break}case p.NOEMBED:case p.NOFRAMES:{Wv(e,t);break}case p.FRAMESET:{m9(e,t);break}case p.TEXTAREA:{R9(e,t);break}case p.NOSCRIPT:{e.options.scriptingEnabled?Wv(e,t):Qv(e,t);break}case p.PLAINTEXT:{S9(e,t);break}case p.COL:case p.TH:case p.TD:case p.TR:case p.HEAD:case p.FRAME:case p.TBODY:case p.TFOOT:case p.THEAD:case p.CAPTION:case p.COLGROUP:break;default:Qv(e,t)}}function F9(e,t){if(e.openElements.hasInScope(p.BODY)&&(e.insertionMode=w.AFTER_BODY,e.options.sourceCodeLocationInfo)){let n=e.openElements.tryPeekProperlyNestedBodyElement();n&&e._setEndLocation(n,t)}}function q9(e,t){e.openElements.hasInScope(p.BODY)&&(e.insertionMode=w.AFTER_BODY,dk(e,t))}function V9(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n))}function G9(e){let t=e.openElements.tmplCount>0,{formElement:n}=e;t||(e.formElement=null),(n||t)&&e.openElements.hasInScope(p.FORM)&&(e.openElements.generateImpliedEndTags(),t?e.openElements.popUntilTagNamePopped(p.FORM):n&&e.openElements.remove(n))}function Y9(e){e.openElements.hasInButtonScope(p.P)||e._insertFakeElement(I.P,p.P),e._closePElement()}function K9(e){e.openElements.hasInListItemScope(p.LI)&&(e.openElements.generateImpliedEndTagsWithExclusion(p.LI),e.openElements.popUntilTagNamePopped(p.LI))}function $9(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTagsWithExclusion(n),e.openElements.popUntilTagNamePopped(n))}function j9(e){e.openElements.hasNumberedHeaderInScope()&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilNumberedHeaderPopped())}function X9(e,t){let n=t.tagID;e.openElements.hasInScope(n)&&(e.openElements.generateImpliedEndTags(),e.openElements.popUntilTagNamePopped(n),e.activeFormattingElements.clearToLastMarker())}function W9(e){e._reconstructActiveFormattingElements(),e._insertFakeElement(I.BR,p.BR),e.openElements.pop(),e.framesetOk=!1}function rk(e,t){let n=t.tagName,r=t.tagID;for(let i=e.openElements.stackTop;i>0;i--){let a=e.openElements.items[i],o=e.openElements.tagIDs[i];if(r===o&&(r!==p.UNKNOWN||e.treeAdapter.getTagName(a)===n)){e.openElements.generateImpliedEndTagsWithExclusion(r),e.openElements.stackTop>=i&&e.openElements.shortenToLength(i);break}if(e._isSpecialElement(a,o))break}}function Fh(e,t){switch(t.tagID){case p.A:case p.B:case p.I:case p.S:case p.U:case p.EM:case p.TT:case p.BIG:case p.CODE:case p.FONT:case p.NOBR:case p.SMALL:case p.STRIKE:case p.STRONG:{kE(e,t);break}case p.P:{Y9(e);break}case p.DL:case p.UL:case p.OL:case p.DIR:case p.DIV:case p.NAV:case p.PRE:case p.MAIN:case p.MENU:case p.ASIDE:case p.BUTTON:case p.CENTER:case p.FIGURE:case p.FOOTER:case p.HEADER:case p.HGROUP:case p.DIALOG:case p.ADDRESS:case p.ARTICLE:case p.DETAILS:case p.SEARCH:case p.SECTION:case p.SUMMARY:case p.LISTING:case p.FIELDSET:case p.BLOCKQUOTE:case p.FIGCAPTION:{V9(e,t);break}case p.LI:{K9(e);break}case p.DD:case p.DT:{$9(e,t);break}case p.H1:case p.H2:case p.H3:case p.H4:case p.H5:case p.H6:{j9(e);break}case p.BR:{W9(e);break}case p.BODY:{F9(e,t);break}case p.HTML:{q9(e,t);break}case p.FORM:{G9(e);break}case p.APPLET:case p.OBJECT:case p.MARQUEE:{X9(e,t);break}case p.TEMPLATE:{Oo(e,t);break}default:rk(e,t)}}function ik(e,t){e.tmplInsertionModeStack.length>0?fk(e,t):wE(e,t)}function Q9(e,t){var n;t.tagID===p.SCRIPT&&((n=e.scriptHandler)===null||n===void 0||n.call(e,e.openElements.current)),e.openElements.pop(),e.insertionMode=e.originalInsertionMode}function Z9(e,t){e._err(t,U.eofInElementThatCanContainOnlyText),e.openElements.pop(),e.insertionMode=e.originalInsertionMode,e.onEof(t)}function CE(e,t){if(e.openElements.currentTagId!==void 0&&Zv.has(e.openElements.currentTagId))switch(e.pendingCharacterTokens.length=0,e.hasNonWhitespacePendingCharacterToken=!1,e.originalInsertionMode=e.insertionMode,e.insertionMode=w.IN_TABLE_TEXT,t.type){case Oe.CHARACTER:{ok(e,t);break}case Oe.WHITESPACE_CHARACTER:{ak(e,t);break}}else xc(e,t)}function J9(e,t){e.openElements.clearBackToTableContext(),e.activeFormattingElements.insertMarker(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_CAPTION}function eU(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_COLUMN_GROUP}function tU(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(I.COLGROUP,p.COLGROUP),e.insertionMode=w.IN_COLUMN_GROUP,ME(e,t)}function nU(e,t){e.openElements.clearBackToTableContext(),e._insertElement(t,j.HTML),e.insertionMode=w.IN_TABLE_BODY}function rU(e,t){e.openElements.clearBackToTableContext(),e._insertFakeElement(I.TBODY,p.TBODY),e.insertionMode=w.IN_TABLE_BODY,qh(e,t)}function iU(e,t){e.openElements.hasInTableScope(p.TABLE)&&(e.openElements.popUntilTagNamePopped(p.TABLE),e._resetInsertionMode(),e._processStartTag(t))}function aU(e,t){nk(t)?e._appendElement(t,j.HTML):xc(e,t),t.ackSelfClosing=!0}function oU(e,t){!e.formElement&&e.openElements.tmplCount===0&&(e._insertElement(t,j.HTML),e.formElement=e.openElements.current,e.openElements.pop())}function gl(e,t){switch(t.tagID){case p.TD:case p.TH:case p.TR:{rU(e,t);break}case p.STYLE:case p.SCRIPT:case p.TEMPLATE:{Pr(e,t);break}case p.COL:{tU(e,t);break}case p.FORM:{oU(e,t);break}case p.TABLE:{iU(e,t);break}case p.TBODY:case p.TFOOT:case p.THEAD:{nU(e,t);break}case p.INPUT:{aU(e,t);break}case p.CAPTION:{J9(e,t);break}case p.COLGROUP:{eU(e,t);break}default:xc(e,t)}}function _c(e,t){switch(t.tagID){case p.TABLE:{e.openElements.hasInTableScope(p.TABLE)&&(e.openElements.popUntilTagNamePopped(p.TABLE),e._resetInsertionMode());break}case p.TEMPLATE:{Oo(e,t);break}case p.BODY:case p.CAPTION:case p.COL:case p.COLGROUP:case p.HTML:case p.TBODY:case p.TD:case p.TFOOT:case p.TH:case p.THEAD:case p.TR:break;default:xc(e,t)}}function xc(e,t){let n=e.fosterParentingEnabled;e.fosterParentingEnabled=!0,zh(e,t),e.fosterParentingEnabled=n}function ak(e,t){e.pendingCharacterTokens.push(t)}function ok(e,t){e.pendingCharacterTokens.push(t),e.hasNonWhitespacePendingCharacterToken=!0}function gc(e,t){let n=0;if(e.hasNonWhitespacePendingCharacterToken)for(;n0&&e.openElements.currentTagId===p.OPTION&&e.openElements.tagIDs[e.openElements.stackTop-1]===p.OPTGROUP&&e.openElements.pop(),e.openElements.currentTagId===p.OPTGROUP&&e.openElements.pop();break}case p.OPTION:{e.openElements.currentTagId===p.OPTION&&e.openElements.pop();break}case p.SELECT:{e.openElements.hasInSelectScope(p.SELECT)&&(e.openElements.popUntilTagNamePopped(p.SELECT),e._resetInsertionMode());break}case p.TEMPLATE:{Oo(e,t);break}default:}}function dU(e,t){let n=t.tagID;n===p.CAPTION||n===p.TABLE||n===p.TBODY||n===p.TFOOT||n===p.THEAD||n===p.TR||n===p.TD||n===p.TH?(e.openElements.popUntilTagNamePopped(p.SELECT),e._resetInsertionMode(),e._processStartTag(t)):uk(e,t)}function hU(e,t){let n=t.tagID;n===p.CAPTION||n===p.TABLE||n===p.TBODY||n===p.TFOOT||n===p.THEAD||n===p.TR||n===p.TD||n===p.TH?e.openElements.hasInTableScope(n)&&(e.openElements.popUntilTagNamePopped(p.SELECT),e._resetInsertionMode(),e.onEndTag(t)):ck(e,t)}function pU(e,t){switch(t.tagID){case p.BASE:case p.BASEFONT:case p.BGSOUND:case p.LINK:case p.META:case p.NOFRAMES:case p.SCRIPT:case p.STYLE:case p.TEMPLATE:case p.TITLE:{Pr(e,t);break}case p.CAPTION:case p.COLGROUP:case p.TBODY:case p.TFOOT:case p.THEAD:{e.tmplInsertionModeStack[0]=w.IN_TABLE,e.insertionMode=w.IN_TABLE,gl(e,t);break}case p.COL:{e.tmplInsertionModeStack[0]=w.IN_COLUMN_GROUP,e.insertionMode=w.IN_COLUMN_GROUP,ME(e,t);break}case p.TR:{e.tmplInsertionModeStack[0]=w.IN_TABLE_BODY,e.insertionMode=w.IN_TABLE_BODY,qh(e,t);break}case p.TD:case p.TH:{e.tmplInsertionModeStack[0]=w.IN_ROW,e.insertionMode=w.IN_ROW,Vh(e,t);break}default:e.tmplInsertionModeStack[0]=w.IN_BODY,e.insertionMode=w.IN_BODY,dn(e,t)}}function mU(e,t){t.tagID===p.TEMPLATE&&Oo(e,t)}function fk(e,t){e.openElements.tmplCount>0?(e.openElements.popUntilTagNamePopped(p.TEMPLATE),e.activeFormattingElements.clearToLastMarker(),e.tmplInsertionModeStack.shift(),e._resetInsertionMode(),e.onEof(t)):wE(e,t)}function gU(e,t){t.tagID===p.HTML?dn(e,t):Hh(e,t)}function dk(e,t){var n;if(t.tagID===p.HTML){if(e.fragmentContext||(e.insertionMode=w.AFTER_AFTER_BODY),e.options.sourceCodeLocationInfo&&e.openElements.tagIDs[0]===p.HTML){e._setEndLocation(e.openElements.items[0],t);let r=e.openElements.items[1];r&&!(!((n=e.treeAdapter.getNodeSourceCodeLocation(r))===null||n===void 0)&&n.endTag)&&e._setEndLocation(r,t)}}else Hh(e,t)}function Hh(e,t){e.insertionMode=w.IN_BODY,zh(e,t)}function bU(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.FRAMESET:{e._insertElement(t,j.HTML);break}case p.FRAME:{e._appendElement(t,j.HTML),t.ackSelfClosing=!0;break}case p.NOFRAMES:{Pr(e,t);break}default:}}function EU(e,t){t.tagID===p.FRAMESET&&!e.openElements.isRootHtmlElementCurrent()&&(e.openElements.pop(),!e.fragmentContext&&e.openElements.currentTagId!==p.FRAMESET&&(e.insertionMode=w.AFTER_FRAMESET))}function yU(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.NOFRAMES:{Pr(e,t);break}default:}}function TU(e,t){t.tagID===p.HTML&&(e.insertionMode=w.AFTER_AFTER_FRAMESET)}function SU(e,t){t.tagID===p.HTML?dn(e,t):Ph(e,t)}function Ph(e,t){e.insertionMode=w.IN_BODY,zh(e,t)}function _U(e,t){switch(t.tagID){case p.HTML:{dn(e,t);break}case p.NOFRAMES:{Pr(e,t);break}default:}}function xU(e,t){t.chars=Qe,e._insertCharacters(t)}function AU(e,t){e._insertCharacters(t),e.framesetOk=!1}function hk(e){for(;e.treeAdapter.getNamespaceURI(e.openElements.current)!==j.HTML&&e.openElements.currentTagId!==void 0&&!e._isIntegrationPoint(e.openElements.currentTagId,e.openElements.current);)e.openElements.pop()}function CU(e,t){if(Yv(t))hk(e),e._startTagOutsideForeignContent(t);else{let n=e._getAdjustedCurrentElement(),r=e.treeAdapter.getNamespaceURI(n);r===j.MATHML?xE(t):r===j.SVG&&(Kv(t),AE(t)),Bh(t),t.selfClosing?e._appendElement(t,r):e._insertElement(t,r),t.ackSelfClosing=!0}}function NU(e,t){if(t.tagID===p.P||t.tagID===p.BR){hk(e),e._endTagOutsideForeignContent(t);return}for(let n=e.openElements.stackTop;n>0;n--){let r=e.openElements.items[n];if(e.treeAdapter.getNamespaceURI(r)===j.HTML){e._endTagOutsideForeignContent(t);break}let i=e.treeAdapter.getTagName(r);if(i.toLowerCase()===t.tagName){t.tagName=i,e.openElements.shortenToLength(n);break}}}var rte=String.prototype.codePointAt==null?(e,t)=>(e.charCodeAt(t)&64512)===55296?(e.charCodeAt(t)-55296)*1024+e.charCodeAt(t+1)-56320+65536:e.charCodeAt(t):(e,t)=>e.codePointAt(t);var cte=new Set([I.AREA,I.BASE,I.BASEFONT,I.BGSOUND,I.BR,I.COL,I.EMBED,I.FRAME,I.HR,I.IMG,I.INPUT,I.KEYGEN,I.LINK,I.META,I.PARAM,I.SOURCE,I.TRACK,I.WBR]);function pk(e,t,n){typeof e=="string"&&(n=t,t=e,e=null);let r=Pa.getFragmentParser(e,n);return r.tokenizer.write(t,!0),r.getFragment()}var Ur={basename:vU,dirname:kU,extname:wU,join:MU,sep:"/"};function vU(e,t){if(t!==void 0&&typeof t!="string")throw new TypeError('"ext" argument must be a string');Ac(e);let n=0,r=-1,i=e.length,a;if(t===void 0||t.length===0||t.length>e.length){for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else r<0&&(a=!0,r=i+1);return r<0?"":e.slice(n,r)}if(t===e)return"";let o=-1,s=t.length-1;for(;i--;)if(e.codePointAt(i)===47){if(a){n=i+1;break}}else o<0&&(a=!0,o=i+1),s>-1&&(e.codePointAt(i)===t.codePointAt(s--)?s<0&&(r=i):(s=-1,r=o));return n===r?r=o:r<0&&(r=e.length),e.slice(n,r)}function kU(e){if(Ac(e),e.length===0)return".";let t=-1,n=e.length,r;for(;--n;)if(e.codePointAt(n)===47){if(r){t=n;break}}else r||(r=!0);return t<0?e.codePointAt(0)===47?"/":".":t===1&&e.codePointAt(0)===47?"//":e.slice(0,t)}function wU(e){Ac(e);let t=e.length,n=-1,r=0,i=-1,a=0,o;for(;t--;){let s=e.codePointAt(t);if(s===47){if(o){r=t+1;break}continue}n<0&&(o=!0,n=t+1),s===46?i<0?i=t:a!==1&&(a=1):i>-1&&(a=-1)}return i<0||n<0||a===0||a===1&&i===n-1&&i===r+1?"":e.slice(i,n)}function MU(...e){let t=-1,n;for(;++t0&&e.codePointAt(e.length-1)===47&&(n+="/"),t?"/"+n:n}function RU(e,t){let n="",r=0,i=-1,a=0,o=-1,s,l;for(;++o<=e.length;){if(o2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),i=o,a=0;continue}}else if(n.length>0){n="",r=0,i=o,a=0;continue}}t&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+e.slice(i+1,o):n=e.slice(i+1,o),r=o-i-1;i=o,a=0}else s===46&&a>-1?a++:a=-1}return n}function Ac(e){if(typeof e!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(e))}var mk={cwd:DU};function DU(){return"/"}function bl(e){return!!(e!==null&&typeof e=="object"&&"href"in e&&e.href&&"protocol"in e&&e.protocol&&e.auth===void 0)}function gk(e){if(typeof e=="string")e=new URL(e);else if(!bl(e)){let t=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+e+"`");throw t.code="ERR_INVALID_ARG_TYPE",t}if(e.protocol!=="file:"){let t=new TypeError("The URL must be of scheme file");throw t.code="ERR_INVALID_URL_SCHEME",t}return IU(e)}function IU(e){if(e.hostname!==""){let r=new TypeError('File URL host must be "localhost" or empty on darwin');throw r.code="ERR_INVALID_FILE_URL_HOST",r}let t=e.pathname,n=-1;for(;++n":""))+")"})}return d;function d(){let h=Ek,m,b,E;if((!t||a(l,u,c[c.length-1]||void 0))&&(h=FU(n(l,c)),h[0]===Do))return h;if("children"in l&&l.children){let g=l;if(g.children&&h[0]!==ei)for(b=(r?g.children.length:-1)+o,E=c.concat(g);b>-1&&bi||n!==-1&&t>n||r!==-1&&t>r||VU.test(e.slice(0,t)))}function IE(e){ht(e,"element",t=>{for(let[n,r]of Object.entries(qU)){if(r!==null&&!r.includes(t.tagName))continue;let i=t.properties?.[n];typeof i=="string"&&!GU(i)&&(t.properties[n]="")}})}var El="dataPending";function Kh(e){return typeof e=="string"?e.split(/\s+/).includes("suggestion"):Array.isArray(e)?e.includes("suggestion"):!1}function Nc(e){return e?e.map(t=>t.type==="text"?t.value:t.type==="element"?Nc(t.children):"").join("").trim():""}function yl(e){if(e.type!=="element")return!1;let t=e.properties;return t?Kh(t.className)||"dataSuggestion"in t:!1}var YU="markdown-stream-dot";function KU(){return{type:"element",tagName:"svg",properties:{width:12,height:12,viewBox:"0 0 12 12",xmlns:"http://www.w3.org/2000/svg",className:[YU],style:"margin-left:.25em;margin-top:-.25em",ariaHidden:"true"},children:[{type:"element",tagName:"circle",properties:{cx:6,cy:6,r:6},children:[]}]}}var $U=new Set(["p","div","pre","ul","ol"]),jU=new Set(["p","h1","h2","h3","h4","h5","h6","li","code"]);function XU(e){return e.type==="text"?/\S/.test(e.value):!1}function WU(e){return e.tagName!=="ul"&&e.tagName!=="ol"?!1:e.properties!=null&&El in e.properties}function yk(e){if(e.children.length===0)return e;let t=QU(e),n={...e,children:[...e.children]},r=n.children;for(let i=0;i=0;l--){let u=i[l];if(u.type!=="doctype"&&(u.type==="element"||XU(u))){a=l,o=u;break}}if(!o||o.type!=="element")return t;let s=o.tagName;if($U.has(s)){if(t.push({index:a}),WU(o))return t;n=o;continue}return jU.has(s)&&t.push({index:a}),t}return t}function Tk(e){return e.type==="text"&&e.value.trim()!==""}function $h(e){return e.filter(t=>t.type==="element"||t.type==="text"&&t.value.trim()!=="")}function Sk(e){let t=e.children;if(t.some(Tk))return!1;let n=t.filter(r=>r.type==="element");if(n.length===0)return!1;for(let r of n){if(r.tagName!=="li")return!1;let i=r.children;if(i.some(Tk))return!1;let a=$h(i).filter(s=>s.type==="element");if(a.length!==1)return!1;let o=a[0];if(!o||!yl(o))return!1}return!0}function LE(e,...t){let n;Array.isArray(e)?n=[...e]:typeof e=="string"&&e.trim()!==""?n=e.split(/\s+/).filter(Boolean):n=[];for(let r of t)n.includes(r)||n.push(r);return n}function ZU(e,...t){let n;return Array.isArray(e)?n=[...e]:typeof e=="string"&&e.trim()!==""?n=e.split(/\s+/).filter(Boolean):n=[],n.filter(r=>!t.includes(String(r)))}function _k(e,t){return{type:"element",tagName:"div",properties:{className:[e]},children:t}}function JU(e,t){return _k(e,[{type:"text",value:t}])}function xk(e,t){let n=["shiny-chat-suggestion-list"];t&&n.push("shiny-chat-suggestion-list--ordered"),e.properties.className=LE(e.properties.className,...n),e.properties.role="list";let r=0;for(let i of e.children){if(i.type!=="element"||i.tagName!=="li")continue;let a=i.children,o=$h(a).find(yl),s=Nc(o.children),l=o.properties.title,u=typeof l=="string"&&l.trim()!==""?l.trim():null,c=u?JU("shiny-chat-suggestion-list-item-title",u):null,f=_k("shiny-chat-suggestion-list-item-body",o.children);o.children=c?[c,f]:[f],o.properties.className=LE(o.properties.className,"shiny-chat-suggestion-list-item");let d=o.properties.dataSuggestion;if(typeof d=="string"&&d!==""||(o.properties.dataSuggestion=s),t){let b=r+1;o.properties.ariaLabel=u?`Use chat suggestion #${b}: ${u} \u2014 ${s}`:`Use chat suggestion #${b}: ${s}`}else o.properties.ariaLabel=u?`Use chat suggestion: ${u} \u2014 ${s}`:`Use chat suggestion: ${s}`;let h=o.properties.style,m=`--_card-index:${r}`;o.properties.style=typeof h=="string"&&h!==""?`${m};${h}`:m,delete o.properties.title,i.properties.role="listitem",r++}}var eH=/^\s*<(s(p(a(n(\s[^>]*)?)?)?)?)?$/i;function tH(e){let n=e.children.filter(s=>s.type==="element");if(n.length===0)return!1;let r=n[n.length-1];if(r.tagName!=="li")return!1;let i=n.slice(0,-1),a=!1;for(let s of i){if(s.tagName!=="li")return!1;let l=s.children,u=$h(l);if(u.length!==0){if(u.length===1&&yl(u[0])){a=!0;continue}return!1}}let o=$h(r.children);if(o.length!==0){if(o.length===1&&yl(o[0]))a=!0;else if(!(o.length===1&&o[0].type==="text"&&eH.test(o[0].value)))return!1}return a||n.length===1}function nH(e,t){let n=["shiny-chat-suggestion-list"];t&&n.push("shiny-chat-suggestion-list--ordered"),e.properties.className=LE(e.properties.className,...n),e.properties[El]=""}function rH(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n&&n.type==="element")return n}return null}var BE=()=>e=>{let t=rH(e.children);for(let n of e.children){if(n.type!=="element")continue;let r=n;if(!(r.tagName!=="ul"&&r.tagName!=="ol")){if(r===t){tH(r)&&nH(r,r.tagName==="ol");continue}Sk(r)&&xk(r,r.tagName==="ol")}}};function iH(e){return{...e,properties:{...e.properties},children:e.children.map(n=>{if(n.type!=="element"||n.tagName!=="li")return n;let r=n;return{...r,properties:{...r.properties},children:r.children.map(a=>{if(!yl(a))return a;let o=a;return{...o,properties:{...o.properties},children:[...o.children]}})}})}}function Ak(e){let t=[];for(let r=0;r(0,Tl.jsx)(e,typeof e=="string"?Ck(e,t):t,n),sH=(e,t,n)=>(0,Tl.jsxs)(e,typeof e=="string"?Ck(e,t):t,n);function Nk(e,t){let n=new Ro(e),r=t.runSync(t.parse(n),n);return IE(r),r}function vk(e,t){let n=cc(pk(e));return t.runSync(n),IE(n),n}function kk(e,t){let{tagToComponentMap:n,streaming:r}=t,i=r?e:Ak(e),a=r?yk(i):i;return uE(a,{Fragment:Tl.Fragment,jsx:oH,jsxs:sH,components:n,passKeys:!0,passNode:!0,ignoreInvalidStyle:!0})}function PE(e){if(e)throw e}var Wh=q(Pk(),1);function vc(e){if(typeof e!="object"||e===null)return!1;let t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function UE(){let e=[],t={run:n,use:r};return t;function n(...i){let a=-1,o=i.pop();if(typeof o!="function")throw new TypeError("Expected function as last argument, not "+o);s(null,...i);function s(l,...u){let c=e[++a],f=-1;if(l){o(l);return}for(;++fo.length,l;s&&o.push(i);try{l=e.apply(this,o)}catch(u){let c=u;if(s&&n)throw c;return i(c)}s||(l&&l.then&&typeof l.then=="function"?l.then(a,i):l instanceof Error?i(l):a(l))}function i(o,...s){n||(n=!0,t(o,...s))}function a(o){i(null,o)}}var Hk=function(e){let r=this.constructor.prototype,i=r[e],a=function(){return i.apply(a,arguments)};return Object.setPrototypeOf(a,r),a};var lH={}.hasOwnProperty,qE=class e extends Hk{constructor(){super("copy"),this.Compiler=void 0,this.Parser=void 0,this.attachers=[],this.compiler=void 0,this.freezeIndex=-1,this.frozen=void 0,this.namespace={},this.parser=void 0,this.transformers=UE()}copy(){let t=new e,n=-1;for(;++n0){let[h,...m]=c,b=r[d][1];vc(b)&&vc(h)&&(h=(0,Wh.default)(!0,b,h)),r[d]=[u,h,...m]}}}},kc=new qE().freeze();function HE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `parser`")}function zE(e,t){if(typeof t!="function")throw new TypeError("Cannot `"+e+"` without `compiler`")}function FE(e,t){if(t)throw new Error("Cannot call `"+e+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function zk(e){if(!vc(e)||typeof e.type!="string")throw new TypeError("Expected node, got `"+e+"`")}function Fk(e,t,n){if(!n)throw new Error("`"+e+"` finished async. Use `"+t+"` instead")}function Xh(e){return uH(e)?e:new Ro(e)}function uH(e){return!!(e&&typeof e=="object"&&"message"in e&&"messages"in e)}function cH(e){return typeof e=="string"||fH(e)}function fH(e){return!!(e&&typeof e=="object"&&"byteLength"in e&&"byteOffset"in e)}var dH={};function Io(e,t){let n=t||dH,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,i=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return Vk(e,r,i)}function Vk(e,t,n){if(hH(e)){if("value"in e)return e.type==="html"&&!n?"":e.value;if(t&&"alt"in e&&e.alt)return e.alt;if("children"in e)return qk(e.children,t,n)}return Array.isArray(e)?qk(e,t,n):""}function qk(e,t,n){let r=[],i=-1;for(;++ii?0:i+t:t=t>i?i:t,n=n>0?n:0,r.length<1e4)o=Array.from(r),o.unshift(t,n),e.splice(...o);else for(n&&e.splice(t,n);a0?(kt(e,e.length,0,t),e):t}var Yk={}.hasOwnProperty;function Qh(e){let t={},n=-1;for(;++n13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCodePoint(n)}function hn(e){return e.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var zt=Ua(/[A-Za-z]/),Tt=Ua(/[\dA-Za-z]/),Kk=Ua(/[#-'*+\--9=?A-Z^-~]/);function Lo(e){return e!==null&&(e<32||e===127)}var wc=Ua(/\d/),$k=Ua(/[\dA-Fa-f]/),jk=Ua(/[!-/:-@[-`{-~]/);function te(e){return e!==null&&e<-2}function ve(e){return e!==null&&(e<0||e===32)}function he(e){return e===-2||e===-1||e===32}var Bo=Ua(/\p{P}|\p{S}/u),ti=Ua(/\s/);function Ua(e){return t;function t(n){return n!==null&&n>-1&&e.test(String.fromCharCode(n))}}function xr(e){let t=[],n=-1,r=0,i=0;for(;++n55295&&a<57344){let s=e.charCodeAt(n+1);a<56320&&s>56319&&s<57344?(o=String.fromCharCode(a,s),i=1):o="\uFFFD"}else o=String.fromCharCode(a);o&&(t.push(e.slice(r,n),encodeURIComponent(o)),r=n+i+1,o=""),i&&(n+=i,i=0)}return t.join("")+e.slice(r)}function de(e,t,n,r){let i=r?r-1:Number.POSITIVE_INFINITY,a=0;return o;function o(l){return he(l)?(e.enter(n),s(l)):t(l)}function s(l){return he(l)&&a++o))return;let M=t.events.length,R=M,L,A;for(;R--;)if(t.events[R][0]==="exit"&&t.events[R][1].type==="chunkFlow"){if(L){A=t.events[R][1].end;break}L=!0}for(g(r),x=M;xT;){let v=n[S];t.containerState=v[1],v[0].exit.call(t,e)}n.length=T}function y(){i.write([null]),a=void 0,i=void 0,t.containerState._closeFlow=void 0}}function EH(e,t,n){return de(e,e.attempt(this.parser.constructs.document,t,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function Pi(e){if(e===null||ve(e)||ti(e))return 1;if(Bo(e))return 2}function Ha(e,t,n){let r=[],i=-1;for(;++i1&&e[n][1].end.offset-e[n][1].start.offset>1?2:1;let f={...e[r][1].end},d={...e[n][1].start};Zk(f,-l),Zk(d,l),o={type:l>1?"strongSequence":"emphasisSequence",start:f,end:{...e[r][1].end}},s={type:l>1?"strongSequence":"emphasisSequence",start:{...e[n][1].start},end:d},a={type:l>1?"strongText":"emphasisText",start:{...e[r][1].end},end:{...e[n][1].start}},i={type:l>1?"strong":"emphasis",start:{...o.start},end:{...s.end}},e[r][1].end={...o.start},e[n][1].start={...s.end},u=[],e[r][1].end.offset-e[r][1].start.offset&&(u=An(u,[["enter",e[r][1],t],["exit",e[r][1],t]])),u=An(u,[["enter",i,t],["enter",o,t],["exit",o,t],["enter",a,t]]),u=An(u,Ha(t.parser.constructs.insideSpan.null,e.slice(r+1,n),t)),u=An(u,[["exit",a,t],["enter",s,t],["exit",s,t],["exit",i,t]]),e[n][1].end.offset-e[n][1].start.offset?(c=2,u=An(u,[["enter",e[n][1],t],["exit",e[n][1],t]])):c=0,kt(e,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&he(x)?de(e,y,"linePrefix",a+1)(x):y(x)}function y(x){return x===null||te(x)?e.check(Jk,b,S)(x):(e.enter("codeFlowValue"),T(x))}function T(x){return x===null||te(x)?(e.exit("codeFlowValue"),y(x)):(e.consume(x),T)}function S(x){return e.exit("codeFenced"),t(x)}function v(x,M,R){let L=0;return A;function A($){return x.enter("lineEnding"),x.consume($),x.exit("lineEnding"),H}function H($){return x.enter("codeFencedFence"),he($)?de(x,Y,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)($):Y($)}function Y($){return $===s?(x.enter("codeFencedFenceSequence"),z($)):R($)}function z($){return $===s?(L++,x.consume($),z):L>=o?(x.exit("codeFencedFenceSequence"),he($)?de(x,V,"whitespace")($):V($)):R($)}function V($){return $===null||te($)?(x.exit("codeFencedFence"),M($)):R($)}}}function wH(e,t,n){let r=this;return i;function i(o){return o===null?n(o):(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}var Oc={name:"codeIndented",tokenize:OH},MH={partial:!0,tokenize:RH};function OH(e,t,n){let r=this;return i;function i(u){return e.enter("codeIndented"),de(e,a,"linePrefix",5)(u)}function a(u){let c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?o(u):n(u)}function o(u){return u===null?l(u):te(u)?e.attempt(MH,o,l)(u):(e.enter("codeFlowValue"),s(u))}function s(u){return u===null||te(u)?(e.exit("codeFlowValue"),o(u)):(e.consume(u),s)}function l(u){return e.exit("codeIndented"),t(u)}}function RH(e,t,n){let r=this;return i;function i(o){return r.parser.lazy[r.now().line]?n(o):te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),i):de(e,a,"linePrefix",5)(o)}function a(o){let s=r.events[r.events.length-1];return s&&s[1].type==="linePrefix"&&s[2].sliceSerialize(s[1],!0).length>=4?t(o):te(o)?i(o):n(o)}}var GE={name:"codeText",previous:IH,resolve:DH,tokenize:LH};function DH(e){let t=e.length-4,n=3,r,i;if((e[n][1].type==="lineEnding"||e[n][1].type==="space")&&(e[t][1].type==="lineEnding"||e[t][1].type==="space")){for(r=n;++r=this.left.length+this.right.length)throw new RangeError("Cannot access index `"+t+"` in a splice buffer of size `"+(this.left.length+this.right.length)+"`");return tthis.left.length?this.right.slice(this.right.length-r+this.left.length,this.right.length-t+this.left.length).reverse():this.left.slice(t).concat(this.right.slice(this.right.length-r+this.left.length).reverse())}splice(t,n,r){let i=n||0;this.setCursor(Math.trunc(t));let a=this.right.splice(this.right.length-i,Number.POSITIVE_INFINITY);return r&&Rc(this.left,r),a.reverse()}pop(){return this.setCursor(Number.POSITIVE_INFINITY),this.left.pop()}push(t){this.setCursor(Number.POSITIVE_INFINITY),this.left.push(t)}pushMany(t){this.setCursor(Number.POSITIVE_INFINITY),Rc(this.left,t)}unshift(t){this.setCursor(0),this.right.push(t)}unshiftMany(t){this.setCursor(0),Rc(this.right,t.reverse())}setCursor(t){if(!(t===this.left.length||t>this.left.length&&this.right.length===0||t<0&&this.left.length===0))if(t=4?t(o):e.interrupt(r.parser.constructs.flow,n,t)(o)}}function ap(e,t,n,r,i,a,o,s,l){let u=l||Number.POSITIVE_INFINITY,c=0;return f;function f(g){return g===60?(e.enter(r),e.enter(i),e.enter(a),e.consume(g),e.exit(a),d):g===null||g===32||g===41||Lo(g)?n(g):(e.enter(r),e.enter(o),e.enter(s),e.enter("chunkString",{contentType:"string"}),b(g))}function d(g){return g===62?(e.enter(a),e.consume(g),e.exit(a),e.exit(i),e.exit(r),t):(e.enter(s),e.enter("chunkString",{contentType:"string"}),h(g))}function h(g){return g===62?(e.exit("chunkString"),e.exit(s),d(g)):g===null||g===60||te(g)?n(g):(e.consume(g),g===92?m:h)}function m(g){return g===60||g===62||g===92?(e.consume(g),h):h(g)}function b(g){return!c&&(g===null||g===41||ve(g))?(e.exit("chunkString"),e.exit(s),e.exit(o),e.exit(r),t(g)):c999||h===null||h===91||h===93&&!l||h===94&&!s&&"_hiddenFootnoteSupport"in o.parser.constructs?n(h):h===93?(e.exit(a),e.enter(i),e.consume(h),e.exit(i),e.exit(r),t):te(h)?(e.enter("lineEnding"),e.consume(h),e.exit("lineEnding"),c):(e.enter("chunkString",{contentType:"string"}),f(h))}function f(h){return h===null||h===91||h===93||te(h)||s++>999?(e.exit("chunkString"),c(h)):(e.consume(h),l||(l=!he(h)),h===92?d:f)}function d(h){return h===91||h===92||h===93?(e.consume(h),s++,f):f(h)}}function sp(e,t,n,r,i,a){let o;return s;function s(d){return d===34||d===39||d===40?(e.enter(r),e.enter(i),e.consume(d),e.exit(i),o=d===40?41:d,l):n(d)}function l(d){return d===o?(e.enter(i),e.consume(d),e.exit(i),e.exit(r),t):(e.enter(a),u(d))}function u(d){return d===o?(e.exit(a),l(o)):d===null?n(d):te(d)?(e.enter("lineEnding"),e.consume(d),e.exit("lineEnding"),de(e,u,"linePrefix")):(e.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===o||d===null||te(d)?(e.exit("chunkString"),u(d)):(e.consume(d),d===92?f:c)}function f(d){return d===o||d===92?(e.consume(d),c):c(d)}}function Po(e,t){let n;return r;function r(i){return te(i)?(e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),n=!0,r):he(i)?de(e,r,n?"linePrefix":"lineSuffix")(i):t(i)}}var KE={name:"definition",tokenize:qH},FH={partial:!0,tokenize:VH};function qH(e,t,n){let r=this,i;return a;function a(h){return e.enter("definition"),o(h)}function o(h){return op.call(r,e,s,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(h)}function s(h){return i=hn(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),h===58?(e.enter("definitionMarker"),e.consume(h),e.exit("definitionMarker"),l):n(h)}function l(h){return ve(h)?Po(e,u)(h):u(h)}function u(h){return ap(e,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(h)}function c(h){return e.attempt(FH,f,f)(h)}function f(h){return he(h)?de(e,d,"whitespace")(h):d(h)}function d(h){return h===null||te(h)?(e.exit("definition"),r.parser.defined.push(i),t(h)):n(h)}}function VH(e,t,n){return r;function r(s){return ve(s)?Po(e,i)(s):n(s)}function i(s){return sp(e,a,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(s)}function a(s){return he(s)?de(e,o,"whitespace")(s):o(s)}function o(s){return s===null||te(s)?t(s):n(s)}}var $E={name:"hardBreakEscape",tokenize:GH};function GH(e,t,n){return r;function r(a){return e.enter("hardBreakEscape"),e.consume(a),i}function i(a){return te(a)?(e.exit("hardBreakEscape"),t(a)):n(a)}}var jE={name:"headingAtx",resolve:YH,tokenize:KH};function YH(e,t){let n=e.length-2,r=3,i,a;return e[r][1].type==="whitespace"&&(r+=2),n-2>r&&e[n][1].type==="whitespace"&&(n-=2),e[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&e[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(i={type:"atxHeadingText",start:e[r][1].start,end:e[n][1].end},a={type:"chunkText",start:e[r][1].start,end:e[n][1].end,contentType:"text"},kt(e,r,n-r+1,[["enter",i,t],["enter",a,t],["exit",a,t],["exit",i,t]])),e}function KH(e,t,n){let r=0;return i;function i(c){return e.enter("atxHeading"),a(c)}function a(c){return e.enter("atxHeadingSequence"),o(c)}function o(c){return c===35&&r++<6?(e.consume(c),o):c===null||ve(c)?(e.exit("atxHeadingSequence"),s(c)):n(c)}function s(c){return c===35?(e.enter("atxHeadingSequence"),l(c)):c===null||te(c)?(e.exit("atxHeading"),t(c)):he(c)?de(e,s,"whitespace")(c):(e.enter("atxHeadingText"),u(c))}function l(c){return c===35?(e.consume(c),l):(e.exit("atxHeadingSequence"),s(c))}function u(c){return c===null||c===35||ve(c)?(e.exit("atxHeadingText"),s(c)):(e.consume(c),u)}}var e2=["address","article","aside","base","basefont","blockquote","body","caption","center","col","colgroup","dd","details","dialog","dir","div","dl","dt","fieldset","figcaption","figure","footer","form","frame","frameset","h1","h2","h3","h4","h5","h6","head","header","hr","html","iframe","legend","li","link","main","menu","menuitem","nav","noframes","ol","optgroup","option","p","param","search","section","summary","table","tbody","td","tfoot","th","thead","title","tr","track","ul"],XE=["pre","script","style","textarea"];var WE={concrete:!0,name:"htmlFlow",resolveTo:XH,tokenize:WH},$H={partial:!0,tokenize:ZH},jH={partial:!0,tokenize:QH};function XH(e){let t=e.length;for(;t--&&!(e[t][0]==="enter"&&e[t][1].type==="htmlFlow"););return t>1&&e[t-2][1].type==="linePrefix"&&(e[t][1].start=e[t-2][1].start,e[t+1][1].start=e[t-2][1].start,e.splice(t-2,2)),e}function WH(e,t,n){let r=this,i,a,o,s,l;return u;function u(k){return c(k)}function c(k){return e.enter("htmlFlow"),e.enter("htmlFlowData"),e.consume(k),f}function f(k){return k===33?(e.consume(k),d):k===47?(e.consume(k),a=!0,b):k===63?(e.consume(k),i=3,r.interrupt?t:N):zt(k)?(e.consume(k),o=String.fromCharCode(k),E):n(k)}function d(k){return k===45?(e.consume(k),i=2,h):k===91?(e.consume(k),i=5,s=0,m):zt(k)?(e.consume(k),i=4,r.interrupt?t:N):n(k)}function h(k){return k===45?(e.consume(k),r.interrupt?t:N):n(k)}function m(k){let Te="CDATA[";return k===Te.charCodeAt(s++)?(e.consume(k),s===Te.length?r.interrupt?t:Y:m):n(k)}function b(k){return zt(k)?(e.consume(k),o=String.fromCharCode(k),E):n(k)}function E(k){if(k===null||k===47||k===62||ve(k)){let Te=k===47,be=o.toLowerCase();return!Te&&!a&&XE.includes(be)?(i=1,r.interrupt?t(k):Y(k)):e2.includes(o.toLowerCase())?(i=6,Te?(e.consume(k),g):r.interrupt?t(k):Y(k)):(i=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(k):a?y(k):T(k))}return k===45||Tt(k)?(e.consume(k),o+=String.fromCharCode(k),E):n(k)}function g(k){return k===62?(e.consume(k),r.interrupt?t:Y):n(k)}function y(k){return he(k)?(e.consume(k),y):A(k)}function T(k){return k===47?(e.consume(k),A):k===58||k===95||zt(k)?(e.consume(k),S):he(k)?(e.consume(k),T):A(k)}function S(k){return k===45||k===46||k===58||k===95||Tt(k)?(e.consume(k),S):v(k)}function v(k){return k===61?(e.consume(k),x):he(k)?(e.consume(k),v):T(k)}function x(k){return k===null||k===60||k===61||k===62||k===96?n(k):k===34||k===39?(e.consume(k),l=k,M):he(k)?(e.consume(k),x):R(k)}function M(k){return k===l?(e.consume(k),l=null,L):k===null||te(k)?n(k):(e.consume(k),M)}function R(k){return k===null||k===34||k===39||k===47||k===60||k===61||k===62||k===96||ve(k)?v(k):(e.consume(k),R)}function L(k){return k===47||k===62||he(k)?T(k):n(k)}function A(k){return k===62?(e.consume(k),H):n(k)}function H(k){return k===null||te(k)?Y(k):he(k)?(e.consume(k),H):n(k)}function Y(k){return k===45&&i===2?(e.consume(k),D):k===60&&i===1?(e.consume(k),B):k===62&&i===4?(e.consume(k),ae):k===63&&i===3?(e.consume(k),N):k===93&&i===5?(e.consume(k),F):te(k)&&(i===6||i===7)?(e.exit("htmlFlowData"),e.check($H,ce,z)(k)):k===null||te(k)?(e.exit("htmlFlowData"),z(k)):(e.consume(k),Y)}function z(k){return e.check(jH,V,ce)(k)}function V(k){return e.enter("lineEnding"),e.consume(k),e.exit("lineEnding"),$}function $(k){return k===null||te(k)?z(k):(e.enter("htmlFlowData"),Y(k))}function D(k){return k===45?(e.consume(k),N):Y(k)}function B(k){return k===47?(e.consume(k),o="",K):Y(k)}function K(k){if(k===62){let Te=o.toLowerCase();return XE.includes(Te)?(e.consume(k),ae):Y(k)}return zt(k)&&o.length<8?(e.consume(k),o+=String.fromCharCode(k),K):Y(k)}function F(k){return k===93?(e.consume(k),N):Y(k)}function N(k){return k===62?(e.consume(k),ae):k===45&&i===2?(e.consume(k),N):Y(k)}function ae(k){return k===null||te(k)?(e.exit("htmlFlowData"),ce(k)):(e.consume(k),ae)}function ce(k){return e.exit("htmlFlow"),t(k)}}function QH(e,t,n){let r=this;return i;function i(o){return te(o)?(e.enter("lineEnding"),e.consume(o),e.exit("lineEnding"),a):n(o)}function a(o){return r.parser.lazy[r.now().line]?n(o):t(o)}}function ZH(e,t,n){return r;function r(i){return e.enter("lineEnding"),e.consume(i),e.exit("lineEnding"),e.attempt(ni,t,n)}}var QE={name:"htmlText",tokenize:JH};function JH(e,t,n){let r=this,i,a,o;return s;function s(N){return e.enter("htmlText"),e.enter("htmlTextData"),e.consume(N),l}function l(N){return N===33?(e.consume(N),u):N===47?(e.consume(N),v):N===63?(e.consume(N),T):zt(N)?(e.consume(N),R):n(N)}function u(N){return N===45?(e.consume(N),c):N===91?(e.consume(N),a=0,m):zt(N)?(e.consume(N),y):n(N)}function c(N){return N===45?(e.consume(N),h):n(N)}function f(N){return N===null?n(N):N===45?(e.consume(N),d):te(N)?(o=f,B(N)):(e.consume(N),f)}function d(N){return N===45?(e.consume(N),h):f(N)}function h(N){return N===62?D(N):N===45?d(N):f(N)}function m(N){let ae="CDATA[";return N===ae.charCodeAt(a++)?(e.consume(N),a===ae.length?b:m):n(N)}function b(N){return N===null?n(N):N===93?(e.consume(N),E):te(N)?(o=b,B(N)):(e.consume(N),b)}function E(N){return N===93?(e.consume(N),g):b(N)}function g(N){return N===62?D(N):N===93?(e.consume(N),g):b(N)}function y(N){return N===null||N===62?D(N):te(N)?(o=y,B(N)):(e.consume(N),y)}function T(N){return N===null?n(N):N===63?(e.consume(N),S):te(N)?(o=T,B(N)):(e.consume(N),T)}function S(N){return N===62?D(N):T(N)}function v(N){return zt(N)?(e.consume(N),x):n(N)}function x(N){return N===45||Tt(N)?(e.consume(N),x):M(N)}function M(N){return te(N)?(o=M,B(N)):he(N)?(e.consume(N),M):D(N)}function R(N){return N===45||Tt(N)?(e.consume(N),R):N===47||N===62||ve(N)?L(N):n(N)}function L(N){return N===47?(e.consume(N),D):N===58||N===95||zt(N)?(e.consume(N),A):te(N)?(o=L,B(N)):he(N)?(e.consume(N),L):D(N)}function A(N){return N===45||N===46||N===58||N===95||Tt(N)?(e.consume(N),A):H(N)}function H(N){return N===61?(e.consume(N),Y):te(N)?(o=H,B(N)):he(N)?(e.consume(N),H):L(N)}function Y(N){return N===null||N===60||N===61||N===62||N===96?n(N):N===34||N===39?(e.consume(N),i=N,z):te(N)?(o=Y,B(N)):he(N)?(e.consume(N),Y):(e.consume(N),V)}function z(N){return N===i?(e.consume(N),i=void 0,$):N===null?n(N):te(N)?(o=z,B(N)):(e.consume(N),z)}function V(N){return N===null||N===34||N===39||N===60||N===61||N===96?n(N):N===47||N===62||ve(N)?L(N):(e.consume(N),V)}function $(N){return N===47||N===62||ve(N)?L(N):n(N)}function D(N){return N===62?(e.consume(N),e.exit("htmlTextData"),e.exit("htmlText"),t):n(N)}function B(N){return e.exit("htmlTextData"),e.enter("lineEnding"),e.consume(N),e.exit("lineEnding"),K}function K(N){return he(N)?de(e,F,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(N):F(N)}function F(N){return e.enter("htmlTextData"),o(N)}}var Uo={name:"labelEnd",resolveAll:rz,resolveTo:iz,tokenize:az},ez={tokenize:oz},tz={tokenize:sz},nz={tokenize:lz};function rz(e){let t=-1,n=[];for(;++t=3&&(u===null||te(u))?(e.exit("thematicBreak"),t(u)):n(u)}function l(u){return u===i?(e.consume(u),r++,l):(e.exit("thematicBreakSequence"),he(u)?de(e,s,"whitespace")(u):s(u))}}var pn={continuation:{tokenize:gz},exit:Ez,name:"list",tokenize:mz},hz={partial:!0,tokenize:yz},pz={partial:!0,tokenize:bz};function mz(e,t,n){let r=this,i=r.events[r.events.length-1],a=i&&i[1].type==="linePrefix"?i[2].sliceSerialize(i[1],!0).length:0,o=0;return s;function s(h){let m=r.containerState.type||(h===42||h===43||h===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||h===r.containerState.marker:wc(h)){if(r.containerState.type||(r.containerState.type=m,e.enter(m,{_container:!0})),m==="listUnordered")return e.enter("listItemPrefix"),h===42||h===45?e.check(Ho,n,u)(h):u(h);if(!r.interrupt||h===49)return e.enter("listItemPrefix"),e.enter("listItemValue"),l(h)}return n(h)}function l(h){return wc(h)&&++o<10?(e.consume(h),l):(!r.interrupt||o<2)&&(r.containerState.marker?h===r.containerState.marker:h===41||h===46)?(e.exit("listItemValue"),u(h)):n(h)}function u(h){return e.enter("listItemMarker"),e.consume(h),e.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||h,e.check(ni,r.interrupt?n:c,e.attempt(hz,d,f))}function c(h){return r.containerState.initialBlankLine=!0,a++,d(h)}function f(h){return he(h)?(e.enter("listItemPrefixWhitespace"),e.consume(h),e.exit("listItemPrefixWhitespace"),d):n(h)}function d(h){return r.containerState.size=a+r.sliceSerialize(e.exit("listItemPrefix"),!0).length,t(h)}}function gz(e,t,n){let r=this;return r.containerState._closeFlow=void 0,e.check(ni,i,a);function i(s){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,de(e,t,"listItemIndent",r.containerState.size+1)(s)}function a(s){return r.containerState.furtherBlankLines||!he(s)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,o(s)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,e.attempt(pz,t,o)(s))}function o(s){return r.containerState._closeFlow=!0,r.interrupt=void 0,de(e,e.attempt(pn,t,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(s)}}function bz(e,t,n){let r=this;return de(e,i,"listItemIndent",r.containerState.size+1);function i(a){let o=r.events[r.events.length-1];return o&&o[1].type==="listItemIndent"&&o[2].sliceSerialize(o[1],!0).length===r.containerState.size?t(a):n(a)}}function Ez(e){e.exit(this.containerState.type)}function yz(e,t,n){let r=this;return de(e,i,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:5);function i(a){let o=r.events[r.events.length-1];return!he(a)&&o&&o[1].type==="listItemPrefixWhitespace"?t(a):n(a)}}var lp={name:"setextUnderline",resolveTo:Tz,tokenize:Sz};function Tz(e,t){let n=e.length,r,i,a;for(;n--;)if(e[n][0]==="enter"){if(e[n][1].type==="content"){r=n;break}e[n][1].type==="paragraph"&&(i=n)}else e[n][1].type==="content"&&e.splice(n,1),!a&&e[n][1].type==="definition"&&(a=n);let o={type:"setextHeading",start:{...e[r][1].start},end:{...e[e.length-1][1].end}};return e[i][1].type="setextHeadingText",a?(e.splice(i,0,["enter",o,t]),e.splice(a+1,0,["exit",e[r][1],t]),e[r][1].end={...e[a][1].end}):e[r][1]=o,e.push(["exit",o,t]),e}function Sz(e,t,n){let r=this,i;return a;function a(u){let c=r.events.length,f;for(;c--;)if(r.events[c][1].type!=="lineEnding"&&r.events[c][1].type!=="linePrefix"&&r.events[c][1].type!=="content"){f=r.events[c][1].type==="paragraph";break}return!r.parser.lazy[r.now().line]&&(r.interrupt||f)?(e.enter("setextHeadingLine"),i=u,o(u)):n(u)}function o(u){return e.enter("setextHeadingLineSequence"),s(u)}function s(u){return u===i?(e.consume(u),s):(e.exit("setextHeadingLineSequence"),he(u)?de(e,l,"lineSuffix")(u):l(u))}function l(u){return u===null||te(u)?(e.exit("setextHeadingLine"),t(u)):n(u)}}var t2={tokenize:_z};function _z(e){let t=this,n=e.attempt(ni,r,e.attempt(this.parser.constructs.flowInitial,i,de(e,e.attempt(this.parser.constructs.flow,i,e.attempt(YE,i)),"linePrefix")));return n;function r(a){if(a===null){e.consume(a);return}return e.enter("lineEndingBlank"),e.consume(a),e.exit("lineEndingBlank"),t.currentConstruct=void 0,n}function i(a){if(a===null){e.consume(a);return}return e.enter("lineEnding"),e.consume(a),e.exit("lineEnding"),t.currentConstruct=void 0,n}}var n2={resolveAll:o2()},r2=a2("string"),i2=a2("text");function a2(e){return{resolveAll:o2(e==="text"?xz:void 0),tokenize:t};function t(n){let r=this,i=this.parser.constructs[e],a=n.attempt(i,o,s);return o;function o(c){return u(c)?a(c):s(c)}function s(c){if(c===null){n.consume(c);return}return n.enter("data"),n.consume(c),l}function l(c){return u(c)?(n.exit("data"),a(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;let f=i[c],d=-1;if(f)for(;++dOz,contentInitial:()=>Cz,disable:()=>Rz,document:()=>Az,flow:()=>vz,flowInitial:()=>Nz,insideSpan:()=>Mz,string:()=>kz,text:()=>wz});var Az={42:pn,43:pn,45:pn,48:pn,49:pn,50:pn,51:pn,52:pn,53:pn,54:pn,55:pn,56:pn,57:pn,62:Jh},Cz={91:KE},Nz={[-2]:Oc,[-1]:Oc,32:Oc},vz={35:jE,42:Ho,45:[lp,Ho],60:WE,61:lp,95:Ho,96:np,126:np},kz={38:tp,92:ep},wz={[-5]:Dc,[-4]:Dc,[-3]:Dc,33:ZE,38:tp,42:Mc,60:[VE,QE],91:JE,92:[$E,ep],93:Uo,95:Mc,96:GE},Mz={null:[Mc,n2]},Oz={null:[42,95]},Rz={null:[]};function s2(e,t,n){let r={_bufferIndex:-1,_index:0,line:n&&n.line||1,column:n&&n.column||1,offset:n&&n.offset||0},i={},a=[],o=[],s=[],l=!0,u={attempt:L(M),check:L(R),consume:S,enter:v,exit:x,interrupt:L(R,{interrupt:!0})},c={code:null,containerState:{},defineSkip:g,events:[],now:E,parser:e,previous:null,sliceSerialize:m,sliceStream:b,write:h},f=t.tokenize.call(c,u),d;return t.resolveAll&&a.push(t),c;function h(z){return o=An(o,z),y(),o[o.length-1]!==null?[]:(A(t,0),c.events=Ha(a,c.events,c),c.events)}function m(z,V){return Iz(b(z),V)}function b(z){return Dz(o,z)}function E(){let{_bufferIndex:z,_index:V,line:$,column:D,offset:B}=r;return{_bufferIndex:z,_index:V,line:$,column:D,offset:B}}function g(z){i[z.line]=z.column,Y()}function y(){let z;for(;r._index-1){let s=o[0];typeof s=="string"?o[0]=s.slice(r):o.shift()}a>0&&o.push(e[i].slice(0,a))}return o}function Iz(e,t){let n=-1,r=[],i;for(;++n0){let xt=J.tokenStack[J.tokenStack.length-1];(xt[1]||c2).call(J,void 0,xt[0])}for(P.position={start:za(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:za(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye0?{type:"text",value:x}:void 0),x===!1?d.lastIndex=S+1:(m!==S&&y.push({type:"text",value:u.value.slice(m,S)}),Array.isArray(x)?y.push(...x):x&&y.push(x),m=S+T[0].length,g=!0),!d.global)break;T=d.exec(u.value)}return g?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=fl(e,"("),a=fl(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function h2(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ti(n)||Bo(n))&&(!t||n!==47)}p2.peek=aF;function Qz(){this.buffer()}function Zz(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function Jz(){this.buffer()}function eF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function tF(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function nF(e){this.exit(e)}function rF(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function iF(e){this.exit(e)}function aF(){return"["}function p2(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]"),a}function dy(){return{enter:{gfmFootnoteCallString:Qz,gfmFootnoteCall:Zz,gfmFootnoteDefinitionLabelString:Jz,gfmFootnoteDefinition:eF},exit:{gfmFootnoteCallString:tF,gfmFootnoteCall:nF,gfmFootnoteDefinitionLabelString:rF,gfmFootnoteDefinition:iF}}}function hy(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:p2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,a,o){let s=a.createTracker(o),l=s.move("[^"),u=a.enter("footnoteDefinition"),c=a.enter("label");return l+=s.move(a.safe(a.associationId(r),{before:l,after:"]"})),c(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?` -`:" ")+a.indentLines(a.containerFlow(r,s.current()),t?m2:oF))),u(),l}}function oF(e,t,n){return t===0?e:m2(e,t,n)}function m2(e,t,n){return(n?"":" ")+e}var sF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];g2.peek=cF;function py(){return{canContainEols:["delete"],enter:{strikethrough:lF},exit:{strikethrough:uF}}}function my(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:sF}],handlers:{delete:g2}}}function lF(e){this.enter({type:"delete",children:[]},e)}function uF(e){this.exit(e)}function g2(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function cF(){return"~"}function fF(e){return e.length}function E2(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||fF,a=[],o=[],s=[],l=[],u=0,c=-1;for(;++cu&&(u=e[c].length);++gl[g])&&(l[g]=T)}b.push(y)}o[c]=b,s[c]=E}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fl[f]&&(l[f]=y),h[f]=y),d[f]=T}o.splice(1,0,d),s.splice(1,0,h),c=-1;let m=[];for(;++c "),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),hF);return i(),o}function hF(e,t,n){return">"+(n?"":" ")+e}function S2(e,t){return T2(e,t.inConstruct,!0)&&!T2(e,t.notInConstruct,!1)}function T2(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++r0){let xt=J.tokenStack[J.tokenStack.length-1];(xt[1]||c2).call(J,void 0,xt[0])}for(P.position={start:za(O.length>0?O[0][1].start:{line:1,column:1,offset:0}),end:za(O.length>0?O[O.length-2][1].end:{line:1,column:1,offset:0})},ye=-1;++ye0?{type:"text",value:x}:void 0),x===!1?d.lastIndex=S+1:(m!==S&&y.push({type:"text",value:u.value.slice(m,S)}),Array.isArray(x)?y.push(...x):x&&y.push(x),m=S+T[0].length,g=!0),!d.global)break;T=d.exec(u.value)}return g?(m?\]}]+$/.exec(e);if(!t)return[e,void 0];e=e.slice(0,t.index);let n=t[0],r=n.indexOf(")"),i=fl(e,"("),a=fl(e,")");for(;r!==-1&&i>a;)e+=n.slice(0,r+1),n=n.slice(r+1),r=n.indexOf(")"),a++;return[e,n]}function h2(e,t){let n=e.input.charCodeAt(e.index-1);return(e.index===0||ti(n)||Bo(n))&&(!t||n!==47)}p2.peek=oF;function Zz(){this.buffer()}function Jz(e){this.enter({type:"footnoteReference",identifier:"",label:""},e)}function eF(){this.buffer()}function tF(e){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},e)}function nF(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function rF(e){this.exit(e)}function iF(e){let t=this.resume(),n=this.stack[this.stack.length-1];n.type,n.identifier=hn(this.sliceSerialize(e)).toLowerCase(),n.label=t}function aF(e){this.exit(e)}function oF(){return"["}function p2(e,t,n,r){let i=n.createTracker(r),a=i.move("[^"),o=n.enter("footnoteReference"),s=n.enter("reference");return a+=i.move(n.safe(n.associationId(e),{after:"]",before:a})),s(),o(),a+=i.move("]"),a}function dy(){return{enter:{gfmFootnoteCallString:Zz,gfmFootnoteCall:Jz,gfmFootnoteDefinitionLabelString:eF,gfmFootnoteDefinition:tF},exit:{gfmFootnoteCallString:nF,gfmFootnoteCall:rF,gfmFootnoteDefinitionLabelString:iF,gfmFootnoteDefinition:aF}}}function hy(e){let t=!1;return e&&e.firstLineBlank&&(t=!0),{handlers:{footnoteDefinition:n,footnoteReference:p2},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]};function n(r,i,a,o){let s=a.createTracker(o),l=s.move("[^"),u=a.enter("footnoteDefinition"),c=a.enter("label");return l+=s.move(a.safe(a.associationId(r),{before:l,after:"]"})),c(),l+=s.move("]:"),r.children&&r.children.length>0&&(s.shift(4),l+=s.move((t?` +`:" ")+a.indentLines(a.containerFlow(r,s.current()),t?m2:sF))),u(),l}}function sF(e,t,n){return t===0?e:m2(e,t,n)}function m2(e,t,n){return(n?"":" ")+e}var lF=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];g2.peek=fF;function py(){return{canContainEols:["delete"],enter:{strikethrough:uF},exit:{strikethrough:cF}}}function my(){return{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:lF}],handlers:{delete:g2}}}function uF(e){this.enter({type:"delete",children:[]},e)}function cF(e){this.exit(e)}function g2(e,t,n,r){let i=n.createTracker(r),a=n.enter("strikethrough"),o=i.move("~~");return o+=n.containerPhrasing(e,{...i.current(),before:o,after:"~"}),o+=i.move("~~"),a(),o}function fF(){return"~"}function dF(e){return e.length}function E2(e,t){let n=t||{},r=(n.align||[]).concat(),i=n.stringLength||dF,a=[],o=[],s=[],l=[],u=0,c=-1;for(;++cu&&(u=e[c].length);++gl[g])&&(l[g]=T)}b.push(y)}o[c]=b,s[c]=E}let f=-1;if(typeof r=="object"&&"length"in r)for(;++fl[f]&&(l[f]=y),h[f]=y),d[f]=T}o.splice(1,0,d),s.splice(1,0,h),c=-1;let m=[];for(;++c "),a.shift(2);let o=n.indentLines(n.containerFlow(e,a.current()),pF);return i(),o}function pF(e,t,n){return">"+(n?"":" ")+e}function S2(e,t){return T2(e,t.inConstruct,!0)&&!T2(e,t.notInConstruct,!1)}function T2(e,t,n){if(typeof t=="string"&&(t=[t]),!t||t.length===0)return n;let r=-1;for(;++ro&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function x2(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function A2(e){let t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function C2(e,t,n,r){let i=A2(n),a=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(x2(e,n)){let f=n.enter("codeIndented"),d=n.indentLines(a,pF);return f(),d}let s=n.createTracker(r),l=i.repeat(Math.max(_2(a,i)+1,3)),u=n.enter("codeFenced"),c=s.move(l);if(e.lang){let f=n.enter(`codeFencedLang${o}`);c+=s.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...s.current()})),f()}if(e.lang&&e.meta){let f=n.enter(`codeFencedMeta${o}`);c+=s.move(" "),c+=s.move(n.safe(e.meta,{before:c,after:` +`}function _2(e,t){let n=String(e),r=n.indexOf(t),i=r,a=0,o=0;if(typeof t!="string")throw new TypeError("Expected substring");for(;r!==-1;)r===i?++a>o&&(o=a):a=1,i=r+t.length,r=n.indexOf(t,i);return o}function x2(e,t){return!!(t.options.fences===!1&&e.value&&!e.lang&&/[^ \r\n]/.test(e.value)&&!/^[\t ]*(?:[\r\n]|$)|(?:^|[\r\n])[\t ]*$/.test(e.value))}function A2(e){let t=e.options.fence||"`";if(t!=="`"&&t!=="~")throw new Error("Cannot serialize code with `"+t+"` for `options.fence`, expected `` ` `` or `~`");return t}function C2(e,t,n,r){let i=A2(n),a=e.value||"",o=i==="`"?"GraveAccent":"Tilde";if(x2(e,n)){let f=n.enter("codeIndented"),d=n.indentLines(a,mF);return f(),d}let s=n.createTracker(r),l=i.repeat(Math.max(_2(a,i)+1,3)),u=n.enter("codeFenced"),c=s.move(l);if(e.lang){let f=n.enter(`codeFencedLang${o}`);c+=s.move(n.safe(e.lang,{before:c,after:" ",encode:["`"],...s.current()})),f()}if(e.lang&&e.meta){let f=n.enter(`codeFencedMeta${o}`);c+=s.move(" "),c+=s.move(n.safe(e.meta,{before:c,after:` `,encode:["`"],...s.current()})),f()}return c+=s.move(` `),a&&(c+=s.move(a+` -`)),c+=s.move(l),u(),c}function pF(e,t,n){return(n?"":" ")+e}function _l(e){let t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function N2(e,t,n,r){let i=_l(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("definition"),s=n.enter("label"),l=n.createTracker(r),u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` -`,...l.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),o(),u}function v2(e){let t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Fa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function xl(e,t,n){let r=Pi(e),i=Pi(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}by.peek=mF;function by(e,t,n,r){let i=v2(n),a=n.enter("emphasis"),o=n.createTracker(r),s=o.move(i),l=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),u=l.charCodeAt(0),c=xl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Fa(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=xl(r.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+Fa(f));let h=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:d.outside,before:c.outside},s+l+h}function mF(e,t,n){return n.options.emphasis||"*"}function k2(e,t){let n=!1;return ht(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Do}),!!((!e.depth||e.depth<3)&&Io(e)&&(t.options.setext||n))}function w2(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(k2(e,n)){let c=n.enter("headingSetext"),f=n.enter("phrasing"),d=n.containerPhrasing(e,{...a.current(),before:` +`)),c+=s.move(l),u(),c}function mF(e,t,n){return(n?"":" ")+e}function _l(e){let t=e.options.quote||'"';if(t!=='"'&&t!=="'")throw new Error("Cannot serialize title with `"+t+"` for `options.quote`, expected `\"`, or `'`");return t}function N2(e,t,n,r){let i=_l(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("definition"),s=n.enter("label"),l=n.createTracker(r),u=l.move("[");return u+=l.move(n.safe(n.associationId(e),{before:u,after:"]",...l.current()})),u+=l.move("]: "),s(),!e.url||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":` +`,...l.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),o(),u}function v2(e){let t=e.options.emphasis||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize emphasis with `"+t+"` for `options.emphasis`, expected `*`, or `_`");return t}function Fa(e){return"&#x"+e.toString(16).toUpperCase()+";"}function xl(e,t,n){let r=Pi(e),i=Pi(t);return r===void 0?i===void 0?n==="_"?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!0}:r===1?i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!0}:{inside:!1,outside:!1}:i===void 0?{inside:!1,outside:!1}:i===1?{inside:!0,outside:!1}:{inside:!1,outside:!1}}by.peek=gF;function by(e,t,n,r){let i=v2(n),a=n.enter("emphasis"),o=n.createTracker(r),s=o.move(i),l=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),u=l.charCodeAt(0),c=xl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Fa(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=xl(r.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+Fa(f));let h=o.move(i);return a(),n.attentionEncodeSurroundingInfo={after:d.outside,before:c.outside},s+l+h}function gF(e,t,n){return n.options.emphasis||"*"}function k2(e,t){let n=!1;return ht(e,function(r){if("value"in r&&/\r?\n|\r/.test(r.value)||r.type==="break")return n=!0,Do}),!!((!e.depth||e.depth<3)&&Io(e)&&(t.options.setext||n))}function w2(e,t,n,r){let i=Math.max(Math.min(6,e.depth||1),1),a=n.createTracker(r);if(k2(e,n)){let c=n.enter("headingSetext"),f=n.enter("phrasing"),d=n.containerPhrasing(e,{...a.current(),before:` `,after:` `});return f(),c(),d+` `+(i===1?"=":"-").repeat(d.length-(Math.max(d.lastIndexOf("\r"),d.lastIndexOf(` `))+1))}let o="#".repeat(i),s=n.enter("headingAtx"),l=n.enter("phrasing");a.move(o+" ");let u=n.containerPhrasing(e,{before:"# ",after:` -`,...a.current()});return/^[\t ]/.test(u)&&(u=Fa(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),s(),u}Ey.peek=gF;function Ey(e){return e.value||""}function gF(){return"<"}yy.peek=bF;function yy(e,t,n,r){let i=_l(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("image"),s=n.enter("label"),l=n.createTracker(r),u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),u+=l.move(")"),o(),u}function bF(){return"!"}Ty.peek=EF;function Ty(e,t,n,r){let i=e.referenceType,a=n.enter("imageReference"),o=n.enter("label"),s=n.createTracker(r),l=s.move("!["),u=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),o();let c=n.stack;n.stack=[],o=n.enter("reference");let f=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=c,a(),i==="full"||!u||u!==f?l+=s.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function EF(){return"!"}Sy.peek=yF;function Sy(e,t,n){let r=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a\u007F]/.test(e.url))}xy.peek=TF;function xy(e,t,n,r){let i=_l(n),a=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r),s,l;if(_y(e,n)){let c=n.stack;n.stack=[],s=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),s(),n.stack=c,f}s=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),s(),u}function TF(e,t,n){return _y(e,n)?"<":"["}Ay.peek=SF;function Ay(e,t,n,r){let i=e.referenceType,a=n.enter("linkReference"),o=n.enter("label"),s=n.createTracker(r),l=s.move("["),u=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),o();let c=n.stack;n.stack=[],o=n.enter("reference");let f=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=c,a(),i==="full"||!u||u!==f?l+=s.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function SF(){return"["}function Al(e){let t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function M2(e){let t=Al(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function O2(e){let t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function up(e){let t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function R2(e,t,n,r){let i=n.enter("list"),a=n.bulletCurrent,o=e.ordered?O2(n):Al(n),s=e.ordered?o==="."?")":".":M2(n),l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let c=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),up(n)===o&&c){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),c);return l(),u;function c(f,d,h){return d?(h?"":" ".repeat(o))+f:(h?a:a+" ".repeat(o-a.length))+f}}function L2(e,t,n,r){let i=n.enter("paragraph"),a=n.enter("phrasing"),o=n.containerPhrasing(e,r);return a(),i(),o}var Cy=Jr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function B2(e,t,n,r){return(e.children.some(function(o){return Cy(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function P2(e){let t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ny.peek=_F;function Ny(e,t,n,r){let i=P2(n),a=n.enter("strong"),o=n.createTracker(r),s=o.move(i+i),l=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),u=l.charCodeAt(0),c=xl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Fa(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=xl(r.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+Fa(f));let h=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:d.outside,before:c.outside},s+l+h}function _F(e,t,n){return n.options.strong||"*"}function U2(e,t,n,r){return n.safe(e.value,r)}function H2(e){let t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function z2(e,t,n){let r=(up(n)+(n.options.ruleSpaces?" ":"")).repeat(H2(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Lc={blockquote:y2,break:gy,code:C2,definition:N2,emphasis:by,hardBreak:gy,heading:w2,html:Ey,image:yy,imageReference:Ty,inlineCode:Sy,link:xy,linkReference:Ay,list:R2,listItem:I2,paragraph:L2,root:B2,strong:Ny,text:U2,thematicBreak:z2};function ky(){return{enter:{table:xF,tableData:F2,tableHeader:F2,tableRow:CF},exit:{codeText:NF,table:AF,tableData:vy,tableHeader:vy,tableRow:vy}}}function xF(e){let t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function AF(e){this.exit(e),this.data.inTable=void 0}function CF(e){this.enter({type:"tableRow",children:[]},e)}function vy(e){this.exit(e)}function F2(e){this.enter({type:"tableCell",children:[]},e)}function NF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,vF));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function vF(e,t){return t==="|"?t:e}function wy(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` +`,...a.current()});return/^[\t ]/.test(u)&&(u=Fa(u.charCodeAt(0))+u.slice(1)),u=u?o+" "+u:o,n.options.closeAtx&&(u+=" "+o),l(),s(),u}Ey.peek=bF;function Ey(e){return e.value||""}function bF(){return"<"}yy.peek=EF;function yy(e,t,n,r){let i=_l(n),a=i==='"'?"Quote":"Apostrophe",o=n.enter("image"),s=n.enter("label"),l=n.createTracker(r),u=l.move("![");return u+=l.move(n.safe(e.alt,{before:u,after:"]",...l.current()})),u+=l.move("]("),s(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(s=n.enter("destinationLiteral"),u+=l.move("<"),u+=l.move(n.safe(e.url,{before:u,after:">",...l.current()})),u+=l.move(">")):(s=n.enter("destinationRaw"),u+=l.move(n.safe(e.url,{before:u,after:e.title?" ":")",...l.current()}))),s(),e.title&&(s=n.enter(`title${a}`),u+=l.move(" "+i),u+=l.move(n.safe(e.title,{before:u,after:i,...l.current()})),u+=l.move(i),s()),u+=l.move(")"),o(),u}function EF(){return"!"}Ty.peek=yF;function Ty(e,t,n,r){let i=e.referenceType,a=n.enter("imageReference"),o=n.enter("label"),s=n.createTracker(r),l=s.move("!["),u=n.safe(e.alt,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),o();let c=n.stack;n.stack=[],o=n.enter("reference");let f=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=c,a(),i==="full"||!u||u!==f?l+=s.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function yF(){return"!"}Sy.peek=TF;function Sy(e,t,n){let r=e.value||"",i="`",a=-1;for(;new RegExp("(^|[^`])"+i+"([^`]|$)").test(r);)i+="`";for(/[^ \r\n]/.test(r)&&(/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||/^`|`$/.test(r))&&(r=" "+r+" ");++a\u007F]/.test(e.url))}xy.peek=SF;function xy(e,t,n,r){let i=_l(n),a=i==='"'?"Quote":"Apostrophe",o=n.createTracker(r),s,l;if(_y(e,n)){let c=n.stack;n.stack=[],s=n.enter("autolink");let f=o.move("<");return f+=o.move(n.containerPhrasing(e,{before:f,after:">",...o.current()})),f+=o.move(">"),s(),n.stack=c,f}s=n.enter("link"),l=n.enter("label");let u=o.move("[");return u+=o.move(n.containerPhrasing(e,{before:u,after:"](",...o.current()})),u+=o.move("]("),l(),!e.url&&e.title||/[\0- \u007F]/.test(e.url)?(l=n.enter("destinationLiteral"),u+=o.move("<"),u+=o.move(n.safe(e.url,{before:u,after:">",...o.current()})),u+=o.move(">")):(l=n.enter("destinationRaw"),u+=o.move(n.safe(e.url,{before:u,after:e.title?" ":")",...o.current()}))),l(),e.title&&(l=n.enter(`title${a}`),u+=o.move(" "+i),u+=o.move(n.safe(e.title,{before:u,after:i,...o.current()})),u+=o.move(i),l()),u+=o.move(")"),s(),u}function SF(e,t,n){return _y(e,n)?"<":"["}Ay.peek=_F;function Ay(e,t,n,r){let i=e.referenceType,a=n.enter("linkReference"),o=n.enter("label"),s=n.createTracker(r),l=s.move("["),u=n.containerPhrasing(e,{before:l,after:"]",...s.current()});l+=s.move(u+"]["),o();let c=n.stack;n.stack=[],o=n.enter("reference");let f=n.safe(n.associationId(e),{before:l,after:"]",...s.current()});return o(),n.stack=c,a(),i==="full"||!u||u!==f?l+=s.move(f+"]"):i==="shortcut"?l=l.slice(0,-1):l+=s.move("]"),l}function _F(){return"["}function Al(e){let t=e.options.bullet||"*";if(t!=="*"&&t!=="+"&&t!=="-")throw new Error("Cannot serialize items with `"+t+"` for `options.bullet`, expected `*`, `+`, or `-`");return t}function M2(e){let t=Al(e),n=e.options.bulletOther;if(!n)return t==="*"?"-":"*";if(n!=="*"&&n!=="+"&&n!=="-")throw new Error("Cannot serialize items with `"+n+"` for `options.bulletOther`, expected `*`, `+`, or `-`");if(n===t)throw new Error("Expected `bullet` (`"+t+"`) and `bulletOther` (`"+n+"`) to be different");return n}function O2(e){let t=e.options.bulletOrdered||".";if(t!=="."&&t!==")")throw new Error("Cannot serialize items with `"+t+"` for `options.bulletOrdered`, expected `.` or `)`");return t}function up(e){let t=e.options.rule||"*";if(t!=="*"&&t!=="-"&&t!=="_")throw new Error("Cannot serialize rules with `"+t+"` for `options.rule`, expected `*`, `-`, or `_`");return t}function R2(e,t,n,r){let i=n.enter("list"),a=n.bulletCurrent,o=e.ordered?O2(n):Al(n),s=e.ordered?o==="."?")":".":M2(n),l=t&&n.bulletLastUsed?o===n.bulletLastUsed:!1;if(!e.ordered){let c=e.children?e.children[0]:void 0;if((o==="*"||o==="-")&&c&&(!c.children||!c.children[0])&&n.stack[n.stack.length-1]==="list"&&n.stack[n.stack.length-2]==="listItem"&&n.stack[n.stack.length-3]==="list"&&n.stack[n.stack.length-4]==="listItem"&&n.indexStack[n.indexStack.length-1]===0&&n.indexStack[n.indexStack.length-2]===0&&n.indexStack[n.indexStack.length-3]===0&&(l=!0),up(n)===o&&c){let f=-1;for(;++f-1?t.start:1)+(n.options.incrementListMarker===!1?0:t.children.indexOf(e))+a);let o=a.length+1;(i==="tab"||i==="mixed"&&(t&&t.type==="list"&&t.spread||e.spread))&&(o=Math.ceil(o/4)*4);let s=n.createTracker(r);s.move(a+" ".repeat(o-a.length)),s.shift(o);let l=n.enter("listItem"),u=n.indentLines(n.containerFlow(e,s.current()),c);return l(),u;function c(f,d,h){return d?(h?"":" ".repeat(o))+f:(h?a:a+" ".repeat(o-a.length))+f}}function L2(e,t,n,r){let i=n.enter("paragraph"),a=n.enter("phrasing"),o=n.containerPhrasing(e,r);return a(),i(),o}var Cy=Jr(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);function B2(e,t,n,r){return(e.children.some(function(o){return Cy(o)})?n.containerPhrasing:n.containerFlow).call(n,e,r)}function P2(e){let t=e.options.strong||"*";if(t!=="*"&&t!=="_")throw new Error("Cannot serialize strong with `"+t+"` for `options.strong`, expected `*`, or `_`");return t}Ny.peek=xF;function Ny(e,t,n,r){let i=P2(n),a=n.enter("strong"),o=n.createTracker(r),s=o.move(i+i),l=o.move(n.containerPhrasing(e,{after:i,before:s,...o.current()})),u=l.charCodeAt(0),c=xl(r.before.charCodeAt(r.before.length-1),u,i);c.inside&&(l=Fa(u)+l.slice(1));let f=l.charCodeAt(l.length-1),d=xl(r.after.charCodeAt(0),f,i);d.inside&&(l=l.slice(0,-1)+Fa(f));let h=o.move(i+i);return a(),n.attentionEncodeSurroundingInfo={after:d.outside,before:c.outside},s+l+h}function xF(e,t,n){return n.options.strong||"*"}function U2(e,t,n,r){return n.safe(e.value,r)}function H2(e){let t=e.options.ruleRepetition||3;if(t<3)throw new Error("Cannot serialize rules with repetition `"+t+"` for `options.ruleRepetition`, expected `3` or more");return t}function z2(e,t,n){let r=(up(n)+(n.options.ruleSpaces?" ":"")).repeat(H2(n));return n.options.ruleSpaces?r.slice(0,-1):r}var Lc={blockquote:y2,break:gy,code:C2,definition:N2,emphasis:by,hardBreak:gy,heading:w2,html:Ey,image:yy,imageReference:Ty,inlineCode:Sy,link:xy,linkReference:Ay,list:R2,listItem:I2,paragraph:L2,root:B2,strong:Ny,text:U2,thematicBreak:z2};function ky(){return{enter:{table:AF,tableData:F2,tableHeader:F2,tableRow:NF},exit:{codeText:vF,table:CF,tableData:vy,tableHeader:vy,tableRow:vy}}}function AF(e){let t=e._align;this.enter({type:"table",align:t.map(function(n){return n==="none"?null:n}),children:[]},e),this.data.inTable=!0}function CF(e){this.exit(e),this.data.inTable=void 0}function NF(e){this.enter({type:"tableRow",children:[]},e)}function vy(e){this.exit(e)}function F2(e){this.enter({type:"tableCell",children:[]},e)}function vF(e){let t=this.resume();this.data.inTable&&(t=t.replace(/\\([\\|])/g,kF));let n=this.stack[this.stack.length-1];n.type,n.value=t,this.exit(e)}function kF(e,t){return t==="|"?t:e}function wy(e){let t=e||{},n=t.tableCellPadding,r=t.tablePipeAlign,i=t.stringLength,a=n?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:` `,inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:d,table:o,tableCell:l,tableRow:s}};function o(h,m,b,E){return u(c(h,b,E),h.align)}function s(h,m,b,E){let g=f(h,b,E),y=u([g]);return y.slice(0,y.indexOf(` -`))}function l(h,m,b,E){let g=b.enter("tableCell"),y=b.enter("phrasing"),T=b.containerPhrasing(h,{...E,before:a,after:a});return y(),g(),T}function u(h,m){return E2(h,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function c(h,m,b){let E=h.children,g=-1,y=[],T=m.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var zF={tokenize:$F,partial:!0};function Py(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:GF,continuation:{tokenize:YF},exit:KF}},text:{91:{name:"gfmFootnoteCall",tokenize:VF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:FF,resolveTo:qF}}}}function FF(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!o||!o._balanced)return n(l);let u=hn(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function qF(e,t){let n=e.length,r;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){r=e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...l),e}function VF(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(a>999||f===93&&!o||f===null||f===91||ve(f))return n(f);if(f===93){e.exit("chunkString");let d=e.exit("gfmFootnoteCallString");return i.includes(hn(r.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ve(f)||(o=!0),a++,e.consume(f),f===92?c:u}function c(f){return f===91||f===92||f===93?(e.consume(f),a++,u):u(f)}}function GF(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(m)}function c(m){if(o>999||m===93&&!s||m===null||m===91||ve(m))return n(m);if(m===93){e.exit("chunkString");let b=e.exit("gfmFootnoteDefinitionLabelString");return a=hn(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return ve(m)||(s=!0),o++,e.consume(m),m===92?f:c}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,c):c(m)}function d(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(a)||i.push(a),de(e,h,"gfmFootnoteDefinitionWhitespace")):n(m)}function h(m){return t(m)}}function YF(e,t,n){return e.check(ni,t,e.attempt(zF,t,n))}function KF(e){e.exit("gfmFootnoteDefinition")}function $F(e,t,n){let r=this;return de(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){let o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function Uy(e){let n=(e||{}).singleTilde,r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,s){let l=-1;for(;++l1?l(m):(o.consume(m),f++,h);if(f<2&&!n)return l(m);let E=o.exit("strikethroughSequenceTemporary"),g=Pi(m);return E._open=!g||g===2&&!!b,E._close=!b||b===2&&!!g,s(m)}}}var cp=class{constructor(){this.map=[]}add(t,n,r){jF(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let n=this.map.length,r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(let a of i)t.push(a);i=r.pop()}this.map.length=0}};function jF(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){let V=r.events[H][1].type;if(V==="lineEnding"||V==="linePrefix")H--;else break}let Y=H>-1?r.events[H][1].type:null,z=Y==="tableHead"||Y==="tableRow"?x:l;return z===x&&r.parser.lazy[r.now().line]?n(A):z(A)}function l(A){return e.enter("tableHead"),e.enter("tableRow"),u(A)}function u(A){return A===124||(o=!0,a+=1),c(A)}function c(A){return A===null?n(A):te(A)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),h):n(A):he(A)?de(e,c,"whitespace")(A):(a+=1,o&&(o=!1,i+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,c):(e.enter("data"),f(A)))}function f(A){return A===null||A===124||ve(A)?(e.exit("data"),c(A)):(e.consume(A),A===92?d:f)}function d(A){return A===92||A===124?(e.consume(A),f):f(A)}function h(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),o=!1,he(A)?de(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):m(A))}function m(A){return A===45||A===58?E(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),b):v(A)}function b(A){return he(A)?de(e,E,"whitespace")(A):E(A)}function E(A){return A===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),g):A===45?(a+=1,g(A)):A===null||te(A)?S(A):v(A)}function g(A){return A===45?(e.enter("tableDelimiterFiller"),y(A)):v(A)}function y(A){return A===45?(e.consume(A),y):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(A))}function T(A){return he(A)?de(e,S,"whitespace")(A):S(A)}function S(A){return A===124?m(A):A===null||te(A)?!o||i!==a?v(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):v(A)}function v(A){return n(A)}function x(A){return e.enter("tableRow"),M(A)}function M(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),M):A===null||te(A)?(e.exit("tableRow"),t(A)):he(A)?de(e,M,"whitespace")(A):(e.enter("data"),R(A))}function R(A){return A===null||A===124||ve(A)?(e.exit("data"),M(A)):(e.consume(A),A===92?L:R)}function L(A){return A===92||A===124?(e.consume(A),R):R(A)}}function WF(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,l=0,u,c,f,d=new cp;for(;++nn[2]+1){let m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(a.end=Object.assign({},Cl(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function Z2(e,t,n,r,i){let a=[],o=Cl(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function Cl(e,t){let n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}var QF={name:"tasklistCheck",tokenize:ZF};function zy(){return{text:{91:QF}}}function ZF(e,t,n){let r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),a)}function a(l){return ve(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return te(l)?t(l):he(l)?e.check({tokenize:JF},t,n)(l):n(l)}}function JF(e,t,n){return de(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function J2(e){return Qh([Ly(),Py(),Uy(e),Hy(),zy()])}var e7={};function Bc(e){let t=this,n=e||e7,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(J2(n)),a.push(Ry()),o.push(Dy(n))}function ew(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function tw(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:` +`))}function l(h,m,b,E){let g=b.enter("tableCell"),y=b.enter("phrasing"),T=b.containerPhrasing(h,{...E,before:a,after:a});return y(),g(),T}function u(h,m){return E2(h,{align:m,alignDelimiters:r,padding:n,stringLength:i})}function c(h,m,b){let E=h.children,g=-1,y=[],T=m.enter("table");for(;++g0&&!n&&(e[e.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),n}var FF={tokenize:jF,partial:!0};function Py(){return{document:{91:{name:"gfmFootnoteDefinition",tokenize:YF,continuation:{tokenize:KF},exit:$F}},text:{91:{name:"gfmFootnoteCall",tokenize:GF},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:qF,resolveTo:VF}}}}function qF(e,t,n){let r=this,i=r.events.length,a=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),o;for(;i--;){let l=r.events[i][1];if(l.type==="labelImage"){o=l;break}if(l.type==="gfmFootnoteCall"||l.type==="labelLink"||l.type==="label"||l.type==="image"||l.type==="link")break}return s;function s(l){if(!o||!o._balanced)return n(l);let u=hn(r.sliceSerialize({start:o.end,end:r.now()}));return u.codePointAt(0)!==94||!a.includes(u.slice(1))?n(l):(e.enter("gfmFootnoteCallLabelMarker"),e.consume(l),e.exit("gfmFootnoteCallLabelMarker"),t(l))}}function VF(e,t){let n=e.length,r;for(;n--;)if(e[n][1].type==="labelImage"&&e[n][0]==="enter"){r=e[n][1];break}e[n+1][1].type="data",e[n+3][1].type="gfmFootnoteCallLabelMarker";let i={type:"gfmFootnoteCall",start:Object.assign({},e[n+3][1].start),end:Object.assign({},e[e.length-1][1].end)},a={type:"gfmFootnoteCallMarker",start:Object.assign({},e[n+3][1].end),end:Object.assign({},e[n+3][1].end)};a.end.column++,a.end.offset++,a.end._bufferIndex++;let o={type:"gfmFootnoteCallString",start:Object.assign({},a.end),end:Object.assign({},e[e.length-1][1].start)},s={type:"chunkString",contentType:"string",start:Object.assign({},o.start),end:Object.assign({},o.end)},l=[e[n+1],e[n+2],["enter",i,t],e[n+3],e[n+4],["enter",a,t],["exit",a,t],["enter",o,t],["enter",s,t],["exit",s,t],["exit",o,t],e[e.length-2],e[e.length-1],["exit",i,t]];return e.splice(n,e.length-n+1,...l),e}function GF(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a=0,o;return s;function s(f){return e.enter("gfmFootnoteCall"),e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),l}function l(f){return f!==94?n(f):(e.enter("gfmFootnoteCallMarker"),e.consume(f),e.exit("gfmFootnoteCallMarker"),e.enter("gfmFootnoteCallString"),e.enter("chunkString").contentType="string",u)}function u(f){if(a>999||f===93&&!o||f===null||f===91||ve(f))return n(f);if(f===93){e.exit("chunkString");let d=e.exit("gfmFootnoteCallString");return i.includes(hn(r.sliceSerialize(d)))?(e.enter("gfmFootnoteCallLabelMarker"),e.consume(f),e.exit("gfmFootnoteCallLabelMarker"),e.exit("gfmFootnoteCall"),t):n(f)}return ve(f)||(o=!0),a++,e.consume(f),f===92?c:u}function c(f){return f===91||f===92||f===93?(e.consume(f),a++,u):u(f)}}function YF(e,t,n){let r=this,i=r.parser.gfmFootnotes||(r.parser.gfmFootnotes=[]),a,o=0,s;return l;function l(m){return e.enter("gfmFootnoteDefinition")._container=!0,e.enter("gfmFootnoteDefinitionLabel"),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),u}function u(m){return m===94?(e.enter("gfmFootnoteDefinitionMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionMarker"),e.enter("gfmFootnoteDefinitionLabelString"),e.enter("chunkString").contentType="string",c):n(m)}function c(m){if(o>999||m===93&&!s||m===null||m===91||ve(m))return n(m);if(m===93){e.exit("chunkString");let b=e.exit("gfmFootnoteDefinitionLabelString");return a=hn(r.sliceSerialize(b)),e.enter("gfmFootnoteDefinitionLabelMarker"),e.consume(m),e.exit("gfmFootnoteDefinitionLabelMarker"),e.exit("gfmFootnoteDefinitionLabel"),d}return ve(m)||(s=!0),o++,e.consume(m),m===92?f:c}function f(m){return m===91||m===92||m===93?(e.consume(m),o++,c):c(m)}function d(m){return m===58?(e.enter("definitionMarker"),e.consume(m),e.exit("definitionMarker"),i.includes(a)||i.push(a),de(e,h,"gfmFootnoteDefinitionWhitespace")):n(m)}function h(m){return t(m)}}function KF(e,t,n){return e.check(ni,t,e.attempt(FF,t,n))}function $F(e){e.exit("gfmFootnoteDefinition")}function jF(e,t,n){let r=this;return de(e,i,"gfmFootnoteDefinitionIndent",5);function i(a){let o=r.events[r.events.length-1];return o&&o[1].type==="gfmFootnoteDefinitionIndent"&&o[2].sliceSerialize(o[1],!0).length===4?t(a):n(a)}}function Uy(e){let n=(e||{}).singleTilde,r={name:"strikethrough",tokenize:a,resolveAll:i};return n==null&&(n=!0),{text:{126:r},insideSpan:{null:[r]},attentionMarkers:{null:[126]}};function i(o,s){let l=-1;for(;++l1?l(m):(o.consume(m),f++,h);if(f<2&&!n)return l(m);let E=o.exit("strikethroughSequenceTemporary"),g=Pi(m);return E._open=!g||g===2&&!!b,E._close=!b||b===2&&!!g,s(m)}}}var cp=class{constructor(){this.map=[]}add(t,n,r){XF(this,t,n,r)}consume(t){if(this.map.sort(function(a,o){return a[0]-o[0]}),this.map.length===0)return;let n=this.map.length,r=[];for(;n>0;)n-=1,r.push(t.slice(this.map[n][0]+this.map[n][1]),this.map[n][2]),t.length=this.map[n][0];r.push(t.slice()),t.length=0;let i=r.pop();for(;i;){for(let a of i)t.push(a);i=r.pop()}this.map.length=0}};function XF(e,t,n,r){let i=0;if(!(n===0&&r.length===0)){for(;i-1;){let V=r.events[H][1].type;if(V==="lineEnding"||V==="linePrefix")H--;else break}let Y=H>-1?r.events[H][1].type:null,z=Y==="tableHead"||Y==="tableRow"?x:l;return z===x&&r.parser.lazy[r.now().line]?n(A):z(A)}function l(A){return e.enter("tableHead"),e.enter("tableRow"),u(A)}function u(A){return A===124||(o=!0,a+=1),c(A)}function c(A){return A===null?n(A):te(A)?a>1?(a=0,r.interrupt=!0,e.exit("tableRow"),e.enter("lineEnding"),e.consume(A),e.exit("lineEnding"),h):n(A):he(A)?de(e,c,"whitespace")(A):(a+=1,o&&(o=!1,i+=1),A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),o=!0,c):(e.enter("data"),f(A)))}function f(A){return A===null||A===124||ve(A)?(e.exit("data"),c(A)):(e.consume(A),A===92?d:f)}function d(A){return A===92||A===124?(e.consume(A),f):f(A)}function h(A){return r.interrupt=!1,r.parser.lazy[r.now().line]?n(A):(e.enter("tableDelimiterRow"),o=!1,he(A)?de(e,m,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(A):m(A))}function m(A){return A===45||A===58?E(A):A===124?(o=!0,e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),b):v(A)}function b(A){return he(A)?de(e,E,"whitespace")(A):E(A)}function E(A){return A===58?(a+=1,o=!0,e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),g):A===45?(a+=1,g(A)):A===null||te(A)?S(A):v(A)}function g(A){return A===45?(e.enter("tableDelimiterFiller"),y(A)):v(A)}function y(A){return A===45?(e.consume(A),y):A===58?(o=!0,e.exit("tableDelimiterFiller"),e.enter("tableDelimiterMarker"),e.consume(A),e.exit("tableDelimiterMarker"),T):(e.exit("tableDelimiterFiller"),T(A))}function T(A){return he(A)?de(e,S,"whitespace")(A):S(A)}function S(A){return A===124?m(A):A===null||te(A)?!o||i!==a?v(A):(e.exit("tableDelimiterRow"),e.exit("tableHead"),t(A)):v(A)}function v(A){return n(A)}function x(A){return e.enter("tableRow"),M(A)}function M(A){return A===124?(e.enter("tableCellDivider"),e.consume(A),e.exit("tableCellDivider"),M):A===null||te(A)?(e.exit("tableRow"),t(A)):he(A)?de(e,M,"whitespace")(A):(e.enter("data"),R(A))}function R(A){return A===null||A===124||ve(A)?(e.exit("data"),M(A)):(e.consume(A),A===92?L:R)}function L(A){return A===92||A===124?(e.consume(A),R):R(A)}}function QF(e,t){let n=-1,r=!0,i=0,a=[0,0,0,0],o=[0,0,0,0],s=!1,l=0,u,c,f,d=new cp;for(;++nn[2]+1){let m=n[2]+1,b=n[3]-n[2]-1;e.add(m,b,[])}}e.add(n[3]+1,0,[["exit",f,t]])}return i!==void 0&&(a.end=Object.assign({},Cl(t.events,i)),e.add(i,0,[["exit",a,t]]),a=void 0),a}function Z2(e,t,n,r,i){let a=[],o=Cl(t.events,n);i&&(i.end=Object.assign({},o),a.push(["exit",i,t])),r.end=Object.assign({},o),a.push(["exit",r,t]),e.add(n+1,0,a)}function Cl(e,t){let n=e[t],r=n[0]==="enter"?"start":"end";return n[1][r]}var ZF={name:"tasklistCheck",tokenize:JF};function zy(){return{text:{91:ZF}}}function JF(e,t,n){let r=this;return i;function i(l){return r.previous!==null||!r._gfmTasklistFirstContentOfListItem?n(l):(e.enter("taskListCheck"),e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),a)}function a(l){return ve(l)?(e.enter("taskListCheckValueUnchecked"),e.consume(l),e.exit("taskListCheckValueUnchecked"),o):l===88||l===120?(e.enter("taskListCheckValueChecked"),e.consume(l),e.exit("taskListCheckValueChecked"),o):n(l)}function o(l){return l===93?(e.enter("taskListCheckMarker"),e.consume(l),e.exit("taskListCheckMarker"),e.exit("taskListCheck"),s):n(l)}function s(l){return te(l)?t(l):he(l)?e.check({tokenize:e7},t,n)(l):n(l)}}function e7(e,t,n){return de(e,r,"whitespace");function r(i){return i===null?n(i):t(i)}}function J2(e){return Qh([Ly(),Py(),Uy(e),Hy(),zy()])}var t7={};function Bc(e){let t=this,n=e||t7,r=t.data(),i=r.micromarkExtensions||(r.micromarkExtensions=[]),a=r.fromMarkdownExtensions||(r.fromMarkdownExtensions=[]),o=r.toMarkdownExtensions||(r.toMarkdownExtensions=[]);i.push(J2(n)),a.push(Ry()),o.push(Dy(n))}function ew(e,t){let n={type:"element",tagName:"blockquote",properties:{},children:e.wrap(e.all(t),!0)};return e.patch(t,n),e.applyData(t,n)}function tw(e,t){let n={type:"element",tagName:"br",properties:{},children:[]};return e.patch(t,n),[e.applyData(t,n),{type:"text",value:` `}]}function nw(e,t){let n=t.value?t.value+` -`:"",r={},i=t.lang?t.lang.split(/\s+/):[];i.length>0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function rw(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iw(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aw(e,t){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=xr(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function ow(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sw(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dp(e,t){let n=t.referenceType,r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function lw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dp(e,t);let i={src:xr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function uw(e,t){let n={src:xr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function cw(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function fw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dp(e,t);let i={href:xr(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function dw(e,t){let n={href:xr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function hw(e,t,n){let r=e.all(t),i=n?t7(n):pw(t),a={},o=[];if(typeof t.checked=="boolean"){let c=r[0],f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s0&&(r.className=["language-"+i[0]]);let a={type:"element",tagName:"code",properties:r,children:[{type:"text",value:n}]};return t.meta&&(a.data={meta:t.meta}),e.patch(t,a),a=e.applyData(t,a),a={type:"element",tagName:"pre",properties:{},children:[a]},e.patch(t,a),a}function rw(e,t){let n={type:"element",tagName:"del",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function iw(e,t){let n={type:"element",tagName:"em",properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function aw(e,t){let n=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",r=String(t.identifier).toUpperCase(),i=xr(r.toLowerCase()),a=e.footnoteOrder.indexOf(r),o,s=e.footnoteCounts.get(r);s===void 0?(s=0,e.footnoteOrder.push(r),o=e.footnoteOrder.length):o=a+1,s+=1,e.footnoteCounts.set(r,s);let l={type:"element",tagName:"a",properties:{href:"#"+n+"fn-"+i,id:n+"fnref-"+i+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(o)}]};e.patch(t,l);let u={type:"element",tagName:"sup",properties:{},children:[l]};return e.patch(t,u),e.applyData(t,u)}function ow(e,t){let n={type:"element",tagName:"h"+t.depth,properties:{},children:e.all(t)};return e.patch(t,n),e.applyData(t,n)}function sw(e,t){if(e.options.allowDangerousHtml){let n={type:"raw",value:t.value};return e.patch(t,n),e.applyData(t,n)}}function dp(e,t){let n=t.referenceType,r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(t.label||t.identifier)+"]"),t.type==="imageReference")return[{type:"text",value:"!["+t.alt+r}];let i=e.all(t),a=i[0];a&&a.type==="text"?a.value="["+a.value:i.unshift({type:"text",value:"["});let o=i[i.length-1];return o&&o.type==="text"?o.value+=r:i.push({type:"text",value:r}),i}function lw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dp(e,t);let i={src:xr(r.url||""),alt:t.alt};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:"element",tagName:"img",properties:i,children:[]};return e.patch(t,a),e.applyData(t,a)}function uw(e,t){let n={src:xr(t.url)};t.alt!==null&&t.alt!==void 0&&(n.alt=t.alt),t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:"element",tagName:"img",properties:n,children:[]};return e.patch(t,r),e.applyData(t,r)}function cw(e,t){let n={type:"text",value:t.value.replace(/\r?\n|\r/g," ")};e.patch(t,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return e.patch(t,r),e.applyData(t,r)}function fw(e,t){let n=String(t.identifier).toUpperCase(),r=e.definitionById.get(n);if(!r)return dp(e,t);let i={href:xr(r.url||"")};r.title!==null&&r.title!==void 0&&(i.title=r.title);let a={type:"element",tagName:"a",properties:i,children:e.all(t)};return e.patch(t,a),e.applyData(t,a)}function dw(e,t){let n={href:xr(t.url)};t.title!==null&&t.title!==void 0&&(n.title=t.title);let r={type:"element",tagName:"a",properties:n,children:e.all(t)};return e.patch(t,r),e.applyData(t,r)}function hw(e,t,n){let r=e.all(t),i=n?n7(n):pw(t),a={},o=[];if(typeof t.checked=="boolean"){let c=r[0],f;c&&c.type==="element"&&c.tagName==="p"?f=c:(f={type:"element",tagName:"p",properties:{},children:[]},r.unshift(f)),f.children.length>0&&f.children.unshift({type:"text",value:" "}),f.children.unshift({type:"element",tagName:"input",properties:{type:"checkbox",checked:t.checked,disabled:!0},children:[]}),a.className=["task-list-item"]}let s=-1;for(;++s1}function mw(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){let o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=Un(t.children[1]),l=Mo(t.children[t.children.length-1]);s&&l&&(o.position={start:s,end:l}),i.push(o)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Tw(e,t,n){let r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,s=o?o.length:t.children.length,l=-1,u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(_w(t.slice(i),i>0,!1)),a.join("")}function _w(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===9||a===32;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===9||a===32;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Aw(e,t){let n={type:"text",value:xw(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Cw(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Nw={blockquote:ew,break:tw,code:nw,delete:rw,emphasis:iw,footnoteReference:aw,heading:ow,html:sw,imageReference:lw,image:uw,inlineCode:cw,linkReference:fw,link:dw,listItem:hw,list:mw,paragraph:gw,root:bw,strong:Ew,table:yw,tableCell:Sw,tableRow:Tw,text:Aw,thematicBreak:Cw,toml:hp,yaml:hp,definition:hp,footnoteDefinition:hp};function hp(){}var vw=typeof self=="object"?self:globalThis,a7=(e,t)=>{let n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let s=n([],i);for(let l of o)s.push(r(l));return s}case 2:{let s=n({},i);for(let[l,u]of o)s[r(l)]=r(u);return s}case 3:return n(new Date(o),i);case 4:{let{source:s,flags:l}=o;return n(new RegExp(s,l),i)}case 5:{let s=n(new Map,i);for(let[l,u]of o)s.set(r(l),r(u));return s}case 6:{let s=n(new Set,i);for(let l of o)s.add(r(l));return s}case 7:{let{name:s,message:l}=o;return n(new vw[s](l),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:s}=new Uint8Array(o);return n(new DataView(s),o)}}return n(new vw[a](o),i)};return r},Vy=e=>a7(new Map,e)(0);var Nl="",{toString:o7}={},{keys:s7}=Object,Pc=e=>{let t=typeof e;if(t!=="object"||!e)return[0,t];let n=o7.call(e).slice(8,-1);switch(n){case"Array":return[1,Nl];case"Object":return[2,Nl];case"Date":return[3,Nl];case"RegExp":return[4,Nl];case"Map":return[5,Nl];case"Set":return[6,Nl];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},mp=([e,t])=>e===0&&(t==="function"||t==="symbol"),l7=(e,t,n,r)=>{let i=(o,s)=>{let l=r.push(o)-1;return n.set(s,l),l},a=o=>{if(n.has(o))return n.get(o);let[s,l]=Pc(o);switch(s){case 0:{let c=o;switch(l){case"bigint":s=8,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([-1],o)}return i([s,c],o)}case 1:{if(l){let d=o;return l==="DataView"?d=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(d=new Uint8Array(o)),i([l,[...d]],o)}let c=[],f=i([s,c],o);for(let d of o)c.push(a(d));return f}case 2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());let c=[],f=i([s,c],o);for(let d of s7(o))(e||!mp(Pc(o[d])))&&c.push([a(d),a(o[d])]);return f}case 3:return i([s,o.toISOString()],o);case 4:{let{source:c,flags:f}=o;return i([s,{source:c,flags:f}],o)}case 5:{let c=[],f=i([s,c],o);for(let[d,h]of o)(e||!(mp(Pc(d))||mp(Pc(h))))&&c.push([a(d),a(h)]);return f}case 6:{let c=[],f=i([s,c],o);for(let d of o)(e||!mp(Pc(d)))&&c.push(a(d));return f}}let{message:u}=o;return i([s,{name:l,message:u}],o)};return a},Gy=(e,{json:t,lossy:n}={})=>{let r=[];return l7(!(t||n),!!t,new Map,r)(e),r};var Hr=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Vy(Gy(e,t)):structuredClone(e):(e,t)=>Vy(Gy(e,t));function u7(e,t){let n=[{type:"text",value:"\u21A9"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function c7(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Rw(e){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||u7,r=e.options.footnoteBackLabel||c7,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l0&&m.push({type:"text",value:" "});let y=typeof n=="string"?n:n(l,h);typeof y=="string"&&(y={type:"text",value:y}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}let E=c[c.length-1];if(E&&E.type==="element"&&E.tagName==="p"){let y=E.children[E.children.length-1];y&&y.type==="text"?y.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...m)}else c.push(...m);let g={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(c,!0)};e.patch(u,g),s.push(g)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Hr(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` +`});let u={type:"element",tagName:"li",properties:a,children:o};return e.patch(t,u),e.applyData(t,u)}function n7(e){let t=!1;if(e.type==="list"){t=e.spread||!1;let n=e.children,r=-1;for(;!t&&++r1}function mw(e,t){let n={},r=e.all(t),i=-1;for(typeof t.start=="number"&&t.start!==1&&(n.start=t.start);++i0){let o={type:"element",tagName:"tbody",properties:{},children:e.wrap(n,!0)},s=Un(t.children[1]),l=Mo(t.children[t.children.length-1]);s&&l&&(o.position={start:s,end:l}),i.push(o)}let a={type:"element",tagName:"table",properties:{},children:e.wrap(i,!0)};return e.patch(t,a),e.applyData(t,a)}function Tw(e,t,n){let r=n?n.children:void 0,a=(r?r.indexOf(t):1)===0?"th":"td",o=n&&n.type==="table"?n.align:void 0,s=o?o.length:t.children.length,l=-1,u=[];for(;++l0,!0),r[0]),i=r.index+r[0].length,r=n.exec(t);return a.push(_w(t.slice(i),i>0,!1)),a.join("")}function _w(e,t,n){let r=0,i=e.length;if(t){let a=e.codePointAt(r);for(;a===9||a===32;)r++,a=e.codePointAt(r)}if(n){let a=e.codePointAt(i-1);for(;a===9||a===32;)i--,a=e.codePointAt(i-1)}return i>r?e.slice(r,i):""}function Aw(e,t){let n={type:"text",value:xw(String(t.value))};return e.patch(t,n),e.applyData(t,n)}function Cw(e,t){let n={type:"element",tagName:"hr",properties:{},children:[]};return e.patch(t,n),e.applyData(t,n)}var Nw={blockquote:ew,break:tw,code:nw,delete:rw,emphasis:iw,footnoteReference:aw,heading:ow,html:sw,imageReference:lw,image:uw,inlineCode:cw,linkReference:fw,link:dw,listItem:hw,list:mw,paragraph:gw,root:bw,strong:Ew,table:yw,tableCell:Sw,tableRow:Tw,text:Aw,thematicBreak:Cw,toml:hp,yaml:hp,definition:hp,footnoteDefinition:hp};function hp(){}var vw=typeof self=="object"?self:globalThis,o7=(e,t)=>{let n=(i,a)=>(e.set(a,i),i),r=i=>{if(e.has(i))return e.get(i);let[a,o]=t[i];switch(a){case 0:case-1:return n(o,i);case 1:{let s=n([],i);for(let l of o)s.push(r(l));return s}case 2:{let s=n({},i);for(let[l,u]of o)s[r(l)]=r(u);return s}case 3:return n(new Date(o),i);case 4:{let{source:s,flags:l}=o;return n(new RegExp(s,l),i)}case 5:{let s=n(new Map,i);for(let[l,u]of o)s.set(r(l),r(u));return s}case 6:{let s=n(new Set,i);for(let l of o)s.add(r(l));return s}case 7:{let{name:s,message:l}=o;return n(new vw[s](l),i)}case 8:return n(BigInt(o),i);case"BigInt":return n(Object(BigInt(o)),i);case"ArrayBuffer":return n(new Uint8Array(o).buffer,o);case"DataView":{let{buffer:s}=new Uint8Array(o);return n(new DataView(s),o)}}return n(new vw[a](o),i)};return r},Vy=e=>o7(new Map,e)(0);var Nl="",{toString:s7}={},{keys:l7}=Object,Pc=e=>{let t=typeof e;if(t!=="object"||!e)return[0,t];let n=s7.call(e).slice(8,-1);switch(n){case"Array":return[1,Nl];case"Object":return[2,Nl];case"Date":return[3,Nl];case"RegExp":return[4,Nl];case"Map":return[5,Nl];case"Set":return[6,Nl];case"DataView":return[1,n]}return n.includes("Array")?[1,n]:n.includes("Error")?[7,n]:[2,n]},mp=([e,t])=>e===0&&(t==="function"||t==="symbol"),u7=(e,t,n,r)=>{let i=(o,s)=>{let l=r.push(o)-1;return n.set(s,l),l},a=o=>{if(n.has(o))return n.get(o);let[s,l]=Pc(o);switch(s){case 0:{let c=o;switch(l){case"bigint":s=8,c=o.toString();break;case"function":case"symbol":if(e)throw new TypeError("unable to serialize "+l);c=null;break;case"undefined":return i([-1],o)}return i([s,c],o)}case 1:{if(l){let d=o;return l==="DataView"?d=new Uint8Array(o.buffer):l==="ArrayBuffer"&&(d=new Uint8Array(o)),i([l,[...d]],o)}let c=[],f=i([s,c],o);for(let d of o)c.push(a(d));return f}case 2:{if(l)switch(l){case"BigInt":return i([l,o.toString()],o);case"Boolean":case"Number":case"String":return i([l,o.valueOf()],o)}if(t&&"toJSON"in o)return a(o.toJSON());let c=[],f=i([s,c],o);for(let d of l7(o))(e||!mp(Pc(o[d])))&&c.push([a(d),a(o[d])]);return f}case 3:return i([s,o.toISOString()],o);case 4:{let{source:c,flags:f}=o;return i([s,{source:c,flags:f}],o)}case 5:{let c=[],f=i([s,c],o);for(let[d,h]of o)(e||!(mp(Pc(d))||mp(Pc(h))))&&c.push([a(d),a(h)]);return f}case 6:{let c=[],f=i([s,c],o);for(let d of o)(e||!mp(Pc(d)))&&c.push(a(d));return f}}let{message:u}=o;return i([s,{name:l,message:u}],o)};return a},Gy=(e,{json:t,lossy:n}={})=>{let r=[];return u7(!(t||n),!!t,new Map,r)(e),r};var Hr=typeof structuredClone=="function"?(e,t)=>t&&("json"in t||"lossy"in t)?Vy(Gy(e,t)):structuredClone(e):(e,t)=>Vy(Gy(e,t));function c7(e,t){let n=[{type:"text",value:"\u21A9"}];return t>1&&n.push({type:"element",tagName:"sup",properties:{},children:[{type:"text",value:String(t)}]}),n}function f7(e,t){return"Back to reference "+(e+1)+(t>1?"-"+t:"")}function Rw(e){let t=typeof e.options.clobberPrefix=="string"?e.options.clobberPrefix:"user-content-",n=e.options.footnoteBackContent||c7,r=e.options.footnoteBackLabel||f7,i=e.options.footnoteLabel||"Footnotes",a=e.options.footnoteLabelTagName||"h2",o=e.options.footnoteLabelProperties||{className:["sr-only"]},s=[],l=-1;for(;++l0&&m.push({type:"text",value:" "});let y=typeof n=="string"?n:n(l,h);typeof y=="string"&&(y={type:"text",value:y}),m.push({type:"element",tagName:"a",properties:{href:"#"+t+"fnref-"+d+(h>1?"-"+h:""),dataFootnoteBackref:"",ariaLabel:typeof r=="string"?r:r(l,h),className:["data-footnote-backref"]},children:Array.isArray(y)?y:[y]})}let E=c[c.length-1];if(E&&E.type==="element"&&E.tagName==="p"){let y=E.children[E.children.length-1];y&&y.type==="text"?y.value+=" ":E.children.push({type:"text",value:" "}),E.children.push(...m)}else c.push(...m);let g={type:"element",tagName:"li",properties:{id:t+"fn-"+d},children:e.wrap(c,!0)};e.patch(u,g),s.push(g)}if(s.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:a,properties:{...Hr(o),id:"footnote-label"},children:[{type:"text",value:i}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:e.wrap(s,!0)},{type:"text",value:` -`}]}}var Yy={}.hasOwnProperty,f7={};function Iw(e,t){let n=t||f7,r=new Map,i=new Map,a=new Map,o={...Nw,...n.handlers},s={all:u,applyData:h7,definitionById:r,footnoteById:i,footnoteCounts:a,footnoteOrder:[],handlers:o,one:l,options:n,patch:d7,wrap:m7};return ht(e,function(c){if(c.type==="definition"||c.type==="footnoteDefinition"){let f=c.type==="definition"?r:i,d=String(c.identifier).toUpperCase();f.has(d)||f.set(d,c)}}),s;function l(c,f){let d=c.type,h=s.handlers[d];if(Yy.call(s.handlers,d)&&h)return h(s,c,f);if(s.options.passThrough&&s.options.passThrough.includes(d)){if("children"in c){let{children:b,...E}=c,g=Hr(E);return g.children=s.all(c),g}return Hr(c)}return(s.options.unknownHandler||p7)(s,c,f)}function u(c){let f=[];if("children"in c){let d=c.children,h=-1;for(;++h0&&n.push({type:"text",value:` `}),n}function Dw(e){let t=0,n=e.charCodeAt(t);for(;n===9||n===32;)t++,n=e.charCodeAt(t);return e.slice(t)}function gp(e,t){let n=Iw(e,t),r=n.one(e,void 0),i=Rw(n),a=Array.isArray(r)?{type:"root",children:r}:r||{type:"root",children:[]};return i&&("children"in a,a.children.push({type:"text",value:` -`},i)),a}function Uc(e,t){return e&&"run"in e?async function(n,r){let i=gp(n,{file:r,...t});await e.run(i,r)}:function(n,r){return gp(n,{file:r,...e||t})}}var g7={},b7={}.hasOwnProperty,Lw=cl("type",{handlers:{root:E7,element:x7,text:S7,comment:_7,doctype:T7}});function Ky(e,t){let r=(t||g7).space;return Lw(e,r==="svg"?cn:Ir)}function E7(e,t){let n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=$y(e.children,n,t),vl(e,n),n}function y7(e,t){let n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=$y(e.children,n,t),vl(e,n),n}function T7(e){let t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return vl(e,t),t}function S7(e){let t={nodeName:"#text",value:e.value,parentNode:null};return vl(e,t),t}function _7(e){let t={nodeName:"#comment",data:e.value,parentNode:null};return vl(e,t),t}function x7(e,t){let n=t,r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=cn);let i=[],a;if(e.properties){for(a in e.properties)if(a!=="children"&&b7.call(e.properties,a)){let l=A7(r,a,e.properties[a]);l&&i.push(l)}}let o=r.space;let s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Wr[o],childNodes:[],parentNode:null};return s.childNodes=$y(e.children,s,r),vl(e,s),e.tagName==="template"&&e.content&&(s.content=y7(e.content,r)),s}function A7(e,t,n){let r=Dr(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?dl(n):hl(n));let i={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){let a=i.name.indexOf(":");a<0?i.prefix="":(i.name=i.name.slice(a+1),i.prefix=r.attribute.slice(0,a)),i.namespace=Wr[r.space]}return i}function $y(e,t,n){let r=-1,i=[];if(e)for(;++r])/gi,N7=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Bw={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function bp(e,t){let n=B7(e),r=cl("type",{handlers:{root:v7,element:k7,text:w7,comment:Uw,doctype:M7,raw:R7},unknown:D7}),i={parser:n?new Pa(Bw):Pa.getFragmentParser(void 0,Bw),handle(s){r(s,i)},stitches:!1,options:t||{}};r(e,i),kl(i,Un());let a=n?i.parser.document:i.parser.getFragment(),o=cc(a,{file:i.options.file});return i.stitches&&ht(o,"comment",function(s,l,u){let c=s;if(c.value.stitch&&u&&l!==void 0){let f=u.children;return f[l]=c.value.stitch,l}}),o.type==="root"&&o.children.length===1&&o.children[0].type===e.type?o.children[0]:o}function Pw(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);let n={type:Da.TokenType.CHARACTER,chars:e.value,location:Hc(e)};kl(t,Un(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function M7(e,t){let n={type:Da.TokenType.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Hc(e)};kl(t,Un(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function O7(e,t){t.stitches=!0;let n=P7(e);if("children"in e&&"children"in n){let r=bp({type:"root",children:e.children},t.options);n.children=r.children}Uw({type:"comment",value:{stitch:n}},t)}function Uw(e,t){let n=e.value,r={type:Da.TokenType.COMMENT,data:n,location:Hc(e)};kl(t,Un(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function R7(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,Hw(t,Un(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(C7,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function D7(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))O7(n,t);else{let r="";throw N7.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function kl(e,t){Hw(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ft.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function Hw(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function I7(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ft.PLAINTEXT)return;kl(t,Un(e));let r=t.parser.openElements.current,i="namespaceURI"in r?r.namespaceURI:Wr.html;i===Wr.html&&n==="svg"&&(i=Wr.svg);let a=Ky({...e,children:[]},{space:i===Wr.svg?"svg":"html"}),o={type:Da.TokenType.START_TAG,tagName:n,tagID:dc.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in a?a.attrs:[],location:Hc(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function L7(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&hh.includes(n)||t.parser.tokenizer.state===ft.PLAINTEXT)return;kl(t,Mo(e));let r={type:Da.TokenType.END_TAG,tagName:n,tagID:dc.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Hc(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ft.RCDATA||t.parser.tokenizer.state===ft.RAWTEXT||t.parser.tokenizer.state===ft.SCRIPT_DATA)&&(t.parser.tokenizer.state=ft.DATA)}function B7(e){let t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Hc(e){let t=Un(e)||{line:void 0,column:void 0,offset:void 0},n=Mo(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function P7(e){return"children"in e?Hr({...e,children:[]}):Hr(e)}function zc(e){return function(t,n){return bp(t,{...e,file:n})}}var Fo=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],jy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Fo,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Fo],h2:[["className","sr-only"]],img:[...Fo,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Fo,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Fo],table:[...Fo],ul:[...Fo,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]};var qa={}.hasOwnProperty;function Xy(e,t){let n={type:"root",children:[]},r={schema:t?{...jy,...t}:jy,stack:[]},i=qw(r,e);return i&&(Array.isArray(i)?i.length===1?n=i[0]:n.children=i:n=i),n}function qw(e,t){if(t&&typeof t=="object"){let n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return U7(e,n);case"doctype":return H7(e,n);case"element":return z7(e,n);case"root":return F7(e,n);case"text":return q7(e,n);default:}}}function U7(e,t){if(e.schema.allowComments){let n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),a={type:"comment",value:r<0?n:n.slice(0,r)};return Fc(a,t),a}}function H7(e,t){if(e.schema.allowDoctypes){let n={type:"doctype"};return Fc(n,t),n}}function z7(e,t){let n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);let r=Vw(e,t.children),i=V7(e,t.properties);e.stack.pop();let a=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&qa.call(e.schema.ancestors,n))){let s=e.schema.ancestors[n],l=-1;for(a=!1;++l1){let i=!1,a=0;for(;++a-1&&a>l||o>-1&&a>o||s>-1&&a>s)return!0;let u=-1;for(;++u4&&t.slice(0,4).toLowerCase()==="data")return n}function Ep(e){return function(t){return Xy(t,e)}}var yp=function(e,t,n){let r=Jr(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=c):c&&(u!==void 0&&u>-1&&l.push(` -`.repeat(u)||" "),u=-1,l.push(c))}return l.join("")}function Ww(e,t,n){return e.type==="element"?Z7(e,t,n):e.type==="text"?n.whitespace==="normal"?Qw(e,n):J7(e):[]}function Z7(e,t,n){let r=Zw(e,n),i=e.children||[],a=-1,o=[];if(Q7(e))return o;let s,l;for(Qy(e)||jw(e)&&yp(t,e,jw)?l=` -`:W7(e)?(s=2,l=2):Xw(e)&&(s=1,l=1);++a]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},h=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],S={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},v={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},x=[v,f,s,n,e.C_BLOCK_COMMENT_MODE,c,u],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:x.concat([{begin:/\(/,end:/\)/,keywords:S,contains:x.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:h,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,c,s,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,c,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:S,illegal:"",keywords:S,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:S},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Jw(e){let t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=iq(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function eM(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let l={match:/\\"/},u={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],g={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],T=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],S=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],v=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:E,built_in:[...y,...T,"set","shopt",...S,...v]},contains:[h,e.SHEBANG(),m,f,a,o,g,s,l,u,c,n]}}function tM(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},h=t.optional(i)+e.IDENT_RE+"\\s*\\(",E={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},g=[f,s,n,e.C_BLOCK_COMMENT_MODE,c,u],y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:g.concat([{begin:/\(/,end:/\)/,keywords:E,contains:g.concat(["self"]),relevance:0}]),relevance:0},T={begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:h,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,c,s,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,c,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:E}}}function nM(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},h=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],S={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},v={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},x=[v,f,s,n,e.C_BLOCK_COMMENT_MODE,c,u],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:x.concat([{begin:/\(/,end:/\)/,keywords:S,contains:x.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:h,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,c,s,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,c,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:S,illegal:"",keywords:S,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:S},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function rM(e){let t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],a=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(a),built_in:t,literal:r},s=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(c,{illegal:/\n/}),d={className:"subst",begin:/\{/,end:/\}/,keywords:o},h=e.inherit(d,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,h]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},d]},E=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});d.contains=[b,m,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.C_BLOCK_COMMENT_MODE],h.contains=[E,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let g={variants:[u,b,m,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},y={begin:"<",end:">",contains:[{beginKeywords:"in out"},s]},T=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",S={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},g,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},s,y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+T+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,y],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[g,l,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},S]}}var aq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),oq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],sq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],lq=[...oq,...sq],uq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),cq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),fq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),dq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function iM(e){let t=e.regex,n=aq(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",a=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",s=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+cq.join("|")+")"},{begin:":(:)?("+fq.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+dq.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...s,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:uq.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...s,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+lq.join("|")+")\\b"}]}}function aM(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function oM(e){let a={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:a,illegal:"cM(e,t,n-1))}function fM(e){let t=e.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+cM("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},c={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[c,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,uM,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},uM,u]}}var dM="[A-Za-z$_][0-9A-Za-z$_]*",hq=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],pq=["true","false","null","undefined","NaN","Infinity"],hM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],pM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],mM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],mq=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],gq=[].concat(mM,hM,pM);function gM(e){let t=e.regex,n=(K,{after:F})=>{let N="",end:""},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,F)=>{let N=K[0].length+K.index,ae=K.input[N];if(ae==="<"||ae===","){F.ignoreMatch();return}ae===">"&&(n(K,{after:N})||F.ignoreMatch());let ce,k=K.input.substring(N);if(ce=k.match(/^\s*=/)){F.ignoreMatch();return}if((ce=k.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},s={$pattern:dM,keyword:hq,literal:pq,built_in:gq,"variable.language":mq},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},T=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,{match:/\$\d+/},f];d.contains=T.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(T)});let S=[].concat(y,d.contains),v=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v},M={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...hM,...pM]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Y(K){return t.concat("(?!",K.join("|"),")")}let z={match:t.concat(/\b/,Y([...mM,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,y,{match:/\$\d+/},f,R,{scope:"attr",match:r+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},A,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},z,H,M,$,{match:/\$[(.]/}]}}function bM(e){let t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ml="[0-9](_*[0-9])*",_p=`\\.(${Ml})`,xp="[0-9a-fA-F](_*[0-9a-fA-F])*",bq={className:"number",variants:[{begin:`(\\b(${Ml})((${_p})|\\.)?|(${_p}))[eE][+-]?(${Ml})[fFdD]?\\b`},{begin:`\\b(${Ml})((${_p})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${_p})[fFdD]?\\b`},{begin:`\\b(${Ml})[fFdD]\\b`},{begin:`\\b0[xX]((${xp})\\.?|(${xp})?\\.(${xp}))[pP][+-]?(${Ml})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${xp})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function EM(e){let t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[a,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,i]}]};i.contains.push(o);let s={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},u=bq,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},d=f;return d.variants[1].contains=[f],f.variants[1].contains=[d],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,n,r,s,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,c],relevance:0},e.C_LINE_COMMENT_MODE,c,s,l,o,e.C_NUMBER_MODE]},c]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` -`},u]}}var Eq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),yq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Tq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Sq=[...yq,...Tq],_q=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),yM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),TM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),xq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Aq=yM.concat(TM).sort().reverse();function SM(e){let t=Eq(e),n=Aq,r="and or not only",i="[\\w-]+",a="("+i+"|@\\{"+i+"\\})",o=[],s=[],l=function(T){return{className:"string",begin:"~?"+T+".*?"+T}},u=function(T,S,v){return{className:T,begin:S,relevance:v}},c={$pattern:/[a-z-]+/,keyword:r,attribute:_q.join(" ")},f={begin:"\\(",end:"\\)",contains:s,keywords:c,relevance:0};s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let d=s.concat({begin:/\{/,end:/\}/,contains:o}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(s)},m={begin:a+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+xq.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:c,returnEnd:!0,contains:s,relevance:0}},E={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:d}},g={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+Sq.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",a,0),u("selector-id","#"+a),u("selector-class","\\."+a,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+yM.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+TM.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:d},{begin:"!important"},t.FUNCTION_DISPATCH]},y={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[g]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,E,y,m,g,h,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function _M(e){let t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function xM(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},a={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},s=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,s,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},c={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),d=e.inherit(c,{contains:[]});u.contains.push(d),c.contains.push(f);let h=[n,l];return[u,c,f,d].forEach(g=>{g.contains=g.contains.concat(h)}),h=h.concat(u,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,a,u,c,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function CM(e){let t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,s={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:s,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function NM(e){let t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},a={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},s={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},c=[e.BACKSLASH_ESCAPE,a,l],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],d=(b,E,g="\\1")=>{let y=g==="\\1"?g:t.concat(g,E);return t.concat(t.concat("(?:",b,")"),E,/(?:\\.|[^\\\/])*?/,y,/(?:\\.|[^\\\/])*?/,g,r)},h=(b,E,g)=>t.concat(t.concat("(?:",b,")"),E,/(?:\\.|[^\\\/])*?/,g,r),m=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:d("s|tr|y",t.either(...f,{capture:!0}))},{begin:d("s|tr|y","\\(","\\)")},{begin:d("s|tr|y","\\[","\\]")},{begin:d("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return a.contains=m,o.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function vM(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},s={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),c=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(V,$)=>{$.data._beginMatch=V[1]||V[2]},"on:end":(V,$)=>{$.data._beginMatch!==V[1]&&$.ignoreMatch()}},d=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[ -]`,m={scope:"string",variants:[c,u,f,d]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},E=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],S={keyword:g,literal:(V=>{let $=[];return V.forEach(D=>{$.push(D),D.toLowerCase()===D?$.push(D.toUpperCase()):$.push(D.toLowerCase())}),$})(E),built_in:y},v=V=>V.map($=>$.replace(/\|\d+$/,"")),x={variants:[{match:[/new/,t.concat(h,"+"),t.concat("(?!",v(y).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},M=t.concat(r,"\\b(?!\\()"),R={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),M],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),M],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},L={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},A={relevance:0,begin:/\(/,end:/\)/,keywords:S,contains:[L,o,R,e.C_BLOCK_COMMENT_MODE,m,b,x]},H={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",v(g).join("\\b|"),"|",v(y).join("\\b|"),"\\b)"),r,t.concat(h,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[A]};A.contains.push(H);let Y=[L,R,e.C_BLOCK_COMMENT_MODE,m,b,x],z={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...Y]},...Y,{scope:"meta",variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:S,contains:[z,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},s,{scope:"variable.language",match:/\$this\b/},o,H,R,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},x,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:S,contains:["self",z,o,R,e.C_BLOCK_COMMENT_MODE,m,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,b]}}function kM(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function wM(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function MM(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:s,illegal:/#/},c={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,c,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,c,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",h=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,m=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${h}))[eE][+-]?(${d})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${d})[jJ](?=${m})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:s,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:["self",l,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s,illegal:/(<\/|\?)|=>/,contains:[l,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,g,f]}]}}function OM(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function RM(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[a,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function DM(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[s]}),e.COMMENT("^=begin","^=end",{contains:[s],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:o},f={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},d="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${d})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},x=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,u),relevance:0}].concat(l,u);c.contains=x,b.contains=x;let A=[{begin:/^\s*=>/,starts:{end:"$",contains:x}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:x}}];return u.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(A).concat(u).concat(x)}}function IM(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",s=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],c=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:c,keyword:s,literal:l,built_in:u},illegal:""},a]}}var Cq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Nq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],vq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],kq=[...Nq,...vq],wq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Mq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Oq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Rq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function LM(e){let t=Cq(e),n=Oq,r=Mq,i="@[a-z-]+",a="and or not only",s={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+kq.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},s,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Rq.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,s,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:wq.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},s,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function BM(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function PM(e){let t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],s=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],c=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],h=c,m=[...u,...l].filter(v=>!c.includes(v)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},g={match:t.concat(/\b/,t.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function y(v){return t.concat(/\b/,t.either(...v.map(x=>x.replace(/\s+/,"\\s+"))),/\b/)}let T={scope:"keyword",match:y(d),relevance:0};function S(v,{exceptions:x,when:M}={}){let R=M;return x=x||[],v.map(L=>L.match(/\|\d+$/)||x.includes(L)?L:R(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:S(m,{when:v=>v.length<3}),literal:a,type:s,built_in:f},contains:[{scope:"type",match:y(o)},T,g,b,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function FM(e){return e?typeof e=="string"?e:e.source:null}function qc(e){return Ke("(?=",e,")")}function Ke(...e){return e.map(n=>FM(n)).join("")}function Dq(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Cn(...e){return"("+(Dq(e).capture?"":"?:")+e.map(r=>FM(r)).join("|")+")"}var t1=e=>Ke(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Iq=["Protocol","Type"].map(t1),UM=["init","self"].map(t1),Lq=["Any","Self"],Jy=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],HM=["false","nil","true"],Bq=["assignment","associativity","higherThan","left","lowerThan","none","right"],Pq=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],zM=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],qM=Cn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),VM=Cn(qM,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),e1=Ke(qM,VM,"*"),GM=Cn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Cp=Cn(GM,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ii=Ke(GM,Cp,"*"),Ap=Ke(/[A-Z]/,Cp,"*"),Uq=["attached","autoclosure",Ke(/convention\(/,Cn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ke(/objc\(/,ii,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Hq=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function YM(e){let t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Cn(...Iq,...UM)],className:{2:"keyword"}},a={match:Ke(/\./,Cn(...Jy)),relevance:0},o=Jy.filter(se=>typeof se=="string").concat(["_|0"]),s=Jy.filter(se=>typeof se!="string").concat(Lq).map(t1),l={variants:[{className:"keyword",match:Cn(...s,...UM)}]},u={$pattern:Cn(/\b\w+/,/#\w+/),keyword:o.concat(Pq),literal:HM},c=[i,a,l],f={match:Ke(/\./,Cn(...zM)),relevance:0},d={className:"built_in",match:Ke(/\b/,Cn(...zM),/(?=\()/)},h=[f,d],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:e1},{match:`\\.(\\.|${VM})+`}]},E=[m,b],g="([0-9]_*)+",y="([0-9a-fA-F]_*)+",T={className:"number",relevance:0,variants:[{match:`\\b(${g})(\\.(${g}))?([eE][+-]?(${g}))?\\b`},{match:`\\b0x(${y})(\\.(${y}))?([pP][+-]?(${g}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},S=(se="")=>({className:"subst",variants:[{match:Ke(/\\/,se,/[0\\tnr"']/)},{match:Ke(/\\/,se,/u\{[0-9a-fA-F]{1,8}\}/)}]}),v=(se="")=>({className:"subst",match:Ke(/\\/,se,/[\t ]*(?:[\r\n]|\r\n)/)}),x=(se="")=>({className:"subst",label:"interpol",begin:Ke(/\\/,se,/\(/),end:/\)/}),M=(se="")=>({begin:Ke(se,/"""/),end:Ke(/"""/,se),contains:[S(se),v(se),x(se)]}),R=(se="")=>({begin:Ke(se,/"/),end:Ke(/"/,se),contains:[S(se),x(se)]}),L={className:"string",variants:[M(),M("#"),M("##"),M("###"),R(),R("#"),R("##"),R("###")]},A=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:A},Y=se=>{let _t=Ke(se,/\//),ue=Ke(/\//,se);return{begin:_t,end:ue,contains:[...A,{scope:"comment",begin:`#(?!.*${ue})`,end:/$/}]}},z={scope:"regexp",variants:[Y("###"),Y("##"),Y("#"),H]},V={match:Ke(/`/,ii,/`/)},$={className:"variable",match:/\$\d+/},D={className:"variable",match:`\\$${Cp}+`},B=[V,$,D],K={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Hq,contains:[...E,T,L]}]}},F={scope:"keyword",match:Ke(/@/,Cn(...Uq),qc(Cn(/\(/,/\s+/)))},N={scope:"meta",match:Ke(/@/,ii)},ae=[K,F,N],ce={match:qc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ke(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Cp,"+")},{className:"type",match:Ap,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ke(/\s+&\s+/,qc(Ap)),relevance:0}]},k={begin://,keywords:u,contains:[...r,...c,...ae,m,ce]};ce.contains.push(k);let Te={match:Ke(ii,/\s*:/),keywords:"_|0",relevance:0},be={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",Te,...r,z,...c,...h,...E,T,L,...B,...ae,ce]},He={begin://,keywords:"repeat each",contains:[...r,ce]},et={begin:Cn(qc(Ke(ii,/\s*:/)),qc(Ke(ii,/\s+/,ii,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ii}]},Ee={begin:/\(/,end:/\)/,keywords:u,contains:[et,...r,...c,...E,T,L,...ae,ce,be],endsParent:!0,illegal:/["']/},lt={match:[/(func|macro)/,/\s+/,Cn(V.match,ii,e1)],className:{1:"keyword",3:"title.function"},contains:[He,Ee,t],illegal:[/\[/,/%/]},Ve={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[He,Ee,t],illegal:/\[|%/},St={match:[/operator/,/\s+/,e1],className:{1:"keyword",3:"title"}},Pt={begin:[/precedencegroup/,/\s+/,Ap],className:{1:"keyword",3:"title"},contains:[ce],keywords:[...Bq,...HM],end:/}/},wn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},qr={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ii,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[He,...c,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:Ap},...c],relevance:0}]};for(let se of L.variants){let _t=se.contains.find(Wn=>Wn.label==="interpol");_t.keywords=u;let ue=[...c,...h,...E,T,L,...B];_t.contains=[...ue,{begin:/\(/,end:/\)/,contains:["self",...ue]}]}return{name:"Swift",keywords:u,contains:[...r,lt,Ve,wn,qr,ee,St,Pt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},z,...c,...h,...E,T,L,...B,...ae,ce,be]}}var Np="[A-Za-z$_][0-9A-Za-z$_]*",KM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],$M=["true","false","null","undefined","NaN","Infinity"],jM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],XM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],WM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],QM=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ZM=[].concat(WM,jM,XM);function zq(e){let t=e.regex,n=(K,{after:F})=>{let N="",end:""},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,F)=>{let N=K[0].length+K.index,ae=K.input[N];if(ae==="<"||ae===","){F.ignoreMatch();return}ae===">"&&(n(K,{after:N})||F.ignoreMatch());let ce,k=K.input.substring(N);if(ce=k.match(/^\s*=/)){F.ignoreMatch();return}if((ce=k.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},s={$pattern:Np,keyword:KM,literal:$M,built_in:ZM,"variable.language":QM},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},T=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,{match:/\$\d+/},f];d.contains=T.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(T)});let S=[].concat(y,d.contains),v=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v},M={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...jM,...XM]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Y(K){return t.concat("(?!",K.join("|"),")")}let z={match:t.concat(/\b/,Y([...WM,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,y,{match:/\$\d+/},f,R,{scope:"attr",match:r+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},A,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},z,H,M,$,{match:/\$[(.]/}]}}function JM(e){let t=e.regex,n=zq(e),r=Np,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Np,keyword:KM.concat(l),literal:$M,built_in:ZM.concat(i),"variable.language":QM},c={className:"meta",begin:"@"+r},f=(b,E,g)=>{let y=b.contains.findIndex(T=>T.label===E);if(y===-1)throw new Error("can not find mode to replace");b.contains.splice(y,1,g)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(c);let d=n.contains.find(b=>b.scope==="attr"),h=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,h]),n.contains=n.contains.concat([c,a,o,h]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",s);let m=n.contains.find(b=>b.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function eO(e){let t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},c={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),d=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,u,c,f,d,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[d]}]}}function tO(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");let n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},a={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},s={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},a,o,i,e.QUOTE_STRING_MODE,l,u,s]}}function nO(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[a,l,s,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[a,o,l,s]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function rO(e){let t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[h],illegal:"\\n",relevance:0},E=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,b,a,o],g=[...E];return g.pop(),g.push(s),h.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}var n1={arduino:Jw,bash:eM,c:tM,cpp:nM,csharp:rM,css:iM,diff:aM,go:oM,graphql:sM,ini:lM,java:fM,javascript:gM,json:bM,kotlin:EM,less:SM,lua:_M,makefile:xM,markdown:AM,objectivec:CM,perl:NM,php:vM,"php-template":kM,plaintext:wM,python:MM,"python-repl":OM,r:RM,ruby:DM,rust:IM,scss:LM,shell:BM,sql:PM,swift:YM,typescript:JM,vbnet:eO,wasm:tO,xml:nO,yaml:rO};var AO=q(xO(),1);var CO=AO.default;var NO={},MV="hljs-";function d1(e){let t=CO.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(l,u,c){let f=c||NO,d=typeof f.prefix=="string"?f.prefix:MV;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:f1,classPrefix:d});let h=t.highlight(u,{ignoreIllegals:!0,language:l});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});let m=h._emitter.root,b=m.data;return b.language=h.language,b.relevance=h.relevance,m}function r(l,u){let f=(u||NO).subset||i(),d=-1,h=0,m;for(;++dh&&(h=E.data.relevance,m=E)}return m||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return t.listLanguages()}function a(l,u){if(typeof l=="string")t.registerLanguage(l,u);else{let c;for(c in l)Object.hasOwn(l,c)&&t.registerLanguage(c,l[c])}}function o(l,u){if(typeof l=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:l});else{let c;for(c in l)if(Object.hasOwn(l,c)){let f=l[c];t.registerAliases(typeof f=="string"?f:[...f],{languageName:c})}}}function s(l){return!!t.getLanguage(l)}}var f1=class{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){let r=this.stack[this.stack.length-1],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){let n=this,r=t.split(".").map(function(o,s){return s?o+"_".repeat(s):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],a={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(a),this.stack.push(a)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}};var OV={};function Op(e){let t=e||OV,n=t.aliases,r=t.detect||!1,i=t.languages||n1,a=t.plainText,o=t.prefix,s=t.subset,l="hljs",u=d1(i);if(n&&u.registerAlias(n),o){let c=o.indexOf("-");l=c===-1?o:o.slice(0,c)}return function(c,f){ht(c,"element",function(d,h,m){if(d.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;let b=RV(d);if(b===!1||!b&&!r||b&&a&&a.includes(b))return;Array.isArray(d.properties.className)||(d.properties.className=[]),d.properties.className.includes(l)||d.properties.className.unshift(l);let E=Zy(d,{whitespace:"pre"}),g;try{g=b?u.highlight(b,E,{prefix:o}):u.highlightAuto(E,{prefix:o,subset:s})}catch(y){let T=y;if(b&&/Unknown language/.test(T.message)){f.message("Cannot highlight as `"+b+"`, it\u2019s not registered",{ancestors:[m,d],cause:T,place:d.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw T}!b&&g.data&&g.data.language&&d.properties.className.push("language-"+g.data.language),g.children.length>0&&(d.children=g.children)})}}function RV(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++ne=>{ht(e,"element",t=>{let n=t.properties;if(!n||!(Kh(n.className)||"dataSuggestion"in n))return;let i=typeof n.dataSuggestion=="string"&&n.dataSuggestion||Nc(t.children);"tabIndex"in n||(n.tabIndex=0),"role"in n||(n.role="button"),!("ariaLabel"in n)&&i&&(n.ariaLabel=`Use chat suggestion: ${i}`)})};var vO=()=>e=>{ht(e,"html",(t,n,r)=>{if(!r||n===void 0)return;let i={type:"text",value:t.value};return r.children.splice(n,1,i),[ei,n]})};var p1=()=>e=>{ht(e,"element",t=>{if(t.tagName!=="a")return;let n=t.properties?.href;typeof n=="string"&&(n.startsWith("#")||/^[a-z][a-z0-9+.-]*:/i.test(n)&&!/^https?:/i.test(n)||(t.properties={...t.properties,dataShinychatLink:"",target:"_blank",rel:"noopener noreferrer"}))})};var m1=()=>e=>{ht(e,"element",t=>{let n=t.properties;n&&(t.tagName==="input"||t.tagName==="textarea")&&("value"in n&&(n.defaultValue=n.value,delete n.value),"checked"in n&&(n.defaultChecked=n.checked,delete n.checked))})};var DV=new Set(["shiny-tool-request","shiny-tool-result","shinychat-raw-html"]);function IV(e){return e.type==="element"&&DV.has(e.tagName)}function kO(e){return e.some(t=>t.type==="text"?t.value.trim().length>0:!0)}function wO(e){ht(e,"element",(t,n,r)=>{if(t.tagName!=="p"||!r||n===void 0)return;let i=t.children.findIndex(IV);if(i===-1)return;let a=t.children.slice(0,i),o=t.children[i],s=t.children.slice(i+1),l=[];if(a.length>0&&kO(a)&&l.push({...t,children:a}),l.push(o),s.length>0&&kO(s)){let c={type:"root",children:[{...t,children:s}]};wO(c),l.push(...c.children)}return r.children.splice(n,1,...l),[ei,n]})}var MO=()=>wO;var OO=()=>e=>{ht(e,"element",(t,n,r)=>{if(!r||n===void 0||t.tagName!=="ul"&&t.tagName!=="ol")return;let i=LV(t.children);if(!i)return;let a=BV(i);if(!a)return;let o={type:"element",tagName:"p",properties:{},children:[{type:"text",value:a}]};return r.children.splice(n+1,0,o),[ei,n+1]})};function LV(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type==="element"&&n.tagName==="li")return n}return null}function BV(e){let t=e.children;if(t.length<2)return null;let n=t[t.length-1];if(n.type!=="text")return null;let r=n.value.indexOf(` -`);if(r===-1)return null;let i=n.value.substring(0,r),a=n.value.substring(r+1).trim();if(!a)return null;let o=t[t.length-2];return!o||o.type!=="element"?null:(i.trim()?n.value=i:t.pop(),a)}var RO=kc().use(Ic).use(Bc).use(Uc,{allowDangerousHtml:!0}).use(zc).use(OO).use(MO).use(m1).use(h1).use(BE).use(p1).use(Op,{detect:!1,ignoreMissing:!0}).freeze(),DO=kc().use(m1).use(h1).use(BE).use(p1).freeze(),IO=kc().use(Ic).use(Bc).use(vO).use(Uc,{allowDangerousHtml:!0}).use(zc).use(Ep).freeze();var Rp=q(me(),1),Yc=q(ne(),1);function LO({children:e,node:t,...n}){let[r,i]=(0,Rp.useState)(!1),a=(0,Rp.useRef)(null);return(0,Yc.jsxs)("pre",{ref:a,...n,children:[(0,Yc.jsx)("button",{onClick:async()=>{let l=a.current?.querySelector("code")?.textContent??"";try{await navigator.clipboard.writeText(l)}catch{let u=document.createElement("textarea");u.value=l,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}i(!0),setTimeout(()=>i(!1),2e3)},className:`code-copy-button${r?" code-copy-button-checked":""}`,title:"Copy to clipboard","aria-label":"Copy to clipboard",children:(0,Yc.jsx)("i",{className:"bi"})}),e]})}var BO=q(ne(),1);function g1({children:e,node:t,...n}){return(0,BO.jsx)("table",{className:"table table-striped table-bordered",...n,children:e})}var Ga=q(me(),1);var PO=q(ne(),1);function Go({html:e,className:t,displayContents:n=!0}){let r=(0,Ga.useRef)(null),[i,a]=(0,Ga.useState)(!1),o=(0,Ga.useContext)(Ma);return(0,Ga.useEffect)(()=>{let s=r.current;return s?(s.innerHTML=e,s.parentElement?.classList.contains("html-fill-container")&&a(!0),o&&e&&o.bindAll(s),()=>{o&&s&&o.unbindAll(s)}):void 0},[e,o]),(0,PO.jsx)("div",{ref:r,className:i?`html-fill-item html-fill-container${t?` ${t}`:""}`:t,style:n?{display:"contents"}:void 0})}var Hn=q(ne(),1),PV={pre:LO,table:g1,"shinychat-raw-html":({node:e})=>(0,Hn.jsx)(Go,{html:e?iE(e.children):"",displayContents:!0})},UV={table:g1};function $t({content:e,contentType:t,role:n,streaming:r=!1,tagToComponentMap:i,prefix:a}){let o=n==="user",s=t==="text",l=t==="html",u=l?DO:o?IO:RO,c=(0,zi.useMemo)(()=>o?{...UV,...i}:{...PV,...i},[o,i]),f=(0,zi.useMemo)(()=>s?null:l?vk(e,u):Nk(e,u),[e,s,l,u]),d=(0,zi.useMemo)(()=>f?kk(f,{tagToComponentMap:c,streaming:r}):null,[f,r,c]);return s?(0,Hn.jsxs)(Hn.Fragment,{children:[a,a&&" ",e]}):a&&d?(0,Hn.jsx)(Hn.Fragment,{children:HV(d,a)}):(0,Hn.jsx)(Hn.Fragment,{children:d})}function HV(e,t){let n=zi.default.Children.toArray(e.props.children);for(let r=0;r +`},i)),a}function Uc(e,t){return e&&"run"in e?async function(n,r){let i=gp(n,{file:r,...t});await e.run(i,r)}:function(n,r){return gp(n,{file:r,...e||t})}}var b7={},E7={}.hasOwnProperty,Lw=cl("type",{handlers:{root:y7,element:A7,text:_7,comment:x7,doctype:S7}});function Ky(e,t){let r=(t||b7).space;return Lw(e,r==="svg"?cn:Ir)}function y7(e,t){let n={nodeName:"#document",mode:(e.data||{}).quirksMode?"quirks":"no-quirks",childNodes:[]};return n.childNodes=$y(e.children,n,t),vl(e,n),n}function T7(e,t){let n={nodeName:"#document-fragment",childNodes:[]};return n.childNodes=$y(e.children,n,t),vl(e,n),n}function S7(e){let t={nodeName:"#documentType",name:"html",publicId:"",systemId:"",parentNode:null};return vl(e,t),t}function _7(e){let t={nodeName:"#text",value:e.value,parentNode:null};return vl(e,t),t}function x7(e){let t={nodeName:"#comment",data:e.value,parentNode:null};return vl(e,t),t}function A7(e,t){let n=t,r=n;e.type==="element"&&e.tagName.toLowerCase()==="svg"&&n.space==="html"&&(r=cn);let i=[],a;if(e.properties){for(a in e.properties)if(a!=="children"&&E7.call(e.properties,a)){let l=C7(r,a,e.properties[a]);l&&i.push(l)}}let o=r.space;let s={nodeName:e.tagName,tagName:e.tagName,attrs:i,namespaceURI:Wr[o],childNodes:[],parentNode:null};return s.childNodes=$y(e.children,s,r),vl(e,s),e.tagName==="template"&&e.content&&(s.content=T7(e.content,r)),s}function C7(e,t,n){let r=Dr(e,t);if(n===!1||n===null||n===void 0||typeof n=="number"&&Number.isNaN(n)||!n&&r.boolean)return;Array.isArray(n)&&(n=r.commaSeparated?dl(n):hl(n));let i={name:r.attribute,value:n===!0?"":String(n)};if(r.space&&r.space!=="html"&&r.space!=="svg"){let a=i.name.indexOf(":");a<0?i.prefix="":(i.name=i.name.slice(a+1),i.prefix=r.attribute.slice(0,a)),i.namespace=Wr[r.space]}return i}function $y(e,t,n){let r=-1,i=[];if(e)for(;++r])/gi,v7=new Set(["mdxFlowExpression","mdxJsxFlowElement","mdxJsxTextElement","mdxTextExpression","mdxjsEsm"]),Bw={sourceCodeLocationInfo:!0,scriptingEnabled:!1};function bp(e,t){let n=P7(e),r=cl("type",{handlers:{root:k7,element:w7,text:M7,comment:Uw,doctype:O7,raw:D7},unknown:I7}),i={parser:n?new Pa(Bw):Pa.getFragmentParser(void 0,Bw),handle(s){r(s,i)},stitches:!1,options:t||{}};r(e,i),kl(i,Un());let a=n?i.parser.document:i.parser.getFragment(),o=cc(a,{file:i.options.file});return i.stitches&&ht(o,"comment",function(s,l,u){let c=s;if(c.value.stitch&&u&&l!==void 0){let f=u.children;return f[l]=c.value.stitch,l}}),o.type==="root"&&o.children.length===1&&o.children[0].type===e.type?o.children[0]:o}function Pw(e,t){let n=-1;if(e)for(;++n4&&(t.parser.tokenizer.state=0);let n={type:Da.TokenType.CHARACTER,chars:e.value,location:Hc(e)};kl(t,Un(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function O7(e,t){let n={type:Da.TokenType.DOCTYPE,name:"html",forceQuirks:!1,publicId:"",systemId:"",location:Hc(e)};kl(t,Un(e)),t.parser.currentToken=n,t.parser._processToken(t.parser.currentToken)}function R7(e,t){t.stitches=!0;let n=U7(e);if("children"in e&&"children"in n){let r=bp({type:"root",children:e.children},t.options);n.children=r.children}Uw({type:"comment",value:{stitch:n}},t)}function Uw(e,t){let n=e.value,r={type:Da.TokenType.COMMENT,data:n,location:Hc(e)};kl(t,Un(e)),t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken)}function D7(e,t){if(t.parser.tokenizer.preprocessor.html="",t.parser.tokenizer.preprocessor.pos=-1,t.parser.tokenizer.preprocessor.lastGapPos=-2,t.parser.tokenizer.preprocessor.gapStack=[],t.parser.tokenizer.preprocessor.skipNextNewLine=!1,t.parser.tokenizer.preprocessor.lastChunkWritten=!1,t.parser.tokenizer.preprocessor.endOfChunkHit=!1,t.parser.tokenizer.preprocessor.isEol=!1,Hw(t,Un(e)),t.parser.tokenizer.write(t.options.tagfilter?e.value.replace(N7,"<$1$2"):e.value,!1),t.parser.tokenizer._runParsingLoop(),t.parser.tokenizer.state===72||t.parser.tokenizer.state===78){t.parser.tokenizer.preprocessor.lastChunkWritten=!0;let n=t.parser.tokenizer._consume();t.parser.tokenizer._callState(n)}}function I7(e,t){let n=e;if(t.options.passThrough&&t.options.passThrough.includes(n.type))R7(n,t);else{let r="";throw v7.has(n.type)&&(r=". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax"),new Error("Cannot compile `"+n.type+"` node"+r)}}function kl(e,t){Hw(e,t);let n=e.parser.tokenizer.currentCharacterToken;n&&n.location&&(n.location.endLine=e.parser.tokenizer.preprocessor.line,n.location.endCol=e.parser.tokenizer.preprocessor.col+1,n.location.endOffset=e.parser.tokenizer.preprocessor.offset+1,e.parser.currentToken=n,e.parser._processToken(e.parser.currentToken)),e.parser.tokenizer.paused=!1,e.parser.tokenizer.inLoop=!1,e.parser.tokenizer.active=!1,e.parser.tokenizer.returnState=ft.DATA,e.parser.tokenizer.charRefCode=-1,e.parser.tokenizer.consumedAfterSnapshot=-1,e.parser.tokenizer.currentLocation=null,e.parser.tokenizer.currentCharacterToken=null,e.parser.tokenizer.currentToken=null,e.parser.tokenizer.currentAttr={name:"",value:""}}function Hw(e,t){if(t&&t.offset!==void 0){let n={startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:-1,endCol:-1,endOffset:-1};e.parser.tokenizer.preprocessor.lineStartPos=-t.column+1,e.parser.tokenizer.preprocessor.droppedBufferSize=t.offset,e.parser.tokenizer.preprocessor.line=t.line,e.parser.tokenizer.currentLocation=n}}function L7(e,t){let n=e.tagName.toLowerCase();if(t.parser.tokenizer.state===ft.PLAINTEXT)return;kl(t,Un(e));let r=t.parser.openElements.current,i="namespaceURI"in r?r.namespaceURI:Wr.html;i===Wr.html&&n==="svg"&&(i=Wr.svg);let a=Ky({...e,children:[]},{space:i===Wr.svg?"svg":"html"}),o={type:Da.TokenType.START_TAG,tagName:n,tagID:dc.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:"attrs"in a?a.attrs:[],location:Hc(e)};t.parser.currentToken=o,t.parser._processToken(t.parser.currentToken),t.parser.tokenizer.lastStartTagName=n}function B7(e,t){let n=e.tagName.toLowerCase();if(!t.parser.tokenizer.inForeignNode&&hh.includes(n)||t.parser.tokenizer.state===ft.PLAINTEXT)return;kl(t,Mo(e));let r={type:Da.TokenType.END_TAG,tagName:n,tagID:dc.getTagID(n),selfClosing:!1,ackSelfClosing:!1,attrs:[],location:Hc(e)};t.parser.currentToken=r,t.parser._processToken(t.parser.currentToken),n===t.parser.tokenizer.lastStartTagName&&(t.parser.tokenizer.state===ft.RCDATA||t.parser.tokenizer.state===ft.RAWTEXT||t.parser.tokenizer.state===ft.SCRIPT_DATA)&&(t.parser.tokenizer.state=ft.DATA)}function P7(e){let t=e.type==="root"?e.children[0]:e;return!!(t&&(t.type==="doctype"||t.type==="element"&&t.tagName.toLowerCase()==="html"))}function Hc(e){let t=Un(e)||{line:void 0,column:void 0,offset:void 0},n=Mo(e)||{line:void 0,column:void 0,offset:void 0};return{startLine:t.line,startCol:t.column,startOffset:t.offset,endLine:n.line,endCol:n.column,endOffset:n.offset}}function U7(e){return"children"in e?Hr({...e,children:[]}):Hr(e)}function zc(e){return function(t,n){return bp(t,{...e,file:n})}}var Fo=["ariaDescribedBy","ariaLabel","ariaLabelledBy"],jy={ancestors:{tbody:["table"],td:["table"],th:["table"],thead:["table"],tfoot:["table"],tr:["table"]},attributes:{a:[...Fo,"dataFootnoteBackref","dataFootnoteRef",["className","data-footnote-backref"],"href"],blockquote:["cite"],code:[["className",/^language-./]],del:["cite"],div:["itemScope","itemType"],dl:[...Fo],h2:[["className","sr-only"]],img:[...Fo,"longDesc","src"],input:[["disabled",!0],["type","checkbox"]],ins:["cite"],li:[["className","task-list-item"]],ol:[...Fo,["className","contains-task-list"]],q:["cite"],section:["dataFootnotes",["className","footnotes"]],source:["srcSet"],summary:[...Fo],table:[...Fo],ul:[...Fo,["className","contains-task-list"]],"*":["abbr","accept","acceptCharset","accessKey","action","align","alt","axis","border","cellPadding","cellSpacing","char","charOff","charSet","checked","clear","colSpan","color","cols","compact","coords","dateTime","dir","encType","frame","hSpace","headers","height","hrefLang","htmlFor","id","isMap","itemProp","label","lang","maxLength","media","method","multiple","name","noHref","noShade","noWrap","open","prompt","readOnly","rev","rowSpan","rows","rules","scope","selected","shape","size","span","start","summary","tabIndex","title","useMap","vAlign","value","width"]},clobber:["ariaDescribedBy","ariaLabelledBy","id","name"],clobberPrefix:"user-content-",protocols:{cite:["http","https"],href:["http","https","irc","ircs","mailto","xmpp"],longDesc:["http","https"],src:["http","https"]},required:{input:{disabled:!0,type:"checkbox"}},strip:["script"],tagNames:["a","b","blockquote","br","code","dd","del","details","div","dl","dt","em","h1","h2","h3","h4","h5","h6","hr","i","img","input","ins","kbd","li","ol","p","picture","pre","q","rp","rt","ruby","s","samp","section","source","span","strike","strong","sub","summary","sup","table","tbody","td","tfoot","th","thead","tr","tt","ul","var"]};var qa={}.hasOwnProperty;function Xy(e,t){let n={type:"root",children:[]},r={schema:t?{...jy,...t}:jy,stack:[]},i=qw(r,e);return i&&(Array.isArray(i)?i.length===1?n=i[0]:n.children=i:n=i),n}function qw(e,t){if(t&&typeof t=="object"){let n=t;switch(typeof n.type=="string"?n.type:""){case"comment":return H7(e,n);case"doctype":return z7(e,n);case"element":return F7(e,n);case"root":return q7(e,n);case"text":return V7(e,n);default:}}}function H7(e,t){if(e.schema.allowComments){let n=typeof t.value=="string"?t.value:"",r=n.indexOf("-->"),a={type:"comment",value:r<0?n:n.slice(0,r)};return Fc(a,t),a}}function z7(e,t){if(e.schema.allowDoctypes){let n={type:"doctype"};return Fc(n,t),n}}function F7(e,t){let n=typeof t.tagName=="string"?t.tagName:"";e.stack.push(n);let r=Vw(e,t.children),i=G7(e,t.properties);e.stack.pop();let a=!1;if(n&&n!=="*"&&(!e.schema.tagNames||e.schema.tagNames.includes(n))&&(a=!0,e.schema.ancestors&&qa.call(e.schema.ancestors,n))){let s=e.schema.ancestors[n],l=-1;for(a=!1;++l1){let i=!1,a=0;for(;++a-1&&a>l||o>-1&&a>o||s>-1&&a>s)return!0;let u=-1;for(;++u4&&t.slice(0,4).toLowerCase()==="data")return n}function Ep(e){return function(t){return Xy(t,e)}}var yp=function(e,t,n){let r=Jr(n);if(!e||!e.type||!e.children)throw new Error("Expected parent node");if(typeof t=="number"){if(t<0||t===Number.POSITIVE_INFINITY)throw new Error("Expected positive finite number as index")}else if(t=e.children.indexOf(t),t<0)throw new Error("Expected child node or index");for(;++tu&&(u=c):c&&(u!==void 0&&u>-1&&l.push(` +`.repeat(u)||" "),u=-1,l.push(c))}return l.join("")}function Ww(e,t,n){return e.type==="element"?J7(e,t,n):e.type==="text"?n.whitespace==="normal"?Qw(e,n):eq(e):[]}function J7(e,t,n){let r=Zw(e,n),i=e.children||[],a=-1,o=[];if(Z7(e))return o;let s,l;for(Qy(e)||jw(e)&&yp(t,e,jw)?l=` +`:Q7(e)?(s=2,l=2):Xw(e)&&(s=1,l=1);++a]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},h=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],S={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},v={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},x=[v,f,s,n,e.C_BLOCK_COMMENT_MODE,c,u],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:x.concat([{begin:/\(/,end:/\)/,keywords:S,contains:x.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:h,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,c,s,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,c,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:S,illegal:"",keywords:S,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:S},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Jw(e){let t={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},n=aq(e),r=n.keywords;return r.type=[...r.type,...t.type],r.literal=[...r.literal,...t.literal],r.built_in=[...r.built_in,...t.built_in],r._hints=t._hints,n.name="Arduino",n.aliases=["ino"],n.supersetOf="cpp",n}function eM(e){let t=e.regex,n={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[n]}]};Object.assign(n,{className:"variable",variants:[{begin:t.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});let i={className:"subst",begin:/\$\(/,end:/\)/,contains:[e.BACKSLASH_ESCAPE]},a=e.inherit(e.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),o={begin:/<<-?\s*(?=\w+)/,starts:{contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,n,i]};i.contains.push(s);let l={match:/\\"/},u={className:"string",begin:/'/,end:/'/},c={match:/\\'/},f={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},e.NUMBER_MODE,n]},d=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],h=e.SHEBANG({binary:`(${d.join("|")})`,relevance:10}),m={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[e.inherit(e.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],E=["true","false"],g={match:/(\/[a-z._-]+)+/},y=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],T=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],S=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],v=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:E,built_in:[...y,...T,"set","shopt",...S,...v]},contains:[h,e.SHEBANG(),m,f,a,o,g,s,l,u,c,n]}}function tM(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},h=t.optional(i)+e.IDENT_RE+"\\s*\\(",E={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},g=[f,s,n,e.C_BLOCK_COMMENT_MODE,c,u],y={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:E,contains:g.concat([{begin:/\(/,end:/\)/,keywords:E,contains:g.concat(["self"]),relevance:0}]),relevance:0},T={begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:E,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:E,relevance:0},{begin:h,returnBegin:!0,contains:[e.inherit(d,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,c,s,{begin:/\(/,end:/\)/,keywords:E,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,c,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C",aliases:["h"],keywords:E,disableAutodetect:!0,illegal:"=]/,contains:[{beginKeywords:"final class struct"},e.TITLE_MODE]}]),exports:{preprocessor:f,strings:u,keywords:E}}}function nM(e){let t=e.regex,n=e.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",i="[a-zA-Z_]\\w*::",o="(?!struct)("+r+"|"+t.optional(i)+"[a-zA-Z_]\\w*"+t.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},u={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[e.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},e.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},c={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},f={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},e.inherit(u,{className:"string"}),{className:"string",begin:/<.*?>/},n,e.C_BLOCK_COMMENT_MODE]},d={className:"title",begin:t.optional(i)+e.IDENT_RE,relevance:0},h=t.optional(i)+e.IDENT_RE+"\\s*\\(",m=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],E=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],g=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],S={type:b,keyword:m,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:E},v={className:"function.dispatch",relevance:0,keywords:{_hint:g},begin:t.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,e.IDENT_RE,t.lookahead(/(<[^<>]+>|)\s*\(/))},x=[v,f,s,n,e.C_BLOCK_COMMENT_MODE,c,u],M={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:S,contains:x.concat([{begin:/\(/,end:/\)/,keywords:S,contains:x.concat(["self"]),relevance:0}]),relevance:0},R={className:"function",begin:"("+o+"[\\*&\\s]+)+"+h,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:S,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:S,relevance:0},{begin:h,returnBegin:!0,contains:[d],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[u,c]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:[n,e.C_BLOCK_COMMENT_MODE,u,c,s,{begin:/\(/,end:/\)/,keywords:S,relevance:0,contains:["self",n,e.C_BLOCK_COMMENT_MODE,u,c,s]}]},s,n,e.C_BLOCK_COMMENT_MODE,f]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:S,illegal:"",keywords:S,contains:["self",s]},{begin:e.IDENT_RE+"::",keywords:S},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function rM(e){let t=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],n=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],i=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],a=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],o={keyword:i.concat(a),built_in:t,literal:r},s=e.inherit(e.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),l={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},u={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},c={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},f=e.inherit(c,{illegal:/\n/}),d={className:"subst",begin:/\{/,end:/\}/,keywords:o},h=e.inherit(d,{illegal:/\n/}),m={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},e.BACKSLASH_ESCAPE,h]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},d]},E=e.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},h]});d.contains=[b,m,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.C_BLOCK_COMMENT_MODE],h.contains=[E,m,f,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,l,e.inherit(e.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];let g={variants:[u,b,m,c,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},y={begin:"<",end:">",contains:[{beginKeywords:"in out"},s]},T=e.IDENT_RE+"(<"+e.IDENT_RE+"(\\s*,\\s*"+e.IDENT_RE+")*>)?(\\[\\])?",S={begin:"@"+e.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:o,illegal:/::/,contains:[e.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:""},{begin:""}]}]}),e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},g,l,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},s,y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,y,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+T+"\\s+)+"+e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:o,contains:[{beginKeywords:n.join(" "),relevance:0},{begin:e.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[e.TITLE_MODE,y],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:o,relevance:0,contains:[g,l,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},S]}}var oq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),sq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],lq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],uq=[...sq,...lq],cq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),fq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),dq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),hq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function iM(e){let t=e.regex,n=oq(e),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},i="and or not only",a=/@-?\w[\w]*(-\w+)*/,o="[a-zA-Z-][a-zA-Z0-9_-]*",s=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[n.BLOCK_COMMENT,r,n.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+o,relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+fq.join("|")+")"},{begin:":(:)?("+dq.join("|")+")"}]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+hq.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[n.BLOCK_COMMENT,n.HEXCOLOR,n.IMPORTANT,n.CSS_NUMBER_MODE,...s,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},n.FUNCTION_DISPATCH]},{begin:t.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:a},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:i,attribute:cq.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...s,n.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+uq.join("|")+")\\b"}]}}function aM(e){let t=e.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:t.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:t.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function oM(e){let a={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:a,illegal:"cM(e,t,n-1))}function fM(e){let t=e.regex,n="[\xC0-\u02B8a-zA-Z_$][\xC0-\u02B8a-zA-Z_$0-9]*",r=n+cM("(?:<"+n+"~~~(?:\\s*,\\s*"+n+"~~~)*>)?",/~~~/g,2),l={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},u={className:"meta",begin:"@"+n,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},c={className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[e.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:l,illegal:/<\/|#/,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[e.BACKSLASH_ESCAPE]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,n],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[t.concat(/(?!else)/,n),/\s+/,n,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,n],className:{1:"keyword",3:"title.class"},contains:[c,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",e.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:l,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:l,relevance:0,contains:[u,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,uM,e.C_BLOCK_COMMENT_MODE]},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},uM,u]}}var dM="[A-Za-z$_][0-9A-Za-z$_]*",pq=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],mq=["true","false","null","undefined","NaN","Infinity"],hM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],pM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],mM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],gq=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],bq=[].concat(mM,hM,pM);function gM(e){let t=e.regex,n=(K,{after:F})=>{let N="",end:""},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,F)=>{let N=K[0].length+K.index,ae=K.input[N];if(ae==="<"||ae===","){F.ignoreMatch();return}ae===">"&&(n(K,{after:N})||F.ignoreMatch());let ce,k=K.input.substring(N);if(ce=k.match(/^\s*=/)){F.ignoreMatch();return}if((ce=k.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},s={$pattern:dM,keyword:pq,literal:mq,built_in:bq,"variable.language":gq},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},T=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,{match:/\$\d+/},f];d.contains=T.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(T)});let S=[].concat(y,d.contains),v=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v},M={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...hM,...pM]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Y(K){return t.concat("(?!",K.join("|"),")")}let z={match:t.concat(/\b/,Y([...mM,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,y,{match:/\$\d+/},f,R,{scope:"attr",match:r+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},A,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},z,H,M,$,{match:/\$[(.]/}]}}function bM(e){let t={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},n={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],i={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[t,n,e.QUOTE_STRING_MODE,i,e.C_NUMBER_MODE,e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var Ml="[0-9](_*[0-9])*",_p=`\\.(${Ml})`,xp="[0-9a-fA-F](_*[0-9a-fA-F])*",Eq={className:"number",variants:[{begin:`(\\b(${Ml})((${_p})|\\.)?|(${_p}))[eE][+-]?(${Ml})[fFdD]?\\b`},{begin:`\\b(${Ml})((${_p})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${_p})[fFdD]?\\b`},{begin:`\\b(${Ml})[fFdD]\\b`},{begin:`\\b0[xX]((${xp})\\.?|(${xp})?\\.(${xp}))[pP][+-]?(${Ml})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${xp})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function EM(e){let t={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},n={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"@"},i={className:"subst",begin:/\$\{/,end:/\}/,contains:[e.C_NUMBER_MODE]},a={className:"variable",begin:"\\$"+e.UNDERSCORE_IDENT_RE},o={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[a,i]},{begin:"'",end:"'",illegal:/\n/,contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[e.BACKSLASH_ESCAPE,a,i]}]};i.contains.push(o);let s={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+e.UNDERSCORE_IDENT_RE+")?"},l={className:"meta",begin:"@"+e.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[e.inherit(o,{className:"string"}),"self"]}]},u=Eq,c=e.COMMENT("/\\*","\\*/",{contains:[e.C_BLOCK_COMMENT_MODE]}),f={variants:[{className:"type",begin:e.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},d=f;return d.variants[1].contains=[f],f.variants[1].contains=[d],{name:"Kotlin",aliases:["kt","kts"],keywords:t,contains:[e.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),e.C_LINE_COMMENT_MODE,c,n,r,s,l,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:t,relevance:5,contains:[{begin:e.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[e.UNDERSCORE_TITLE_MODE]},{className:"type",begin://,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:t,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[f,e.C_LINE_COMMENT_MODE,c],relevance:0},e.C_LINE_COMMENT_MODE,c,s,l,o,e.C_NUMBER_MODE]},c]},{begin:[/class|interface|trait/,/\s+/,e.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},e.UNDERSCORE_TITLE_MODE,{className:"type",begin://,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,l]},o,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:` +`},u]}}var yq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Tq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Sq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],_q=[...Tq,...Sq],xq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),yM=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),TM=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Aq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),Cq=yM.concat(TM).sort().reverse();function SM(e){let t=yq(e),n=Cq,r="and or not only",i="[\\w-]+",a="("+i+"|@\\{"+i+"\\})",o=[],s=[],l=function(T){return{className:"string",begin:"~?"+T+".*?"+T}},u=function(T,S,v){return{className:T,begin:S,relevance:v}},c={$pattern:/[a-z-]+/,keyword:r,attribute:xq.join(" ")},f={begin:"\\(",end:"\\)",contains:s,keywords:c,relevance:0};s.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,l("'"),l('"'),t.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},t.HEXCOLOR,f,u("variable","@@?"+i,10),u("variable","@\\{"+i+"\\}"),u("built_in","~?`[^`]*?`"),{className:"attribute",begin:i+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},t.IMPORTANT,{beginKeywords:"and not"},t.FUNCTION_DISPATCH);let d=s.concat({begin:/\{/,end:/\}/,contains:o}),h={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(s)},m={begin:a+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Aq.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:c,returnEnd:!0,contains:s,relevance:0}},E={className:"variable",variants:[{begin:"@"+i+"\\s*:",relevance:15},{begin:"@"+i}],starts:{end:"[;}]",returnEnd:!0,contains:d}},g={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:a,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,h,u("keyword","all\\b"),u("variable","@\\{"+i+"\\}"),{begin:"\\b("+_q.join("|")+")\\b",className:"selector-tag"},t.CSS_NUMBER_MODE,u("selector-tag",a,0),u("selector-id","#"+a),u("selector-class","\\."+a,0),u("selector-tag","&",0),t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+yM.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+TM.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:d},{begin:"!important"},t.FUNCTION_DISPATCH]},y={begin:i+`:(:)?(${n.join("|")})`,returnBegin:!0,contains:[g]};return o.push(e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,b,E,y,m,g,h,t.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:o}}function _M(e){let t="\\[=*\\[",n="\\]=*\\]",r={begin:t,end:n,contains:["self"]},i=[e.COMMENT("--(?!"+t+")","$"),e.COMMENT("--"+t,n,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:e.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:i.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[e.inherit(e.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:i}].concat(i)},e.C_NUMBER_MODE,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,{className:"string",begin:t,end:n,contains:[r],relevance:5}])}}function xM(e){let t={className:"variable",variants:[{begin:"\\$\\("+e.UNDERSCORE_IDENT_RE+"\\)",contains:[e.BACKSLASH_ESCAPE]},{begin:/\$[@%",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},i={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},a={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},o={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},s=/[A-Za-z][A-Za-z0-9+.-]*/,l={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:t.concat(/\[.+?\]\(/,s,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},u={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},c={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},f=e.inherit(u,{contains:[]}),d=e.inherit(c,{contains:[]});u.contains.push(d),c.contains.push(f);let h=[n,l];return[u,c,f,d].forEach(g=>{g.contains=g.contains.concat(h)}),h=h.concat(u,c),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:h},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:h}]}]},n,a,u,c,{className:"quote",begin:"^>\\s+",contains:h,end:"$"},i,r,l,o,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function CM(e){let t={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},n=/[a-zA-Z@][a-zA-Z0-9_]*/,s={"variable.language":["this","super"],$pattern:n,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},l={$pattern:n,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:s,illegal:"/,end:/$/,illegal:"\\n"},e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+l.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:l,contains:[e.UNDERSCORE_TITLE_MODE]},{begin:"\\."+e.UNDERSCORE_IDENT_RE,relevance:0}]}}function NM(e){let t=e.regex,n=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,i={$pattern:/[\w.]+/,keyword:n.join(" ")},a={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:i},o={begin:/->\{/,end:/\}/},s={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},l={scope:"variable",variants:[{begin:/\$\d/},{begin:t.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},u={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},c=[e.BACKSLASH_ESCAPE,a,l],f=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],d=(b,E,g="\\1")=>{let y=g==="\\1"?g:t.concat(g,E);return t.concat(t.concat("(?:",b,")"),E,/(?:\\.|[^\\\/])*?/,y,/(?:\\.|[^\\\/])*?/,g,r)},h=(b,E,g)=>t.concat(t.concat("(?:",b,")"),E,/(?:\\.|[^\\\/])*?/,g,r),m=[l,e.HASH_COMMENT_MODE,e.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),o,{className:"string",contains:c,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[e.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},u,{begin:"(\\/\\/|"+e.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[e.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:d("s|tr|y",t.either(...f,{capture:!0}))},{begin:d("s|tr|y","\\(","\\)")},{begin:d("s|tr|y","\\[","\\]")},{begin:d("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:h("(?:m|qr)?",/\//,/\//)},{begin:h("m|qr",t.either(...f,{capture:!0}),/\1/)},{begin:h("m|qr",/\(/,/\)/)},{begin:h("m|qr",/\[/,/\]/)},{begin:h("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[e.TITLE_MODE,s,u]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return a.contains=m,o.contains=m,{name:"Perl",aliases:["pl","pm"],keywords:i,contains:m}}function vM(e){let t=e.regex,n=/(?![A-Za-z0-9])(?![$])/,r=t.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,n),i=t.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,n),a=t.concat(/[A-Z]+/,n),o={scope:"variable",match:"\\$+"+r},s={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},l={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},u=e.inherit(e.APOS_STRING_MODE,{illegal:null}),c=e.inherit(e.QUOTE_STRING_MODE,{illegal:null,contains:e.QUOTE_STRING_MODE.contains.concat(l)}),f={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:e.QUOTE_STRING_MODE.contains.concat(l),"on:begin":(V,$)=>{$.data._beginMatch=V[1]||V[2]},"on:end":(V,$)=>{$.data._beginMatch!==V[1]&&$.ignoreMatch()}},d=e.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),h=`[ +]`,m={scope:"string",variants:[c,u,f,d]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},E=["false","null","true"],g=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],y=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],S={keyword:g,literal:(V=>{let $=[];return V.forEach(D=>{$.push(D),D.toLowerCase()===D?$.push(D.toUpperCase()):$.push(D.toLowerCase())}),$})(E),built_in:y},v=V=>V.map($=>$.replace(/\|\d+$/,"")),x={variants:[{match:[/new/,t.concat(h,"+"),t.concat("(?!",v(y).join("\\b|"),"\\b)"),i],scope:{1:"keyword",4:"title.class"}}]},M=t.concat(r,"\\b(?!\\()"),R={variants:[{match:[t.concat(/::/,t.lookahead(/(?!class\b)/)),M],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[i,t.concat(/::/,t.lookahead(/(?!class\b)/)),M],scope:{1:"title.class",3:"variable.constant"}},{match:[i,t.concat("::",t.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[i,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},L={scope:"attr",match:t.concat(r,t.lookahead(":"),t.lookahead(/(?!::)/))},A={relevance:0,begin:/\(/,end:/\)/,keywords:S,contains:[L,o,R,e.C_BLOCK_COMMENT_MODE,m,b,x]},H={relevance:0,match:[/\b/,t.concat("(?!fn\\b|function\\b|",v(g).join("\\b|"),"|",v(y).join("\\b|"),"\\b)"),r,t.concat(h,"*"),t.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[A]};A.contains.push(H);let Y=[L,R,e.C_BLOCK_COMMENT_MODE,m,b,x],z={begin:t.concat(/#\[\s*\\?/,t.either(i,a)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:E,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:E,keyword:["new","array"]},contains:["self",...Y]},...Y,{scope:"meta",variants:[{match:i},{match:a}]}]};return{case_insensitive:!1,keywords:S,contains:[z,e.HASH_COMMENT_MODE,e.COMMENT("//","$"),e.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:e.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},s,{scope:"variable.language",match:/\$this\b/},o,H,R,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},x,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},e.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:S,contains:["self",z,o,R,e.C_BLOCK_COMMENT_MODE,m,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},e.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[e.inherit(e.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},e.UNDERSCORE_TITLE_MODE]},m,b]}}function kM(e){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},e.inherit(e.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),e.inherit(e.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function wM(e){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function MM(e){let t=e.regex,n=/[\p{XID_Start}_]\p{XID_Continue}*/u,r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},l={className:"meta",begin:/^(>>>|\.\.\.) /},u={className:"subst",begin:/\{/,end:/\}/,keywords:s,illegal:/#/},c={begin:/\{\{/,relevance:0},f={className:"string",contains:[e.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[e.BACKSLASH_ESCAPE,l,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[e.BACKSLASH_ESCAPE,l,c,u]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[e.BACKSLASH_ESCAPE,c,u]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[e.BACKSLASH_ESCAPE,c,u]},e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},d="[0-9](_?[0-9])*",h=`(\\b(${d}))?\\.(${d})|\\b(${d})\\.`,m=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${d})|(${h}))[eE][+-]?(${d})[jJ]?(?=${m})`},{begin:`(${h})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${m})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${m})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${m})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${m})`},{begin:`\\b(${d})[jJ](?=${m})`}]},E={className:"comment",begin:t.lookahead(/# type:/),end:/$/,keywords:s,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},g={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:["self",l,b,f,e.HASH_COMMENT_MODE]}]};return u.contains=[f,b,l],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s,illegal:/(<\/|\?)|=>/,contains:[l,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},f,E,e.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[g]},{variants:[{match:[/\bclass/,/\s+/,n,/\s*/,/\(\s*/,n,/\s*\)/]},{match:[/\bclass/,/\s+/,n]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,g,f]}]}}function OM(e){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function RM(e){let t=e.regex,n=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=t.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),i=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,a=t.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:n,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[e.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:t.lookahead(t.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:n},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),e.HASH_COMMENT_MODE,{scope:"string",contains:[e.BACKSLASH_ESCAPE],variants:[e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),e.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[i,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[a,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[n,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:i},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:a},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function DM(e){let t=e.regex,n="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=t.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),i=t.concat(r,/(::\w+)*/),o={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},l={begin:"#<",end:">"},u=[e.COMMENT("#","$",{contains:[s]}),e.COMMENT("^=begin","^=end",{contains:[s],relevance:10}),e.COMMENT("^__END__",e.MATCH_NOTHING_RE)],c={className:"subst",begin:/#\{/,end:/\}/,keywords:o},f={className:"string",contains:[e.BACKSLASH_ESCAPE,c],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:t.concat(/<<[-~]?'?/,t.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[e.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[e.BACKSLASH_ESCAPE,c]})]}]},d="[1-9](_?[0-9])*|0",h="[0-9](_?[0-9])*",m={className:"number",relevance:0,variants:[{begin:`\\b(${d})(\\.(${h}))?([eE][+-]?(${h})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:o}]},x=[f,{variants:[{match:[/class\s+/,i,/\s+<\s+/,i]},{match:[/\b(class|module)\s+/,i]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:o},{match:[/(include|extend)\s+/,i],scope:{2:"title.class"},keywords:o},{relevance:0,match:[i,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,n],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:e.IDENT_RE+"::"},{className:"symbol",begin:e.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[f,{begin:n}],relevance:0},m,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:o},{begin:"("+e.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[e.BACKSLASH_ESCAPE,c],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(l,u),relevance:0}].concat(l,u);c.contains=x,b.contains=x;let A=[{begin:/^\s*=>/,starts:{end:"$",contains:x}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:o,contains:x}}];return u.unshift(l),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:o,illegal:/\/\*/,contains:[e.SHEBANG({binary:"ruby"})].concat(A).concat(u).concat(x)}}function IM(e){let t=e.regex,n=/(r#)?/,r=t.concat(n,e.UNDERSCORE_IDENT_RE),i=t.concat(n,e.IDENT_RE),a={className:"title.function.invoke",relevance:0,begin:t.concat(/\b/,/(?!let|for|while|if|else|match\b)/,i,t.lookahead(/\s*\(/))},o="([ui](8|16|32|64|128|size)|f(32|64))?",s=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],l=["true","false","Some","None","Ok","Err"],u=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],c=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:e.IDENT_RE+"!?",type:c,keyword:s,literal:l,built_in:u},illegal:""},a]}}var Nq=e=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:e.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:e.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),vq=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],kq=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],wq=[...vq,...kq],Mq=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Oq=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Rq=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Dq=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function LM(e){let t=Nq(e),n=Rq,r=Oq,i="@[a-z-]+",a="and or not only",s={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[e.C_LINE_COMMENT_MODE,e.C_BLOCK_COMMENT_MODE,t.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},t.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+wq.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+n.join("|")+")"},s,{begin:/\(/,end:/\)/,contains:[t.CSS_NUMBER_MODE]},t.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Dq.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[t.BLOCK_COMMENT,s,t.HEXCOLOR,t.CSS_NUMBER_MODE,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.IMPORTANT,t.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:i,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:Mq.join(" ")},contains:[{begin:i,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},s,e.QUOTE_STRING_MODE,e.APOS_STRING_MODE,t.HEXCOLOR,t.CSS_NUMBER_MODE]},t.FUNCTION_DISPATCH]}}function BM(e){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function PM(e){let t=e.regex,n=e.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},i={begin:/"/,end:/"/,contains:[{match:/""/}]},a=["true","false","unknown"],o=["double precision","large object","with timezone","without timezone"],s=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],l=["add","asc","collation","desc","final","first","last","view"],u=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],c=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],f=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],d=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],h=c,m=[...u,...l].filter(v=>!c.includes(v)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},E={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},g={match:t.concat(/\b/,t.either(...h),/\s*\(/),relevance:0,keywords:{built_in:h}};function y(v){return t.concat(/\b/,t.either(...v.map(x=>x.replace(/\s+/,"\\s+"))),/\b/)}let T={scope:"keyword",match:y(d),relevance:0};function S(v,{exceptions:x,when:M}={}){let R=M;return x=x||[],v.map(L=>L.match(/\|\d+$/)||x.includes(L)?L:R(L)?`${L}|0`:L)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:S(m,{when:v=>v.length<3}),literal:a,type:s,built_in:f},contains:[{scope:"type",match:y(o)},T,g,b,r,i,e.C_NUMBER_MODE,e.C_BLOCK_COMMENT_MODE,n,E]}}function FM(e){return e?typeof e=="string"?e:e.source:null}function qc(e){return Ke("(?=",e,")")}function Ke(...e){return e.map(n=>FM(n)).join("")}function Iq(e){let t=e[e.length-1];return typeof t=="object"&&t.constructor===Object?(e.splice(e.length-1,1),t):{}}function Cn(...e){return"("+(Iq(e).capture?"":"?:")+e.map(r=>FM(r)).join("|")+")"}var t1=e=>Ke(/\b/,e,/\w$/.test(e)?/\b/:/\B/),Lq=["Protocol","Type"].map(t1),UM=["init","self"].map(t1),Bq=["Any","Self"],Jy=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],HM=["false","nil","true"],Pq=["assignment","associativity","higherThan","left","lowerThan","none","right"],Uq=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],zM=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],qM=Cn(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),VM=Cn(qM,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),e1=Ke(qM,VM,"*"),GM=Cn(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),Cp=Cn(GM,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),ii=Ke(GM,Cp,"*"),Ap=Ke(/[A-Z]/,Cp,"*"),Hq=["attached","autoclosure",Ke(/convention\(/,Cn("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",Ke(/objc\(/,ii,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],zq=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function YM(e){let t={match:/\s+/,relevance:0},n=e.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[e.C_LINE_COMMENT_MODE,n],i={match:[/\./,Cn(...Lq,...UM)],className:{2:"keyword"}},a={match:Ke(/\./,Cn(...Jy)),relevance:0},o=Jy.filter(se=>typeof se=="string").concat(["_|0"]),s=Jy.filter(se=>typeof se!="string").concat(Bq).map(t1),l={variants:[{className:"keyword",match:Cn(...s,...UM)}]},u={$pattern:Cn(/\b\w+/,/#\w+/),keyword:o.concat(Uq),literal:HM},c=[i,a,l],f={match:Ke(/\./,Cn(...zM)),relevance:0},d={className:"built_in",match:Ke(/\b/,Cn(...zM),/(?=\()/)},h=[f,d],m={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:e1},{match:`\\.(\\.|${VM})+`}]},E=[m,b],g="([0-9]_*)+",y="([0-9a-fA-F]_*)+",T={className:"number",relevance:0,variants:[{match:`\\b(${g})(\\.(${g}))?([eE][+-]?(${g}))?\\b`},{match:`\\b0x(${y})(\\.(${y}))?([pP][+-]?(${g}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},S=(se="")=>({className:"subst",variants:[{match:Ke(/\\/,se,/[0\\tnr"']/)},{match:Ke(/\\/,se,/u\{[0-9a-fA-F]{1,8}\}/)}]}),v=(se="")=>({className:"subst",match:Ke(/\\/,se,/[\t ]*(?:[\r\n]|\r\n)/)}),x=(se="")=>({className:"subst",label:"interpol",begin:Ke(/\\/,se,/\(/),end:/\)/}),M=(se="")=>({begin:Ke(se,/"""/),end:Ke(/"""/,se),contains:[S(se),v(se),x(se)]}),R=(se="")=>({begin:Ke(se,/"/),end:Ke(/"/,se),contains:[S(se),x(se)]}),L={className:"string",variants:[M(),M("#"),M("##"),M("###"),R(),R("#"),R("##"),R("###")]},A=[e.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[e.BACKSLASH_ESCAPE]}],H={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:A},Y=se=>{let _t=Ke(se,/\//),ue=Ke(/\//,se);return{begin:_t,end:ue,contains:[...A,{scope:"comment",begin:`#(?!.*${ue})`,end:/$/}]}},z={scope:"regexp",variants:[Y("###"),Y("##"),Y("#"),H]},V={match:Ke(/`/,ii,/`/)},$={className:"variable",match:/\$\d+/},D={className:"variable",match:`\\$${Cp}+`},B=[V,$,D],K={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:zq,contains:[...E,T,L]}]}},F={scope:"keyword",match:Ke(/@/,Cn(...Hq),qc(Cn(/\(/,/\s+/)))},N={scope:"meta",match:Ke(/@/,ii)},ae=[K,F,N],ce={match:qc(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:Ke(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,Cp,"+")},{className:"type",match:Ap,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:Ke(/\s+&\s+/,qc(Ap)),relevance:0}]},k={begin://,keywords:u,contains:[...r,...c,...ae,m,ce]};ce.contains.push(k);let Te={match:Ke(ii,/\s*:/),keywords:"_|0",relevance:0},be={begin:/\(/,end:/\)/,relevance:0,keywords:u,contains:["self",Te,...r,z,...c,...h,...E,T,L,...B,...ae,ce]},He={begin://,keywords:"repeat each",contains:[...r,ce]},et={begin:Cn(qc(Ke(ii,/\s*:/)),qc(Ke(ii,/\s+/,ii,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:ii}]},Ee={begin:/\(/,end:/\)/,keywords:u,contains:[et,...r,...c,...E,T,L,...ae,ce,be],endsParent:!0,illegal:/["']/},lt={match:[/(func|macro)/,/\s+/,Cn(V.match,ii,e1)],className:{1:"keyword",3:"title.function"},contains:[He,Ee,t],illegal:[/\[/,/%/]},Ve={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[He,Ee,t],illegal:/\[|%/},St={match:[/operator/,/\s+/,e1],className:{1:"keyword",3:"title"}},Pt={begin:[/precedencegroup/,/\s+/,Ap],className:{1:"keyword",3:"title"},contains:[ce],keywords:[...Pq,...HM],end:/}/},wn={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},qr={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},ee={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,ii,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:u,contains:[He,...c,{begin:/:/,end:/\{/,keywords:u,contains:[{scope:"title.class.inherited",match:Ap},...c],relevance:0}]};for(let se of L.variants){let _t=se.contains.find(Wn=>Wn.label==="interpol");_t.keywords=u;let ue=[...c,...h,...E,T,L,...B];_t.contains=[...ue,{begin:/\(/,end:/\)/,contains:["self",...ue]}]}return{name:"Swift",keywords:u,contains:[...r,lt,Ve,wn,qr,ee,St,Pt,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},z,...c,...h,...E,T,L,...B,...ae,ce,be]}}var Np="[A-Za-z$_][0-9A-Za-z$_]*",KM=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],$M=["true","false","null","undefined","NaN","Infinity"],jM=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],XM=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],WM=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],QM=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],ZM=[].concat(WM,jM,XM);function Fq(e){let t=e.regex,n=(K,{after:F})=>{let N="",end:""},a=/<[A-Za-z0-9\\._:-]+\s*\/>/,o={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(K,F)=>{let N=K[0].length+K.index,ae=K.input[N];if(ae==="<"||ae===","){F.ignoreMatch();return}ae===">"&&(n(K,{after:N})||F.ignoreMatch());let ce,k=K.input.substring(N);if(ce=k.match(/^\s*=/)){F.ignoreMatch();return}if((ce=k.match(/^\s+extends\s+/))&&ce.index===0){F.ignoreMatch();return}}},s={$pattern:Np,keyword:KM,literal:$M,built_in:ZM,"variable.language":QM},l="[0-9](_?[0-9])*",u=`\\.(${l})`,c="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",f={className:"number",variants:[{begin:`(\\b(${c})((${u})|\\.)?|(${u}))[eE][+-]?(${l})\\b`},{begin:`\\b(${c})\\b((${u})\\b|\\.)?|(${u})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},d={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},h={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"xml"}},m={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[e.BACKSLASH_ESCAPE,d],subLanguage:"graphql"}},E={className:"string",begin:"`",end:"`",contains:[e.BACKSLASH_ESCAPE,d]},y={className:"comment",variants:[e.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),e.C_BLOCK_COMMENT_MODE,e.C_LINE_COMMENT_MODE]},T=[e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,{match:/\$\d+/},f];d.contains=T.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(T)});let S=[].concat(y,d.contains),v=S.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(S)}]),x={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v},M={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,t.concat(r,"(",t.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},R={relevance:0,match:t.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...jM,...XM]}},L={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},A={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[x],illegal:/%/},H={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function Y(K){return t.concat("(?!",K.join("|"),")")}let z={match:t.concat(/\b/,Y([...WM,"super","import"].map(K=>`${K}\\s*\\(`)),r,t.lookahead(/\s*\(/)),className:"title.function",relevance:0},V={begin:t.concat(/\./,t.lookahead(t.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},$={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},x]},D="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+e.UNDERSCORE_IDENT_RE+")\\s*=>",B={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,t.lookahead(D)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[x]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:v,CLASS_REFERENCE:R},illegal:/#(?![$_A-z])/,contains:[e.SHEBANG({label:"shebang",binary:"node",relevance:5}),L,e.APOS_STRING_MODE,e.QUOTE_STRING_MODE,h,m,b,E,y,{match:/\$\d+/},f,R,{scope:"attr",match:r+t.lookahead(":"),relevance:0},B,{begin:"("+e.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[y,e.REGEXP_MODE,{className:"function",begin:D,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:e.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:v}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:i.begin,end:i.end},{match:a},{begin:o.begin,"on:begin":o.isTrulyOpeningTag,end:o.end}],subLanguage:"xml",contains:[{begin:o.begin,end:o.end,skip:!0,contains:["self"]}]}]},A,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+e.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[x,e.inherit(e.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},V,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[x]},z,H,M,$,{match:/\$[(.]/}]}}function JM(e){let t=e.regex,n=Fq(e),r=Np,i=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],a={begin:[/namespace/,/\s+/,e.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},o={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:i},contains:[n.exports.CLASS_REFERENCE]},s={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},l=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],u={$pattern:Np,keyword:KM.concat(l),literal:$M,built_in:ZM.concat(i),"variable.language":QM},c={className:"meta",begin:"@"+r},f=(b,E,g)=>{let y=b.contains.findIndex(T=>T.label===E);if(y===-1)throw new Error("can not find mode to replace");b.contains.splice(y,1,g)};Object.assign(n.keywords,u),n.exports.PARAMS_CONTAINS.push(c);let d=n.contains.find(b=>b.scope==="attr"),h=Object.assign({},d,{match:t.concat(r,t.lookahead(/\s*\?:/))});n.exports.PARAMS_CONTAINS.push([n.exports.CLASS_REFERENCE,d,h]),n.contains=n.contains.concat([c,a,o,h]),f(n,"shebang",e.SHEBANG()),f(n,"use_strict",s);let m=n.contains.find(b=>b.label==="func.def");return m.relevance=0,Object.assign(n,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),n}function eO(e){let t=e.regex,n={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},i=/\d{1,2}\/\d{1,2}\/\d{4}/,a=/\d{4}-\d{1,2}-\d{1,2}/,o=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,l={className:"literal",variants:[{begin:t.concat(/# */,t.either(a,i),/ *#/)},{begin:t.concat(/# */,s,/ *#/)},{begin:t.concat(/# */,o,/ *#/)},{begin:t.concat(/# */,t.either(a,i),/ +/,t.either(o,s),/ *#/)}]},u={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},c={className:"label",begin:/^\w+:/},f=e.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),d=e.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[n,r,l,u,c,f,d,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[d]}]}}function tO(e){e.regex;let t=e.COMMENT(/\(;/,/;\)/);t.contains.push("self");let n=e.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],i={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},a={className:"variable",begin:/\$[\w_]+/},o={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},s={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},l={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},u={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[n,t,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},a,o,i,e.QUOTE_STRING_MODE,l,u,s]}}function nO(e){let t=e.regex,n=t.concat(/[\p{L}_]/u,t.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,i={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},a={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},o=e.inherit(a,{begin:/\(/,end:/\)/}),s=e.inherit(e.APOS_STRING_MODE,{className:"string"}),l=e.inherit(e.QUOTE_STRING_MODE,{className:"string"}),u={endsWithParent:!0,illegal:/`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin://,relevance:10,contains:[a,l,s,o,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin://,contains:[a,o,l,s]}]}]},e.COMMENT(//,{relevance:10}),{begin://,relevance:10},i,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[l]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/)/,end:/>/,keywords:{name:"style"},contains:[u],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/)/,end:/>/,keywords:{name:"script"},contains:[u],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:t.concat(//,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:n,relevance:0,starts:u}]},{className:"tag",begin:t.concat(/<\//,t.lookahead(t.concat(n,/>/))),contains:[{className:"name",begin:n,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function rO(e){let t="true false yes no null",n="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},i={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},a={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},o={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[e.BACKSLASH_ESCAPE,i]},s=e.inherit(o,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),d={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},h={end:",",endsWithParent:!0,excludeEnd:!0,keywords:t,relevance:0},m={begin:/\{/,end:/\}/,contains:[h],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[h],illegal:"\\n",relevance:0},E=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+n},{className:"type",begin:"!<"+n+">"},{className:"type",begin:"!"+n},{className:"type",begin:"!!"+n},{className:"meta",begin:"&"+e.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+e.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},e.HASH_COMMENT_MODE,{beginKeywords:t,keywords:{literal:t}},d,{className:"number",begin:e.C_NUMBER_RE+"\\b",relevance:0},m,b,a,o],g=[...E];return g.pop(),g.push(s),h.contains=g,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:E}}var n1={arduino:Jw,bash:eM,c:tM,cpp:nM,csharp:rM,css:iM,diff:aM,go:oM,graphql:sM,ini:lM,java:fM,javascript:gM,json:bM,kotlin:EM,less:SM,lua:_M,makefile:xM,markdown:AM,objectivec:CM,perl:NM,php:vM,"php-template":kM,plaintext:wM,python:MM,"python-repl":OM,r:RM,ruby:DM,rust:IM,scss:LM,shell:BM,sql:PM,swift:YM,typescript:JM,vbnet:eO,wasm:tO,xml:nO,yaml:rO};var AO=q(xO(),1);var CO=AO.default;var NO={},OV="hljs-";function d1(e){let t=CO.newInstance();return e&&a(e),{highlight:n,highlightAuto:r,listLanguages:i,register:a,registerAlias:o,registered:s};function n(l,u,c){let f=c||NO,d=typeof f.prefix=="string"?f.prefix:OV;if(!t.getLanguage(l))throw new Error("Unknown language: `"+l+"` is not registered");t.configure({__emitter:f1,classPrefix:d});let h=t.highlight(u,{ignoreIllegals:!0,language:l});if(h.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:h.errorRaised});let m=h._emitter.root,b=m.data;return b.language=h.language,b.relevance=h.relevance,m}function r(l,u){let f=(u||NO).subset||i(),d=-1,h=0,m;for(;++dh&&(h=E.data.relevance,m=E)}return m||{type:"root",children:[],data:{language:void 0,relevance:h}}}function i(){return t.listLanguages()}function a(l,u){if(typeof l=="string")t.registerLanguage(l,u);else{let c;for(c in l)Object.hasOwn(l,c)&&t.registerLanguage(c,l[c])}}function o(l,u){if(typeof l=="string")t.registerAliases(typeof u=="string"?u:[...u],{languageName:l});else{let c;for(c in l)if(Object.hasOwn(l,c)){let f=l[c];t.registerAliases(typeof f=="string"?f:[...f],{languageName:c})}}}function s(l){return!!t.getLanguage(l)}}var f1=class{constructor(t){this.options=t,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(t){if(t==="")return;let n=this.stack[this.stack.length-1],r=n.children[n.children.length-1];r&&r.type==="text"?r.value+=t:n.children.push({type:"text",value:t})}startScope(t){this.openNode(String(t))}endScope(){this.closeNode()}__addSublanguage(t,n){let r=this.stack[this.stack.length-1],i=t.root.children;n?r.children.push({type:"element",tagName:"span",properties:{className:[n]},children:i}):r.children.push(...i)}openNode(t){let n=this,r=t.split(".").map(function(o,s){return s?o+"_".repeat(s):n.options.classPrefix+o}),i=this.stack[this.stack.length-1],a={type:"element",tagName:"span",properties:{className:r},children:[]};i.children.push(a),this.stack.push(a)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}};var RV={};function Op(e){let t=e||RV,n=t.aliases,r=t.detect||!1,i=t.languages||n1,a=t.plainText,o=t.prefix,s=t.subset,l="hljs",u=d1(i);if(n&&u.registerAlias(n),o){let c=o.indexOf("-");l=c===-1?o:o.slice(0,c)}return function(c,f){ht(c,"element",function(d,h,m){if(d.tagName!=="code"||!m||m.type!=="element"||m.tagName!=="pre")return;let b=DV(d);if(b===!1||!b&&!r||b&&a&&a.includes(b))return;Array.isArray(d.properties.className)||(d.properties.className=[]),d.properties.className.includes(l)||d.properties.className.unshift(l);let E=Zy(d,{whitespace:"pre"}),g;try{g=b?u.highlight(b,E,{prefix:o}):u.highlightAuto(E,{prefix:o,subset:s})}catch(y){let T=y;if(b&&/Unknown language/.test(T.message)){f.message("Cannot highlight as `"+b+"`, it\u2019s not registered",{ancestors:[m,d],cause:T,place:d.position,ruleId:"missing-language",source:"rehype-highlight"});return}throw T}!b&&g.data&&g.data.language&&d.properties.className.push("language-"+g.data.language),g.children.length>0&&(d.children=g.children)})}}function DV(e){let t=e.properties.className,n=-1;if(!Array.isArray(t))return;let r;for(;++ne=>{ht(e,"element",t=>{let n=t.properties;if(!n||!(Kh(n.className)||"dataSuggestion"in n))return;let i=typeof n.dataSuggestion=="string"&&n.dataSuggestion||Nc(t.children);"tabIndex"in n||(n.tabIndex=0),"role"in n||(n.role="button"),!("ariaLabel"in n)&&i&&(n.ariaLabel=`Use chat suggestion: ${i}`)})};var vO=()=>e=>{ht(e,"html",(t,n,r)=>{if(!r||n===void 0)return;let i={type:"text",value:t.value};return r.children.splice(n,1,i),[ei,n]})};var p1=()=>e=>{ht(e,"element",t=>{if(t.tagName!=="a")return;let n=t.properties?.href;typeof n=="string"&&(n.startsWith("#")||/^[a-z][a-z0-9+.-]*:/i.test(n)&&!/^https?:/i.test(n)||(t.properties={...t.properties,dataShinychatLink:"",target:"_blank",rel:"noopener noreferrer"}))})};var m1=()=>e=>{ht(e,"element",t=>{let n=t.properties;n&&(t.tagName==="input"||t.tagName==="textarea")&&("value"in n&&(n.defaultValue=n.value,delete n.value),"checked"in n&&(n.defaultChecked=n.checked,delete n.checked))})};var IV=new Set(["shiny-tool-request","shiny-tool-result","shinychat-raw-html"]);function LV(e){return e.type==="element"&&IV.has(e.tagName)}function kO(e){return e.some(t=>t.type==="text"?t.value.trim().length>0:!0)}function wO(e){ht(e,"element",(t,n,r)=>{if(t.tagName!=="p"||!r||n===void 0)return;let i=t.children.findIndex(LV);if(i===-1)return;let a=t.children.slice(0,i),o=t.children[i],s=t.children.slice(i+1),l=[];if(a.length>0&&kO(a)&&l.push({...t,children:a}),l.push(o),s.length>0&&kO(s)){let c={type:"root",children:[{...t,children:s}]};wO(c),l.push(...c.children)}return r.children.splice(n,1,...l),[ei,n]})}var MO=()=>wO;var OO=()=>e=>{ht(e,"element",(t,n,r)=>{if(!r||n===void 0||t.tagName!=="ul"&&t.tagName!=="ol")return;let i=BV(t.children);if(!i)return;let a=PV(i);if(!a)return;let o={type:"element",tagName:"p",properties:{},children:[{type:"text",value:a}]};return r.children.splice(n+1,0,o),[ei,n+1]})};function BV(e){for(let t=e.length-1;t>=0;t--){let n=e[t];if(n.type==="element"&&n.tagName==="li")return n}return null}function PV(e){let t=e.children;if(t.length<2)return null;let n=t[t.length-1];if(n.type!=="text")return null;let r=n.value.indexOf(` +`);if(r===-1)return null;let i=n.value.substring(0,r),a=n.value.substring(r+1).trim();if(!a)return null;let o=t[t.length-2];return!o||o.type!=="element"?null:(i.trim()?n.value=i:t.pop(),a)}var RO=kc().use(Ic).use(Bc).use(Uc,{allowDangerousHtml:!0}).use(zc).use(OO).use(MO).use(m1).use(h1).use(BE).use(p1).use(Op,{detect:!1,ignoreMissing:!0}).freeze(),DO=kc().use(m1).use(h1).use(BE).use(p1).freeze(),IO=kc().use(Ic).use(Bc).use(vO).use(Uc,{allowDangerousHtml:!0}).use(zc).use(Ep).freeze();var Rp=q(me(),1),Yc=q(ne(),1);function LO({children:e,node:t,...n}){let[r,i]=(0,Rp.useState)(!1),a=(0,Rp.useRef)(null);return(0,Yc.jsxs)("pre",{ref:a,...n,children:[(0,Yc.jsx)("button",{onClick:async()=>{let l=a.current?.querySelector("code")?.textContent??"";try{await navigator.clipboard.writeText(l)}catch{let u=document.createElement("textarea");u.value=l,u.style.position="fixed",u.style.opacity="0",document.body.appendChild(u),u.select(),document.execCommand("copy"),document.body.removeChild(u)}i(!0),setTimeout(()=>i(!1),2e3)},className:`code-copy-button${r?" code-copy-button-checked":""}`,title:"Copy to clipboard","aria-label":"Copy to clipboard",children:(0,Yc.jsx)("i",{className:"bi"})}),e]})}var BO=q(ne(),1);function g1({children:e,node:t,...n}){return(0,BO.jsx)("table",{className:"table table-striped table-bordered",...n,children:e})}var Ga=q(me(),1);var PO=q(ne(),1);function Go({html:e,className:t,displayContents:n=!0}){let r=(0,Ga.useRef)(null),[i,a]=(0,Ga.useState)(!1),o=(0,Ga.useContext)(Ma);return(0,Ga.useEffect)(()=>{let s=r.current;return s?(s.innerHTML=e,s.parentElement?.classList.contains("html-fill-container")&&a(!0),o&&e&&o.bindAll(s),()=>{o&&s&&o.unbindAll(s)}):void 0},[e,o]),(0,PO.jsx)("div",{ref:r,className:i?`html-fill-item html-fill-container${t?` ${t}`:""}`:t,style:n?{display:"contents"}:void 0})}var UV=["shinychat-raw-html","shiny-tool-request","shiny-tool-result"],HV=new RegExp(`<(/?)(${UV.join("|")})(?=[\\s/>]|$)`,"gi");function UO(e){return e.replace(HV,"<$1$2")}var Hn=q(ne(),1),zV={pre:LO,table:g1,"shinychat-raw-html":({node:e})=>(0,Hn.jsx)(Go,{html:e?iE(e.children):"",displayContents:!0})},FV={table:g1};function $t({content:e,contentType:t,role:n,streaming:r=!1,tagToComponentMap:i,prefix:a}){let o=n==="user",s=t==="text",l=t==="html",u=l?DO:o?IO:RO,c=(0,zi.useMemo)(()=>o?{...FV,...i}:{...zV,...i},[o,i]),f=(0,zi.useMemo)(()=>s?null:l?vk(e,u):Nk(UO(e),u),[e,s,l,u]),d=(0,zi.useMemo)(()=>f?kk(f,{tagToComponentMap:c,streaming:r}):null,[f,r,c]);return s?(0,Hn.jsxs)(Hn.Fragment,{children:[a,a&&" ",e]}):a&&d?(0,Hn.jsx)(Hn.Fragment,{children:qV(d,a)}):(0,Hn.jsx)(Hn.Fragment,{children:d})}function qV(e,t){let n=zi.default.Children.toArray(e.props.children);for(let r=0;r -`,FO=` +`,qO=` -`,qO=` +`,VO=` -`,VO='',b1='',GO='',YO='',KO='',$O='',jO='',XO='';var zn=q(me(),1),WO=q(io(),1);var Kc=q(ne(),1);function QO(e){let[t,n]=(0,zn.useState)(!1),r=(0,zn.useRef)(!1),i=(0,zn.useRef)(null),a=(0,zn.useRef)(null),o=(0,zn.useRef)(null),s=(0,zn.useRef)(d=>{o.current?.(d)}),l=(0,zn.useCallback)(()=>{if(!r.current)return;let d=e.current;d&&(r.current=!1,n(!1),d.removeAttribute("fullscreen"),d.removeAttribute("tabindex"),window.dispatchEvent(new Event("resize")),document.removeEventListener("keydown",s.current,!0),i.current?.focus(),i.current=null)},[e]),u=(0,zn.useCallback)(d=>{if(d.key==="Escape"){let T=d.target;if(typeof T.matches=="function"&&(T.matches("select[open]")||T.matches("input[aria-expanded='true']")))return;l(),d.preventDefault();return}if(d.key!=="Tab")return;let h=e.current;if(!h?.hasAttribute("fullscreen")||!r.current)return;let m=[...h.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(T=>T.offsetParent!==null),b=a.current;if(!b)return;let E=m[0],g=m[m.length-1],y=document.activeElement;!d.shiftKey&&(y===g||y===h)?(d.preventDefault(),b.focus()):!d.shiftKey&&y===b?(d.preventDefault(),(E??h).focus()):d.shiftKey&&(y===E||y===h)?(d.preventDefault(),b.focus()):d.shiftKey&&y===b?(d.preventDefault(),(g??h).focus()):!h.contains(y)&&y!==b&&(d.preventDefault(),h.focus())},[e,l]);o.current=u;let c=(0,zn.useCallback)(d=>{if(r.current)return;let h=e.current;h&&(r.current=!0,n(!0),i.current=d,h.setAttribute("fullscreen",""),window.dispatchEvent(new Event("resize")),document.addEventListener("keydown",s.current,!0),h.setAttribute("tabindex","-1"),h.focus())},[e]);(0,zn.useEffect)(()=>{let d=e.current,h=s.current;return()=>{r.current&&(r.current=!1,d&&(d.removeAttribute("fullscreen"),d.removeAttribute("tabindex")),document.removeEventListener("keydown",h,!0),i.current?.focus(),i.current=null)}},[e]);let f=t?(0,WO.createPortal)((0,Kc.jsx)("div",{className:"shiny-tool-fullscreen-backdrop",onClick:l,children:(0,Kc.jsxs)("button",{ref:a,type:"button",className:"shiny-tool-fullscreen-exit","aria-label":"Exit fullscreen",onClick:d=>{d.stopPropagation(),l()},children:["Close ",(0,Kc.jsx)("span",{dangerouslySetInnerHTML:{__html:GO}})]})}),document.body):null;return{enterFullscreen:c,exitFullscreen:l,overlay:f}}var Ar=q(ne(),1),zV={__html:qO},FV={__html:b1};function Ip({requestId:e,toolName:t,toolTitle:n,intent:r,icon:i,classStatus:a="",titleTemplate:o="{title}",fullScreen:s=!1,initialExpanded:l=!1,footer:u,onEnterFullscreen:c,cardRef:f,children:d}){let[h,m]=(0,$c.useState)(l),b=`tool-header-${e}`,E=`tool-content-${e}`,g=i||FO,y=n||`${t}()`,T=o.replace("{title}",`${y}`),S=(0,$c.useMemo)(()=>({__html:g}),[g]),v=(0,$c.useMemo)(()=>({__html:T}),[T]);function x(R){R.preventDefault(),!R.currentTarget.closest(".shiny-tool-card")?.hasAttribute("fullscreen")&&(m(!h),requestAnimationFrame(()=>window.dispatchEvent(new Event("resize"))))}function M(R){R.preventDefault(),R.stopPropagation(),m(!0),c?.(R.currentTarget)}return(0,Ar.jsxs)("div",{ref:f,className:"shiny-tool-card card bslib-card html-fill-item html-fill-container m-0",children:[(0,Ar.jsxs)("button",{className:"card-header",id:b,onClick:x,"aria-expanded":h,"aria-controls":E,children:[(0,Ar.jsx)("div",{className:`tool-icon${a?` ${a}`:""}`,dangerouslySetInnerHTML:S}),(0,Ar.jsx)("div",{className:`tool-title${a?` ${a}`:""}`,dangerouslySetInnerHTML:v}),(0,Ar.jsx)("div",{className:"tool-spacer"}),r&&(0,Ar.jsx)("div",{className:"tool-intent",children:r}),(0,Ar.jsx)("div",{className:"collapse-indicator",dangerouslySetInnerHTML:zV})]}),(0,Ar.jsxs)("div",{className:`card-body bslib-gap-spacing html-fill-item html-fill-container${h?"":" collapsed"}`,id:E,role:"region","aria-labelledby":b,inert:!h||void 0,children:[d,s&&c&&(0,Ar.jsx)("button",{className:"tool-fullscreen-toggle badge rounded-pill",onClick:M,"aria-label":"Expand card","aria-controls":E,type:"button",dangerouslySetInnerHTML:FV})]}),u&&(0,Ar.jsx)(Go,{html:u,className:"card-footer",displayContents:!1})]})}function Yo(e,t="markdown"){let n="`".repeat(8);return`${n}${t} +`,GO='',b1='',YO='',KO='',$O='',jO='',XO='',WO='';var zn=q(me(),1),QO=q(io(),1);var Kc=q(ne(),1);function ZO(e){let[t,n]=(0,zn.useState)(!1),r=(0,zn.useRef)(!1),i=(0,zn.useRef)(null),a=(0,zn.useRef)(null),o=(0,zn.useRef)(null),s=(0,zn.useRef)(d=>{o.current?.(d)}),l=(0,zn.useCallback)(()=>{if(!r.current)return;let d=e.current;d&&(r.current=!1,n(!1),d.removeAttribute("fullscreen"),d.removeAttribute("tabindex"),window.dispatchEvent(new Event("resize")),document.removeEventListener("keydown",s.current,!0),i.current?.focus(),i.current=null)},[e]),u=(0,zn.useCallback)(d=>{if(d.key==="Escape"){let T=d.target;if(typeof T.matches=="function"&&(T.matches("select[open]")||T.matches("input[aria-expanded='true']")))return;l(),d.preventDefault();return}if(d.key!=="Tab")return;let h=e.current;if(!h?.hasAttribute("fullscreen")||!r.current)return;let m=[...h.querySelectorAll('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])')].filter(T=>T.offsetParent!==null),b=a.current;if(!b)return;let E=m[0],g=m[m.length-1],y=document.activeElement;!d.shiftKey&&(y===g||y===h)?(d.preventDefault(),b.focus()):!d.shiftKey&&y===b?(d.preventDefault(),(E??h).focus()):d.shiftKey&&(y===E||y===h)?(d.preventDefault(),b.focus()):d.shiftKey&&y===b?(d.preventDefault(),(g??h).focus()):!h.contains(y)&&y!==b&&(d.preventDefault(),h.focus())},[e,l]);o.current=u;let c=(0,zn.useCallback)(d=>{if(r.current)return;let h=e.current;h&&(r.current=!0,n(!0),i.current=d,h.setAttribute("fullscreen",""),window.dispatchEvent(new Event("resize")),document.addEventListener("keydown",s.current,!0),h.setAttribute("tabindex","-1"),h.focus())},[e]);(0,zn.useEffect)(()=>{let d=e.current,h=s.current;return()=>{r.current&&(r.current=!1,d&&(d.removeAttribute("fullscreen"),d.removeAttribute("tabindex")),document.removeEventListener("keydown",h,!0),i.current?.focus(),i.current=null)}},[e]);let f=t?(0,QO.createPortal)((0,Kc.jsx)("div",{className:"shiny-tool-fullscreen-backdrop",onClick:l,children:(0,Kc.jsxs)("button",{ref:a,type:"button",className:"shiny-tool-fullscreen-exit","aria-label":"Exit fullscreen",onClick:d=>{d.stopPropagation(),l()},children:["Close ",(0,Kc.jsx)("span",{dangerouslySetInnerHTML:{__html:YO}})]})}),document.body):null;return{enterFullscreen:c,exitFullscreen:l,overlay:f}}var Ar=q(ne(),1),VV={__html:VO},GV={__html:b1};function Ip({requestId:e,toolName:t,toolTitle:n,intent:r,icon:i,classStatus:a="",titleTemplate:o="{title}",fullScreen:s=!1,initialExpanded:l=!1,footer:u,onEnterFullscreen:c,cardRef:f,children:d}){let[h,m]=(0,$c.useState)(l),b=`tool-header-${e}`,E=`tool-content-${e}`,g=i||qO,y=n||`${t}()`,T=o.replace("{title}",`${y}`),S=(0,$c.useMemo)(()=>({__html:g}),[g]),v=(0,$c.useMemo)(()=>({__html:T}),[T]);function x(R){R.preventDefault(),!R.currentTarget.closest(".shiny-tool-card")?.hasAttribute("fullscreen")&&(m(!h),requestAnimationFrame(()=>window.dispatchEvent(new Event("resize"))))}function M(R){R.preventDefault(),R.stopPropagation(),m(!0),c?.(R.currentTarget)}return(0,Ar.jsxs)("div",{ref:f,className:"shiny-tool-card card bslib-card html-fill-item html-fill-container m-0",children:[(0,Ar.jsxs)("button",{className:"card-header",id:b,onClick:x,"aria-expanded":h,"aria-controls":E,children:[(0,Ar.jsx)("div",{className:`tool-icon${a?` ${a}`:""}`,dangerouslySetInnerHTML:S}),(0,Ar.jsx)("div",{className:`tool-title${a?` ${a}`:""}`,dangerouslySetInnerHTML:v}),(0,Ar.jsx)("div",{className:"tool-spacer"}),r&&(0,Ar.jsx)("div",{className:"tool-intent",children:r}),(0,Ar.jsx)("div",{className:"collapse-indicator",dangerouslySetInnerHTML:VV})]}),(0,Ar.jsxs)("div",{className:`card-body bslib-gap-spacing html-fill-item html-fill-container${h?"":" collapsed"}`,id:E,role:"region","aria-labelledby":b,inert:!h||void 0,children:[d,s&&c&&(0,Ar.jsx)("button",{className:"tool-fullscreen-toggle badge rounded-pill",onClick:M,"aria-label":"Expand card","aria-controls":E,type:"button",dangerouslySetInnerHTML:GV})]}),u&&(0,Ar.jsx)(Go,{html:u,className:"card-footer",displayContents:!1})]})}function Yo(e,t="markdown"){let n="`".repeat(8);return`${n}${t} ${e} -${n}`}var Dl=q(ne(),1),qV='
',JO=(0,ZO.memo)(function({requestId:t,toolName:n,toolTitle:r,intent:i,arguments:a}){return(0,Dl.jsx)(Ip,{requestId:t,toolName:n,toolTitle:r,intent:i,icon:qV,titleTemplate:"Running {title}",children:(0,Dl.jsxs)("div",{className:"shiny-tool-request__arguments",children:[(0,Dl.jsx)("strong",{children:"Tool arguments"}),(0,Dl.jsx)($t,{content:Yo(a,"json"),contentType:"markdown",streaming:!1})]})})});var E1=q(ne(),1);function eR({"request-id":e,"tool-name":t,"tool-title":n,intent:r,arguments:i}){let{hiddenToolRequests:a}=yN();return!e||!t||a.has(e)?null:(0,E1.jsx)("div",{className:"shiny-tool-request",children:(0,E1.jsx)(JO,{requestId:e,toolName:t,toolTitle:n,intent:r,arguments:i??"{}"})})}var Bp=q(me(),1);var Lp=q(me(),1);var Pe=q(ne(),1);function VV({filename:e}){return(0,Pe.jsxs)("div",{className:"shinychat-pdf badge fs-6 text-bg-secondary",children:[(0,Pe.jsx)("span",{className:"shinychat-pdf__icon me-1",dangerouslySetInnerHTML:{__html:jO}}),(0,Pe.jsx)("span",{className:"shinychat-pdf__filename font-monospace",children:e})]})}function GV({value:e,valueType:t}){return t==="html"?(0,Pe.jsx)(Go,{html:e}):t==="text"?(0,Pe.jsx)("p",{children:e}):t==="markdown"?(0,Pe.jsx)($t,{content:e,contentType:"markdown",streaming:!1}):(0,Pe.jsx)($t,{content:Yo(e,"text"),contentType:"markdown",streaming:!1})}var tR=(0,Lp.memo)(function({requestId:t,toolName:n,toolTitle:r,intent:i,status:a,value:o,valueType:s,requestCall:l,showRequest:u=!1,fullScreen:c=!1,expanded:f=!1,icon:d,footer:h}){let m=(0,Lp.useRef)(null),{enterFullscreen:b,overlay:E}=QO(m),g=a==="error";return(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsxs)(Ip,{requestId:t,toolName:n,toolTitle:r,intent:i,icon:g?zO:d,classStatus:g?"text-danger":"",titleTemplate:g?"{title} failed":"{title}",fullScreen:c,initialExpanded:f,footer:h,onEnterFullscreen:b,cardRef:m,children:[YV(l,u),KV(o,s,u)]}),E]})});function YV(e,t){if(!t||!e)return null;let n=Yo(e,""),r=e.split(` -`).length>2;return(0,Pe.jsx)("div",{className:"shiny-tool-result__request",children:r?(0,Pe.jsxs)("details",{children:[(0,Pe.jsx)("summary",{children:"Tool call"}),(0,Pe.jsx)($t,{content:n,contentType:"markdown",streaming:!1})]}):(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)("strong",{children:"Tool call"}),(0,Pe.jsx)($t,{content:n,contentType:"markdown",streaming:!1})]})})}function KV(e,t,n){let r=e||"[Empty result]",i;if(t==="html")i=(0,Pe.jsx)(Go,{html:r});else if(t==="text")i=(0,Pe.jsx)("p",{children:r});else if(t==="content_extra")try{let o=JSON.parse(e);i=(0,Pe.jsx)("div",{className:"shinychat-content-extra",children:o.map((s,l)=>s.type==="image"?(0,Pe.jsx)("img",{src:s.src,className:"shinychat-tool-image"},l):s.type==="pdf"?(0,Pe.jsx)(VV,{filename:s.filename??""},l):s.type==="text"?(0,Pe.jsx)(GV,{value:s.value??"",valueType:s.value_type??"code"},l):null)})}catch{i=(0,Pe.jsx)($t,{content:Yo(r,"text"),contentType:"markdown",streaming:!1})}else{let o=t!=="markdown"?Yo(r,"text"):r;i=(0,Pe.jsx)($t,{content:o,contentType:"markdown",streaming:!1})}return!n&&t==="html"?i:(0,Pe.jsxs)("div",{className:"shiny-tool-result__result",children:[n?(0,Pe.jsx)("strong",{children:"Tool result"}):null,i]})}var T1=q(ne(),1);function y1(e){return e===!0||e===""||e==="true"}function nR({"request-id":e,"tool-name":t,"tool-title":n,intent:r,status:i,value:a,"value-type":o,"request-call":s,"show-request":l,"full-screen":u,expanded:c,icon:f,footer:d}){let h=(0,Bp.useContext)(No);return(0,Bp.useEffect)(()=>{!h||!e||h({type:"hide_tool_request",requestId:e})},[h,e]),!e||!t?null:(0,T1.jsx)("div",{className:"shiny-tool-result",children:(0,T1.jsx)(tR,{requestId:e,toolName:t,toolTitle:n,intent:r,status:i??"success",value:a??"",valueType:o??"markdown",requestCall:s,showRequest:y1(l),fullScreen:y1(u),expanded:y1(c),icon:f,footer:d})})}var Ko={"shiny-tool-request":eR,"shiny-tool-result":nR};var Pp=q(me(),1);function Il(){let[e,t]=(0,Pp.useState)(()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Pp.useEffect)(()=>{let n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}var Fn=q(ne(),1),rR=2500;function $V(e){let[t,n]=(0,pt.useState)(null),r=(0,pt.useRef)(0),i=(0,pt.useRef)(null),a=(0,pt.useRef)(null);return(0,pt.useEffect)(()=>{if(!e)return;let o=Date.now(),s=o-r.current;if(s>=rR||!t)n(e),r.current=o,i.current=null;else if(i.current=e,!a.current){let l=rR-s;a.current=setTimeout(()=>{a.current=null,i.current&&(n(i.current),r.current=Date.now(),i.current=null)},l)}return()=>{a.current&&(clearTimeout(a.current),a.current=null)}},[e,t]),t}var jV=200;function XV(e){let t=Il(),[n,r]=(0,pt.useState)(e),[i,a]=(0,pt.useState)(!1),o=(0,pt.useRef)(e);return(0,pt.useLayoutEffect)(()=>{if(e===n)return;if(o.current=e,t){r(e),a(!1);return}a(!0);let s=setTimeout(()=>{r(o.current),a(!1)},jV);return()=>clearTimeout(s)},[e,n,t]),{visible:n,fading:i}}function WV({expanded:e}){return(0,Fn.jsx)("svg",{className:"shinychat-thinking-chevron",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",...e?{"data-expanded":""}:{},children:(0,Fn.jsx)("path",{d:"M4.5 2.5L8 6L4.5 9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var iR=(0,pt.memo)(function({thinking:t,messageId:n}){let[r,i]=(0,pt.useState)(!1),[a,o]=(0,pt.useState)(!1),s=(0,pt.useRef)(t.streaming),l=EN(),{scrollRef:u,contentRef:c,scrollToBottom:f}=dh({resize:"smooth"}),d=(0,pt.useRef)(!1);(0,pt.useEffect)(()=>{let y=u.current;if(!y||!r||!t.streaming)return;let T=y.scrollHeight>y.clientHeight;T&&!d.current&&f(),d.current=T},[t.content,r,t.streaming,f,u]);let h=$V(t.streaming?t.topic:null);(0,pt.useEffect)(()=>{if(s.current&&!t.streaming){if(!a){let y=setTimeout(()=>i(!1),600);return()=>clearTimeout(y)}s.current=t.streaming}s.current=t.streaming},[t.streaming,a]);let m=(0,pt.useCallback)(()=>{i(y=>(y?l?.():t.streaming&&(d.current=!1,f()),!y)),t.streaming||o(!0)},[t.streaming,l,f]),b=QV(t,h),{visible:E,fading:g}=XV(b);return!t.streaming&&!t.content.trim()?null:(0,Fn.jsxs)("div",{className:"shinychat-thinking","data-streaming":t.streaming||void 0,children:[(0,Fn.jsxs)("button",{id:`thinking-header-${n}`,className:"shinychat-thinking-header",onClick:m,"aria-expanded":r,"aria-controls":`thinking-content-${n}`,children:[(0,Fn.jsx)(WV,{expanded:r}),(0,Fn.jsx)("span",{className:"shinychat-thinking-label","data-fading":g||void 0,children:E}),t.streaming&&(0,Fn.jsx)("svg",{className:"shinychat-thinking-dot",width:"8",height:"8",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,Fn.jsx)("circle",{cx:"4",cy:"4",r:"4"})})]}),(0,Fn.jsx)("div",{className:"shinychat-thinking-content",id:`thinking-content-${n}`,role:"region","aria-labelledby":`thinking-header-${n}`,"aria-hidden":r?void 0:"true",inert:!r||void 0,"data-expanded":r||void 0,children:(0,Fn.jsx)("div",{className:"shinychat-thinking-content-inner",ref:u,children:(0,Fn.jsx)("div",{ref:c,children:(0,Fn.jsx)($t,{content:t.content,contentType:"markdown",role:"assistant",streaming:t.streaming,tagToComponentMap:Ko})})})})]})});function QV(e,t){if(e.streaming)return t??"Thinking";if(e.durationMs!=null&&e.durationMs>=500){let n=Math.round(e.durationMs/1e3);return n<1?"Thought for less than a second":`Thought for ${n}s`}return"Thinking"}var oR=q(ne(),1);function aR({name:e}){return(0,oR.jsxs)("span",{className:"command-chip",children:["/",e]})}var Up={image_types:["image/png","image/jpeg","image/gif","image/webp"],pdf_type:"application/pdf",text_extensions:{md:"text/markdown",markdown:"text/markdown",txt:"text/plain",csv:"text/csv",json:"application/json",py:"text/x-python",js:"text/javascript",ts:"text/typescript",r:"text/x-r",yaml:"text/yaml",yml:"text/yaml",toml:"text/x-toml",qmd:"text/markdown",rmd:"text/markdown",ipynb:"application/x-ipynb+json",rst:"text/x-rst",tex:"text/x-tex",sql:"text/x-sql",sh:"text/x-sh",html:"text/html",htm:"text/html",css:"text/css",xml:"application/xml",ini:"text/x-ini",cfg:"text/x-ini",log:"text/plain"}};var sR=new TextDecoder("utf-8"),JV=Up.image_types,S1=Up.pdf_type,_1=Up.text_extensions,lR=Array.from(new Set(Object.values(_1))),x1={"image/png":{family:"image",downscale:!0},"image/jpeg":{family:"image",downscale:!0},"image/gif":{family:"image",downscale:!0},"image/webp":{family:"image",downscale:!0},[S1]:{family:"document",downscale:!1},...Object.fromEntries(lR.map(e=>[e,{family:"text",downscale:!1}]))},uR=Object.keys(x1);function cR(e){let t=new Set(e);for(let[n,r]of Object.entries(_1))t.has(r)&&t.add(`.${n}`);return[...t].join(",")}var eG=1568;function $o(e){return x1[e]?.family??null}function fR(e){return JV.includes(e)}function tG(e,t,n){let r=Math.max(e,t);if(r<=n)return null;let i=n/r;return{width:Math.round(e*i),height:Math.round(t*i)}}var dR=300,hR=1e3;function A1(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r=999.95&&rt+n.size,0)}function nG(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}async function rG(e,t){if(typeof document>"u"||typeof Image>"u")return{dataUrl:e,wasDownscaled:!1};let n=await new Promise(s=>{let l=new Image;l.onload=()=>s(l),l.onerror=()=>s(null),l.src=e});if(!n||!n.naturalWidth||!n.naturalHeight)return{dataUrl:e,wasDownscaled:!1};let r=tG(n.naturalWidth,n.naturalHeight,eG);if(!r)return{dataUrl:e,wasDownscaled:!1};let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let a=i.getContext("2d");if(!a)return{dataUrl:e,wasDownscaled:!1};a.drawImage(n,0,0,r.width,r.height);let o=t==="image/gif"?"image/png":t;return{dataUrl:i.toDataURL(o),wasDownscaled:!0}}function ER(e){let t=e.lastIndexOf(".");return t<=0?"":e.slice(t+1).toLowerCase()}function zp(e,t){let n=ER(e);return n?n.toUpperCase():t===S1?"PDF":"FILE"}function yR(e){return new File([e],"Pasted Text",{type:"text/plain"})}function iG(e){if(fR(e.type)||e.type===S1)return e.type;let t=ER(e.name);return t?_1[t]??null:lR.includes(e.type)?e.type:null}async function TR(e,t){let n=iG(e);if(n===null||!t.includes(n))return null;let r=$o(n);if(r===null)return null;let i=x1[n],a=await nG(e);if(i?.downscale&&fR(n)){let{dataUrl:o,wasDownscaled:s}=await rG(a,n),l=s&&n==="image/gif"?"image/png":n;return{file:{id:Sr(),type:l,family:r,dataUrl:o,name:e.name,size:Hp(o)},wasDownscaled:s,wasConverted:l!==n}}return{file:{id:Sr(),type:n,family:r,dataUrl:a,name:e.name,size:Hp(a)},wasDownscaled:!1,wasConverted:!1}}var Fp=q(me(),1);var Ya=q(ne(),1),qp=(0,Fp.memo)(function({dataUrl:t,name:n,size:r,onRemove:i,onActivate:a,rootRef:o,rootProps:s}){let l=(0,Fp.useMemo)(()=>pR(t,dR).trim(),[t]);return(0,Ya.jsxs)("div",{ref:o,className:"shiny-chat-text-preview",title:n||void 0,...s,...a?{role:"button",tabIndex:0,onClick:a,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),a())}}:void 0,children:[(0,Ya.jsx)("div",{className:"shiny-chat-text-preview-body",children:l||"(empty file)"}),(0,Ya.jsxs)("div",{className:"shiny-chat-text-preview-footer",children:[n&&(0,Ya.jsx)("span",{className:"shiny-chat-text-preview-name",children:n}),(0,Ya.jsx)("span",{className:"shiny-chat-text-preview-size",children:jc(r)})]}),i&&(0,Ya.jsx)("button",{type:"button",tabIndex:0,"aria-label":n?`Remove ${n}`:"Remove attachment",onClick:i,children:"\xD7"})]})});var qn=q(me(),1),_R=q(io(),1);var Fi=q(ne(),1),SR='button, [tabindex="0"], a[href], input, select, textarea, iframe';function xR({src:e,name:t,mime:n,onClose:r}){let i=$o(n),a=i==="image",o=i==="text",[s,l]=(0,qn.useState)(null),u=(0,qn.useRef)(null),c=(0,qn.useRef)(null),f=(0,qn.useMemo)(()=>o?mR(e):"",[o,e]);(0,qn.useLayoutEffect)(()=>{c.current=document.activeElement instanceof HTMLElement?document.activeElement:null,u.current?.querySelector(SR)?.focus()},[]),(0,qn.useEffect)(()=>{let h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=h,c.current?.focus()}},[]);let d=(0,qn.useCallback)(h=>{if(h.key==="Escape"){r();return}if(h.key!=="Tab")return;let m=u.current;if(!m)return;let b=m.querySelectorAll(SR);if(b.length===0)return;let E=b[0],g=b[b.length-1];h.shiftKey&&document.activeElement===E?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),E.focus())},[r]);return(0,qn.useEffect)(()=>{if(a||o)return;let h=URL.createObjectURL(gR(e));return l(h),()=>URL.revokeObjectURL(h)},[e,a,o]),(0,_R.createPortal)((0,Fi.jsxs)("div",{ref:u,className:"shiny-chat-lightbox",role:"dialog","aria-modal":"true","aria-label":t||"Attachment preview",onClick:r,onKeyDown:d,children:[(0,Fi.jsxs)("div",{className:"shiny-chat-lightbox-content",onClick:h=>h.stopPropagation(),children:[a?(0,Fi.jsx)("img",{className:"shiny-chat-lightbox-img",src:e,alt:t||"Attached image"}):o?(0,Fi.jsx)("pre",{className:"shiny-chat-lightbox-text",tabIndex:0,"aria-label":t||"File content",children:f||"(empty file)"}):s&&(0,Fi.jsx)("iframe",{className:"shiny-chat-lightbox-frame",src:s,title:t||"PDF preview"}),t&&(0,Fi.jsx)("div",{className:"shiny-chat-lightbox-name",children:t})]}),(0,Fi.jsx)("button",{type:"button",className:"shiny-chat-lightbox-close","aria-label":"Close preview",onClick:r,children:"\xD7"})]}),document.body)}var $n=q(me(),1);var Lm=q(me(),1),eo=q(me(),1),Z3=q(io(),1),J3=q(Vp(),1),Ji=q(ne(),1);function mn(e){this.content=e}mn.prototype={constructor:mn,find:function(e){for(var t=0;t>1}};mn.from=function(e){if(e instanceof mn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new mn(t)};var N1=mn;function BR(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let o=i.text,s=a.text,l=0;for(;o[l]==s[l];l++)n++;return l&&l0&&d>0&&u[f-1]==c[d-1];)f--,d--,n--,r--;return f&&d&&f=56320&&e<57344}function HR(e){return e>=55296&&e<56320}var Q=class e{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;rt&&r(l,i+s,a||null,o)!==!1&&l.content.size){let c=s+1;l.nodesBetween(Math.max(0,t-c),Math.min(l.content.size,n-c),r,i+c)}s=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let a="",o=!0;return this.nodesBetween(t,n,(s,l)=>{let u=s.isText?s.text.slice(Math.max(t,l)-l,n-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&u||s.isTextblock)&&r&&(o?o=!1:a+=r),a+=u},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);at)for(let a=0,o=0;ot&&((on)&&(s.isText?s=s.cut(Math.max(0,t-o),Math.min(s.text.length,n-o)):s=s.cut(Math.max(0,t-o-1),Math.min(s.content.size,n-o-1))),r.push(s),i+=s.nodeSize),o=l}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;nthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=t)return a==t?Gp(n+1,a):Gp(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;nr.type.rank-i.type.rank),n}};Ie.none=[];var Wo=class extends Error{},re=class e{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=FR(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(zR(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return e.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 e(Q.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let a=t.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,r,i)}};re.empty=new re(Q.empty,0,0);function zR(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(r,a.copy(zR(a.content,t-i-1,n-i-1)))}function FR(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),l=e.maybeChild(o);if(s==t||l.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let u=FR(l.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,l);return u&&e.replaceChild(o,l.copy(u))}function pG(e,t,n){if(n.openStart>e.depth)throw new Wo("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Wo("Inconsistent open depths");return qR(e,t,n,0)}function qR(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Xc(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(jo(e.nodeAfter,r),a++));for(let s=a;si&&k1(e,t,i+1),o=r.depth>i&&k1(n,r,i+1),s=[];return Xc(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(VR(a,o),jo(Xo(a,GR(e,t,n,r,i+1)),s)):(a&&jo(Xo(a,jp(e,t,i+1)),s),Xc(t,n,i,s),o&&jo(Xo(o,jp(n,r,i+1)),s)),Xc(r,null,i,s),new Q(s)}function jp(e,t,n){let r=[];if(Xc(null,e,n,r),e.depth>n){let i=k1(e,t,n+1);jo(Xo(i,jp(e,t,n+1)),r)}return Xc(t,null,n,r),new Q(r)}function mG(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let a=n-1;a>=0;a--)i=t.node(a).copy(Q.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}var Xp=class e{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Qo(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let o=t;;){let{index:s,offset:l}=o.content.findIndex(a),u=a-l;if(r.push(o,s,i+l),!u||(o=o.child(s),o.isText))break;a=u-1,i+=l+1}return new e(n,r,a)}static resolveCached(t,n){let r=vR.get(t);if(r)for(let a=0;at&&this.nodesBetween(t,n,a=>(r.isInSet(a.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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),YR(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Q.empty,i=0,a=r.childCount){let o=this.contentMatchAt(t).matchFragment(r,i,a),s=o&&o.matchFragment(this.content,n);if(!s||!s.validEnd)return!1;for(let l=i;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,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(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=Q.fromJSON(t,n.content),a=t.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Vn.prototype.text=void 0;var M1=class e extends Vn{constructor(t,n,r,i){if(super(t,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):YR(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function YR(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var Zo=class e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new O1(t,n);if(r.next==null)return e.empty;let i=KR(r);r.next&&r.err("Unexpected trailing text");let a=AG(xG(i));return CG(a,r),a}matchType(t){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let i=0;i{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+t.indexOf(r.next[o].next);return a}).join(` -`)}};Zo.empty=new Zo(!0);var O1=class{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function KR(e){let t=[];do t.push(EG(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function EG(e){let t=[];do t.push(yG(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function yG(e){let t=_G(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=TG(e,t);else break;return t}function kR(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function TG(e,t){let n=kR(e),r=n;return e.eat(",")&&(e.next!="}"?r=kR(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function SG(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let a in n){let o=n[a];o.isInGroup(t)&&i.push(o)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function _G(e){if(e.eat("(")){let t=KR(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=SG(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function xG(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(o,s,l){let u={term:l,to:s};return t[o].push(u),u}function i(o,s){o.forEach(l=>l.to=s)}function a(o,s){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(a(u,s)),[]);if(o.type=="seq")for(let l=0;;l++){let u=a(o.exprs[l],s);if(l==o.exprs.length-1)return u;i(u,s=n())}else if(o.type=="star"){let l=n();return r(s,l),i(a(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(a(o.expr,s),l),i(a(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(s)].concat(a(o.expr,s));if(o.type=="range"){let l=s;for(let u=0;u{e[o].forEach(({term:s,to:l})=>{if(!s)return;let u;for(let c=0;c{u||i.push([s,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let a=t[r.join(",")]=new Zo(r.indexOf(e.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:XR(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Vn(this,this.computeAttrs(t),Q.from(n),Ie.setFrom(r))}createChecked(t=null,n,r){return n=Q.from(n),this.checkContent(n),new Vn(this,this.computeAttrs(t),n,Ie.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=Q.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(Q.empty,!0);return a?new Vn(this,t,n.append(a),Ie.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;nr[a]=new e(a,n,o));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 a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function NG(e,t,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${a}`)}}var R1=class{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?NG(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Qc=class e{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=QR(t,i.attrs),this.excluded=null;let a=jR(this.attrs);this.instance=a?new Ie(this,a):null}create(t=null){return!t&&this.instance?this.instance:new Ie(this,XR(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((a,o)=>r[a]=new e(a,i++,n,o)),r}removeFromSet(t){for(var n=0;n-1}},Pl=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=N1.from(t.nodes),n.marks=N1.from(t.marks||{}),this.nodes=Wp.compile(this.spec.nodes,this),this.marks=Qc.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 a=this.nodes[i],o=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=Zo.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?MR(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:MR(this,o.split(" "))}this.nodeFromJSON=i=>Vn.fromJSON(this,i),this.markFromJSON=i=>Ie.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Wp){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new M1(r,r.defaultAttrs,t,Ie.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function MR(e,t){let n=[];for(let r=0;r-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function vG(e){return e.tag!=null}function kG(e){return e.style!=null}var ai=class e{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(vG(i))this.tags.push(i);else if(kG(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=t.nodes[i.node];return a.contentMatch.matchType(a)})}parse(t,n={}){let r=new Qp(this,n,!1);return r.addAll(t,Ie.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new Qp(this,n,!0);return r.addAll(t,Ie.none,n.from,n.to),re.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;it.length&&(s.charCodeAt(t.length)!=61||s.slice(t.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(t){let n=[];function r(i){let a=i.priority==null?50:i.priority,o=0;for(;o{r(o=RR(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in t.nodes){let a=t.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=RR(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},ZR={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},wG={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},JR={ol:!0,ul:!0},Zc=1,D1=2,Wc=4;function OR(e,t,n){return t!=null?(t?Zc:0)|(t==="full"?D1:0):e&&e.whitespace=="pre"?Zc|D1:n&~Wc}var Bl=class{constructor(t,n,r,i,a,o){this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ie.none,this.match=a||(o&Wc?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Q.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Zc)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=Q.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!ZR.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},Qp=class{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,o=OR(null,n.preserveWhitespace,0)|(r?Wc:0);i?a=new Bl(i.type,i.attrs,Ie.none,!0,n.topMatch||i.type.contentMatch,o):r?a=new Bl(null,null,Ie.none,!0,null,o):a=new Bl(t.schema.topNodeType,null,Ie.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,i=this.top,a=i.options&D1?"full":this.localPreserveWS||(i.options&Zc)>0,{schema:o}=this.parser;if(a==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,` -`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let s=r.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return n}addElementByRule(t,n,r,i){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(a=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}a&&this.sync(s)&&this.open--}addAll(t,n,r,i){let a=r||0;for(let o=r?t.childNodes[r]:t.firstChild,s=i==null?null:t.childNodes[i];o!=s;o=o.nextSibling,++a)this.findAtPoint(t,a),this.addDOM(o,n);this.findAtPoint(t,a)}findPlace(t,n,r){let i,a;for(let o=this.open,s=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(t);if(u&&(!i||i.length>u.length+s)&&(i=u,a=l,!u.length))break;if(l.solid){if(r)break;s+=2}}if(!i)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(u.type):DR(u.type,t))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Bl(t,n,l,i,null,s)),this.open++,r}closeExtra(t=!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(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Zc)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),o=(s,l)=>{for(;s>=0;s--){let u=n[s];if(u==""){if(s==n.length-1||s==0)continue;for(;l>=a;l--)if(o(s-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=a?r.node(l-a).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.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 MG(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&JR.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function OG(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function RR(e){let t={};for(let n in e)t[n]=e[n];return t}function DR(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=s=>{a.push(s);for(let l=0;l{if(a.length||o.marks.length){let s=0,l=0;for(;s=0;i--){let a=this.serializeMark(t.marks[i],t.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&Kp(Yp(r),i(t,n),null,t.attrs)}static renderSpec(t,n,r=null,i){return typeof n=="string"?{dom:t.createTextNode(n)}:Kp(t,n,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=IR(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return IR(t.marks)}};function IR(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Yp(e){return e.document||window.document}var LR=new WeakMap;function RG(e){let t=LR.get(e);return t===void 0&&LR.set(e,t=DG(e)),t}function DG(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let i=0;i-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 o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,l=n?e.createElementNS(n,i):e.createElement(i),u=t[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let f in u)if(u[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),u[f]):f=="style"&&l.style?l.style.cssText=u[f]:l.setAttribute(f,u[f])}}for(let f=c;fc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof d=="string")l.appendChild(e.createTextNode(d));else{let{dom:h,contentDOM:m}=Kp(e,d,n,r);if(l.appendChild(h),m){if(s)throw new RangeError("Multiple content holes");s=m}}}return{dom:l,contentDOM:s}}var nD=65535,rD=Math.pow(2,16);function IG(e,t){return e+t*rD}function eD(e){return e&nD}function LG(e){return(e-(e&nD))/rD}var iD=1,aD=2,Zp=4,oD=8,tf=class{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&oD)>0}get deletedBefore(){return(this.delInfo&(iD|Zp))>0}get deletedAfter(){return(this.delInfo&(aD|Zp))>0}get deletedAcross(){return(this.delInfo&Zp)>0}},Vi=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(t){let n=0,r=eD(t);if(!this.inverted)for(let i=0;it)break;let u=this.ranges[s+a],c=this.ranges[s+o],f=l+u;if(t<=f){let d=u?t==l?-1:t==f?1:n:n,h=l+i+(d<0?0:c);if(r)return h;let m=t==(n<0?l:f)?null:IG(s/3,t-l),b=t==l?aD:t==f?iD:Zp;return(n<0?t!=l:t!=f)&&(b|=oD),new tf(h,b,m)}i+=c-u}return r?t+i:new tf(t+i,0,null)}touches(t,n){let r=0,i=eD(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;st)break;let u=this.ranges[s+a],c=l+u;if(t<=c&&s==i*3)return!0;r+=this.ranges[s+o]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i=0;n--){let i=t.getMirror(n);this.appendMap(t._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;ra&&l!o.isAtom||!s.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return an.fromReplace(t,this.from,this.to,a)}invert(){return new Gi(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};jt.jsonID("addMark",rf);var Gi=class e extends jt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new re(H1(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return an.fromReplace(t,this.from,this.to,r)}invert(){return new rf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};jt.jsonID("removeMark",Gi);var af=class e extends jt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return an.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return an.fromReplace(t,this.pos,this.pos+1,new re(Q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 e(n.from,n.to,n.gapFrom,n.gapTo,re.fromJSON(t,n.slice),n.insert,!!n.structure)}};jt.jsonID("replaceAround",It);function P1(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function BG(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(l,u,c)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let d=Math.max(u,t),h=Math.min(u+l.nodeSize,n),m=r.addToSet(f);for(let b=0;be.step(l)),a.forEach(l=>e.step(l))}function PG(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(o,s)=>{if(!o.isInline)return;a++;let l=null;if(r instanceof Qc){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(s+o.nodeSize,n);for(let c=0;ce.step(new Gi(o.from,o.to,o.style)))}function z1(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let l=0;l=0;l--)e.step(o[l])}function UG(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Yi(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,i=0,a=0;;--r){let o=e.$from.node(r),s=e.$from.index(r)+i,l=e.$to.indexAfter(r)-a;if(rn;m--)b||r.index(m)>0?(b=!0,c=Q.from(r.node(m).copy(c)),f++):l--;let d=Q.empty,h=0;for(let m=a,b=!1;m>n;m--)b||i.after(m+1)=0;o--){if(r.size){let s=n[o].type.contentMatch.matchFragment(r);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Q.from(n[o].type.create(n[o].attrs,r))}let i=t.start,a=t.end;e.step(new It(i,a,i,a,new re(r,0,0),n.length,!0))}function VG(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=e.steps.length;e.doc.nodesBetween(t,n,(o,s)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&GG(e.doc,e.mapping.slice(a).map(s),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&lD(e,o,s,a),z1(e,e.mapping.slice(a).map(s,1),r,void 0,u===null);let c=e.mapping.slice(a),f=c.map(s,1),d=c.map(s+o.nodeSize,1);return e.step(new It(f,d,f+1,d-1,new re(Q.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&sD(e,o,s,a),!1}})}function sD(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let l=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function lD(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+a);e.replaceWith(o,o+1,t.type.schema.text(` -`))}})}function GG(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function YG(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new It(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new re(Q.from(o),0,0),1,!0))}function ur(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>a;u--,c--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),m=r&&r[c+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!b.type.validContent(h))return!1}let s=i.indexAfter(a),l=r&&r[0];return i.node(a).canReplaceWith(s,s,l?l.type:i.node(a+1).type)}function KG(e,t,n=1,r){let i=e.doc.resolve(t),a=Q.empty,o=Q.empty;for(let s=i.depth,l=i.depth-n,u=n-1;s>l;s--,u--){a=Q.from(i.node(s).copy(a));let c=r&&r[u];o=Q.from(c?c.type.create(c.attrs,o):i.node(s).copy(o))}e.step(new on(t,t,new re(a.append(o),n,n),!0))}function zr(e,t){let n=e.resolve(t),r=n.index();return uD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function $G(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i0?(a=r.node(i+1),s++,o=r.node(i).maybeChild(s)):(a=r.node(i).maybeChild(s-1),o=r.node(i+1)),a&&!a.isTextblock&&uD(a,o)&&r.node(i).canReplace(s,s+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function jG(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);c&&!f?r=!1:!c&&f&&(r=!0)}let s=e.steps.length;if(r===!1){let c=e.doc.resolve(t+n);lD(e,c.node(),c.before(),s)}o.inlineContent&&z1(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let l=e.mapping.slice(s),u=l.map(t-n);if(e.step(new on(u,l.map(t+n,-1),re.empty,!0)),r===!0){let c=e.doc.resolve(u);sD(e,c.node(),c.before(),e.steps.length)}return e}function XG(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,n))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,n))return r.after(i+1);if(a=0;o--){let s=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(s>0?1:0),u=r.node(o),c=!1;if(a==1)c=u.canReplace(l,l,i);else{let f=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=f&&u.canReplaceWith(l,l,f[0])}if(c)return s==0?r.pos:s<0?r.before(o+1):r.after(o+1)}return null}function sf(e,t,n=t,r=re.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return fD(i,a,r)?new on(t,n,r):new U1(i,a,r).fit()}function fD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var U1=class{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Q.empty;for(let i=0;i<=t.depth;i++){let a=t.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=Q.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let a=this.placed,o=r.depth,s=i.depth;for(;o&&s&&a.childCount==1;)a=a.firstChild.content,o--,s--;let l=new re(a,o,s);return t>-1?new It(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new on(r.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),a.type.spec.isolating&&i<=r){t=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,a=null;r?(a=L1(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.firstChild;for(let s=this.depth;s>=0;s--){let{type:l,match:u}=this.frontier[s],c,f=null;if(n==1&&(o?u.matchType(o.type)||(f=u.fillBefore(Q.from(o),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:s,parent:a,inject:f};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:s,parent:a,wrap:c};if(a&&u.matchType(a.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=L1(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new re(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=L1(t,n);if(i.childCount<=1&&n>0){let a=t.size-n<=n+i.size;this.unplaced=new re(Jc(t,n-1,1),n-1,a?n-1:r)}else this.unplaced=new re(Jc(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let b=0;b1||l==0||b.content.size)&&(f=E,c.push(dD(b.mark(d.allowedMarks(b.marks)),u==1?l:0,u==s.childCount?h:-1)))}let m=u==s.childCount;m||(h=-1),this.placed=ef(this.placed,n,Q.from(c)),this.frontier[n].match=f,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,E=s;b1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],a=n=0;s--){let{match:l,type:u}=this.frontier[s],c=B1(t,s,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:a?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ef(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,a)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=ef(this.placed,this.depth,Q.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Q.empty,!0);n.childCount&&(this.placed=ef(this.placed,this.frontier.length,n))}};function Jc(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Jc(e.firstChild.content,t-1,n)))}function ef(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(ef(e.lastChild.content,t-1,n)))}function L1(e,t){for(let n=0;n1&&(r=r.replaceChild(0,dD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Q.empty,!0)))),e.copy(r)}function B1(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!WG(n,a.content,o)?s:null}function WG(e,t,n){for(let r=n;r0;d--,h--){let m=i.node(d).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(d)>-1?s=d:i.before(d)==h&&o.splice(1,0,-d)}let l=o.indexOf(s),u=[],c=r.openStart;for(let d=r.content,h=0;;h++){let m=d.firstChild;if(u.push(m),h==r.openStart)break;d=m.content}for(let d=c-1;d>=0;d--){let h=u[d],m=QG(h.type);if(m&&!h.sameMarkup(i.node(Math.abs(s)-1)))c=d;else if(m||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+c+1)%(r.openStart+1),m=u[h];if(m)for(let b=0;b=0&&(e.replace(t,n,r),!(e.steps.length>f));d--){let h=o[d];h<0||(t=i.before(h),n=a.after(h))}}function hD(e,t,n,r,i){if(tr){let a=i.contentMatchAt(0),o=a.fillBefore(e).append(e);e=o.append(a.matchFragment(o).fillBefore(Q.empty,!0))}return e}function JG(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=XG(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new re(Q.from(r),0,0))}function eY(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),s=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(s=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(s=!0);if(!s){for(let l=r.depth;l>0&&t==r.start(l);l--)t=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=pD(r,i);for(let o=0;o0&&(l||r.node(s-1).canReplace(r.index(s-1),i.indexAfter(s-1))))return e.delete(r.before(s),i.after(s))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}function pD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let a=e.start(i);if(at.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(a==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==a-1)&&n.push(i)}return n}var Jp=class e extends jt{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return an.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return an.fromReplace(t,this.pos,this.pos+1,new re(Q.from(i),0,n.isLeaf?0:1))}getMap(){return Vi.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(n.pos,n.attr,n.value)}};jt.jsonID("attr",Jp);var em=class e extends jt{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return an.ok(r)}getMap(){return Vi.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(n.attr,n.value)}};jt.jsonID("docAttr",em);var Hl=class extends Error{};Hl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Hl.prototype=Object.create(Error.prototype);Hl.prototype.constructor=Hl;Hl.prototype.name="TransformError";var zl=class{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new nf}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Hl(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r{t=Math.min(t,s),n=Math.max(n,l)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=re.empty){let i=sf(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new re(Q.from(r),0,0))}delete(t,n){return this.replace(t,n,re.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return ZG(this,t,n,r),this}replaceRangeWith(t,n,r){return JG(this,t,n,r),this}deleteRange(t,n){return eY(this,t,n),this}lift(t,n){return HG(this,t,n),this}join(t,n=1){return jG(this,t,n),this}wrap(t,n){return qG(this,t,n),this}setBlockType(t,n=t,r,i=null){return VG(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return YG(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new Jp(t,n,r)),this}setDocAttribute(t,n){return this.step(new em(t,n)),this}addNodeMark(t,n){return this.step(new af(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof Ie)n.isInSet(r.marks)&&this.step(new Ul(t,n));else{let i=r.marks,a,o=[];for(;a=n.isInSet(i);)o.push(new Ul(t,a)),i=a.removeFromSet(i);for(let s=o.length-1;s>=0;s--)this.step(o[s])}return this}split(t,n=1,r){return KG(this,t,n,r),this}addMark(t,n,r){return BG(this,t,n,r),this}removeMark(t,n,r){return PG(this,t,n,r),this}clearIncompatible(t,n,r){return z1(this,t,n,r),this}};var F1=Object.create(null),Ce=class{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new nm(t.min(n),t.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 t=this.ranges;for(let n=0;n=0;a--){let o=n<0?Fl(t.node(0),t.node(a),t.before(a+1),t.index(a),n,r):Fl(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,n,r);if(o)return o}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Nn(t.node(0))}static atStart(t){return Fl(t,t,0,0,1)||new Nn(t)}static atEnd(t){return Fl(t,t,t.content.size,t.childCount,-1)||new Nn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=F1[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in F1)throw new RangeError("Duplicate use of selection JSON ID "+t);return F1[t]=n,n.prototype.jsonID=t,n}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}};Ce.prototype.visible=!0;var nm=class{constructor(t,n){this.$from=t,this.$to=n}},mD=!1;function gD(e){!mD&&!e.parent.inlineContent&&(mD=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var pe=class e extends Ce{constructor(t,n=t){gD(t),gD(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ce.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(t,n=re.empty){if(super.replace(t,n),n==re.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new rm(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let a=Ce.findFrom(n,r,!0)||Ce.findFrom(n,-r,!0);if(a)n=a.$head;else return Ce.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Ce.findFrom(t,-r,!0)||Ce.findFrom(t,r,!0)).$anchor,t.pos0?0:1);i>0?o=0;o+=i){let s=t.child(o);if(s.isAtom){if(!a&&fe.isSelectable(s))return fe.create(e,n-(i<0?s.nodeSize:0))}else{let l=Fl(e,s,n+i,i<0?s.childCount:0,i,a);if(l)return l}n+=s.nodeSize*i}return null}function bD(e,t,n){let r=e.steps.length-1;if(r{o==null&&(o=c)}),e.setSelection(Ce.near(e.doc.resolve(o),n))}var ED=1,tm=2,yD=4,G1=class extends zl{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=tm,this}ensureMarks(t){return Ie.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&tm)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~tm,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ie.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,a)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Ce.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=yD,this}get scrolledIntoView(){return(this.updated&yD)>0}};function TD(e,t){return!t||!e?e:e.bind(t)}var es=class{constructor(t,n,r){this.name=t,this.init=TD(n.init,r),this.apply=TD(n.apply,r)}},nY=[new es("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new es("selection",{init(e,t){return e.selection||Ce.atStart(t.doc)},apply(e){return e.selection}}),new es("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new es("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],lf=class{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=nY.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 es(r.key,r.spec.state,r))})}},im=class e{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;rr.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],a=i.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new lf(t.schema,t.plugins),a=new e(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=Vn.fromJSON(t.schema,n.doc);else if(o.name=="selection")a.selection=Ce.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let s in r){let l=r[s],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,s)){a[o.name]=u.fromJSON.call(l,t,n[s],a);return}}a[o.name]=o.init(t,a)}}),a}};function SD(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=SD(i,t,{})),n[r]=i}return n}var Ue=class{constructor(t){this.spec=t,this.props={},t.props&&SD(t.props,this,this.props),this.key=t.key?t.key.key:_D("plugin")}getState(t){return t[this.key]}},q1=Object.create(null);function _D(e){return e in q1?e+"$"+ ++q1[e]:(q1[e]=0,e+"$")}var at=class{constructor(t="key"){this.key=_D(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}};var AD=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function CD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var K1=(e,t,n)=>{let r=CD(e,n);if(!r)return!1;let i=j1(r);if(!i){let o=r.blockRange(),s=o&&Yi(o);return s==null?!1:(t&&t(e.tr.lift(o,s).scrollIntoView()),!0)}let a=i.nodeBefore;if(ID(e,i,t,-1))return!0;if(r.parent.content.size==0&&(ql(a,"end")||fe.isSelectable(a)))for(let o=r.depth;;o--){let s=sf(e.doc,r.before(o),r.after(o),re.empty);if(s&&s.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},ND=(e,t,n)=>{let r=CD(e,n);if(!r)return!1;let i=j1(r);return i?kD(e,i,t):!1},vD=(e,t,n)=>{let r=wD(e,n);if(!r)return!1;let i=Q1(r);return i?kD(e,i,t):!1};function kD(e,t,n){let r=t.nodeBefore,i=r,a=t.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=t.nodeAfter,s=o,l=t.pos+1;for(;!s.isTextblock;l++){if(s.type.spec.isolating)return!1;let c=s.firstChild;if(!c)return!1;s=c}let u=sf(e.doc,a,l,re.empty);if(!u||u.from!=a||u instanceof on&&u.slice.size>=l-a)return!1;if(n){let c=e.tr.step(u);c.setSelection(pe.create(c.doc,a)),n(c.scrollIntoView())}return!0}function ql(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var $1=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;a=j1(r)}let o=a&&a.nodeBefore;return!o||!fe.isSelectable(o)?!1:(t&&t(e.tr.setSelection(fe.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function j1(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function wD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let r=wD(e,n);if(!r)return!1;let i=Q1(r);if(!i)return!1;let a=i.nodeAfter;if(ID(e,i,t,1))return!0;if(r.parent.content.size==0&&(ql(a,"start")||fe.isSelectable(a))){let o=sf(e.doc,r.before(),r.after(),re.empty);if(o&&o.slice.size{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,r=n instanceof fe,i;if(r){if(n.node.isTextblock||!zr(e.doc,n.from))return!1;i=n.from}else if(i=Jo(e.doc,n.from,-1),i==null)return!1;if(t){let a=e.tr.join(i);r&&a.setSelection(fe.create(a.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(a.scrollIntoView())}return!0},OD=(e,t)=>{let n=e.selection,r;if(n instanceof fe){if(n.node.isTextblock||!zr(e.doc,n.to))return!1;r=n.to}else if(r=Jo(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},RD=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Yi(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Z1=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(` -`).scrollIntoView()),!0)};function J1(e){for(let t=0;t{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=J1(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let s=n.after(),l=e.tr.replaceWith(s,s,o.createAndFill());l.setSelection(Ce.near(l.doc.resolve(s),1)),t(l.scrollIntoView())}return!0},tT=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Nn||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=J1(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let o=(!r.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(ur(e.doc,a))return t&&t(e.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Yi(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function rY(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof fe&&t.selection.node.isBlock)return!r.parentOffset||!ur(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,l=!1,u=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),u=r.start(h)==r.pos-(r.depth-h),s=J1(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let b=e&&e(i.parent,l,r);a.unshift(b||(l&&s?{type:s}:null)),o=h;break}else{if(h==1)return!1;a.unshift(null)}let c=t.tr;(t.selection instanceof pe||t.selection instanceof Nn)&&c.deleteSelection();let f=c.mapping.map(r.pos),d=ur(c.doc,f,a.length,a);if(d||(a[0]=s?{type:s}:null,d=ur(c.doc,f,a.length,a)),!d)return!1;if(c.split(f,a.length,a),!l&&u&&r.node(o).type!=s){let h=c.mapping.map(r.before(o)),m=c.doc.resolve(h);s&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,s)&&c.setNodeMarkup(c.mapping.map(r.before(o)),s)}return n&&n(c.scrollIntoView()),!0}}var iY=rY();var DD=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(fe.create(e.doc,i))),!0)},aY=(e,t)=>(t&&t(e.tr.setSelection(new Nn(e.doc))),!0);function oY(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||zr(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function ID(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,l=i.type.spec.isolating||a.type.spec.isolating;if(!l&&oY(e,t,n))return!0;let u=!l&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let h=t.pos+a.nodeSize,m=Q.empty;for(let g=o.length-1;g>=0;g--)m=Q.from(o[g].create(null,m));m=Q.from(i.copy(m));let b=e.tr.step(new It(t.pos-1,h,t.pos,h,new re(m,1,0),o.length,!0)),E=b.doc.resolve(h+2*o.length);E.nodeAfter&&E.nodeAfter.type==i.type&&zr(b.doc,E.pos)&&b.join(E.pos),n(b.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&l?null:Ce.findFrom(t,1),f=c&&c.$from.blockRange(c.$to),d=f&&Yi(f);if(d!=null&&d>=t.depth)return n&&n(e.tr.lift(f,d).scrollIntoView()),!0;if(u&&ql(a,"start",!0)&&ql(i,"end")){let h=i,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=a,E=1;for(;!b.isTextblock;b=b.firstChild)E++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let g=Q.empty;for(let T=m.length-1;T>=0;T--)g=Q.from(m[T].copy(g));let y=e.tr.step(new It(t.pos-m.length,t.pos+a.nodeSize,t.pos+E,t.pos+a.nodeSize-E,new re(g,m.length,0),0,!0));n(y.scrollIntoView())}return!0}}return!1}function LD(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(pe.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var rT=LD(-1),iT=LD(1);function BD(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&of(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function aT(e,t=null){return function(n,r){let i=!1;for(let a=0;a{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(e,t)))if(l.type==e)i=!0;else{let c=n.doc.resolve(u),f=c.index();i=c.parent.canReplaceWith(f,f+1,e)}})}if(!i)return!1;if(r){let a=n.tr;for(let o=0;o=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=o.resolve(t.start-2);a=new Qo(l,l,t.depth),t.endIndex=0;c--)a=Q.from(n[c].type.create(n[c].attrs,a));e.step(new It(t.start-(r?2:0),t.end,t.start,t.end,new re(a,0,0),n.length,!0));let o=0;for(let c=0;co.childCount>0&&o.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?cY(t,n,e,a):fY(t,n,a):!0:!1}}function cY(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);ab;m--)h-=i.child(m).nodeSize,r.delete(h-1,h+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,l=n.endIndex==i.childCount,u=a.node(-1),c=a.index(-1);if(!u.canReplace(c+(s?0:1),c+1,o.content.append(l?Q.empty:Q.from(i))))return!1;let f=a.pos,d=f+o.nodeSize;return r.step(new It(f-(s?1:0),d+(l?1:0),f+1,d-1,new re((s?Q.empty:Q.from(i.copy(Q.empty))).append(l?Q.empty:Q.from(i.copy(Q.empty))),s?0:1,l?0:1),s?0:1)),t(r.scrollIntoView()),!0}function HD(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,l=s.child(o-1);if(l.type!=e)return!1;if(n){let u=l.lastChild&&l.lastChild.type==s.type,c=Q.from(u?e.create():null),f=new re(Q.from(e.create(null,Q.from(s.type.create(null,c)))),u?3:1,0),d=a.start,h=a.end;n(t.tr.step(new It(d-(u?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}var sn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Kl=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},dT=null,$i=function(e,t,n){let r=dT||(dT=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},dY=function(){dT=null},ls=function(e,t,n,r){return n&&(zD(e,t,n,r,-1)||zD(e,t,n,r,1))},hY=/^(img|br|input|textarea|hr)$/i;function zD(e,t,n,r,i){for(var a;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Nr(e))){let o=e.parentNode;if(!o||o.nodeType!=1||gf(e)||hY.test(e.nodeName)||e.contentEditable=="false")return!1;t=sn(e)+(i<0?0:1),e=o}else if(e.nodeType==1){let o=e.childNodes[t+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)t+=i;else return!1;else e=o,t=i<0?Nr(e):0}else return!1}}function Nr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function pY(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Nr(e)}else if(e.parentNode&&!gf(e))t=sn(e),e=e.parentNode;else return null}}function mY(e,t){for(;;){if(e.nodeType==3&&t2),Cr=$l||(oi?/Mac/.test(oi.platform):!1),TI=oi?/Win/.test(oi.platform):!1,ji=/Android \d/.test(Qa),bf=!!FD&&"webkitFontSmoothing"in FD.documentElement.style,yY=bf?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function TY(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ki(e,t){return typeof e=="number"?e:e[t]}function SY(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function qD(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Kl(o);continue}let s=o,l=s==a.body,u=l?TY(a):SY(s),c=0,f=0;if(t.topu.bottom-Ki(r,"bottom")&&(f=t.bottom-t.top>u.bottom-u.top?t.top+Ki(i,"top")-u.top:t.bottom-u.bottom+Ki(i,"bottom")),t.leftu.right-Ki(r,"right")&&(c=t.right-u.right+Ki(i,"right")),c||f)if(l)a.defaultView.scrollBy(c,f);else{let h=s.scrollLeft,m=s.scrollTop;f&&(s.scrollTop+=f),c&&(s.scrollLeft+=c);let b=s.scrollLeft-h,E=s.scrollTop-m;t={left:t.left-b,top:t.top-E,right:t.right-b,bottom:t.bottom-E}}let d=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(d))break;o=d=="absolute"?o.offsetParent:Kl(o)}}function _Y(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o=n-20){r=s,i=l.top;break}}return{refDOM:r,refTop:i,stack:SI(e.dom)}}function SI(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Kl(r));return t}function xY({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;_I(n,r==0?0:r-t)}function _I(e,t){for(let n=0;n=s){o=Math.max(m.bottom,o),s=Math.min(m.top,s);let b=m.left>t.left?m.left-t.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=c,u={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(a=f+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?CY(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:xI(n,i)}function CY(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:e,offset:0}}function OT(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function NY(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(o.left+o.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function kY(e,t,n,r){let i=-1;for(let a=t,o=!1;a!=e.dom;){let s=e.docView.nearestDesc(a,!0),l;if(!s)return null;if(s.dom.nodeType==1&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((l=s.dom.getBoundingClientRect()).width||l.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=s.posBefore:(!o&&l.right-1?i:e.docView.posFromDOM(t,n,-1)}function AI(e,t,n){let r=e.childNodes.length;if(r&&n.topt.top&&i++}let u;bf&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(s=kY(e,r,i,t))}s==null&&(s=vY(e,o,t));let l=e.docView.nearestDesc(o,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function VD(e){return e.top=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,uf($a($i(r,l,u),c),c<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Nr(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return sT(l.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==Nr(r))){let l=r.childNodes[i-1],u=l.nodeType==3?$i(l,Nr(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return uf($a(u,1),!1)}if(a==null&&i=0)}function uf(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function sT(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function NI(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function OY(e,t,n){let r=t.selection,i=n=="up"?r.$from:r.$to;return NI(e,t,()=>{let{node:a}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let s=e.docView.nearestDesc(a,!0);if(!s)break;if(s.node.isBlock){a=s.contentDOM||s.dom;break}a=s.dom.parentNode}let o=CI(e,i.pos,1);for(let s=a.firstChild;s;s=s.nextSibling){let l;if(s.nodeType==1)l=s.getClientRects();else if(s.nodeType==3)l=$i(s,0,s.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}var RY=/[\u0590-\u08ac]/;function DY(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!RY.test(r.parent.textContent)||!s.modify?n=="left"||n=="backward"?a:o:NI(e,t,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:f}=e.domSelectionRange(),d=s.caretBidiLevel;s.modify("move",n,"character");let h=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:b}=e.domSelectionRange(),E=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==b;try{s.collapse(c,f),l&&(l!=c||u!=f)&&s.extend&&s.extend(l,u)}catch{}return d!=null&&(s.caretBidiLevel=d),E}):r.pos==r.start()||r.pos==r.end()}var GD=null,YD=null,KD=!1;function IY(e,t,n){return GD==t&&YD==n?KD:(GD=t,YD=n,KD=n=="up"||n=="down"?OY(e,t,n):DY(e,t,n))}var kr=0,$D=1,ns=2,si=3,us=class{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=kr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;nsn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let a=this.getDesc(i),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(t.nodeType==1?t:t.parentNode):o==t))r=!1;else return a}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;nt||o instanceof sm){i=t-a;break}a=s}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof am&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?sn(a.dom)+1:0}}else{let a,o=!0;for(;a=r=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,c);t=o;for(let f=s;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=sn(d.dom)+1;break}t-=d.size}i==-1&&(i=0)}if(i>-1&&(u>n||s==this.children.length-1)){n=u;for(let c=s+1;cm&&on){let m=s;s=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(s.node,s.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,i=0;i=r:tr){let s=r+a.border,l=o-a.border;if(t>=s&&n<=l){this.dirty=t==r||n==o?ns:$D,t==s&&n==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=si:a.markDirty(t-s,n-s);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?ns:si}r=o}this.dirty=ns}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?ns:$D;n.dirty{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let s=document.createElement("span");s.appendChild(o),o=s}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(t,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(t){return this.dirty==kr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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}},gT=class extends us{constructor(t,n,r,i){super(t,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}},jl=class e extends us{constructor(t,n,r,i,a){super(t,[],r,i),this.mark=n,this.spec=a}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=qi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&si||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=si&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=kr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=TT(a,0,t,r));for(let s=0;s{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=qi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=wI(c,r,n),u?l=new bT(t,n,r,i,c,f||null,d,u,a,o+1):n.isText?new om(t,n,r,i,c,d,a):new e(t,n,r,i,c,f||null,d,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>Q.empty)}return t}matchesNode(t,n,r){return this.dirty==kr&&t.eq(this.node)&&lm(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,i=n,a=t.composing?this.localCompositionInfo(t,n):null,o=a&&a.pos>-1?a:null,s=a&&a.pos<0,l=new yT(this,o&&o.node,t);UY(this.node,this.innerDeco,(u,c,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,t,c):u.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?Ie.none:this.node.child(c).marks,r,t,c),l.placeWidget(u,t,i)},(u,c,f,d)=>{l.syncToMarks(u.marks,r,t,d);let h;l.findNodeMatch(u,c,f,d)||s&&t.state.selection.from>i&&t.state.selection.to-1&&l.updateNodeAt(u,c,f,h,t)||l.updateNextNode(u,c,f,t,d,i)||l.addNode(u,c,f,t,i),i+=u.nodeSize}),l.syncToMarks([],r,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ns)&&(o&&this.protectLocalComposition(t,o),vI(this.contentDOM,this.children,t),$l&&HY(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof pe)||rn+this.node.content.size)return null;let a=t.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,s=zY(this.node.content,o,r-n,i-n);return s<0?null:{node:a,pos:s,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new gT(this,a,n,i);t.input.compositionNodes.push(o),this.children=TT(this.children,r,r+i.length,t,o)}update(t,n,r,i){return this.dirty==si||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,i),!0)}updateInner(t,n,r,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=kr}updateOuterDeco(t){if(lm(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=kI(this.dom,this.nodeDOM,ET(this.outerDeco,this.node,n),ET(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 jD(e,t,n,r,i){wI(r,t,e);let a=new Wa(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var om=class e extends Wa{constructor(t,n,r,i,a,o,s){super(t,n,r,i,a,null,o,s,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,i){return this.dirty==si||this.dirty!=kr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=kr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=kr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=si)}get domAtom(){return!1}isText(t){return this.node.text==t}},sm=class extends us{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==kr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},bT=class extends Wa{constructor(t,n,r,i,a,o,s,l,u,c){super(t,n,r,i,a,o,s,u,c),this.spec=l}update(t,n,r,i){if(this.dirty==si)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let a=this.spec.update(t,n,r);return a&&this.updateInner(t,n,r,i),a}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}};function vI(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a>1,s=Math.min(o,t.length);for(;a-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=jl.create(this.top,t[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,r,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(t,n,r))a=this.top.children.indexOf(o,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s0;){let s;for(;;)if(r){let u=n.children[r-1];if(u instanceof jl)n=u,r=u.children.length;else{s=u,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=s.node;if(l){if(l!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function PY(e,t){return e.type.side-t.type.side}function UY(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let u=0;ua;)s.push(i[o++]);let m=a+d.nodeSize;if(d.isText){let E=m;o!E.inline):s.slice();r(d,b,t.forChild(a,d),h),a=m}}function HY(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function zY(e,t,n,r){for(let i=0,a=0;i=n){if(a>=r&&l.slice(r-t.length-s,r-s)==t)return r-t.length;let u=s=0&&u+t.length+s>=n)return s+u;if(n==r&&l.length>=r+t.length-s&&l.slice(r-s,r-s+t.length)==t)return r}}return-1}function TT(e,t,n,r,i){let a=[];for(let o=0,s=0;o=n||c<=t?a.push(l):(un&&a.push(l.slice(n-u,l.size,r)))}return a}function RT(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),l,u;if(gm(n)){for(l=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&fe.isSelectable(f)&&i.parent&&!(f.isInline&&gY(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;u=new fe(o==d?s:r.resolve(d))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,d=o;for(let h=0;h{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!MI(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function qY(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,sn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Gn&&Xa<=11&&(n.disabled=!0,n.disabled=!1)}function OI(e,t){if(t instanceof fe){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(JD(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else JD(e)}function JD(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function DT(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||pe.between(t,n,r)}function eI(e){return e.editable&&!e.hasFocus()?!1:RI(e)}function RI(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function VY(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ls(t.node,t.offset,n.anchorNode,n.anchorOffset)}function ST(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&Ce.findFrom(a,t)}function ja(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function tI(e,t,n){let r=e.state.selection;if(r instanceof pe)if(n.indexOf("s")>-1){let{$head:i}=r,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return ja(e,new pe(r.$anchor,o))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=ST(e.state,t);return i&&i instanceof fe?ja(e,i):!1}else if(!(Cr&&n.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let s=t<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM?fe.isSelectable(a)?ja(e,new fe(t<0?e.state.doc.resolve(i.pos-a.nodeSize):i)):bf?ja(e,new pe(e.state.doc.resolve(t<0?s:s+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof fe&&r.node.isInline)return ja(e,new pe(t>0?r.$to:r.$from));{let i=ST(e.state,t);return i?ja(e,i):!1}}}function um(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ff(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Gl(e,t){return t<0?GY(e):YY(e)}function GY(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(vr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let s=n.childNodes[r-1];if(ff(s,-1))i=n,a=--r;else if(s.nodeType==3)n=s,r=n.nodeValue.length;else break}}else{if(DI(n))break;{let s=n.previousSibling;for(;s&&ff(s,-1);)i=n.parentNode,a=sn(s),s=s.previousSibling;if(s)n=s,r=um(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?_T(e,n,r):i&&_T(e,i,a)}function YY(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=um(n),a,o;for(;;)if(r{e.state==i&&Wi(e)},50)}function nI(e,t){let n=e.state.doc.resolve(t);if(!(Xt||TI)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let a=e.coordsAtPos(t-1),o=(a.top+a.bottom)/2;if(o>i.top&&o1)return a.lefti.top&&o1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function rI(e,t,n){let r=e.state.selection;if(r instanceof pe&&!r.empty||n.indexOf("s")>-1||Cr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=ST(e.state,t);if(o&&o instanceof fe)return ja(e,o)}if(!i.parent.inlineContent){let o=t<0?i:a,s=r instanceof Nn?Ce.near(o,t):Ce.findFrom(o,t);return s?ja(e,s):!1}return!1}function iI(e,t){if(!(e.state.selection instanceof pe))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=e.state.tr;return t<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),e.dispatch(o),!0}return!1}function aI(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function jY(e){if(!bn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;aI(e,r,"true"),setTimeout(()=>aI(e,r,"false"),20)}return!1}function XY(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function WY(e,t){let n=t.keyCode,r=XY(t);if(n==8||Cr&&n==72&&r=="c")return iI(e,-1)||Gl(e,-1);if(n==46&&!t.shiftKey||Cr&&n==68&&r=="c")return iI(e,1)||Gl(e,1);if(n==13||n==27)return!0;if(n==37||Cr&&n==66&&r=="c"){let i=n==37?nI(e,e.state.selection.from)=="ltr"?-1:1:-1;return tI(e,i,r)||Gl(e,i)}else if(n==39||Cr&&n==70&&r=="c"){let i=n==39?nI(e,e.state.selection.from)=="ltr"?1:-1:1;return tI(e,i,r)||Gl(e,i)}else{if(n==38||Cr&&n==80&&r=="c")return rI(e,-1,r)||Gl(e,-1);if(n==40||Cr&&n==78&&r=="c")return jY(e)||rI(e,1,r)||Gl(e,1);if(r==(Cr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function IT(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=e.someProp("clipboardSerializer")||qi.fromSchema(e.state.schema),s=HI(),l=s.createElement("div");l.appendChild(o.serializeFragment(r,{document:s}));let u=l.firstChild,c,f=0;for(;u&&u.nodeType==1&&(c=UI[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let m=s.createElement(c[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${a}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,` - -`);return{dom:l,text:d,slice:t}}function II(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",d=>{t=d(t,a||r,e)}),a)return s=new re(Q.from(e.state.schema.text(t.replace(/\r\n?/g,` -`))),0,0),e.someProp("transformPasted",d=>{s=d(s,e,!0)}),s;let f=e.someProp("clipboardTextParser",d=>d(t,i,r,e));if(f)s=f;else{let d=i.marks(),{schema:h}=e.state,m=qi.fromSchema(h);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(b=>{let E=o.appendChild(document.createElement("p"));b&&E.appendChild(m.serializeNode(h.text(b,d)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),o=eK(n),bf&&tK(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||ai.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!QY.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)s=nK(oI(s,+c[1],+c[2]),c[4]);else if(s=re.maxOpen(ZY(s.content,i),!0),s.openStart||s.openEnd){let f=0,d=0;for(let h=s.content.firstChild;f{s=f(s,e,l)}),s}var QY=/^(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 ZY(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),a,o=[];if(e.forEach(s=>{if(!o)return;let l=i.findWrapping(s.type),u;if(!l)return o=null;if(u=o.length&&a.length&&BI(l,a,s,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=PI(o[o.length-1],a.length));let c=LI(s,l);o.push(c),i=i.matchType(c.type),a=l}}),o)return Q.from(o)}return e}function LI(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Q.from(e));return e}function BI(e,t,n,r,i){if(i1&&(a=0),i=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function oI(e,t,n){return tn})),uT.createHTML(e)):e}function eK(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=HI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&UI[r[1].toLowerCase()])&&(e=i.map(a=>"<"+a+">").join("")+e+i.map(a=>"").reverse().join("")),n.innerHTML=JY(e),i)for(let a=0;a=0;s-=2){let l=n.nodes[r[s]];if(!l||l.hasRequiredAttrs())break;i=Q.from(l.create(r[s+1],i)),a++,o++}return new re(i,a,o)}var vn={},kn={},rK={touchstart:!0,touchmove:!0},AT=class{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function iK(e){for(let t in vn){let n=vn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{oK(e,r)&&!LT(e,r)&&(e.editable||!(r.type in kn))&&n(e,r)},rK[t]?{passive:!0}:void 0)}bn&&e.dom.addEventListener("input",()=>null),CT(e)}function Xi(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function aK(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function CT(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>LT(e,r))})}function LT(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function oK(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function sK(e,t){!LT(e,t)&&vn[t.type]&&(e.editable||!(t.type in kn))&&vn[t.type](e,t)}kn.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!qI(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ji&&Xt&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),$l&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,ts(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||WY(e,n)?n.preventDefault():Xi(e,"key")};kn.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};kn.keypress=(e,t)=>{let n=t;if(qI(e)||!n.charCode||n.ctrlKey&&!n.altKey||Cr&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof pe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),a=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,i,a))&&e.dispatch(a()),n.preventDefault()}};function Ef(e){return{left:e.clientX,top:e.clientY}}function lK(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function BT(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(e.someProp(t,s=>o>a.depth?s(e,n,a.nodeAfter,a.before(o),i,!0):s(e,n,a.node(o),a.before(o),i,!1)))return!0;return!1}function yf(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n=="pointer"&&r.setMeta("pointer",!0),e.dispatch(r)}function uK(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&fe.isSelectable(r)?(yf(e,new fe(n),"pointer"),!0):!1}function cK(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof fe&&(r=n.node);let a=e.state.doc.resolve(t);for(let o=a.depth+1;o>0;o--){let s=o>a.depth?a.nodeAfter:a.node(o);if(fe.isSelectable(s)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?i=a.before(n.$from.depth):i=a.before(o);break}}return i!=null?(yf(e,fe.create(e.state.doc,i),"pointer"),!0):!1}function fK(e,t,n,r,i){return BT(e,"handleClickOn",t,n,r)||e.someProp("handleClick",a=>a(e,t,r))||(i?cK(e,n):uK(e,n))}function dK(e,t,n,r){return BT(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function hK(e,t,n,r){return BT(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||pK(e,n,r)}function pK(e,t,n){if(n.button!=0)return!1;let r=zI(e,t,!0),i=e.state.doc;return r?(yf(e,r,"pointer"),r instanceof pe&&i.eq(e.state.doc)&&(e.input.mouseDown=new vT(e,r)),!0):!1}function zI(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?pe.create(r,0,r.content.size):null;let i=r.resolve(t);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),s=i.before(a);if(o.inlineContent)return pe.create(r,s+1,s+1+o.content.size);if(n&&fe.isSelectable(o))return fe.create(r,s)}return null}function PT(e){return fm(e)}var FI=Cr?"metaKey":"ctrlKey";vn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=PT(e),i=Date.now(),a="singleClick";i-e.input.lastClick.time<500&&lK(n,e.input.lastClick)&&!n[FI]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?a="doubleClick":e.input.lastClick.type=="doubleClick"&&(a="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Ef(n));o&&(a=="singleClick"?e.input.mouseDown=new NT(e,o,n,!!r):(a=="doubleClick"?dK:hK)(e,o.pos,o.inside,n)?n.preventDefault():Xi(e,"pointer"))};var cm=class{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},NT=class extends cm{constructor(t,n,r,i){super(t),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[FI],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=t.state.doc.nodeAt(n.inside),o=n.inside;else{let c=t.state.doc.resolve(n.pos);a=c.parent,o=c.depth?c.before():0}let s=i?null:r.target,l=s?t.docView.nearestDesc(s,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=t.state;r.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof fe&&u.from<=o&&u.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&vr&&!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()),Xi(t,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||Wi(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ef(t))),this.updateAllowDefault(t),this.allowDefault||!n?Xi(this.view,"pointer"):fK(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||bn&&this.mightDrag&&!this.mightDrag.node.isAtom||Xt&&!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)?(yf(this.view,Ce.near(this.view.state.doc.resolve(n.pos)),"pointer"),t.preventDefault()):Xi(this.view,"pointer")}move(t){this.updateAllowDefault(t),Xi(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},vT=class extends cm{constructor(t,n){super(t),this.startSelection=n,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),Xi(this.view,"pointer");let n=this.view.posAtCoords(Ef(t)),r=n&&zI(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,a=this.startSelection,[o,s]=r.from{e.input.lastTouch=Date.now(),PT(e),Xi(e,"pointer")};vn.touchmove=e=>{e.input.lastTouch=Date.now(),Xi(e,"pointer")};vn.contextmenu=e=>PT(e);function qI(e,t){return e.composing?!0:bn&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var mK=ji?5e3:-1;kn.compositionstart=kn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof pe&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Xt&&TI&&gK(e)))e.markCursor=e.state.storedMarks||n.marks(),fm(e,!0),e.markCursor=null;else if(fm(e,!t.selection.empty),vr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let s=e.domSelection();s&&s.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}e.input.composing=!0}VI(e,mK)};function gK(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}kn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,VI(e,20))};function VI(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>fm(e),t))}function GI(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function bK(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=pY(t.focusNode,t.focusOffset),r=mY(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,a=e.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function fm(e,t=!1){if(!(ji&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),GI(e),t||e.docView&&e.docView.dirty){let n=RT(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function EK(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var df=Gn&&Xa<15||$l&&yY<604;vn.copy=kn.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let a=df?null:n.clipboardData,o=r.content(),{dom:s,text:l}=IT(e,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",l)):EK(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function yK(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function TK(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.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=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?hf(e,r.value,null,i,t):hf(e,r.textContent,r.innerHTML,i,t)},50)}function hf(e,t,n,r,i){let a=II(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,i,a||re.empty)))return!0;if(!a)return!1;let o=yK(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function YI(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kn.paste=(e,t)=>{let n=t;if(e.composing&&!ji)return;let r=df?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&hf(e,YI(r),r.getData("text/html"),i,n)?n.preventDefault():TK(e,n)};var dm=class{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}},SK=Cr?"altKey":"ctrlKey";function KI(e,t){let n;return e.someProp("dragCopies",r=>{n=n||r(t)}),n!=null?!n:!t[SK]}vn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Ef(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof fe?i.to-1:i.to))){if(r&&r.mightDrag)o=fe.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=e.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(o=fe.create(e.state.doc,f.posBefore))}}let s=(o||e.state.selection).content(),{dom:l,text:u,slice:c}=IT(e,s);(!n.dataTransfer.files.length||!Xt||yI>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(df?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",df||n.dataTransfer.setData("text/plain",u),e.dragging=new dm(c,KI(e,n),o)};vn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};kn.dragover=kn.dragenter=(e,t)=>t.preventDefault();kn.drop=(e,t)=>{try{_K(e,t,e.dragging)}finally{e.dragging=null}};function _K(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ef(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp("transformPasted",h=>{a=h(a,e,!1)}):a=II(e,YI(t.dataTransfer),df?null:t.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&KI(e,t));if(e.someProp("handleDrop",h=>h(e,t,a||re.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?cD(e.state.doc,i.pos,a):i.pos;s==null&&(s=i.pos);let l=e.state.tr;if(o){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let u=l.mapping.map(s),c=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,f=l.doc;if(c?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(f))return;let d=l.doc.resolve(u);if(c&&fe.isSelectable(a.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new fe(d));else{let h=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((m,b,E,g)=>h=g),l.setSelection(DT(e,d,l.doc.resolve(h)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}vn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Wi(e)},20))};vn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};vn.beforeinput=(e,t)=>{if(Xt&&ji&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",a=>a(e,ts(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in kn)vn[e]=kn[e];function pf(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var hm=class e{constructor(t,n){this.toDOM=t,this.spec=n||as,this.side=this.spec.side||0}map(t,n,r,i){let{pos:a,deleted:o}=t.mapResult(n.from+i,this.side<0?-1:1);return o?null:new li(a-r,a-r,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&pf(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}},is=class e{constructor(t,n){this.attrs=t,this.spec=n||as}map(t,n,r,i){let a=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new li(a,o,this)}valid(t,n){return n.from=t&&(!a||a(s.spec))&&r.push(s.copy(s.from+i,s.to+i))}for(let o=0;ot){let s=this.children[o]+1;this.children[o+2].findInner(t-s,n-s,r,i+s,a)}}map(t,n,r){return this==gn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||as)}mapInner(t,n,r,i,a){let o;for(let s=0;s{let u=l+r,c;if(c=jI(n,s,u)){for(i||(i=this.children.slice());as&&f.to=t){this.children[s]==t&&(r=this.children[s+2]);break}let a=t+1,o=a+n.content.size;for(let s=0;sa&&l.type instanceof is){let u=Math.max(a,l.from)-a,c=Math.min(o,l.to)-a;ui.map(t,n,as));return e.from(r)}forChild(t,n){if(n.isLeaf)return Yn.empty;let r=[];for(let i=0;in instanceof Yn)?t:t.reduce((n,r)=>n.concat(r instanceof Yn?r:r.members),[]))}}forEachSet(t){for(let n=0;n{let E=b-m-(h-d);for(let g=0;gy+c-f)continue;let T=s[g]+c-f;h>=T?s[g+1]=d<=T?-2:-1:d>=c&&E&&(s[g]+=E,s[g+1]+=E)}f+=E}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u=r.content.size){l=!0;continue}let d=n.map(e[u+1]+a,-1),h=d-i,{index:m,offset:b}=r.content.findIndex(f),E=r.maybeChild(m);if(E&&b==f&&b+E.nodeSize==h){let g=s[u+2].mapInner(n,E,c+1,e[u]+a+1,o);g!=gn?(s[u]=f,s[u+1]=h,s[u+2]=g):(s[u+1]=-2,l=!0)}else l=!0}if(l){let u=AK(s,e,t,n,i,a,o),c=mm(u,r,0,o);t=c.local;for(let f=0;fn&&o.to{let u=jI(e,s,l+n);if(u){a=!0;let c=mm(u,s,n+l+1,r);c!=gn&&i.push(l,l+s.nodeSize,c)}});let o=$I(a?XI(e):e,-n).sort(ss);for(let s=0;s0;)t++;e.splice(t,0,n)}function cT(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=gn&&t.push(r)}),e.cursorWrapper&&t.push(Yn.create(e.state.doc,[e.cursorWrapper.deco])),pm.from(t)}var CK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},NK=Gn&&Xa<=11,wT=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}},MT=class{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wT,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():bn&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),NK&&(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,CK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;nthis.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(eI(this.view)){if(this.suppressingSelectionUpdates)return Wi(this.view);if(Gn&&Xa<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ls(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let a=t.focusNode;a;a=Kl(a))n.add(a);for(let a=t.anchorNode;a;a=Kl(a))if(n.has(a)){r=a;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 t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&eI(t)&&!this.ignoreSelectionChange(r),a=-1,o=-1,s=!1,l=[];if(t.editable)for(let c=0;cc.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Xt&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(c=>c.type=="childList"&&c.removedNodes.length))){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let f=c.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){c.parentNode.removeChild(c);break}f=f.firstChild}}}else if(vr&&l.length){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,d]=c;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of c){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||wK(t,f)!=h)&&d.remove()}}}let u=null;a<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(a>-1&&(t.docView.markDirty(a,o),vK(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,MK(t,l)),this.handleDOMChange(a,o,s,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Wi(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let c=0;ci;E--){let g=r.childNodes[E-1],y=g.pmViewDesc;if(g.nodeName=="BR"&&!y){a=E;break}if(!y||y.size)break}let f=e.state.doc,d=e.someProp("domParser")||ai.fromSchema(e.state.schema),h=f.resolve(o),m=null,b=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:a,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:RK,context:h});if(u&&u[0].pos!=null){let E=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=E),m={anchor:E+o,head:g+o}}return{doc:b,sel:m,from:o,to:s}}function RK(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(bn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||bn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var DK=/^(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 IK(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let M=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,R=RT(e,M);if(R&&!e.state.selection.eq(R)){if(Xt&&ji&&e.input.lastKeyCode===13&&Date.now()-100A(e,ts(13,"Enter"))))return;let L=e.state.tr.setSelection(R);M=="pointer"?L.setMeta("pointer",!0):M=="key"&&L.scrollIntoView(),a&&L.setMeta("composition",a),e.dispatch(L)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let l=e.state.selection,u=OK(e,t,n),c=e.state.doc,f=c.slice(u.from,u.to),d,h;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ji)&&i.some(M=>M.nodeType==1&&!DK.test(M.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",M=>M(e,ts(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof pe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let M=dI(e,e.state.doc,u.sel);if(M&&!M.eq(e.state.selection)){let R=e.state.tr.setSelection(M);a&&R.setMeta("composition",a),e.dispatch(R)}}return}e.state.selection.frome.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Gn&&Xa<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" \xA0"&&(m.start--,m.endA--,m.endB--);let b=u.doc.resolveNoCache(m.start-u.from),E=u.doc.resolveNoCache(m.endB-u.from),g=c.resolve(m.start),y=b.sameParent(E)&&b.parent.inlineContent&&g.end()>=m.endA;if(($l&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!y&&b.posM(e,ts(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&BK(c,m.start,m.endA,b,E)&&e.someProp("handleKeyDown",M=>M(e,ts(8,"Backspace")))){ji&&Xt&&e.domObserver.suppressSelectionUpdates();return}Xt&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),ji&&!y&&b.start()!=E.start()&&E.parentOffset==0&&b.depth==E.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,E=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(M){return M(e,ts(13,"Enter"))})},20));let T=m.start,S=m.endA,v=M=>{let R=M||e.state.tr.replace(T,S,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let L=dI(e,R.doc,u.sel);L&&!(Xt&&e.composing&&L.empty&&(m.start!=m.endB||e.input.lastChromeDeleteWi(e),20));let M=v(e.state.tr.delete(T,S)),R=c.resolve(m.start).marksAcross(c.resolve(m.endA));R&&M.ensureMarks(R),e.dispatch(M)}else if(m.endA==m.endB&&(x=LK(b.parent.content.cut(b.parentOffset,E.parentOffset),g.parent.content.cut(g.parentOffset,m.endA-g.start())))){let M=v(e.state.tr);x.type=="add"?M.addMark(T,S,x.mark):M.removeMark(T,S,x.mark),e.dispatch(M)}else if(b.parent.child(b.index()).isText&&b.index()==E.index()-(E.textOffset?0:1)){let M=b.parent.textBetween(b.parentOffset,E.parentOffset),R=()=>v(e.state.tr.insertText(M,T,S));e.someProp("handleTextInput",L=>L(e,T,S,M,R))||e.dispatch(R())}else e.dispatch(v());else e.dispatch(v())}function dI(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:DT(e,t.resolve(n.anchor),t.resolve(n.head))}function LK(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,l;for(let c=0;cc.mark(s.addToSet(c.marks));else if(i.length==0&&a.length==1)s=a[0],o="remove",l=c=>c.mark(s.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||fT(o,!0,!1)0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let a=e.node(r).maybeChild(e.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function PK(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:l,b:u}=e.findDiffEnd(t,o,s);if(i=="end"){let c=Math.max(0,a-Math.min(l,u));r-=l+c-a}if(l=l?a-r:0;a-=c,u=a+(u-l),l=a}else if(u=u?a-r:0;a-=c,l=a+(l-u),u=a}return{start:a,endA:l,endB:u}}var mf=class{constructor(t,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 AT,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(bI),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=mI(this),pI(this),this.nodeViews=gI(this),this.docView=jD(this.state.doc,hI(this),cT(this),this.dom,this),this.domObserver=new MT(this,(r,i,a,o)=>IK(this,r,i,a,o)),this.domObserver.start(),iK(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&CT(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(bI),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let i=this.state,a=!1,o=!1;t.storedMarks&&this.composing&&(GI(this),o=!0),this.state=t;let s=i.plugins!=t.plugins||this._props.plugins!=n.plugins;if(s||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=gI(this);HK(h,this.nodeViews)&&(this.nodeViews=h,a=!0)}(s||n.handleDOMEvents!=this._props.handleDOMEvents)&&CT(this),this.editable=mI(this),pI(this);let l=cT(this),u=hI(this),c=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=a||!this.docView.matchesNode(t.doc,u,l);(f||!t.selection.eq(i.selection))&&(o=!0);let d=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&_Y(this);if(o){this.domObserver.stop();let h=f&&(Gn||Xt)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&UK(i.selection,t.selection);if(f){let b=Xt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=bK(this)),(a||!this.docView.update(t.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=jD(t.doc,u,l,this.dom,this)),b&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let m=this.input.mouseDown;h||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&VY(this)&&m.delaySelUpdate())?Wi(this,h):(OI(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&xY(d)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof fe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&qD(this,n.getBoundingClientRect(),t)}else qD(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&an.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return wY(this,t)}coordsAtPos(t,n=1){return CI(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let i=this.docView.posFromDOM(t,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return IY(this,n||this.state,t)}pasteHTML(t,n){return hf(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return hf(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return IT(this,t)}destroy(){this.docView&&(aK(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cT(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,dY())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return sK(this,t)}domSelectionRange(){let t=this.domSelection();return t?bn&&this.root.nodeType===11&&bY(this.dom.ownerDocument)==this.dom&&kK(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};mf.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function hI(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[li.node(0,e.state.doc.content.size,t)]}function pI(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:li.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function mI(e){return!e.someProp("editable",t=>t(e.state)===!1)}function UK(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function gI(e){let t=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function HK(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r}function bI(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Qi={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:"'"},Em={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},zK=typeof navigator<"u"&&/Mac/.test(navigator.platform),FK=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Lt=0;Lt<10;Lt++)Qi[48+Lt]=Qi[96+Lt]=String(Lt);var Lt;for(Lt=1;Lt<=24;Lt++)Qi[Lt+111]="F"+Lt;var Lt;for(Lt=65;Lt<=90;Lt++)Qi[Lt]=String.fromCharCode(Lt+32),Em[Lt]=String.fromCharCode(Lt);var Lt;for(bm in Qi)Em.hasOwnProperty(bm)||(Em[bm]=Qi[bm]);var bm;function WI(e){var t=zK&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||FK&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Em:Qi)[e.keyCode]||e.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}var qK=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),VK=typeof navigator<"u"&&/Win/.test(navigator.platform);function GK(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,i,a,o;for(let s=0;s{for(var n in t)$K(e,n,{get:t[n],enumerable:!0})};function vm(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var km=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([o,s])=>[o,(...u)=>{let c=s(...u)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,l=e||i.tr,u=()=>(!s&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),o.every(f=>f===!0)),c={...Object.fromEntries(Object.entries(n).map(([f,d])=>[f,(...m)=>{let b=this.buildProps(l,t),E=d(...m)(b);return o.push(E),c}])),run:u};return c}createCan(e){let{rawCommands:t,state:n}=this,r=!1,i=e||n.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...u)=>l(...u)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:vm({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...u)=>l(...u)(o)]))}};return o}},l3={};YT(l3,{blur:()=>jK,clearContent:()=>XK,clearNodes:()=>WK,command:()=>QK,createParagraphNear:()=>ZK,cut:()=>JK,deleteCurrentNode:()=>e$,deleteNode:()=>t$,deleteRange:()=>n$,deleteSelection:()=>a$,enter:()=>o$,exitCode:()=>s$,extendMarkRange:()=>l$,first:()=>u$,focus:()=>f$,forEach:()=>d$,insertContent:()=>h$,insertContentAt:()=>g$,joinBackward:()=>y$,joinDown:()=>E$,joinForward:()=>T$,joinItemBackward:()=>S$,joinItemForward:()=>_$,joinTextblockBackward:()=>x$,joinTextblockForward:()=>A$,joinUp:()=>b$,keyboardShortcut:()=>N$,lift:()=>v$,liftEmptyBlock:()=>k$,liftListItem:()=>w$,newlineInCode:()=>M$,resetAttributes:()=>O$,scrollIntoView:()=>R$,selectAll:()=>D$,selectNodeBackward:()=>I$,selectNodeForward:()=>L$,selectParentNode:()=>B$,selectTextblockEnd:()=>P$,selectTextblockStart:()=>U$,setContent:()=>H$,setMark:()=>aj,setMeta:()=>oj,setNode:()=>sj,setNodeSelection:()=>lj,setTextDirection:()=>uj,setTextSelection:()=>cj,sinkListItem:()=>fj,splitBlock:()=>dj,splitListItem:()=>hj,toggleList:()=>mj,toggleMark:()=>gj,toggleNode:()=>bj,toggleWrap:()=>Ej,undoInputRule:()=>yj,unsetAllMarks:()=>Tj,unsetMark:()=>Sj,unsetTextDirection:()=>_j,updateAttributes:()=>xj,wrapIn:()=>Aj,wrapInList:()=>Cj});var jK=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),XK=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),WK=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:a,$to:o})=>{e.doc.nodesBetween(a.pos,o.pos,(s,l)=>{if(s.type.isText)return;let{doc:u,mapping:c}=t,f=u.resolve(c.map(l)),d=u.resolve(c.map(l+s.nodeSize)),h=f.blockRange(d);if(!h)return;let m=Yi(h);if(s.type.isTextblock){let{defaultType:b}=f.parent.contentMatchAt(f.index());t.setNodeMarkup(h.start,b)}(m||m===0)&&t.lift(h,m)})}),!0},QK=e=>t=>e(t),ZK=()=>({state:e,dispatch:t})=>tT(e,t),JK=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new pe(r.doc.resolve(Math.max(o-1,0)))),!0},e$=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(t){let s=i.before(a),l=i.after(a);e.delete(s,l).scrollIntoView()}return!0}return!1};function Wt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var t$=e=>({tr:t,state:n,dispatch:r})=>{let i=Wt(e,n.schema),a=t.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===i){if(r){let l=a.before(o),u=a.after(o);t.delete(l,u).scrollIntoView()}return!0}return!1},n$=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},r$=e=>e.content?/^text(\*|\+)/.test(e.content):!1,ZI=(e,t,n)=>{if(!e.parent.isInline||n==="left"&&e.pos>e.start()||n==="right"&&e.pos{let r=ZI(e,n,"left"),i=ZI(t,n,"right");return{from:r,to:i}},a$=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:a}=i$(n,r,e.schema);return t&&(e.tr.deleteRange(i,a).scrollIntoView(),t(e.tr)),!0},o$=()=>({commands:e})=>e.keyboardShortcut("Enter"),s$=()=>({state:e,dispatch:t})=>eT(e,t);function KT(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Am(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:KT(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function u3(e,t,n={}){return e.find(r=>r.type===t&&Am(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function JI(e,t,n={}){return!!u3(e,t,n)}function c3(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===t))return;if(!n){let u=r.node.marks.find(c=>c.type===t);u&&(n=u.attrs)}if(!u3([...r.node.marks],t,n))return;let a=r.index,o=e.start()+r.offset,s=a+1,l=o+r.node.nodeSize;for(;a>0&&JI([...e.parent.child(a-1).marks],t,n);)a-=1,o-=e.parent.child(a).nodeSize;for(;s({tr:n,state:r,dispatch:i})=>{let a=Zi(e,r.schema),{doc:o,selection:s}=n,{$from:l,from:u,to:c}=s;if(i){let f=c3(l,a,t);if(f&&f.from<=u&&f.to>=c){let d=pe.create(o,f.from,f.to);n.setSelection(d)}}return!0},u$=e=>t=>{let n=typeof e=="function"?e(t):e;for(let r=0;r({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Cm()||e3())&&r.dom.focus(),c$()&&!Cm()&&!e3()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!f3(n.state.selection))return o(),!0;let s=d3(i.doc,e)||n.state.selection,l=n.state.selection.eq(s);return a&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},d$=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),h$=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),h3=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&h3(r)}return e};function ym(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return h3(n)}function xf(e,t,n){if(e instanceof Vn||e instanceof Q)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e=="object"&&e!==null,i=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return Q.fromArray(e.map(s=>t.nodeFromJSON(s)));let o=t.nodeFromJSON(e);return n.errorOnInvalidContent&&o.check(),o}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",a),xf("",t,n)}if(i){if(n.errorOnInvalidContent){let o=!1,s="",l=new Pl({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,s=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?ai.fromSchema(l).parseSlice(ym(e),n.parseOptions):ai.fromSchema(l).parse(ym(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}let a=ai.fromSchema(t);return n.slice?a.parseSlice(ym(e),n.parseOptions).content:a.parse(ym(e),n.parseOptions)}return xf("",t,n)}function p$(e,t,n){let r=e.steps.length-1;if(r{o===0&&(o=c)}),e.setSelection(Ce.near(e.doc.resolve(o),n))}var m$=e=>!("type"in e),g$=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{var o;if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s,l=E=>{a.emit("contentError",{editor:a,error:E,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xf(t,a.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(E){l(E)}try{s=xf(t,a.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(E){return l(E),!1}let{from:c,to:f}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},d=!0,h=!0;if((m$(s)?s:[s]).forEach(E=>{E.check(),d=d?E.isText&&E.marks.length===0:!1,h=h?E.isBlock:!1}),c===f&&h){let{parent:E}=r.doc.resolve(c);E.isTextblock&&!E.type.spec.code&&!E.childCount&&(c-=1,f+=1)}let b;if(d){if(Array.isArray(t))b=t.map(E=>E.text||"").join("");else if(t instanceof Q){let E="";t.forEach(g=>{g.text&&(E+=g.text)}),b=E}else typeof t=="object"&&t&&t.text?b=t.text:b=t;r.insertText(b,c,f)}else{b=s;let E=r.doc.resolve(c),g=E.node(),y=E.parentOffset===0,T=g.isText||g.isTextblock,S=g.content.size>0;y&&T&&S&&h&&(c=Math.max(0,c-1)),r.replaceWith(c,f,b)}n.updateSelection&&p$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:b}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:b})}return!0},b$=()=>({state:e,dispatch:t})=>MD(e,t),E$=()=>({state:e,dispatch:t})=>OD(e,t),y$=()=>({state:e,dispatch:t})=>K1(e,t),T$=()=>({state:e,dispatch:t})=>X1(e,t),S$=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Jo(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},_$=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Jo(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},x$=()=>({state:e,dispatch:t})=>ND(e,t),A$=()=>({state:e,dispatch:t})=>vD(e,t);function p3(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function C$(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==="Space"&&(n=" ");let r,i,a,o;for(let s=0;s({editor:t,view:n,tr:r,dispatch:i})=>{let a=C$(e).split(/-(?!$)/),o=a.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),s=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,s))});return l?.steps.forEach(u=>{let c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function Af(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?Wt(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;let h=Math.max(r,d),m=Math.min(i,d+f.nodeSize);s.push({node:f,from:h,to:m})});let l=i-r,u=s.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Am(f.node.attrs,n,{strict:!1}));return a?!!u.length:u.reduce((f,d)=>f+d.to-d.from,0)>=l}var v$=(e,t={})=>({state:n,dispatch:r})=>{let i=Wt(e,n.schema);return Af(n,i,t)?RD(n,r):!1},k$=()=>({state:e,dispatch:t})=>nT(e,t),w$=e=>({state:t,dispatch:n})=>{let r=Wt(e,t.schema);return UD(r)(t,n)},M$=()=>({state:e,dispatch:t})=>Z1(e,t);function wm(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function t3(e,t){let n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}var O$=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=wm(typeof e=="string"?e:e.name,r.schema);if(!s)return!1;s==="node"&&(a=Wt(e,r.schema)),s==="mark"&&(o=Zi(e,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,f)=>{a&&a===c.type&&(l=!0,i&&n.setNodeMarkup(f,void 0,t3(c.attrs,t))),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&(l=!0,i&&n.addMark(f,f+c.nodeSize,o.create(t3(d.attrs,t))))})})}),l},R$=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),D$=()=>({tr:e,dispatch:t})=>{if(t){let n=new Nn(e.doc);e.setSelection(n)}return!0},I$=()=>({state:e,dispatch:t})=>$1(e,t),L$=()=>({state:e,dispatch:t})=>W1(e,t),B$=()=>({state:e,dispatch:t})=>DD(e,t),P$=()=>({state:e,dispatch:t})=>iT(e,t),U$=()=>({state:e,dispatch:t})=>rT(e,t);function VT(e,t,n={},r={}){return xf(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var H$=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:l}=a;if(r.preserveWhitespace!=="full"){let u=VT(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!n),!0}return o&&a.setMeta("preventUpdate",!n),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function m3(e,t){let n=Zi(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});let s=o.find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function z$(e,t){let n=new zl(e);return t.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function F$(e){for(let t=0;t0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function $T(e){return t=>q$(t.$from,e)}function le(e,t,n){return e.config[t]===void 0&&e.parent?le(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?le(e.parent,t,n):null}):e.config[t]}function jT(e){return e.map(t=>{let n={name:t.name,options:t.options,storage:t.storage},r=le(t,"addExtensions",n);return r?[t,...jT(r())]:t}).flat(10)}function XT(e,t){let n=qi.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function g3(e){return typeof e=="function"}function dt(e,t=void 0,...n){return g3(e)?t?e.bind(t)(...n):e(...n):e}function V$(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Xl(e){let t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),r=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function b3(e){let t=[],{nodeExtensions:n,markExtensions:r}=Xl(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),s=r.map(u=>u.name),l=[...o,...s];return e.forEach(u=>{let c={name:u.name,options:u.options,storage:u.storage,extensions:i},f=le(u,"addGlobalAttributes",c);if(!f)return;f().forEach(h=>{let m;Array.isArray(h.types)?m=h.types:h.types==="*"?m=l:h.types==="nodes"?m=o:h.types==="marks"?m=s:m=[],m.forEach(b=>{Object.entries(h.attributes).forEach(([E,g])=>{t.push({type:b,name:E,attribute:{...a,...g}})})})})}),i.forEach(u=>{let c={name:u.name,options:u.options,storage:u.storage},f=le(u,"addAttributes",c);if(!f)return;let d=f();Object.entries(d).forEach(([h,m])=>{let b={...a,...m};typeof b?.default=="function"&&(b.default=b.default()),b?.isRequired&&b?.default===void 0&&delete b.default,t.push({type:u.name,name:h,attribute:b})})}),t}function G$(e){let t=[],n="",r=!1,i=!1,a=0,o=e.length;for(let s=0;s0){a-=1,n+=l;continue}if(l===";"&&a===0){t.push(n),n="";continue}}n+=l}return n&&t.push(n),t}function n3(e){let t=[],n=G$(e||""),r=n.length;for(let i=0;i!!t).reduce((t,n)=>{let r={...t};return Object.entries(n).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){let s=a?String(a).split(" "):[],l=r[i]?r[i].split(" "):[],u=s.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){let s=new Map([...n3(r[i]),...n3(a)]);r[i]=Array.from(s.entries()).map(([l,u])=>`${l}: ${u}`).join("; ")}else r[i]=a}),r},{})}function Nm(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Cf(n,r),{})}function Y$(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function r3(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((a,o)=>{let s=o.attribute.parseHTML?o.attribute.parseHTML(n):Y$(n.getAttribute(o.name));return s==null?a:{...a,[o.name]:s}},{});return{...r,...i}}}}function i3(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&V$(n)?!1:n!=null))}function a3(e){var t,n;let r={};return!((t=e?.attribute)!=null&&t.isRequired)&&"default"in(e?.attribute||{})&&(r.default=e.attribute.default),((n=e?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function K$(e,t){var n;let r=b3(e),{nodeExtensions:i,markExtensions:a}=Xl(e),o=(n=i.find(u=>le(u,"topNode")))==null?void 0:n.name,s=Object.fromEntries(i.map(u=>{let c=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:t},d=e.reduce((g,y)=>{let T=le(y,"extendNodeSchema",f);return{...g,...T?T(u):{}}},{}),h=i3({...d,content:dt(le(u,"content",f)),marks:dt(le(u,"marks",f)),group:dt(le(u,"group",f)),inline:dt(le(u,"inline",f)),atom:dt(le(u,"atom",f)),selectable:dt(le(u,"selectable",f)),draggable:dt(le(u,"draggable",f)),code:dt(le(u,"code",f)),whitespace:dt(le(u,"whitespace",f)),linebreakReplacement:dt(le(u,"linebreakReplacement",f)),defining:dt(le(u,"defining",f)),isolating:dt(le(u,"isolating",f)),attrs:Object.fromEntries(c.map(a3))}),m=dt(le(u,"parseHTML",f));m&&(h.parseDOM=m.map(g=>r3(g,c)));let b=le(u,"renderHTML",f);b&&(h.toDOM=g=>b({node:g,HTMLAttributes:Nm(g,c)}));let E=le(u,"renderText",f);return E&&(h.toText=E),[u.name,h]})),l=Object.fromEntries(a.map(u=>{let c=r.filter(E=>E.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:t},d=e.reduce((E,g)=>{let y=le(g,"extendMarkSchema",f);return{...E,...y?y(u):{}}},{}),h=i3({...d,inclusive:dt(le(u,"inclusive",f)),excludes:dt(le(u,"excludes",f)),group:dt(le(u,"group",f)),spanning:dt(le(u,"spanning",f)),code:dt(le(u,"code",f)),attrs:Object.fromEntries(c.map(a3))}),m=dt(le(u,"parseHTML",f));m&&(h.parseDOM=m.map(E=>r3(E,c)));let b=le(u,"renderHTML",f);return b&&(h.toDOM=E=>b({mark:E,HTMLAttributes:Nm(E,c)})),[u.name,h]}));return new Pl({topNode:o,nodes:s,marks:l})}function $$(e){let t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function _f(e){return e.sort((n,r)=>{let i=le(n,"priority")||100,a=le(r,"priority")||100;return i>a?-1:ir.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function y3(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=` - -`,textSerializers:o={}}=n||{},s="";return e.nodesBetween(r,i,(l,u,c,f)=>{var d;l.isBlock&&u>r&&(s+=a);let h=o?.[l.type.name];if(h)return c&&(s+=h({node:l,pos:u,parent:c,index:f,range:t})),!1;l.isText&&(s+=(d=l?.text)==null?void 0:d.slice(Math.max(r,u)-u,i-u))}),s}function j$(e,t){let n={from:0,to:e.content.size};return y3(e,n,t)}function T3(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function X$(e,t){let n=Wt(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,s=>{a.push(s)});let o=a.reverse().find(s=>s.type.name===n.name);return o?{...o.attrs}:{}}function W$(e,t){let n=wm(typeof t=="string"?t:t.name,e.schema);return n==="node"?X$(e,t):n==="mark"?m3(e,t):{}}function Q$(e,t=JSON.stringify){let n={};return e.filter(r=>{let i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function Z$(e){let t=Q$(e);return t.length===1?t:t.filter((n,r)=>!t.filter((a,o)=>o!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function J$(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((i,a)=>{let o=[];if(i.ranges.length)i.forEach((s,l)=>{o.push({from:s,to:l})});else{let{from:s,to:l}=n[a];if(s===void 0||l===void 0)return;o.push({from:s,to:l})}o.forEach(({from:s,to:l})=>{let u=t.slice(a).map(s,-1),c=t.slice(a).map(l),f=t.invert().map(u,-1),d=t.invert().map(c);r.push({oldRange:{from:f,to:d},newRange:{from:u,to:c}})})}),Z$(r)}function Tf(e,t){return t.nodes[e]||t.marks[e]||null}function xm(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let i=e.find(a=>a.type===t&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var ej=(e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,a,o,s)=>{var l,u;let c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:a,parent:o,index:s}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-a))}),n};function GT(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Zi(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(f=>a?a.name===f.type.name:!0).find(f=>Am(f.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:f,$to:d})=>{let h=f.pos,m=d.pos;e.doc.nodesBetween(h,m,(b,E)=>{if(a&&b.inlineContent&&!b.type.allowsMarkType(a))return!1;if(!b.isText&&!b.marks.length)return;let g=Math.max(h,E),y=Math.min(m,E+b.nodeSize),T=y-g;o+=T,s.push(...b.marks.map(S=>({mark:S,from:g,to:y})))})}),o===0)return!1;let l=s.filter(f=>a?a.name===f.mark.type.name:!0).filter(f=>Am(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),u=s.filter(f=>a?f.mark.type!==a&&f.mark.type.excludes(a):!0).reduce((f,d)=>f+d.to-d.from,0);return(l>0?l+u:l)>=o}function tj(e,t,n={}){if(!t)return Af(e,null,n)||GT(e,null,n);let r=wm(t,e.schema);return r==="node"?Af(e,t,n):r==="mark"?GT(e,t,n):!1}function o3(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function zT(e,t){let{nodeExtensions:n}=Xl(t),r=n.find(o=>o.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},a=dt(le(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function WT(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return!/\S/.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(a=>{i!==!1&&(WT(a,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}var S3=class _3{constructor(t){this.position=t}static fromJSON(t){return new _3(t.position)}toJSON(){return{position:this.position}}};function nj(e,t){let n=t.mapping.mapResult(e.position);return{position:new S3(n.pos),mapResult:n}}function rj(e){return new S3(e)}function ij(e,t,n){var r;let{selection:i}=t,a=null;if(f3(i)&&(a=i.$cursor),a){let s=(r=e.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(s)||!s.some(u=>u.type.excludes(n)))}let{ranges:o}=i;return o.some(({$from:s,$to:l})=>{let u=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(s.pos,l.pos,(c,f,d)=>{if(u)return!1;if(c.isInline){let h=!d||d.type.allowsMarkType(n),m=!!n.isInSet(c.marks)||!c.marks.some(b=>b.type.excludes(n));u=h&&m}return!u}),u})}var aj=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,l=Zi(e,r.schema);if(i)if(o){let u=m3(r,l);n.addStoredMark(l.create({...u,...t}))}else s.forEach(u=>{let c=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(c,f,(d,h)=>{let m=Math.max(h,c),b=Math.min(h+d.nodeSize,f);d.marks.find(g=>g.type===l)?d.marks.forEach(g=>{l===g.type&&n.addMark(m,b,l.create({...g.attrs,...t}))}):n.addMark(m,b,l.create(t))})});return ij(r,n,l)},oj=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),sj=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=Wt(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:s})=>aT(a,{...o,...t})(n)?!0:s.clearNodes()).command(({state:s})=>aT(a,{...o,...t})(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},lj=e=>({tr:t,dispatch:n})=>{if(n){let{doc:r}=t,i=cs(e,0,r.content.size),a=fe.create(r,i);t.setSelection(a)}return!0},uj=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t=="number"?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:e})}),!0},cj=e=>({tr:t,dispatch:n})=>{if(n){let{doc:r}=t,{from:i,to:a}=typeof e=="number"?{from:e,to:e}:e,o=pe.atStart(r).from,s=pe.atEnd(r).to,l=cs(i,o,s),u=cs(a,o,s),c=pe.create(r,l,u);t.setSelection(c)}return!0},fj=e=>({state:t,dispatch:n})=>{let r=Wt(e,t.schema);return HD(r)(t,n)};function s3(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(i=>t?.includes(i.type.name));e.tr.ensureMarks(r)}}var dj=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:l}=a,u=i.extensionManager.attributes,c=xm(u,s.node().type.name,s.node().attrs);if(a instanceof fe&&a.node.isBlock)return!s.parentOffset||!ur(o,s.pos)?!1:(r&&(e&&s3(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let f=l.parentOffset===l.parent.content.size,d=s.depth===0?void 0:F$(s.node(-1).contentMatchAt(s.indexAfter(-1))),h=f&&d?[{type:d,attrs:c}]:void 0,m=ur(t.doc,t.mapping.map(s.pos),1,h);if(!h&&!m&&ur(t.doc,t.mapping.map(s.pos),1,d?[{type:d}]:void 0)&&(m=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(m&&(a instanceof pe&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,h),d&&!f&&!s.parentOffset&&s.parent.type!==d)){let b=t.mapping.map(s.before()),E=t.doc.resolve(b);s.node(-1).canReplaceWith(E.index(),E.index()+1,d)&&t.setNodeMarkup(t.mapping.map(s.before()),d)}e&&s3(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},hj=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var o;let s=Wt(e,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;let f=l.node(-1);if(f.type!==s)return!1;let d=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let g=Q.empty,y=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-y;R>=l.depth-3;R-=1)g=Q.from(l.node(R).copy(g));let T=l.indexAfter(-1){if(M>-1)return!1;R.isTextblock&&R.content.size===0&&(M=L+1)}),M>-1&&n.setSelection(pe.near(n.doc.resolve(M))),n.scrollIntoView()}return!0}let h=u.pos===l.end()?f.contentMatchAt(0).defaultType:null,m={...xm(d,f.type.name,f.attrs),...t},b={...xm(d,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,u.pos);let E=h?[{type:s,attrs:m},{type:h,attrs:b}]:[{type:s,attrs:m}];if(!ur(n.doc,l.pos,2))return!1;if(i){let{selection:g,storedMarks:y}=r,{splittableMarks:T}=a.extensionManager,S=y||g.$to.parentOffset&&g.$from.marks();if(n.split(l.pos,2,E).scrollIntoView(),!S||!i)return!0;let v=S.filter(x=>T.includes(x.type.name));n.ensureMarks(v)}return!0},FT=(e,t)=>{let n=$T(o=>o.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&zr(e.doc,n.pos)&&e.join(n.pos),!0},qT=(e,t)=>{let n=$T(o=>o.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&zr(e.doc,r)&&e.join(r),!0};function pj(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return pe.between(r,i)}var mj=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:l,commands:u,can:c})=>{let{extensions:f,splittableMarks:d}=i.extensionManager,h=Wt(e,o.schema),m=Wt(t,o.schema),{selection:b,storedMarks:E}=o,{$from:g,$to:y}=b,T=g.blockRange(y),S=E||b.$to.parentOffset&&b.$from.marks();if(!T)return!1;let v=$T(z=>zT(z.type.name,f))(b),x=b.from===0&&b.to===o.doc.content.size,M=o.doc.content.content,R=M.length===1?M[0]:null,L=x&&R&&zT(R.type.name,f)?{node:R,pos:0,depth:0}:null,A=v??L,H=!!v&&T.depth>=1&&T.depth-v.depth<=1,Y=!!L;if((H||Y)&&A){if(A.node.type===h)return x&&Y?l().command(({tr:z,dispatch:V})=>{let $=pj(z);return $?(z.setSelection($),V&&V(z),!0):!1}).liftListItem(m).run():u.liftListItem(m);if(zT(A.node.type.name,f)&&h.validContent(A.node.content))return l().command(()=>(a.setNodeMarkup(A.pos,h),!0)).command(()=>FT(a,h)).command(()=>qT(a,h)).run()}return!n||!S||!s?l().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>FT(a,h)).command(()=>qT(a,h)).run():l().command(()=>{let z=c().wrapInList(h,r),V=S.filter($=>d.includes($.type.name));return a.ensureMarks(V),z?!0:u.clearNodes()}).wrapInList(h,r).command(()=>FT(a,h)).command(()=>qT(a,h)).run()},gj=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Zi(e,r.schema);return GT(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},bj=(e,t,n={})=>({state:r,commands:i})=>{let a=Wt(e,r.schema),o=Wt(t,r.schema),s=Af(r,a,n),l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(a,{...l,...n})},Ej=(e,t={})=>({state:n,commands:r})=>{let i=Wt(e,n.schema);return Af(n,i,t)?r.lift(i):r.wrapIn(i,t)},yj=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r=0;l-=1)o.step(s.steps[l].invert(s.docs[l]));if(a.text){let l=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,e.schema.text(a.text,l))}else o.delete(a.from,a.to)}return!0}}return!1},Tj=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:l}=r.extensionManager;if(n){let u=Object.values(r.schema.marks).filter(c=>i||!l.includes(c.name));s.forEach(c=>{for(let f of u)t.removeMark(c.$from.pos,c.$to.pos,f)})}return!0},Sj=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var a;let{extendEmptyMarkRange:o=!1}=t,{selection:s}=n,l=Zi(e,r.schema),{$from:u,empty:c,ranges:f}=s;if(!i)return!0;if(c&&o){let{from:d,to:h}=s,m=(a=u.marks().find(E=>E.type===l))==null?void 0:a.attrs,b=c3(u,l,m);b&&(d=b.from,h=b.to),n.removeMark(d,h,l)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,l)});return n.removeStoredMark(l),!0},_j=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e=="number"?(a=e,o=e):e&&"from"in e&&"to"in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(s,l)=>{if(s.isText)return;let u={...s.attrs};delete u.dir,t.setNodeMarkup(l,void 0,u)}),!0},xj=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=wm(typeof e=="string"?e:e.name,r.schema);if(!s)return!1;s==="node"&&(a=Wt(e,r.schema)),s==="mark"&&(o=Zi(e,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{let c=u.$from.pos,f=u.$to.pos,d,h,m,b;n.selection.empty?r.doc.nodesBetween(c,f,(E,g)=>{a&&a===E.type&&(l=!0,m=Math.max(g,c),b=Math.min(g+E.nodeSize,f),d=g,h=E)}):r.doc.nodesBetween(c,f,(E,g)=>{g=c&&g<=f&&(a&&a===E.type&&(l=!0,i&&n.setNodeMarkup(g,void 0,{...E.attrs,...t})),o&&E.marks.length&&E.marks.forEach(y=>{if(o===y.type&&(l=!0,i)){let T=Math.max(g,c),S=Math.min(g+E.nodeSize,f);n.addMark(T,S,o.create({...y.attrs,...t}))}}))}),h&&(d!==void 0&&i&&n.setNodeMarkup(d,void 0,{...h.attrs,...t}),o&&h.marks.length&&h.marks.forEach(E=>{o===E.type&&i&&n.addMark(m,b,o.create({...E.attrs,...t}))}))}),l},Aj=(e,t={})=>({state:n,dispatch:r})=>{let i=Wt(e,n.schema);return BD(i,t)(n,r)},Cj=(e,t={})=>({state:n,dispatch:r})=>{let i=Wt(e,n.schema);return PD(i,t)(n,r)},Nj=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};var vj=(e,t)=>{if(KT(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,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 Tm(e){var t;let{editor:n,from:r,to:i,text:a,rules:o,plugin:s}=e,{view:l}=n;if(l.composing)return!1;let u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(t=u.nodeBefore||u.nodeAfter)!=null&&t.marks.find(d=>d.type.spec.code))return!1;let c=!1,f=ej(u)+a;return o.forEach(d=>{if(c)return;let h=vj(f,d.find);if(!h)return;let m=l.state.tr,b=vm({state:l.state,transaction:m}),E={from:r-(h[0].length-a.length),to:i},{commands:g,chain:y,can:T}=new km({editor:n,state:b});d.handler({state:b,range:E,match:h,commands:g,chain:y,can:T})===null||!m.steps.length||(d.undoable&&m.setMeta(s,{transform:m,from:r,to:i,text:a}),l.dispatch(m),c=!0)}),c}function kj(e){let{editor:t,rules:n}=e,r=new Ue({state:{init(){return null},apply(i,a,o){let s=i.getMeta(r);if(s)return s;let l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=XT(Q.from(c),o.schema);let{from:f}=l,d=f+c.length;Tm({editor:t,from:f,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,o,s){return Tm({editor:t,from:a,to:o,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:a}=i.state.selection;a&&Tm({editor:t,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;let{$cursor:o}=i.state.selection;return o?Tm({editor:t,from:o.pos,to:o.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function wj(e){return Object.prototype.toString.call(e).slice(8,-1)}function Sm(e){return wj(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function x3(e,t){let n={...e};return Sm(e)&&Sm(t)&&Object.keys(t).forEach(r=>{Sm(t[r])&&Sm(e[r])?n[r]=x3(e[r],t[r]):n[r]=t[r]}),n}var QT=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...dt(le(this,"addOptions",{name:this.name}))}}get storage(){return{...dt(le(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>x3(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Mj=class A3 extends QT{constructor(){super(...arguments),this.type="mark"}static create(t={}){let n=typeof t=="function"?t():t;return new A3(n)}static handleExit({editor:t,mark:n}){let{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!!!o.find(u=>u?.type.name===n.name))return!1;let l=o.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){let n=typeof t=="function"?t():t;return super.extend(n)}};function Oj(e){return typeof e=="number"}var Rj=(e,t,n)=>{if(KT(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(i=>{let a=[i.text];return a.index=i.index,a.input=e,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function Dj(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:u,can:c}=new km({editor:t,state:n}),f=[];return n.doc.nodesBetween(r,i,(h,m)=>{var b,E,g,y,T;if((E=(b=h.type)==null?void 0:b.spec)!=null&&E.code||!(h.isText||h.isTextblock||h.isInline))return;let S=(T=(y=(g=h.content)==null?void 0:g.size)!=null?y:h.nodeSize)!=null?T:0,v=Math.max(r,m),x=Math.min(i,m+S);if(v>=x)return;let M=h.isText?h.text||"":h.textBetween(v-m,x-m,void 0,"\uFFFC");Rj(M,a.find,o).forEach(L=>{if(L.index===void 0)return;let A=v+L.index+1,H=A+L[0].length,Y={from:n.tr.mapping.map(A),to:n.tr.mapping.map(H)},z=a.handler({state:n,range:Y,match:L,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:s});f.push(z)})}),f.every(h=>h!==null)}var _m=null,Ij=e=>{var t;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function Lj(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,s;try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}let l=({state:c,from:f,to:d,rule:h,pasteEvt:m})=>{let b=c.tr,E=vm({state:c,transaction:b});if(!(!Dj({editor:t,state:E,from:Math.max(f-1,0),to:d.b-1,rule:h,pasteEvent:m,dropEvent:s})||!b.steps.length)){try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(c=>new Ue({view(f){let d=m=>{var b;r=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,r&&(_m=t)},h=()=>{_m&&(_m=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,d)=>{if(a=r===f.dom.parentElement,s=d,!a){let h=_m;h?.isEditable&&setTimeout(()=>{let m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,d)=>{var h;let m=(h=d.clipboardData)==null?void 0:h.getData("text/html");return o=d,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,d,h)=>{let m=f[0],b=m.getMeta("uiEvent")==="paste"&&!i,E=m.getMeta("uiEvent")==="drop"&&!a,g=m.getMeta("applyPasteRules"),y=!!g;if(!b&&!E&&!y)return;if(y){let{text:v}=g;typeof v=="string"?v=v:v=XT(Q.from(v),h.schema);let{from:x}=g,M=x+v.length,R=Ij(v);return l({rule:c,state:h,from:x,to:{b:M},pasteEvt:R})}let T=d.doc.content.findDiffStart(h.doc.content),S=d.doc.content.findDiffEnd(h.doc.content);if(!(!Oj(T)||!S||T===S.b))return l({rule:c,state:h,from:T,to:S,pasteEvt:o})}}))}var Mm=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=E3(e),this.schema=K$(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Tf(t.name,this.schema)},r=le(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return _f([...this.extensions].reverse()).flatMap(r=>{let i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Tf(r.name,this.schema)},a=[],o=le(r,"addKeyboardShortcuts",i),s={};if(r.type==="mark"&&le(r,"exitable",i)&&(s.ArrowRight=()=>Mj.handleExit({editor:e,mark:r})),o){let d=Object.fromEntries(Object.entries(o()).map(([h,m])=>[h,()=>m({editor:e})]));s={...s,...d}}let l=QI(s);a.push(l);let u=le(r,"addInputRules",i);if(o3(r,e.options.enableInputRules)&&u){let d=u();if(d&&d.length){let h=kj({editor:e,rules:d}),m=Array.isArray(h)?h:[h];a.push(...m)}}let c=le(r,"addPasteRules",i);if(o3(r,e.options.enablePasteRules)&&c){let d=c();if(d&&d.length){let h=Lj({editor:e,rules:d});a.push(...h)}}let f=le(r,"addProseMirrorPlugins",i);if(f){let d=f();a.push(...d)}return a})}get attributes(){return b3(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Xl(this.extensions);return Object.fromEntries(t.filter(n=>!!le(n,"addNodeView")).map(n=>{let r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Wt(n.name,this.schema)},a=le(n,"addNodeView",i);if(!a)return[];let o=a();if(!o)return[];let s=(l,u,c,f,d)=>{let h=Nm(l,r);return o({node:l,view:u,getPos:c,decorations:f,innerDecorations:d,editor:e,extension:n,HTMLAttributes:h})};return[n.name,s]}))}dispatchTransaction(e){let{editor:t}=this;return _f([...this.extensions].reverse()).reduceRight((r,i)=>{let a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Tf(i.name,this.schema)},o=le(i,"dispatchTransaction",a);return o?s=>{o.call(a,{transaction:s,next:r})}:r},e)}transformPastedHTML(e){let{editor:t}=this;return _f([...this.extensions]).reduce((r,i)=>{let a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Tf(i.name,this.schema)},o=le(i,"transformPastedHTML",a);return o?(s,l)=>{let u=r(s,l);return o.call(a,u)}:r},e||(r=>r))}get markViews(){let{editor:e}=this,{markExtensions:t}=Xl(this.extensions);return Object.fromEntries(t.filter(n=>!!le(n,"addMarkView")).map(n=>{let r=this.attributes.filter(s=>s.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Zi(n.name,this.schema)},a=le(n,"addMarkView",i);if(!a)return[];let o=(s,l,u)=>{let c=Nm(s,r);return a()({mark:s,view:l,inline:u,editor:e,extension:n,HTMLAttributes:c,updateAttributes:f=>{jj(s,e,f)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let n=t.parent;n.child===t&&(n.child=null),t=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n,r;let i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Tf(t.name,this.schema)};t.type==="mark"&&(((n=dt(le(t,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(t.name),(r=dt(le(t,"clearable",i)))==null||r||this.nonClearableMarks.push(t.name));let a=le(t,"onBeforeCreate",i),o=le(t,"onCreate",i),s=le(t,"onUpdate",i),l=le(t,"onSelectionUpdate",i),u=le(t,"onTransaction",i),c=le(t,"onFocus",i),f=le(t,"onBlur",i),d=le(t,"onDestroy",i);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),c&&this.editor.on("focus",c),f&&this.editor.on("blur",f),d&&this.editor.on("destroy",d)})}};Mm.resolve=E3;Mm.sort=_f;Mm.flatten=jT;var Bj={};YT(Bj,{ClipboardTextSerializer:()=>N3,Commands:()=>v3,Delete:()=>k3,Drop:()=>w3,Editable:()=>M3,FocusEvents:()=>R3,Keymap:()=>D3,Paste:()=>I3,Tabindex:()=>L3,TextDirection:()=>B3,focusEventsPluginKey:()=>O3});var Kn=class C3 extends QT{constructor(){super(...arguments),this.type="extension"}static create(t={}){let n=typeof t=="function"?t():t;return new C3(n)}configure(t){return super.configure(t)}extend(t){let n=typeof t=="function"?t():t;return super.extend(n)}},N3=Kn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ue({key:new at("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=T3(n),{blockSeparator:o}=this.options,s={...o!==void 0?{blockSeparator:o}:{},textSerializers:a};return[...i.ranges].sort((u,c)=>u.$from.pos-c.$from.pos).map(({$from:u,$to:c})=>y3(r,{from:u.pos,to:c.pos},s)).join(o??` - -`)}}})]}}),v3=Kn.create({name:"commands",addCommands(){return{...l3}}}),k3=Kn.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let a=()=>{var o,s,l,u;if((u=(l=(s=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:s.filterTransaction)==null?void 0:l.call(s,e))!=null?u:e.getMeta("y-sync$"))return;let c=z$(e.before,[e,...t]);J$(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{let E=b+m.nodeSize-2,g=h.oldRange.from<=b&&E<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:E,newFrom:c.mapping.map(b),newTo:c.mapping.map(E),deletedRange:h.oldRange,newRange:h.newRange,partial:!g,editor:this.editor,transaction:e,combinedTransform:c})})});let d=c.mapping;c.steps.forEach((h,m)=>{var b,E;if(h instanceof Gi){let g=d.slice(m).map(h.from,-1),y=d.slice(m).map(h.to),T=d.invert().map(g,-1),S=d.invert().map(y),v=g>0?(b=c.doc.nodeAt(g-1))==null?void 0:b.marks.some(M=>M.eq(h.mark)):!1,x=(E=c.doc.nodeAt(y))==null?void 0:E.marks.some(M=>M.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:T,to:S},newRange:{from:g,to:y},partial:!!(x||v),editor:this.editor,transaction:e,combinedTransform:c})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),w3=Kn.create({name:"drop",addProseMirrorPlugins(){return[new Ue({key:new at("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),M3=Kn.create({name:"editable",addProseMirrorPlugins(){return[new Ue({key:new at("editable"),props:{editable:()=>this.editor.options.editable}})]}}),O3=new at("focusEvents"),R3=Kn.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new Ue({key:O3,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),D3=Kn.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:s})=>{let{selection:l,doc:u}=s,{empty:c,$anchor:f}=l,{pos:d,parent:h}=f,m=f.parent.isTextblock&&d>0?s.doc.resolve(d-1):f,b=m.parent.type.spec.isolating,E=f.pos-f.parentOffset,g=b&&m.parent.childCount===1?E===f.pos:Ce.atStart(u).from===d;return!c||!h.type.isTextblock||h.textContent.length||!g||g&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},a={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Cm()||p3()?a:i},addProseMirrorPlugins(){return[new Ue({key:new at("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(b=>b.getMeta("composition")))return;let r=e.some(b=>b.docChanged)&&!t.doc.eq(n.doc),i=e.some(b=>b.getMeta("preventClearDocument"));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,l=Ce.atStart(t.doc).from,u=Ce.atEnd(t.doc).to;if(a||!(o===l&&s===u)||!WT(n.doc))return;let d=n.tr,h=vm({state:n,transaction:d}),{commands:m}=new km({editor:this.editor,state:h});if(m.clearNodes(),!!d.steps.length)return d}})]}}),I3=Kn.create({name:"paste",addProseMirrorPlugins(){return[new Ue({key:new at("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),L3=Kn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Ue({key:new at("tabindex"),props:{attributes:()=>{var e;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(e=this.options.value)!=null?e:"0"}}}})]}}),B3=Kn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Xl(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{let n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ue({key:new at("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),Pj=class Sf{constructor(t,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,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 t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t 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},t)}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;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Sf(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Sf(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Sf(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(s);if(!i&&!o&&l.depth<=this.depth)return;let u=new Sf(l,this.editor,i,i||o?n:null);i&&(u.actualDepth=this.depth+1),t.push(u)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(n).length>0){let a=i.node.attrs,o=Object.keys(n);for(let s=0;s{r&&i.length>0||(o.node.type.name===t&&a.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(t,n,r))))}),i}setAttribute(t){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},Uj=`.ProseMirror { +${n}`}var Dl=q(ne(),1),YV='
',eR=(0,JO.memo)(function({requestId:t,toolName:n,toolTitle:r,intent:i,arguments:a}){return(0,Dl.jsx)(Ip,{requestId:t,toolName:n,toolTitle:r,intent:i,icon:YV,titleTemplate:"Running {title}",children:(0,Dl.jsxs)("div",{className:"shiny-tool-request__arguments",children:[(0,Dl.jsx)("strong",{children:"Tool arguments"}),(0,Dl.jsx)($t,{content:Yo(a,"json"),contentType:"markdown",streaming:!1})]})})});var E1=q(ne(),1);function tR({"request-id":e,"tool-name":t,"tool-title":n,intent:r,arguments:i}){let{hiddenToolRequests:a}=yN();return!e||!t||a.has(e)?null:(0,E1.jsx)("div",{className:"shiny-tool-request",children:(0,E1.jsx)(eR,{requestId:e,toolName:t,toolTitle:n,intent:r,arguments:i??"{}"})})}var Bp=q(me(),1);var Lp=q(me(),1);var Pe=q(ne(),1);function KV({filename:e}){return(0,Pe.jsxs)("div",{className:"shinychat-pdf badge fs-6 text-bg-secondary",children:[(0,Pe.jsx)("span",{className:"shinychat-pdf__icon me-1",dangerouslySetInnerHTML:{__html:XO}}),(0,Pe.jsx)("span",{className:"shinychat-pdf__filename font-monospace",children:e})]})}function $V({value:e,valueType:t}){return t==="html"?(0,Pe.jsx)(Go,{html:e}):t==="text"?(0,Pe.jsx)("p",{children:e}):t==="markdown"?(0,Pe.jsx)($t,{content:e,contentType:"markdown",streaming:!1}):(0,Pe.jsx)($t,{content:Yo(e,"text"),contentType:"markdown",streaming:!1})}var nR=(0,Lp.memo)(function({requestId:t,toolName:n,toolTitle:r,intent:i,status:a,value:o,valueType:s,requestCall:l,showRequest:u=!1,fullScreen:c=!1,expanded:f=!1,icon:d,footer:h}){let m=(0,Lp.useRef)(null),{enterFullscreen:b,overlay:E}=ZO(m),g=a==="error";return(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsxs)(Ip,{requestId:t,toolName:n,toolTitle:r,intent:i,icon:g?FO:d,classStatus:g?"text-danger":"",titleTemplate:g?"{title} failed":"{title}",fullScreen:c,initialExpanded:f,footer:h,onEnterFullscreen:b,cardRef:m,children:[jV(l,u),XV(o,s,u)]}),E]})});function jV(e,t){if(!t||!e)return null;let n=Yo(e,""),r=e.split(` +`).length>2;return(0,Pe.jsx)("div",{className:"shiny-tool-result__request",children:r?(0,Pe.jsxs)("details",{children:[(0,Pe.jsx)("summary",{children:"Tool call"}),(0,Pe.jsx)($t,{content:n,contentType:"markdown",streaming:!1})]}):(0,Pe.jsxs)(Pe.Fragment,{children:[(0,Pe.jsx)("strong",{children:"Tool call"}),(0,Pe.jsx)($t,{content:n,contentType:"markdown",streaming:!1})]})})}function XV(e,t,n){let r=e||"[Empty result]",i;if(t==="html")i=(0,Pe.jsx)(Go,{html:r});else if(t==="text")i=(0,Pe.jsx)("p",{children:r});else if(t==="content_extra")try{let o=JSON.parse(e);i=(0,Pe.jsx)("div",{className:"shinychat-content-extra",children:o.map((s,l)=>s.type==="image"?(0,Pe.jsx)("img",{src:s.src,className:"shinychat-tool-image"},l):s.type==="pdf"?(0,Pe.jsx)(KV,{filename:s.filename??""},l):s.type==="text"?(0,Pe.jsx)($V,{value:s.value??"",valueType:s.value_type??"code"},l):null)})}catch{i=(0,Pe.jsx)($t,{content:Yo(r,"text"),contentType:"markdown",streaming:!1})}else{let o=t!=="markdown"?Yo(r,"text"):r;i=(0,Pe.jsx)($t,{content:o,contentType:"markdown",streaming:!1})}return!n&&t==="html"?i:(0,Pe.jsxs)("div",{className:"shiny-tool-result__result",children:[n?(0,Pe.jsx)("strong",{children:"Tool result"}):null,i]})}var T1=q(ne(),1);function y1(e){return e===!0||e===""||e==="true"}function rR({"request-id":e,"tool-name":t,"tool-title":n,intent:r,status:i,value:a,"value-type":o,"request-call":s,"show-request":l,"full-screen":u,expanded:c,icon:f,footer:d}){let h=(0,Bp.useContext)(No);return(0,Bp.useEffect)(()=>{!h||!e||h({type:"hide_tool_request",requestId:e})},[h,e]),!e||!t?null:(0,T1.jsx)("div",{className:"shiny-tool-result",children:(0,T1.jsx)(nR,{requestId:e,toolName:t,toolTitle:n,intent:r,status:i??"success",value:a??"",valueType:o??"markdown",requestCall:s,showRequest:y1(l),fullScreen:y1(u),expanded:y1(c),icon:f,footer:d})})}var Ko={"shiny-tool-request":tR,"shiny-tool-result":rR};var Pp=q(me(),1);function Il(){let[e,t]=(0,Pp.useState)(()=>typeof window<"u"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches);return(0,Pp.useEffect)(()=>{let n=window.matchMedia("(prefers-reduced-motion: reduce)"),r=i=>t(i.matches);return n.addEventListener("change",r),()=>n.removeEventListener("change",r)},[]),e}var Fn=q(ne(),1),iR=2500;function WV(e){let[t,n]=(0,pt.useState)(null),r=(0,pt.useRef)(0),i=(0,pt.useRef)(null),a=(0,pt.useRef)(null);return(0,pt.useEffect)(()=>{if(!e)return;let o=Date.now(),s=o-r.current;if(s>=iR||!t)n(e),r.current=o,i.current=null;else if(i.current=e,!a.current){let l=iR-s;a.current=setTimeout(()=>{a.current=null,i.current&&(n(i.current),r.current=Date.now(),i.current=null)},l)}return()=>{a.current&&(clearTimeout(a.current),a.current=null)}},[e,t]),t}var QV=200;function ZV(e){let t=Il(),[n,r]=(0,pt.useState)(e),[i,a]=(0,pt.useState)(!1),o=(0,pt.useRef)(e);return(0,pt.useLayoutEffect)(()=>{if(e===n)return;if(o.current=e,t){r(e),a(!1);return}a(!0);let s=setTimeout(()=>{r(o.current),a(!1)},QV);return()=>clearTimeout(s)},[e,n,t]),{visible:n,fading:i}}function JV({expanded:e}){return(0,Fn.jsx)("svg",{className:"shinychat-thinking-chevron",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none","aria-hidden":"true",...e?{"data-expanded":""}:{},children:(0,Fn.jsx)("path",{d:"M4.5 2.5L8 6L4.5 9.5",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}var aR=(0,pt.memo)(function({thinking:t,messageId:n}){let[r,i]=(0,pt.useState)(!1),[a,o]=(0,pt.useState)(!1),s=(0,pt.useRef)(t.streaming),l=EN(),{scrollRef:u,contentRef:c,scrollToBottom:f}=dh({resize:"smooth"}),d=(0,pt.useRef)(!1);(0,pt.useEffect)(()=>{let y=u.current;if(!y||!r||!t.streaming)return;let T=y.scrollHeight>y.clientHeight;T&&!d.current&&f(),d.current=T},[t.content,r,t.streaming,f,u]);let h=WV(t.streaming?t.topic:null);(0,pt.useEffect)(()=>{if(s.current&&!t.streaming){if(!a){let y=setTimeout(()=>i(!1),600);return()=>clearTimeout(y)}s.current=t.streaming}s.current=t.streaming},[t.streaming,a]);let m=(0,pt.useCallback)(()=>{i(y=>(y?l?.():t.streaming&&(d.current=!1,f()),!y)),t.streaming||o(!0)},[t.streaming,l,f]),b=eG(t,h),{visible:E,fading:g}=ZV(b);return!t.streaming&&!t.content.trim()?null:(0,Fn.jsxs)("div",{className:"shinychat-thinking","data-streaming":t.streaming||void 0,children:[(0,Fn.jsxs)("button",{id:`thinking-header-${n}`,className:"shinychat-thinking-header",onClick:m,"aria-expanded":r,"aria-controls":`thinking-content-${n}`,children:[(0,Fn.jsx)(JV,{expanded:r}),(0,Fn.jsx)("span",{className:"shinychat-thinking-label","data-fading":g||void 0,children:E}),t.streaming&&(0,Fn.jsx)("svg",{className:"shinychat-thinking-dot",width:"8",height:"8",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,Fn.jsx)("circle",{cx:"4",cy:"4",r:"4"})})]}),(0,Fn.jsx)("div",{className:"shinychat-thinking-content",id:`thinking-content-${n}`,role:"region","aria-labelledby":`thinking-header-${n}`,"aria-hidden":r?void 0:"true",inert:!r||void 0,"data-expanded":r||void 0,children:(0,Fn.jsx)("div",{className:"shinychat-thinking-content-inner",ref:u,children:(0,Fn.jsx)("div",{ref:c,children:(0,Fn.jsx)($t,{content:t.content,contentType:"markdown",role:"assistant",streaming:t.streaming,tagToComponentMap:Ko})})})})]})});function eG(e,t){if(e.streaming)return t??"Thinking";if(e.durationMs!=null&&e.durationMs>=500){let n=Math.round(e.durationMs/1e3);return n<1?"Thought for less than a second":`Thought for ${n}s`}return"Thinking"}var sR=q(ne(),1);function oR({name:e}){return(0,sR.jsxs)("span",{className:"command-chip",children:["/",e]})}var Up={image_types:["image/png","image/jpeg","image/gif","image/webp"],pdf_type:"application/pdf",text_extensions:{md:"text/markdown",markdown:"text/markdown",txt:"text/plain",csv:"text/csv",json:"application/json",py:"text/x-python",js:"text/javascript",ts:"text/typescript",r:"text/x-r",yaml:"text/yaml",yml:"text/yaml",toml:"text/x-toml",qmd:"text/markdown",rmd:"text/markdown",ipynb:"application/x-ipynb+json",rst:"text/x-rst",tex:"text/x-tex",sql:"text/x-sql",sh:"text/x-sh",html:"text/html",htm:"text/html",css:"text/css",xml:"application/xml",ini:"text/x-ini",cfg:"text/x-ini",log:"text/plain"}};var lR=new TextDecoder("utf-8"),nG=Up.image_types,S1=Up.pdf_type,_1=Up.text_extensions,uR=Array.from(new Set(Object.values(_1))),x1={"image/png":{family:"image",downscale:!0},"image/jpeg":{family:"image",downscale:!0},"image/gif":{family:"image",downscale:!0},"image/webp":{family:"image",downscale:!0},[S1]:{family:"document",downscale:!1},...Object.fromEntries(uR.map(e=>[e,{family:"text",downscale:!1}]))},cR=Object.keys(x1);function fR(e){let t=new Set(e);for(let[n,r]of Object.entries(_1))t.has(r)&&t.add(`.${n}`);return[...t].join(",")}var rG=1568;function $o(e){return x1[e]?.family??null}function dR(e){return nG.includes(e)}function iG(e,t,n){let r=Math.max(e,t);if(r<=n)return null;let i=n/r;return{width:Math.round(e*i),height:Math.round(t*i)}}var hR=300,pR=1e3;function A1(e){let t=atob(e),n=new Uint8Array(t.length);for(let r=0;r=999.95&&rt+n.size,0)}function aG(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=()=>n(r.error),r.readAsDataURL(e)})}async function oG(e,t){if(typeof document>"u"||typeof Image>"u")return{dataUrl:e,wasDownscaled:!1};let n=await new Promise(s=>{let l=new Image;l.onload=()=>s(l),l.onerror=()=>s(null),l.src=e});if(!n||!n.naturalWidth||!n.naturalHeight)return{dataUrl:e,wasDownscaled:!1};let r=iG(n.naturalWidth,n.naturalHeight,rG);if(!r)return{dataUrl:e,wasDownscaled:!1};let i=document.createElement("canvas");i.width=r.width,i.height=r.height;let a=i.getContext("2d");if(!a)return{dataUrl:e,wasDownscaled:!1};a.drawImage(n,0,0,r.width,r.height);let o=t==="image/gif"?"image/png":t;return{dataUrl:i.toDataURL(o),wasDownscaled:!0}}function yR(e){let t=e.lastIndexOf(".");return t<=0?"":e.slice(t+1).toLowerCase()}function zp(e,t){let n=yR(e);return n?n.toUpperCase():t===S1?"PDF":"FILE"}function TR(e){return new File([e],"Pasted Text",{type:"text/plain"})}function sG(e){if(dR(e.type)||e.type===S1)return e.type;let t=yR(e.name);return t?_1[t]??null:uR.includes(e.type)?e.type:null}async function SR(e,t){let n=sG(e);if(n===null||!t.includes(n))return null;let r=$o(n);if(r===null)return null;let i=x1[n],a=await aG(e);if(i?.downscale&&dR(n)){let{dataUrl:o,wasDownscaled:s}=await oG(a,n),l=s&&n==="image/gif"?"image/png":n;return{file:{id:Sr(),type:l,family:r,dataUrl:o,name:e.name,size:Hp(o)},wasDownscaled:s,wasConverted:l!==n}}return{file:{id:Sr(),type:n,family:r,dataUrl:a,name:e.name,size:Hp(a)},wasDownscaled:!1,wasConverted:!1}}var Fp=q(me(),1);var Ya=q(ne(),1),qp=(0,Fp.memo)(function({dataUrl:t,name:n,size:r,onRemove:i,onActivate:a,rootRef:o,rootProps:s}){let l=(0,Fp.useMemo)(()=>mR(t,hR).trim(),[t]);return(0,Ya.jsxs)("div",{ref:o,className:"shiny-chat-text-preview",title:n||void 0,...s,...a?{role:"button",tabIndex:0,onClick:a,onKeyDown:c=>{(c.key==="Enter"||c.key===" ")&&(c.preventDefault(),a())}}:void 0,children:[(0,Ya.jsx)("div",{className:"shiny-chat-text-preview-body",children:l||"(empty file)"}),(0,Ya.jsxs)("div",{className:"shiny-chat-text-preview-footer",children:[n&&(0,Ya.jsx)("span",{className:"shiny-chat-text-preview-name",children:n}),(0,Ya.jsx)("span",{className:"shiny-chat-text-preview-size",children:jc(r)})]}),i&&(0,Ya.jsx)("button",{type:"button",tabIndex:0,"aria-label":n?`Remove ${n}`:"Remove attachment",onClick:i,children:"\xD7"})]})});var qn=q(me(),1),xR=q(io(),1);var Fi=q(ne(),1),_R='button, [tabindex="0"], a[href], input, select, textarea, iframe';function AR({src:e,name:t,mime:n,onClose:r}){let i=$o(n),a=i==="image",o=i==="text",[s,l]=(0,qn.useState)(null),u=(0,qn.useRef)(null),c=(0,qn.useRef)(null),f=(0,qn.useMemo)(()=>o?gR(e):"",[o,e]);(0,qn.useLayoutEffect)(()=>{c.current=document.activeElement instanceof HTMLElement?document.activeElement:null,u.current?.querySelector(_R)?.focus()},[]),(0,qn.useEffect)(()=>{let h=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=h,c.current?.focus()}},[]);let d=(0,qn.useCallback)(h=>{if(h.key==="Escape"){r();return}if(h.key!=="Tab")return;let m=u.current;if(!m)return;let b=m.querySelectorAll(_R);if(b.length===0)return;let E=b[0],g=b[b.length-1];h.shiftKey&&document.activeElement===E?(h.preventDefault(),g.focus()):!h.shiftKey&&document.activeElement===g&&(h.preventDefault(),E.focus())},[r]);return(0,qn.useEffect)(()=>{if(a||o)return;let h=URL.createObjectURL(bR(e));return l(h),()=>URL.revokeObjectURL(h)},[e,a,o]),(0,xR.createPortal)((0,Fi.jsxs)("div",{ref:u,className:"shiny-chat-lightbox",role:"dialog","aria-modal":"true","aria-label":t||"Attachment preview",onClick:r,onKeyDown:d,children:[(0,Fi.jsxs)("div",{className:"shiny-chat-lightbox-content",onClick:h=>h.stopPropagation(),children:[a?(0,Fi.jsx)("img",{className:"shiny-chat-lightbox-img",src:e,alt:t||"Attached image"}):o?(0,Fi.jsx)("pre",{className:"shiny-chat-lightbox-text",tabIndex:0,"aria-label":t||"File content",children:f||"(empty file)"}):s&&(0,Fi.jsx)("iframe",{className:"shiny-chat-lightbox-frame",src:s,title:t||"PDF preview"}),t&&(0,Fi.jsx)("div",{className:"shiny-chat-lightbox-name",children:t})]}),(0,Fi.jsx)("button",{type:"button",className:"shiny-chat-lightbox-close","aria-label":"Close preview",onClick:r,children:"\xD7"})]}),document.body)}var $n=q(me(),1);var Lm=q(me(),1),eo=q(me(),1),J3=q(io(),1),eL=q(Vp(),1),Ji=q(ne(),1);function mn(e){this.content=e}mn.prototype={constructor:mn,find:function(e){for(var t=0;t>1}};mn.from=function(e){if(e instanceof mn)return e;var t=[];if(e)for(var n in e)t.push(n,e[n]);return new mn(t)};var N1=mn;function PR(e,t,n){for(let r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(r),a=t.child(r);if(i==a){n+=i.nodeSize;continue}if(!i.sameMarkup(a))return n;if(i.isText&&i.text!=a.text){let o=i.text,s=a.text,l=0;for(;o[l]==s[l];l++)n++;return l&&l0&&d>0&&u[f-1]==c[d-1];)f--,d--,n--,r--;return f&&d&&f=56320&&e<57344}function zR(e){return e>=55296&&e<56320}var Q=class e{constructor(t,n){if(this.content=t,this.size=n||0,n==null)for(let r=0;rt&&r(l,i+s,a||null,o)!==!1&&l.content.size){let c=s+1;l.nodesBetween(Math.max(0,t-c),Math.min(l.content.size,n-c),r,i+c)}s=u}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,n,r,i){let a="",o=!0;return this.nodesBetween(t,n,(s,l)=>{let u=s.isText?s.text.slice(Math.max(t,l)-l,n-l):s.isLeaf?i?typeof i=="function"?i(s):i:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&u||s.isTextblock)&&r&&(o?o=!1:a+=r),a+=u},0),a}append(t){if(!t.size)return this;if(!this.size)return t;let n=this.lastChild,r=t.firstChild,i=this.content.slice(),a=0;for(n.isText&&n.sameMarkup(r)&&(i[i.length-1]=n.withText(n.text+r.text),a=1);at)for(let a=0,o=0;ot&&((on)&&(s.isText?s=s.cut(Math.max(0,t-o),Math.min(s.text.length,n-o)):s=s.cut(Math.max(0,t-o-1),Math.min(s.content.size,n-o-1))),r.push(s),i+=s.nodeSize),o=l}return new e(r,i)}cutByIndex(t,n){return t==n?e.empty:t==0&&n==this.content.length?this:new e(this.content.slice(t,n))}replaceChild(t,n){let r=this.content[t];if(r==n)return this;let i=this.content.slice(),a=this.size+n.nodeSize-r.nodeSize;return i[t]=n,new e(i,a)}addToStart(t){return new e([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new e(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let n=0;nthis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,r=0;;n++){let i=this.child(n),a=r+i.nodeSize;if(a>=t)return a==t?Gp(n+1,a):Gp(n,r);r=a}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return e.fromArray(n.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return e.empty;let n,r=0;for(let i=0;ithis.type.rank&&(n||(n=t.slice(0,i)),n.push(this),r=!0),n&&n.push(a)}}return n||(n=t.slice()),r||n.push(this),n}removeFromSet(t){for(let n=0;nr.type.rank-i.type.rank),n}};Ie.none=[];var Wo=class extends Error{},re=class e{constructor(t,n,r){this.content=t,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,n){let r=qR(this.content,t+this.openStart,n,this.openStart+1,this.openEnd+1);return r&&new e(r,this.openStart,this.openEnd)}removeBetween(t,n){return new e(FR(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,n){if(!n)return e.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 e(Q.fromJSON(t,n.content),r,i)}static maxOpen(t,n=!0){let r=0,i=0;for(let a=t.firstChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.firstChild)r++;for(let a=t.lastChild;a&&!a.isLeaf&&(n||!a.type.spec.isolating);a=a.lastChild)i++;return new e(t,r,i)}};re.empty=new re(Q.empty,0,0);function FR(e,t,n){let{index:r,offset:i}=e.findIndex(t),a=e.maybeChild(r),{index:o,offset:s}=e.findIndex(n);if(i==t||a.isText){if(s!=n&&!e.child(o).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=o)throw new RangeError("Removing non-flat range");return e.replaceChild(r,a.copy(FR(a.content,t-i-1,n-i-1)))}function qR(e,t,n,r,i,a){let{index:o,offset:s}=e.findIndex(t),l=e.maybeChild(o);if(s==t||l.isText)return a&&r<=0&&i<=0&&!a.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let u=qR(l.content,t-s-1,n,o==0?r-1:0,o==e.childCount-1?i-1:0,l);return u&&e.replaceChild(o,l.copy(u))}function bG(e,t,n){if(n.openStart>e.depth)throw new Wo("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new Wo("Inconsistent open depths");return VR(e,t,n,0)}function VR(e,t,n,r){let i=e.index(r),a=e.node(r);if(i==t.index(r)&&r=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function Xc(e,t,n,r){let i=(t||e).node(n),a=0,o=t?t.index(n):i.childCount;e&&(a=e.index(n),e.depth>n?a++:e.textOffset&&(jo(e.nodeAfter,r),a++));for(let s=a;si&&k1(e,t,i+1),o=r.depth>i&&k1(n,r,i+1),s=[];return Xc(null,e,i,s),a&&o&&t.index(i)==n.index(i)?(GR(a,o),jo(Xo(a,YR(e,t,n,r,i+1)),s)):(a&&jo(Xo(a,jp(e,t,i+1)),s),Xc(t,n,i,s),o&&jo(Xo(o,jp(n,r,i+1)),s)),Xc(r,null,i,s),new Q(s)}function jp(e,t,n){let r=[];if(Xc(null,e,n,r),e.depth>n){let i=k1(e,t,n+1);jo(Xo(i,jp(e,t,n+1)),r)}return Xc(t,null,n,r),new Q(r)}function EG(e,t){let n=t.depth-e.openStart,i=t.node(n).copy(e.content);for(let a=n-1;a>=0;a--)i=t.node(a).copy(Q.from(i));return{start:i.resolveNoCache(e.openStart+n),end:i.resolveNoCache(i.content.size-e.openEnd-n)}}var Xp=class e{constructor(t,n,r){this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,n=this.index(this.depth);if(n==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(n);return r?t.child(n).cut(r):i}get nodeBefore(){let t=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(t).cut(0,n):t==0?null:this.parent.child(t-1)}posAtIndex(t,n){n=this.resolveDepth(n);let r=this.path[n*3],i=n==0?0:this.path[n*3-1]+1;for(let a=0;a0;n--)if(this.start(n)<=t&&this.end(n)>=t)return n;return 0}blockRange(t=this,n){if(t.pos=0;r--)if(t.pos<=this.end(r)&&(!n||n(this.node(r))))return new Qo(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");let r=[],i=0,a=n;for(let o=t;;){let{index:s,offset:l}=o.content.findIndex(a),u=a-l;if(r.push(o,s,i+l),!u||(o=o.child(s),o.isText))break;a=u-1,i+=l+1}return new e(n,r,a)}static resolveCached(t,n){let r=kR.get(t);if(r)for(let a=0;at&&this.nodesBetween(t,n,a=>(r.isInSet(a.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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),KR(this.marks,t)}contentMatchAt(t){let n=this.type.contentMatch.matchFragment(this.content,0,t);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(t,n,r=Q.empty,i=0,a=r.childCount){let o=this.contentMatchAt(t).matchFragment(r,i,a),s=o&&o.matchFragment(this.content,n);if(!s||!s.validEnd)return!1;for(let l=i;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let t={type:this.type.name};for(let n in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(n=>n.toJSON())),t}static fromJSON(t,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(t.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(n.text,r)}let i=Q.fromJSON(t,n.content),a=t.nodeType(n.type).create(n.attrs,i,r);return a.type.checkAttrs(a.attrs),a}};Vn.prototype.text=void 0;var M1=class e extends Vn{constructor(t,n,r,i){if(super(t,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):KR(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,n){return this.text.slice(t,n)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new e(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new e(this.type,this.attrs,t,this.marks)}cut(t=0,n=this.text.length){return t==0&&n==this.text.length?this:this.withText(this.text.slice(t,n))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function KR(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var Zo=class e{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,n){let r=new O1(t,n);if(r.next==null)return e.empty;let i=$R(r);r.next&&r.err("Unexpected trailing text");let a=vG(NG(i));return kG(a,r),a}matchType(t){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function n(r){t.push(r);for(let i=0;i{let a=i+(r.validEnd?"*":" ")+" ";for(let o=0;o"+t.indexOf(r.next[o].next);return a}).join(` +`)}};Zo.empty=new Zo(!0);var O1=class{constructor(t,n){this.string=t,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function $R(e){let t=[];do t.push(SG(e));while(e.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function SG(e){let t=[];do t.push(_G(e));while(e.next&&e.next!=")"&&e.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function _G(e){let t=CG(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else if(e.eat("{"))t=xG(e,t);else break;return t}function wR(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function xG(e,t){let n=wR(e),r=n;return e.eat(",")&&(e.next!="}"?r=wR(e):r=-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function AG(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let i=[];for(let a in n){let o=n[a];o.isInGroup(t)&&i.push(o)}return i.length==0&&e.err("No node type or group '"+t+"' found"),i}function CG(e){if(e.eat("(")){let t=$R(e);return e.eat(")")||e.err("Missing closing paren"),t}else if(/\W/.test(e.next))e.err("Unexpected token '"+e.next+"'");else{let t=AG(e,e.next).map(n=>(e.inline==null?e.inline=n.isInline:e.inline!=n.isInline&&e.err("Mixing inline and block content"),{type:"name",value:n}));return e.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function NG(e){let t=[[]];return i(a(e,0),n()),t;function n(){return t.push([])-1}function r(o,s,l){let u={term:l,to:s};return t[o].push(u),u}function i(o,s){o.forEach(l=>l.to=s)}function a(o,s){if(o.type=="choice")return o.exprs.reduce((l,u)=>l.concat(a(u,s)),[]);if(o.type=="seq")for(let l=0;;l++){let u=a(o.exprs[l],s);if(l==o.exprs.length-1)return u;i(u,s=n())}else if(o.type=="star"){let l=n();return r(s,l),i(a(o.expr,l),l),[r(l)]}else if(o.type=="plus"){let l=n();return i(a(o.expr,s),l),i(a(o.expr,l),l),[r(l)]}else{if(o.type=="opt")return[r(s)].concat(a(o.expr,s));if(o.type=="range"){let l=s;for(let u=0;u{e[o].forEach(({term:s,to:l})=>{if(!s)return;let u;for(let c=0;c{u||i.push([s,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let a=t[r.join(",")]=new Zo(r.indexOf(e.length-1)>-1);for(let o=0;o-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:WR(this.attrs,t)}create(t=null,n,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new Vn(this,this.computeAttrs(t),Q.from(n),Ie.setFrom(r))}createChecked(t=null,n,r){return n=Q.from(n),this.checkContent(n),new Vn(this,this.computeAttrs(t),n,Ie.setFrom(r))}createAndFill(t=null,n,r){if(t=this.computeAttrs(t),n=Q.from(n),n.size){let o=this.contentMatch.fillBefore(n);if(!o)return null;n=o.append(n)}let i=this.contentMatch.matchFragment(n),a=i&&i.fillBefore(Q.empty,!0);return a?new Vn(this,t,n.append(a),Ie.setFrom(r)):null}validContent(t){let n=this.contentMatch.matchFragment(t);if(!n||!n.validEnd)return!1;for(let r=0;r-1}allowsMarks(t){if(this.markSet==null)return!0;for(let n=0;nr[a]=new e(a,n,o));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 a in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function wG(e,t,n){let r=n.split("|");return i=>{let a=i===null?"null":typeof i;if(r.indexOf(a)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${a}`)}}var R1=class{constructor(t,n,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?wG(t,n,r.validate):r.validate}get isRequired(){return!this.hasDefault}},Qc=class e{constructor(t,n,r,i){this.name=t,this.rank=n,this.schema=r,this.spec=i,this.attrs=ZR(t,i.attrs),this.excluded=null;let a=XR(this.attrs);this.instance=a?new Ie(this,a):null}create(t=null){return!t&&this.instance?this.instance:new Ie(this,WR(this.attrs,t))}static compile(t,n){let r=Object.create(null),i=0;return t.forEach((a,o)=>r[a]=new e(a,i++,n,o)),r}removeFromSet(t){for(var n=0;n-1}},Pl=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let n=this.spec={};for(let i in t)n[i]=t[i];n.nodes=N1.from(t.nodes),n.marks=N1.from(t.marks||{}),this.nodes=Wp.compile(this.spec.nodes,this),this.marks=Qc.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 a=this.nodes[i],o=a.spec.content||"",s=a.spec.marks;if(a.contentMatch=r[o]||(r[o]=Zo.parse(o,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet=s=="_"?null:s?OR(this,s.split(" ")):s==""||!a.inlineContent?[]:null}for(let i in this.marks){let a=this.marks[i],o=a.spec.excludes;a.excluded=o==null?[a]:o==""?[]:OR(this,o.split(" "))}this.nodeFromJSON=i=>Vn.fromJSON(this,i),this.markFromJSON=i=>Ie.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,n=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof Wp){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(n,r,i)}text(t,n){let r=this.nodes.text;return new M1(r,r.defaultAttrs,t,Ie.setFrom(n))}mark(t,n){return typeof t=="string"&&(t=this.marks[t]),t.create(n)}nodeType(t){let n=this.nodes[t];if(!n)throw new RangeError("Unknown node type: "+t);return n}};function OR(e,t){let n=[];for(let r=0;r-1)&&n.push(o=l)}if(!o)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}function MG(e){return e.tag!=null}function OG(e){return e.style!=null}var ai=class e{constructor(t,n){this.schema=t,this.rules=n,this.tags=[],this.styles=[];let r=this.matchedStyles=[];n.forEach(i=>{if(MG(i))this.tags.push(i);else if(OG(i)){let a=/[^=]*/.exec(i.style)[0];r.indexOf(a)<0&&r.push(a),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let a=t.nodes[i.node];return a.contentMatch.matchType(a)})}parse(t,n={}){let r=new Qp(this,n,!1);return r.addAll(t,Ie.none,n.from,n.to),r.finish()}parseSlice(t,n={}){let r=new Qp(this,n,!0);return r.addAll(t,Ie.none,n.from,n.to),re.maxOpen(r.finish())}matchTag(t,n,r){for(let i=r?this.tags.indexOf(r)+1:0;it.length&&(s.charCodeAt(t.length)!=61||s.slice(t.length+1)!=n))){if(o.getAttrs){let l=o.getAttrs(n);if(l===!1)continue;o.attrs=l||void 0}return o}}}static schemaRules(t){let n=[];function r(i){let a=i.priority==null?50:i.priority,o=0;for(;o{r(o=DR(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in t.nodes){let a=t.nodes[i].spec.parseDOM;a&&a.forEach(o=>{r(o=DR(o)),o.node||o.ignore||o.mark||(o.node=i)})}return n}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}},JR={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},RG={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},eD={ol:!0,ul:!0},Zc=1,D1=2,Wc=4;function RR(e,t,n){return t!=null?(t?Zc:0)|(t==="full"?D1:0):e&&e.whitespace=="pre"?Zc|D1:n&~Wc}var Bl=class{constructor(t,n,r,i,a,o){this.type=t,this.attrs=n,this.marks=r,this.solid=i,this.options=o,this.content=[],this.activeMarks=Ie.none,this.match=a||(o&Wc?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(Q.from(t));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&Zc)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let a=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=a.withText(a.text.slice(0,a.text.length-i[0].length))}}let n=Q.from(this.content);return!t&&this.match&&(n=n.append(this.match.fillBefore(Q.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!JR.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},Qp=class{constructor(t,n,r){this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;let i=n.topNode,a,o=RR(null,n.preserveWhitespace,0)|(r?Wc:0);i?a=new Bl(i.type,i.attrs,Ie.none,!0,n.topMatch||i.type.contentMatch,o):r?a=new Bl(null,null,Ie.none,!0,null,o):a=new Bl(t.schema.topNodeType,null,Ie.none,!0,null,o),this.nodes=[a],this.find=n.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,n){t.nodeType==3?this.addTextNode(t,n):t.nodeType==1&&this.addElement(t,n)}addTextNode(t,n){let r=t.nodeValue,i=this.top,a=i.options&D1?"full":this.localPreserveWS||(i.options&Zc)>0,{schema:o}=this.parser;if(a==="full"||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(a)if(a==="full")r=r.replace(/\r\n?/g,` +`);else if(o.linebreakReplacement&&/[\r\n]/.test(r)&&this.top.findWrapping(o.linebreakReplacement.create())){let s=r.split(/\r?\n|\r/);for(let l=0;l!l.clearMark(u)):n=n.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)s=l;else break}}return n}addElementByRule(t,n,r,i){let a,o;if(n.node)if(o=this.parser.schema.nodes[n.node],o.isLeaf)this.insertNode(o.create(n.attrs),r,t.nodeName=="BR")||this.leafFallback(t,r);else{let l=this.enter(o,n.attrs||null,r,n.preserveWhitespace);l&&(a=!0,r=l)}else{let l=this.parser.schema.marks[n.mark];r=r.concat(l.create(n.attrs))}let s=this.top;if(o&&o.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(n.getContent)this.findInside(t),n.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r,!1));else{let l=t;typeof n.contentElement=="string"?l=t.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(t):n.contentElement&&(l=n.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}a&&this.sync(s)&&this.open--}addAll(t,n,r,i){let a=r||0;for(let o=r?t.childNodes[r]:t.firstChild,s=i==null?null:t.childNodes[i];o!=s;o=o.nextSibling,++a)this.findAtPoint(t,a),this.addDOM(o,n);this.findAtPoint(t,a)}findPlace(t,n,r){let i,a;for(let o=this.open,s=0;o>=0;o--){let l=this.nodes[o],u=l.findWrapping(t);if(u&&(!i||i.length>u.length+s)&&(i=u,a=l,!u.length))break;if(l.solid){if(r)break;s+=2}}if(!i)return null;this.sync(a);for(let o=0;o(o.type?o.type.allowsMarkType(u.type):IR(u.type,t))?(l=u.addToSet(l),!1):!0),this.nodes.push(new Bl(t,n,l,i,null,s)),this.open++,r}closeExtra(t=!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(t));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(t){for(let n=this.open;n>=0;n--){if(this.nodes[n]==t)return this.open=n,!0;this.localPreserveWS&&(this.nodes[n].options|=Zc)}return!1}get currentPos(){this.closeExtra();let t=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;n&&t++}return t}findAtPoint(t,n){if(this.find)for(let r=0;r-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let n=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),a=-(r?r.depth+1:0)+(i?0:1),o=(s,l)=>{for(;s>=0;s--){let u=n[s];if(u==""){if(s==n.length-1||s==0)continue;for(;l>=a;l--)if(o(s-1,l))return!0;return!1}else{let c=l>0||l==0&&i?this.nodes[l].type:r&&l>=a?r.node(l-a).type:null;if(!c||c.name!=u&&!c.isInGroup(u))return!1;l--}}return!0};return o(n.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let n=t.depth;n>=0;n--){let r=t.node(n).contentMatchAt(t.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 DG(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&eD.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):r=="li"?n=t:r&&(n=null)}}function IG(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function DR(e){let t={};for(let n in e)t[n]=e[n];return t}function IR(e,t){let n=t.schema.nodes;for(let r in n){let i=n[r];if(!i.allowsMarkType(e))continue;let a=[],o=s=>{a.push(s);for(let l=0;l{if(a.length||o.marks.length){let s=0,l=0;for(;s=0;i--){let a=this.serializeMark(t.marks[i],t.isInline,n);a&&((a.contentDOM||a.dom).appendChild(r),r=a.dom)}return r}serializeMark(t,n,r={}){let i=this.marks[t.type.name];return i&&Kp(Yp(r),i(t,n),null,t.attrs)}static renderSpec(t,n,r=null,i){return typeof n=="string"?{dom:t.createTextNode(n)}:Kp(t,n,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let n=LR(t.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(t){return LR(t.marks)}};function LR(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Yp(e){return e.document||window.document}var BR=new WeakMap;function LG(e){let t=BR.get(e);return t===void 0&&BR.set(e,t=BG(e)),t}function BG(e){let t=null;function n(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let i=0;i-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 o=i.indexOf(" ");o>0&&(n=i.slice(0,o),i=i.slice(o+1));let s,l=n?e.createElementNS(n,i):e.createElement(i),u=t[1],c=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){c=2;for(let f in u)if(u[f]!=null){let d=f.indexOf(" ");d>0?l.setAttributeNS(f.slice(0,d),f.slice(d+1),u[f]):f=="style"&&l.style?l.style.cssText=u[f]:l.setAttribute(f,u[f])}}for(let f=c;fc)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else if(typeof d=="string")l.appendChild(e.createTextNode(d));else{let{dom:h,contentDOM:m}=Kp(e,d,n,r);if(l.appendChild(h),m){if(s)throw new RangeError("Multiple content holes");s=m}}}return{dom:l,contentDOM:s}}var rD=65535,iD=Math.pow(2,16);function PG(e,t){return e+t*iD}function tD(e){return e&rD}function UG(e){return(e-(e&rD))/iD}var aD=1,oD=2,Zp=4,sD=8,tf=class{constructor(t,n,r){this.pos=t,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&sD)>0}get deletedBefore(){return(this.delInfo&(aD|Zp))>0}get deletedAfter(){return(this.delInfo&(oD|Zp))>0}get deletedAcross(){return(this.delInfo&Zp)>0}},Vi=class e{constructor(t,n=!1){if(this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}recover(t){let n=0,r=tD(t);if(!this.inverted)for(let i=0;it)break;let u=this.ranges[s+a],c=this.ranges[s+o],f=l+u;if(t<=f){let d=u?t==l?-1:t==f?1:n:n,h=l+i+(d<0?0:c);if(r)return h;let m=t==(n<0?l:f)?null:PG(s/3,t-l),b=t==l?oD:t==f?aD:Zp;return(n<0?t!=l:t!=f)&&(b|=sD),new tf(h,b,m)}i+=c-u}return r?t+i:new tf(t+i,0,null)}touches(t,n){let r=0,i=tD(n),a=this.inverted?2:1,o=this.inverted?1:2;for(let s=0;st)break;let u=this.ranges[s+a],c=l+u;if(t<=c&&s==i*3)return!0;r+=this.ranges[s+o]-u}return!1}forEach(t){let n=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,a=0;i=0;n--){let i=t.getMirror(n);this.appendMap(t._maps[n].invert(),i!=null&&i>n?r-i-1:void 0)}}invert(){let t=new e;return t.appendMappingInverted(this),t}map(t,n=1){if(this.mirror)return this._map(t,n,!0);for(let r=this.from;ra&&l!o.isAtom||!s.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),n.openStart,n.openEnd);return an.fromReplace(t,this.from,this.to,a)}invert(){return new Gi(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};jt.jsonID("addMark",rf);var Gi=class e extends jt{constructor(t,n,r){super(),this.from=t,this.to=n,this.mark=r}apply(t){let n=t.slice(this.from,this.to),r=new re(H1(n.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),n.openStart,n.openEnd);return an.fromReplace(t,this.from,this.to,r)}invert(){return new rf(this.from,this.to,this.mark)}map(t){let n=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new e(n.pos,r.pos,this.mark)}merge(t){return t instanceof e&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new e(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new e(n.from,n.to,t.markFromJSON(n.mark))}};jt.jsonID("removeMark",Gi);var af=class e extends jt{constructor(t,n){super(),this.pos=t,this.mark=n}apply(t){let n=t.nodeAt(this.pos);if(!n)return an.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return an.fromReplace(t,this.pos,this.pos+1,new re(Q.from(r),0,n.isLeaf?0:1))}invert(t){let n=t.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let i=0;ir.pos?null:new e(n.pos,r.pos,i,a,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,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 e(n.from,n.to,n.gapFrom,n.gapTo,re.fromJSON(t,n.slice),n.insert,!!n.structure)}};jt.jsonID("replaceAround",It);function P1(e,t,n){let r=e.resolve(t),i=n-t,a=r.depth;for(;i>0&&a>0&&r.indexAfter(a)==r.node(a).childCount;)a--,i--;if(i>0){let o=r.node(a).maybeChild(r.indexAfter(a));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function HG(e,t,n,r){let i=[],a=[],o,s;e.doc.nodesBetween(t,n,(l,u,c)=>{if(!l.isInline)return;let f=l.marks;if(!r.isInSet(f)&&c.type.allowsMarkType(r.type)){let d=Math.max(u,t),h=Math.min(u+l.nodeSize,n),m=r.addToSet(f);for(let b=0;be.step(l)),a.forEach(l=>e.step(l))}function zG(e,t,n,r){let i=[],a=0;e.doc.nodesBetween(t,n,(o,s)=>{if(!o.isInline)return;a++;let l=null;if(r instanceof Qc){let u=o.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(o.marks)&&(l=[r]):l=o.marks;if(l&&l.length){let u=Math.min(s+o.nodeSize,n);for(let c=0;ce.step(new Gi(o.from,o.to,o.style)))}function z1(e,t,n,r=n.contentMatch,i=!0){let a=e.doc.nodeAt(t),o=[],s=t+1;for(let l=0;l=0;l--)e.step(o[l])}function FG(e,t,n){return(t==0||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function Yi(e){let n=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let r=e.depth,i=0,a=0;;--r){let o=e.$from.node(r),s=e.$from.index(r)+i,l=e.$to.indexAfter(r)-a;if(rn;m--)b||r.index(m)>0?(b=!0,c=Q.from(r.node(m).copy(c)),f++):l--;let d=Q.empty,h=0;for(let m=a,b=!1;m>n;m--)b||i.after(m+1)=0;o--){if(r.size){let s=n[o].type.contentMatch.matchFragment(r);if(!s||!s.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=Q.from(n[o].type.create(n[o].attrs,r))}let i=t.start,a=t.end;e.step(new It(i,a,i,a,new re(r,0,0),n.length,!0))}function KG(e,t,n,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let a=e.steps.length;e.doc.nodesBetween(t,n,(o,s)=>{let l=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(r,l)&&$G(e.doc,e.mapping.slice(a).map(s),r)){let u=null;if(r.schema.linebreakReplacement){let h=r.whitespace=="pre",m=!!r.contentMatch.matchType(r.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&uD(e,o,s,a),z1(e,e.mapping.slice(a).map(s,1),r,void 0,u===null);let c=e.mapping.slice(a),f=c.map(s,1),d=c.map(s+o.nodeSize,1);return e.step(new It(f,d,f+1,d-1,new re(Q.from(r.create(l,null,o.marks)),0,0),1,!0)),u===!0&&lD(e,o,s,a),!1}})}function lD(e,t,n,r){t.forEach((i,a)=>{if(i.isText){let o,s=/\r?\n|\r/g;for(;o=s.exec(i.text);){let l=e.mapping.slice(r).map(n+1+a+o.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function uD(e,t,n,r){t.forEach((i,a)=>{if(i.type==i.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+a);e.replaceWith(o,o+1,t.type.schema.text(` +`))}})}function $G(e,t,n){let r=e.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,n)}function jG(e,t,n,r,i){let a=e.doc.nodeAt(t);if(!a)throw new RangeError("No node at given position");n||(n=a.type);let o=n.create(r,null,i||a.marks);if(a.isLeaf)return e.replaceWith(t,t+a.nodeSize,o);if(!n.validContent(a.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new It(t,t+a.nodeSize,t+1,t+a.nodeSize-1,new re(Q.from(o),0,0),1,!0))}function ur(e,t,n=1,r){let i=e.resolve(t),a=i.depth-n,o=r&&r[r.length-1]||i.parent;if(a<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let u=i.depth-1,c=n-2;u>a;u--,c--){let f=i.node(u),d=i.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(d,f.childCount),m=r&&r[c+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let b=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!b.type.validContent(h))return!1}let s=i.indexAfter(a),l=r&&r[0];return i.node(a).canReplaceWith(s,s,l?l.type:i.node(a+1).type)}function XG(e,t,n=1,r){let i=e.doc.resolve(t),a=Q.empty,o=Q.empty;for(let s=i.depth,l=i.depth-n,u=n-1;s>l;s--,u--){a=Q.from(i.node(s).copy(a));let c=r&&r[u];o=Q.from(c?c.type.create(c.attrs,o):i.node(s).copy(o))}e.step(new on(t,t,new re(a.append(o),n,n),!0))}function zr(e,t){let n=e.resolve(t),r=n.index();return cD(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function WG(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let i=0;i0?(a=r.node(i+1),s++,o=r.node(i).maybeChild(s)):(a=r.node(i).maybeChild(s-1),o=r.node(i+1)),a&&!a.isTextblock&&cD(a,o)&&r.node(i).canReplace(s,s+1))return t;if(i==0)break;t=n<0?r.before(i):r.after(i)}}function QG(e,t,n){let r=null,{linebreakReplacement:i}=e.doc.type.schema,a=e.doc.resolve(t-n),o=a.node().type;if(i&&o.inlineContent){let c=o.whitespace=="pre",f=!!o.contentMatch.matchType(i);c&&!f?r=!1:!c&&f&&(r=!0)}let s=e.steps.length;if(r===!1){let c=e.doc.resolve(t+n);uD(e,c.node(),c.before(),s)}o.inlineContent&&z1(e,t+n-1,o,a.node().contentMatchAt(a.index()),r==null);let l=e.mapping.slice(s),u=l.map(t-n);if(e.step(new on(u,l.map(t+n,-1),re.empty,!0)),r===!0){let c=e.doc.resolve(u);lD(e,c.node(),c.before(),e.steps.length)}return e}function ZG(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let a=r.index(i);if(r.node(i).canReplaceWith(a,a,n))return r.before(i+1);if(a>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let a=r.indexAfter(i);if(r.node(i).canReplaceWith(a,a,n))return r.after(i+1);if(a=0;o--){let s=o==r.depth?0:r.pos<=(r.start(o+1)+r.end(o+1))/2?-1:1,l=r.index(o)+(s>0?1:0),u=r.node(o),c=!1;if(a==1)c=u.canReplace(l,l,i);else{let f=u.contentMatchAt(l).findWrapping(i.firstChild.type);c=f&&u.canReplaceWith(l,l,f[0])}if(c)return s==0?r.pos:s<0?r.before(o+1):r.after(o+1)}return null}function sf(e,t,n=t,r=re.empty){if(t==n&&!r.size)return null;let i=e.resolve(t),a=e.resolve(n);return dD(i,a,r)?new on(t,n,r):new U1(i,a,r).fit()}function dD(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}var U1=class{constructor(t,n,r){this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=Q.empty;for(let i=0;i<=t.depth;i++){let a=t.node(i);this.frontier.push({type:a.type,match:a.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=Q.from(t.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let a=this.placed,o=r.depth,s=i.depth;for(;o&&s&&a.childCount==1;)a=a.firstChild.content,o--,s--;let l=new re(a,o,s);return t>-1?new It(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new on(r.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,i=this.unplaced.openEnd;r1&&(i=0),a.type.spec.isolating&&i<=r){t=r;break}n=a.content}for(let n=1;n<=2;n++)for(let r=n==1?t:this.unplaced.openStart;r>=0;r--){let i,a=null;r?(a=L1(this.unplaced.content,r-1).firstChild,i=a.content):i=this.unplaced.content;let o=i.firstChild;for(let s=this.depth;s>=0;s--){let{type:l,match:u}=this.frontier[s],c,f=null;if(n==1&&(o?u.matchType(o.type)||(f=u.fillBefore(Q.from(o),!1)):a&&l.compatibleContent(a.type)))return{sliceDepth:r,frontierDepth:s,parent:a,inject:f};if(n==2&&o&&(c=u.findWrapping(o.type)))return{sliceDepth:r,frontierDepth:s,parent:a,wrap:c};if(a&&u.matchType(a.type))break}}}openMore(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=L1(t,n);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new re(t,n+1,Math.max(r,i.size+n>=t.size-r?n+1:0)),!0)}dropNode(){let{content:t,openStart:n,openEnd:r}=this.unplaced,i=L1(t,n);if(i.childCount<=1&&n>0){let a=t.size-n<=n+i.size;this.unplaced=new re(Jc(t,n-1,1),n-1,a?n-1:r)}else this.unplaced=new re(Jc(t,n,1),n,r)}placeNodes({sliceDepth:t,frontierDepth:n,parent:r,inject:i,wrap:a}){for(;this.depth>n;)this.closeFrontierNode();if(a)for(let b=0;b1||l==0||b.content.size)&&(f=E,c.push(hD(b.mark(d.allowedMarks(b.marks)),u==1?l:0,u==s.childCount?h:-1)))}let m=u==s.childCount;m||(h=-1),this.placed=ef(this.placed,n,Q.from(c)),this.frontier[n].match=f,m&&h<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let b=0,E=s;b1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){e:for(let n=Math.min(this.depth,t.depth);n>=0;n--){let{match:r,type:i}=this.frontier[n],a=n=0;s--){let{match:l,type:u}=this.frontier[s],c=B1(t,s,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:o,move:a?t.doc.resolve(t.after(n+1)):t}}}}close(t){let n=this.findCloseLevel(t);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=ef(this.placed,n.depth,n.fit)),t=n.move;for(let r=n.depth+1;r<=t.depth;r++){let i=t.node(r),a=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,a)}return t}openFrontierNode(t,n=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=ef(this.placed,this.depth,Q.from(t.create(n,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(Q.empty,!0);n.childCount&&(this.placed=ef(this.placed,this.frontier.length,n))}};function Jc(e,t,n){return t==0?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(Jc(e.firstChild.content,t-1,n)))}function ef(e,t,n){return t==0?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(ef(e.lastChild.content,t-1,n)))}function L1(e,t){for(let n=0;n1&&(r=r.replaceChild(0,hD(r.firstChild,t-1,r.childCount==1?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(Q.empty,!0)))),e.copy(r)}function B1(e,t,n,r,i){let a=e.node(t),o=i?e.indexAfter(t):e.index(t);if(o==a.childCount&&!n.compatibleContent(a.type))return null;let s=r.fillBefore(a.content,!0,o);return s&&!JG(n,a.content,o)?s:null}function JG(e,t,n){for(let r=n;r0;d--,h--){let m=i.node(d).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;o.indexOf(d)>-1?s=d:i.before(d)==h&&o.splice(1,0,-d)}let l=o.indexOf(s),u=[],c=r.openStart;for(let d=r.content,h=0;;h++){let m=d.firstChild;if(u.push(m),h==r.openStart)break;d=m.content}for(let d=c-1;d>=0;d--){let h=u[d],m=eY(h.type);if(m&&!h.sameMarkup(i.node(Math.abs(s)-1)))c=d;else if(m||!h.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let h=(d+c+1)%(r.openStart+1),m=u[h];if(m)for(let b=0;b=0&&(e.replace(t,n,r),!(e.steps.length>f));d--){let h=o[d];h<0||(t=i.before(h),n=a.after(h))}}function pD(e,t,n,r,i){if(tr){let a=i.contentMatchAt(0),o=a.fillBefore(e).append(e);e=o.append(a.matchFragment(o).fillBefore(Q.empty,!0))}return e}function nY(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let i=ZG(e.doc,t,r.type);i!=null&&(t=n=i)}e.replaceRange(t,n,new re(Q.from(r),0,0))}function rY(e,t,n){let r=e.doc.resolve(t),i=e.doc.resolve(n);if(r.parent.isTextblock&&i.parent.isTextblock&&r.start()!=i.start()&&r.parentOffset==0&&i.parentOffset==0){let o=r.sharedDepth(n),s=!1;for(let l=r.depth;l>o;l--)r.node(l).type.spec.isolating&&(s=!0);for(let l=i.depth;l>o;l--)i.node(l).type.spec.isolating&&(s=!0);if(!s){for(let l=r.depth;l>0&&t==r.start(l);l--)t=r.before(l);for(let l=i.depth;l>0&&n==i.start(l);l--)n=i.before(l);r=e.doc.resolve(t),i=e.doc.resolve(n)}}let a=mD(r,i);for(let o=0;o0&&(l||r.node(s-1).canReplace(r.index(s-1),i.indexAfter(s-1))))return e.delete(r.before(s),i.after(s))}for(let o=1;o<=r.depth&&o<=i.depth;o++)if(t-r.start(o)==r.depth-o&&n>r.end(o)&&i.end(o)-n!=i.depth-o&&r.start(o-1)==i.start(o-1)&&r.node(o-1).canReplace(r.index(o-1),i.index(o-1)))return e.delete(r.before(o),n);e.delete(t,n)}function mD(e,t){let n=[],r=Math.min(e.depth,t.depth);for(let i=r;i>=0;i--){let a=e.start(i);if(at.pos+(t.depth-i)||e.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(a==t.start(i)||i==e.depth&&i==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==a-1)&&n.push(i)}return n}var Jp=class e extends jt{constructor(t,n,r){super(),this.pos=t,this.attr=n,this.value=r}apply(t){let n=t.nodeAt(this.pos);if(!n)return an.fail("No node at attribute step's position");let r=Object.create(null);for(let a in n.attrs)r[a]=n.attrs[a];r[this.attr]=this.value;let i=n.type.create(r,null,n.marks);return an.fromReplace(t,this.pos,this.pos+1,new re(Q.from(i),0,n.isLeaf?0:1))}getMap(){return Vi.empty}invert(t){return new e(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let n=t.mapResult(this.pos,1);return n.deletedAfter?null:new e(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new e(n.pos,n.attr,n.value)}};jt.jsonID("attr",Jp);var em=class e extends jt{constructor(t,n){super(),this.attr=t,this.value=n}apply(t){let n=Object.create(null);for(let i in t.attrs)n[i]=t.attrs[i];n[this.attr]=this.value;let r=t.type.create(n,t.content,t.marks);return an.ok(r)}getMap(){return Vi.empty}invert(t){return new e(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new e(n.attr,n.value)}};jt.jsonID("docAttr",em);var Hl=class extends Error{};Hl=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n};Hl.prototype=Object.create(Error.prototype);Hl.prototype.constructor=Hl;Hl.prototype.name="TransformError";var zl=class{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new nf}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let n=this.maybeStep(t);if(n.failed)throw new Hl(n.failed);return this}maybeStep(t){let n=t.apply(this.doc);return n.failed||this.addStep(t,n.doc),n}get docChanged(){return this.steps.length>0}changedRange(){let t=1e9,n=-1e9;for(let r=0;r{t=Math.min(t,s),n=Math.max(n,l)})}return t==1e9?null:{from:t,to:n}}addStep(t,n){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=n}replace(t,n=t,r=re.empty){let i=sf(this.doc,t,n,r);return i&&this.step(i),this}replaceWith(t,n,r){return this.replace(t,n,new re(Q.from(r),0,0))}delete(t,n){return this.replace(t,n,re.empty)}insert(t,n){return this.replaceWith(t,t,n)}replaceRange(t,n,r){return tY(this,t,n,r),this}replaceRangeWith(t,n,r){return nY(this,t,n,r),this}deleteRange(t,n){return rY(this,t,n),this}lift(t,n){return qG(this,t,n),this}join(t,n=1){return QG(this,t,n),this}wrap(t,n){return YG(this,t,n),this}setBlockType(t,n=t,r,i=null){return KG(this,t,n,r,i),this}setNodeMarkup(t,n,r=null,i){return jG(this,t,n,r,i),this}setNodeAttribute(t,n,r){return this.step(new Jp(t,n,r)),this}setDocAttribute(t,n){return this.step(new em(t,n)),this}addNodeMark(t,n){return this.step(new af(t,n)),this}removeNodeMark(t,n){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(n instanceof Ie)n.isInSet(r.marks)&&this.step(new Ul(t,n));else{let i=r.marks,a,o=[];for(;a=n.isInSet(i);)o.push(new Ul(t,a)),i=a.removeFromSet(i);for(let s=o.length-1;s>=0;s--)this.step(o[s])}return this}split(t,n=1,r){return XG(this,t,n,r),this}addMark(t,n,r){return HG(this,t,n,r),this}removeMark(t,n,r){return zG(this,t,n,r),this}clearIncompatible(t,n,r){return z1(this,t,n,r),this}};var F1=Object.create(null),Ce=class{constructor(t,n,r){this.$anchor=t,this.$head=n,this.ranges=r||[new nm(t.min(n),t.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 t=this.ranges;for(let n=0;n=0;a--){let o=n<0?Fl(t.node(0),t.node(a),t.before(a+1),t.index(a),n,r):Fl(t.node(0),t.node(a),t.after(a+1),t.index(a)+1,n,r);if(o)return o}return null}static near(t,n=1){return this.findFrom(t,n)||this.findFrom(t,-n)||new Nn(t.node(0))}static atStart(t){return Fl(t,t,0,0,1)||new Nn(t)}static atEnd(t){return Fl(t,t,t.content.size,t.childCount,-1)||new Nn(t)}static fromJSON(t,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=F1[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(t,n)}static jsonID(t,n){if(t in F1)throw new RangeError("Duplicate use of selection JSON ID "+t);return F1[t]=n,n.prototype.jsonID=t,n}getBookmark(){return pe.between(this.$anchor,this.$head).getBookmark()}};Ce.prototype.visible=!0;var nm=class{constructor(t,n){this.$from=t,this.$to=n}},gD=!1;function bD(e){!gD&&!e.parent.inlineContent&&(gD=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var pe=class e extends Ce{constructor(t,n=t){bD(t),bD(n),super(t,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,n){let r=t.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ce.near(r);let i=t.resolve(n.map(this.anchor));return new e(i.parent.inlineContent?i:r,r)}replace(t,n=re.empty){if(super.replace(t,n),n==re.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof e&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new rm(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){let i=t.resolve(n);return new this(i,r==n?i:t.resolve(r))}static between(t,n,r){let i=t.pos-n.pos;if((!r||i)&&(r=i>=0?1:-1),!n.parent.inlineContent){let a=Ce.findFrom(n,r,!0)||Ce.findFrom(n,-r,!0);if(a)n=a.$head;else return Ce.near(n,r)}return t.parent.inlineContent||(i==0?t=n:(t=(Ce.findFrom(t,-r,!0)||Ce.findFrom(t,r,!0)).$anchor,t.pos0?0:1);i>0?o=0;o+=i){let s=t.child(o);if(s.isAtom){if(!a&&fe.isSelectable(s))return fe.create(e,n-(i<0?s.nodeSize:0))}else{let l=Fl(e,s,n+i,i<0?s.childCount:0,i,a);if(l)return l}n+=s.nodeSize*i}return null}function ED(e,t,n){let r=e.steps.length-1;if(r{o==null&&(o=c)}),e.setSelection(Ce.near(e.doc.resolve(o),n))}var yD=1,tm=2,TD=4,G1=class extends zl{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=tm,this}ensureMarks(t){return Ie.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&tm)>0}addStep(t,n){super.addStep(t,n),this.updated=this.updated&~tm,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,n=!0){let r=this.selection;return n&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ie.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,n,r){let i=this.doc.type.schema;if(n==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=n),!t)return this.deleteRange(n,r);let a=this.storedMarks;if(!a){let o=this.doc.resolve(n);a=r==n?o.marks():o.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,i.text(t,a)),!this.selection.empty&&this.selection.to==n+t.length&&this.setSelection(Ce.near(this.selection.$to)),this}}setMeta(t,n){return this.meta[typeof t=="string"?t:t.key]=n,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=TD,this}get scrolledIntoView(){return(this.updated&TD)>0}};function SD(e,t){return!t||!e?e:e.bind(t)}var es=class{constructor(t,n,r){this.name=t,this.init=SD(n.init,r),this.apply=SD(n.apply,r)}},aY=[new es("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new es("selection",{init(e,t){return e.selection||Ce.atStart(t.doc)},apply(e){return e.selection}}),new es("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new es("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}})],lf=class{constructor(t,n){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=aY.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 es(r.key,r.spec.state,r))})}},im=class e{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,n=-1){for(let r=0;rr.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],a=i.spec.state;a&&a.toJSON&&(n[r]=a.toJSON.call(i,this[i.key]))}return n}static fromJSON(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new lf(t.schema,t.plugins),a=new e(i);return i.fields.forEach(o=>{if(o.name=="doc")a.doc=Vn.fromJSON(t.schema,n.doc);else if(o.name=="selection")a.selection=Ce.fromJSON(a.doc,n.selection);else if(o.name=="storedMarks")n.storedMarks&&(a.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let s in r){let l=r[s],u=l.spec.state;if(l.key==o.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,s)){a[o.name]=u.fromJSON.call(l,t,n[s],a);return}}a[o.name]=o.init(t,a)}}),a}};function _D(e,t,n){for(let r in e){let i=e[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=_D(i,t,{})),n[r]=i}return n}var Ue=class{constructor(t){this.spec=t,this.props={},t.props&&_D(t.props,this,this.props),this.key=t.key?t.key.key:xD("plugin")}getState(t){return t[this.key]}},q1=Object.create(null);function xD(e){return e in q1?e+"$"+ ++q1[e]:(q1[e]=0,e+"$")}var at=class{constructor(t="key"){this.key=xD(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}};var CD=(e,t)=>e.selection.empty?!1:(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function ND(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var K1=(e,t,n)=>{let r=ND(e,n);if(!r)return!1;let i=j1(r);if(!i){let o=r.blockRange(),s=o&&Yi(o);return s==null?!1:(t&&t(e.tr.lift(o,s).scrollIntoView()),!0)}let a=i.nodeBefore;if(LD(e,i,t,-1))return!0;if(r.parent.content.size==0&&(ql(a,"end")||fe.isSelectable(a)))for(let o=r.depth;;o--){let s=sf(e.doc,r.before(o),r.after(o),re.empty);if(s&&s.slice.size1)break}return a.isAtom&&i.depth==r.depth-1?(t&&t(e.tr.delete(i.pos-a.nodeSize,i.pos).scrollIntoView()),!0):!1},vD=(e,t,n)=>{let r=ND(e,n);if(!r)return!1;let i=j1(r);return i?wD(e,i,t):!1},kD=(e,t,n)=>{let r=MD(e,n);if(!r)return!1;let i=Q1(r);return i?wD(e,i,t):!1};function wD(e,t,n){let r=t.nodeBefore,i=r,a=t.pos-1;for(;!i.isTextblock;a--){if(i.type.spec.isolating)return!1;let c=i.lastChild;if(!c)return!1;i=c}let o=t.nodeAfter,s=o,l=t.pos+1;for(;!s.isTextblock;l++){if(s.type.spec.isolating)return!1;let c=s.firstChild;if(!c)return!1;s=c}let u=sf(e.doc,a,l,re.empty);if(!u||u.from!=a||u instanceof on&&u.slice.size>=l-a)return!1;if(n){let c=e.tr.step(u);c.setSelection(pe.create(c.doc,a)),n(c.scrollIntoView())}return!0}function ql(e,t,n=!1){for(let r=e;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&r.childCount!=1)return!1}return!1}var $1=(e,t,n)=>{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;a=j1(r)}let o=a&&a.nodeBefore;return!o||!fe.isSelectable(o)?!1:(t&&t(e.tr.setSelection(fe.create(e.doc,a.pos-o.nodeSize)).scrollIntoView()),!0)};function j1(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function MD(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset{let r=MD(e,n);if(!r)return!1;let i=Q1(r);if(!i)return!1;let a=i.nodeAfter;if(LD(e,i,t,1))return!0;if(r.parent.content.size==0&&(ql(a,"start")||fe.isSelectable(a))){let o=sf(e.doc,r.before(),r.after(),re.empty);if(o&&o.slice.size{let{$head:r,empty:i}=e.selection,a=r;if(!i)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset=0;t--){let n=e.node(t);if(e.index(t)+1{let n=e.selection,r=n instanceof fe,i;if(r){if(n.node.isTextblock||!zr(e.doc,n.from))return!1;i=n.from}else if(i=Jo(e.doc,n.from,-1),i==null)return!1;if(t){let a=e.tr.join(i);r&&a.setSelection(fe.create(a.doc,i-e.doc.resolve(i).nodeBefore.nodeSize)),t(a.scrollIntoView())}return!0},RD=(e,t)=>{let n=e.selection,r;if(n instanceof fe){if(n.node.isTextblock||!zr(e.doc,n.to))return!1;r=n.to}else if(r=Jo(e.doc,n.to,1),r==null)return!1;return t&&t(e.tr.join(r).scrollIntoView()),!0},DD=(e,t)=>{let{$from:n,$to:r}=e.selection,i=n.blockRange(r),a=i&&Yi(i);return a==null?!1:(t&&t(e.tr.lift(i,a).scrollIntoView()),!0)},Z1=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(t&&t(e.tr.insertText(` +`).scrollIntoView()),!0)};function J1(e){for(let t=0;t{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let i=n.node(-1),a=n.indexAfter(-1),o=J1(i.contentMatchAt(a));if(!o||!i.canReplaceWith(a,a,o))return!1;if(t){let s=n.after(),l=e.tr.replaceWith(s,s,o.createAndFill());l.setSelection(Ce.near(l.doc.resolve(s),1)),t(l.scrollIntoView())}return!0},tT=(e,t)=>{let n=e.selection,{$from:r,$to:i}=n;if(n instanceof Nn||r.parent.inlineContent||i.parent.inlineContent)return!1;let a=J1(i.parent.contentMatchAt(i.indexAfter()));if(!a||!a.isTextblock)return!1;if(t){let o=(!r.parentOffset&&i.index(){let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let a=n.before();if(ur(e.doc,a))return t&&t(e.tr.split(a).scrollIntoView()),!0}let r=n.blockRange(),i=r&&Yi(r);return i==null?!1:(t&&t(e.tr.lift(r,i).scrollIntoView()),!0)};function oY(e){return(t,n)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof fe&&t.selection.node.isBlock)return!r.parentOffset||!ur(t.doc,r.pos)?!1:(n&&n(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let a=[],o,s,l=!1,u=!1;for(let h=r.depth;;h--)if(r.node(h).isBlock){l=r.end(h)==r.pos+(r.depth-h),u=r.start(h)==r.pos-(r.depth-h),s=J1(r.node(h-1).contentMatchAt(r.indexAfter(h-1)));let b=e&&e(i.parent,l,r);a.unshift(b||(l&&s?{type:s}:null)),o=h;break}else{if(h==1)return!1;a.unshift(null)}let c=t.tr;(t.selection instanceof pe||t.selection instanceof Nn)&&c.deleteSelection();let f=c.mapping.map(r.pos),d=ur(c.doc,f,a.length,a);if(d||(a[0]=s?{type:s}:null,d=ur(c.doc,f,a.length,a)),!d)return!1;if(c.split(f,a.length,a),!l&&u&&r.node(o).type!=s){let h=c.mapping.map(r.before(o)),m=c.doc.resolve(h);s&&r.node(o-1).canReplaceWith(m.index(),m.index()+1,s)&&c.setNodeMarkup(c.mapping.map(r.before(o)),s)}return n&&n(c.scrollIntoView()),!0}}var sY=oY();var ID=(e,t)=>{let{$from:n,to:r}=e.selection,i,a=n.sharedDepth(r);return a==0?!1:(i=n.before(a),t&&t(e.tr.setSelection(fe.create(e.doc,i))),!0)},lY=(e,t)=>(t&&t(e.tr.setSelection(new Nn(e.doc))),!0);function uY(e,t,n){let r=t.nodeBefore,i=t.nodeAfter,a=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(a-1,a)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(a,a+1)||!(i.isTextblock||zr(e.doc,t.pos))?!1:(n&&n(e.tr.join(t.pos).scrollIntoView()),!0)}function LD(e,t,n,r){let i=t.nodeBefore,a=t.nodeAfter,o,s,l=i.type.spec.isolating||a.type.spec.isolating;if(!l&&uY(e,t,n))return!0;let u=!l&&t.parent.canReplace(t.index(),t.index()+1);if(u&&(o=(s=i.contentMatchAt(i.childCount)).findWrapping(a.type))&&s.matchType(o[0]||a.type).validEnd){if(n){let h=t.pos+a.nodeSize,m=Q.empty;for(let g=o.length-1;g>=0;g--)m=Q.from(o[g].create(null,m));m=Q.from(i.copy(m));let b=e.tr.step(new It(t.pos-1,h,t.pos,h,new re(m,1,0),o.length,!0)),E=b.doc.resolve(h+2*o.length);E.nodeAfter&&E.nodeAfter.type==i.type&&zr(b.doc,E.pos)&&b.join(E.pos),n(b.scrollIntoView())}return!0}let c=a.type.spec.isolating||r>0&&l?null:Ce.findFrom(t,1),f=c&&c.$from.blockRange(c.$to),d=f&&Yi(f);if(d!=null&&d>=t.depth)return n&&n(e.tr.lift(f,d).scrollIntoView()),!0;if(u&&ql(a,"start",!0)&&ql(i,"end")){let h=i,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let b=a,E=1;for(;!b.isTextblock;b=b.firstChild)E++;if(h.canReplace(h.childCount,h.childCount,b.content)){if(n){let g=Q.empty;for(let T=m.length-1;T>=0;T--)g=Q.from(m[T].copy(g));let y=e.tr.step(new It(t.pos-m.length,t.pos+a.nodeSize,t.pos+E,t.pos+a.nodeSize-E,new re(g,m.length,0),0,!0));n(y.scrollIntoView())}return!0}}return!1}function BD(e){return function(t,n){let r=t.selection,i=e<0?r.$from:r.$to,a=i.depth;for(;i.node(a).isInline;){if(!a)return!1;a--}return i.node(a).isTextblock?(n&&n(t.tr.setSelection(pe.create(t.doc,e<0?i.start(a):i.end(a)))),!0):!1}}var rT=BD(-1),iT=BD(1);function PD(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a),s=o&&of(o,e,t);return s?(r&&r(n.tr.wrap(o,s).scrollIntoView()),!0):!1}}function aT(e,t=null){return function(n,r){let i=!1;for(let a=0;a{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(e,t)))if(l.type==e)i=!0;else{let c=n.doc.resolve(u),f=c.index();i=c.parent.canReplaceWith(f,f+1,e)}})}if(!i)return!1;if(r){let a=n.tr;for(let o=0;o=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let l=o.resolve(t.start-2);a=new Qo(l,l,t.depth),t.endIndex=0;c--)a=Q.from(n[c].type.create(n[c].attrs,a));e.step(new It(t.start-(r?2:0),t.end,t.start,t.end,new re(a,0,0),n.length,!0));let o=0;for(let c=0;co.childCount>0&&o.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?hY(t,n,e,a):pY(t,n,a):!0:!1}}function hY(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);ab;m--)h-=i.child(m).nodeSize,r.delete(h-1,h+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,l=n.endIndex==i.childCount,u=a.node(-1),c=a.index(-1);if(!u.canReplace(c+(s?0:1),c+1,o.content.append(l?Q.empty:Q.from(i))))return!1;let f=a.pos,d=f+o.nodeSize;return r.step(new It(f-(s?1:0),d+(l?1:0),f+1,d-1,new re((s?Q.empty:Q.from(i.copy(Q.empty))).append(l?Q.empty:Q.from(i.copy(Q.empty))),s?0:1,l?0:1),s?0:1)),t(r.scrollIntoView()),!0}function zD(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,u=>u.childCount>0&&u.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,l=s.child(o-1);if(l.type!=e)return!1;if(n){let u=l.lastChild&&l.lastChild.type==s.type,c=Q.from(u?e.create():null),f=new re(Q.from(e.create(null,Q.from(s.type.create(null,c)))),u?3:1,0),d=a.start,h=a.end;n(t.tr.step(new It(d-(u?3:1),h,d,h,f,1,!0)).scrollIntoView())}return!0}}var sn=function(e){for(var t=0;;t++)if(e=e.previousSibling,!e)return t},Kl=function(e){let t=e.assignedSlot||e.parentNode;return t&&t.nodeType==11?t.host:t},dT=null,$i=function(e,t,n){let r=dT||(dT=document.createRange());return r.setEnd(e,n??e.nodeValue.length),r.setStart(e,t||0),r},mY=function(){dT=null},ls=function(e,t,n,r){return n&&(FD(e,t,n,r,-1)||FD(e,t,n,r,1))},gY=/^(img|br|input|textarea|hr)$/i;function FD(e,t,n,r,i){for(var a;;){if(e==n&&t==r)return!0;if(t==(i<0?0:Nr(e))){let o=e.parentNode;if(!o||o.nodeType!=1||gf(e)||gY.test(e.nodeName)||e.contentEditable=="false")return!1;t=sn(e)+(i<0?0:1),e=o}else if(e.nodeType==1){let o=e.childNodes[t+(i<0?-1:0)];if(o.nodeType==1&&o.contentEditable=="false")if(!((a=o.pmViewDesc)===null||a===void 0)&&a.ignoreForSelection)t+=i;else return!1;else e=o,t=i<0?Nr(e):0}else return!1}}function Nr(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function bY(e,t){for(;;){if(e.nodeType==3&&t)return e;if(e.nodeType==1&&t>0){if(e.contentEditable=="false")return null;e=e.childNodes[t-1],t=Nr(e)}else if(e.parentNode&&!gf(e))t=sn(e),e=e.parentNode;else return null}}function EY(e,t){for(;;){if(e.nodeType==3&&t2),Cr=$l||(oi?/Mac/.test(oi.platform):!1),SI=oi?/Win/.test(oi.platform):!1,ji=/Android \d/.test(Qa),bf=!!qD&&"webkitFontSmoothing"in qD.documentElement.style,_Y=bf?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function xY(e){let t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Ki(e,t){return typeof e=="number"?e:e[t]}function AY(e){let t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function VD(e,t,n){let r=e.someProp("scrollThreshold")||0,i=e.someProp("scrollMargin")||5,a=e.dom.ownerDocument;for(let o=n||e.dom;o;){if(o.nodeType!=1){o=Kl(o);continue}let s=o,l=s==a.body,u=l?xY(a):AY(s),c=0,f=0;if(t.topu.bottom-Ki(r,"bottom")&&(f=t.bottom-t.top>u.bottom-u.top?t.top+Ki(i,"top")-u.top:t.bottom-u.bottom+Ki(i,"bottom")),t.leftu.right-Ki(r,"right")&&(c=t.right-u.right+Ki(i,"right")),c||f)if(l)a.defaultView.scrollBy(c,f);else{let h=s.scrollLeft,m=s.scrollTop;f&&(s.scrollTop+=f),c&&(s.scrollLeft+=c);let b=s.scrollLeft-h,E=s.scrollTop-m;t={left:t.left-b,top:t.top-E,right:t.right-b,bottom:t.bottom-E}}let d=l?"fixed":getComputedStyle(o).position;if(/^(fixed|sticky)$/.test(d))break;o=d=="absolute"?o.offsetParent:Kl(o)}}function CY(e){let t=e.dom.getBoundingClientRect(),n=Math.max(0,t.top),r,i;for(let a=(t.left+t.right)/2,o=n+1;o=n-20){r=s,i=l.top;break}}return{refDOM:r,refTop:i,stack:_I(e.dom)}}function _I(e){let t=[],n=e.ownerDocument;for(let r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=Kl(r));return t}function NY({refDOM:e,refTop:t,stack:n}){let r=e?e.getBoundingClientRect().top:0;xI(n,r==0?0:r-t)}function xI(e,t){for(let n=0;n=s){o=Math.max(m.bottom,o),s=Math.min(m.top,s);let b=m.left>t.left?m.left-t.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>t.top&&!l&&m.left<=t.left&&m.right>=t.left&&(l=c,u={left:Math.max(m.left,Math.min(m.right,t.left)),top:m.top});!n&&(t.left>=m.right&&t.top>=m.top||t.left>=m.left&&t.top>=m.bottom)&&(a=f+1)}}return!n&&l&&(n=l,i=u,r=0),n&&n.nodeType==3?kY(n,i):!n||r&&n.nodeType==1?{node:e,offset:a}:AI(n,i)}function kY(e,t){let n=e.nodeValue.length,r=document.createRange(),i;for(let a=0;a=(o.left+o.right)/2?1:0)};break}}return r.detach(),i||{node:e,offset:0}}function OT(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function wY(e,t){let n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left(o.left+o.right)/2?1:-1}return e.docView.posFromDOM(r,i,a)}function OY(e,t,n,r){let i=-1;for(let a=t,o=!1;a!=e.dom;){let s=e.docView.nearestDesc(a,!0),l;if(!s)return null;if(s.dom.nodeType==1&&(s.node.isBlock&&s.parent||!s.contentDOM)&&((l=s.dom.getBoundingClientRect()).width||l.height)&&(s.node.isBlock&&s.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(s.dom.nodeName)&&(!o&&l.left>r.left||l.top>r.top?i=s.posBefore:(!o&&l.right-1?i:e.docView.posFromDOM(t,n,-1)}function CI(e,t,n){let r=e.childNodes.length;if(r&&n.topt.top&&i++}let u;bf&&i&&r.nodeType==1&&(u=r.childNodes[i-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=t.top&&i--,r==e.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(s=OY(e,r,i,t))}s==null&&(s=MY(e,o,t));let l=e.docView.nearestDesc(o,!0);return{pos:s,inside:l?l.posAtStart-l.border:-1}}function GD(e){return e.top=0&&i==r.nodeValue.length?(l--,c=1):n<0?l--:u++,uf($a($i(r,l,u),c),c<0)}if(!e.state.doc.resolve(t-(a||0)).parent.inlineContent){if(a==null&&i&&(n<0||i==Nr(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return sT(l.getBoundingClientRect(),!1)}if(a==null&&i=0)}if(a==null&&i&&(n<0||i==Nr(r))){let l=r.childNodes[i-1],u=l.nodeType==3?$i(l,Nr(l)-(o?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return uf($a(u,1),!1)}if(a==null&&i=0)}function uf(e,t){if(e.width==0)return e;let n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function sT(e,t){if(e.height==0)return e;let n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function vI(e,t,n){let r=e.state,i=e.root.activeElement;r!=t&&e.updateState(t),i!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),i!=e.dom&&i&&i.focus()}}function IY(e,t,n){let r=t.selection,i=n=="up"?r.$from:r.$to;return vI(e,t,()=>{let{node:a}=e.docView.domFromPos(i.pos,n=="up"?-1:1);for(;;){let s=e.docView.nearestDesc(a,!0);if(!s)break;if(s.node.isBlock){a=s.contentDOM||s.dom;break}a=s.dom.parentNode}let o=NI(e,i.pos,1);for(let s=a.firstChild;s;s=s.nextSibling){let l;if(s.nodeType==1)l=s.getClientRects();else if(s.nodeType==3)l=$i(s,0,s.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?o.top-c.top>(c.bottom-o.top)*2:c.bottom-o.bottom>(o.bottom-c.top)*2))return!1}}return!0})}var LY=/[\u0590-\u08ac]/;function BY(e,t,n){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,a=!i,o=i==r.parent.content.size,s=e.domSelection();return s?!LY.test(r.parent.textContent)||!s.modify?n=="left"||n=="backward"?a:o:vI(e,t,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:f}=e.domSelectionRange(),d=s.caretBidiLevel;s.modify("move",n,"character");let h=r.depth?e.docView.domAfterPos(r.before()):e.dom,{focusNode:m,focusOffset:b}=e.domSelectionRange(),E=m&&!h.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==b;try{s.collapse(c,f),l&&(l!=c||u!=f)&&s.extend&&s.extend(l,u)}catch{}return d!=null&&(s.caretBidiLevel=d),E}):r.pos==r.start()||r.pos==r.end()}var YD=null,KD=null,$D=!1;function PY(e,t,n){return YD==t&&KD==n?$D:(YD=t,KD=n,$D=n=="up"||n=="down"?IY(e,t,n):BY(e,t,n))}var kr=0,jD=1,ns=2,si=3,us=class{constructor(t,n,r,i){this.parent=t,this.children=n,this.dom=r,this.contentDOM=i,this.dirty=kr,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,n,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let n=0;nsn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!1;break}if(a.previousSibling)break}if(i==null&&n==t.childNodes.length)for(let a=t;;a=a.parentNode){if(a==this.dom){i=!0;break}if(a.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,n=!1){for(let r=!0,i=t;i;i=i.parentNode){let a=this.getDesc(i),o;if(a&&(!n||a.node))if(r&&(o=a.nodeDOM)&&!(o.nodeType==1?o.contains(t.nodeType==1?t:t.parentNode):o==t))r=!1;else return a}}getDesc(t){let n=t.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(t,n,r){for(let i=t;i;i=i.parentNode){let a=this.getDesc(i);if(a)return a.localPosFromDOM(t,n,r)}return-1}descAt(t){for(let n=0,r=0;nt||o instanceof sm){i=t-a;break}a=s}if(i)return this.children[r].domFromPos(i-this.children[r].border,n);for(let a;r&&!(a=this.children[r-1]).size&&a instanceof am&&a.side>=0;r--);if(n<=0){let a,o=!0;for(;a=r?this.children[r-1]:null,!(!a||a.dom.parentNode==this.contentDOM);r--,o=!1);return a&&n&&o&&!a.border&&!a.domAtom?a.domFromPos(a.size,n):{node:this.contentDOM,offset:a?sn(a.dom)+1:0}}else{let a,o=!0;for(;a=r=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,n,c);t=o;for(let f=s;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){i=sn(d.dom)+1;break}t-=d.size}i==-1&&(i=0)}if(i>-1&&(u>n||s==this.children.length-1)){n=u;for(let c=s+1;cm&&on){let m=s;s=l,l=m}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(s.node,s.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,n){for(let r=0,i=0;i=r:tr){let s=r+a.border,l=o-a.border;if(t>=s&&n<=l){this.dirty=t==r||n==o?ns:jD,t==s&&n==l&&(a.contentLost||a.dom.parentNode!=this.contentDOM)?a.dirty=si:a.markDirty(t-s,n-s);return}else a.dirty=a.dom==a.contentDOM&&a.dom.parentNode==this.contentDOM&&!a.children.length?ns:si}r=o}this.dirty=ns}markParentsDirty(){let t=1;for(let n=this.parent;n;n=n.parent,t++){let r=t==1?ns:jD;n.dirty{if(!a)return i;if(a.parent)return a.parent.posBeforeChild(a)})),!n.type.spec.raw){if(o.nodeType!=1){let s=document.createElement("span");s.appendChild(o),o=s}o.contentEditable="false",o.classList.add("ProseMirror-widget")}super(t,[],o,null),this.widget=n,this.widget=n,a=this}matchesWidget(t){return this.dirty==kr&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let n=this.widget.spec.stopEvent;return n?n(t):!1}ignoreMutation(t){return t.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}},gT=class extends us{constructor(t,n,r,i){super(t,[],n,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,n){return t!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}},jl=class e extends us{constructor(t,n,r,i,a){super(t,[],r,i),this.mark=n,this.spec=a}static create(t,n,r,i){let a=i.nodeViews[n.type.name],o=a&&a(n,i,r);return(!o||!o.dom)&&(o=qi.renderSpec(document,n.type.spec.toDOM(n,r),null,n.attrs)),new e(t,n,o.dom,o.contentDOM||o.dom,o)}parseRule(){return this.dirty&si||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return this.dirty!=si&&this.mark.eq(t)}markDirty(t,n){if(super.markDirty(t,n),this.dirty!=kr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(a=TT(a,0,t,r));for(let s=0;s{if(!l)return o;if(l.parent)return l.parent.posBeforeChild(l)},r,i),c=u&&u.dom,f=u&&u.contentDOM;if(n.isText){if(!c)c=document.createTextNode(n.text);else if(c.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else c||({dom:c,contentDOM:f}=qi.renderSpec(document,n.type.spec.toDOM(n),null,n.attrs));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=MI(c,r,n),u?l=new bT(t,n,r,i,c,f||null,d,u,a,o+1):n.isText?new om(t,n,r,i,c,d,a):new e(t,n,r,i,c,f||null,d,a,o+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.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)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>Q.empty)}return t}matchesNode(t,n,r){return this.dirty==kr&&t.eq(this.node)&&lm(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,n){let r=this.node.inlineContent,i=n,a=t.composing?this.localCompositionInfo(t,n):null,o=a&&a.pos>-1?a:null,s=a&&a.pos<0,l=new yT(this,o&&o.node,t);FY(this.node,this.innerDeco,(u,c,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,t,c):u.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?Ie.none:this.node.child(c).marks,r,t,c),l.placeWidget(u,t,i)},(u,c,f,d)=>{l.syncToMarks(u.marks,r,t,d);let h;l.findNodeMatch(u,c,f,d)||s&&t.state.selection.from>i&&t.state.selection.to-1&&l.updateNodeAt(u,c,f,h,t)||l.updateNextNode(u,c,f,t,d,i)||l.addNode(u,c,f,t,i),i+=u.nodeSize}),l.syncToMarks([],r,t,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ns)&&(o&&this.protectLocalComposition(t,o),kI(this.contentDOM,this.children,t),$l&&qY(this.dom))}localCompositionInfo(t,n){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof pe)||rn+this.node.content.size)return null;let a=t.input.compositionNode;if(!a||!this.dom.contains(a.parentNode))return null;if(this.node.inlineContent){let o=a.nodeValue,s=VY(this.node.content,o,r-n,i-n);return s<0?null:{node:a,pos:s,text:o}}else return{node:a,pos:-1,text:""}}protectLocalComposition(t,{node:n,pos:r,text:i}){if(this.getDesc(n))return;let a=n;for(;a.parentNode!=this.contentDOM;a=a.parentNode){for(;a.previousSibling;)a.parentNode.removeChild(a.previousSibling);for(;a.nextSibling;)a.parentNode.removeChild(a.nextSibling);a.pmViewDesc&&(a.pmViewDesc=void 0)}let o=new gT(this,a,n,i);t.input.compositionNodes.push(o),this.children=TT(this.children,r,r+i.length,t,o)}update(t,n,r,i){return this.dirty==si||!t.sameMarkup(this.node)?!1:(this.updateInner(t,n,r,i),!0)}updateInner(t,n,r,i){this.updateOuterDeco(n),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=kr}updateOuterDeco(t){if(lm(t,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=wI(this.dom,this.nodeDOM,ET(this.outerDeco,this.node,n),ET(t,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}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 XD(e,t,n,r,i){MI(r,t,e);let a=new Wa(void 0,e,t,n,r,r,r,i,0);return a.contentDOM&&a.updateChildren(i,0),a}var om=class e extends Wa{constructor(t,n,r,i,a,o,s){super(t,n,r,i,a,null,o,s,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,n,r,i){return this.dirty==si||this.dirty!=kr&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=kr||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=kr,!0)}inParent(){let t=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,n,r){return t==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(t,n,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,n,r){let i=this.node.cut(t,n),a=document.createTextNode(i.text);return new e(this.parent,i,this.outerDeco,this.innerDeco,a,a,r)}markDirty(t,n){super.markDirty(t,n),this.dom!=this.nodeDOM&&(t==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=si)}get domAtom(){return!1}isText(t){return this.node.text==t}},sm=class extends us{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==kr&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},bT=class extends Wa{constructor(t,n,r,i,a,o,s,l,u,c){super(t,n,r,i,a,o,s,u,c),this.spec=l}update(t,n,r,i){if(this.dirty==si)return!1;if(this.spec.update&&(this.node.type==t.type||this.spec.multiType)){let a=this.spec.update(t,n,r);return a&&this.updateInner(t,n,r,i),a}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,n,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,n,r,i){this.spec.setSelection?this.spec.setSelection(t,n,r.root):super.setSelection(t,n,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}};function kI(e,t,n){let r=e.firstChild,i=!1;for(let a=0;a>1,s=Math.min(o,t.length);for(;a-1)l>this.index&&(this.changed=!0,this.destroyBetween(this.index,l)),this.top=this.top.children[this.index];else{let c=jl.create(this.top,t[o],n,r);this.top.children.splice(this.index,0,c),this.top=c,this.changed=!0}this.index=0,o++}}findNodeMatch(t,n,r,i){let a=-1,o;if(i>=this.preMatch.index&&(o=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&o.matchesNode(t,n,r))a=this.top.children.indexOf(o,this.index);else for(let s=this.index,l=Math.min(this.top.children.length,s+5);s0;){let s;for(;;)if(r){let u=n.children[r-1];if(u instanceof jl)n=u,r=u.children.length;else{s=u,r--;break}}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=s.node;if(l){if(l!=e.child(i-1))break;--i,a.set(s,i),o.push(s)}}return{index:i,matched:a,matches:o.reverse()}}function zY(e,t){return e.type.side-t.type.side}function FY(e,t,n,r){let i=t.locals(e),a=0;if(i.length==0){for(let u=0;ua;)s.push(i[o++]);let m=a+d.nodeSize;if(d.isText){let E=m;o!E.inline):s.slice();r(d,b,t.forChild(a,d),h),a=m}}function qY(e){if(e.nodeName=="UL"||e.nodeName=="OL"){let t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}function VY(e,t,n,r){for(let i=0,a=0;i=n){if(a>=r&&l.slice(r-t.length-s,r-s)==t)return r-t.length;let u=s=0&&u+t.length+s>=n)return s+u;if(n==r&&l.length>=r+t.length-s&&l.slice(r-s,r-s+t.length)==t)return r}}return-1}function TT(e,t,n,r,i){let a=[];for(let o=0,s=0;o=n||c<=t?a.push(l):(un&&a.push(l.slice(n-u,l.size,r)))}return a}function RT(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let i=e.docView.nearestDesc(n.focusNode),a=i&&i.size==0,o=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(o<0)return null;let s=r.resolve(o),l,u;if(gm(n)){for(l=o;i&&!i.node;)i=i.parent;let f=i.node;if(i&&f.isAtom&&fe.isSelectable(f)&&i.parent&&!(f.isInline&&yY(n.focusNode,n.focusOffset,i.dom))){let d=i.posBefore;u=new fe(o==d?s:r.resolve(d))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let f=o,d=o;for(let h=0;h{(n.anchorNode!=r||n.anchorOffset!=i)&&(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!OI(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})}function YY(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r=n.nodeName=="IMG";r?t.collapse(n.parentNode,sn(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&Gn&&Xa<=11&&(n.disabled=!0,n.disabled=!1)}function RI(e,t){if(t instanceof fe){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(eI(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else eI(e)}function eI(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function DT(e,t,n,r){return e.someProp("createSelectionBetween",i=>i(e,t,n))||pe.between(t,n,r)}function tI(e){return e.editable&&!e.hasFocus()?!1:DI(e)}function DI(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function KY(e){let t=e.docView.domFromPos(e.state.selection.anchor,0),n=e.domSelectionRange();return ls(t.node,t.offset,n.anchorNode,n.anchorOffset)}function ST(e,t){let{$anchor:n,$head:r}=e.selection,i=t>0?n.max(r):n.min(r),a=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return a&&Ce.findFrom(a,t)}function ja(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function nI(e,t,n){let r=e.state.selection;if(r instanceof pe)if(n.indexOf("s")>-1){let{$head:i}=r,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!a||a.isText||!a.isLeaf)return!1;let o=e.state.doc.resolve(i.pos+a.nodeSize*(t<0?-1:1));return ja(e,new pe(r.$anchor,o))}else if(r.empty){if(e.endOfTextblock(t>0?"forward":"backward")){let i=ST(e.state,t);return i&&i instanceof fe?ja(e,i):!1}else if(!(Cr&&n.indexOf("m")>-1)){let i=r.$head,a=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,o;if(!a||a.isText)return!1;let s=t<0?i.pos-a.nodeSize:i.pos;return a.isAtom||(o=e.docView.descAt(s))&&!o.contentDOM?fe.isSelectable(a)?ja(e,new fe(t<0?e.state.doc.resolve(i.pos-a.nodeSize):i)):bf?ja(e,new pe(e.state.doc.resolve(t<0?s:s+a.nodeSize))):!1:!1}}else return!1;else{if(r instanceof fe&&r.node.isInline)return ja(e,new pe(t>0?r.$to:r.$from));{let i=ST(e.state,t);return i?ja(e,i):!1}}}function um(e){return e.nodeType==3?e.nodeValue.length:e.childNodes.length}function ff(e,t){let n=e.pmViewDesc;return n&&n.size==0&&(t<0||e.nextSibling||e.nodeName!="BR")}function Gl(e,t){return t<0?$Y(e):jY(e)}function $Y(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i,a,o=!1;for(vr&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let s=n.childNodes[r-1];if(ff(s,-1))i=n,a=--r;else if(s.nodeType==3)n=s,r=n.nodeValue.length;else break}}else{if(II(n))break;{let s=n.previousSibling;for(;s&&ff(s,-1);)i=n.parentNode,a=sn(s),s=s.previousSibling;if(s)n=s,r=um(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}o?_T(e,n,r):i&&_T(e,i,a)}function jY(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let i=um(n),a,o;for(;;)if(r{e.state==i&&Wi(e)},50)}function rI(e,t){let n=e.state.doc.resolve(t);if(!(Xt||SI)&&n.parent.inlineContent){let i=e.coordsAtPos(t);if(t>n.start()){let a=e.coordsAtPos(t-1),o=(a.top+a.bottom)/2;if(o>i.top&&o1)return a.lefti.top&&o1)return a.left>i.left?"ltr":"rtl"}}return getComputedStyle(e.dom).direction=="rtl"?"rtl":"ltr"}function iI(e,t,n){let r=e.state.selection;if(r instanceof pe&&!r.empty||n.indexOf("s")>-1||Cr&&n.indexOf("m")>-1)return!1;let{$from:i,$to:a}=r;if(!i.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let o=ST(e.state,t);if(o&&o instanceof fe)return ja(e,o)}if(!i.parent.inlineContent){let o=t<0?i:a,s=r instanceof Nn?Ce.near(o,t):Ce.findFrom(o,t);return s?ja(e,s):!1}return!1}function aI(e,t){if(!(e.state.selection instanceof pe))return!0;let{$head:n,$anchor:r,empty:i}=e.state.selection;if(!n.sameParent(r))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let a=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(a&&!a.isText){let o=e.state.tr;return t<0?o.delete(n.pos-a.nodeSize,n.pos):o.delete(n.pos,n.pos+a.nodeSize),e.dispatch(o),!0}return!1}function oI(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function QY(e){if(!bn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&t.nodeType==1&&n==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;oI(e,r,"true"),setTimeout(()=>oI(e,r,"false"),20)}return!1}function ZY(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}function JY(e,t){let n=t.keyCode,r=ZY(t);if(n==8||Cr&&n==72&&r=="c")return aI(e,-1)||Gl(e,-1);if(n==46&&!t.shiftKey||Cr&&n==68&&r=="c")return aI(e,1)||Gl(e,1);if(n==13||n==27)return!0;if(n==37||Cr&&n==66&&r=="c"){let i=n==37?rI(e,e.state.selection.from)=="ltr"?-1:1:-1;return nI(e,i,r)||Gl(e,i)}else if(n==39||Cr&&n==70&&r=="c"){let i=n==39?rI(e,e.state.selection.from)=="ltr"?1:-1:1;return nI(e,i,r)||Gl(e,i)}else{if(n==38||Cr&&n==80&&r=="c")return iI(e,-1,r)||Gl(e,-1);if(n==40||Cr&&n==78&&r=="c")return QY(e)||iI(e,1,r)||Gl(e,1);if(r==(Cr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function IT(e,t){e.someProp("transformCopied",h=>{t=h(t,e)});let n=[],{content:r,openStart:i,openEnd:a}=t;for(;i>1&&a>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,a--;let h=r.firstChild;n.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),r=h.content}let o=e.someProp("clipboardSerializer")||qi.fromSchema(e.state.schema),s=zI(),l=s.createElement("div");l.appendChild(o.serializeFragment(r,{document:s}));let u=l.firstChild,c,f=0;for(;u&&u.nodeType==1&&(c=HI[u.nodeName.toLowerCase()]);){for(let h=c.length-1;h>=0;h--){let m=s.createElement(c[h]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${i} ${a}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=e.someProp("clipboardTextSerializer",h=>h(t,e))||t.content.textBetween(0,t.content.size,` + +`);return{dom:l,text:d,slice:t}}function LI(e,t,n,r,i){let a=i.parent.type.spec.code,o,s;if(!n&&!t)return null;let l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",d=>{t=d(t,a||r,e)}),a)return s=new re(Q.from(e.state.schema.text(t.replace(/\r\n?/g,` +`))),0,0),e.someProp("transformPasted",d=>{s=d(s,e,!0)}),s;let f=e.someProp("clipboardTextParser",d=>d(t,i,r,e));if(f)s=f;else{let d=i.marks(),{schema:h}=e.state,m=qi.fromSchema(h);o=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(b=>{let E=o.appendChild(document.createElement("p"));b&&E.appendChild(m.serializeNode(h.text(b,d)))})}}else e.someProp("transformPastedHTML",f=>{n=f(n,e)}),o=rK(n),bf&&iK(o);let u=o&&o.querySelector("[data-pm-slice]"),c=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(c&&c[3])for(let f=+c[3];f>0;f--){let d=o.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;o=d}if(s||(s=(e.someProp("clipboardParser")||e.someProp("domParser")||ai.fromSchema(e.state.schema)).parseSlice(o,{preserveWhitespace:!!(l||c),context:i,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!eK.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)s=aK(sI(s,+c[1],+c[2]),c[4]);else if(s=re.maxOpen(tK(s.content,i),!0),s.openStart||s.openEnd){let f=0,d=0;for(let h=s.content.firstChild;f{s=f(s,e,l)}),s}var eK=/^(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 tK(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let i=t.node(n).contentMatchAt(t.index(n)),a,o=[];if(e.forEach(s=>{if(!o)return;let l=i.findWrapping(s.type),u;if(!l)return o=null;if(u=o.length&&a.length&&PI(l,a,s,o[o.length-1],0))o[o.length-1]=u;else{o.length&&(o[o.length-1]=UI(o[o.length-1],a.length));let c=BI(s,l);o.push(c),i=i.matchType(c.type),a=l}}),o)return Q.from(o)}return e}function BI(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,Q.from(e));return e}function PI(e,t,n,r,i){if(i1&&(a=0),i=n&&(s=t<0?o.contentMatchAt(0).fillBefore(s,a<=i).append(s):s.append(o.contentMatchAt(o.childCount).fillBefore(Q.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,o.copy(s))}function sI(e,t,n){return tn})),uT.createHTML(e)):e}function rK(e){let t=/^(\s*]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n=zI().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(e),i;if((i=r&&HI[r[1].toLowerCase()])&&(e=i.map(a=>"<"+a+">").join("")+e+i.map(a=>"").reverse().join("")),n.innerHTML=nK(e),i)for(let a=0;a=0;s-=2){let l=n.nodes[r[s]];if(!l||l.hasRequiredAttrs())break;i=Q.from(l.create(r[s+1],i)),a++,o++}return new re(i,a,o)}var vn={},kn={},oK={touchstart:!0,touchmove:!0},AT=class{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.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function sK(e){for(let t in vn){let n=vn[t];e.dom.addEventListener(t,e.input.eventHandlers[t]=r=>{uK(e,r)&&!LT(e,r)&&(e.editable||!(r.type in kn))&&n(e,r)},oK[t]?{passive:!0}:void 0)}bn&&e.dom.addEventListener("input",()=>null),CT(e)}function Xi(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function lK(e){e.input.mouseDown&&e.input.mouseDown.done(),e.domObserver.stop();for(let t in e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}function CT(e){e.someProp("handleDOMEvents",t=>{for(let n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=r=>LT(e,r))})}function LT(e,t){return e.someProp("handleDOMEvents",n=>{let r=n[t.type];return r?r(e,t)||t.defaultPrevented:!1})}function uK(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let n=t.target;n!=e.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}function cK(e,t){!LT(e,t)&&vn[t.type]&&(e.editable||!(t.type in kn))&&vn[t.type](e,t)}kn.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=n.keyCode==16||n.shiftKey,!VI(e)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!(ji&&Xt&&n.keyCode==13)))if(n.keyCode!=229&&e.domObserver.forceFlush(),$l&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",i=>i(e,ts(13,"Enter"))),e.input.lastIOSEnter=0)},200)}else e.someProp("handleKeyDown",r=>r(e,n))||JY(e,n)?n.preventDefault():Xi(e,"key")};kn.keyup=(e,t)=>{t.keyCode==16&&(e.input.shiftKey=!1)};kn.keypress=(e,t)=>{let n=t;if(VI(e)||!n.charCode||n.ctrlKey&&!n.altKey||Cr&&n.metaKey)return;if(e.someProp("handleKeyPress",i=>i(e,n))){n.preventDefault();return}let r=e.state.selection;if(!(r instanceof pe)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(n.charCode),a=()=>e.state.tr.insertText(i).scrollIntoView();!/[\r\n]/.test(i)&&!e.someProp("handleTextInput",o=>o(e,r.$from.pos,r.$to.pos,i,a))&&e.dispatch(a()),n.preventDefault()}};function Ef(e){return{left:e.clientX,top:e.clientY}}function fK(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}function BT(e,t,n,r,i){if(r==-1)return!1;let a=e.state.doc.resolve(r);for(let o=a.depth+1;o>0;o--)if(e.someProp(t,s=>o>a.depth?s(e,n,a.nodeAfter,a.before(o),i,!0):s(e,n,a.node(o),a.before(o),i,!1)))return!0;return!1}function yf(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);n=="pointer"&&r.setMeta("pointer",!0),e.dispatch(r)}function dK(e,t){if(t==-1)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return r&&r.isAtom&&fe.isSelectable(r)?(yf(e,new fe(n),"pointer"),!0):!1}function hK(e,t){if(t==-1)return!1;let n=e.state.selection,r,i;n instanceof fe&&(r=n.node);let a=e.state.doc.resolve(t);for(let o=a.depth+1;o>0;o--){let s=o>a.depth?a.nodeAfter:a.node(o);if(fe.isSelectable(s)){r&&n.$from.depth>0&&o>=n.$from.depth&&a.before(n.$from.depth+1)==n.$from.pos?i=a.before(n.$from.depth):i=a.before(o);break}}return i!=null?(yf(e,fe.create(e.state.doc,i),"pointer"),!0):!1}function pK(e,t,n,r,i){return BT(e,"handleClickOn",t,n,r)||e.someProp("handleClick",a=>a(e,t,r))||(i?hK(e,n):dK(e,n))}function mK(e,t,n,r){return BT(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",i=>i(e,t,r))}function gK(e,t,n,r){return BT(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",i=>i(e,t,r))||bK(e,n,r)}function bK(e,t,n){if(n.button!=0)return!1;let r=FI(e,t,!0),i=e.state.doc;return r?(yf(e,r,"pointer"),r instanceof pe&&i.eq(e.state.doc)&&(e.input.mouseDown=new vT(e,r)),!0):!1}function FI(e,t,n){let r=e.state.doc;if(t==-1)return r.inlineContent?pe.create(r,0,r.content.size):null;let i=r.resolve(t);for(let a=i.depth+1;a>0;a--){let o=a>i.depth?i.nodeAfter:i.node(a),s=i.before(a);if(o.inlineContent)return pe.create(r,s+1,s+1+o.content.size);if(n&&fe.isSelectable(o))return fe.create(r,s)}return null}function PT(e){return fm(e)}var qI=Cr?"metaKey":"ctrlKey";vn.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=PT(e),i=Date.now(),a="singleClick";i-e.input.lastClick.time<500&&fK(n,e.input.lastClick)&&!n[qI]&&e.input.lastClick.button==n.button&&(e.input.lastClick.type=="singleClick"?a="doubleClick":e.input.lastClick.type=="doubleClick"&&(a="tripleClick")),e.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:a,button:n.button},e.input.mouseDown&&e.input.mouseDown.done();let o=e.posAtCoords(Ef(n));o&&(a=="singleClick"?e.input.mouseDown=new NT(e,o,n,!!r):(a=="doubleClick"?mK:gK)(e,o.pos,o.inside,n)?n.preventDefault():Xi(e,"pointer"))};var cm=class{constructor(t){this.view=t,this.mightDrag=null,t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this))}up(t){this.done()}move(t){t.buttons==0&&this.done()}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.view.input.mouseDown==this&&(this.view.input.mouseDown=null)}delaySelUpdate(){return!1}},NT=class extends cm{constructor(t,n,r,i){super(t),this.pos=n,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.startDoc=t.state.doc,this.selectNode=!!r[qI],this.allowDefault=r.shiftKey;let a,o;if(n.inside>-1)a=t.state.doc.nodeAt(n.inside),o=n.inside;else{let c=t.state.doc.resolve(n.pos);a=c.parent,o=c.depth?c.before():0}let s=i?null:r.target,l=s?t.docView.nearestDesc(s,!0):null;this.target=l&&l.nodeDOM.nodeType==1?l.nodeDOM:null;let{selection:u}=t.state;r.button==0&&(a.type.spec.draggable&&a.type.spec.selectable!==!1||u instanceof fe&&u.from<=o&&u.to>o)&&(this.mightDrag={node:a,pos:o,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&vr&&!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()),Xi(t,"pointer")}done(){super.done(),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(()=>{this.view.isDestroyed||Wi(this.view)})}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Ef(t))),this.updateAllowDefault(t),this.allowDefault||!n?Xi(this.view,"pointer"):pK(this.view,n.pos,n.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||bn&&this.mightDrag&&!this.mightDrag.node.isAtom||Xt&&!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)?(yf(this.view,Ce.near(this.view.state.doc.resolve(n.pos)),"pointer"),t.preventDefault()):Xi(this.view,"pointer")}move(t){this.updateAllowDefault(t),Xi(this.view,"pointer"),super.move(t)}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}delaySelUpdate(){return this.allowDefault?(this.delayedSelectionSync=!0,!0):!1}},vT=class extends cm{constructor(t,n){super(t),this.startSelection=n,this.startDoc=t.state.doc}move(t){if(t.buttons==0||this.view.isDestroyed||!this.view.state.doc.eq(this.startDoc)){this.done();return}t.preventDefault(),Xi(this.view,"pointer");let n=this.view.posAtCoords(Ef(t)),r=n&&FI(this.view,n.inside,!1);if(!r)return;let{doc:i}=this.view.state,a=this.startSelection,[o,s]=r.from{e.input.lastTouch=Date.now(),PT(e),Xi(e,"pointer")};vn.touchmove=e=>{e.input.lastTouch=Date.now(),Xi(e,"pointer")};vn.contextmenu=e=>PT(e);function VI(e,t){return e.composing?!0:bn&&Math.abs(Date.now()-e.input.compositionEndedAt)<500?(e.input.compositionEndedAt=-2e8,!0):!1}var EK=ji?5e3:-1;kn.compositionstart=kn.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof pe&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)||Xt&&SI&&yK(e)))e.markCursor=e.state.storedMarks||n.marks(),fm(e,!0),e.markCursor=null;else if(fm(e,!t.selection.empty),vr&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=e.domSelectionRange();for(let i=r.focusNode,a=r.focusOffset;i&&i.nodeType==1&&a!=0;){let o=a<0?i.lastChild:i.childNodes[a-1];if(!o)break;if(o.nodeType==3){let s=e.domSelection();s&&s.collapse(o,o.nodeValue.length);break}else i=o,a=-1}}e.input.composing=!0}GI(e,EK)};function yK(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||t.nodeType!=1||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return r.nodeType==1&&r.contentEditable=="false"}kn.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now(),e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,GI(e,20))};function GI(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>fm(e),t))}function YI(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=Date.now());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function TK(e){let t=e.domSelectionRange();if(!t.focusNode)return null;let n=bY(t.focusNode,t.focusOffset),r=EY(t.focusNode,t.focusOffset);if(n&&r&&n!=r){let i=r.pmViewDesc,a=e.domObserver.lastChangedTextNode;if(n==a||r==a)return a;if(!i||!i.isText(r.nodeValue))return r;if(e.input.compositionNode==r){let o=n.pmViewDesc;if(!(!o||!o.isText(n.nodeValue)))return r}}return n||r}function fm(e,t=!1){if(!(ji&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),YI(e),t||e.docView&&e.docView.dirty){let n=RT(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):(e.markCursor||t)&&!r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.dispatch(e.state.tr.deleteSelection()):e.updateState(e.state),!0}return!1}}function SK(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}var df=Gn&&Xa<15||$l&&_Y<604;vn.copy=kn.cut=(e,t)=>{let n=t,r=e.state.selection,i=n.type=="cut";if(r.empty)return;let a=df?null:n.clipboardData,o=r.content(),{dom:s,text:l}=IT(e,o);a?(n.preventDefault(),a.clearData(),a.setData("text/html",s.innerHTML),a.setData("text/plain",l)):SK(e,s),i&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function _K(e){return e.openStart==0&&e.openEnd==0&&e.content.childCount==1?e.content.firstChild:null}function xK(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.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=e.input.shiftKey&&e.input.lastKeyCode!=45;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?hf(e,r.value,null,i,t):hf(e,r.textContent,r.innerHTML,i,t)},50)}function hf(e,t,n,r,i){let a=LI(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",l=>l(e,i,a||re.empty)))return!0;if(!a)return!1;let o=_K(a),s=o?e.state.tr.replaceSelectionWith(o,r):e.state.tr.replaceSelection(a);return e.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function KI(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}kn.paste=(e,t)=>{let n=t;if(e.composing&&!ji)return;let r=df?null:n.clipboardData,i=e.input.shiftKey&&e.input.lastKeyCode!=45;r&&hf(e,KI(r),r.getData("text/html"),i,n)?n.preventDefault():xK(e,n)};var dm=class{constructor(t,n,r){this.slice=t,this.move=n,this.node=r}},AK=Cr?"altKey":"ctrlKey";function $I(e,t){let n;return e.someProp("dragCopies",r=>{n=n||r(t)}),n!=null?!n:!t[AK]}vn.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let i=e.state.selection,a=i.empty?null:e.posAtCoords(Ef(n)),o;if(!(a&&a.pos>=i.from&&a.pos<=(i instanceof fe?i.to-1:i.to))){if(r&&r.mightDrag)o=fe.create(e.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let f=e.docView.nearestDesc(n.target,!0);f&&f.node.type.spec.draggable&&f!=e.docView&&(o=fe.create(e.state.doc,f.posBefore))}}let s=(o||e.state.selection).content(),{dom:l,text:u,slice:c}=IT(e,s);(!n.dataTransfer.files.length||!Xt||TI>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(df?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",df||n.dataTransfer.setData("text/plain",u),e.dragging=new dm(c,$I(e,n),o)};vn.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)};kn.dragover=kn.dragenter=(e,t)=>t.preventDefault();kn.drop=(e,t)=>{try{CK(e,t,e.dragging)}finally{e.dragging=null}};function CK(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(Ef(t));if(!r)return;let i=e.state.doc.resolve(r.pos),a=n&&n.slice;a?e.someProp("transformPasted",h=>{a=h(a,e,!1)}):a=LI(e,KI(t.dataTransfer),df?null:t.dataTransfer.getData("text/html"),!1,i);let o=!!(n&&$I(e,t));if(e.someProp("handleDrop",h=>h(e,t,a||re.empty,o))){t.preventDefault();return}if(!a)return;t.preventDefault();let s=a?fD(e.state.doc,i.pos,a):i.pos;s==null&&(s=i.pos);let l=e.state.tr;if(o){let{node:h}=n;h?h.replace(l):l.deleteSelection()}let u=l.mapping.map(s),c=a.openStart==0&&a.openEnd==0&&a.content.childCount==1,f=l.doc;if(c?l.replaceRangeWith(u,u,a.content.firstChild):l.replaceRange(u,u,a),l.doc.eq(f))return;let d=l.doc.resolve(u);if(c&&fe.isSelectable(a.content.firstChild)&&d.nodeAfter&&d.nodeAfter.sameMarkup(a.content.firstChild))l.setSelection(new fe(d));else{let h=l.mapping.map(s);l.mapping.maps[l.mapping.maps.length-1].forEach((m,b,E,g)=>h=g),l.setSelection(DT(e,d,l.doc.resolve(h)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}vn.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&Wi(e)},20))};vn.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)};vn.beforeinput=(e,t)=>{if(Xt&&ji&&t.inputType=="deleteContentBackward"){e.domObserver.flushSoon();let{domChangeCount:r}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=r||(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",a=>a(e,ts(8,"Backspace")))))return;let{$cursor:i}=e.state.selection;i&&i.pos>0&&e.dispatch(e.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let e in kn)vn[e]=kn[e];function pf(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}var hm=class e{constructor(t,n){this.toDOM=t,this.spec=n||as,this.side=this.spec.side||0}map(t,n,r,i){let{pos:a,deleted:o}=t.mapResult(n.from+i,this.side<0?-1:1);return o?null:new li(a-r,a-r,this)}valid(){return!0}eq(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&pf(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}},is=class e{constructor(t,n){this.attrs=t,this.spec=n||as}map(t,n,r,i){let a=t.map(n.from+i,this.spec.inclusiveStart?-1:1)-r,o=t.map(n.to+i,this.spec.inclusiveEnd?1:-1)-r;return a>=o?null:new li(a,o,this)}valid(t,n){return n.from=t&&(!a||a(s.spec))&&r.push(s.copy(s.from+i,s.to+i))}for(let o=0;ot){let s=this.children[o]+1;this.children[o+2].findInner(t-s,n-s,r,i+s,a)}}map(t,n,r){return this==gn||t.maps.length==0?this:this.mapInner(t,n,0,0,r||as)}mapInner(t,n,r,i,a){let o;for(let s=0;s{let u=l+r,c;if(c=XI(n,s,u)){for(i||(i=this.children.slice());as&&f.to=t){this.children[s]==t&&(r=this.children[s+2]);break}let a=t+1,o=a+n.content.size;for(let s=0;sa&&l.type instanceof is){let u=Math.max(a,l.from)-a,c=Math.min(o,l.to)-a;ui.map(t,n,as));return e.from(r)}forChild(t,n){if(n.isLeaf)return Yn.empty;let r=[];for(let i=0;in instanceof Yn)?t:t.reduce((n,r)=>n.concat(r instanceof Yn?r:r.members),[]))}}forEachSet(t){for(let n=0;n{let E=b-m-(h-d);for(let g=0;gy+c-f)continue;let T=s[g]+c-f;h>=T?s[g+1]=d<=T?-2:-1:d>=c&&E&&(s[g]+=E,s[g+1]+=E)}f+=E}),c=n.maps[u].map(c,-1)}let l=!1;for(let u=0;u=r.content.size){l=!0;continue}let d=n.map(e[u+1]+a,-1),h=d-i,{index:m,offset:b}=r.content.findIndex(f),E=r.maybeChild(m);if(E&&b==f&&b+E.nodeSize==h){let g=s[u+2].mapInner(n,E,c+1,e[u]+a+1,o);g!=gn?(s[u]=f,s[u+1]=h,s[u+2]=g):(s[u+1]=-2,l=!0)}else l=!0}if(l){let u=vK(s,e,t,n,i,a,o),c=mm(u,r,0,o);t=c.local;for(let f=0;fn&&o.to{let u=XI(e,s,l+n);if(u){a=!0;let c=mm(u,s,n+l+1,r);c!=gn&&i.push(l,l+s.nodeSize,c)}});let o=jI(a?WI(e):e,-n).sort(ss);for(let s=0;s0;)t++;e.splice(t,0,n)}function cT(e){let t=[];return e.someProp("decorations",n=>{let r=n(e.state);r&&r!=gn&&t.push(r)}),e.cursorWrapper&&t.push(Yn.create(e.state.doc,[e.cursorWrapper.deco])),pm.from(t)}var kK={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},wK=Gn&&Xa<=11,wT=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}},MT=class{constructor(t,n){this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wT,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;ii.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():bn&&t.composing&&r.some(i=>i.type=="childList"&&i.target.nodeName=="TR")?(t.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),wK&&(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,kK)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let n=0;nthis.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(tI(this.view)){if(this.suppressingSelectionUpdates)return Wi(this.view);if(Gn&&Xa<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&ls(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let n=new Set,r;for(let a=t.focusNode;a;a=Kl(a))n.add(a);for(let a=t.anchorNode;a;a=Kl(a))if(n.has(a)){r=a;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 t of this.observer.takeRecords())this.queue.push(t);return this.queue}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&tI(t)&&!this.ignoreSelectionChange(r),a=-1,o=-1,s=!1,l=[];if(t.editable)for(let c=0;cc.nodeName=="BR")&&(t.input.lastKeyCode==8||t.input.lastKeyCode==46||Xt&&(t.composing||t.input.compositionEndedAt>Date.now()-50)&&n.some(c=>c.type=="childList"&&c.removedNodes.length))){for(let c of l)if(c.nodeName=="BR"&&c.parentNode){let f=c.nextSibling;for(;f&&f.nodeType==1;){if(f.contentEditable=="false"){c.parentNode.removeChild(c);break}f=f.firstChild}}}else if(vr&&l.length){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let[f,d]=c;f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let d of c){let h=d.parentNode;h&&h.nodeName=="LI"&&(!f||RK(t,f)!=h)&&d.remove()}}}let u=null;a<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(a>-1&&(t.docView.markDirty(a,o),MK(t)),t.input.badSafariComposition&&(t.input.badSafariComposition=!1,DK(t,l)),this.handleDOMChange(a,o,s,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||Wi(t),this.currentSelection.set(r))}registerMutation(t,n){if(n.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let c=0;ci;E--){let g=r.childNodes[E-1],y=g.pmViewDesc;if(g.nodeName=="BR"&&!y){a=E;break}if(!y||y.size)break}let f=e.state.doc,d=e.someProp("domParser")||ai.fromSchema(e.state.schema),h=f.resolve(o),m=null,b=d.parse(r,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:i,to:a,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:LK,context:h});if(u&&u[0].pos!=null){let E=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=E),m={anchor:E+o,head:g+o}}return{doc:b,sel:m,from:o,to:s}}function LK(e){let t=e.pmViewDesc;if(t)return t.parseRule();if(e.nodeName=="BR"&&e.parentNode){if(bn&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(e.parentNode.lastChild==e||bn&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if(e.nodeName=="IMG"&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var BK=/^(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 PK(e,t,n,r,i){let a=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){let M=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,R=RT(e,M);if(R&&!e.state.selection.eq(R)){if(Xt&&ji&&e.input.lastKeyCode===13&&Date.now()-100A(e,ts(13,"Enter"))))return;let L=e.state.tr.setSelection(R);M=="pointer"?L.setMeta("pointer",!0):M=="key"&&L.scrollIntoView(),a&&L.setMeta("composition",a),e.dispatch(L)}return}let o=e.state.doc.resolve(t),s=o.sharedDepth(n);t=o.before(s+1),n=e.state.doc.resolve(n).after(s+1);let l=e.state.selection,u=IK(e,t,n),c=e.state.doc,f=c.slice(u.from,u.to),d,h;e.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ji)&&i.some(M=>M.nodeType==1&&!BK.test(M.nodeName))&&(!m||m.endA>=m.endB)&&e.someProp("handleKeyDown",M=>M(e,ts(13,"Enter")))){e.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof pe&&!l.empty&&l.$head.sameParent(l.$anchor)&&!e.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let M=hI(e,e.state.doc,u.sel);if(M&&!M.eq(e.state.selection)){let R=e.state.tr.setSelection(M);a&&R.setMeta("composition",a),e.dispatch(R)}}return}e.state.selection.frome.state.selection.from&&m.start<=e.state.selection.from+2&&e.state.selection.from>=u.from?m.start=e.state.selection.from:m.endA=e.state.selection.to-2&&e.state.selection.to<=u.to&&(m.endB+=e.state.selection.to-m.endA,m.endA=e.state.selection.to)),Gn&&Xa<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" \xA0"&&(m.start--,m.endA--,m.endB--);let b=u.doc.resolveNoCache(m.start-u.from),E=u.doc.resolveNoCache(m.endB-u.from),g=c.resolve(m.start),y=b.sameParent(E)&&b.parent.inlineContent&&g.end()>=m.endA;if(($l&&e.input.lastIOSEnter>Date.now()-225&&(!y||i.some(M=>M.nodeName=="DIV"||M.nodeName=="P"))||!y&&b.posM(e,ts(13,"Enter")))){e.input.lastIOSEnter=0;return}if(e.state.selection.anchor>m.start&&HK(c,m.start,m.endA,b,E)&&e.someProp("handleKeyDown",M=>M(e,ts(8,"Backspace")))){ji&&Xt&&e.domObserver.suppressSelectionUpdates();return}Xt&&m.endB==m.start&&(e.input.lastChromeDelete=Date.now()),ji&&!y&&b.start()!=E.start()&&E.parentOffset==0&&b.depth==E.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,E=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{e.someProp("handleKeyDown",function(M){return M(e,ts(13,"Enter"))})},20));let T=m.start,S=m.endA,v=M=>{let R=M||e.state.tr.replace(T,S,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let L=hI(e,R.doc,u.sel);L&&!(Xt&&e.composing&&L.empty&&(m.start!=m.endB||e.input.lastChromeDeleteWi(e),20));let M=v(e.state.tr.delete(T,S)),R=c.resolve(m.start).marksAcross(c.resolve(m.endA));R&&M.ensureMarks(R),e.dispatch(M)}else if(m.endA==m.endB&&(x=UK(b.parent.content.cut(b.parentOffset,E.parentOffset),g.parent.content.cut(g.parentOffset,m.endA-g.start())))){let M=v(e.state.tr);x.type=="add"?M.addMark(T,S,x.mark):M.removeMark(T,S,x.mark),e.dispatch(M)}else if(b.parent.child(b.index()).isText&&b.index()==E.index()-(E.textOffset?0:1)){let M=b.parent.textBetween(b.parentOffset,E.parentOffset),R=()=>v(e.state.tr.insertText(M,T,S));e.someProp("handleTextInput",L=>L(e,T,S,M,R))||e.dispatch(R())}else e.dispatch(v());else e.dispatch(v())}function hI(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:DT(e,t.resolve(n.anchor),t.resolve(n.head))}function UK(e,t){let n=e.firstChild.marks,r=t.firstChild.marks,i=n,a=r,o,s,l;for(let c=0;cc.mark(s.addToSet(c.marks));else if(i.length==0&&a.length==1)s=a[0],o="remove",l=c=>c.mark(s.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||fT(o,!0,!1)0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,i++,t=!1;if(n){let a=e.node(r).maybeChild(e.indexAfter(r));for(;a&&!a.isLeaf;)a=a.firstChild,i++}return i}function zK(e,t,n,r,i){let a=e.findDiffStart(t,n),o=n+e.size,s=n+t.size;if(a==null)return null;let{a:l,b:u}=e.findDiffEnd(t,o,s);if(i=="end"){let c=Math.max(0,a-Math.min(l,u));r-=l+c-a}if(l=l?a-r:0;a-=c,u=a+(u-l),l=a}else if(u=u?a-r:0;a-=c,l=a+(l-u),u=a}return{start:a,endA:l,endB:u}}var mf=class{constructor(t,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 AT,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(EI),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=gI(this),mI(this),this.nodeViews=bI(this),this.docView=XD(this.state.doc,pI(this),cT(this),this.dom,this),this.domObserver=new MT(this,(r,i,a,o)=>PK(this,r,i,a,o)),this.domObserver.start(),sK(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let n in t)this._props[n]=t[n];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&CT(this);let n=this._props;this._props=t,t.plugins&&(t.plugins.forEach(EI),this.directPlugins=t.plugins),this.updateStateInner(t.state,n)}setProps(t){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in t)n[r]=t[r];this.update(n)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,n){var r;let i=this.state,a=!1,o=!1;t.storedMarks&&this.composing&&(YI(this),o=!0),this.state=t;let s=i.plugins!=t.plugins||this._props.plugins!=n.plugins;if(s||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let h=bI(this);qK(h,this.nodeViews)&&(this.nodeViews=h,a=!0)}(s||n.handleDOMEvents!=this._props.handleDOMEvents)&&CT(this),this.editable=gI(this),mI(this);let l=cT(this),u=pI(this),c=i.plugins!=t.plugins&&!i.doc.eq(t.doc)?"reset":t.scrollToSelection>i.scrollToSelection?"to selection":"preserve",f=a||!this.docView.matchesNode(t.doc,u,l);(f||!t.selection.eq(i.selection))&&(o=!0);let d=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&CY(this);if(o){this.domObserver.stop();let h=f&&(Gn||Xt)&&!this.composing&&!i.selection.empty&&!t.selection.empty&&FK(i.selection,t.selection);if(f){let b=Xt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=TK(this)),(a||!this.docView.update(t.doc,u,l,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=XD(t.doc,u,l,this.dom,this)),b&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}let m=this.input.mouseDown;h||!(m&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&KY(this)&&m.delaySelUpdate())?Wi(this,h):(RI(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(i),!((r=this.dragging)===null||r===void 0)&&r.node&&!i.doc.eq(t.doc)&&this.updateDraggedNode(this.dragging,i),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&NY(d)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!(!t||!this.dom.contains(t.nodeType==1?t:t.parentNode))){if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof fe){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&VD(this,n.getBoundingClientRect(),t)}else VD(this,this.coordsAtPos(this.state.selection.head,1),t)}}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&an.ownerDocument.getSelection()),this._root=n}return t||document}updateRoot(){this._root=null}posAtCoords(t){return RY(this,t)}coordsAtPos(t,n=1){return NI(this,t,n)}domAtPos(t,n=0){return this.docView.domFromPos(t,n)}nodeDOM(t){let n=this.docView.descAt(t);return n?n.nodeDOM:null}posAtDOM(t,n,r=-1){let i=this.docView.posFromDOM(t,n,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,n){return PY(this,n||this.state,t)}pasteHTML(t,n){return hf(this,"",t,!1,n||new ClipboardEvent("paste"))}pasteText(t,n){return hf(this,t,null,!0,n||new ClipboardEvent("paste"))}serializeForClipboard(t){return IT(this,t)}destroy(){this.docView&&(lK(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],cT(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,mY())}get isDestroyed(){return this.docView==null}dispatchEvent(t){return cK(this,t)}domSelectionRange(){let t=this.domSelection();return t?bn&&this.root.nodeType===11&&TY(this.dom.ownerDocument)==this.dom&&OK(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}};mf.prototype.dispatch=function(e){let t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))};function pI(e){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(e.state)),n)for(let r in n)r=="class"?t.class+=" "+n[r]:r=="style"?t.style=(t.style?t.style+";":"")+n[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[li.node(0,e.state.doc.content.size,t)]}function mI(e){if(e.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:li.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function gI(e){return!e.someProp("editable",t=>t(e.state)===!1)}function FK(e,t){let n=Math.min(e.$anchor.sharedDepth(e.head),t.$anchor.sharedDepth(t.head));return e.$anchor.start(n)!=t.$anchor.start(n)}function bI(e){let t=Object.create(null);function n(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function qK(e,t){let n=0,r=0;for(let i in e){if(e[i]!=t[i])return!0;n++}for(let i in t)r++;return n!=r}function EI(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Qi={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:"'"},Em={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},VK=typeof navigator<"u"&&/Mac/.test(navigator.platform),GK=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Lt=0;Lt<10;Lt++)Qi[48+Lt]=Qi[96+Lt]=String(Lt);var Lt;for(Lt=1;Lt<=24;Lt++)Qi[Lt+111]="F"+Lt;var Lt;for(Lt=65;Lt<=90;Lt++)Qi[Lt]=String.fromCharCode(Lt+32),Em[Lt]=String.fromCharCode(Lt);var Lt;for(bm in Qi)Em.hasOwnProperty(bm)||(Em[bm]=Qi[bm]);var bm;function QI(e){var t=VK&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||GK&&e.shiftKey&&e.key&&e.key.length==1||e.key=="Unidentified",n=!t&&e.key||(e.shiftKey?Em:Qi)[e.keyCode]||e.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}var YK=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),KK=typeof navigator<"u"&&/Win/.test(navigator.platform);function $K(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n=="Space"&&(n=" ");let r,i,a,o;for(let s=0;s{for(var n in t)WK(e,n,{get:t[n],enumerable:!0})};function vm(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var km=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([o,s])=>[o,(...u)=>{let c=s(...u)(a);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),c}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,l=e||i.tr,u=()=>(!s&&t&&!l.getMeta("preventDispatch")&&!this.hasCustomState&&a.dispatch(l),o.every(f=>f===!0)),c={...Object.fromEntries(Object.entries(n).map(([f,d])=>[f,(...m)=>{let b=this.buildProps(l,t),E=d(...m)(b);return o.push(E),c}])),run:u};return c}createCan(e){let{rawCommands:t,state:n}=this,r=!1,i=e||n.tr,a=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(t).map(([s,l])=>[s,(...u)=>l(...u)({...a,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:vm({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...u)=>l(...u)(o)]))}};return o}},u3={};YT(u3,{blur:()=>QK,clearContent:()=>ZK,clearNodes:()=>JK,command:()=>e$,createParagraphNear:()=>t$,cut:()=>n$,deleteCurrentNode:()=>r$,deleteNode:()=>i$,deleteRange:()=>a$,deleteSelection:()=>l$,enter:()=>u$,exitCode:()=>c$,extendMarkRange:()=>f$,first:()=>d$,focus:()=>p$,forEach:()=>m$,insertContent:()=>g$,insertContentAt:()=>y$,joinBackward:()=>_$,joinDown:()=>S$,joinForward:()=>x$,joinItemBackward:()=>A$,joinItemForward:()=>C$,joinTextblockBackward:()=>N$,joinTextblockForward:()=>v$,joinUp:()=>T$,keyboardShortcut:()=>w$,lift:()=>M$,liftEmptyBlock:()=>O$,liftListItem:()=>R$,newlineInCode:()=>D$,resetAttributes:()=>I$,scrollIntoView:()=>L$,selectAll:()=>B$,selectNodeBackward:()=>P$,selectNodeForward:()=>U$,selectParentNode:()=>H$,selectTextblockEnd:()=>z$,selectTextblockStart:()=>F$,setContent:()=>q$,setMark:()=>lj,setMeta:()=>uj,setNode:()=>cj,setNodeSelection:()=>fj,setTextDirection:()=>dj,setTextSelection:()=>hj,sinkListItem:()=>pj,splitBlock:()=>mj,splitListItem:()=>gj,toggleList:()=>Ej,toggleMark:()=>yj,toggleNode:()=>Tj,toggleWrap:()=>Sj,undoInputRule:()=>_j,unsetAllMarks:()=>xj,unsetMark:()=>Aj,unsetTextDirection:()=>Cj,updateAttributes:()=>Nj,wrapIn:()=>vj,wrapInList:()=>kj});var QK=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),(n=window?.getSelection())==null||n.removeAllRanges())}),!0),ZK=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),JK=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:a,$to:o})=>{e.doc.nodesBetween(a.pos,o.pos,(s,l)=>{if(s.type.isText)return;let{doc:u,mapping:c}=t,f=u.resolve(c.map(l)),d=u.resolve(c.map(l+s.nodeSize)),h=f.blockRange(d);if(!h)return;let m=Yi(h);if(s.type.isTextblock){let{defaultType:b}=f.parent.contentMatchAt(f.index());t.setNodeMarkup(h.start,b)}(m||m===0)&&t.lift(h,m)})}),!0},e$=e=>t=>e(t),t$=()=>({state:e,dispatch:t})=>tT(e,t),n$=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new pe(r.doc.resolve(Math.max(o-1,0)))),!0},r$=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let a=i.depth;a>0;a-=1)if(i.node(a).type===r.type){if(t){let s=i.before(a),l=i.after(a);e.delete(s,l).scrollIntoView()}return!0}return!1};function Wt(e,t){if(typeof e=="string"){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var i$=e=>({tr:t,state:n,dispatch:r})=>{let i=Wt(e,n.schema),a=t.selection.$anchor;for(let o=a.depth;o>0;o-=1)if(a.node(o).type===i){if(r){let l=a.before(o),u=a.after(o);t.delete(l,u).scrollIntoView()}return!0}return!1},a$=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},o$=e=>e.content?/^text(\*|\+)/.test(e.content):!1,JI=(e,t,n)=>{if(!e.parent.isInline||n==="left"&&e.pos>e.start()||n==="right"&&e.pos{let r=JI(e,n,"left"),i=JI(t,n,"right");return{from:r,to:i}},l$=()=>({state:e,dispatch:t})=>{let{$from:n,$to:r}=e.selection;if(e.selection.empty)return!1;let{from:i,to:a}=s$(n,r,e.schema);return t&&(e.tr.deleteRange(i,a).scrollIntoView(),t(e.tr)),!0},u$=()=>({commands:e})=>e.keyboardShortcut("Enter"),c$=()=>({state:e,dispatch:t})=>eT(e,t);function KT(e){return Object.prototype.toString.call(e)==="[object RegExp]"}function Am(e,t,n={strict:!0}){let r=Object.keys(t);return r.length?r.every(i=>n.strict?t[i]===e[i]:KT(t[i])?t[i].test(e[i]):t[i]===e[i]):!0}function c3(e,t,n={}){return e.find(r=>r.type===t&&Am(Object.fromEntries(Object.keys(n).map(i=>[i,r.attrs[i]])),n))}function e3(e,t,n={}){return!!c3(e,t,n)}function f3(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===t))&&(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===t))return;if(!n){let u=r.node.marks.find(c=>c.type===t);u&&(n=u.attrs)}if(!c3([...r.node.marks],t,n))return;let a=r.index,o=e.start()+r.offset,s=a+1,l=o+r.node.nodeSize;for(;a>0&&e3([...e.parent.child(a-1).marks],t,n);)a-=1,o-=e.parent.child(a).nodeSize;for(;s({tr:n,state:r,dispatch:i})=>{let a=Zi(e,r.schema),{doc:o,selection:s}=n,{$from:l,from:u,to:c}=s;if(i){let f=f3(l,a,t);if(f&&f.from<=u&&f.to>=c){let d=pe.create(o,f.from,f.to);n.setSelection(d)}}return!0},d$=e=>t=>{let n=typeof e=="function"?e(t):e;for(let r=0;r({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(Cm()||t3())&&r.dom.focus(),h$()&&!Cm()&&!t3()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!d3(n.state.selection))return o(),!0;let s=h3(i.doc,e)||n.state.selection,l=n.state.selection.eq(s);return a&&(l||i.setSelection(s),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},m$=(e,t)=>n=>e.every((r,i)=>t(r,{...n,index:i})),g$=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),p3=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&p3(r)}return e};function ym(e){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");let t=`${e}`,n=new window.DOMParser().parseFromString(t,"text/html").body;return p3(n)}function xf(e,t,n){if(e instanceof Vn||e instanceof Q)return e;n={slice:!0,parseOptions:{},...n};let r=typeof e=="object"&&e!==null,i=typeof e=="string";if(r)try{if(Array.isArray(e)&&e.length>0)return Q.fromArray(e.map(s=>t.nodeFromJSON(s)));let o=t.nodeFromJSON(e);return n.errorOnInvalidContent&&o.check(),o}catch(a){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:a});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",a),xf("",t,n)}if(i){if(n.errorOnInvalidContent){let o=!1,s="",l=new Pl({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(o=!0,s=typeof u=="string"?u:u.outerHTML,null)}]}})});if(n.slice?ai.fromSchema(l).parseSlice(ym(e),n.parseOptions):ai.fromSchema(l).parse(ym(e),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${s}`)})}let a=ai.fromSchema(t);return n.slice?a.parseSlice(ym(e),n.parseOptions).content:a.parse(ym(e),n.parseOptions)}return xf("",t,n)}function b$(e,t,n){let r=e.steps.length-1;if(r{o===0&&(o=c)}),e.setSelection(Ce.near(e.doc.resolve(o),n))}var E$=e=>!("type"in e),y$=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{var o;if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let s,l=E=>{a.emit("contentError",{editor:a,error:E,disableCollaboration:()=>{"collaboration"in a.storage&&typeof a.storage.collaboration=="object"&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{xf(t,a.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(E){l(E)}try{s=xf(t,a.schema,{parseOptions:u,errorOnInvalidContent:(o=n.errorOnInvalidContent)!=null?o:a.options.enableContentCheck})}catch(E){return l(E),!1}let{from:c,to:f}=typeof e=="number"?{from:e,to:e}:{from:e.from,to:e.to},d=!0,h=!0;if((E$(s)?s:[s]).forEach(E=>{E.check(),d=d?E.isText&&E.marks.length===0:!1,h=h?E.isBlock:!1}),c===f&&h){let{parent:E}=r.doc.resolve(c);E.isTextblock&&!E.type.spec.code&&!E.childCount&&(c-=1,f+=1)}let b;if(d){if(Array.isArray(t))b=t.map(E=>E.text||"").join("");else if(t instanceof Q){let E="";t.forEach(g=>{g.text&&(E+=g.text)}),b=E}else typeof t=="object"&&t&&t.text?b=t.text:b=t;r.insertText(b,c,f)}else{b=s;let E=r.doc.resolve(c),g=E.node(),y=E.parentOffset===0,T=g.isText||g.isTextblock,S=g.content.size>0;y&&T&&S&&h&&(c=Math.max(0,c-1)),r.replaceWith(c,f,b)}n.updateSelection&&b$(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:c,text:b}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:c,text:b})}return!0},T$=()=>({state:e,dispatch:t})=>OD(e,t),S$=()=>({state:e,dispatch:t})=>RD(e,t),_$=()=>({state:e,dispatch:t})=>K1(e,t),x$=()=>({state:e,dispatch:t})=>X1(e,t),A$=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Jo(e.doc,e.selection.$from.pos,-1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},C$=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Jo(e.doc,e.selection.$from.pos,1);return r==null?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},N$=()=>({state:e,dispatch:t})=>vD(e,t),v$=()=>({state:e,dispatch:t})=>kD(e,t);function m3(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function k$(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n==="Space"&&(n=" ");let r,i,a,o;for(let s=0;s({editor:t,view:n,tr:r,dispatch:i})=>{let a=k$(e).split(/-(?!$)/),o=a.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),s=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:a.includes("Alt"),ctrlKey:a.includes("Ctrl"),metaKey:a.includes("Meta"),shiftKey:a.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,s))});return l?.steps.forEach(u=>{let c=u.map(r.mapping);c&&i&&r.maybeStep(c)}),!0};function Af(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?Wt(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(f,d)=>{if(f.isText)return;let h=Math.max(r,d),m=Math.min(i,d+f.nodeSize);s.push({node:f,from:h,to:m})});let l=i-r,u=s.filter(f=>o?o.name===f.node.type.name:!0).filter(f=>Am(f.node.attrs,n,{strict:!1}));return a?!!u.length:u.reduce((f,d)=>f+d.to-d.from,0)>=l}var M$=(e,t={})=>({state:n,dispatch:r})=>{let i=Wt(e,n.schema);return Af(n,i,t)?DD(n,r):!1},O$=()=>({state:e,dispatch:t})=>nT(e,t),R$=e=>({state:t,dispatch:n})=>{let r=Wt(e,t.schema);return HD(r)(t,n)},D$=()=>({state:e,dispatch:t})=>Z1(e,t);function wm(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function n3(e,t){let n=typeof t=="string"?[t]:t;return Object.keys(e).reduce((r,i)=>(n.includes(i)||(r[i]=e[i]),r),{})}var I$=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=wm(typeof e=="string"?e:e.name,r.schema);if(!s)return!1;s==="node"&&(a=Wt(e,r.schema)),s==="mark"&&(o=Zi(e,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{r.doc.nodesBetween(u.$from.pos,u.$to.pos,(c,f)=>{a&&a===c.type&&(l=!0,i&&n.setNodeMarkup(f,void 0,n3(c.attrs,t))),o&&c.marks.length&&c.marks.forEach(d=>{o===d.type&&(l=!0,i&&n.addMark(f,f+c.nodeSize,o.create(n3(d.attrs,t))))})})}),l},L$=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),B$=()=>({tr:e,dispatch:t})=>{if(t){let n=new Nn(e.doc);e.setSelection(n)}return!0},P$=()=>({state:e,dispatch:t})=>$1(e,t),U$=()=>({state:e,dispatch:t})=>W1(e,t),H$=()=>({state:e,dispatch:t})=>ID(e,t),z$=()=>({state:e,dispatch:t})=>iT(e,t),F$=()=>({state:e,dispatch:t})=>rT(e,t);function VT(e,t,n={},r={}){return xf(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var q$=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:l}=a;if(r.preserveWhitespace!=="full"){let u=VT(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});return o&&a.replaceWith(0,l.content.size,u).setMeta("preventUpdate",!n),!0}return o&&a.setMeta("preventUpdate",!n),s.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function g3(e,t){let n=Zi(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,l=>{o.push(...l.marks)});let s=o.find(l=>l.type.name===n.name);return s?{...s.attrs}:{}}function V$(e,t){let n=new zl(e);return t.forEach(r=>{r.steps.forEach(i=>{n.step(i)})}),n}function G$(e){for(let t=0;t0;n-=1){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function $T(e){return t=>Y$(t.$from,e)}function le(e,t,n){return e.config[t]===void 0&&e.parent?le(e.parent,t,n):typeof e.config[t]=="function"?e.config[t].bind({...n,parent:e.parent?le(e.parent,t,n):null}):e.config[t]}function jT(e){return e.map(t=>{let n={name:t.name,options:t.options,storage:t.storage},r=le(t,"addExtensions",n);return r?[t,...jT(r())]:t}).flat(10)}function XT(e,t){let n=qi.fromSchema(t).serializeFragment(e),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(n),i.innerHTML}function b3(e){return typeof e=="function"}function dt(e,t=void 0,...n){return b3(e)?t?e.bind(t)(...n):e(...n):e}function K$(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Xl(e){let t=e.filter(i=>i.type==="extension"),n=e.filter(i=>i.type==="node"),r=e.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:n,markExtensions:r}}function E3(e){let t=[],{nodeExtensions:n,markExtensions:r}=Xl(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(u=>u.name!=="text").map(u=>u.name),s=r.map(u=>u.name),l=[...o,...s];return e.forEach(u=>{let c={name:u.name,options:u.options,storage:u.storage,extensions:i},f=le(u,"addGlobalAttributes",c);if(!f)return;f().forEach(h=>{let m;Array.isArray(h.types)?m=h.types:h.types==="*"?m=l:h.types==="nodes"?m=o:h.types==="marks"?m=s:m=[],m.forEach(b=>{Object.entries(h.attributes).forEach(([E,g])=>{t.push({type:b,name:E,attribute:{...a,...g}})})})})}),i.forEach(u=>{let c={name:u.name,options:u.options,storage:u.storage},f=le(u,"addAttributes",c);if(!f)return;let d=f();Object.entries(d).forEach(([h,m])=>{let b={...a,...m};typeof b?.default=="function"&&(b.default=b.default()),b?.isRequired&&b?.default===void 0&&delete b.default,t.push({type:u.name,name:h,attribute:b})})}),t}function $$(e){let t=[],n="",r=!1,i=!1,a=0,o=e.length;for(let s=0;s0){a-=1,n+=l;continue}if(l===";"&&a===0){t.push(n),n="";continue}}n+=l}return n&&t.push(n),t}function r3(e){let t=[],n=$$(e||""),r=n.length;for(let i=0;i!!t).reduce((t,n)=>{let r={...t};return Object.entries(n).forEach(([i,a])=>{if(!r[i]){r[i]=a;return}if(i==="class"){let s=a?String(a).split(" "):[],l=r[i]?r[i].split(" "):[],u=s.filter(c=>!l.includes(c));r[i]=[...l,...u].join(" ")}else if(i==="style"){let s=new Map([...r3(r[i]),...r3(a)]);r[i]=Array.from(s.entries()).map(([l,u])=>`${l}: ${u}`).join("; ")}else r[i]=a}),r},{})}function Nm(e,t){return t.filter(n=>n.type===e.type.name).filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(e.attrs)||{}:{[n.name]:e.attrs[n.name]}).reduce((n,r)=>Cf(n,r),{})}function j$(e){return typeof e!="string"?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e==="true"?!0:e==="false"?!1:e}function i3(e,t){return"style"in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((a,o)=>{let s=o.attribute.parseHTML?o.attribute.parseHTML(n):j$(n.getAttribute(o.name));return s==null?a:{...a,[o.name]:s}},{});return{...r,...i}}}}function a3(e){return Object.fromEntries(Object.entries(e).filter(([t,n])=>t==="attrs"&&K$(n)?!1:n!=null))}function o3(e){var t,n;let r={};return!((t=e?.attribute)!=null&&t.isRequired)&&"default"in(e?.attribute||{})&&(r.default=e.attribute.default),((n=e?.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function X$(e,t){var n;let r=E3(e),{nodeExtensions:i,markExtensions:a}=Xl(e),o=(n=i.find(u=>le(u,"topNode")))==null?void 0:n.name,s=Object.fromEntries(i.map(u=>{let c=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:t},d=e.reduce((g,y)=>{let T=le(y,"extendNodeSchema",f);return{...g,...T?T(u):{}}},{}),h=a3({...d,content:dt(le(u,"content",f)),marks:dt(le(u,"marks",f)),group:dt(le(u,"group",f)),inline:dt(le(u,"inline",f)),atom:dt(le(u,"atom",f)),selectable:dt(le(u,"selectable",f)),draggable:dt(le(u,"draggable",f)),code:dt(le(u,"code",f)),whitespace:dt(le(u,"whitespace",f)),linebreakReplacement:dt(le(u,"linebreakReplacement",f)),defining:dt(le(u,"defining",f)),isolating:dt(le(u,"isolating",f)),attrs:Object.fromEntries(c.map(o3))}),m=dt(le(u,"parseHTML",f));m&&(h.parseDOM=m.map(g=>i3(g,c)));let b=le(u,"renderHTML",f);b&&(h.toDOM=g=>b({node:g,HTMLAttributes:Nm(g,c)}));let E=le(u,"renderText",f);return E&&(h.toText=E),[u.name,h]})),l=Object.fromEntries(a.map(u=>{let c=r.filter(E=>E.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:t},d=e.reduce((E,g)=>{let y=le(g,"extendMarkSchema",f);return{...E,...y?y(u):{}}},{}),h=a3({...d,inclusive:dt(le(u,"inclusive",f)),excludes:dt(le(u,"excludes",f)),group:dt(le(u,"group",f)),spanning:dt(le(u,"spanning",f)),code:dt(le(u,"code",f)),attrs:Object.fromEntries(c.map(o3))}),m=dt(le(u,"parseHTML",f));m&&(h.parseDOM=m.map(E=>i3(E,c)));let b=le(u,"renderHTML",f);return b&&(h.toDOM=E=>b({mark:E,HTMLAttributes:Nm(E,c)})),[u.name,h]}));return new Pl({topNode:o,nodes:s,marks:l})}function W$(e){let t=e.filter((n,r)=>e.indexOf(n)!==r);return Array.from(new Set(t))}function _f(e){return e.sort((n,r)=>{let i=le(n,"priority")||100,a=le(r,"priority")||100;return i>a?-1:ir.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(r=>`'${r}'`).join(", ")}]. This can lead to issues.`),t}function T3(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=` + +`,textSerializers:o={}}=n||{},s="";return e.nodesBetween(r,i,(l,u,c,f)=>{var d;l.isBlock&&u>r&&(s+=a);let h=o?.[l.type.name];if(h)return c&&(s+=h({node:l,pos:u,parent:c,index:f,range:t})),!1;l.isText&&(s+=(d=l?.text)==null?void 0:d.slice(Math.max(r,u)-u,i-u))}),s}function Q$(e,t){let n={from:0,to:e.content.size};return T3(e,n,t)}function S3(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,t])=>t.spec.toText).map(([t,n])=>[t,n.spec.toText]))}function Z$(e,t){let n=Wt(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,s=>{a.push(s)});let o=a.reverse().find(s=>s.type.name===n.name);return o?{...o.attrs}:{}}function J$(e,t){let n=wm(typeof t=="string"?t:t.name,e.schema);return n==="node"?Z$(e,t):n==="mark"?g3(e,t):{}}function ej(e,t=JSON.stringify){let n={};return e.filter(r=>{let i=t(r);return Object.prototype.hasOwnProperty.call(n,i)?!1:n[i]=!0})}function tj(e){let t=ej(e);return t.length===1?t:t.filter((n,r)=>!t.filter((a,o)=>o!==r).some(a=>n.oldRange.from>=a.oldRange.from&&n.oldRange.to<=a.oldRange.to&&n.newRange.from>=a.newRange.from&&n.newRange.to<=a.newRange.to))}function nj(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((i,a)=>{let o=[];if(i.ranges.length)i.forEach((s,l)=>{o.push({from:s,to:l})});else{let{from:s,to:l}=n[a];if(s===void 0||l===void 0)return;o.push({from:s,to:l})}o.forEach(({from:s,to:l})=>{let u=t.slice(a).map(s,-1),c=t.slice(a).map(l),f=t.invert().map(u,-1),d=t.invert().map(c);r.push({oldRange:{from:f,to:d},newRange:{from:u,to:c}})})}),tj(r)}function Tf(e,t){return t.nodes[e]||t.marks[e]||null}function xm(e,t,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let i=e.find(a=>a.type===t&&a.name===r);return i?i.attribute.keepOnSplit:!1}))}var rj=(e,t=500)=>{let n="",r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(i,a,o,s)=>{var l,u;let c=((u=(l=i.type.spec).toText)==null?void 0:u.call(l,{node:i,pos:a,parent:o,index:s}))||i.textContent||"%leaf%";n+=i.isAtom&&!i.isText?c:c.slice(0,Math.max(0,r-a))}),n};function GT(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?Zi(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(f=>a?a.name===f.type.name:!0).find(f=>Am(f.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:f,$to:d})=>{let h=f.pos,m=d.pos;e.doc.nodesBetween(h,m,(b,E)=>{if(a&&b.inlineContent&&!b.type.allowsMarkType(a))return!1;if(!b.isText&&!b.marks.length)return;let g=Math.max(h,E),y=Math.min(m,E+b.nodeSize),T=y-g;o+=T,s.push(...b.marks.map(S=>({mark:S,from:g,to:y})))})}),o===0)return!1;let l=s.filter(f=>a?a.name===f.mark.type.name:!0).filter(f=>Am(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),u=s.filter(f=>a?f.mark.type!==a&&f.mark.type.excludes(a):!0).reduce((f,d)=>f+d.to-d.from,0);return(l>0?l+u:l)>=o}function ij(e,t,n={}){if(!t)return Af(e,null,n)||GT(e,null,n);let r=wm(t,e.schema);return r==="node"?Af(e,t,n):r==="mark"?GT(e,t,n):!1}function s3(e,t){return Array.isArray(t)?t.some(n=>(typeof n=="string"?n:n.name)===e.name):t}function zT(e,t){let{nodeExtensions:n}=Xl(t),r=n.find(o=>o.name===e);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},a=dt(le(r,"group",i));return typeof a!="string"?!1:a.split(" ").includes("list")}function WT(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if(e.type.name==="hardBreak")return!0;if(e.isText)return!/\S/.test((r=e.text)!=null?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let i=!0;return e.content.forEach(a=>{i!==!1&&(WT(a,{ignoreWhitespace:n,checkChildren:t})||(i=!1))}),i}return!1}var _3=class x3{constructor(t){this.position=t}static fromJSON(t){return new x3(t.position)}toJSON(){return{position:this.position}}};function aj(e,t){let n=t.mapping.mapResult(e.position);return{position:new _3(n.pos),mapResult:n}}function oj(e){return new _3(e)}function sj(e,t,n){var r;let{selection:i}=t,a=null;if(d3(i)&&(a=i.$cursor),a){let s=(r=e.storedMarks)!=null?r:a.marks();return a.parent.type.allowsMarkType(n)&&(!!n.isInSet(s)||!s.some(u=>u.type.excludes(n)))}let{ranges:o}=i;return o.some(({$from:s,$to:l})=>{let u=s.depth===0?e.doc.inlineContent&&e.doc.type.allowsMarkType(n):!1;return e.doc.nodesBetween(s.pos,l.pos,(c,f,d)=>{if(u)return!1;if(c.isInline){let h=!d||d.type.allowsMarkType(n),m=!!n.isInSet(c.marks)||!c.marks.some(b=>b.type.excludes(n));u=h&&m}return!u}),u})}var lj=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,l=Zi(e,r.schema);if(i)if(o){let u=g3(r,l);n.addStoredMark(l.create({...u,...t}))}else s.forEach(u=>{let c=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(c,f,(d,h)=>{let m=Math.max(h,c),b=Math.min(h+d.nodeSize,f);d.marks.find(g=>g.type===l)?d.marks.forEach(g=>{l===g.type&&n.addMark(m,b,l.create({...g.attrs,...t}))}):n.addMark(m,b,l.create(t))})});return sj(r,n,l)},uj=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),cj=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=Wt(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:s})=>aT(a,{...o,...t})(n)?!0:s.clearNodes()).command(({state:s})=>aT(a,{...o,...t})(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},fj=e=>({tr:t,dispatch:n})=>{if(n){let{doc:r}=t,i=cs(e,0,r.content.size),a=fe.create(r,i);t.setSelection(a)}return!0},dj=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t=="number"?(o=t,s=t):t&&"from"in t&&"to"in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(l,u)=>{l.isText||n.setNodeMarkup(u,void 0,{...l.attrs,dir:e})}),!0},hj=e=>({tr:t,dispatch:n})=>{if(n){let{doc:r}=t,{from:i,to:a}=typeof e=="number"?{from:e,to:e}:e,o=pe.atStart(r).from,s=pe.atEnd(r).to,l=cs(i,o,s),u=cs(a,o,s),c=pe.create(r,l,u);t.setSelection(c)}return!0},pj=e=>({state:t,dispatch:n})=>{let r=Wt(e,t.schema);return zD(r)(t,n)};function l3(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(i=>t?.includes(i.type.name));e.tr.ensureMarks(r)}}var mj=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:l}=a,u=i.extensionManager.attributes,c=xm(u,s.node().type.name,s.node().attrs);if(a instanceof fe&&a.node.isBlock)return!s.parentOffset||!ur(o,s.pos)?!1:(r&&(e&&l3(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let f=l.parentOffset===l.parent.content.size,d=s.depth===0?void 0:G$(s.node(-1).contentMatchAt(s.indexAfter(-1))),h=f&&d?[{type:d,attrs:c}]:void 0,m=ur(t.doc,t.mapping.map(s.pos),1,h);if(!h&&!m&&ur(t.doc,t.mapping.map(s.pos),1,d?[{type:d}]:void 0)&&(m=!0,h=d?[{type:d,attrs:c}]:void 0),r){if(m&&(a instanceof pe&&t.deleteSelection(),t.split(t.mapping.map(s.pos),1,h),d&&!f&&!s.parentOffset&&s.parent.type!==d)){let b=t.mapping.map(s.before()),E=t.doc.resolve(b);s.node(-1).canReplaceWith(E.index(),E.index()+1,d)&&t.setNodeMarkup(t.mapping.map(s.before()),d)}e&&l3(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return m},gj=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{var o;let s=Wt(e,r.schema),{$from:l,$to:u}=r.selection,c=r.selection.node;if(c&&c.isBlock||l.depth<2||!l.sameParent(u))return!1;let f=l.node(-1);if(f.type!==s)return!1;let d=a.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==s||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let g=Q.empty,y=l.index(-1)?1:l.index(-2)?2:3;for(let R=l.depth-y;R>=l.depth-3;R-=1)g=Q.from(l.node(R).copy(g));let T=l.indexAfter(-1){if(M>-1)return!1;R.isTextblock&&R.content.size===0&&(M=L+1)}),M>-1&&n.setSelection(pe.near(n.doc.resolve(M))),n.scrollIntoView()}return!0}let h=u.pos===l.end()?f.contentMatchAt(0).defaultType:null,m={...xm(d,f.type.name,f.attrs),...t},b={...xm(d,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,u.pos);let E=h?[{type:s,attrs:m},{type:h,attrs:b}]:[{type:s,attrs:m}];if(!ur(n.doc,l.pos,2))return!1;if(i){let{selection:g,storedMarks:y}=r,{splittableMarks:T}=a.extensionManager,S=y||g.$to.parentOffset&&g.$from.marks();if(n.split(l.pos,2,E).scrollIntoView(),!S||!i)return!0;let v=S.filter(x=>T.includes(x.type.name));n.ensureMarks(v)}return!0},FT=(e,t)=>{let n=$T(o=>o.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&zr(e.doc,n.pos)&&e.join(n.pos),!0},qT=(e,t)=>{let n=$T(o=>o.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return n.node.type===i?.type&&zr(e.doc,r)&&e.join(r),!0};function bj(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return pe.between(r,i)}var Ej=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:l,commands:u,can:c})=>{let{extensions:f,splittableMarks:d}=i.extensionManager,h=Wt(e,o.schema),m=Wt(t,o.schema),{selection:b,storedMarks:E}=o,{$from:g,$to:y}=b,T=g.blockRange(y),S=E||b.$to.parentOffset&&b.$from.marks();if(!T)return!1;let v=$T(z=>zT(z.type.name,f))(b),x=b.from===0&&b.to===o.doc.content.size,M=o.doc.content.content,R=M.length===1?M[0]:null,L=x&&R&&zT(R.type.name,f)?{node:R,pos:0,depth:0}:null,A=v??L,H=!!v&&T.depth>=1&&T.depth-v.depth<=1,Y=!!L;if((H||Y)&&A){if(A.node.type===h)return x&&Y?l().command(({tr:z,dispatch:V})=>{let $=bj(z);return $?(z.setSelection($),V&&V(z),!0):!1}).liftListItem(m).run():u.liftListItem(m);if(zT(A.node.type.name,f)&&h.validContent(A.node.content))return l().command(()=>(a.setNodeMarkup(A.pos,h),!0)).command(()=>FT(a,h)).command(()=>qT(a,h)).run()}return!n||!S||!s?l().command(()=>c().wrapInList(h,r)?!0:u.clearNodes()).wrapInList(h,r).command(()=>FT(a,h)).command(()=>qT(a,h)).run():l().command(()=>{let z=c().wrapInList(h,r),V=S.filter($=>d.includes($.type.name));return a.ensureMarks(V),z?!0:u.clearNodes()}).wrapInList(h,r).command(()=>FT(a,h)).command(()=>qT(a,h)).run()},yj=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=Zi(e,r.schema);return GT(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},Tj=(e,t,n={})=>({state:r,commands:i})=>{let a=Wt(e,r.schema),o=Wt(t,r.schema),s=Af(r,a,n),l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),s?i.setNode(o,l):i.setNode(a,{...l,...n})},Sj=(e,t={})=>({state:n,commands:r})=>{let i=Wt(e,n.schema);return Af(n,i,t)?r.lift(i):r.wrapIn(i,t)},_j=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r=0;l-=1)o.step(s.steps[l].invert(s.docs[l]));if(a.text){let l=o.doc.resolve(a.from).marks();o.replaceWith(a.from,a.to,e.schema.text(a.text,l))}else o.delete(a.from,a.to)}return!0}}return!1},xj=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:l}=r.extensionManager;if(n){let u=Object.values(r.schema.marks).filter(c=>i||!l.includes(c.name));s.forEach(c=>{for(let f of u)t.removeMark(c.$from.pos,c.$to.pos,f)})}return!0},Aj=(e,t={})=>({tr:n,state:r,dispatch:i})=>{var a;let{extendEmptyMarkRange:o=!1}=t,{selection:s}=n,l=Zi(e,r.schema),{$from:u,empty:c,ranges:f}=s;if(!i)return!0;if(c&&o){let{from:d,to:h}=s,m=(a=u.marks().find(E=>E.type===l))==null?void 0:a.attrs,b=f3(u,l,m);b&&(d=b.from,h=b.to),n.removeMark(d,h,l)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,l)});return n.removeStoredMark(l),!0},Cj=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e=="number"?(a=e,o=e):e&&"from"in e&&"to"in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(s,l)=>{if(s.isText)return;let u={...s.attrs};delete u.dir,t.setNodeMarkup(l,void 0,u)}),!0},Nj=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=wm(typeof e=="string"?e:e.name,r.schema);if(!s)return!1;s==="node"&&(a=Wt(e,r.schema)),s==="mark"&&(o=Zi(e,r.schema));let l=!1;return n.selection.ranges.forEach(u=>{let c=u.$from.pos,f=u.$to.pos,d,h,m,b;n.selection.empty?r.doc.nodesBetween(c,f,(E,g)=>{a&&a===E.type&&(l=!0,m=Math.max(g,c),b=Math.min(g+E.nodeSize,f),d=g,h=E)}):r.doc.nodesBetween(c,f,(E,g)=>{g=c&&g<=f&&(a&&a===E.type&&(l=!0,i&&n.setNodeMarkup(g,void 0,{...E.attrs,...t})),o&&E.marks.length&&E.marks.forEach(y=>{if(o===y.type&&(l=!0,i)){let T=Math.max(g,c),S=Math.min(g+E.nodeSize,f);n.addMark(T,S,o.create({...y.attrs,...t}))}}))}),h&&(d!==void 0&&i&&n.setNodeMarkup(d,void 0,{...h.attrs,...t}),o&&h.marks.length&&h.marks.forEach(E=>{o===E.type&&i&&n.addMark(m,b,o.create({...E.attrs,...t}))}))}),l},vj=(e,t={})=>({state:n,dispatch:r})=>{let i=Wt(e,n.schema);return PD(i,t)(n,r)},kj=(e,t={})=>({state:n,dispatch:r})=>{let i=Wt(e,n.schema);return UD(i,t)(n,r)},wj=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(r=>r.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(r=>r!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}};var Mj=(e,t)=>{if(KT(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,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 Tm(e){var t;let{editor:n,from:r,to:i,text:a,rules:o,plugin:s}=e,{view:l}=n;if(l.composing)return!1;let u=l.state.doc.resolve(r);if(u.parent.type.spec.code||(t=u.nodeBefore||u.nodeAfter)!=null&&t.marks.find(d=>d.type.spec.code))return!1;let c=!1,f=rj(u)+a;return o.forEach(d=>{if(c)return;let h=Mj(f,d.find);if(!h)return;let m=l.state.tr,b=vm({state:l.state,transaction:m}),E={from:r-(h[0].length-a.length),to:i},{commands:g,chain:y,can:T}=new km({editor:n,state:b});d.handler({state:b,range:E,match:h,commands:g,chain:y,can:T})===null||!m.steps.length||(d.undoable&&m.setMeta(s,{transform:m,from:r,to:i,text:a}),l.dispatch(m),c=!0)}),c}function Oj(e){let{editor:t,rules:n}=e,r=new Ue({state:{init(){return null},apply(i,a,o){let s=i.getMeta(r);if(s)return s;let l=i.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:c}=l;typeof c=="string"?c=c:c=XT(Q.from(c),o.schema);let{from:f}=l,d=f+c.length;Tm({editor:t,from:f,to:d,text:c,rules:n,plugin:r})}),i.selectionSet||i.docChanged?null:a}},props:{handleTextInput(i,a,o,s){return Tm({editor:t,from:a,to:o,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:a}=i.state.selection;a&&Tm({editor:t,from:a.pos,to:a.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(i,a){if(a.key!=="Enter")return!1;let{$cursor:o}=i.state.selection;return o?Tm({editor:t,from:o.pos,to:o.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function Rj(e){return Object.prototype.toString.call(e).slice(8,-1)}function Sm(e){return Rj(e)!=="Object"?!1:e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function A3(e,t){let n={...e};return Sm(e)&&Sm(t)&&Object.keys(t).forEach(r=>{Sm(t[r])&&Sm(e[r])?n[r]=A3(e[r],t[r]):n[r]=t[r]}),n}var QT=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...dt(le(this,"addOptions",{name:this.name}))}}get storage(){return{...dt(le(this,"addStorage",{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>A3(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Dj=class C3 extends QT{constructor(){super(...arguments),this.type="mark"}static create(t={}){let n=typeof t=="function"?t():t;return new C3(n)}static handleExit({editor:t,mark:n}){let{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){let o=i.marks();if(!!!o.find(u=>u?.type.name===n.name))return!1;let l=o.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}configure(t){return super.configure(t)}extend(t){let n=typeof t=="function"?t():t;return super.extend(n)}};function Ij(e){return typeof e=="number"}var Lj=(e,t,n)=>{if(KT(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(i=>{let a=[i.text];return a.index=i.index,a.input=e,a.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),a.push(i.replaceWith)),a}):[]};function Bj(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:l,chain:u,can:c}=new km({editor:t,state:n}),f=[];return n.doc.nodesBetween(r,i,(h,m)=>{var b,E,g,y,T;if((E=(b=h.type)==null?void 0:b.spec)!=null&&E.code||!(h.isText||h.isTextblock||h.isInline))return;let S=(T=(y=(g=h.content)==null?void 0:g.size)!=null?y:h.nodeSize)!=null?T:0,v=Math.max(r,m),x=Math.min(i,m+S);if(v>=x)return;let M=h.isText?h.text||"":h.textBetween(v-m,x-m,void 0,"\uFFFC");Lj(M,a.find,o).forEach(L=>{if(L.index===void 0)return;let A=v+L.index+1,H=A+L[0].length,Y={from:n.tr.mapping.map(A),to:n.tr.mapping.map(H)},z=a.handler({state:n,range:Y,match:L,commands:l,chain:u,can:c,pasteEvent:o,dropEvent:s});f.push(z)})}),f.every(h=>h!==null)}var _m=null,Pj=e=>{var t;let n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData("text/html",e),n};function Uj(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,s;try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}let l=({state:c,from:f,to:d,rule:h,pasteEvt:m})=>{let b=c.tr,E=vm({state:c,transaction:b});if(!(!Bj({editor:t,state:E,from:Math.max(f-1,0),to:d.b-1,rule:h,pasteEvent:m,dropEvent:s})||!b.steps.length)){try{s=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{s=null}return o=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,b}};return n.map(c=>new Ue({view(f){let d=m=>{var b;r=(b=f.dom.parentElement)!=null&&b.contains(m.target)?f.dom.parentElement:null,r&&(_m=t)},h=()=>{_m&&(_m=null)};return window.addEventListener("dragstart",d),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",d),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,d)=>{if(a=r===f.dom.parentElement,s=d,!a){let h=_m;h?.isEditable&&setTimeout(()=>{let m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,d)=>{var h;let m=(h=d.clipboardData)==null?void 0:h.getData("text/html");return o=d,i=!!m?.includes("data-pm-slice"),!1}}},appendTransaction:(f,d,h)=>{let m=f[0],b=m.getMeta("uiEvent")==="paste"&&!i,E=m.getMeta("uiEvent")==="drop"&&!a,g=m.getMeta("applyPasteRules"),y=!!g;if(!b&&!E&&!y)return;if(y){let{text:v}=g;typeof v=="string"?v=v:v=XT(Q.from(v),h.schema);let{from:x}=g,M=x+v.length,R=Pj(v);return l({rule:c,state:h,from:x,to:{b:M},pasteEvt:R})}let T=d.doc.content.findDiffStart(h.doc.content),S=d.doc.content.findDiffEnd(h.doc.content);if(!(!Ij(T)||!S||T===S.b))return l({rule:c,state:h,from:T,to:S,pasteEvt:o})}}))}var Mm=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=y3(e),this.schema=X$(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Tf(t.name,this.schema)},r=le(t,"addCommands",n);return r?{...e,...r()}:e},{})}get plugins(){let{editor:e}=this;return _f([...this.extensions].reverse()).flatMap(r=>{let i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:Tf(r.name,this.schema)},a=[],o=le(r,"addKeyboardShortcuts",i),s={};if(r.type==="mark"&&le(r,"exitable",i)&&(s.ArrowRight=()=>Dj.handleExit({editor:e,mark:r})),o){let d=Object.fromEntries(Object.entries(o()).map(([h,m])=>[h,()=>m({editor:e})]));s={...s,...d}}let l=ZI(s);a.push(l);let u=le(r,"addInputRules",i);if(s3(r,e.options.enableInputRules)&&u){let d=u();if(d&&d.length){let h=Oj({editor:e,rules:d}),m=Array.isArray(h)?h:[h];a.push(...m)}}let c=le(r,"addPasteRules",i);if(s3(r,e.options.enablePasteRules)&&c){let d=c();if(d&&d.length){let h=Uj({editor:e,rules:d});a.push(...h)}}let f=le(r,"addProseMirrorPlugins",i);if(f){let d=f();a.push(...d)}return a})}get attributes(){return E3(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=Xl(this.extensions);return Object.fromEntries(t.filter(n=>!!le(n,"addNodeView")).map(n=>{let r=this.attributes.filter(l=>l.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Wt(n.name,this.schema)},a=le(n,"addNodeView",i);if(!a)return[];let o=a();if(!o)return[];let s=(l,u,c,f,d)=>{let h=Nm(l,r);return o({node:l,view:u,getPos:c,decorations:f,innerDecorations:d,editor:e,extension:n,HTMLAttributes:h})};return[n.name,s]}))}dispatchTransaction(e){let{editor:t}=this;return _f([...this.extensions].reverse()).reduceRight((r,i)=>{let a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Tf(i.name,this.schema)},o=le(i,"dispatchTransaction",a);return o?s=>{o.call(a,{transaction:s,next:r})}:r},e)}transformPastedHTML(e){let{editor:t}=this;return _f([...this.extensions]).reduce((r,i)=>{let a={name:i.name,options:i.options,storage:this.editor.extensionStorage[i.name],editor:t,type:Tf(i.name,this.schema)},o=le(i,"transformPastedHTML",a);return o?(s,l)=>{let u=r(s,l);return o.call(a,u)}:r},e||(r=>r))}get markViews(){let{editor:e}=this,{markExtensions:t}=Xl(this.extensions);return Object.fromEntries(t.filter(n=>!!le(n,"addMarkView")).map(n=>{let r=this.attributes.filter(s=>s.type===n.name),i={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Zi(n.name,this.schema)},a=le(n,"addMarkView",i);if(!a)return[];let o=(s,l,u)=>{let c=Nm(s,r);return a()({mark:s,view:l,inline:u,editor:e,extension:n,HTMLAttributes:c,updateAttributes:f=>{Qj(s,e,f)}})};return[n.name,o]}))}destroy(){this.extensions.forEach(e=>{let t=e;for(;t.parent;){let n=t.parent;n.child===t&&(n.child=null),t=n}}),this.extensions=[],this.baseExtensions=[],this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(t=>[t.name,t.storage])),e.forEach(t=>{var n,r;let i={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Tf(t.name,this.schema)};t.type==="mark"&&(((n=dt(le(t,"keepOnSplit",i)))==null||n)&&this.splittableMarks.push(t.name),(r=dt(le(t,"clearable",i)))==null||r||this.nonClearableMarks.push(t.name));let a=le(t,"onBeforeCreate",i),o=le(t,"onCreate",i),s=le(t,"onUpdate",i),l=le(t,"onSelectionUpdate",i),u=le(t,"onTransaction",i),c=le(t,"onFocus",i),f=le(t,"onBlur",i),d=le(t,"onDestroy",i);a&&this.editor.on("beforeCreate",a),o&&this.editor.on("create",o),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),u&&this.editor.on("transaction",u),c&&this.editor.on("focus",c),f&&this.editor.on("blur",f),d&&this.editor.on("destroy",d)})}};Mm.resolve=y3;Mm.sort=_f;Mm.flatten=jT;var Hj={};YT(Hj,{ClipboardTextSerializer:()=>v3,Commands:()=>k3,Delete:()=>w3,Drop:()=>M3,Editable:()=>O3,FocusEvents:()=>D3,Keymap:()=>I3,Paste:()=>L3,Tabindex:()=>B3,TextDirection:()=>P3,focusEventsPluginKey:()=>R3});var Kn=class N3 extends QT{constructor(){super(...arguments),this.type="extension"}static create(t={}){let n=typeof t=="function"?t():t;return new N3(n)}configure(t){return super.configure(t)}extend(t){let n=typeof t=="function"?t():t;return super.extend(n)}},v3=Kn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Ue({key:new at("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=S3(n),{blockSeparator:o}=this.options,s={...o!==void 0?{blockSeparator:o}:{},textSerializers:a};return[...i.ranges].sort((u,c)=>u.$from.pos-c.$from.pos).map(({$from:u,$to:c})=>T3(r,{from:u.pos,to:c.pos},s)).join(o??` + +`)}}})]}}),k3=Kn.create({name:"commands",addCommands(){return{...u3}}}),w3=Kn.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,i;let a=()=>{var o,s,l,u;if((u=(l=(s=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:s.filterTransaction)==null?void 0:l.call(s,e))!=null?u:e.getMeta("y-sync$"))return;let c=V$(e.before,[e,...t]);nj(c).forEach(h=>{c.mapping.mapResult(h.oldRange.from).deletedAfter&&c.mapping.mapResult(h.oldRange.to).deletedBefore&&c.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,b)=>{let E=b+m.nodeSize-2,g=h.oldRange.from<=b&&E<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:b,to:E,newFrom:c.mapping.map(b),newTo:c.mapping.map(E),deletedRange:h.oldRange,newRange:h.newRange,partial:!g,editor:this.editor,transaction:e,combinedTransform:c})})});let d=c.mapping;c.steps.forEach((h,m)=>{var b,E;if(h instanceof Gi){let g=d.slice(m).map(h.from,-1),y=d.slice(m).map(h.to),T=d.invert().map(g,-1),S=d.invert().map(y),v=g>0?(b=c.doc.nodeAt(g-1))==null?void 0:b.marks.some(M=>M.eq(h.mark)):!1,x=(E=c.doc.nodeAt(y))==null?void 0:E.marks.some(M=>M.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:T,to:S},newRange:{from:g,to:y},partial:!!(x||v),editor:this.editor,transaction:e,combinedTransform:c})}})};(i=(r=(n=this.editor.options.coreExtensionOptions)==null?void 0:n.delete)==null?void 0:r.async)==null||i?setTimeout(a,0):a()}}),M3=Kn.create({name:"drop",addProseMirrorPlugins(){return[new Ue({key:new at("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),O3=Kn.create({name:"editable",addProseMirrorPlugins(){return[new Ue({key:new at("editable"),props:{editable:()=>this.editor.options.editable}})]}}),R3=new at("focusEvents"),D3=Kn.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:e}=this;return[new Ue({key:R3,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),I3=Kn.create({name:"keymap",addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:s})=>{let{selection:l,doc:u}=s,{empty:c,$anchor:f}=l,{pos:d,parent:h}=f,m=f.parent.isTextblock&&d>0?s.doc.resolve(d-1):f,b=m.parent.type.spec.isolating,E=f.pos-f.parentOffset,g=b&&m.parent.childCount===1?E===f.pos:Ce.atStart(u).from===d;return!c||!h.type.isTextblock||h.textContent.length||!g||g&&f.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},a={...r,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Cm()||m3()?a:i},addProseMirrorPlugins(){return[new Ue({key:new at("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(b=>b.getMeta("composition")))return;let r=e.some(b=>b.docChanged)&&!t.doc.eq(n.doc),i=e.some(b=>b.getMeta("preventClearDocument"));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,l=Ce.atStart(t.doc).from,u=Ce.atEnd(t.doc).to;if(a||!(o===l&&s===u)||!WT(n.doc))return;let d=n.tr,h=vm({state:n,transaction:d}),{commands:m}=new km({editor:this.editor,state:h});if(m.clearNodes(),!!d.steps.length)return d}})]}}),L3=Kn.create({name:"paste",addProseMirrorPlugins(){return[new Ue({key:new at("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),B3=Kn.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Ue({key:new at("tabindex"),props:{attributes:()=>{var e;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(e=this.options.value)!=null?e:"0"}}}})]}}),P3=Kn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=Xl(this.extensions);return[{types:e.filter(t=>t.name!=="text").map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{let n=t.getAttribute("dir");return n&&(n==="ltr"||n==="rtl"||n==="auto")?n:this.options.direction},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new Ue({key:new at("textDirection"),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),zj=class Sf{constructor(t,n,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,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 t;return(t=this.actualDepth)!=null?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let n=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t 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},t)}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;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new Sf(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new Sf(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new Sf(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+(a?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let l=this.resolvedPos.doc.resolve(s);if(!i&&!o&&l.depth<=this.depth)return;let u=new Sf(l,this.editor,i,i||o?n:null);i&&(u.actualDepth=this.depth+1),t.push(u)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let t=this.children;return t[t.length-1]||null}closest(t,n={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(n).length>0){let a=i.node.attrs,o=Object.keys(n);for(let s=0;s{r&&i.length>0||(o.node.type.name===t&&a.every(l=>n[l]===o.node.attrs[l])&&i.push(o),!(r&&i.length>0)&&(i=i.concat(o.querySelectorAll(t,n,r))))}),i}setAttribute(t){let{tr:n}=this.editor.state;n.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(n)}},Fj=`.ProseMirror { position: relative; } @@ -171,33 +171,33 @@ img.ProseMirror-separator { .ProseMirror-focused .ProseMirror-gapcursor { display: block; -}`;function Hj(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}var P3=class extends Nj{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!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:nj,createMappablePosition:rj},this.setOptions(e),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:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);let t=this.createDoc(),n=d3(t,this.options.autofocus);this.editorState=im.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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){let e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}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=Hj(Uj,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=g3(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(i=>{let a=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(a))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t,n,r;let a=[...this.options.enableCoreExtensions?[M3,N3.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),v3,R3,D3,L3.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),w3,I3,k3,B3.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Mm(a,this)}createCommandManager(){this.commandManager=new km({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=VT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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()}}),e=VT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new mf(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let l=this.view.dom;l.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),s=o?.getMeta("focus"),l=o?.getMeta("blur");s&&this.emit("focus",{editor:this,event:s.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(e.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||a.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return W$(this.state,e)}isActive(e,t){let n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return tj(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return XT(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` +}`;function qj(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),i.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(i),i}var U3=class extends wj{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.destroyed=!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:aj,createMappablePosition:oj},this.setOptions(e),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:a})=>this.options.onDrop(r,i,a)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);let t=this.createDoc(),n=h3(t,this.options.autofocus);this.editorState=im.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){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(e),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){let e=this.editorView.dom;e?.editor&&delete e.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(e){console.warn("Failed to remove CSS element:",e)}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=qj(Fj,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.editorView||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&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:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t==="state")return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=b3(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(i=>{let a=typeof i=="string"?`${i}$`:i.key;n=n.filter(o=>!o.key.startsWith(a))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t,n,r;let a=[...this.options.enableCoreExtensions?[O3,v3.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),k3,D3,I3,B3.configure({value:(r=(n=this.options.coreExtensionOptions)==null?void 0:n.tabindex)==null?void 0:r.value}),M3,L3,w3,P3.configure({direction:this.options.textDirection})].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new Mm(a,this)}createCommandManager(){this.commandManager=new km({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=VT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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()}}),e=VT(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new mf(e,{...t,attributes:{role:"textbox",...t?.attributes},dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let l=this.view.dom;l.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(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(u=>{var c;return(c=this.capturedTransaction)==null?void 0:c.step(u)});return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=n.findLast(u=>u.getMeta("focus")||u.getMeta("blur")),s=o?.getMeta("focus"),l=o?.getMeta("blur");s&&this.emit("focus",{editor:this,event:s.event,transaction:o}),l&&this.emit("blur",{editor:this,event:l.event,transaction:o}),!(e.getMeta("preventUpdate")||!n.some(u=>u.docChanged)||a.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return J$(this.state,e)}isActive(e,t){let n=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return ij(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return XT(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=` -`,textSerializers:n={}}=e||{};return j$(this.state.doc,{blockSeparator:t,textSerializers:{...T3(this.schema),...n}})}get isEmpty(){return WT(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new Pj(t,this,!1,n)}get $doc(){return this.$pos(0)}};function U3(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var zj={};YT(zj,{createAtomBlockMarkdownSpec:()=>Fj,createBlockMarkdownSpec:()=>qj,createInlineMarkdownSpec:()=>Yj,parseAttributes:()=>ZT,parseIndentedBlocks:()=>Kj,renderNestedMarkdownContent:()=>$j,serializeAttributes:()=>JT});function ZT(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){let u=i.map(c=>c.trim().slice(1));t.class=u.join(" ")}let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);let o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,c])=>{var f;let d=parseInt(((f=c.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=n[d];h&&(t[u]=h.slice(1,-1))});let l=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 l&&l.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(t[c]=!0)}),t}function JT(e){if(!e||Object.keys(e).length===0)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function Fj(e){let{nodeName:t,name:n,parseAttributes:r=ZT,serializeAttributes:i=JT,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,l=n||t,u=c=>{if(!s)return c;let f={};return s.forEach(d=>{d in c&&(f[d]=c[d])}),f};return{parseMarkdown:(c,f)=>{let d={...a,...c.attributes};return f.createNode(t,d,[])},markdownTokenizer:{name:t,level:"block",start(c){var f;let d=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(f=c.match(d))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(c,f,d){let h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=c.match(h);if(!m)return;let b=m[1]||"",E=r(b);if(!o.find(y=>!(y in E)))return{type:t,raw:m[0],attributes:E}}},renderMarkdown:c=>{let f=u(c.attrs||{}),d=i(f),h=d?` {${d}}`:"";return`:::${l}${h} :::`}}}function qj(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=ZT,serializeAttributes:a=JT,defaultAttributes:o={},content:s="block",allowedAttributes:l}=e,u=n||t,c=f=>{if(!l)return f;let d={};return l.forEach(h=>{h in f&&(d[h]=f[h])}),d};return{parseMarkdown:(f,d)=>{let h;if(r){let b=r(f);h=typeof b=="string"?[{type:"text",text:b}]:b}else s==="block"?h=d.parseChildren(f.tokens||[]):h=d.parseInline(f.tokens||[]);let m={...o,...f.attributes};return d.createNode(t,m,h)},markdownTokenizer:{name:t,level:"block",start(f){var d;let h=new RegExp(`^:::${u}`,"m"),m=(d=f.match(h))==null?void 0:d.index;return m!==void 0?m:-1},tokenize(f,d,h){var m;let b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),E=f.match(b);if(!E)return;let[g,y=""]=E,T=i(y),S=1,v=g.length,x="",M=/^:::([\w-]*)(\s.*)?/gm,R=f.slice(v);for(M.lastIndex=0;;){let L=M.exec(R);if(L===null)break;let A=L.index,H=L[1];if(!((m=L[2])!=null&&m.endsWith(":::"))){if(H)S+=1;else if(S-=1,S===0){let Y=R.slice(0,A);x=Y.trim();let z=f.slice(0,v+A+L[0].length),V=[];if(x)if(s==="block")for(V=h.blockTokens(Y),V.forEach($=>{$.text&&(!$.tokens||$.tokens.length===0)&&($.tokens=h.inlineTokens($.text))});V.length>0;){let $=V[V.length-1];if($.type==="paragraph"&&(!$.text||$.text.trim()===""))V.pop();else break}else V=h.inlineTokens(x);return{type:t,raw:z,attributes:T,content:x,tokens:V}}}}}},renderMarkdown:(f,d)=>{let h=c(f.attrs||{}),m=a(h),b=m?` {${m}}`:"",E=d.renderChildren(f.content||[],` +`,textSerializers:n={}}=e||{};return Q$(this.state.doc,{blockSeparator:t,textSerializers:{...S3(this.schema),...n}})}get isEmpty(){return WT(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit("destroy"),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return((n=this.$doc)==null?void 0:n.querySelectorAll(e,t))||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText?t.nodeAfter:null;return new zj(t,this,!1,n)}get $doc(){return this.$pos(0)}};function H3(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var Vj={};YT(Vj,{createAtomBlockMarkdownSpec:()=>Gj,createBlockMarkdownSpec:()=>Yj,createInlineMarkdownSpec:()=>jj,parseAttributes:()=>ZT,parseIndentedBlocks:()=>Xj,renderNestedMarkdownContent:()=>Wj,serializeAttributes:()=>JT});function ZT(e){if(!e?.trim())return{};let t={},n=[],r=e.replace(/["']([^"']*)["']/g,u=>(n.push(u),`__QUOTED_${n.length-1}__`)),i=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){let u=i.map(c=>c.trim().slice(1));t.class=u.join(" ")}let a=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);a&&(t.id=a[1]);let o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(r.matchAll(o)).forEach(([,u,c])=>{var f;let d=parseInt(((f=c.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=n[d];h&&(t[u]=h.slice(1,-1))});let l=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 l&&l.split(/\s+/).filter(Boolean).forEach(c=>{c.match(/^[a-zA-Z][\w-]*$/)&&(t[c]=!0)}),t}function JT(e){if(!e||Object.keys(e).length===0)return"";let t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(r=>t.push(`.${r}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([n,r])=>{n==="class"||n==="id"||(r===!0?t.push(n):r!==!1&&r!=null&&t.push(`${n}="${String(r)}"`))}),t.join(" ")}function Gj(e){let{nodeName:t,name:n,parseAttributes:r=ZT,serializeAttributes:i=JT,defaultAttributes:a={},requiredAttributes:o=[],allowedAttributes:s}=e,l=n||t,u=c=>{if(!s)return c;let f={};return s.forEach(d=>{d in c&&(f[d]=c[d])}),f};return{parseMarkdown:(c,f)=>{let d={...a,...c.attributes};return f.createNode(t,d,[])},markdownTokenizer:{name:t,level:"block",start(c){var f;let d=new RegExp(`^:::${l}(?:\\s|$)`,"m"),h=(f=c.match(d))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(c,f,d){let h=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=c.match(h);if(!m)return;let b=m[1]||"",E=r(b);if(!o.find(y=>!(y in E)))return{type:t,raw:m[0],attributes:E}}},renderMarkdown:c=>{let f=u(c.attrs||{}),d=i(f),h=d?` {${d}}`:"";return`:::${l}${h} :::`}}}function Yj(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=ZT,serializeAttributes:a=JT,defaultAttributes:o={},content:s="block",allowedAttributes:l}=e,u=n||t,c=f=>{if(!l)return f;let d={};return l.forEach(h=>{h in f&&(d[h]=f[h])}),d};return{parseMarkdown:(f,d)=>{let h;if(r){let b=r(f);h=typeof b=="string"?[{type:"text",text:b}]:b}else s==="block"?h=d.parseChildren(f.tokens||[]):h=d.parseInline(f.tokens||[]);let m={...o,...f.attributes};return d.createNode(t,m,h)},markdownTokenizer:{name:t,level:"block",start(f){var d;let h=new RegExp(`^:::${u}`,"m"),m=(d=f.match(h))==null?void 0:d.index;return m!==void 0?m:-1},tokenize(f,d,h){var m;let b=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),E=f.match(b);if(!E)return;let[g,y=""]=E,T=i(y),S=1,v=g.length,x="",M=/^:::([\w-]*)(\s.*)?/gm,R=f.slice(v);for(M.lastIndex=0;;){let L=M.exec(R);if(L===null)break;let A=L.index,H=L[1];if(!((m=L[2])!=null&&m.endsWith(":::"))){if(H)S+=1;else if(S-=1,S===0){let Y=R.slice(0,A);x=Y.trim();let z=f.slice(0,v+A+L[0].length),V=[];if(x)if(s==="block")for(V=h.blockTokens(Y),V.forEach($=>{$.text&&(!$.tokens||$.tokens.length===0)&&($.tokens=h.inlineTokens($.text))});V.length>0;){let $=V[V.length-1];if($.type==="paragraph"&&(!$.text||$.text.trim()===""))V.pop();else break}else V=h.inlineTokens(x);return{type:t,raw:z,attributes:T,content:x,tokens:V}}}}}},renderMarkdown:(f,d)=>{let h=c(f.attrs||{}),m=a(h),b=m?` {${m}}`:"",E=d.renderChildren(f.content||[],` `);return`:::${u}${b} ${E} -:::`}}}function Vj(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function Gj(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function Yj(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Vj,serializeAttributes:a=Gj,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:l}=e,u=n||t,c=d=>{if(!l)return d;let h={};return l.forEach(m=>{let b=typeof m=="string"?m:m.name,E=typeof m=="string"?void 0:m.skipIfDefault;if(b in d){let g=d[b];if(E!==void 0&&g===E)return;h[b]=g}}),h},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(d,h)=>{let m={...o,...d.attributes};if(s)return h.createNode(t,m);let b=r?r(d):d.content||"";return b?h.createNode(t,m,[h.createTextNode(b)]):h.createNode(t,m,[])},markdownTokenizer:{name:t,level:"inline",start(d){let h=s?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=d.match(h),b=m?.index;return b!==void 0?b:-1},tokenize(d,h,m){let b=s?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),E=d.match(b);if(!E)return;let g="",y="";if(s){let[,S]=E;y=S}else{let[,S,v]=E;y=S,g=v||""}let T=i(y.trim());return{type:t,raw:E[0],content:g.trim(),attributes:T}}},renderMarkdown:d=>{let h="";r?h=r(d):d.content&&d.content.length>0&&(h=d.content.filter(g=>g.type==="text").map(g=>g.text).join(""));let m=c(d.attrs||{}),b=a(m),E=b?` ${b}`:"";return s?`[${u}${E}]`:`[${u}${E}]${h}[/${u}]`}}}function Kj(e,t,n){var r,i,a,o;let s=e.split(` +:::`}}}function Kj(e){if(!e.trim())return{};let t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g,r=n.exec(e);for(;r!==null;){let[,i,a,o]=r;t[i]=a||o,r=n.exec(e)}return t}function $j(e){return Object.entries(e).filter(([,t])=>t!=null).map(([t,n])=>`${t}="${n}"`).join(" ")}function jj(e){let{nodeName:t,name:n,getContent:r,parseAttributes:i=Kj,serializeAttributes:a=$j,defaultAttributes:o={},selfClosing:s=!1,allowedAttributes:l}=e,u=n||t,c=d=>{if(!l)return d;let h={};return l.forEach(m=>{let b=typeof m=="string"?m:m.name,E=typeof m=="string"?void 0:m.skipIfDefault;if(b in d){let g=d[b];if(E!==void 0&&g===E)return;h[b]=g}}),h},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(d,h)=>{let m={...o,...d.attributes};if(s)return h.createNode(t,m);let b=r?r(d):d.content||"";return b?h.createNode(t,m,[h.createTextNode(b)]):h.createNode(t,m,[])},markdownTokenizer:{name:t,level:"inline",start(d){let h=s?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=d.match(h),b=m?.index;return b!==void 0?b:-1},tokenize(d,h,m){let b=s?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),E=d.match(b);if(!E)return;let g="",y="";if(s){let[,S]=E;y=S}else{let[,S,v]=E;y=S,g=v||""}let T=i(y.trim());return{type:t,raw:E[0],content:g.trim(),attributes:T}}},renderMarkdown:d=>{let h="";r?h=r(d):d.content&&d.content.length>0&&(h=d.content.filter(g=>g.type==="text").map(g=>g.text).join(""));let m=c(d.attrs||{}),b=a(m),E=b?` ${b}`:"";return s?`[${u}${E}]`:`[${u}${E}]${h}[/${u}]`}}}function Xj(e,t,n){var r,i,a,o;let s=e.split(` `),l=[],u="",c=0,f=t.baseIndentSize||2;for(;c0)break;if(d.trim()===""){c+=1,u=`${u}${d} `;continue}else return}let m=t.extractItemData(h),{indentLevel:b,mainContent:E}=m;u=`${u}${d} `;let g=[E];for(c+=1;cA.trim()!=="");if(M===-1)break;if((((i=(r=s[c+1+M].match(/^(\s*)/))==null?void 0:r[1])==null?void 0:i.length)||0)>b){g.push(v),u=`${u}${v} `,c+=1;continue}else break}if((((o=(a=v.match(/^(\s*)/))==null?void 0:a[1])==null?void 0:o.length)||0)>b)g.push(v),u=`${u}${v} `,c+=1;else break}let y,T=g.slice(1);if(T.length>0){let v=T.map(x=>x.slice(b+f)).join(` -`);v.trim()&&(t.customNestedParser?y=t.customNestedParser(v):y=n.blockTokens(v))}let S=t.createToken(m,y);l.push(S)}if(l.length!==0)return{items:l,raw:u}}function $j(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i=typeof n=="function"?n(r):n,[a,...o]=e.content,s=t.renderChildren([a]),l=`${i}${s}`;return o&&o.length>0&&o.forEach((u,c)=>{var f,d;let h=(d=(f=t.renderChild)==null?void 0:f.call(t,u,c+1))!=null?d:t.renderChildren([u]);if(h!=null){let m=h.split(` +`);v.trim()&&(t.customNestedParser?y=t.customNestedParser(v):y=n.blockTokens(v))}let S=t.createToken(m,y);l.push(S)}if(l.length!==0)return{items:l,raw:u}}function Wj(e,t,n,r){if(!e||!Array.isArray(e.content))return"";let i=typeof n=="function"?n(r):n,[a,...o]=e.content,s=t.renderChildren([a]),l=`${i}${s}`;return o&&o.length>0&&o.forEach((u,c)=>{var f,d;let h=(d=(f=t.renderChild)==null?void 0:f.call(t,u,c+1))!=null?d:t.renderChildren([u]);if(h!=null){let m=h.split(` `).map(b=>b?t.indent(b):t.indent("")).join(` `);l+=u.type==="paragraph"?` ${m}`:` -${m}`}}),l}function jj(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((s,l)=>{let u=a.mapping.map(l),c=a.mapping.map(l)+s.nodeSize,f=null;if(s.marks.forEach(h=>{if(h!==o)return!1;f=h}),!f)return;let d=!1;if(Object.keys(n).forEach(h=>{n[h]!==f.attrs[h]&&(d=!0)}),d){let h=e.type.create({...e.attrs,...n});a.removeMark(u,c,e.type),a.addMark(u,c,h)}}),a.docChanged&&t.view.dispatch(a)}var Za=class H3 extends QT{constructor(){super(...arguments),this.type="node"}static create(t={}){let n=typeof t=="function"?t():t;return new H3(n)}configure(t){return super.configure(t)}extend(t){let n=typeof t=="function"?t():t;return super.extend(n)}};var to=q(me(),1),eL=q(Vp(),1);var{getOwnPropertyNames:Xj,getOwnPropertySymbols:Wj}=Object,{hasOwnProperty:Qj}=Object.prototype;function eS(e,t){return function(r,i,a){return e(r,i,a)&&t(r,i,a)}}function Om(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);let{cache:a}=i,o=a.get(n),s=a.get(r);if(o&&s)return o===r&&s===n;a.set(n,r),a.set(r,n);let l=e(n,r,i);return a.delete(n),a.delete(r),l}}function Zj(e){return e?.[Symbol.toStringTag]}function z3(e){return Xj(e).concat(Wj(e))}var Jj=Object.hasOwn||((e,t)=>Qj.call(e,t));function fs(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var eX="__v",tX="__o",nX="_owner",{getOwnPropertyDescriptor:F3,keys:q3}=Object;function rX(e,t){return e.byteLength===t.byteLength&&Rm(new Uint8Array(e),new Uint8Array(t))}function iX(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function aX(e,t){return e.byteLength===t.byteLength&&Rm(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function oX(e,t){return fs(e.getTime(),t.getTime())}function sX(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function lX(e,t){return e===t}function V3(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=new Array(r),a=e.entries(),o,s,l=0;for(;(o=a.next())&&!o.done;){let u=t.entries(),c=!1,f=0;for(;(s=u.next())&&!s.done;){if(i[f]){f++;continue}let d=o.value,h=s.value;if(n.equals(d[0],h[0],l,f,e,t,n)&&n.equals(d[1],h[1],d[0],h[0],e,t,n)){c=i[f]=!0;break}f++}if(!c)return!1;l++}return!0}var uX=fs;function cX(e,t,n){let r=q3(e),i=r.length;if(q3(t).length!==i)return!1;for(;i-- >0;)if(!Y3(e,t,n,r[i]))return!1;return!0}function Nf(e,t,n){let r=z3(e),i=r.length;if(z3(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!Y3(e,t,n,a)||(o=F3(e,a),s=F3(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function fX(e,t){return fs(e.valueOf(),t.valueOf())}function dX(e,t){return e.source===t.source&&e.flags===t.flags}function G3(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=new Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let l=t.values(),u=!1,c=0;for(;(s=l.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function Rm(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function hX(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function Y3(e,t,n,r){return(r===nX||r===tX||r===eX)&&(e.$$typeof||t.$$typeof)?!0:Jj(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var pX="[object ArrayBuffer]",mX="[object Arguments]",gX="[object Boolean]",bX="[object DataView]",EX="[object Date]",yX="[object Error]",TX="[object Map]",SX="[object Number]",_X="[object Object]",xX="[object RegExp]",AX="[object Set]",CX="[object String]",NX={"[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},vX="[object URL]",kX=Object.prototype.toString;function wX({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:f,areTypedArraysEqual:d,areUrlsEqual:h,unknownTagComparators:m}){return function(E,g,y){if(E===g)return!0;if(E==null||g==null)return!1;let T=typeof E;if(T!==typeof g)return!1;if(T!=="object")return T==="number"?s(E,g,y):T==="function"?a(E,g,y):!1;let S=E.constructor;if(S!==g.constructor)return!1;if(S===Object)return l(E,g,y);if(Array.isArray(E))return t(E,g,y);if(S===Date)return r(E,g,y);if(S===RegExp)return c(E,g,y);if(S===Map)return o(E,g,y);if(S===Set)return f(E,g,y);let v=kX.call(E);if(v===EX)return r(E,g,y);if(v===xX)return c(E,g,y);if(v===TX)return o(E,g,y);if(v===AX)return f(E,g,y);if(v===_X)return typeof E.then!="function"&&typeof g.then!="function"&&l(E,g,y);if(v===vX)return h(E,g,y);if(v===yX)return i(E,g,y);if(v===mX)return l(E,g,y);if(NX[v])return d(E,g,y);if(v===pX)return e(E,g,y);if(v===bX)return n(E,g,y);if(v===gX||v===SX||v===CX)return u(E,g,y);if(m){let x=m[v];if(!x){let M=Zj(E);M&&(x=m[M])}if(x)return x(E,g,y)}return!1}}function MX({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:rX,areArraysEqual:n?Nf:iX,areDataViewsEqual:aX,areDatesEqual:oX,areErrorsEqual:sX,areFunctionsEqual:lX,areMapsEqual:n?eS(V3,Nf):V3,areNumbersEqual:uX,areObjectsEqual:n?Nf:cX,arePrimitiveWrappersEqual:fX,areRegExpsEqual:dX,areSetsEqual:n?eS(G3,Nf):G3,areTypedArraysEqual:n?eS(Rm,Nf):Rm,areUrlsEqual:hX,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let i=Om(r.areArraysEqual),a=Om(r.areMapsEqual),o=Om(r.areObjectsEqual),s=Om(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:s})}return r}function OX(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function RX({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(s,l){let{cache:u=e?new WeakMap:void 0,meta:c}=n();return t(s,l,{cache:u,equals:r,meta:c,strict:i})};if(e)return function(s,l){return t(s,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(s,l){return t(s,l,a)}}var K3=Ja(),Ige=Ja({strict:!0}),Lge=Ja({circular:!0}),Bge=Ja({circular:!0,strict:!0}),Pge=Ja({createInternalComparator:()=>fs}),Uge=Ja({strict:!0,createInternalComparator:()=>fs}),Hge=Ja({circular:!0,createInternalComparator:()=>fs}),zge=Ja({circular:!0,createInternalComparator:()=>fs,strict:!0});function Ja(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=MX(e),o=wX(a),s=n?n(o):OX(o);return RX({circular:t,comparator:o,createState:r,equals:s,strict:i})}var no=q(me(),1),tL=q(W3(),1),aL=q(ne(),1),vf=q(me(),1),JX=q(ne(),1),sL=q(me(),1),lL=q(ne(),1);var uL=q(me(),1),eW=q(me(),1),tW=q(io(),1),nW=q(ne(),1),rW=q(ne(),1);var nS=q(me(),1),iW=q(ne(),1),ds=q(me(),1),Im=q(ne(),1),FX=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},qX=({contentComponent:e})=>{let t=(0,J3.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,Ji.jsx)(Ji.Fragment,{children:Object.values(t)})};function VX(){let e=new Set,t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:Z3.default.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(i=>i())}}}var GX=class extends eo.default.Component{constructor(e){super(e),this.editorContentRef=eo.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=VX(),t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,Ji.jsxs)(Ji.Fragment,{children:[(0,Ji.jsx)("div",{ref:FX(t,this.editorContentRef),...n}),e?.contentComponent&&(0,Ji.jsx)(qX,{contentComponent:e.contentComponent})]})}},YX=(0,eo.forwardRef)((e,t)=>{let n=eo.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return eo.default.createElement(GX,{key:n,innerRef:t,...e})}),tS=eo.default.memo(YX),KX=typeof window<"u"?no.useLayoutEffect:no.useEffect,$X=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function jX(e){var t;let[n]=(0,no.useState)(()=>new $X(e.editor)),r=(0,tL.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:K3);return KX(()=>n.watch(e.editor),[e.editor,n]),(0,no.useDebugValue)(r),r}var Q3=!1,nL=typeof window>"u",XX=nL||!!(typeof window<"u"&&window.next),WX=class rL{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,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(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){let t=this.options.current.immediatelyRender,n=t??!0;return nL?(n&&Q3&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):XX&&t===void 0&&(n=!1,Q3&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),n?this.createEditor():null}createEditor(){let t={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)},onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new P3(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((i,a)=>{var o;return i===((o=n.extensions)==null?void 0:o[a])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?rL.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,i)=>r===t[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){let t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function iL(e={},t=[]){let n=(0,to.useRef)(e);n.current=e;let[r]=(0,to.useState)(()=>new WX(n)),i=(0,eL.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,to.useDebugValue)(i),(0,to.useEffect)(r.onRender(t)),jX({editor:i,selector:({transactionNumber:a})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&a===0?0:a+1}),i}var oL=(0,Lm.createContext)({editor:null}),Kge=oL.Consumer;var QX=(0,vf.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});var ZX=()=>(0,vf.useContext)(QX);var $ge=sL.default.forwardRef((e,t)=>{let{onDragStart:n}=ZX(),r=e.as||"div";return(0,lL.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});var jge=uL.default.createContext({markViewContentRef:()=>{}});var rS=(0,ds.createContext)({get editor(){throw new Error("useTiptap must be used within a provider")}});rS.displayName="TiptapContext";var aW=()=>(0,ds.useContext)(rS);function cL({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,ds.useMemo)(()=>({editor:r}),[r]),a=(0,ds.useMemo)(()=>({editor:r}),[r]);return(0,Im.jsx)(oL.Provider,{value:a,children:(0,Im.jsx)(rS.Provider,{value:i,children:n})})}cL.displayName="Tiptap";function fL({...e}){let{editor:t}=aW();return(0,Im.jsx)(tS,{editor:t,...e})}fL.displayName="Tiptap.Content";var Xge=Object.assign(cL,{Content:fL});var oW=Za.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` +${m}`}}),l}function Qj(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((s,l)=>{let u=a.mapping.map(l),c=a.mapping.map(l)+s.nodeSize,f=null;if(s.marks.forEach(h=>{if(h!==o)return!1;f=h}),!f)return;let d=!1;if(Object.keys(n).forEach(h=>{n[h]!==f.attrs[h]&&(d=!0)}),d){let h=e.type.create({...e.attrs,...n});a.removeMark(u,c,e.type),a.addMark(u,c,h)}}),a.docChanged&&t.view.dispatch(a)}var Za=class z3 extends QT{constructor(){super(...arguments),this.type="node"}static create(t={}){let n=typeof t=="function"?t():t;return new z3(n)}configure(t){return super.configure(t)}extend(t){let n=typeof t=="function"?t():t;return super.extend(n)}};var to=q(me(),1),tL=q(Vp(),1);var{getOwnPropertyNames:Zj,getOwnPropertySymbols:Jj}=Object,{hasOwnProperty:eX}=Object.prototype;function eS(e,t){return function(r,i,a){return e(r,i,a)&&t(r,i,a)}}function Om(e){return function(n,r,i){if(!n||!r||typeof n!="object"||typeof r!="object")return e(n,r,i);let{cache:a}=i,o=a.get(n),s=a.get(r);if(o&&s)return o===r&&s===n;a.set(n,r),a.set(r,n);let l=e(n,r,i);return a.delete(n),a.delete(r),l}}function tX(e){return e?.[Symbol.toStringTag]}function F3(e){return Zj(e).concat(Jj(e))}var nX=Object.hasOwn||((e,t)=>eX.call(e,t));function fs(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var rX="__v",iX="__o",aX="_owner",{getOwnPropertyDescriptor:q3,keys:V3}=Object;function oX(e,t){return e.byteLength===t.byteLength&&Rm(new Uint8Array(e),new Uint8Array(t))}function sX(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-- >0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function lX(e,t){return e.byteLength===t.byteLength&&Rm(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function uX(e,t){return fs(e.getTime(),t.getTime())}function cX(e,t){return e.name===t.name&&e.message===t.message&&e.cause===t.cause&&e.stack===t.stack}function fX(e,t){return e===t}function G3(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=new Array(r),a=e.entries(),o,s,l=0;for(;(o=a.next())&&!o.done;){let u=t.entries(),c=!1,f=0;for(;(s=u.next())&&!s.done;){if(i[f]){f++;continue}let d=o.value,h=s.value;if(n.equals(d[0],h[0],l,f,e,t,n)&&n.equals(d[1],h[1],d[0],h[0],e,t,n)){c=i[f]=!0;break}f++}if(!c)return!1;l++}return!0}var dX=fs;function hX(e,t,n){let r=V3(e),i=r.length;if(V3(t).length!==i)return!1;for(;i-- >0;)if(!K3(e,t,n,r[i]))return!1;return!0}function Nf(e,t,n){let r=F3(e),i=r.length;if(F3(t).length!==i)return!1;let a,o,s;for(;i-- >0;)if(a=r[i],!K3(e,t,n,a)||(o=q3(e,a),s=q3(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function pX(e,t){return fs(e.valueOf(),t.valueOf())}function mX(e,t){return e.source===t.source&&e.flags===t.flags}function Y3(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=new Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let l=t.values(),u=!1,c=0;for(;(s=l.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){u=i[c]=!0;break}c++}if(!u)return!1}return!0}function Rm(e,t){let n=e.byteLength;if(t.byteLength!==n||e.byteOffset!==t.byteOffset)return!1;for(;n-- >0;)if(e[n]!==t[n])return!1;return!0}function gX(e,t){return e.hostname===t.hostname&&e.pathname===t.pathname&&e.protocol===t.protocol&&e.port===t.port&&e.hash===t.hash&&e.username===t.username&&e.password===t.password}function K3(e,t,n,r){return(r===aX||r===iX||r===rX)&&(e.$$typeof||t.$$typeof)?!0:nX(t,r)&&n.equals(e[r],t[r],r,r,e,t,n)}var bX="[object ArrayBuffer]",EX="[object Arguments]",yX="[object Boolean]",TX="[object DataView]",SX="[object Date]",_X="[object Error]",xX="[object Map]",AX="[object Number]",CX="[object Object]",NX="[object RegExp]",vX="[object Set]",kX="[object String]",wX={"[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},MX="[object URL]",OX=Object.prototype.toString;function RX({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:l,arePrimitiveWrappersEqual:u,areRegExpsEqual:c,areSetsEqual:f,areTypedArraysEqual:d,areUrlsEqual:h,unknownTagComparators:m}){return function(E,g,y){if(E===g)return!0;if(E==null||g==null)return!1;let T=typeof E;if(T!==typeof g)return!1;if(T!=="object")return T==="number"?s(E,g,y):T==="function"?a(E,g,y):!1;let S=E.constructor;if(S!==g.constructor)return!1;if(S===Object)return l(E,g,y);if(Array.isArray(E))return t(E,g,y);if(S===Date)return r(E,g,y);if(S===RegExp)return c(E,g,y);if(S===Map)return o(E,g,y);if(S===Set)return f(E,g,y);let v=OX.call(E);if(v===SX)return r(E,g,y);if(v===NX)return c(E,g,y);if(v===xX)return o(E,g,y);if(v===vX)return f(E,g,y);if(v===CX)return typeof E.then!="function"&&typeof g.then!="function"&&l(E,g,y);if(v===MX)return h(E,g,y);if(v===_X)return i(E,g,y);if(v===EX)return l(E,g,y);if(wX[v])return d(E,g,y);if(v===bX)return e(E,g,y);if(v===TX)return n(E,g,y);if(v===yX||v===AX||v===kX)return u(E,g,y);if(m){let x=m[v];if(!x){let M=tX(E);M&&(x=m[M])}if(x)return x(E,g,y)}return!1}}function DX({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:oX,areArraysEqual:n?Nf:sX,areDataViewsEqual:lX,areDatesEqual:uX,areErrorsEqual:cX,areFunctionsEqual:fX,areMapsEqual:n?eS(G3,Nf):G3,areNumbersEqual:dX,areObjectsEqual:n?Nf:hX,arePrimitiveWrappersEqual:pX,areRegExpsEqual:mX,areSetsEqual:n?eS(Y3,Nf):Y3,areTypedArraysEqual:n?eS(Rm,Nf):Rm,areUrlsEqual:gX,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let i=Om(r.areArraysEqual),a=Om(r.areMapsEqual),o=Om(r.areObjectsEqual),s=Om(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:i,areMapsEqual:a,areObjectsEqual:o,areSetsEqual:s})}return r}function IX(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function LX({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(s,l){let{cache:u=e?new WeakMap:void 0,meta:c}=n();return t(s,l,{cache:u,equals:r,meta:c,strict:i})};if(e)return function(s,l){return t(s,l,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(s,l){return t(s,l,a)}}var $3=Ja(),Hge=Ja({strict:!0}),zge=Ja({circular:!0}),Fge=Ja({circular:!0,strict:!0}),qge=Ja({createInternalComparator:()=>fs}),Vge=Ja({strict:!0,createInternalComparator:()=>fs}),Gge=Ja({circular:!0,createInternalComparator:()=>fs}),Yge=Ja({circular:!0,createInternalComparator:()=>fs,strict:!0});function Ja(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=DX(e),o=RX(a),s=n?n(o):IX(o);return LX({circular:t,comparator:o,createState:r,equals:s,strict:i})}var no=q(me(),1),nL=q(Q3(),1),oL=q(ne(),1),vf=q(me(),1),nW=q(ne(),1),lL=q(me(),1),uL=q(ne(),1);var cL=q(me(),1),rW=q(me(),1),iW=q(io(),1),aW=q(ne(),1),oW=q(ne(),1);var nS=q(me(),1),sW=q(ne(),1),ds=q(me(),1),Im=q(ne(),1),GX=(...e)=>t=>{e.forEach(n=>{typeof n=="function"?n(t):n&&(n.current=t)})},YX=({contentComponent:e})=>{let t=(0,eL.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,Ji.jsx)(Ji.Fragment,{children:Object.values(t)})};function KX(){let e=new Set,t={};return{subscribe(n){return e.add(n),()=>{e.delete(n)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(n,r){t={...t,[n]:J3.default.createPortal(r.reactElement,r.element,n)},e.forEach(i=>i())},removeRenderer(n){let r={...t};delete r[n],t=r,e.forEach(i=>i())}}}var $X=class extends eo.default.Component{constructor(e){super(e),this.editorContentRef=eo.default.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){var e;let t=this.props.editor;if(t&&!t.isDestroyed&&((e=t.view.dom)!=null&&e.parentNode)){if(t.contentComponent)return;let n=this.editorContentRef.current;n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n}),t.contentComponent=KX(),t.createNodeViews(),t.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){var e;let t=this.props.editor;if(t){t.isEditorContentInitialized=!1,t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null;try{if(!((e=t.view.dom)!=null&&e.parentNode))return;let n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,Ji.jsxs)(Ji.Fragment,{children:[(0,Ji.jsx)("div",{ref:GX(t,this.editorContentRef),...n}),e?.contentComponent&&(0,Ji.jsx)(YX,{contentComponent:e.contentComponent})]})}},jX=(0,eo.forwardRef)((e,t)=>{let n=eo.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return eo.default.createElement($X,{key:n,innerRef:t,...e})}),tS=eo.default.memo(jX),XX=typeof window<"u"?no.useLayoutEffect:no.useEffect,WX=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,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(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let t=()=>{this.transactionNumber+=1,this.subscribers.forEach(r=>r())},n=this.editor;return n.on("transaction",t),()=>{n.off("transaction",t)}}}};function QX(e){var t;let[n]=(0,no.useState)(()=>new WX(e.editor)),r=(0,nL.useSyncExternalStoreWithSelector)(n.subscribe,n.getSnapshot,n.getServerSnapshot,e.selector,(t=e.equalityFn)!=null?t:$3);return XX(()=>n.watch(e.editor),[e.editor,n]),(0,no.useDebugValue)(r),r}var Z3=!1,rL=typeof window>"u",ZX=rL||!!(typeof window<"u"&&window.next),JX=class iL{constructor(t){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId="",this.options=t,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(t){this.editor=t,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(n=>n())}getInitialEditor(){let t=this.options.current.immediatelyRender,n=t??!0;return rL?(n&&Z3&&console.warn("SSR detected. `immediatelyRender` has been set to false to avoid hydration mismatches"),n=!1):ZX&&t===void 0&&(n=!1,Z3&&console.warn("Next.js detected. `immediatelyRender` defaults to false to avoid hydration mismatches. Pass `immediatelyRender: true` explicitly if you are rendering the editor only on the client.")),n?this.createEditor():null}createEditor(){let t={...this.options.current,onBeforeCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onBeforeCreate)==null?void 0:a.call(i,...r)},onBlur:(...r)=>{var i,a;return(a=(i=this.options.current).onBlur)==null?void 0:a.call(i,...r)},onCreate:(...r)=>{var i,a;return(a=(i=this.options.current).onCreate)==null?void 0:a.call(i,...r)},onDestroy:(...r)=>{var i,a;return(a=(i=this.options.current).onDestroy)==null?void 0:a.call(i,...r)},onFocus:(...r)=>{var i,a;return(a=(i=this.options.current).onFocus)==null?void 0:a.call(i,...r)},onSelectionUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onSelectionUpdate)==null?void 0:a.call(i,...r)},onTransaction:(...r)=>{var i,a;return(a=(i=this.options.current).onTransaction)==null?void 0:a.call(i,...r)},onUpdate:(...r)=>{var i,a;return(a=(i=this.options.current).onUpdate)==null?void 0:a.call(i,...r)},onContentError:(...r)=>{var i,a;return(a=(i=this.options.current).onContentError)==null?void 0:a.call(i,...r)},onDrop:(...r)=>{var i,a;return(a=(i=this.options.current).onDrop)==null?void 0:a.call(i,...r)},onPaste:(...r)=>{var i,a;return(a=(i=this.options.current).onPaste)==null?void 0:a.call(i,...r)},onDelete:(...r)=>{var i,a;return(a=(i=this.options.current).onDelete)==null?void 0:a.call(i,...r)}};return new U3(t)}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(t){return this.subscriptions.add(t),()=>{this.subscriptions.delete(t)}}static compareOptions(t,n){return Object.keys(t).every(r=>["onCreate","onBeforeCreate","onDestroy","onUpdate","onTransaction","onFocus","onBlur","onSelectionUpdate","onContentError","onDrop","onPaste"].includes(r)?!0:r==="extensions"&&t.extensions&&n.extensions?t.extensions.length!==n.extensions.length?!1:t.extensions.every((i,a)=>{var o;return i===((o=n.extensions)==null?void 0:o[a])}):t[r]===n[r])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?iL.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(t){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=t;return}if(this.previousDeps.length===t.length&&this.previousDeps.every((r,i)=>r===t[i]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=t}scheduleDestroy(){let t=this.instanceId,n=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{if(this.isComponentMounted&&this.instanceId===t){n&&n.setOptions(this.options.current);return}n&&!n.isDestroyed&&(n.destroy(),this.instanceId===t&&this.setEditor(null))},1)}};function aL(e={},t=[]){let n=(0,to.useRef)(e);n.current=e;let[r]=(0,to.useState)(()=>new JX(n)),i=(0,tL.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,to.useDebugValue)(i),(0,to.useEffect)(r.onRender(t)),QX({editor:i,selector:({transactionNumber:a})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&a===0?0:a+1}),i}var sL=(0,Lm.createContext)({editor:null}),Qge=sL.Consumer;var eW=(0,vf.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}});var tW=()=>(0,vf.useContext)(eW);var Zge=lL.default.forwardRef((e,t)=>{let{onDragStart:n}=tW(),r=e.as||"div";return(0,uL.jsx)(r,{...e,ref:t,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...e.style}})});var Jge=cL.default.createContext({markViewContentRef:()=>{}});var rS=(0,ds.createContext)({get editor(){throw new Error("useTiptap must be used within a provider")}});rS.displayName="TiptapContext";var lW=()=>(0,ds.useContext)(rS);function fL({editor:e,instance:t,children:n}){let r=e??t;if(!r)throw new Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let i=(0,ds.useMemo)(()=>({editor:r}),[r]),a=(0,ds.useMemo)(()=>({editor:r}),[r]);return(0,Im.jsx)(sL.Provider,{value:a,children:(0,Im.jsx)(rS.Provider,{value:i,children:n})})}fL.displayName="Tiptap";function dL({...e}){let{editor:t}=lW();return(0,Im.jsx)(tS,{editor:t,...e})}dL.displayName="Tiptap.Content";var e0e=Object.assign(fL,{Content:dL});var uW=Za.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,` -`):""}),dL=oW;var sW=Za.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),hL=sW;var lW=Za.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Cf(this.options.HTMLAttributes,e)]},renderText(){return` +`):""}),hL=uW;var cW=Za.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),pL=cW;var fW=Za.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Cf(this.options.HTMLAttributes,e)]},renderText(){return` `},renderMarkdown:()=>` -`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:i,storedMarks:a}=n;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=a||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&o){let f=l.filter(d=>s.includes(d.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),pL=lW;var Bm=200,ln=function(){};ln.prototype.append=function(t){return t.length?(t=ln.from(t),!this.length&&t||t.length=n?ln.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};ln.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};ln.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};ln.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,o){return i.push(t(a,o))},n,r),i};ln.from=function(t){return t instanceof ln?t:t&&t.length?new mL(t):ln.empty};var mL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new t(this.values.slice(i,a))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,a,o,s){for(var l=a;l=o;l--)if(i(this.values[l],s+l)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=Bm)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Bm)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(ln);ln.empty=new mL([]);var uW=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return rs&&this.right.forEachInner(r,Math.max(i-s,0),Math.min(this.length,a)-s,o+s)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,a,o){var s=this.left.length;if(i>s&&this.right.forEachInvertedInner(r,i-s,Math.max(a,s)-s,o+s)===!1||a=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(ln),iS=ln;var cW=500,ps=class e{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,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,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,l,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),a=i.maps.length),a--,c.push(f);return}if(i){c.push(new ui(f.map));let h=f.step.map(i.slice(a)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new ui(m,void 0,void 0,u.length+c.length))),a--,m&&i.appendMap(m,a)}else o.maybeStep(f.step);if(f.selection)return s=i?f.selection.map(i.slice(a)):f.selection,l=new e(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,l=!i&&s.length?s.get(s.length-1):null;for(let c=0;cdW&&(s=fW(s,u),o-=u),new e(s.append(a),o)}remapping(t,n){let r=new nf;return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},t,n),r}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(n=>new ui(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(d=>{d.selection&&s--},i);let l=n;this.items.forEach(d=>{let h=a.getMirror(--l);if(h==null)return;o=Math.min(o,h);let m=a.maps[h];if(d.step){let b=t.steps[h].invert(t.docs[h]),E=d.selection&&d.selection.map(a.slice(l+1,h));E&&s++,r.push(new ui(m,b,E))}else r.push(new ui(m))},i);let u=[];for(let d=n;dcW&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((o,s)=>{if(s>=t)i.push(o),o.selection&&a++;else if(o.step){let l=o.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=o.selection&&o.selection.map(n.slice(r));c&&a++;let f=new ui(u.invert(),l,c),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else o.map&&r--},this.items.length,0),new e(iS.from(i.reverse()),a)}};ps.empty=new ps(iS.empty,0);function fW(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}var ui=class e{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},ci=class{constructor(t,n,r,i,a){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}},dW=20;function hW(e,t,n,r){let i=n.getMeta(hs),a;if(i)return i.historyState;n.getMeta(gW)&&(e=new ci(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(o&&o.getMeta(hs))return o.getMeta(hs).redo?new ci(e.done.addTransform(n,void 0,r,Pm(t)),e.undone,gL(n.mapping.maps),e.prevTime,e.prevComposition):new ci(e.done,e.undone.addTransform(n,void 0,r,Pm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),l=e.prevTime==0||!o&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!pW(n,e.prevRanges)),u=o?aS(e.prevRanges,n.mapping):gL(n.mapping.maps);return new ci(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Pm(t)),ps.empty,u,n.time,s??e.prevComposition)}else return(a=n.getMeta("rebased"))?new ci(e.done.rebased(n,a),e.undone.rebased(n,a),aS(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ci(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),aS(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function pW(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let a=0;a=t[a]&&(n=!0)}),n}function gL(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,i,a,o)=>t.push(a,o));return t}function aS(e,t){if(!e)return null;let n=[];for(let r=0;r{let i=hs.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=mW(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var sS=Um(!1,!0),lS=Um(!0,!0),c0e=Um(!1,!1),f0e=Um(!0,!1);var yL=Kn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>sS(e,t),redo:()=>({state:e,dispatch:t})=>lS(e,t)}},addProseMirrorPlugins(){return[EL(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});function bW(e){var t;let{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:s}=e,l=r&&!i,u=U3(n),c=new RegExp(`\\s${u}$`),f=o?"^":"",d=i?"":u,h=l?new RegExp(`${f}${u}.*?(?=\\s${d}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${d}]*`,"gm"),m=((t=s.nodeBefore)==null?void 0:t.isText)&&s.nodeBefore.text;if(!m)return null;let b=s.pos-m.length,E=Array.from(m.matchAll(h)).pop();if(!E||E.input===void 0||E.index===void 0)return null;let g=E.input.slice(Math.max(0,E.index-1),E.index),y=new RegExp(`^[${a?.join("")}\0]?$`).test(g);if(a!==null&&!y)return null;let T=b+E.index,S=T+E[0].length;return l&&c.test(m.slice(S-1,S+1))&&(E[0]+=" ",S+=1),T=s.pos?{range:{from:T,to:S},query:E[0].slice(n.length),text:E[0]}:null}function EW(e){return e.docChanged?e.steps.some(t=>{let n=t.slice;if(!n?.content)return!1;let r=n.content.textBetween(0,n.content.size,` -`);return/\s/.test(r)}):!1}var uS=new at("suggestion");function TL({pluginKey:e=uS,editor:t,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[" "],startOfLine:o=!1,decorationTag:s="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:c="is-empty",command:f=()=>null,items:d=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:b=bW,shouldShow:E,shouldResetDismissed:g}){let y,T=h?.(),S=r&&!i,v=()=>{let A=t.state.selection.$anchor.pos,H=t.view.coordsAtPos(A),{top:Y,right:z,bottom:V,left:$}=H;try{return new DOMRect($,Y,z-$,V-Y)}catch{return null}},x=(A,H)=>H?()=>{let Y=e.getState(t.state),z=Y?.decorationId,V=A.dom.querySelector(`[data-decoration-id="${z}"]`);return V?.getBoundingClientRect()||null}:v,M=({match:A,dismissedRange:H,state:Y,transaction:z})=>g?.({editor:t,state:Y,range:H,match:A,transaction:z,allowSpaces:S})?!1:S?A.range.from===H.from:A.range.from===H.from&&!EW(z);function R(A,H){var Y;try{let V=e.getState(A.state),$=V?.decorationId?A.dom.querySelector(`[data-decoration-id="${V.decorationId}"]`):null,D={editor:t,range:V?.range||{from:0,to:0},query:V?.query||null,text:V?.text||null,items:[],command:B=>f({editor:t,range:V?.range||{from:0,to:0},props:B}),decorationNode:$,clientRect:x(A,$)};(Y=T?.onExit)==null||Y.call(T,D)}catch{}let z=A.state.tr.setMeta(H,{exit:!0});A.dispatch(z)}let L=new Ue({key:e,view(){return{update:async(A,H)=>{var Y,z,V,$,D,B,K;let F=(Y=this.key)==null?void 0:Y.getState(H),N=(z=this.key)==null?void 0:z.getState(A.state),ae=F.active&&N.active&&F.range.from!==N.range.from,ce=!F.active&&N.active,k=F.active&&!N.active,Te=!ce&&!k&&F.query!==N.query,be=ce||ae&&Te,He=Te||ae,et=k||ae&&Te;if(!be&&!He&&!et)return;let Ee=et&&!be?F:N,lt=A.dom.querySelector(`[data-decoration-id="${Ee.decorationId}"]`);y={editor:t,range:Ee.range,query:Ee.query,text:Ee.text,items:[],command:Ve=>f({editor:t,range:Ee.range,props:Ve}),decorationNode:lt,clientRect:x(A,lt)},be&&((V=T?.onBeforeStart)==null||V.call(T,y)),He&&(($=T?.onBeforeUpdate)==null||$.call(T,y)),(He||be)&&(y.items=await d({editor:t,query:Ee.query})),et&&((D=T?.onExit)==null||D.call(T,y)),He&&((B=T?.onUpdate)==null||B.call(T,y)),be&&((K=T?.onStart)==null||K.call(T,y))},destroy:()=>{var A;y&&((A=T?.onExit)==null||A.call(T,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(A,H,Y,z){let{isEditable:V}=t,{composing:$}=t.view,{selection:D}=A,{empty:B,from:K}=D,F={...H},N=A.getMeta(e);if(N&&N.exit)return F.active=!1,F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null,F.dismissedRange=H.active?{...H.range}:H.dismissedRange,F;if(F.composing=$,A.docChanged&&F.dismissedRange!==null&&(F.dismissedRange={from:A.mapping.map(F.dismissedRange.from),to:A.mapping.map(F.dismissedRange.to)}),V&&(B||t.view.composing)){(KH.range.to)&&!$&&!H.composing&&(F.active=!1);let ae=b({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:D.$from}),ce=`id_${Math.floor(Math.random()*4294967295)}`;ae&&m({editor:t,state:z,range:ae.range,isActive:H.active})&&(!E||E({editor:t,range:ae.range,query:ae.query,text:ae.text,transaction:A}))?(F.dismissedRange!==null&&!M({match:ae,dismissedRange:F.dismissedRange,state:z,transaction:A})&&(F.dismissedRange=null),F.dismissedRange===null?(F.active=!0,F.decorationId=H.decorationId?H.decorationId:ce,F.range=ae.range,F.query=ae.query,F.text=ae.text):F.active=!1):(ae||(F.dismissedRange=null),F.active=!1)}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(A,H){var Y,z;let{active:V,range:$}=L.getState(A.state);if(!V)return!1;if(H.key==="Escape"||H.key==="Esc"){let B=L.getState(A.state);return(Y=T?.onKeyDown)==null||Y.call(T,{view:A,event:H,range:B.range}),R(A,e),!0}return((z=T?.onKeyDown)==null?void 0:z.call(T,{view:A,event:H,range:$}))||!1},decorations(A){let{active:H,range:Y,decorationId:z,query:V}=L.getState(A);if(!H)return null;let $=!V?.length,D=[l];return $&&D.push(c),Yn.create(A.doc,[li.inline(Y.from,Y.to,{nodeName:s,class:D.join(" "),"data-decoration-id":z,"data-decoration-content":u})])}}});return L}var SL=Za.create({name:"commandMention",group:"inline",inline:!0,atom:!0,selectable:!0,addOptions(){return{commands:[],suggestion:{char:"/",allowSpaces:!1,allow({range:e}){return e.from===0},command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).insertContent([{type:"commandMention",attrs:{name:n.name}},{type:"text",text:" "}]).run()}}}},addAttributes(){return{name:{default:null}}},parseHTML(){return[{tag:"span[data-command-mention]",getAttrs:e=>({name:e.getAttribute("data-command-mention")})}]},renderHTML({node:e,HTMLAttributes:t}){return["span",Cf(t,{"data-command-mention":e.attrs.name,class:"command-chip"}),`/${e.attrs.name}`]},addKeyboardShortcuts(){return{Backspace:()=>{let{state:e,view:t}=this.editor,{selection:n}=e,{$from:r}=n;if(n instanceof fe&&n.node.type.name==="commandMention"){let a=n.node.attrs.name,o=n.from,s=e.tr.replaceWith(o,n.to,e.schema.text(`/${a}`));return s.setSelection(pe.create(s.doc,o+a.length+1)),t.dispatch(s),!0}let i=r.nodeBefore;if(i?.type.name==="commandMention"){let a=i.attrs.name,o=r.pos-i.nodeSize,s=e.tr.replaceWith(o,r.pos,e.schema.text(`/${a}`));return s.setSelection(pe.create(s.doc,o+a.length+1)),t.dispatch(s),!0}return!1}}},addProseMirrorPlugins(){let e=this.options;return[TL({editor:this.editor,...this.options.suggestion}),new Ue({key:new at("commandMentionPaste"),props:{handlePaste:(t,n)=>{let r=n.clipboardData?.getData("text/plain")??"";if(!r.startsWith("/"))return!1;let i=r.slice(1),a=i.indexOf(" "),o=a===-1?i:i.slice(0,a),s=a===-1?"":i.slice(a);if(!e.commands.find(E=>E.name===o))return!1;let{state:c}=t,f=c.schema.nodes.commandMention;if(!f)return!1;let d=[];d.push(f.create({name:o})),s&&d.push(c.schema.text(s));let h=c.tr,{from:m,to:b}=c.selection;return h.replaceWith(m,b,d),t.dispatch(h),!0}}})]}});var AL=q(oh(),1);var Hm=q(me(),1),ms=q(ne(),1);function _L(e,t){let n=t.toLowerCase();return e.filter(r=>r.name.toLowerCase().startsWith(n))}function xL({id:e,commands:t,effectiveIndex:n,onSelect:r,onHighlight:i}){let a=(0,Hm.useRef)(null);return(0,Hm.useEffect)(()=>{a.current?.children[n]?.scrollIntoView({block:"nearest"})},[n]),(0,ms.jsx)("ul",{id:e,ref:a,className:"shiny-chat-slash-palette",role:"listbox","aria-label":"Slash commands",onMouseDown:o=>o.preventDefault(),children:t.length===0?(0,ms.jsx)("li",{className:"shiny-chat-slash-palette-empty",role:"presentation",children:"No matching commands"}):t.map((o,s)=>(0,ms.jsxs)("li",{id:`${e}-item-${o.name}`,className:"shiny-chat-slash-palette-item"+(s===n?" highlighted":""),role:"option","aria-selected":s===n,onClick:()=>r(o),onMouseEnter:()=>i(s),children:[(0,ms.jsxs)("span",{className:"shiny-chat-slash-palette-name",children:["/",o.name]}),(0,ms.jsx)("span",{className:"shiny-chat-slash-palette-desc",children:o.description})]},o.name))})}var NL=q(ne(),1);function CL({paletteId:e}){let t=null,n=null,r=0,i=[],a=null;function o(f){if(!t||!f)return;let d=f();if(!d)return;let h=t.offsetHeight,m=d.top,b=window.innerHeight-d.bottom,E=4;t.style.left=`${d.left}px`,h>0&&b>=h+E||b>=m?(t.style.top=`${d.bottom+E}px`,t.style.bottom=""):(t.style.top="",t.style.bottom=`${window.innerHeight-d.top+E}px`)}function s(){n&&n.render((0,NL.jsx)(xL,{id:e,commands:i,effectiveIndex:r>=0?Math.min(r,i.length-1):-1,onSelect:f=>{a?.({name:f.name})},onHighlight:f=>{r=f,s()}}))}let l=null,u=null;function c(){l&&(window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0),l=null),u&&(document.removeEventListener("pointerdown",u,!0),u=null),n&&(n.unmount(),n=null),t&&(t.remove(),t=null),a=null}return{onStart(f){i=f.items??[],r=0,a=f.command,t=document.createElement("div"),t.style.position="fixed",t.style.zIndex="var(--slash-palette-z-index, 1050)",t.style.width="max-content",t.style.maxWidth="400px",document.body.appendChild(t),n=(0,AL.createRoot)(t),s(),requestAnimationFrame(()=>requestAnimationFrame(()=>o(f.clientRect))),l=()=>o(f.clientRect),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),u=d=>{t&&t.contains(d.target)},document.addEventListener("pointerdown",u,!0)},onUpdate(f){i=f.items??[],r=0,a=f.command,s(),requestAnimationFrame(()=>o(f.clientRect))},onKeyDown({event:f}){if(f.key==="ArrowDown")return r=i.length===0?0:(r+1)%i.length,s(),!0;if(f.key==="ArrowUp")return r=i.length===0?0:(r-1+i.length)%i.length,s(),!0;if(f.key==="Enter"||f.key==="Tab"){if(i.length>0&&r>=0){let d=i[Math.min(r,i.length-1)];d&&a?.({name:d.name})}return!0}return f.key==="Escape"},onExit(){c()}}}var ea=q(me(),1);function vL(e){let t=(0,ea.useRef)(-1),n=(0,ea.useRef)(new Map),r=(0,ea.useRef)(!1),i=(0,ea.useRef)(e);i.current!==e&&(i.current=e,t.current=-1,n.current.clear(),r.current=!1);let a=(0,ea.useCallback)((l,u)=>{let c=e.length-1;if(n.current.set(t.current,u),l==="up"){if(e.length===0)return;r.current=!0,t.current>c&&(t.current=-1);let f=t.current===-1?c:Math.max(0,t.current-1);return t.current=f,n.current.get(f)??e[f]}else{let f=t.current;if(f===-1)return;if(f>c){t.current=-1;return}if(f>=c)return t.current=-1,n.current.get(-1)??"";let d=f+1;return t.current=d,n.current.get(d)??e[d]}},[e]),o=(0,ea.useCallback)(()=>{t.current=-1,n.current.clear(),r.current=!1},[]),s=(0,ea.useCallback)(()=>r.current,[]);return{recall:a,reset:o,isActive:s}}var kL=q(ne(),1);function kf(e){let t=e.state.doc,n=[];return t.descendants(r=>r.type.name==="commandMention"?(n.push(`/${r.attrs.name}`),!1):r.type.name==="text"?(n.push(r.text??""),!1):r.type.name==="hardBreak"?(n.push(` +`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{let{selection:i,storedMarks:a}=n;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:o}=this.options,{splittableMarks:s}=r.extensionManager,l=a||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:u,dispatch:c})=>{if(c&&l&&o){let f=l.filter(d=>s.includes(d.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),mL=fW;var Bm=200,ln=function(){};ln.prototype.append=function(t){return t.length?(t=ln.from(t),!this.length&&t||t.length=n?ln.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,n))};ln.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};ln.prototype.forEach=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(t,n,r,0):this.forEachInvertedInner(t,n,r,0)};ln.prototype.map=function(t,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(a,o){return i.push(t(a,o))},n,r),i};ln.from=function(t){return t instanceof ln?t:t&&t.length?new gL(t):ln.empty};var gL=function(e){function t(r){e.call(this),this.values=r}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,a){return i==0&&a==this.length?this:new t(this.values.slice(i,a))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,a,o,s){for(var l=a;l=o;l--)if(i(this.values[l],s+l)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=Bm)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=Bm)return new t(i.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(ln);ln.empty=new gL([]);var dW=function(e){function t(n,r){e.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return rs&&this.right.forEachInner(r,Math.max(i-s,0),Math.min(this.length,a)-s,o+s)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,a,o){var s=this.left.length;if(i>s&&this.right.forEachInvertedInner(r,i-s,Math.max(a,s)-s,o+s)===!1||a=a?this.right.slice(r-a,i-a):this.left.slice(r,a).append(this.right.slice(0,i-a))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(ln),iS=ln;var hW=500,ps=class e{constructor(t,n){this.items=t,this.eventCount=n}popEvent(t,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,a;n&&(i=this.remapping(r,this.items.length),a=i.maps.length);let o=t.tr,s,l,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){i||(i=this.remapping(r,d+1),a=i.maps.length),a--,c.push(f);return}if(i){c.push(new ui(f.map));let h=f.step.map(i.slice(a)),m;h&&o.maybeStep(h).doc&&(m=o.mapping.maps[o.mapping.maps.length-1],u.push(new ui(m,void 0,void 0,u.length+c.length))),a--,m&&i.appendMap(m,a)}else o.maybeStep(f.step);if(f.selection)return s=i?f.selection.map(i.slice(a)):f.selection,l=new e(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:o,selection:s}}addTransform(t,n,r,i){let a=[],o=this.eventCount,s=this.items,l=!i&&s.length?s.get(s.length-1):null;for(let c=0;cmW&&(s=pW(s,u),o-=u),new e(s.append(a),o)}remapping(t,n){let r=new nf;return this.items.forEach((i,a)=>{let o=i.mirrorOffset!=null&&a-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,o)},t,n),r}addMaps(t){return this.eventCount==0?this:new e(this.items.append(t.map(n=>new ui(n))),this.eventCount)}rebased(t,n){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-n),a=t.mapping,o=t.steps.length,s=this.eventCount;this.items.forEach(d=>{d.selection&&s--},i);let l=n;this.items.forEach(d=>{let h=a.getMirror(--l);if(h==null)return;o=Math.min(o,h);let m=a.maps[h];if(d.step){let b=t.steps[h].invert(t.docs[h]),E=d.selection&&d.selection.map(a.slice(l+1,h));E&&s++,r.push(new ui(m,b,E))}else r.push(new ui(m))},i);let u=[];for(let d=n;dhW&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let t=0;return this.items.forEach(n=>{n.step||t++}),t}compress(t=this.items.length){let n=this.remapping(0,t),r=n.maps.length,i=[],a=0;return this.items.forEach((o,s)=>{if(s>=t)i.push(o),o.selection&&a++;else if(o.step){let l=o.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=o.selection&&o.selection.map(n.slice(r));c&&a++;let f=new ui(u.invert(),l,c),d,h=i.length-1;(d=i.length&&i[h].merge(f))?i[h]=d:i.push(f)}}else o.map&&r--},this.items.length,0),new e(iS.from(i.reverse()),a)}};ps.empty=new ps(iS.empty,0);function pW(e,t){let n;return e.forEach((r,i)=>{if(r.selection&&t--==0)return n=i,!1}),e.slice(n)}var ui=class e{constructor(t,n,r,i){this.map=t,this.step=n,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let n=t.step.merge(this.step);if(n)return new e(n.getMap().invert(),n,this.selection)}}},ci=class{constructor(t,n,r,i,a){this.done=t,this.undone=n,this.prevRanges=r,this.prevTime=i,this.prevComposition=a}},mW=20;function gW(e,t,n,r){let i=n.getMeta(hs),a;if(i)return i.historyState;n.getMeta(yW)&&(e=new ci(e.done,e.undone,null,0,-1));let o=n.getMeta("appendedTransaction");if(n.steps.length==0)return e;if(o&&o.getMeta(hs))return o.getMeta(hs).redo?new ci(e.done.addTransform(n,void 0,r,Pm(t)),e.undone,bL(n.mapping.maps),e.prevTime,e.prevComposition):new ci(e.done,e.undone.addTransform(n,void 0,r,Pm(t)),null,e.prevTime,e.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(o&&o.getMeta("addToHistory")===!1)){let s=n.getMeta("composition"),l=e.prevTime==0||!o&&e.prevComposition!=s&&(e.prevTime<(n.time||0)-r.newGroupDelay||!bW(n,e.prevRanges)),u=o?aS(e.prevRanges,n.mapping):bL(n.mapping.maps);return new ci(e.done.addTransform(n,l?t.selection.getBookmark():void 0,r,Pm(t)),ps.empty,u,n.time,s??e.prevComposition)}else return(a=n.getMeta("rebased"))?new ci(e.done.rebased(n,a),e.undone.rebased(n,a),aS(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new ci(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),aS(e.prevRanges,n.mapping),e.prevTime,e.prevComposition)}function bW(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((r,i)=>{for(let a=0;a=t[a]&&(n=!0)}),n}function bL(e){let t=[];for(let n=e.length-1;n>=0&&t.length==0;n--)e[n].forEach((r,i,a,o)=>t.push(a,o));return t}function aS(e,t){if(!e)return null;let n=[];for(let r=0;r{let i=hs.getState(n);if(!i||(e?i.undone:i.done).eventCount==0)return!1;if(r){let a=EW(i,n,e);a&&r(t?a.scrollIntoView():a)}return!0}}var sS=Um(!1,!0),lS=Um(!0,!0),m0e=Um(!1,!1),g0e=Um(!0,!1);var TL=Kn.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>sS(e,t),redo:()=>({state:e,dispatch:t})=>lS(e,t)}},addProseMirrorPlugins(){return[yL(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});function TW(e){var t;let{char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:s}=e,l=r&&!i,u=H3(n),c=new RegExp(`\\s${u}$`),f=o?"^":"",d=i?"":u,h=l?new RegExp(`${f}${u}.*?(?=\\s${d}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${d}]*`,"gm"),m=((t=s.nodeBefore)==null?void 0:t.isText)&&s.nodeBefore.text;if(!m)return null;let b=s.pos-m.length,E=Array.from(m.matchAll(h)).pop();if(!E||E.input===void 0||E.index===void 0)return null;let g=E.input.slice(Math.max(0,E.index-1),E.index),y=new RegExp(`^[${a?.join("")}\0]?$`).test(g);if(a!==null&&!y)return null;let T=b+E.index,S=T+E[0].length;return l&&c.test(m.slice(S-1,S+1))&&(E[0]+=" ",S+=1),T=s.pos?{range:{from:T,to:S},query:E[0].slice(n.length),text:E[0]}:null}function SW(e){return e.docChanged?e.steps.some(t=>{let n=t.slice;if(!n?.content)return!1;let r=n.content.textBetween(0,n.content.size,` +`);return/\s/.test(r)}):!1}var uS=new at("suggestion");function SL({pluginKey:e=uS,editor:t,char:n="@",allowSpaces:r=!1,allowToIncludeChar:i=!1,allowedPrefixes:a=[" "],startOfLine:o=!1,decorationTag:s="span",decorationClass:l="suggestion",decorationContent:u="",decorationEmptyClass:c="is-empty",command:f=()=>null,items:d=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:b=TW,shouldShow:E,shouldResetDismissed:g}){let y,T=h?.(),S=r&&!i,v=()=>{let A=t.state.selection.$anchor.pos,H=t.view.coordsAtPos(A),{top:Y,right:z,bottom:V,left:$}=H;try{return new DOMRect($,Y,z-$,V-Y)}catch{return null}},x=(A,H)=>H?()=>{let Y=e.getState(t.state),z=Y?.decorationId,V=A.dom.querySelector(`[data-decoration-id="${z}"]`);return V?.getBoundingClientRect()||null}:v,M=({match:A,dismissedRange:H,state:Y,transaction:z})=>g?.({editor:t,state:Y,range:H,match:A,transaction:z,allowSpaces:S})?!1:S?A.range.from===H.from:A.range.from===H.from&&!SW(z);function R(A,H){var Y;try{let V=e.getState(A.state),$=V?.decorationId?A.dom.querySelector(`[data-decoration-id="${V.decorationId}"]`):null,D={editor:t,range:V?.range||{from:0,to:0},query:V?.query||null,text:V?.text||null,items:[],command:B=>f({editor:t,range:V?.range||{from:0,to:0},props:B}),decorationNode:$,clientRect:x(A,$)};(Y=T?.onExit)==null||Y.call(T,D)}catch{}let z=A.state.tr.setMeta(H,{exit:!0});A.dispatch(z)}let L=new Ue({key:e,view(){return{update:async(A,H)=>{var Y,z,V,$,D,B,K;let F=(Y=this.key)==null?void 0:Y.getState(H),N=(z=this.key)==null?void 0:z.getState(A.state),ae=F.active&&N.active&&F.range.from!==N.range.from,ce=!F.active&&N.active,k=F.active&&!N.active,Te=!ce&&!k&&F.query!==N.query,be=ce||ae&&Te,He=Te||ae,et=k||ae&&Te;if(!be&&!He&&!et)return;let Ee=et&&!be?F:N,lt=A.dom.querySelector(`[data-decoration-id="${Ee.decorationId}"]`);y={editor:t,range:Ee.range,query:Ee.query,text:Ee.text,items:[],command:Ve=>f({editor:t,range:Ee.range,props:Ve}),decorationNode:lt,clientRect:x(A,lt)},be&&((V=T?.onBeforeStart)==null||V.call(T,y)),He&&(($=T?.onBeforeUpdate)==null||$.call(T,y)),(He||be)&&(y.items=await d({editor:t,query:Ee.query})),et&&((D=T?.onExit)==null||D.call(T,y)),He&&((B=T?.onUpdate)==null||B.call(T,y)),be&&((K=T?.onStart)==null||K.call(T,y))},destroy:()=>{var A;y&&((A=T?.onExit)==null||A.call(T,y))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1,dismissedRange:null}},apply(A,H,Y,z){let{isEditable:V}=t,{composing:$}=t.view,{selection:D}=A,{empty:B,from:K}=D,F={...H},N=A.getMeta(e);if(N&&N.exit)return F.active=!1,F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null,F.dismissedRange=H.active?{...H.range}:H.dismissedRange,F;if(F.composing=$,A.docChanged&&F.dismissedRange!==null&&(F.dismissedRange={from:A.mapping.map(F.dismissedRange.from),to:A.mapping.map(F.dismissedRange.to)}),V&&(B||t.view.composing)){(KH.range.to)&&!$&&!H.composing&&(F.active=!1);let ae=b({char:n,allowSpaces:r,allowToIncludeChar:i,allowedPrefixes:a,startOfLine:o,$position:D.$from}),ce=`id_${Math.floor(Math.random()*4294967295)}`;ae&&m({editor:t,state:z,range:ae.range,isActive:H.active})&&(!E||E({editor:t,range:ae.range,query:ae.query,text:ae.text,transaction:A}))?(F.dismissedRange!==null&&!M({match:ae,dismissedRange:F.dismissedRange,state:z,transaction:A})&&(F.dismissedRange=null),F.dismissedRange===null?(F.active=!0,F.decorationId=H.decorationId?H.decorationId:ce,F.range=ae.range,F.query=ae.query,F.text=ae.text):F.active=!1):(ae||(F.dismissedRange=null),F.active=!1)}else F.active=!1;return F.active||(F.decorationId=null,F.range={from:0,to:0},F.query=null,F.text=null),F}},props:{handleKeyDown(A,H){var Y,z;let{active:V,range:$}=L.getState(A.state);if(!V)return!1;if(H.key==="Escape"||H.key==="Esc"){let B=L.getState(A.state);return(Y=T?.onKeyDown)==null||Y.call(T,{view:A,event:H,range:B.range}),R(A,e),!0}return((z=T?.onKeyDown)==null?void 0:z.call(T,{view:A,event:H,range:$}))||!1},decorations(A){let{active:H,range:Y,decorationId:z,query:V}=L.getState(A);if(!H)return null;let $=!V?.length,D=[l];return $&&D.push(c),Yn.create(A.doc,[li.inline(Y.from,Y.to,{nodeName:s,class:D.join(" "),"data-decoration-id":z,"data-decoration-content":u})])}}});return L}var _L=Za.create({name:"commandMention",group:"inline",inline:!0,atom:!0,selectable:!0,addOptions(){return{commands:[],suggestion:{char:"/",allowSpaces:!1,allow({range:e}){return e.from===0},command:({editor:e,range:t,props:n})=>{e.chain().focus().deleteRange(t).insertContent([{type:"commandMention",attrs:{name:n.name}},{type:"text",text:" "}]).run()}}}},addAttributes(){return{name:{default:null}}},parseHTML(){return[{tag:"span[data-command-mention]",getAttrs:e=>({name:e.getAttribute("data-command-mention")})}]},renderHTML({node:e,HTMLAttributes:t}){return["span",Cf(t,{"data-command-mention":e.attrs.name,class:"command-chip"}),`/${e.attrs.name}`]},addKeyboardShortcuts(){return{Backspace:()=>{let{state:e,view:t}=this.editor,{selection:n}=e,{$from:r}=n;if(n instanceof fe&&n.node.type.name==="commandMention"){let a=n.node.attrs.name,o=n.from,s=e.tr.replaceWith(o,n.to,e.schema.text(`/${a}`));return s.setSelection(pe.create(s.doc,o+a.length+1)),t.dispatch(s),!0}let i=r.nodeBefore;if(i?.type.name==="commandMention"){let a=i.attrs.name,o=r.pos-i.nodeSize,s=e.tr.replaceWith(o,r.pos,e.schema.text(`/${a}`));return s.setSelection(pe.create(s.doc,o+a.length+1)),t.dispatch(s),!0}return!1}}},addProseMirrorPlugins(){let e=this.options;return[SL({editor:this.editor,...this.options.suggestion}),new Ue({key:new at("commandMentionPaste"),props:{handlePaste:(t,n)=>{let r=n.clipboardData?.getData("text/plain")??"";if(!r.startsWith("/"))return!1;let i=r.slice(1),a=i.indexOf(" "),o=a===-1?i:i.slice(0,a),s=a===-1?"":i.slice(a);if(!e.commands.find(E=>E.name===o))return!1;let{state:c}=t,f=c.schema.nodes.commandMention;if(!f)return!1;let d=[];d.push(f.create({name:o})),s&&d.push(c.schema.text(s));let h=c.tr,{from:m,to:b}=c.selection;return h.replaceWith(m,b,d),t.dispatch(h),!0}}})]}});var CL=q(oh(),1);var Hm=q(me(),1),ms=q(ne(),1);function xL(e,t){let n=t.toLowerCase();return e.filter(r=>r.name.toLowerCase().startsWith(n))}function AL({id:e,commands:t,effectiveIndex:n,onSelect:r,onHighlight:i}){let a=(0,Hm.useRef)(null);return(0,Hm.useEffect)(()=>{a.current?.children[n]?.scrollIntoView({block:"nearest"})},[n]),(0,ms.jsx)("ul",{id:e,ref:a,className:"shiny-chat-slash-palette",role:"listbox","aria-label":"Slash commands",onMouseDown:o=>o.preventDefault(),children:t.length===0?(0,ms.jsx)("li",{className:"shiny-chat-slash-palette-empty",role:"presentation",children:"No matching commands"}):t.map((o,s)=>(0,ms.jsxs)("li",{id:`${e}-item-${o.name}`,className:"shiny-chat-slash-palette-item"+(s===n?" highlighted":""),role:"option","aria-selected":s===n,onClick:()=>r(o),onMouseEnter:()=>i(s),children:[(0,ms.jsxs)("span",{className:"shiny-chat-slash-palette-name",children:["/",o.name]}),(0,ms.jsx)("span",{className:"shiny-chat-slash-palette-desc",children:o.description})]},o.name))})}var vL=q(ne(),1);function NL({paletteId:e}){let t=null,n=null,r=0,i=[],a=null;function o(f){if(!t||!f)return;let d=f();if(!d)return;let h=t.offsetHeight,m=d.top,b=window.innerHeight-d.bottom,E=4;t.style.left=`${d.left}px`,h>0&&b>=h+E||b>=m?(t.style.top=`${d.bottom+E}px`,t.style.bottom=""):(t.style.top="",t.style.bottom=`${window.innerHeight-d.top+E}px`)}function s(){n&&n.render((0,vL.jsx)(AL,{id:e,commands:i,effectiveIndex:r>=0?Math.min(r,i.length-1):-1,onSelect:f=>{a?.({name:f.name})},onHighlight:f=>{r=f,s()}}))}let l=null,u=null;function c(){l&&(window.removeEventListener("resize",l),window.removeEventListener("scroll",l,!0),l=null),u&&(document.removeEventListener("pointerdown",u,!0),u=null),n&&(n.unmount(),n=null),t&&(t.remove(),t=null),a=null}return{onStart(f){i=f.items??[],r=0,a=f.command,t=document.createElement("div"),t.style.position="fixed",t.style.zIndex="var(--slash-palette-z-index, 1050)",t.style.width="max-content",t.style.maxWidth="400px",document.body.appendChild(t),n=(0,CL.createRoot)(t),s(),requestAnimationFrame(()=>requestAnimationFrame(()=>o(f.clientRect))),l=()=>o(f.clientRect),window.addEventListener("resize",l),window.addEventListener("scroll",l,!0),u=d=>{t&&t.contains(d.target)},document.addEventListener("pointerdown",u,!0)},onUpdate(f){i=f.items??[],r=0,a=f.command,s(),requestAnimationFrame(()=>o(f.clientRect))},onKeyDown({event:f}){if(f.key==="ArrowDown")return r=i.length===0?0:(r+1)%i.length,s(),!0;if(f.key==="ArrowUp")return r=i.length===0?0:(r-1+i.length)%i.length,s(),!0;if(f.key==="Enter"||f.key==="Tab"){if(i.length>0&&r>=0){let d=i[Math.min(r,i.length-1)];d&&a?.({name:d.name})}return!0}return f.key==="Escape"},onExit(){c()}}}var ea=q(me(),1);function kL(e){let t=(0,ea.useRef)(-1),n=(0,ea.useRef)(new Map),r=(0,ea.useRef)(!1),i=(0,ea.useRef)(e);i.current!==e&&(i.current=e,t.current=-1,n.current.clear(),r.current=!1);let a=(0,ea.useCallback)((l,u)=>{let c=e.length-1;if(n.current.set(t.current,u),l==="up"){if(e.length===0)return;r.current=!0,t.current>c&&(t.current=-1);let f=t.current===-1?c:Math.max(0,t.current-1);return t.current=f,n.current.get(f)??e[f]}else{let f=t.current;if(f===-1)return;if(f>c){t.current=-1;return}if(f>=c)return t.current=-1,n.current.get(-1)??"";let d=f+1;return t.current=d,n.current.get(d)??e[d]}},[e]),o=(0,ea.useCallback)(()=>{t.current=-1,n.current.clear(),r.current=!1},[]),s=(0,ea.useCallback)(()=>r.current,[]);return{recall:a,reset:o,isActive:s}}var wL=q(ne(),1);function kf(e){let t=e.state.doc,n=[];return t.descendants(r=>r.type.name==="commandMention"?(n.push(`/${r.attrs.name}`),!1):r.type.name==="text"?(n.push(r.text??""),!1):r.type.name==="hardBreak"?(n.push(` `),!1):!0),n.join("")}function cS(e,t){if(!e)return{type:"doc",content:[]};if(e.startsWith("/")){let i=e.slice(1),a=i.indexOf(" "),o=a===-1?i:i.slice(0,a),s=a===-1?"":i.slice(a+1);if(t.find(u=>u.name===o)){let u=[{type:"commandMention",attrs:{name:o}}];return s&&u.push({type:"text",text:" "+s}),{type:"doc",content:u}}}let n=e.split(` -`),r=[];return n.forEach((i,a)=>{a>0&&r.push({type:"hardBreak"}),i&&r.push({type:"text",text:i})}),{type:"doc",content:r}}var zm=(0,$n.forwardRef)(function({inputId:t,placeholder:n,hasTopShadow:r=!1,slashCommands:i,onHasTextChange:a,onSubmit:o,userMessages:s,submitKey:l,canSubmitEmpty:u},c){let{recall:f,reset:d,isActive:h}=vL(s),m=(0,$n.useRef)(i);m.current=i;let b=(0,$n.useRef)(n);b.current=n;let E=(0,$n.useRef)(o);E.current=o;let g=(0,$n.useRef)(a);g.current=a;let y=(0,$n.useRef)(u);y.current=u;let T=(0,$n.useRef)(d);T.current=d;let S=(0,$n.useRef)(null),v=iL({extensions:[dL.extend({content:"inline*"}),hL,pL,yL,Kn.create({name:"submitShortcut",priority:200,addKeyboardShortcuts(){let x=()=>{if(uS.getState(this.editor.view.state)?.active)return!1;let A=kf(this.editor);return(this.editor.isEmpty||A.trim().length===0)&&!y.current?.()?!1:(E.current(A)&&(this.editor.commands.clearContent(!0),g.current(!1),T.current()),!0)},R={[l==="enter+modifier"?"Mod-Enter":"Enter"]:x};return l==="enter+modifier"&&(R.Enter=()=>this.editor.commands.first(({commands:L})=>[()=>L.newlineInCode(),()=>L.setHardBreak()])),R}}),SL.configure({commands:i,suggestion:{char:"/",allowSpaces:!1,allow({range:x}){return x.from===0},items:({query:x})=>_L(m.current,x),render:()=>CL({paletteId:`${t}-slash-palette`}),command:({editor:x,range:M,props:R})=>{x.chain().focus().deleteRange(M).insertContent([{type:"commandMention",attrs:{name:R.name}},{type:"text",text:" "}]).run()}}})],editorProps:{attributes:x=>{let M=x.doc.content.size===0;return{"aria-label":"Chat message","data-shiny-no-bind-input":"",role:"textbox","aria-multiline":"true",...m.current.length>0?{"aria-haspopup":"listbox"}:{},class:`form-control${r?" shadow":""}${M?" is-empty":""}`,...M?{"data-placeholder":b.current}:{}}},handleKeyDown:(x,M)=>{if(M.isComposing)return!1;if(M.key==="ArrowUp"||M.key==="ArrowDown"){let R=S.current;if(!R)return!1;let L=kf(R),{$from:A}=x.state.selection,H=A.pos===x.state.doc.content.size-1;if(h()?H:L.length===0){let z=f(M.key==="ArrowUp"?"up":"down",L);if(z!==void 0)return M.preventDefault(),R.commands.setContent(cS(z,m.current)),a(z.trim().length>0),R.commands.focus("end"),!0}return!1}return!1}},onCreate:({editor:x})=>{S.current=x,a(!x.isEmpty)},onUpdate:({editor:x})=>{a(!x.isEmpty)}});return(0,$n.useEffect)(()=>{let x=v?.view?.dom;x&&(i.length>0?x.setAttribute("aria-haspopup","listbox"):x.removeAttribute("aria-haspopup"))},[v,i]),(0,$n.useImperativeHandle)(c,()=>({setInputValue(x,{submit:M=!1,focus:R=!1}={}){if(!v)return;let L=kf(v);if(v.commands.setContent(cS(x,m.current)),a(x.trim().length>0),M){let A=kf(v);o(A),v.commands.setContent(cS(L,m.current)),a(L.trim().length>0)}R&&(v.view.dom.focus(),v.commands.setTextSelection(v.state.doc.content.size))},focus(){v?.commands.focus("end")},serializeEditor(){return v?kf(v):""}}),[v,o,a]),(0,kL.jsx)(tS,{editor:v,id:t})});var Ze=q(me(),1);function yW(e){return{mime:e.type,data_url:e.dataUrl,name:e.name,size:e.size}}function TW(e){return e.map(t=>({id:Sr(),type:t.mime,family:$o(t.mime)??"document",dataUrl:t.data_url,name:t.name,size:t.size}))}function Fm({uploadAccept:e,maxUploadSize:t,enableUpload:n,focusEditor:r}){let[i,a]=(0,Ze.useState)([]),o=(0,Ze.useRef)([]);(0,Ze.useEffect)(()=>{o.current=i},[i]);let[s,l]=(0,Ze.useState)(!1),[u,c]=(0,Ze.useState)(!1),[f,d]=(0,Ze.useState)(!1),h=(0,Ze.useRef)(null),m=(0,Ze.useCallback)(async H=>{let Y=[];for(let D of Array.from(H)){let B=null;try{B=await TR(D,e)}catch{continue}B&&Y.push(B)}if(Y.length===0){r();return}let z=!1,V=!1,$=!1;a(D=>{let B=bR(D),K=[];for(let{file:F,wasDownscaled:N,wasConverted:ae}of Y){if(t!==null&&B+F.size>t){z=!0;continue}K.push(F),B+=F.size,N&&(V=!0),ae&&($=!0)}return K.length>0?[...D,...K]:D}),z&&d(!0),V&&l(!0),$&&c(!0),r()},[e,t,r]),b=(0,Ze.useCallback)(H=>{d(!1),a(Y=>{let z=Y.filter(V=>V.id!==H);return z.length===0&&(l(!1),c(!1)),z})},[]),E=(0,Ze.useRef)([]),g=(0,Ze.useRef)(null),y=(0,Ze.useCallback)(H=>{let Y=i.length-1;g.current=Y===0?"input":Math.min(H,Y-1),b(i[H].id)},[i,b]);(0,Ze.useLayoutEffect)(()=>{E.current.length=i.length;let H=g.current;H!==null&&(g.current=null,H==="input"?r():E.current[H]?.focus())},[i,r]);let T=(0,Ze.useCallback)(H=>{if(!n)return;let Y=H.clipboardData;if(!Y)return;let z=[];for(let $ of Array.from(Y.items))if($.kind==="file"&&e.includes($.type)){let D=$.getAsFile();D&&z.push(D)}if(z.length>0){H.preventDefault(),H.stopPropagation(),m(z);return}let V=Y.getData("text/plain");V.length>hR&&e.includes("text/plain")&&(H.preventDefault(),H.stopPropagation(),m([yR(V)]))},[m,n,e]),S=(0,Ze.useCallback)(H=>{n&&H.dataTransfer?.files?.length&&(H.preventDefault(),H.stopPropagation(),m(H.dataTransfer.files))},[m,n]),v=(0,Ze.useCallback)(H=>{H.target.files&&m(H.target.files),H.target.value=""},[m]),x=(0,Ze.useCallback)(H=>{H.target===H.currentTarget&&(H.preventDefault(),r())},[r]),M=(0,Ze.useCallback)(()=>o.current.map(yW),[]),R=(0,Ze.useCallback)((H,Y)=>{let z=TW(H);Y==="append"?a(V=>[...V,...z]):(a(z),l(!1),c(!1),d(!1))},[]),L=(0,Ze.useCallback)(()=>a([]),[]),A=(0,Ze.useCallback)(()=>{a([]),l(!1),c(!1),d(!1)},[]);return{attachments:i,downscaleNotice:s,gifConvertedNotice:u,sizeNotice:f,fileInputRef:h,attachmentRefs:E,addFiles:m,removeAttachment:b,removeAttachmentByKeyboard:y,onPaste:T,onDrop:S,onFilePick:v,onAttachmentsMouseDown:x,getPayloads:M,applyPayloads:R,clearAttachments:L,resetAll:A}}var fS=q(me(),1);var ot=q(ne(),1),qm=(0,fS.memo)(function({staging:t,uploadAccept:n,maxUploadSize:r,enableUpload:i,disabled:a}){let{attachments:o,downscaleNotice:s,gifConvertedNotice:l,sizeNotice:u,fileInputRef:c,attachmentRefs:f,removeAttachmentByKeyboard:d,onFilePick:h,onAttachmentsMouseDown:m}=t;return(0,ot.jsxs)(ot.Fragment,{children:[o.length>0&&(0,ot.jsx)("div",{className:"shiny-chat-input-attachments",onMouseDown:m,children:o.map((b,E)=>(0,ot.jsx)(SW,{attachment:b,index:E,onRemove:()=>d(E),registerRef:g=>{f.current[E]=g}},b.id))}),(s||u||l)&&(0,ot.jsxs)("div",{className:"shiny-chat-input-notice",role:"status",children:[u&&r!==null&&(0,ot.jsxs)("div",{children:["Attachments exceed the ",jc(r)," limit."]}),s&&(0,ot.jsx)("div",{children:"Large image(s) were downscaled to fit."}),l&&(0,ot.jsx)("div",{children:"Animated GIF(s) were converted to a still image."})]}),i&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)("input",{ref:c,type:"file",multiple:!0,accept:cR(n),style:{display:"none"},onChange:h,"data-shiny-no-bind-input":!0}),(0,ot.jsx)("button",{type:"button",className:"shiny-chat-btn-attach",title:"Attach file","aria-label":"Attach file",disabled:a,onClick:()=>c.current?.click(),dangerouslySetInnerHTML:{__html:VO}})]})]})}),SW=(0,fS.memo)(function({attachment:t,index:n,onRemove:r,registerRef:i}){let a={tabIndex:0,"aria-label":t.name?`Attachment: ${t.name}. Press Delete to remove.`:"Attachment. Press Delete to remove.",onClick:o=>o.currentTarget.focus(),onKeyDown:o=>{(o.code==="Delete"||o.code==="Backspace")&&(o.preventDefault(),r())}};return t.family==="image"?(0,ot.jsxs)("div",{ref:i,className:"shiny-chat-input-thumbnail",title:t.name||void 0,...a,children:[(0,ot.jsx)("img",{src:t.dataUrl,alt:t.name?`Attached image: ${t.name}`:`Attached image ${n+1}`}),(0,ot.jsx)("button",{type:"button",tabIndex:0,"aria-label":t.name?`Remove ${t.name}`:"Remove image",onClick:r,children:"\xD7"})]}):t.family==="text"?(0,ot.jsx)(qp,{dataUrl:t.dataUrl,name:t.name,size:t.size,onRemove:r,rootRef:i,rootProps:a}):(0,ot.jsxs)("div",{ref:i,className:"shiny-chat-input-attachment-chip",title:t.name||void 0,...a,children:[(0,ot.jsx)("span",{className:"shiny-chat-attachment-badge",children:zp(t.name,t.type)}),(0,ot.jsxs)("span",{className:"shiny-chat-attachment-meta",children:[(0,ot.jsx)("span",{className:"shiny-chat-attachment-name",children:t.name||"attachment"}),(0,ot.jsx)("span",{className:"shiny-chat-attachment-size",children:jc(t.size)})]}),(0,ot.jsx)("button",{type:"button",tabIndex:0,"aria-label":t.name?`Remove ${t.name}`:"Remove attachment",onClick:r,children:"\xD7"})]})});var Re=q(ne(),1),_W=500,xW=10;function AW(e,t){if(!e.startsWith("/"))return null;let n=e.slice(1),r=n.indexOf(" "),i=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r+1).trim();return t.find(s=>s.name===i)?{commandName:i,remainingText:a}:null}var Vm=(0,Je.memo)(function({message:t,index:n,iconAssistant:r,onEdit:i,onNavigate:a,disabled:o,inputId:s,submitKey:l="enter",isEditing:u=!1,onStartEdit:c,onCancelEdit:f,uploadAccept:d=[],maxUploadSize:h=null,enableUpload:m}){let b=SN(),[E,g]=(0,Je.useState)(null),[y,T]=(0,Je.useState)(!1),S=(0,Je.useRef)(null),v=t.role==="user",x=v&&!!i&&!o&&!u,[M,R]=(0,Je.useState)(!1),L=(0,Je.useRef)(null),A=(0,Je.useRef)(null),H=(0,Je.useRef)(!1),Y=(0,Je.useRef)(null),z=(0,Je.useCallback)(()=>S.current?.focus(),[]),V=Fm({uploadAccept:d,maxUploadSize:h,enableUpload:m,focusEditor:z}),{applyPayloads:$,getPayloads:D,onPaste:B,onDrop:K}=V,F=(0,Je.useRef)(!1);(0,Je.useEffect)(()=>{u&&!F.current&&(S.current?.setInputValue(t.content,{focus:!0}),$(t.attachments??[],"set")),F.current=u},[u,t.content,t.attachments,$]);let N=(0,Je.useCallback)(ee=>o?!1:(i?.(n,ee,D()),f?.(),!0),[i,f,n,o,D]),ae=(0,Je.useCallback)(()=>D().length>0,[D]),ce=(0,Je.useCallback)(()=>{L.current!==null&&(clearTimeout(L.current),L.current=null)},[]),k=(0,Je.useCallback)(ee=>{ee.pointerType==="touch"&&(A.current={x:ee.clientX,y:ee.clientY},H.current=!1,ce(),L.current=setTimeout(()=>{L.current=null,H.current=!0,R(!0)},_W))},[ce]),Te=(0,Je.useCallback)(ee=>{let se=A.current;if(!se)return;Math.hypot(ee.clientX-se.x,ee.clientY-se.y)>xW&&(A.current=null,ce())},[ce]),be=(0,Je.useCallback)(ee=>{let se=A.current!==null;A.current=null,ce(),se&&H.current&&ee.preventDefault()},[ce]),He=(0,Je.useCallback)(()=>{A.current=null,ce()},[ce]),et=(0,Je.useCallback)(ee=>{(A.current!==null||H.current)&&ee.preventDefault()},[]);(0,Je.useEffect)(()=>{if(!M)return;let ee=se=>{Y.current?.contains(se.target)||R(!1)};return document.addEventListener("pointerdown",ee,!0),()=>document.removeEventListener("pointerdown",ee,!0)},[M]);let Ee=t.content.trim()!==""||t.blocks.some(ee=>ee.type==="thinking")||(t.attachments?.length??0)>0||t.cancelled,lt;v?lt=t.icon||void 0:lt=Ee?t.icon??r??UO:HO;let Ve=v?AW(t.content,b):null,St=v?"shiny-chat-user-message":"shiny-chat-message",Pt=t.attachments&&t.attachments.length>0?(0,Re.jsx)("div",{className:"shiny-chat-message-attachments",children:t.attachments.map((ee,se)=>{if(ee.mime.startsWith("image/")){let _t=ee.name?`Attached image: ${ee.name}`:`Attached image ${se+1}`;return(0,Re.jsx)("button",{type:"button",className:"shiny-chat-message-image-btn",title:ee.name||void 0,"aria-label":ee.name?`View ${ee.name}`:`View attached image ${se+1}`,onClick:()=>g({src:ee.data_url,name:ee.name,mime:ee.mime}),children:(0,Re.jsx)("img",{className:"shiny-chat-message-image",src:ee.data_url,alt:_t})},se)}return $o(ee.mime)==="text"?(0,Re.jsx)(qp,{dataUrl:ee.data_url,name:ee.name,size:Hp(ee.data_url),onActivate:()=>g({src:ee.data_url,name:ee.name,mime:ee.mime})},se):(0,Re.jsxs)("button",{type:"button",className:"shiny-chat-message-attachment-chip",title:ee.name||void 0,"aria-label":`View ${ee.name||"attachment"}`,onClick:()=>g({src:ee.data_url,name:ee.name,mime:ee.mime}),children:[(0,Re.jsx)("span",{className:"shiny-chat-attachment-badge",children:zp(ee.name,ee.mime)}),(0,Re.jsx)("span",{className:"shiny-chat-attachment-name",children:ee.name||"attachment"})]},se)})}):null,wn=t.blocks.map((ee,se)=>{if(ee.type==="thinking")return(0,Re.jsx)(iR,{thinking:ee,messageId:`${t.id}-${se}`},se);let _t=se===t.blocks.length-1;if(Ve&&se===0){let Wn=(0,Re.jsx)(aR,{name:Ve.commandName}),$e=Ve.remainingText||"";return ee.contentType==="text"?(0,Re.jsxs)("div",{className:"content-type-text",children:[Wn,$e&&` ${$e}`]},se):$e?(0,Re.jsx)($t,{content:$e,contentType:ee.contentType,role:t.role,streaming:t.streaming&&_t,tagToComponentMap:Ko,prefix:Wn},se):(0,Re.jsx)("p",{children:Wn},se)}let ue=(0,Re.jsx)($t,{content:ee.content,contentType:ee.contentType,role:t.role,streaming:t.streaming&&_t,tagToComponentMap:Ko},se);return ee.contentType==="text"?(0,Re.jsx)("div",{className:"content-type-text",children:ue},se):ue}),qr=E&&(0,Re.jsx)(xR,{src:E.src,name:E.name,mime:E.mime,onClose:()=>g(null)});return(0,Re.jsxs)("div",{ref:Y,className:St,"data-touch-revealed":M||void 0,onPointerDown:x?k:void 0,onPointerMove:x?Te:void 0,onPointerUp:x?be:void 0,onPointerCancel:x?He:void 0,onContextMenu:x?et:void 0,children:[lt&&(0,Re.jsx)("div",{className:"message-icon",dangerouslySetInnerHTML:{__html:lt}}),(0,Re.jsx)("div",{className:"shiny-chat-message-content",children:u?(0,Re.jsxs)("div",{className:"shiny-chat-edit-wrap",onKeyDownCapture:ee=>{ee.key==="Escape"&&(ee.preventDefault(),f?.())},children:[(0,Re.jsxs)("div",{className:"shiny-chat-edit-box",onDropCapture:K,onDragOver:ee=>ee.preventDefault(),onPasteCapture:B,children:[(0,Re.jsx)(qm,{staging:V,uploadAccept:d,maxUploadSize:h,enableUpload:m,disabled:o}),(0,Re.jsx)(zm,{ref:S,inputId:`${s}-edit`,placeholder:"Edit message",slashCommands:[],userMessages:[],submitKey:l,onHasTextChange:T,onSubmit:N,canSubmitEmpty:ae}),(0,Re.jsx)("button",{type:"button",className:"shiny-chat-btn-send",disabled:o||!y&&V.attachments.length===0,onClick:()=>{let ee=S.current?.serializeEditor()??"";N(ee)},"aria-label":"Save and resend",title:"Save and resend",dangerouslySetInnerHTML:{__html:Dp}})]}),(0,Re.jsx)("button",{type:"button",className:"shiny-chat-edit-cancel-outside",onClick:()=>f?.(),children:"Cancel"})]}):(0,Re.jsxs)(Re.Fragment,{children:[v&&Pt,wn,!v&&Pt,t.cancelled&&(0,Re.jsx)("div",{className:"shiny-chat-message-cancelled",children:"Response cancelled"})]})}),v&&!u&&(i&&!o||t.siblings&&t.siblings.total>1)&&(0,Re.jsxs)("div",{className:"shiny-chat-message-footer",children:[t.siblings&&t.siblings.total>1&&(0,Re.jsxs)("div",{className:"shiny-chat-sibling-nav",children:[(0,Re.jsx)("button",{type:"button",disabled:t.siblings.index===0||o,onClick:()=>a?.(n,"prev"),"aria-label":"Previous version",children:"\u2039"}),(0,Re.jsxs)("span",{"aria-live":"polite",children:[t.siblings.index+1," / ",t.siblings.total]}),(0,Re.jsx)("button",{type:"button",disabled:t.siblings.index===t.siblings.total-1||o,onClick:()=>a?.(n,"next"),"aria-label":"Next version",children:"\u203A"})]}),i&&!o&&(0,Re.jsx)("button",{type:"button",className:"shiny-chat-edit-btn",onClick:()=>{R(!1),c?.(t.id)},"aria-label":"Edit message",title:"Edit message",dangerouslySetInnerHTML:{__html:XO}})]}),qr]})});var wL=q(me(),1),ML=q(ne(),1),Wl=class extends wL.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){console.warn("[shinychat] Error rendering message:",t,n)}render(){return this.state.hasError?(0,ML.jsx)("div",{className:"shiny-chat-message-error",role:"alert",children:"Error rendering message"}):this.props.children}};var Ql=q(ne(),1),OL=(0,gs.memo)(function({messages:t,iconAssistant:n,onEdit:r,onNavigate:i,disabled:a,inputId:o,submitKey:s,uploadAccept:l,maxUploadSize:u,enableUpload:c}){let[f,d]=(0,gs.useState)(null),h=(0,gs.useCallback)(b=>d(b),[]),m=(0,gs.useCallback)(()=>d(null),[]);return(0,Ql.jsx)(Ql.Fragment,{children:t.map((b,E)=>(0,Ql.jsx)(Wl,{children:(0,Ql.jsx)(Vm,{message:b,index:E,iconAssistant:n,onEdit:r,onNavigate:i,disabled:a,inputId:o,submitKey:s,uploadAccept:l,maxUploadSize:u,enableUpload:c,isEditing:b.id===f,onStartEdit:h,onCancelEdit:m})},b.id))})});var Fr=q(me(),1);var Gm=q(ne(),1),RL=(0,Fr.memo)(function({greeting:t}){let n=Il(),r=(0,Fr.useContext)(No),i=(0,Fr.useRef)(null),[a,o]=(0,Fr.useState)(!0),s=t.status==="dismissing";if((0,Fr.useEffect)(()=>{if(!a)return;if(n){o(!1);return}let c=i.current;if(!c)return;function f(d){d.animationName==="shiny-chat-greeting-reveal"&&o(!1)}return c.addEventListener("animationend",f),()=>c.removeEventListener("animationend",f)},[a,n]),(0,Fr.useEffect)(()=>{if(!s)return;if(n){r?.({type:"greeting_dismissed"});return}let c=i.current;if(!c)return;function f(d){d.animationName==="shiny-chat-greeting-dismiss"&&r?.({type:"greeting_dismissed"})}return c.addEventListener("animationend",f),()=>c.removeEventListener("animationend",f)},[s,n,r]),t.status==="dismissed")return null;let l=t.blocks.length-1;return(0,Gm.jsx)("div",{className:a?"shiny-chat-greeting shiny-chat-greeting--enter":"shiny-chat-greeting",ref:i,...s?{"data-dismissing":""}:{},children:(0,Gm.jsx)("div",{className:"shiny-chat-greeting-content",children:t.blocks.map((c,f)=>(0,Gm.jsx)($t,{content:c.content,contentType:c.contentType,role:"assistant",streaming:t.streaming&&f===l,tagToComponentMap:Ko},f))})})});var jn=q(me(),1);var ro=q(ne(),1);function CW(e,t){if(!e.startsWith("/"))return null;let n=e.slice(1),r=n.indexOf(" "),i=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r+1).trim(),o=t.find(s=>s.name===i);return o?{command:i,userText:a,echo:o.echo}:null}var DL=(0,jn.memo)((0,jn.forwardRef)(function({transport:t,inputId:n,uploadAccept:r,maxUploadSize:i,disabled:a,hasTopShadow:o=!1,placeholder:s,onSend:l,userMessages:u,enableCancel:c,enableUpload:f,cancelRequested:d,isStreaming:h,onCancel:m,slashCommands:b=[],slashCommandId:E="",submitKey:g="enter"},y){let T=ch(),S=TN(),v=(0,jn.useRef)(null),[x,M]=(0,jn.useState)(!1),R=(0,jn.useCallback)(()=>v.current?.focus(),[]),L=Fm({uploadAccept:r,maxUploadSize:i,enableUpload:f,focusEditor:R}),{attachments:A,onPaste:H,onDrop:Y,getPayloads:z,applyPayloads:V,clearAttachments:$,resetAll:D}=L,B=(0,jn.useCallback)(k=>{let Te=z();if(k.trim().length===0&&Te.length===0||a)return!1;let be=CW(k,b);if(be){let He=document.getElementById(n),et=He?.closest("shiny-chat-container")??null,Ee={id:et?.getAttribute("effective-id")??et?.id??"",command:be.command,userText:be.userText,echo:be.echo},lt=new CustomEvent("shiny:chat-slash-command",{detail:Ee,cancelable:!0,bubbles:!0});(et??He)?.dispatchEvent(lt);let Ve=Ee.echo,St=lt.defaultPrevented;Ve&&T({type:"INPUT_SENT",content:k,role:"user",awaitResponse:!St}),St||t.sendSlashCommand(E,be.command,be.userText,Ve)}else S(k,Te),D();return l?.(),!0},[a,T,t,n,l,b,E,S,z,D]),K=(0,jn.useCallback)(()=>z().length>0,[z]);(0,jn.useImperativeHandle)(y,()=>({setInputValue(k,{submit:Te=!1,focus:be=!1,attachments:He,attachmentMode:et="append"}={}){let Ee=v.current;if(!Ee)return;if(!Te){k!==void 0?Ee.setInputValue(k,{focus:be}):be&&Ee.focus(),He!==void 0&&V(He,et);return}let lt=Ee.serializeEditor();k!==void 0&&Ee.setInputValue(k);let Ve=Ee.serializeEditor(),St=He??[],Pt=et==="append"?[...z(),...St]:St;Pt.length===0?B(Ve):!a&&Pt.length>0&&(S(Ve,Pt),l?.()),k!==void 0?Ee.setInputValue(lt,{focus:be}):be&&Ee.focus(),He!==void 0&&$()},focus(){v.current?.focus()}}),[a,l,B,S,V,z,$]);let F=a||!x&&A.length===0;return(0,ro.jsxs)("div",{className:"shiny-chat-input-dropzone",onDropCapture:Y,onDragOver:k=>k.preventDefault(),onPasteCapture:H,children:[(0,ro.jsx)(qm,{staging:L,uploadAccept:r,maxUploadSize:i,enableUpload:f,disabled:a}),(0,ro.jsx)(zm,{ref:v,inputId:n,placeholder:s,hasTopShadow:o,slashCommands:b,onHasTextChange:M,onSubmit:B,userMessages:u,submitKey:g,canSubmitEmpty:K}),!!c&&!!h&&!d?(0,ro.jsx)("button",{type:"button",className:"shiny-chat-btn-send shiny-chat-btn-cancel",title:"Stop generating","aria-label":"Stop generating",onClick:m,dangerouslySetInnerHTML:{__html:KO}}):a&&!h||!!d?(0,ro.jsx)("button",{type:"button",className:`shiny-chat-btn-send shiny-chat-btn-spinner${d?" shiny-chat-btn-cancel":""}`,"aria-label":"Loading",dangerouslySetInnerHTML:{__html:$O}}):(0,ro.jsx)("button",{type:"button",className:"shiny-chat-btn-send",title:"Send message","aria-label":"Send message",disabled:F,onClick:()=>{let k=v.current?.serializeEditor()??"";B(k)&&(v.current?.setInputValue(""),v.current?.focus())},dangerouslySetInnerHTML:{__html:Dp}})]})}));var dS=q(ne(),1);function IL({isAtBottom:e,scrollToBottom:t,streaming:n}){return e?null:(0,dS.jsx)("button",{type:"button",className:n?"shiny-chat-scroll-to-bottom streaming":"shiny-chat-scroll-to-bottom",title:"Scroll to bottom","aria-label":"Scroll to bottom",onClick:()=>t(),children:(0,dS.jsx)("span",{dangerouslySetInnerHTML:{__html:YO}})})}var Zl=q(me(),1),En=q(ne(),1);function LL({url:e,onProceed:t,onAlways:n,onCancel:r}){let i=(0,Zl.useRef)(null),a=(0,Zl.useRef)(t);a.current=t;let o=(0,Zl.useRef)(r);return o.current=r,(0,Zl.useEffect)(()=>{let s=i.current;if(!s)return;try{s.showModal()}catch{a.current()}let l=c=>{c.target===s&&o.current()},u=()=>{o.current()};return s.addEventListener("click",l),s.addEventListener("cancel",u),()=>{s.removeEventListener("click",l),s.removeEventListener("cancel",u)}},[]),(0,En.jsx)("dialog",{ref:i,className:"shinychat-external-link-dialog",children:(0,En.jsx)("div",{className:"modal position-relative d-block fade show",children:(0,En.jsxs)("div",{className:"modal-content",children:[(0,En.jsxs)("div",{className:"modal-header",children:[(0,En.jsx)("h5",{className:"modal-title",children:"External Link"}),(0,En.jsx)("button",{className:"btn-close shinychat-btn-close","data-bs-dismiss":"modal","aria-label":"Close",onClick:r})]}),(0,En.jsxs)("div",{className:"modal-body",children:[(0,En.jsx)("p",{children:"This link will take you to an external website:"}),(0,En.jsx)("p",{className:"link-url text-break",children:e})]}),(0,En.jsxs)("div",{className:"modal-footer flex-wrap-reverse",children:[(0,En.jsx)("button",{className:"btn btn-sm btn-link shinychat-btn-always ps-0 me-auto",onClick:n,children:"Always open external links"}),(0,En.jsxs)("div",{className:"d-flex gap-2 justify-content-end",children:[(0,En.jsx)("button",{autoFocus:!0,className:"btn btn-sm btn-primary shinychat-btn-proceed",onClick:t,children:"Open Link"}),(0,En.jsx)("button",{className:"btn btn-sm btn-outline-danger shinychat-btn-cancel",onClick:r,children:"Cancel"})]})]})]})})})}var Jl=q(me(),1);var PL=q(ne(),1);function BL({source:e,className:t}){let n=(0,Jl.useRef)(null),r=(0,Jl.useContext)(Ma);return(0,Jl.useEffect)(()=>{let i=n.current;if(i){for(r&&r.unbindAll(e);e.firstChild;)i.appendChild(e.firstChild);return r&&r.bindAll(i),()=>{for(r&&r.unbindAll(i);i.firstChild;)e.appendChild(i.firstChild)}}},[e,r]),(0,PL.jsx)("div",{ref:n,className:t})}var Xe=q(me(),1);var oe=q(ne(),1),NW=300;function UL({isOpen:e,onClose:t,triggerRef:n,conversations:r,activeId:i,busy:a,onSelect:o,onNew:s,onRename:l,onDelete:u}){let[c,f]=(0,Xe.useState)(e),[d,h]=(0,Xe.useState)(!1),m=(0,Xe.useRef)(e);m.current=c;let b=Il(),[E,g]=(0,Xe.useState)(""),[y,T]=(0,Xe.useState)(null),[S,v]=(0,Xe.useState)(null),[x,M]=(0,Xe.useState)(null),R=(0,Xe.useRef)(null),L=(0,Xe.useRef)(null),A=(0,Xe.useCallback)(()=>{g(""),T(null),v(null),M(null),t()},[t]),H=(0,Xe.useCallback)(()=>{f(!1),h(!1),n.current?.focus({preventScroll:!0})},[n]);(0,Xe.useEffect)(()=>{e?(f(!0),h(!1)):m.current&&h(!0)},[e]),(0,Xe.useEffect)(()=>{if(!d)return;if(b){H();return}let B=setTimeout(H,NW);return()=>clearTimeout(B)},[d,b,H]),(0,Xe.useEffect)(()=>{if(!c||d)return;let B=R.current;if(!B)return;let K=F=>{if(F.key==="Escape"){if(x){M(null);return}if(y){T(null);return}A();return}if(F.key==="Tab"){let N=B.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(N.length===0)return;let ae=N[0],ce=N[N.length-1],k=document.activeElement===B;F.shiftKey&&(document.activeElement===ae||k)?(F.preventDefault(),ce.focus()):!F.shiftKey&&document.activeElement===ce&&(F.preventDefault(),ae.focus())}};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[c,d,x,y,A]),(0,Xe.useEffect)(()=>{c&&!d&&R.current?.focus({preventScroll:!0})},[c,d]),(0,Xe.useEffect)(()=>{if(!y)return;let B=K=>{K.target.closest(`[data-menu-id="${y}"]`)||T(null)};return document.addEventListener("pointerdown",B,!0),()=>document.removeEventListener("pointerdown",B,!0)},[y]);let Y=(0,Xe.useMemo)(()=>{let B=E.trim().toLowerCase();return B?r.filter(K=>K.title.toLowerCase().includes(B)):r},[r,E]),z=(0,Xe.useMemo)(()=>kW(Y),[Y]);function V(B){B.target===B.currentTarget&&d&&H()}function $(B){a||(o(B),A())}function D(){a||(s(),A())}return c?(0,oe.jsxs)("div",{ref:R,className:"shiny-chat-history","data-closing":d||void 0,role:"dialog","aria-modal":"true","aria-label":"Conversation history",tabIndex:-1,children:[(0,oe.jsx)("div",{className:"shiny-chat-history-scrim",onClick:A}),(0,oe.jsxs)("div",{className:"shiny-chat-history-drawer",onAnimationEnd:V,children:[(0,oe.jsxs)("div",{className:"shiny-chat-history-header",children:[(0,oe.jsx)("h2",{className:"shiny-chat-history-title",children:"History"}),(0,oe.jsx)("button",{type:"button",className:"shiny-chat-history-close","aria-label":"Close history",onClick:A,children:(0,oe.jsx)(zL,{})})]}),(0,oe.jsxs)("div",{className:"shiny-chat-history-toprow",children:[(0,oe.jsxs)("button",{type:"button",className:"shiny-chat-history-new",disabled:a,title:a?"Wait for the response to finish":void 0,"aria-label":"New conversation",onClick:D,children:[(0,oe.jsx)(MW,{}),"New"]}),(0,oe.jsxs)("span",{className:"shiny-chat-history-search-wrap",children:[(0,oe.jsx)("span",{className:"shiny-chat-history-search-icon",children:(0,oe.jsx)(OW,{})}),(0,oe.jsx)("input",{className:"shiny-chat-history-search form-control",ref:L,placeholder:"Search\u2026",value:E,onChange:B=>g(B.target.value),"aria-label":"Search conversations"})]})]}),(0,oe.jsxs)("div",{className:"shiny-chat-history-list",children:[Y.length===0&&(0,oe.jsx)("div",{className:"shiny-chat-history-empty",children:E.trim()?"No conversations found":"No conversations yet"}),z.map(([B,K])=>(0,oe.jsxs)(Xe.default.Fragment,{children:[(0,oe.jsx)("div",{className:"shiny-chat-history-section",children:B}),K.map(F=>(0,oe.jsx)(vW,{meta:F,active:F.id===i,busy:a,menuOpen:y===F.id,renaming:S===F.id,confirmingDelete:x===F.id,onToggleMenu:()=>T(y===F.id?null:F.id),onStartRename:()=>{v(F.id),T(null)},onStartDelete:()=>{M(F.id),T(null)},onCancelEdit:()=>{v(null),M(null)},onRename:N=>{l(F.id,N),v(null)},onDelete:()=>{u(F.id),M(null)},onSelect:()=>$(F.id)},F.id))]},B))]})]})]}):null}function vW({meta:e,active:t,busy:n,menuOpen:r,renaming:i,confirmingDelete:a,onToggleMenu:o,onStartRename:s,onStartDelete:l,onCancelEdit:u,onRename:c,onDelete:f,onSelect:d}){let[h,m]=(0,Xe.useState)(e.title);return(0,Xe.useEffect)(()=>{i||m(e.title)},[e.title,i]),i?(0,oe.jsx)("div",{className:"shiny-chat-history-item",children:(0,oe.jsx)("input",{className:"shiny-chat-history-rename-input form-control form-control-sm",autoFocus:!0,value:h,onChange:b=>m(b.target.value),onKeyDown:b=>{if(b.key==="Enter"){if(!h.trim())return;c(h);return}b.key==="Escape"&&(b.stopPropagation(),u())},onBlur:u,"aria-label":"Rename conversation"})}):(0,oe.jsxs)("div",{className:`shiny-chat-history-item${t?" active":""}`,children:[(0,oe.jsxs)("button",{type:"button",className:"shiny-chat-history-item-select",disabled:n,title:n?"Wait for the response to finish":void 0,onClick:d,children:[(0,oe.jsx)("span",{className:"shiny-chat-history-item-title",children:e.title}),(0,oe.jsx)("span",{className:"shiny-chat-history-item-time",children:wW(e.updated_at)})]}),a?(0,oe.jsxs)("span",{className:"shiny-chat-history-confirm",children:["Delete?",(0,oe.jsx)("button",{type:"button",className:"shiny-chat-history-confirm-yes",onClick:f,"aria-label":"Confirm delete",children:(0,oe.jsx)(RW,{})}),(0,oe.jsx)("button",{type:"button",className:"shiny-chat-history-confirm-no",onClick:u,"aria-label":"Cancel delete",children:(0,oe.jsx)(zL,{})})]}):(0,oe.jsxs)("span",{className:"shiny-chat-history-itemmenu","data-menu-id":e.id,children:[(0,oe.jsx)("button",{type:"button","aria-label":"Conversation actions",onClick:o,children:(0,oe.jsx)(DW,{})}),r&&(0,oe.jsxs)("span",{className:"shiny-chat-history-menu",children:[(0,oe.jsxs)("button",{type:"button",onClick:s,children:[(0,oe.jsx)(IW,{}),"Rename"]}),(0,oe.jsxs)("button",{type:"button",className:"shiny-chat-history-menu-danger",disabled:n,title:n?"Wait for the response to finish":void 0,onClick:l,children:[(0,oe.jsx)(LW,{}),"Delete"]})]})]})]})}function kW(e){let t=new Date;t.setHours(0,0,0,0);let n=new Date(t);n.setDate(n.getDate()-7);let r=[],i=[],a=[];for(let s of e){let l=new Date(s.updated_at);l>=t?r.push(s):l>=n?i.push(s):a.push(s)}let o=[];return r.length&&o.push(["Today",r]),i.length&&o.push(["Last 7 days",i]),a.length&&o.push(["Previous",a]),o}function wW(e){let t=new Date(e),n=new Date;return n.setHours(0,0,0,0),t>=n?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function HL(){return(0,oe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("path",{d:"M2.5 3v3h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"M2.75 6A5.5 5.5 0 1 1 3 9.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"M8 5v3.2l2.2 1.3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function MW(){return(0,oe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("path",{d:"M8 2.5H3.5A1.5 1.5 0 0 0 2 4v8.5A1.5 1.5 0 0 0 3.5 14H12a1.5 1.5 0 0 0 1.5-1.5V8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"M11.7 2.3a1.2 1.2 0 0 1 1.7 1.7L8 9.4l-2.3.6.6-2.3 5.4-5.4z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function OW(){return(0,oe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,oe.jsx)("path",{d:"m10.5 10.5 3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function zL(){return(0,oe.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,oe.jsx)("path",{d:"m4 4 8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function RW(){return(0,oe.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,oe.jsx)("path",{d:"m3.5 8.5 3 3 6-7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function DW(){return(0,oe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[(0,oe.jsx)("circle",{cx:"3.5",cy:"8",r:"1.35"}),(0,oe.jsx)("circle",{cx:"8",cy:"8",r:"1.35"}),(0,oe.jsx)("circle",{cx:"12.5",cy:"8",r:"1.35"})]})}function IW(){return(0,oe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("path",{d:"M11.7 2.3a1.2 1.2 0 0 1 1.7 1.7l-8 8-2.8.9.9-2.8 8.2-8.2z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"m10.5 3.5 2 2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function LW(){return(0,oe.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,oe.jsx)("path",{d:"M3 4.5h10M6.5 4.5V3a.8.8 0 0 1 .8-.8h1.4a.8.8 0 0 1 .8.8v1.5M4.5 4.5l.5 8a1 1 0 0 0 1 .95h4a1 1 0 0 0 1-.95l.5-8M6.75 7v3.75M9.25 7v3.75",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}var FL=q(me(),1);function qL(e){(0,FL.useEffect)(()=>{let t=e.current?.closest("shiny-chat-container");if(!t?.hasAttribute("fill")||!t.classList.contains("html-fill-item"))return;let n=null,r="",i=t;for(;i.parentElement instanceof HTMLElement&&i.parentElement.classList.contains("html-fill-container")&&i.parentElement.children.length===1;){i=i.parentElement;let o=getComputedStyle(i).paddingLeft;if(parseFloat(o)>0){n=i,r=o;break}}if(!n)return;let a=n.style.padding;return n.style.padding="0",t.style.setProperty("--shiny-chat-fill-padding",r),()=>{n.style.padding=a,t.style.removeProperty("--shiny-chat-fill-padding")}},[e])}var Ym=q(me(),1);function VL(e,t){let n=(0,Ym.useRef)(t);n.current=t;let{enabled:r=!0,boundarySelector:i}=t;(0,Ym.useEffect)(()=>{if(!r)return;let a=e.current;if(!a)return;let o=a.closest(i);if(!o)return;let s=()=>{let{shiftProperty:h,side:m,gap:b=8,maxShiftFraction:E=1/3,shouldSkip:g}=n.current;if(g?.(o))return;let y=(typeof m=="function"?m(o):m)==="right";a.style.setProperty(h,"0px");let T=a.getBoundingClientRect();if(T.width===0||T.height===0)return;let S=y?T.right-1:T.left+1,v=[T.top+2,T.top+T.height/2,T.bottom-2],x=null;for(let L of v){let A=document.elementsFromPoint(S,L).find(z=>!o.contains(z)&&!z.contains(o));if(!A)continue;let H=A.getBoundingClientRect(),Y=y?H.left:H.right;x=x===null?Y:y?Math.min(x,Y):Math.max(x,Y)}if(x===null)return;let M=y?T.right-x+b:x-T.left+b;if(M<=0)return;let R=o.clientWidth*E;a.style.setProperty(h,`${Math.min(M,R)}px`)};s();let l=new ResizeObserver(s);l.observe(o),window.addEventListener("resize",s);let u=o.closest(".bslib-sidebar-layout");u?.addEventListener("transitionend",s);let c=u?new MutationObserver(s):null;c?.observe(u,{attributes:!0,attributeFilter:["class"]});let{watchMutations:f}=n.current,d=f?new MutationObserver(s):null;return d?.observe(o,f),()=>{l.disconnect(),window.removeEventListener("resize",s),u?.removeEventListener("transitionend",s),c?.disconnect(),d?.disconnect()}},[r,i,e])}var Bt=q(ne(),1);function hS(e){window.open(e,"_blank","noopener,noreferrer")}var YL=(0,st.forwardRef)(function({transport:t,messages:n,streamingMessage:r,inputDisabled:i,inputPlaceholder:a,iconAssistant:o,inputId:s,uploadAccept:l,maxUploadSize:u,elementId:c,greeting:f,cancelId:d,enableCancel:h,enableUpload:m,cancelRequested:b,footerEl:E,slashCommands:g,slashCommandId:y,submitKey:T,historyEnabled:S,historyConversations:v,historyActiveId:x,onEdit:M,onNavigate:R},L){let A=(0,st.useMemo)(()=>n.filter(X=>X.role==="user").map(X=>X.content),[n]),H=(0,st.useRef)(null),[Y,z]=(0,st.useState)(!1),V=(0,st.useRef)(null),[$,D]=(0,st.useState)(null),B=(0,st.useRef)(null);B.current=$;let{scrollRef:K,contentRef:F,scrollToBottom:N,stopScroll:ae}=dh({resize:"smooth"}),[ce,k]=(0,st.useState)(!0);(0,st.useEffect)(()=>{let X=K.current;if(!X)return;let Se=()=>{let O=X.scrollHeight-X.scrollTop-X.clientHeight;k(O<=1)};Se(),X.addEventListener("scroll",Se,{passive:!0});let Ne=new ResizeObserver(Se);Ne.observe(X);let gt=()=>{Array.from(X.children).forEach(O=>Ne.observe(O))};gt();let yn=new MutationObserver(()=>{gt(),Se()});return yn.observe(X,{childList:!0}),()=>{X.removeEventListener("scroll",Se),Ne.disconnect(),yn.disconnect()}},[K]);let Te=ch(),be=!!r,He=(0,st.useCallback)(()=>{!h||!d||!be||b||(Te({type:"CANCEL_REQUESTED"}),t.sendCancel(d))},[h,d,be,b,Te,t]),et=(0,st.useRef)(He);et.current=He,(0,st.useEffect)(()=>{if(!h)return;let X=K.current?.closest("shiny-chat-container");if(!X)return;let Se=Ne=>{Ne.defaultPrevented||Ne.key==="Escape"&&et.current()};return X.addEventListener("keydown",Se),()=>X.removeEventListener("keydown",Se)},[h,K]),qL(K),VL(V,{enabled:S,boundarySelector:"shiny-chat-container",shiftProperty:"--_history-trigger-shift",side:X=>X.getAttribute("data-history-placement")==="right"?"right":"left",shouldSkip:X=>!!X.querySelector(":scope > .shiny-chat-history"),watchMutations:{childList:!0}}),(0,st.useImperativeHandle)(L,()=>({setInputValue(...X){H.current?.setInputValue(...X)},focus(){H.current?.focus()}}));let Ee=(0,st.useCallback)(X=>{let Ne=X.target.closest("a[data-shinychat-link]");if(!Ne||!Ne.href)return;if(X.preventDefault(),Ne.origin===window.location.origin||window.shinychat_always_open_external_links){hS(Ne.href);return}if(typeof window.HTMLDialogElement>"u"){hS(Ne.href);return}D(Ne.href)},[]);function lt(X){if(!(X instanceof HTMLElement))return{};let Se=X.closest(".suggestion, [data-suggestion]");return Se instanceof HTMLElement?Se.classList.contains("suggestion")||Se.dataset.suggestion!==void 0?{suggestion:Se.dataset.suggestion||Se.textContent||void 0,submit:Se.classList.contains("submit")||Se.dataset.suggestionSubmit===""||Se.dataset.suggestionSubmit==="true"}:{}:{}}function Ve(X){let{suggestion:Se,submit:Ne}=lt(X.target);if(!Se)return;X.preventDefault();let gt=X.metaKey||X.ctrlKey?!0:X.altKey?!1:Ne;H.current?.setInputValue(Se,{submit:gt,focus:!gt});let yn=X.target.closest(".shiny-chat-suggestion-list-item"),O=yn?.closest(".shiny-chat-suggestion-list");yn&&O&&(O.querySelectorAll("[data-last-clicked]").forEach(P=>P.removeAttribute("data-last-clicked")),yn.setAttribute("data-last-clicked",""))}function St(X){Ve(X)}function Pt(X){Ee(X),St(X)}function wn(X){let Se=X.target.closest(".shiny-chat-suggestion-list-item");if(!Se)return;let Ne=Se.closest(".shiny-chat-suggestion-list");!Ne||Ne.dataset.roved!==void 0||(Ne.dataset.roved="",Ne.querySelectorAll(".shiny-chat-suggestion-list-item").forEach(gt=>{gt!==Se&&(gt.tabIndex=-1)}))}function qr(X){let Se=X.target.closest(".shiny-chat-suggestion-list-item");if(!Se)return;let Ne=Se.closest(".shiny-chat-suggestion-list");if(!Ne)return;let gt=X.relatedTarget,yn=gt?.closest(".shiny-chat-suggestion-list");(!gt||yn!==Ne)&&delete Ne.dataset.roved}function ee(X,Se,Ne){switch(Ne){case"ArrowDown":case"ArrowRight":return(X+1)%Se;case"ArrowUp":case"ArrowLeft":return(X-1+Se)%Se;case"Home":return 0;case"End":return Se-1;default:return null}}function se(X){let Ne=X.target.closest(".shiny-chat-suggestion-list-item"),gt=Ne?.closest(".shiny-chat-suggestion-list");if(Ne&>){let O=Array.from(gt.querySelectorAll(".shiny-chat-suggestion-list-item")),P=O.indexOf(Ne),J=ee(P,O.length,X.key);if(J!==null){X.preventDefault();let ie=O[P],ye=O[J];ie.tabIndex=-1,ye.tabIndex=0,ye.focus();return}}(X.key==="Enter"||X.key===" ")&&Ve(X)}let _t=(0,st.useCallback)(()=>{let X=B.current;X&&hS(X),D(null)},[]),ue=(0,st.useCallback)(()=>{window.shinychat_always_open_external_links=!0,_t()},[_t]),Wn=(0,st.useCallback)(()=>{D(null)},[]),$e=(0,st.useCallback)(()=>{N()},[N]);return(0,Bt.jsxs)(Fb.Provider,{value:g,children:[S&&(0,Bt.jsx)("button",{type:"button",ref:V,className:"shiny-chat-history-trigger","aria-label":"Conversation history","aria-expanded":Y,onClick:()=>z(X=>!X),children:(0,Bt.jsx)(HL,{})}),(0,Bt.jsxs)("div",{className:"shiny-chat-wrapper",children:[(0,Bt.jsxs)("div",{className:"shiny-chat-messages-wrapper",children:[(0,Bt.jsx)("div",{className:"shiny-chat-messages",ref:K,onClick:Pt,onFocus:wn,onBlur:qr,onKeyDown:se,children:(0,Bt.jsxs)(Ub.Provider,{value:ae,children:[f!=null&&(0,Bt.jsx)(RL,{greeting:f}),(0,Bt.jsxs)("div",{className:"shiny-chat-messages-content",ref:F,role:"log","aria-live":"polite",...f?.status==="dismissing"?{"data-greeting-dismissing":""}:{},children:[(0,Bt.jsx)(OL,{messages:n,iconAssistant:o,onEdit:S?M:void 0,onNavigate:S?R:void 0,disabled:be,inputId:s,submitKey:T,uploadAccept:l,maxUploadSize:u,enableUpload:m}),r&&(0,Bt.jsx)(Wl,{children:(0,Bt.jsx)(Vm,{message:r,index:n.length,iconAssistant:o})},r.id)]})]})}),(0,Bt.jsx)(IL,{isAtBottom:ce,scrollToBottom:N,streaming:!!r||!!f?.streaming})]}),(0,Bt.jsx)("div",{className:i?"shiny-chat-input disabled":"shiny-chat-input",onClick:Ee,children:(0,Bt.jsx)(DL,{ref:H,transport:t,inputId:s,uploadAccept:l,maxUploadSize:u,disabled:i,hasTopShadow:!ce,placeholder:a,onSend:$e,userMessages:A,enableCancel:h,enableUpload:m,cancelRequested:b,isStreaming:be,onCancel:He,slashCommands:g,slashCommandId:y,submitKey:T})}),E&&(0,Bt.jsx)(BL,{source:E,className:"shiny-chat-footer"})]}),S&&(0,Bt.jsx)(UL,{isOpen:Y,onClose:()=>z(!1),triggerRef:V,conversations:v??[],activeId:x??null,busy:be,onSelect:X=>{t.sendHistorySelect(c,X)},onNew:()=>t.sendHistoryNew(c),onRename:(X,Se)=>t.sendHistoryRename(c,X,Se),onDelete:X=>t.sendHistoryDelete(c,X)}),$&&(0,GL.createPortal)((0,Bt.jsx)(LL,{url:$,onProceed:_t,onAlways:ue,onCancel:Wn}),document.body)]})});var eu=q(ne(),1);function BW(e,t){let r=!(e.options.persistent===!0)&&t>0?"dismissed":"visible";return{content:e.content,contentType:e.contentType,streaming:!1,status:r,options:e.options,blocks:[{type:"content",content:e.content,contentType:e.contentType}]}}function KL({transport:e,shinyLifecycle:t,elementId:n,iconAssistant:r,inputId:i,cancelId:a,uploadAccept:o=[],maxUploadSize:s=null,placeholder:l,initialMessages:u,initialGreeting:c,enableCancel:f,enableUpload:d,footerEl:h,slashCommandId:m="",submitKey:b}){let E=u??[],[g,y]=(0,mt.useReducer)(bN,{...wa,inputPlaceholder:l??wa.inputPlaceholder,messages:E,greeting:c?BW(c,E.length):null,enableCancel:f??wa.enableCancel,enableCancelExplicit:f!==void 0,enableUpload:d??wa.enableUpload,enableUploadExplicit:d!==void 0}),T=(0,mt.useRef)(g);T.current=g;let S=(0,mt.useCallback)(()=>{e.sendMessagesSnapshot(n,Pb(T.current))},[e,n]);(0,mt.useEffect)(()=>{S()},[g.messages,S]);let v=(0,mt.useCallback)((D,B)=>{y({type:"INPUT_SENT",content:D,role:"user",...B.length>0?{attachments:B}:{}});let K=Pb(T.current);K.push({role:"user",segments:[{content:D,content_type:"markdown"}],...B.length>0?{attachments:B}:{}});let F=T.current.enableUpload;e.sendInput(i,F?{text:D,attachments:B}:D),e.sendMessagesSnapshot(n,K)},[y,e,i,n]),x=(0,mt.useRef)(null);(0,mt.useEffect)(()=>e.onMessage(n,B=>{if(B.type==="history_navigate"){Vb(n,B.active_id),AN(B.url,B.reload===!0);return}if(B.type==="update_input"){B.placeholder!==void 0&&y({type:"update_input",placeholder:B.placeholder}),B.value!==void 0||B.attachments!==void 0?x.current?.setInputValue(B.value,{submit:B.submit,focus:B.focus,attachments:B.attachments,attachmentMode:B.attachment_mode}):B.focus&&x.current?.focus();return}y(B)}),[e,n]);let[M,R]=(0,mt.useState)(!1);(0,mt.useEffect)(()=>{if(!n)return;let D=document.getElementById(n);if(!D)return;if(typeof IntersectionObserver>"u"){R(!0);return}let B=new IntersectionObserver(K=>R(K[0]?.isIntersecting??!1),{threshold:0});return B.observe(D),()=>B.disconnect()},[n]);let L=M&&g.messages.length===0&&g.greeting===null,A=(0,mt.useRef)(!1);(0,mt.useEffect)(()=>{if(!L){A.current=!1;return}A.current||window.Shiny?.setInputValue&&(A.current=!0,window.Shiny.setInputValue(`${n}_greeting_requested`,Date.now(),{priority:"event"}))},[L,n]);let H=g.greeting?.status==="dismissed",Y=(0,mt.useRef)(!1);(0,mt.useEffect)(()=>{window.Shiny?.setInputValue&&(H&&!Y.current?(Y.current=!0,window.Shiny.setInputValue(`${n}_greeting_dismissed`,Date.now(),{priority:"event"})):!H&&Y.current&&(Y.current=!1,window.Shiny.setInputValue(`${n}_greeting_dismissed`,null)))},[H,n]),(0,mt.useEffect)(()=>{g.history.enabled&&Vb(n,g.history.activeId)},[n,g.history.enabled,g.history.activeId]);let z=(0,mt.useCallback)((D,B,K)=>{e.sendMessageEdit(n,D,B,K)},[e,n]),V=(0,mt.useCallback)((D,B)=>{e.sendMessageNavigate(n,D,B)},[e,n]),$=(0,mt.useMemo)(()=>({hiddenToolRequests:g.hiddenToolRequests}),[g.hiddenToolRequests]);return(0,eu.jsx)(Ma.Provider,{value:t,children:(0,eu.jsx)(Hb.Provider,{value:$,children:(0,eu.jsx)(No.Provider,{value:y,children:(0,eu.jsx)(zb.Provider,{value:v,children:(0,eu.jsx)(YL,{ref:x,transport:e,messages:g.messages,streamingMessage:g.streamingMessage,inputDisabled:g.inputDisabled,inputPlaceholder:g.inputPlaceholder,iconAssistant:r,inputId:i,uploadAccept:o,maxUploadSize:s,elementId:n,greeting:g.greeting,cancelId:a,enableCancel:g.enableCancel,enableUpload:g.enableUpload,cancelRequested:g.cancelRequested,footerEl:h,slashCommands:g.slashCommands,slashCommandId:m,submitKey:b,historyEnabled:g.history.enabled,historyConversations:g.history.conversations,historyActiveId:g.history.activeId,onEdit:z,onNavigate:V})})})})})}function $L(e){if(!e||typeof e!="object")return!1;let t=e;return!(typeof t.id!="string"||!t.action||typeof t.action!="object"||typeof t.action.type!="string")}function Km(){return window.__shinyChatTransport||(window.__shinyChatTransport=new pS),window.__shinyChatTransport}var pS=class{listeners=new Map;pendingMessages=new Map;inputSeq=0;constructor(){window.Shiny?.addCustomMessageHandler("shinyChatMessage",async t=>{if(!$L(t)){console.warn("[shinychat] Malformed shinyChatMessage envelope, dropping:",JSON.stringify(t));return}let{id:n,action:r,html_deps:i}=t;i&&Array.isArray(i)&&(await this.renderDependencies(i),(r.type==="message"||r.type==="chunk_start"||r.type==="chunk")&&(r.html_deps=i));let a=this.listeners.get(n);if(!a||a.size===0){this.pendingMessages.has(n)||this.pendingMessages.set(n,[]),this.pendingMessages.get(n).push(r);return}for(let o of a)o(r)})}sendInput(t,n){if(!window.Shiny?.setInputValue)return;let r=typeof n=="string"?{text:n,attachments:[]}:n;this.inputSeq+=1,window.Shiny.setInputValue(`${t}:shinychat.userInput`,{...r,seq:this.inputSeq})}sendCancel(t){window.Shiny?.setInputValue&&window.Shiny.setInputValue(t,Date.now(),{priority:"event"})}sendSlashCommand(t,n,r,i){window.Shiny?.setInputValue&&window.Shiny.setInputValue(t,{command:n,userText:r,echo:i},{priority:"event"})}sendMessagesSnapshot(t,n){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_messages:shinychat.messages`,n)}sendHistorySelect(t,n){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_select`,{id:n,ts:Date.now()},{priority:"event"})}sendHistoryNew(t){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_new`,Date.now(),{priority:"event"})}sendHistoryRename(t,n,r){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_rename`,{id:n,title:r,ts:Date.now()},{priority:"event"})}sendHistoryDelete(t,n){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_delete`,{id:n,ts:Date.now()},{priority:"event"})}sendMessageEdit(t,n,r,i=[]){window.Shiny?.setInputValue?.(`${t}_message_edit`,{index:n,content:r,attachments:i,ts:Date.now()})}sendMessageNavigate(t,n,r){window.Shiny?.setInputValue?.(`${t}_message_navigate`,{index:n,direction:r,ts:Date.now()})}onMessage(t,n){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n);let r=this.pendingMessages.get(t);if(r&&r.length>0){this.pendingMessages.delete(t);for(let i of r)n(i)}return()=>{this.listeners.get(t)?.delete(n)}}async renderDependencies(t){if(window.Shiny&&t)try{await window.Shiny.renderDependenciesAsync(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to render HTML dependencies: ${n}`})}}async bindAll(t){if(window?.Shiny?.initializeInputs&&window?.Shiny?.bindAll){try{window.Shiny.initializeInputs(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to initialize Shiny inputs: ${n}`})}try{await window.Shiny.bindAll(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to bind Shiny inputs/outputs: ${n}`})}}}unbindAll(t){if(window?.Shiny?.unbindAll)try{window.Shiny.unbindAll(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to unbind Shiny inputs/outputs: ${n}`})}}showClientMessage(t){document.dispatchEvent(new CustomEvent("shiny:client-message",{detail:{headline:t.headline??"",message:t.message,status:t.status??"warning"}}))}};var $m=Km(),jL="shinychat-browser-token",mS=null;function PW(){try{let e=window.localStorage.getItem(jL);return e||(e=crypto.randomUUID(),window.localStorage.setItem(jL,e)),e}catch{return mS||(mS=crypto.randomUUID()),mS}}var UW="shiny-chat-input",HW="shiny-chat-message",zW="shiny-chat-footer";function FW(e){let t=e.querySelectorAll(HW),n=[];return t.forEach(r=>{let i=r.getAttribute("content")??"",a=r.getAttribute("data-role")??"assistant",o=r.getAttribute("content-type")??"markdown",s=r.getAttribute("icon")??void 0;n.push({id:Sr(),role:a,content:i,streaming:!1,icon:s,blocks:[{type:"content",content:i,contentType:o}]})}),n}function qW(e){let t=e.getAttribute("greeting");if(t)try{let n=JSON.parse(t);return n.content?{content:n.content,contentType:n.content_type??"markdown",options:n.options??{}}:void 0}catch{return}}var gS=class extends HTMLElement{reactRoot=null;footerEl=null;pendingUnmount=null;connectedCallback(){if(this.pendingUnmount!==null&&(clearTimeout(this.pendingUnmount),this.pendingUnmount=null),this.reactRoot)return;let t=this.getAttribute("id")??"",n=this.getAttribute("icon-assistant")??void 0,r=this.getAttribute("enable-cancel"),i=r===null?void 0:r!=="false",a=this.getAttribute("allow-attachments"),o=a===null?void 0:a!=="false",s=this.querySelector(UW),l=s?.getAttribute("placeholder")??void 0,u=s?.getAttribute("id")??`${t}_user_input`,c=`${t}_cancel`,f=this.getAttribute("attachment-accept"),d=f?f.split(",").map(v=>v.trim()):uR,h=this.getAttribute("max-attachment-size"),m=h?parseInt(h,10):NaN,b=Number.isFinite(m)?m:null,E=FW(this);this.footerEl||(this.footerEl=this.querySelector(zW),this.footerEl?.remove());let g=qW(this),T=this.getAttribute("submit-key")==="enter+modifier"?"enter+modifier":"enter",S=`${t}_slash_command`;$m.unbindAll(this),window.Shiny?.initializedPromise.then(()=>{window.Shiny?.setInputValue?.(`${t}_history_browser_token`,PW()),window.Shiny?.setInputValue?.(`${t}_history_current_id`,xN(t)??""),window.Shiny?.setInputValue?.(`${t}_history_url_id`,_N()??"")}),this.reactRoot=(0,XL.createRoot)(this),this.reactRoot.render((0,WL.createElement)(KL,{transport:$m,shinyLifecycle:$m,elementId:t,iconAssistant:n,inputId:u,cancelId:c,uploadAccept:d,maxUploadSize:b,placeholder:l,initialMessages:E,initialGreeting:g,enableCancel:i,enableUpload:o,footerEl:this.footerEl??void 0,slashCommandId:S,submitKey:T}))}disconnectedCallback(){this.pendingUnmount=setTimeout(()=>{$m.unbindAll(this),this.reactRoot?.unmount(),this.reactRoot=null,this.pendingUnmount=null},0)}};customElements.get("shiny-chat-container")||customElements.define("shiny-chat-container",gS);var t6=q(oh(),1),ES=q(me(),1);var Qt=q(me(),1);var Xn=q(me(),1);function QL({streaming:e,contentDependency:t,bottomTolerance:n=10,scrollOnContentChange:r=!1}){let i=(0,Xn.useRef)(null),[a,o]=(0,Xn.useState)(!0),s=(0,Xn.useRef)(0),l=(0,Xn.useCallback)(()=>{let m=i.current;if(!m)return;let{scrollTop:b,scrollHeight:E,clientHeight:g}=m,y=b+g>=E-n,T=b{u.current()}),f=(0,Xn.useCallback)(m=>{i.current&&i.current.removeEventListener("scroll",c.current),i.current=m,m&&(s.current=m.scrollTop,m.addEventListener("scroll",c.current,{passive:!0}))},[]);(0,Xn.useEffect)(()=>{(e||r)&&a&&i.current&&i.current.scrollTo({top:i.current.scrollHeight,behavior:"smooth"})},[e,a,t,r]);let d=(0,Xn.useCallback)(()=>{o(!0),i.current?.scrollTo({top:i.current.scrollHeight,behavior:"smooth"})},[]),h=(0,Xn.useCallback)(()=>{o(!0)},[]);return{containerRef:f,stickToBottom:a,scrollToBottom:d,engageStickToBottom:h}}function ZL(e,t){let n=e.parentElement,r=t?.toLowerCase();for(;n&&!(r&&n.tagName.toLowerCase()===r);){let i=getComputedStyle(n),a=i.overflowY!=="hidden"&&i.overflowY!=="clip",o=n.scrollHeight>n.clientHeight;if(a&&o)return n;n=n.parentElement}return null}var bS=q(ne(),1),VW="shiny-chat-container";function JL({initialContent:e="",initialContentType:t="markdown",initialStreaming:n=!1,autoScroll:r=!1,onApiReady:i}){let[a,o]=(0,Qt.useState)(e),[s,l]=(0,Qt.useState)(t),[u,c]=(0,Qt.useState)(n),f=(0,Qt.useRef)(null),d=(0,Qt.useRef)(null),{containerRef:h,scrollToBottom:m}=QL({streaming:r&&u,contentDependency:a});(0,Qt.useLayoutEffect)(()=>{if(!r||!f.current){d.current&&(h(null),d.current=null);return}let y=ZL(f.current,VW);y!==d.current&&(h(y),d.current=y)},[r,a,h]),(0,Qt.useEffect)(()=>()=>{d.current&&(h(null),d.current=null)},[h]),(0,Qt.useEffect)(()=>{u&&r&&m()},[u,r,m]);let b=(0,Qt.useCallback)(y=>{o(T=>T+y)},[]),E=(0,Qt.useCallback)(y=>{o(y)},[]),g=(0,Qt.useMemo)(()=>({appendContent:b,replaceContent:E,setStreaming:c,setContentType:l}),[b,E]);return(0,Qt.useEffect)(()=>{i?.(g)},[g,i]),(0,bS.jsx)("div",{ref:f,children:(0,bS.jsx)($t,{content:a,contentType:s,streaming:u})})}var yS=Km();function n6(e){return"isStreaming"in e}var TS=class extends HTMLElement{reactRoot=null;api=null;pendingMessages=[];pendingUnmount=null;connectedCallback(){if(this.pendingUnmount!==null&&(clearTimeout(this.pendingUnmount),this.pendingUnmount=null),this.reactRoot)return;this.reactRoot=(0,t6.createRoot)(this);let t=this.getAttribute("content")??"",n=this.getAttribute("content-type")??"markdown",r=e6(this,"streaming"),i=e6(this,"auto-scroll");this.reactRoot.render((0,ES.createElement)(Ma.Provider,{value:yS},(0,ES.createElement)(JL,{initialContent:t,initialContentType:n,initialStreaming:r,autoScroll:i,onApiReady:a=>{this.api=a;for(let o of this.pendingMessages)this.dispatchMessage(o);this.pendingMessages=[]}})))}disconnectedCallback(){this.pendingUnmount=setTimeout(()=>{this.reactRoot?.unmount(),this.reactRoot=null,this.api=null,this.pendingMessages=[],this.pendingUnmount=null},0)}handleMessage(t){if(!this.api){this.pendingMessages.push(t);return}this.dispatchMessage(t)}dispatchMessage(t){if(n6(t)){this.api.setStreaming(t.isStreaming);return}t.operation==="replace"?this.api.replaceContent(t.content):t.operation==="append"&&this.api.appendContent(t.content)}};function GW(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function e6(e,t){let n=e.getAttribute(t);if(n===""||n==="true")return!0;if(n==="false")return!1;let r=GW(t),i=e[r];return i===!0||i==="true"}customElements.get("shiny-markdown-stream")||customElements.define("shiny-markdown-stream",TS);window.Shiny?.addCustomMessageHandler("shinyMarkdownStreamMessage",async e=>{let t=document.getElementById(e.id);if(!t){yS.showClientMessage({status:"error",message:`Unable to handle MarkdownStream() message since element with id ${e.id} wasn't found.`});return}!n6(e)&&e.html_deps&&await yS.renderDependencies(e.html_deps),t.handleMessage(e)}); +`),r=[];return n.forEach((i,a)=>{a>0&&r.push({type:"hardBreak"}),i&&r.push({type:"text",text:i})}),{type:"doc",content:r}}var zm=(0,$n.forwardRef)(function({inputId:t,placeholder:n,hasTopShadow:r=!1,slashCommands:i,onHasTextChange:a,onSubmit:o,userMessages:s,submitKey:l,canSubmitEmpty:u},c){let{recall:f,reset:d,isActive:h}=kL(s),m=(0,$n.useRef)(i);m.current=i;let b=(0,$n.useRef)(n);b.current=n;let E=(0,$n.useRef)(o);E.current=o;let g=(0,$n.useRef)(a);g.current=a;let y=(0,$n.useRef)(u);y.current=u;let T=(0,$n.useRef)(d);T.current=d;let S=(0,$n.useRef)(null),v=aL({extensions:[hL.extend({content:"inline*"}),pL,mL,TL,Kn.create({name:"submitShortcut",priority:200,addKeyboardShortcuts(){let x=()=>{if(uS.getState(this.editor.view.state)?.active)return!1;let A=kf(this.editor);return(this.editor.isEmpty||A.trim().length===0)&&!y.current?.()?!1:(E.current(A)&&(this.editor.commands.clearContent(!0),g.current(!1),T.current()),!0)},R={[l==="enter+modifier"?"Mod-Enter":"Enter"]:x};return l==="enter+modifier"&&(R.Enter=()=>this.editor.commands.first(({commands:L})=>[()=>L.newlineInCode(),()=>L.setHardBreak()])),R}}),_L.configure({commands:i,suggestion:{char:"/",allowSpaces:!1,allow({range:x}){return x.from===0},items:({query:x})=>xL(m.current,x),render:()=>NL({paletteId:`${t}-slash-palette`}),command:({editor:x,range:M,props:R})=>{x.chain().focus().deleteRange(M).insertContent([{type:"commandMention",attrs:{name:R.name}},{type:"text",text:" "}]).run()}}})],editorProps:{attributes:x=>{let M=x.doc.content.size===0;return{"aria-label":"Chat message","data-shiny-no-bind-input":"",role:"textbox","aria-multiline":"true",...m.current.length>0?{"aria-haspopup":"listbox"}:{},class:`form-control${r?" shadow":""}${M?" is-empty":""}`,...M?{"data-placeholder":b.current}:{}}},handleKeyDown:(x,M)=>{if(M.isComposing)return!1;if(M.key==="ArrowUp"||M.key==="ArrowDown"){let R=S.current;if(!R)return!1;let L=kf(R),{$from:A}=x.state.selection,H=A.pos===x.state.doc.content.size-1;if(h()?H:L.length===0){let z=f(M.key==="ArrowUp"?"up":"down",L);if(z!==void 0)return M.preventDefault(),R.commands.setContent(cS(z,m.current)),a(z.trim().length>0),R.commands.focus("end"),!0}return!1}return!1}},onCreate:({editor:x})=>{S.current=x,a(!x.isEmpty)},onUpdate:({editor:x})=>{a(!x.isEmpty)}});return(0,$n.useEffect)(()=>{let x=v?.view?.dom;x&&(i.length>0?x.setAttribute("aria-haspopup","listbox"):x.removeAttribute("aria-haspopup"))},[v,i]),(0,$n.useImperativeHandle)(c,()=>({setInputValue(x,{submit:M=!1,focus:R=!1}={}){if(!v)return;let L=kf(v);if(v.commands.setContent(cS(x,m.current)),a(x.trim().length>0),M){let A=kf(v);o(A),v.commands.setContent(cS(L,m.current)),a(L.trim().length>0)}R&&(v.view.dom.focus(),v.commands.setTextSelection(v.state.doc.content.size))},focus(){v?.commands.focus("end")},serializeEditor(){return v?kf(v):""}}),[v,o,a]),(0,wL.jsx)(tS,{editor:v,id:t})});var Ze=q(me(),1);function _W(e){return{mime:e.type,data_url:e.dataUrl,name:e.name,size:e.size}}function xW(e){return e.map(t=>({id:Sr(),type:t.mime,family:$o(t.mime)??"document",dataUrl:t.data_url,name:t.name,size:t.size}))}function Fm({uploadAccept:e,maxUploadSize:t,enableUpload:n,focusEditor:r}){let[i,a]=(0,Ze.useState)([]),o=(0,Ze.useRef)([]);(0,Ze.useEffect)(()=>{o.current=i},[i]);let[s,l]=(0,Ze.useState)(!1),[u,c]=(0,Ze.useState)(!1),[f,d]=(0,Ze.useState)(!1),h=(0,Ze.useRef)(null),m=(0,Ze.useCallback)(async H=>{let Y=[];for(let D of Array.from(H)){let B=null;try{B=await SR(D,e)}catch{continue}B&&Y.push(B)}if(Y.length===0){r();return}let z=!1,V=!1,$=!1;a(D=>{let B=ER(D),K=[];for(let{file:F,wasDownscaled:N,wasConverted:ae}of Y){if(t!==null&&B+F.size>t){z=!0;continue}K.push(F),B+=F.size,N&&(V=!0),ae&&($=!0)}return K.length>0?[...D,...K]:D}),z&&d(!0),V&&l(!0),$&&c(!0),r()},[e,t,r]),b=(0,Ze.useCallback)(H=>{d(!1),a(Y=>{let z=Y.filter(V=>V.id!==H);return z.length===0&&(l(!1),c(!1)),z})},[]),E=(0,Ze.useRef)([]),g=(0,Ze.useRef)(null),y=(0,Ze.useCallback)(H=>{let Y=i.length-1;g.current=Y===0?"input":Math.min(H,Y-1),b(i[H].id)},[i,b]);(0,Ze.useLayoutEffect)(()=>{E.current.length=i.length;let H=g.current;H!==null&&(g.current=null,H==="input"?r():E.current[H]?.focus())},[i,r]);let T=(0,Ze.useCallback)(H=>{if(!n)return;let Y=H.clipboardData;if(!Y)return;let z=[];for(let $ of Array.from(Y.items))if($.kind==="file"&&e.includes($.type)){let D=$.getAsFile();D&&z.push(D)}if(z.length>0){H.preventDefault(),H.stopPropagation(),m(z);return}let V=Y.getData("text/plain");V.length>pR&&e.includes("text/plain")&&(H.preventDefault(),H.stopPropagation(),m([TR(V)]))},[m,n,e]),S=(0,Ze.useCallback)(H=>{n&&H.dataTransfer?.files?.length&&(H.preventDefault(),H.stopPropagation(),m(H.dataTransfer.files))},[m,n]),v=(0,Ze.useCallback)(H=>{H.target.files&&m(H.target.files),H.target.value=""},[m]),x=(0,Ze.useCallback)(H=>{H.target===H.currentTarget&&(H.preventDefault(),r())},[r]),M=(0,Ze.useCallback)(()=>o.current.map(_W),[]),R=(0,Ze.useCallback)((H,Y)=>{let z=xW(H);Y==="append"?a(V=>[...V,...z]):(a(z),l(!1),c(!1),d(!1))},[]),L=(0,Ze.useCallback)(()=>a([]),[]),A=(0,Ze.useCallback)(()=>{a([]),l(!1),c(!1),d(!1)},[]);return{attachments:i,downscaleNotice:s,gifConvertedNotice:u,sizeNotice:f,fileInputRef:h,attachmentRefs:E,addFiles:m,removeAttachment:b,removeAttachmentByKeyboard:y,onPaste:T,onDrop:S,onFilePick:v,onAttachmentsMouseDown:x,getPayloads:M,applyPayloads:R,clearAttachments:L,resetAll:A}}var fS=q(me(),1);var ot=q(ne(),1),qm=(0,fS.memo)(function({staging:t,uploadAccept:n,maxUploadSize:r,enableUpload:i,disabled:a}){let{attachments:o,downscaleNotice:s,gifConvertedNotice:l,sizeNotice:u,fileInputRef:c,attachmentRefs:f,removeAttachmentByKeyboard:d,onFilePick:h,onAttachmentsMouseDown:m}=t;return(0,ot.jsxs)(ot.Fragment,{children:[o.length>0&&(0,ot.jsx)("div",{className:"shiny-chat-input-attachments",onMouseDown:m,children:o.map((b,E)=>(0,ot.jsx)(AW,{attachment:b,index:E,onRemove:()=>d(E),registerRef:g=>{f.current[E]=g}},b.id))}),(s||u||l)&&(0,ot.jsxs)("div",{className:"shiny-chat-input-notice",role:"status",children:[u&&r!==null&&(0,ot.jsxs)("div",{children:["Attachments exceed the ",jc(r)," limit."]}),s&&(0,ot.jsx)("div",{children:"Large image(s) were downscaled to fit."}),l&&(0,ot.jsx)("div",{children:"Animated GIF(s) were converted to a still image."})]}),i&&(0,ot.jsxs)(ot.Fragment,{children:[(0,ot.jsx)("input",{ref:c,type:"file",multiple:!0,accept:fR(n),style:{display:"none"},onChange:h,"data-shiny-no-bind-input":!0}),(0,ot.jsx)("button",{type:"button",className:"shiny-chat-btn-attach",title:"Attach file","aria-label":"Attach file",disabled:a,onClick:()=>c.current?.click(),dangerouslySetInnerHTML:{__html:GO}})]})]})}),AW=(0,fS.memo)(function({attachment:t,index:n,onRemove:r,registerRef:i}){let a={tabIndex:0,"aria-label":t.name?`Attachment: ${t.name}. Press Delete to remove.`:"Attachment. Press Delete to remove.",onClick:o=>o.currentTarget.focus(),onKeyDown:o=>{(o.code==="Delete"||o.code==="Backspace")&&(o.preventDefault(),r())}};return t.family==="image"?(0,ot.jsxs)("div",{ref:i,className:"shiny-chat-input-thumbnail",title:t.name||void 0,...a,children:[(0,ot.jsx)("img",{src:t.dataUrl,alt:t.name?`Attached image: ${t.name}`:`Attached image ${n+1}`}),(0,ot.jsx)("button",{type:"button",tabIndex:0,"aria-label":t.name?`Remove ${t.name}`:"Remove image",onClick:r,children:"\xD7"})]}):t.family==="text"?(0,ot.jsx)(qp,{dataUrl:t.dataUrl,name:t.name,size:t.size,onRemove:r,rootRef:i,rootProps:a}):(0,ot.jsxs)("div",{ref:i,className:"shiny-chat-input-attachment-chip",title:t.name||void 0,...a,children:[(0,ot.jsx)("span",{className:"shiny-chat-attachment-badge",children:zp(t.name,t.type)}),(0,ot.jsxs)("span",{className:"shiny-chat-attachment-meta",children:[(0,ot.jsx)("span",{className:"shiny-chat-attachment-name",children:t.name||"attachment"}),(0,ot.jsx)("span",{className:"shiny-chat-attachment-size",children:jc(t.size)})]}),(0,ot.jsx)("button",{type:"button",tabIndex:0,"aria-label":t.name?`Remove ${t.name}`:"Remove attachment",onClick:r,children:"\xD7"})]})});var Re=q(ne(),1),CW=500,NW=10;function vW(e,t){if(!e.startsWith("/"))return null;let n=e.slice(1),r=n.indexOf(" "),i=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r+1).trim();return t.find(s=>s.name===i)?{commandName:i,remainingText:a}:null}var Vm=(0,Je.memo)(function({message:t,index:n,iconAssistant:r,onEdit:i,onNavigate:a,disabled:o,inputId:s,submitKey:l="enter",isEditing:u=!1,onStartEdit:c,onCancelEdit:f,uploadAccept:d=[],maxUploadSize:h=null,enableUpload:m}){let b=SN(),[E,g]=(0,Je.useState)(null),[y,T]=(0,Je.useState)(!1),S=(0,Je.useRef)(null),v=t.role==="user",x=v&&!!i&&!o&&!u,[M,R]=(0,Je.useState)(!1),L=(0,Je.useRef)(null),A=(0,Je.useRef)(null),H=(0,Je.useRef)(!1),Y=(0,Je.useRef)(null),z=(0,Je.useCallback)(()=>S.current?.focus(),[]),V=Fm({uploadAccept:d,maxUploadSize:h,enableUpload:m,focusEditor:z}),{applyPayloads:$,getPayloads:D,onPaste:B,onDrop:K}=V,F=(0,Je.useRef)(!1);(0,Je.useEffect)(()=>{u&&!F.current&&(S.current?.setInputValue(t.content,{focus:!0}),$(t.attachments??[],"set")),F.current=u},[u,t.content,t.attachments,$]);let N=(0,Je.useCallback)(ee=>o?!1:(i?.(n,ee,D()),f?.(),!0),[i,f,n,o,D]),ae=(0,Je.useCallback)(()=>D().length>0,[D]),ce=(0,Je.useCallback)(()=>{L.current!==null&&(clearTimeout(L.current),L.current=null)},[]),k=(0,Je.useCallback)(ee=>{ee.pointerType==="touch"&&(A.current={x:ee.clientX,y:ee.clientY},H.current=!1,ce(),L.current=setTimeout(()=>{L.current=null,H.current=!0,R(!0)},CW))},[ce]),Te=(0,Je.useCallback)(ee=>{let se=A.current;if(!se)return;Math.hypot(ee.clientX-se.x,ee.clientY-se.y)>NW&&(A.current=null,ce())},[ce]),be=(0,Je.useCallback)(ee=>{let se=A.current!==null;A.current=null,ce(),se&&H.current&&ee.preventDefault()},[ce]),He=(0,Je.useCallback)(()=>{A.current=null,ce()},[ce]),et=(0,Je.useCallback)(ee=>{(A.current!==null||H.current)&&ee.preventDefault()},[]);(0,Je.useEffect)(()=>{if(!M)return;let ee=se=>{Y.current?.contains(se.target)||R(!1)};return document.addEventListener("pointerdown",ee,!0),()=>document.removeEventListener("pointerdown",ee,!0)},[M]);let Ee=t.content.trim()!==""||t.blocks.some(ee=>ee.type==="thinking")||(t.attachments?.length??0)>0||t.cancelled,lt;v?lt=t.icon||void 0:lt=Ee?t.icon??r??HO:zO;let Ve=v?vW(t.content,b):null,St=v?"shiny-chat-user-message":"shiny-chat-message",Pt=t.attachments&&t.attachments.length>0?(0,Re.jsx)("div",{className:"shiny-chat-message-attachments",children:t.attachments.map((ee,se)=>{if(ee.mime.startsWith("image/")){let _t=ee.name?`Attached image: ${ee.name}`:`Attached image ${se+1}`;return(0,Re.jsx)("button",{type:"button",className:"shiny-chat-message-image-btn",title:ee.name||void 0,"aria-label":ee.name?`View ${ee.name}`:`View attached image ${se+1}`,onClick:()=>g({src:ee.data_url,name:ee.name,mime:ee.mime}),children:(0,Re.jsx)("img",{className:"shiny-chat-message-image",src:ee.data_url,alt:_t})},se)}return $o(ee.mime)==="text"?(0,Re.jsx)(qp,{dataUrl:ee.data_url,name:ee.name,size:Hp(ee.data_url),onActivate:()=>g({src:ee.data_url,name:ee.name,mime:ee.mime})},se):(0,Re.jsxs)("button",{type:"button",className:"shiny-chat-message-attachment-chip",title:ee.name||void 0,"aria-label":`View ${ee.name||"attachment"}`,onClick:()=>g({src:ee.data_url,name:ee.name,mime:ee.mime}),children:[(0,Re.jsx)("span",{className:"shiny-chat-attachment-badge",children:zp(ee.name,ee.mime)}),(0,Re.jsx)("span",{className:"shiny-chat-attachment-name",children:ee.name||"attachment"})]},se)})}):null,wn=t.blocks.map((ee,se)=>{if(ee.type==="thinking")return(0,Re.jsx)(aR,{thinking:ee,messageId:`${t.id}-${se}`},se);let _t=se===t.blocks.length-1;if(Ve&&se===0){let Wn=(0,Re.jsx)(oR,{name:Ve.commandName}),$e=Ve.remainingText||"";return ee.contentType==="text"?(0,Re.jsxs)("div",{className:"content-type-text",children:[Wn,$e&&` ${$e}`]},se):$e?(0,Re.jsx)($t,{content:$e,contentType:ee.contentType,role:t.role,streaming:t.streaming&&_t,tagToComponentMap:Ko,prefix:Wn},se):(0,Re.jsx)("p",{children:Wn},se)}let ue=(0,Re.jsx)($t,{content:ee.content,contentType:ee.contentType,role:t.role,streaming:t.streaming&&_t,tagToComponentMap:Ko},se);return ee.contentType==="text"?(0,Re.jsx)("div",{className:"content-type-text",children:ue},se):ue}),qr=E&&(0,Re.jsx)(AR,{src:E.src,name:E.name,mime:E.mime,onClose:()=>g(null)});return(0,Re.jsxs)("div",{ref:Y,className:St,"data-touch-revealed":M||void 0,onPointerDown:x?k:void 0,onPointerMove:x?Te:void 0,onPointerUp:x?be:void 0,onPointerCancel:x?He:void 0,onContextMenu:x?et:void 0,children:[lt&&(0,Re.jsx)("div",{className:"message-icon",dangerouslySetInnerHTML:{__html:lt}}),(0,Re.jsx)("div",{className:"shiny-chat-message-content",children:u?(0,Re.jsxs)("div",{className:"shiny-chat-edit-wrap",onKeyDownCapture:ee=>{ee.key==="Escape"&&(ee.preventDefault(),f?.())},children:[(0,Re.jsxs)("div",{className:"shiny-chat-edit-box",onDropCapture:K,onDragOver:ee=>ee.preventDefault(),onPasteCapture:B,children:[(0,Re.jsx)(qm,{staging:V,uploadAccept:d,maxUploadSize:h,enableUpload:m,disabled:o}),(0,Re.jsx)(zm,{ref:S,inputId:`${s}-edit`,placeholder:"Edit message",slashCommands:[],userMessages:[],submitKey:l,onHasTextChange:T,onSubmit:N,canSubmitEmpty:ae}),(0,Re.jsx)("button",{type:"button",className:"shiny-chat-btn-send",disabled:o||!y&&V.attachments.length===0,onClick:()=>{let ee=S.current?.serializeEditor()??"";N(ee)},"aria-label":"Save and resend",title:"Save and resend",dangerouslySetInnerHTML:{__html:Dp}})]}),(0,Re.jsx)("button",{type:"button",className:"shiny-chat-edit-cancel-outside",onClick:()=>f?.(),children:"Cancel"})]}):(0,Re.jsxs)(Re.Fragment,{children:[v&&Pt,wn,!v&&Pt,t.cancelled&&(0,Re.jsx)("div",{className:"shiny-chat-message-cancelled",children:"Response cancelled"})]})}),v&&!u&&(i&&!o||t.siblings&&t.siblings.total>1)&&(0,Re.jsxs)("div",{className:"shiny-chat-message-footer",children:[t.siblings&&t.siblings.total>1&&(0,Re.jsxs)("div",{className:"shiny-chat-sibling-nav",children:[(0,Re.jsx)("button",{type:"button",disabled:t.siblings.index===0||o,onClick:()=>a?.(n,"prev"),"aria-label":"Previous version",children:"\u2039"}),(0,Re.jsxs)("span",{"aria-live":"polite",children:[t.siblings.index+1," / ",t.siblings.total]}),(0,Re.jsx)("button",{type:"button",disabled:t.siblings.index===t.siblings.total-1||o,onClick:()=>a?.(n,"next"),"aria-label":"Next version",children:"\u203A"})]}),i&&!o&&(0,Re.jsx)("button",{type:"button",className:"shiny-chat-edit-btn",onClick:()=>{R(!1),c?.(t.id)},"aria-label":"Edit message",title:"Edit message",dangerouslySetInnerHTML:{__html:WO}})]}),qr]})});var ML=q(me(),1),OL=q(ne(),1),Wl=class extends ML.Component{constructor(t){super(t),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(t,n){console.warn("[shinychat] Error rendering message:",t,n)}render(){return this.state.hasError?(0,OL.jsx)("div",{className:"shiny-chat-message-error",role:"alert",children:"Error rendering message"}):this.props.children}};var Ql=q(ne(),1),RL=(0,gs.memo)(function({messages:t,iconAssistant:n,onEdit:r,onNavigate:i,disabled:a,inputId:o,submitKey:s,uploadAccept:l,maxUploadSize:u,enableUpload:c}){let[f,d]=(0,gs.useState)(null),h=(0,gs.useCallback)(b=>d(b),[]),m=(0,gs.useCallback)(()=>d(null),[]);return(0,Ql.jsx)(Ql.Fragment,{children:t.map((b,E)=>(0,Ql.jsx)(Wl,{children:(0,Ql.jsx)(Vm,{message:b,index:E,iconAssistant:n,onEdit:r,onNavigate:i,disabled:a,inputId:o,submitKey:s,uploadAccept:l,maxUploadSize:u,enableUpload:c,isEditing:b.id===f,onStartEdit:h,onCancelEdit:m})},b.id))})});var Fr=q(me(),1);var Gm=q(ne(),1),DL=(0,Fr.memo)(function({greeting:t}){let n=Il(),r=(0,Fr.useContext)(No),i=(0,Fr.useRef)(null),[a,o]=(0,Fr.useState)(!0),s=t.status==="dismissing";if((0,Fr.useEffect)(()=>{if(!a)return;if(n){o(!1);return}let c=i.current;if(!c)return;function f(d){d.animationName==="shiny-chat-greeting-reveal"&&o(!1)}return c.addEventListener("animationend",f),()=>c.removeEventListener("animationend",f)},[a,n]),(0,Fr.useEffect)(()=>{if(!s)return;if(n){r?.({type:"greeting_dismissed"});return}let c=i.current;if(!c)return;function f(d){d.animationName==="shiny-chat-greeting-dismiss"&&r?.({type:"greeting_dismissed"})}return c.addEventListener("animationend",f),()=>c.removeEventListener("animationend",f)},[s,n,r]),t.status==="dismissed")return null;let l=t.blocks.length-1;return(0,Gm.jsx)("div",{className:a?"shiny-chat-greeting shiny-chat-greeting--enter":"shiny-chat-greeting",ref:i,...s?{"data-dismissing":""}:{},children:(0,Gm.jsx)("div",{className:"shiny-chat-greeting-content",children:t.blocks.map((c,f)=>(0,Gm.jsx)($t,{content:c.content,contentType:c.contentType,role:"assistant",streaming:t.streaming&&f===l,tagToComponentMap:Ko},f))})})});var jn=q(me(),1);var ro=q(ne(),1);function kW(e,t){if(!e.startsWith("/"))return null;let n=e.slice(1),r=n.indexOf(" "),i=r===-1?n:n.slice(0,r),a=r===-1?"":n.slice(r+1).trim(),o=t.find(s=>s.name===i);return o?{command:i,userText:a,echo:o.echo}:null}var IL=(0,jn.memo)((0,jn.forwardRef)(function({transport:t,inputId:n,uploadAccept:r,maxUploadSize:i,disabled:a,hasTopShadow:o=!1,placeholder:s,onSend:l,userMessages:u,enableCancel:c,enableUpload:f,cancelRequested:d,isStreaming:h,onCancel:m,slashCommands:b=[],slashCommandId:E="",submitKey:g="enter"},y){let T=ch(),S=TN(),v=(0,jn.useRef)(null),[x,M]=(0,jn.useState)(!1),R=(0,jn.useCallback)(()=>v.current?.focus(),[]),L=Fm({uploadAccept:r,maxUploadSize:i,enableUpload:f,focusEditor:R}),{attachments:A,onPaste:H,onDrop:Y,getPayloads:z,applyPayloads:V,clearAttachments:$,resetAll:D}=L,B=(0,jn.useCallback)(k=>{let Te=z();if(k.trim().length===0&&Te.length===0||a)return!1;let be=kW(k,b);if(be){let He=document.getElementById(n),et=He?.closest("shiny-chat-container")??null,Ee={id:et?.getAttribute("effective-id")??et?.id??"",command:be.command,userText:be.userText,echo:be.echo},lt=new CustomEvent("shiny:chat-slash-command",{detail:Ee,cancelable:!0,bubbles:!0});(et??He)?.dispatchEvent(lt);let Ve=Ee.echo,St=lt.defaultPrevented;Ve&&T({type:"INPUT_SENT",content:k,role:"user",awaitResponse:!St}),St||t.sendSlashCommand(E,be.command,be.userText,Ve)}else S(k,Te),D();return l?.(),!0},[a,T,t,n,l,b,E,S,z,D]),K=(0,jn.useCallback)(()=>z().length>0,[z]);(0,jn.useImperativeHandle)(y,()=>({setInputValue(k,{submit:Te=!1,focus:be=!1,attachments:He,attachmentMode:et="append"}={}){let Ee=v.current;if(!Ee)return;if(!Te){k!==void 0?Ee.setInputValue(k,{focus:be}):be&&Ee.focus(),He!==void 0&&V(He,et);return}let lt=Ee.serializeEditor();k!==void 0&&Ee.setInputValue(k);let Ve=Ee.serializeEditor(),St=He??[],Pt=et==="append"?[...z(),...St]:St;Pt.length===0?B(Ve):!a&&Pt.length>0&&(S(Ve,Pt),l?.()),k!==void 0?Ee.setInputValue(lt,{focus:be}):be&&Ee.focus(),He!==void 0&&$()},focus(){v.current?.focus()}}),[a,l,B,S,V,z,$]);let F=a||!x&&A.length===0;return(0,ro.jsxs)("div",{className:"shiny-chat-input-dropzone",onDropCapture:Y,onDragOver:k=>k.preventDefault(),onPasteCapture:H,children:[(0,ro.jsx)(qm,{staging:L,uploadAccept:r,maxUploadSize:i,enableUpload:f,disabled:a}),(0,ro.jsx)(zm,{ref:v,inputId:n,placeholder:s,hasTopShadow:o,slashCommands:b,onHasTextChange:M,onSubmit:B,userMessages:u,submitKey:g,canSubmitEmpty:K}),!!c&&!!h&&!d?(0,ro.jsx)("button",{type:"button",className:"shiny-chat-btn-send shiny-chat-btn-cancel",title:"Stop generating","aria-label":"Stop generating",onClick:m,dangerouslySetInnerHTML:{__html:$O}}):a&&!h||!!d?(0,ro.jsx)("button",{type:"button",className:`shiny-chat-btn-send shiny-chat-btn-spinner${d?" shiny-chat-btn-cancel":""}`,"aria-label":"Loading",dangerouslySetInnerHTML:{__html:jO}}):(0,ro.jsx)("button",{type:"button",className:"shiny-chat-btn-send",title:"Send message","aria-label":"Send message",disabled:F,onClick:()=>{let k=v.current?.serializeEditor()??"";B(k)&&(v.current?.setInputValue(""),v.current?.focus())},dangerouslySetInnerHTML:{__html:Dp}})]})}));var dS=q(ne(),1);function LL({isAtBottom:e,scrollToBottom:t,streaming:n}){return e?null:(0,dS.jsx)("button",{type:"button",className:n?"shiny-chat-scroll-to-bottom streaming":"shiny-chat-scroll-to-bottom",title:"Scroll to bottom","aria-label":"Scroll to bottom",onClick:()=>t(),children:(0,dS.jsx)("span",{dangerouslySetInnerHTML:{__html:KO}})})}var Zl=q(me(),1),En=q(ne(),1);function BL({url:e,onProceed:t,onAlways:n,onCancel:r}){let i=(0,Zl.useRef)(null),a=(0,Zl.useRef)(t);a.current=t;let o=(0,Zl.useRef)(r);return o.current=r,(0,Zl.useEffect)(()=>{let s=i.current;if(!s)return;try{s.showModal()}catch{a.current()}let l=c=>{c.target===s&&o.current()},u=()=>{o.current()};return s.addEventListener("click",l),s.addEventListener("cancel",u),()=>{s.removeEventListener("click",l),s.removeEventListener("cancel",u)}},[]),(0,En.jsx)("dialog",{ref:i,className:"shinychat-external-link-dialog",children:(0,En.jsx)("div",{className:"modal position-relative d-block fade show",children:(0,En.jsxs)("div",{className:"modal-content",children:[(0,En.jsxs)("div",{className:"modal-header",children:[(0,En.jsx)("h5",{className:"modal-title",children:"External Link"}),(0,En.jsx)("button",{className:"btn-close shinychat-btn-close","data-bs-dismiss":"modal","aria-label":"Close",onClick:r})]}),(0,En.jsxs)("div",{className:"modal-body",children:[(0,En.jsx)("p",{children:"This link will take you to an external website:"}),(0,En.jsx)("p",{className:"link-url text-break",children:e})]}),(0,En.jsxs)("div",{className:"modal-footer flex-wrap-reverse",children:[(0,En.jsx)("button",{className:"btn btn-sm btn-link shinychat-btn-always ps-0 me-auto",onClick:n,children:"Always open external links"}),(0,En.jsxs)("div",{className:"d-flex gap-2 justify-content-end",children:[(0,En.jsx)("button",{autoFocus:!0,className:"btn btn-sm btn-primary shinychat-btn-proceed",onClick:t,children:"Open Link"}),(0,En.jsx)("button",{className:"btn btn-sm btn-outline-danger shinychat-btn-cancel",onClick:r,children:"Cancel"})]})]})]})})})}var Jl=q(me(),1);var UL=q(ne(),1);function PL({source:e,className:t}){let n=(0,Jl.useRef)(null),r=(0,Jl.useContext)(Ma);return(0,Jl.useEffect)(()=>{let i=n.current;if(i){for(r&&r.unbindAll(e);e.firstChild;)i.appendChild(e.firstChild);return r&&r.bindAll(i),()=>{for(r&&r.unbindAll(i);i.firstChild;)e.appendChild(i.firstChild)}}},[e,r]),(0,UL.jsx)("div",{ref:n,className:t})}var Xe=q(me(),1);var oe=q(ne(),1),wW=300;function HL({isOpen:e,onClose:t,triggerRef:n,conversations:r,activeId:i,busy:a,onSelect:o,onNew:s,onRename:l,onDelete:u}){let[c,f]=(0,Xe.useState)(e),[d,h]=(0,Xe.useState)(!1),m=(0,Xe.useRef)(e);m.current=c;let b=Il(),[E,g]=(0,Xe.useState)(""),[y,T]=(0,Xe.useState)(null),[S,v]=(0,Xe.useState)(null),[x,M]=(0,Xe.useState)(null),R=(0,Xe.useRef)(null),L=(0,Xe.useRef)(null),A=(0,Xe.useCallback)(()=>{g(""),T(null),v(null),M(null),t()},[t]),H=(0,Xe.useCallback)(()=>{f(!1),h(!1),n.current?.focus({preventScroll:!0})},[n]);(0,Xe.useEffect)(()=>{e?(f(!0),h(!1)):m.current&&h(!0)},[e]),(0,Xe.useEffect)(()=>{if(!d)return;if(b){H();return}let B=setTimeout(H,wW);return()=>clearTimeout(B)},[d,b,H]),(0,Xe.useEffect)(()=>{if(!c||d)return;let B=R.current;if(!B)return;let K=F=>{if(F.key==="Escape"){if(x){M(null);return}if(y){T(null);return}A();return}if(F.key==="Tab"){let N=B.querySelectorAll('button:not([disabled]), input:not([disabled]), [tabindex]:not([tabindex="-1"])');if(N.length===0)return;let ae=N[0],ce=N[N.length-1],k=document.activeElement===B;F.shiftKey&&(document.activeElement===ae||k)?(F.preventDefault(),ce.focus()):!F.shiftKey&&document.activeElement===ce&&(F.preventDefault(),ae.focus())}};return document.addEventListener("keydown",K),()=>document.removeEventListener("keydown",K)},[c,d,x,y,A]),(0,Xe.useEffect)(()=>{c&&!d&&R.current?.focus({preventScroll:!0})},[c,d]),(0,Xe.useEffect)(()=>{if(!y)return;let B=K=>{K.target.closest(`[data-menu-id="${y}"]`)||T(null)};return document.addEventListener("pointerdown",B,!0),()=>document.removeEventListener("pointerdown",B,!0)},[y]);let Y=(0,Xe.useMemo)(()=>{let B=E.trim().toLowerCase();return B?r.filter(K=>K.title.toLowerCase().includes(B)):r},[r,E]),z=(0,Xe.useMemo)(()=>OW(Y),[Y]);function V(B){B.target===B.currentTarget&&d&&H()}function $(B){a||(o(B),A())}function D(){a||(s(),A())}return c?(0,oe.jsxs)("div",{ref:R,className:"shiny-chat-history","data-closing":d||void 0,role:"dialog","aria-modal":"true","aria-label":"Conversation history",tabIndex:-1,children:[(0,oe.jsx)("div",{className:"shiny-chat-history-scrim",onClick:A}),(0,oe.jsxs)("div",{className:"shiny-chat-history-drawer",onAnimationEnd:V,children:[(0,oe.jsxs)("div",{className:"shiny-chat-history-header",children:[(0,oe.jsx)("h2",{className:"shiny-chat-history-title",children:"History"}),(0,oe.jsx)("button",{type:"button",className:"shiny-chat-history-close","aria-label":"Close history",onClick:A,children:(0,oe.jsx)(FL,{})})]}),(0,oe.jsxs)("div",{className:"shiny-chat-history-toprow",children:[(0,oe.jsxs)("button",{type:"button",className:"shiny-chat-history-new",disabled:a,title:a?"Wait for the response to finish":void 0,"aria-label":"New conversation",onClick:D,children:[(0,oe.jsx)(DW,{}),"New"]}),(0,oe.jsxs)("span",{className:"shiny-chat-history-search-wrap",children:[(0,oe.jsx)("span",{className:"shiny-chat-history-search-icon",children:(0,oe.jsx)(IW,{})}),(0,oe.jsx)("input",{className:"shiny-chat-history-search form-control",ref:L,placeholder:"Search\u2026",value:E,onChange:B=>g(B.target.value),"aria-label":"Search conversations"})]})]}),(0,oe.jsxs)("div",{className:"shiny-chat-history-list",children:[Y.length===0&&(0,oe.jsx)("div",{className:"shiny-chat-history-empty",children:E.trim()?"No conversations found":"No conversations yet"}),z.map(([B,K])=>(0,oe.jsxs)(Xe.default.Fragment,{children:[(0,oe.jsx)("div",{className:"shiny-chat-history-section",children:B}),K.map(F=>(0,oe.jsx)(MW,{meta:F,active:F.id===i,busy:a,menuOpen:y===F.id,renaming:S===F.id,confirmingDelete:x===F.id,onToggleMenu:()=>T(y===F.id?null:F.id),onStartRename:()=>{v(F.id),T(null)},onStartDelete:()=>{M(F.id),T(null)},onCancelEdit:()=>{v(null),M(null)},onRename:N=>{l(F.id,N),v(null)},onDelete:()=>{u(F.id),M(null)},onSelect:()=>$(F.id)},F.id))]},B))]})]})]}):null}function MW({meta:e,active:t,busy:n,menuOpen:r,renaming:i,confirmingDelete:a,onToggleMenu:o,onStartRename:s,onStartDelete:l,onCancelEdit:u,onRename:c,onDelete:f,onSelect:d}){let[h,m]=(0,Xe.useState)(e.title);return(0,Xe.useEffect)(()=>{i||m(e.title)},[e.title,i]),i?(0,oe.jsx)("div",{className:"shiny-chat-history-item",children:(0,oe.jsx)("input",{className:"shiny-chat-history-rename-input form-control form-control-sm",autoFocus:!0,value:h,onChange:b=>m(b.target.value),onKeyDown:b=>{if(b.key==="Enter"){if(!h.trim())return;c(h);return}b.key==="Escape"&&(b.stopPropagation(),u())},onBlur:u,"aria-label":"Rename conversation"})}):(0,oe.jsxs)("div",{className:`shiny-chat-history-item${t?" active":""}`,children:[(0,oe.jsxs)("button",{type:"button",className:"shiny-chat-history-item-select",disabled:n,title:n?"Wait for the response to finish":void 0,onClick:d,children:[(0,oe.jsx)("span",{className:"shiny-chat-history-item-title",children:e.title}),(0,oe.jsx)("span",{className:"shiny-chat-history-item-time",children:RW(e.updated_at)})]}),a?(0,oe.jsxs)("span",{className:"shiny-chat-history-confirm",children:["Delete?",(0,oe.jsx)("button",{type:"button",className:"shiny-chat-history-confirm-yes",onClick:f,"aria-label":"Confirm delete",children:(0,oe.jsx)(LW,{})}),(0,oe.jsx)("button",{type:"button",className:"shiny-chat-history-confirm-no",onClick:u,"aria-label":"Cancel delete",children:(0,oe.jsx)(FL,{})})]}):(0,oe.jsxs)("span",{className:"shiny-chat-history-itemmenu","data-menu-id":e.id,children:[(0,oe.jsx)("button",{type:"button","aria-label":"Conversation actions",onClick:o,children:(0,oe.jsx)(BW,{})}),r&&(0,oe.jsxs)("span",{className:"shiny-chat-history-menu",children:[(0,oe.jsxs)("button",{type:"button",onClick:s,children:[(0,oe.jsx)(PW,{}),"Rename"]}),(0,oe.jsxs)("button",{type:"button",className:"shiny-chat-history-menu-danger",disabled:n,title:n?"Wait for the response to finish":void 0,onClick:l,children:[(0,oe.jsx)(UW,{}),"Delete"]})]})]})]})}function OW(e){let t=new Date;t.setHours(0,0,0,0);let n=new Date(t);n.setDate(n.getDate()-7);let r=[],i=[],a=[];for(let s of e){let l=new Date(s.updated_at);l>=t?r.push(s):l>=n?i.push(s):a.push(s)}let o=[];return r.length&&o.push(["Today",r]),i.length&&o.push(["Last 7 days",i]),a.length&&o.push(["Previous",a]),o}function RW(e){let t=new Date(e),n=new Date;return n.setHours(0,0,0,0),t>=n?t.toLocaleTimeString(void 0,{hour:"numeric",minute:"2-digit"}):t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}function zL(){return(0,oe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("path",{d:"M2.5 3v3h3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"M2.75 6A5.5 5.5 0 1 1 3 9.6",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"M8 5v3.2l2.2 1.3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})]})}function DW(){return(0,oe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("path",{d:"M8 2.5H3.5A1.5 1.5 0 0 0 2 4v8.5A1.5 1.5 0 0 0 3.5 14H12a1.5 1.5 0 0 0 1.5-1.5V8",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"M11.7 2.3a1.2 1.2 0 0 1 1.7 1.7L8 9.4l-2.3.6.6-2.3 5.4-5.4z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"})]})}function IW(){return(0,oe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("circle",{cx:"7",cy:"7",r:"4.5",stroke:"currentColor",strokeWidth:"1.5"}),(0,oe.jsx)("path",{d:"m10.5 10.5 3 3",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})}function FL(){return(0,oe.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,oe.jsx)("path",{d:"m4 4 8 8M12 4l-8 8",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})})}function LW(){return(0,oe.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,oe.jsx)("path",{d:"m3.5 8.5 3 3 6-7",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})})}function BW(){return(0,oe.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"currentColor","aria-hidden":"true",children:[(0,oe.jsx)("circle",{cx:"3.5",cy:"8",r:"1.35"}),(0,oe.jsx)("circle",{cx:"8",cy:"8",r:"1.35"}),(0,oe.jsx)("circle",{cx:"12.5",cy:"8",r:"1.35"})]})}function PW(){return(0,oe.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:[(0,oe.jsx)("path",{d:"M11.7 2.3a1.2 1.2 0 0 1 1.7 1.7l-8 8-2.8.9.9-2.8 8.2-8.2z",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round",strokeLinejoin:"round"}),(0,oe.jsx)("path",{d:"m10.5 3.5 2 2",stroke:"currentColor",strokeWidth:"1.4",strokeLinecap:"round"})]})}function UW(){return(0,oe.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 16 16",fill:"none","aria-hidden":"true",children:(0,oe.jsx)("path",{d:"M3 4.5h10M6.5 4.5V3a.8.8 0 0 1 .8-.8h1.4a.8.8 0 0 1 .8.8v1.5M4.5 4.5l.5 8a1 1 0 0 0 1 .95h4a1 1 0 0 0 1-.95l.5-8M6.75 7v3.75M9.25 7v3.75",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})}var qL=q(me(),1);function VL(e){(0,qL.useEffect)(()=>{let t=e.current?.closest("shiny-chat-container");if(!t?.hasAttribute("fill")||!t.classList.contains("html-fill-item"))return;let n=null,r="",i=t;for(;i.parentElement instanceof HTMLElement&&i.parentElement.classList.contains("html-fill-container")&&i.parentElement.children.length===1;){i=i.parentElement;let o=getComputedStyle(i).paddingLeft;if(parseFloat(o)>0){n=i,r=o;break}}if(!n)return;let a=n.style.padding;return n.style.padding="0",t.style.setProperty("--shiny-chat-fill-padding",r),()=>{n.style.padding=a,t.style.removeProperty("--shiny-chat-fill-padding")}},[e])}var Ym=q(me(),1);function GL(e,t){let n=(0,Ym.useRef)(t);n.current=t;let{enabled:r=!0,boundarySelector:i}=t;(0,Ym.useEffect)(()=>{if(!r)return;let a=e.current;if(!a)return;let o=a.closest(i);if(!o)return;let s=()=>{let{shiftProperty:h,side:m,gap:b=8,maxShiftFraction:E=1/3,shouldSkip:g}=n.current;if(g?.(o))return;let y=(typeof m=="function"?m(o):m)==="right";a.style.setProperty(h,"0px");let T=a.getBoundingClientRect();if(T.width===0||T.height===0)return;let S=y?T.right-1:T.left+1,v=[T.top+2,T.top+T.height/2,T.bottom-2],x=null;for(let L of v){let A=document.elementsFromPoint(S,L).find(z=>!o.contains(z)&&!z.contains(o));if(!A)continue;let H=A.getBoundingClientRect(),Y=y?H.left:H.right;x=x===null?Y:y?Math.min(x,Y):Math.max(x,Y)}if(x===null)return;let M=y?T.right-x+b:x-T.left+b;if(M<=0)return;let R=o.clientWidth*E;a.style.setProperty(h,`${Math.min(M,R)}px`)};s();let l=new ResizeObserver(s);l.observe(o),window.addEventListener("resize",s);let u=o.closest(".bslib-sidebar-layout");u?.addEventListener("transitionend",s);let c=u?new MutationObserver(s):null;c?.observe(u,{attributes:!0,attributeFilter:["class"]});let{watchMutations:f}=n.current,d=f?new MutationObserver(s):null;return d?.observe(o,f),()=>{l.disconnect(),window.removeEventListener("resize",s),u?.removeEventListener("transitionend",s),c?.disconnect(),d?.disconnect()}},[r,i,e])}var Bt=q(ne(),1);function hS(e){window.open(e,"_blank","noopener,noreferrer")}var KL=(0,st.forwardRef)(function({transport:t,messages:n,streamingMessage:r,inputDisabled:i,inputPlaceholder:a,iconAssistant:o,inputId:s,uploadAccept:l,maxUploadSize:u,elementId:c,greeting:f,cancelId:d,enableCancel:h,enableUpload:m,cancelRequested:b,footerEl:E,slashCommands:g,slashCommandId:y,submitKey:T,historyEnabled:S,historyConversations:v,historyActiveId:x,onEdit:M,onNavigate:R},L){let A=(0,st.useMemo)(()=>n.filter(X=>X.role==="user").map(X=>X.content),[n]),H=(0,st.useRef)(null),[Y,z]=(0,st.useState)(!1),V=(0,st.useRef)(null),[$,D]=(0,st.useState)(null),B=(0,st.useRef)(null);B.current=$;let{scrollRef:K,contentRef:F,scrollToBottom:N,stopScroll:ae}=dh({resize:"smooth"}),[ce,k]=(0,st.useState)(!0);(0,st.useEffect)(()=>{let X=K.current;if(!X)return;let Se=()=>{let O=X.scrollHeight-X.scrollTop-X.clientHeight;k(O<=1)};Se(),X.addEventListener("scroll",Se,{passive:!0});let Ne=new ResizeObserver(Se);Ne.observe(X);let gt=()=>{Array.from(X.children).forEach(O=>Ne.observe(O))};gt();let yn=new MutationObserver(()=>{gt(),Se()});return yn.observe(X,{childList:!0}),()=>{X.removeEventListener("scroll",Se),Ne.disconnect(),yn.disconnect()}},[K]);let Te=ch(),be=!!r,He=(0,st.useCallback)(()=>{!h||!d||!be||b||(Te({type:"CANCEL_REQUESTED"}),t.sendCancel(d))},[h,d,be,b,Te,t]),et=(0,st.useRef)(He);et.current=He,(0,st.useEffect)(()=>{if(!h)return;let X=K.current?.closest("shiny-chat-container");if(!X)return;let Se=Ne=>{Ne.defaultPrevented||Ne.key==="Escape"&&et.current()};return X.addEventListener("keydown",Se),()=>X.removeEventListener("keydown",Se)},[h,K]),VL(K),GL(V,{enabled:S,boundarySelector:"shiny-chat-container",shiftProperty:"--_history-trigger-shift",side:X=>X.getAttribute("data-history-placement")==="right"?"right":"left",shouldSkip:X=>!!X.querySelector(":scope > .shiny-chat-history"),watchMutations:{childList:!0}}),(0,st.useImperativeHandle)(L,()=>({setInputValue(...X){H.current?.setInputValue(...X)},focus(){H.current?.focus()}}));let Ee=(0,st.useCallback)(X=>{let Ne=X.target.closest("a[data-shinychat-link]");if(!Ne||!Ne.href)return;if(X.preventDefault(),Ne.origin===window.location.origin||window.shinychat_always_open_external_links){hS(Ne.href);return}if(typeof window.HTMLDialogElement>"u"){hS(Ne.href);return}D(Ne.href)},[]);function lt(X){if(!(X instanceof HTMLElement))return{};let Se=X.closest(".suggestion, [data-suggestion]");return Se instanceof HTMLElement?Se.classList.contains("suggestion")||Se.dataset.suggestion!==void 0?{suggestion:Se.dataset.suggestion||Se.textContent||void 0,submit:Se.classList.contains("submit")||Se.dataset.suggestionSubmit===""||Se.dataset.suggestionSubmit==="true"}:{}:{}}function Ve(X){let{suggestion:Se,submit:Ne}=lt(X.target);if(!Se)return;X.preventDefault();let gt=X.metaKey||X.ctrlKey?!0:X.altKey?!1:Ne;H.current?.setInputValue(Se,{submit:gt,focus:!gt});let yn=X.target.closest(".shiny-chat-suggestion-list-item"),O=yn?.closest(".shiny-chat-suggestion-list");yn&&O&&(O.querySelectorAll("[data-last-clicked]").forEach(P=>P.removeAttribute("data-last-clicked")),yn.setAttribute("data-last-clicked",""))}function St(X){Ve(X)}function Pt(X){Ee(X),St(X)}function wn(X){let Se=X.target.closest(".shiny-chat-suggestion-list-item");if(!Se)return;let Ne=Se.closest(".shiny-chat-suggestion-list");!Ne||Ne.dataset.roved!==void 0||(Ne.dataset.roved="",Ne.querySelectorAll(".shiny-chat-suggestion-list-item").forEach(gt=>{gt!==Se&&(gt.tabIndex=-1)}))}function qr(X){let Se=X.target.closest(".shiny-chat-suggestion-list-item");if(!Se)return;let Ne=Se.closest(".shiny-chat-suggestion-list");if(!Ne)return;let gt=X.relatedTarget,yn=gt?.closest(".shiny-chat-suggestion-list");(!gt||yn!==Ne)&&delete Ne.dataset.roved}function ee(X,Se,Ne){switch(Ne){case"ArrowDown":case"ArrowRight":return(X+1)%Se;case"ArrowUp":case"ArrowLeft":return(X-1+Se)%Se;case"Home":return 0;case"End":return Se-1;default:return null}}function se(X){let Ne=X.target.closest(".shiny-chat-suggestion-list-item"),gt=Ne?.closest(".shiny-chat-suggestion-list");if(Ne&>){let O=Array.from(gt.querySelectorAll(".shiny-chat-suggestion-list-item")),P=O.indexOf(Ne),J=ee(P,O.length,X.key);if(J!==null){X.preventDefault();let ie=O[P],ye=O[J];ie.tabIndex=-1,ye.tabIndex=0,ye.focus();return}}(X.key==="Enter"||X.key===" ")&&Ve(X)}let _t=(0,st.useCallback)(()=>{let X=B.current;X&&hS(X),D(null)},[]),ue=(0,st.useCallback)(()=>{window.shinychat_always_open_external_links=!0,_t()},[_t]),Wn=(0,st.useCallback)(()=>{D(null)},[]),$e=(0,st.useCallback)(()=>{N()},[N]);return(0,Bt.jsxs)(Fb.Provider,{value:g,children:[S&&(0,Bt.jsx)("button",{type:"button",ref:V,className:"shiny-chat-history-trigger","aria-label":"Conversation history","aria-expanded":Y,onClick:()=>z(X=>!X),children:(0,Bt.jsx)(zL,{})}),(0,Bt.jsxs)("div",{className:"shiny-chat-wrapper",children:[(0,Bt.jsxs)("div",{className:"shiny-chat-messages-wrapper",children:[(0,Bt.jsx)("div",{className:"shiny-chat-messages",ref:K,onClick:Pt,onFocus:wn,onBlur:qr,onKeyDown:se,children:(0,Bt.jsxs)(Ub.Provider,{value:ae,children:[f!=null&&(0,Bt.jsx)(DL,{greeting:f}),(0,Bt.jsxs)("div",{className:"shiny-chat-messages-content",ref:F,role:"log","aria-live":"polite",...f?.status==="dismissing"?{"data-greeting-dismissing":""}:{},children:[(0,Bt.jsx)(RL,{messages:n,iconAssistant:o,onEdit:S?M:void 0,onNavigate:S?R:void 0,disabled:be,inputId:s,submitKey:T,uploadAccept:l,maxUploadSize:u,enableUpload:m}),r&&(0,Bt.jsx)(Wl,{children:(0,Bt.jsx)(Vm,{message:r,index:n.length,iconAssistant:o})},r.id)]})]})}),(0,Bt.jsx)(LL,{isAtBottom:ce,scrollToBottom:N,streaming:!!r||!!f?.streaming})]}),(0,Bt.jsx)("div",{className:i?"shiny-chat-input disabled":"shiny-chat-input",onClick:Ee,children:(0,Bt.jsx)(IL,{ref:H,transport:t,inputId:s,uploadAccept:l,maxUploadSize:u,disabled:i,hasTopShadow:!ce,placeholder:a,onSend:$e,userMessages:A,enableCancel:h,enableUpload:m,cancelRequested:b,isStreaming:be,onCancel:He,slashCommands:g,slashCommandId:y,submitKey:T})}),E&&(0,Bt.jsx)(PL,{source:E,className:"shiny-chat-footer"})]}),S&&(0,Bt.jsx)(HL,{isOpen:Y,onClose:()=>z(!1),triggerRef:V,conversations:v??[],activeId:x??null,busy:be,onSelect:X=>{t.sendHistorySelect(c,X)},onNew:()=>t.sendHistoryNew(c),onRename:(X,Se)=>t.sendHistoryRename(c,X,Se),onDelete:X=>t.sendHistoryDelete(c,X)}),$&&(0,YL.createPortal)((0,Bt.jsx)(BL,{url:$,onProceed:_t,onAlways:ue,onCancel:Wn}),document.body)]})});var eu=q(ne(),1);function HW(e,t){let r=!(e.options.persistent===!0)&&t>0?"dismissed":"visible";return{content:e.content,contentType:e.contentType,streaming:!1,status:r,options:e.options,blocks:[{type:"content",content:e.content,contentType:e.contentType}]}}function $L({transport:e,shinyLifecycle:t,elementId:n,iconAssistant:r,inputId:i,cancelId:a,uploadAccept:o=[],maxUploadSize:s=null,placeholder:l,initialMessages:u,initialGreeting:c,enableCancel:f,enableUpload:d,footerEl:h,slashCommandId:m="",submitKey:b}){let E=u??[],[g,y]=(0,mt.useReducer)(bN,{...wa,inputPlaceholder:l??wa.inputPlaceholder,messages:E,greeting:c?HW(c,E.length):null,enableCancel:f??wa.enableCancel,enableCancelExplicit:f!==void 0,enableUpload:d??wa.enableUpload,enableUploadExplicit:d!==void 0}),T=(0,mt.useRef)(g);T.current=g;let S=(0,mt.useCallback)(()=>{e.sendMessagesSnapshot(n,Pb(T.current))},[e,n]);(0,mt.useEffect)(()=>{S()},[g.messages,S]);let v=(0,mt.useCallback)((D,B)=>{y({type:"INPUT_SENT",content:D,role:"user",...B.length>0?{attachments:B}:{}});let K=Pb(T.current);K.push({role:"user",segments:[{content:D,content_type:"markdown"}],...B.length>0?{attachments:B}:{}});let F=T.current.enableUpload;e.sendInput(i,F?{text:D,attachments:B}:D),e.sendMessagesSnapshot(n,K)},[y,e,i,n]),x=(0,mt.useRef)(null);(0,mt.useEffect)(()=>e.onMessage(n,B=>{if(B.type==="history_navigate"){Vb(n,B.active_id),AN(B.url,B.reload===!0);return}if(B.type==="update_input"){B.placeholder!==void 0&&y({type:"update_input",placeholder:B.placeholder}),B.value!==void 0||B.attachments!==void 0?x.current?.setInputValue(B.value,{submit:B.submit,focus:B.focus,attachments:B.attachments,attachmentMode:B.attachment_mode}):B.focus&&x.current?.focus();return}y(B)}),[e,n]);let[M,R]=(0,mt.useState)(!1);(0,mt.useEffect)(()=>{if(!n)return;let D=document.getElementById(n);if(!D)return;if(typeof IntersectionObserver>"u"){R(!0);return}let B=new IntersectionObserver(K=>R(K[0]?.isIntersecting??!1),{threshold:0});return B.observe(D),()=>B.disconnect()},[n]);let L=M&&g.messages.length===0&&g.greeting===null,A=(0,mt.useRef)(!1);(0,mt.useEffect)(()=>{if(!L){A.current=!1;return}A.current||window.Shiny?.setInputValue&&(A.current=!0,window.Shiny.setInputValue(`${n}_greeting_requested`,Date.now(),{priority:"event"}))},[L,n]);let H=g.greeting?.status==="dismissed",Y=(0,mt.useRef)(!1);(0,mt.useEffect)(()=>{window.Shiny?.setInputValue&&(H&&!Y.current?(Y.current=!0,window.Shiny.setInputValue(`${n}_greeting_dismissed`,Date.now(),{priority:"event"})):!H&&Y.current&&(Y.current=!1,window.Shiny.setInputValue(`${n}_greeting_dismissed`,null)))},[H,n]),(0,mt.useEffect)(()=>{g.history.enabled&&Vb(n,g.history.activeId)},[n,g.history.enabled,g.history.activeId]);let z=(0,mt.useCallback)((D,B,K)=>{e.sendMessageEdit(n,D,B,K)},[e,n]),V=(0,mt.useCallback)((D,B)=>{e.sendMessageNavigate(n,D,B)},[e,n]),$=(0,mt.useMemo)(()=>({hiddenToolRequests:g.hiddenToolRequests}),[g.hiddenToolRequests]);return(0,eu.jsx)(Ma.Provider,{value:t,children:(0,eu.jsx)(Hb.Provider,{value:$,children:(0,eu.jsx)(No.Provider,{value:y,children:(0,eu.jsx)(zb.Provider,{value:v,children:(0,eu.jsx)(KL,{ref:x,transport:e,messages:g.messages,streamingMessage:g.streamingMessage,inputDisabled:g.inputDisabled,inputPlaceholder:g.inputPlaceholder,iconAssistant:r,inputId:i,uploadAccept:o,maxUploadSize:s,elementId:n,greeting:g.greeting,cancelId:a,enableCancel:g.enableCancel,enableUpload:g.enableUpload,cancelRequested:g.cancelRequested,footerEl:h,slashCommands:g.slashCommands,slashCommandId:m,submitKey:b,historyEnabled:g.history.enabled,historyConversations:g.history.conversations,historyActiveId:g.history.activeId,onEdit:z,onNavigate:V})})})})})}function jL(e){if(!e||typeof e!="object")return!1;let t=e;return!(typeof t.id!="string"||!t.action||typeof t.action!="object"||typeof t.action.type!="string")}function Km(){return window.__shinyChatTransport||(window.__shinyChatTransport=new pS),window.__shinyChatTransport}var pS=class{listeners=new Map;pendingMessages=new Map;inputSeq=0;constructor(){window.Shiny?.addCustomMessageHandler("shinyChatMessage",async t=>{if(!jL(t)){console.warn("[shinychat] Malformed shinyChatMessage envelope, dropping:",JSON.stringify(t));return}let{id:n,action:r,html_deps:i}=t;i&&Array.isArray(i)&&(await this.renderDependencies(i),(r.type==="message"||r.type==="chunk_start"||r.type==="chunk")&&(r.html_deps=i));let a=this.listeners.get(n);if(!a||a.size===0){this.pendingMessages.has(n)||this.pendingMessages.set(n,[]),this.pendingMessages.get(n).push(r);return}for(let o of a)o(r)})}sendInput(t,n){if(!window.Shiny?.setInputValue)return;let r=typeof n=="string"?{text:n,attachments:[]}:n;this.inputSeq+=1,window.Shiny.setInputValue(`${t}:shinychat.userInput`,{...r,seq:this.inputSeq})}sendCancel(t){window.Shiny?.setInputValue&&window.Shiny.setInputValue(t,Date.now(),{priority:"event"})}sendSlashCommand(t,n,r,i){window.Shiny?.setInputValue&&window.Shiny.setInputValue(t,{command:n,userText:r,echo:i},{priority:"event"})}sendMessagesSnapshot(t,n){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_messages:shinychat.messages`,n)}sendHistorySelect(t,n){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_select`,{id:n,ts:Date.now()},{priority:"event"})}sendHistoryNew(t){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_new`,Date.now(),{priority:"event"})}sendHistoryRename(t,n,r){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_rename`,{id:n,title:r,ts:Date.now()},{priority:"event"})}sendHistoryDelete(t,n){window.Shiny?.setInputValue&&window.Shiny.setInputValue(`${t}_history_delete`,{id:n,ts:Date.now()},{priority:"event"})}sendMessageEdit(t,n,r,i=[]){window.Shiny?.setInputValue?.(`${t}_message_edit`,{index:n,content:r,attachments:i,ts:Date.now()})}sendMessageNavigate(t,n,r){window.Shiny?.setInputValue?.(`${t}_message_navigate`,{index:n,direction:r,ts:Date.now()})}onMessage(t,n){this.listeners.has(t)||this.listeners.set(t,new Set),this.listeners.get(t).add(n);let r=this.pendingMessages.get(t);if(r&&r.length>0){this.pendingMessages.delete(t);for(let i of r)n(i)}return()=>{this.listeners.get(t)?.delete(n)}}async renderDependencies(t){if(window.Shiny&&t)try{await window.Shiny.renderDependenciesAsync(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to render HTML dependencies: ${n}`})}}async bindAll(t){if(window?.Shiny?.initializeInputs&&window?.Shiny?.bindAll){try{window.Shiny.initializeInputs(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to initialize Shiny inputs: ${n}`})}try{await window.Shiny.bindAll(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to bind Shiny inputs/outputs: ${n}`})}}}unbindAll(t){if(window?.Shiny?.unbindAll)try{window.Shiny.unbindAll(t)}catch(n){this.showClientMessage({status:"error",message:`Failed to unbind Shiny inputs/outputs: ${n}`})}}showClientMessage(t){document.dispatchEvent(new CustomEvent("shiny:client-message",{detail:{headline:t.headline??"",message:t.message,status:t.status??"warning"}}))}};var $m=Km(),XL="shinychat-browser-token",mS=null;function zW(){try{let e=window.localStorage.getItem(XL);return e||(e=crypto.randomUUID(),window.localStorage.setItem(XL,e)),e}catch{return mS||(mS=crypto.randomUUID()),mS}}var FW="shiny-chat-input",qW="shiny-chat-message",VW="shiny-chat-footer";function GW(e){let t=e.querySelectorAll(qW),n=[];return t.forEach(r=>{let i=r.getAttribute("content")??"",a=r.getAttribute("data-role")??"assistant",o=r.getAttribute("content-type")??"markdown",s=r.getAttribute("icon")??void 0;n.push({id:Sr(),role:a,content:i,streaming:!1,icon:s,blocks:[{type:"content",content:i,contentType:o}],fromMarkup:!0})}),n}function YW(e){let t=e.getAttribute("greeting");if(t)try{let n=JSON.parse(t);return n.content?{content:n.content,contentType:n.content_type??"markdown",options:n.options??{}}:void 0}catch{return}}var gS=class extends HTMLElement{reactRoot=null;footerEl=null;pendingUnmount=null;connectedCallback(){if(this.pendingUnmount!==null&&(clearTimeout(this.pendingUnmount),this.pendingUnmount=null),this.reactRoot)return;let t=this.getAttribute("id")??"",n=this.getAttribute("icon-assistant")??void 0,r=this.getAttribute("enable-cancel"),i=r===null?void 0:r!=="false",a=this.getAttribute("allow-attachments"),o=a===null?void 0:a!=="false",s=this.querySelector(FW),l=s?.getAttribute("placeholder")??void 0,u=s?.getAttribute("id")??`${t}_user_input`,c=`${t}_cancel`,f=this.getAttribute("attachment-accept"),d=f?f.split(",").map(v=>v.trim()):cR,h=this.getAttribute("max-attachment-size"),m=h?parseInt(h,10):NaN,b=Number.isFinite(m)?m:null,E=GW(this);this.footerEl||(this.footerEl=this.querySelector(VW),this.footerEl?.remove());let g=YW(this),T=this.getAttribute("submit-key")==="enter+modifier"?"enter+modifier":"enter",S=`${t}_slash_command`;$m.unbindAll(this),window.Shiny?.initializedPromise.then(()=>{window.Shiny?.setInputValue?.(`${t}_history_browser_token`,zW()),window.Shiny?.setInputValue?.(`${t}_history_current_id`,xN(t)??""),window.Shiny?.setInputValue?.(`${t}_history_url_id`,_N()??"")}),this.reactRoot=(0,WL.createRoot)(this),this.reactRoot.render((0,QL.createElement)($L,{transport:$m,shinyLifecycle:$m,elementId:t,iconAssistant:n,inputId:u,cancelId:c,uploadAccept:d,maxUploadSize:b,placeholder:l,initialMessages:E,initialGreeting:g,enableCancel:i,enableUpload:o,footerEl:this.footerEl??void 0,slashCommandId:S,submitKey:T}))}disconnectedCallback(){this.pendingUnmount=setTimeout(()=>{$m.unbindAll(this),this.reactRoot?.unmount(),this.reactRoot=null,this.pendingUnmount=null},0)}};customElements.get("shiny-chat-container")||customElements.define("shiny-chat-container",gS);var n6=q(oh(),1),ES=q(me(),1);var Qt=q(me(),1);var Xn=q(me(),1);function ZL({streaming:e,contentDependency:t,bottomTolerance:n=10,scrollOnContentChange:r=!1}){let i=(0,Xn.useRef)(null),[a,o]=(0,Xn.useState)(!0),s=(0,Xn.useRef)(0),l=(0,Xn.useCallback)(()=>{let m=i.current;if(!m)return;let{scrollTop:b,scrollHeight:E,clientHeight:g}=m,y=b+g>=E-n,T=b{u.current()}),f=(0,Xn.useCallback)(m=>{i.current&&i.current.removeEventListener("scroll",c.current),i.current=m,m&&(s.current=m.scrollTop,m.addEventListener("scroll",c.current,{passive:!0}))},[]);(0,Xn.useEffect)(()=>{(e||r)&&a&&i.current&&i.current.scrollTo({top:i.current.scrollHeight,behavior:"smooth"})},[e,a,t,r]);let d=(0,Xn.useCallback)(()=>{o(!0),i.current?.scrollTo({top:i.current.scrollHeight,behavior:"smooth"})},[]),h=(0,Xn.useCallback)(()=>{o(!0)},[]);return{containerRef:f,stickToBottom:a,scrollToBottom:d,engageStickToBottom:h}}function JL(e,t){let n=e.parentElement,r=t?.toLowerCase();for(;n&&!(r&&n.tagName.toLowerCase()===r);){let i=getComputedStyle(n),a=i.overflowY!=="hidden"&&i.overflowY!=="clip",o=n.scrollHeight>n.clientHeight;if(a&&o)return n;n=n.parentElement}return null}var bS=q(ne(),1),KW="shiny-chat-container";function e6({initialContent:e="",initialContentType:t="markdown",initialStreaming:n=!1,autoScroll:r=!1,onApiReady:i}){let[a,o]=(0,Qt.useState)(e),[s,l]=(0,Qt.useState)(t),[u,c]=(0,Qt.useState)(n),f=(0,Qt.useRef)(null),d=(0,Qt.useRef)(null),{containerRef:h,scrollToBottom:m}=ZL({streaming:r&&u,contentDependency:a});(0,Qt.useLayoutEffect)(()=>{if(!r||!f.current){d.current&&(h(null),d.current=null);return}let y=JL(f.current,KW);y!==d.current&&(h(y),d.current=y)},[r,a,h]),(0,Qt.useEffect)(()=>()=>{d.current&&(h(null),d.current=null)},[h]),(0,Qt.useEffect)(()=>{u&&r&&m()},[u,r,m]);let b=(0,Qt.useCallback)(y=>{o(T=>T+y)},[]),E=(0,Qt.useCallback)(y=>{o(y)},[]),g=(0,Qt.useMemo)(()=>({appendContent:b,replaceContent:E,setStreaming:c,setContentType:l}),[b,E]);return(0,Qt.useEffect)(()=>{i?.(g)},[g,i]),(0,bS.jsx)("div",{ref:f,children:(0,bS.jsx)($t,{content:a,contentType:s,streaming:u})})}var yS=Km();function r6(e){return"isStreaming"in e}var TS=class extends HTMLElement{reactRoot=null;api=null;pendingMessages=[];pendingUnmount=null;connectedCallback(){if(this.pendingUnmount!==null&&(clearTimeout(this.pendingUnmount),this.pendingUnmount=null),this.reactRoot)return;this.reactRoot=(0,n6.createRoot)(this);let t=this.getAttribute("content")??"",n=this.getAttribute("content-type")??"markdown",r=t6(this,"streaming"),i=t6(this,"auto-scroll");this.reactRoot.render((0,ES.createElement)(Ma.Provider,{value:yS},(0,ES.createElement)(e6,{initialContent:t,initialContentType:n,initialStreaming:r,autoScroll:i,onApiReady:a=>{this.api=a;for(let o of this.pendingMessages)this.dispatchMessage(o);this.pendingMessages=[]}})))}disconnectedCallback(){this.pendingUnmount=setTimeout(()=>{this.reactRoot?.unmount(),this.reactRoot=null,this.api=null,this.pendingMessages=[],this.pendingUnmount=null},0)}handleMessage(t){if(!this.api){this.pendingMessages.push(t);return}this.dispatchMessage(t)}dispatchMessage(t){if(r6(t)){this.api.setStreaming(t.isStreaming);return}t.operation==="replace"?this.api.replaceContent(t.content):t.operation==="append"&&this.api.appendContent(t.content)}};function $W(e){return e.replace(/-([a-z])/g,(t,n)=>n.toUpperCase())}function t6(e,t){let n=e.getAttribute(t);if(n===""||n==="true")return!0;if(n==="false")return!1;let r=$W(t),i=e[r];return i===!0||i==="true"}customElements.get("shiny-markdown-stream")||customElements.define("shiny-markdown-stream",TS);window.Shiny?.addCustomMessageHandler("shinyMarkdownStreamMessage",async e=>{let t=document.getElementById(e.id);if(!t){yS.showClientMessage({status:"error",message:`Unable to handle MarkdownStream() message since element with id ${e.id} wasn't found.`});return}!r6(e)&&e.html_deps&&await yS.renderDependencies(e.html_deps),t.handleMessage(e)}); /*! Bundled license information: scheduler/cjs/scheduler.production.js: diff --git a/js/dist/shinychat.js.map b/js/dist/shinychat.js.map index 3f7de6498..0ae83f2fd 100644 --- a/js/dist/shinychat.js.map +++ b/js/dist/shinychat.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../node_modules/scheduler/cjs/scheduler.production.js", "../node_modules/scheduler/index.js", "../node_modules/react/cjs/react.production.js", "../node_modules/react/index.js", "../node_modules/react-dom/cjs/react-dom.production.js", "../node_modules/react-dom/index.js", "../node_modules/react-dom/cjs/react-dom-client.production.js", "../node_modules/react-dom/client.js", "../node_modules/inline-style-parser/index.js", "../node_modules/style-to-object/src/index.ts", "../node_modules/style-to-js/src/utilities.ts", "../node_modules/style-to-js/src/index.ts", "../node_modules/react/cjs/react-jsx-runtime.production.js", "../node_modules/react/jsx-runtime.js", "../node_modules/extend/index.js", "../node_modules/highlight.js/lib/core.js", "../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js", "../node_modules/use-sync-external-store/shim/index.js", "../node_modules/use-sync-external-store/cjs/use-sync-external-store-shim/with-selector.production.js", "../node_modules/use-sync-external-store/shim/with-selector.js", "../src/chat/chat-entry.ts", "../src/chat/ChatApp.tsx", "../src/chat/context.ts", "../src/utils/uuid.ts", "../src/chat/state.ts", "../src/chat/currentConversation.ts", "../src/utils/navigate.ts", "../src/chat/ChatContainer.tsx", "../node_modules/use-stick-to-bottom/dist/useStickToBottom.js", "../src/chat/ChatMessages.tsx", "../src/chat/ChatMessage.tsx", "../src/markdown/MarkdownContent.tsx", "../node_modules/html-void-elements/index.js", "../node_modules/property-information/lib/util/schema.js", "../node_modules/property-information/lib/util/merge.js", "../node_modules/property-information/lib/normalize.js", "../node_modules/property-information/lib/util/info.js", "../node_modules/property-information/lib/util/types.js", "../node_modules/property-information/lib/util/defined-info.js", "../node_modules/property-information/lib/util/create.js", "../node_modules/property-information/lib/aria.js", "../node_modules/property-information/lib/util/case-sensitive-transform.js", "../node_modules/property-information/lib/util/case-insensitive-transform.js", "../node_modules/property-information/lib/html.js", "../node_modules/property-information/lib/svg.js", "../node_modules/property-information/lib/xlink.js", "../node_modules/property-information/lib/xmlns.js", "../node_modules/property-information/lib/xml.js", "../node_modules/property-information/lib/hast-to-react.js", "../node_modules/property-information/lib/find.js", "../node_modules/property-information/index.js", "../node_modules/zwitch/index.js", "../node_modules/stringify-entities/lib/core.js", "../node_modules/stringify-entities/lib/util/to-hexadecimal.js", "../node_modules/stringify-entities/lib/util/to-decimal.js", "../node_modules/character-entities-legacy/index.js", "../node_modules/character-entities-html4/index.js", "../node_modules/stringify-entities/lib/constant/dangerous.js", "../node_modules/stringify-entities/lib/util/to-named.js", "../node_modules/stringify-entities/lib/util/format-smart.js", "../node_modules/stringify-entities/lib/index.js", "../node_modules/hast-util-to-html/lib/handle/comment.js", "../node_modules/hast-util-to-html/lib/handle/doctype.js", "../node_modules/ccount/index.js", "../node_modules/comma-separated-tokens/index.js", "../node_modules/space-separated-tokens/index.js", "../node_modules/hast-util-whitespace/lib/index.js", "../node_modules/hast-util-to-html/lib/omission/util/siblings.js", "../node_modules/hast-util-to-html/lib/omission/omission.js", "../node_modules/hast-util-to-html/lib/omission/closing.js", "../node_modules/hast-util-to-html/lib/omission/opening.js", "../node_modules/hast-util-to-html/lib/handle/element.js", "../node_modules/hast-util-to-html/lib/handle/text.js", "../node_modules/hast-util-to-html/lib/handle/raw.js", "../node_modules/hast-util-to-html/lib/handle/root.js", "../node_modules/hast-util-to-html/lib/handle/index.js", "../node_modules/hast-util-to-html/lib/index.js", "../node_modules/estree-util-is-identifier-name/lib/index.js", "../node_modules/hast-util-to-jsx-runtime/lib/index.js", "../node_modules/unist-util-position/lib/index.js", "../node_modules/unist-util-stringify-position/lib/index.js", "../node_modules/vfile-message/lib/index.js", "../node_modules/hast-util-parse-selector/lib/index.js", "../node_modules/hastscript/lib/create-h.js", "../node_modules/hastscript/lib/svg-case-sensitive-tag-names.js", "../node_modules/hastscript/lib/index.js", "../node_modules/vfile-location/lib/index.js", "../node_modules/web-namespaces/index.js", "../node_modules/hast-util-from-parse5/lib/index.js", "../src/markdown/markdownToReact.ts", "../node_modules/parse5/dist/common/unicode.js", "../node_modules/parse5/dist/common/error-codes.js", "../node_modules/parse5/dist/tokenizer/preprocessor.js", "../node_modules/parse5/dist/common/token.js", "../node_modules/entities/src/generated/decode-data-html.ts", "../node_modules/entities/src/decode-codepoint.ts", "../node_modules/entities/src/decode.ts", "../node_modules/parse5/dist/common/html.js", "../node_modules/parse5/dist/tokenizer/index.js", "../node_modules/parse5/dist/parser/open-element-stack.js", "../node_modules/parse5/dist/parser/formatting-element-list.js", "../node_modules/parse5/dist/tree-adapters/default.js", "../node_modules/parse5/dist/common/doctype.js", "../node_modules/parse5/dist/common/foreign-content.js", "../node_modules/parse5/dist/parser/index.js", "../node_modules/entities/src/escape.ts", "../node_modules/parse5/dist/serializer/index.js", "../node_modules/parse5/dist/index.js", "../node_modules/vfile/lib/minpath.browser.js", "../node_modules/vfile/lib/minproc.browser.js", "../node_modules/vfile/lib/minurl.shared.js", "../node_modules/vfile/lib/minurl.browser.js", "../node_modules/vfile/lib/index.js", "../node_modules/unist-util-is/lib/index.js", "../node_modules/unist-util-visit-parents/lib/index.js", "../node_modules/unist-util-visit/lib/index.js", "../src/markdown/urlSanitize.ts", "../src/markdown/plugins/suggestionHelpers.ts", "../src/markdown/streamingDot.ts", "../src/markdown/plugins/rehypeSuggestionCards.ts", "../node_modules/bail/index.js", "../node_modules/unified/lib/index.js", "../node_modules/is-plain-obj/index.js", "../node_modules/trough/lib/index.js", "../node_modules/unified/lib/callable-instance.js", "../node_modules/mdast-util-to-string/lib/index.js", "../node_modules/decode-named-character-reference/index.dom.js", "../node_modules/micromark-util-chunked/index.js", "../node_modules/micromark-util-combine-extensions/index.js", "../node_modules/micromark-util-decode-numeric-character-reference/index.js", "../node_modules/micromark-util-normalize-identifier/index.js", "../node_modules/micromark-util-character/index.js", "../node_modules/micromark-util-sanitize-uri/index.js", "../node_modules/micromark-factory-space/index.js", "../node_modules/micromark/lib/initialize/content.js", "../node_modules/micromark/lib/initialize/document.js", "../node_modules/micromark-util-classify-character/index.js", "../node_modules/micromark-util-resolve-all/index.js", "../node_modules/micromark-core-commonmark/lib/attention.js", "../node_modules/micromark-core-commonmark/lib/autolink.js", "../node_modules/micromark-core-commonmark/lib/blank-line.js", "../node_modules/micromark-core-commonmark/lib/block-quote.js", "../node_modules/micromark-core-commonmark/lib/character-escape.js", "../node_modules/micromark-core-commonmark/lib/character-reference.js", "../node_modules/micromark-core-commonmark/lib/code-fenced.js", "../node_modules/micromark-core-commonmark/lib/code-indented.js", "../node_modules/micromark-core-commonmark/lib/code-text.js", "../node_modules/micromark-util-subtokenize/lib/splice-buffer.js", "../node_modules/micromark-util-subtokenize/index.js", "../node_modules/micromark-core-commonmark/lib/content.js", "../node_modules/micromark-factory-destination/index.js", "../node_modules/micromark-factory-label/index.js", "../node_modules/micromark-factory-title/index.js", "../node_modules/micromark-factory-whitespace/index.js", "../node_modules/micromark-core-commonmark/lib/definition.js", "../node_modules/micromark-core-commonmark/lib/hard-break-escape.js", "../node_modules/micromark-core-commonmark/lib/heading-atx.js", "../node_modules/micromark-util-html-tag-name/index.js", "../node_modules/micromark-core-commonmark/lib/html-flow.js", "../node_modules/micromark-core-commonmark/lib/html-text.js", "../node_modules/micromark-core-commonmark/lib/label-end.js", "../node_modules/micromark-core-commonmark/lib/label-start-image.js", "../node_modules/micromark-core-commonmark/lib/label-start-link.js", "../node_modules/micromark-core-commonmark/lib/line-ending.js", "../node_modules/micromark-core-commonmark/lib/thematic-break.js", "../node_modules/micromark-core-commonmark/lib/list.js", "../node_modules/micromark-core-commonmark/lib/setext-underline.js", "../node_modules/micromark/lib/initialize/flow.js", "../node_modules/micromark/lib/initialize/text.js", "../node_modules/micromark/lib/constructs.js", "../node_modules/micromark/lib/create-tokenizer.js", "../node_modules/micromark/lib/parse.js", "../node_modules/micromark/lib/postprocess.js", "../node_modules/micromark/lib/preprocess.js", "../node_modules/micromark-util-decode-string/index.js", "../node_modules/mdast-util-from-markdown/lib/index.js", "../node_modules/remark-parse/lib/index.js", "../node_modules/mdast-util-find-and-replace/node_modules/escape-string-regexp/index.js", "../node_modules/mdast-util-find-and-replace/lib/index.js", "../node_modules/mdast-util-gfm-autolink-literal/lib/index.js", "../node_modules/mdast-util-gfm-footnote/lib/index.js", "../node_modules/mdast-util-gfm-strikethrough/lib/index.js", "../node_modules/markdown-table/index.js", "../node_modules/mdast-util-to-markdown/lib/handle/blockquote.js", "../node_modules/mdast-util-to-markdown/lib/util/pattern-in-scope.js", "../node_modules/mdast-util-to-markdown/lib/handle/break.js", "../node_modules/longest-streak/index.js", "../node_modules/mdast-util-to-markdown/lib/util/format-code-as-indented.js", "../node_modules/mdast-util-to-markdown/lib/util/check-fence.js", "../node_modules/mdast-util-to-markdown/lib/handle/code.js", "../node_modules/mdast-util-to-markdown/lib/util/check-quote.js", "../node_modules/mdast-util-to-markdown/lib/handle/definition.js", "../node_modules/mdast-util-to-markdown/lib/util/check-emphasis.js", "../node_modules/mdast-util-to-markdown/lib/util/encode-character-reference.js", "../node_modules/mdast-util-to-markdown/lib/util/encode-info.js", "../node_modules/mdast-util-to-markdown/lib/handle/emphasis.js", "../node_modules/mdast-util-to-markdown/lib/util/format-heading-as-setext.js", "../node_modules/mdast-util-to-markdown/lib/handle/heading.js", "../node_modules/mdast-util-to-markdown/lib/handle/html.js", "../node_modules/mdast-util-to-markdown/lib/handle/image.js", "../node_modules/mdast-util-to-markdown/lib/handle/image-reference.js", "../node_modules/mdast-util-to-markdown/lib/handle/inline-code.js", "../node_modules/mdast-util-to-markdown/lib/util/format-link-as-autolink.js", "../node_modules/mdast-util-to-markdown/lib/handle/link.js", "../node_modules/mdast-util-to-markdown/lib/handle/link-reference.js", "../node_modules/mdast-util-to-markdown/lib/util/check-bullet.js", "../node_modules/mdast-util-to-markdown/lib/util/check-bullet-other.js", "../node_modules/mdast-util-to-markdown/lib/util/check-bullet-ordered.js", "../node_modules/mdast-util-to-markdown/lib/util/check-rule.js", "../node_modules/mdast-util-to-markdown/lib/handle/list.js", "../node_modules/mdast-util-to-markdown/lib/util/check-list-item-indent.js", "../node_modules/mdast-util-to-markdown/lib/handle/list-item.js", "../node_modules/mdast-util-to-markdown/lib/handle/paragraph.js", "../node_modules/mdast-util-phrasing/lib/index.js", "../node_modules/mdast-util-to-markdown/lib/handle/root.js", "../node_modules/mdast-util-to-markdown/lib/util/check-strong.js", "../node_modules/mdast-util-to-markdown/lib/handle/strong.js", "../node_modules/mdast-util-to-markdown/lib/handle/text.js", "../node_modules/mdast-util-to-markdown/lib/util/check-rule-repetition.js", "../node_modules/mdast-util-to-markdown/lib/handle/thematic-break.js", "../node_modules/mdast-util-to-markdown/lib/handle/index.js", "../node_modules/mdast-util-gfm-table/lib/index.js", "../node_modules/mdast-util-gfm-task-list-item/lib/index.js", "../node_modules/mdast-util-gfm/lib/index.js", "../node_modules/micromark-extension-gfm-autolink-literal/lib/syntax.js", "../node_modules/micromark-extension-gfm-footnote/lib/syntax.js", "../node_modules/micromark-extension-gfm-strikethrough/lib/syntax.js", "../node_modules/micromark-extension-gfm-table/lib/edit-map.js", "../node_modules/micromark-extension-gfm-table/lib/infer.js", "../node_modules/micromark-extension-gfm-table/lib/syntax.js", "../node_modules/micromark-extension-gfm-task-list-item/lib/syntax.js", "../node_modules/micromark-extension-gfm/index.js", "../node_modules/remark-gfm/lib/index.js", "../node_modules/mdast-util-to-hast/lib/handlers/blockquote.js", "../node_modules/mdast-util-to-hast/lib/handlers/break.js", "../node_modules/mdast-util-to-hast/lib/handlers/code.js", "../node_modules/mdast-util-to-hast/lib/handlers/delete.js", "../node_modules/mdast-util-to-hast/lib/handlers/emphasis.js", "../node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js", "../node_modules/mdast-util-to-hast/lib/handlers/heading.js", "../node_modules/mdast-util-to-hast/lib/handlers/html.js", "../node_modules/mdast-util-to-hast/lib/revert.js", "../node_modules/mdast-util-to-hast/lib/handlers/image-reference.js", "../node_modules/mdast-util-to-hast/lib/handlers/image.js", "../node_modules/mdast-util-to-hast/lib/handlers/inline-code.js", "../node_modules/mdast-util-to-hast/lib/handlers/link-reference.js", "../node_modules/mdast-util-to-hast/lib/handlers/link.js", "../node_modules/mdast-util-to-hast/lib/handlers/list-item.js", "../node_modules/mdast-util-to-hast/lib/handlers/list.js", "../node_modules/mdast-util-to-hast/lib/handlers/paragraph.js", "../node_modules/mdast-util-to-hast/lib/handlers/root.js", "../node_modules/mdast-util-to-hast/lib/handlers/strong.js", "../node_modules/mdast-util-to-hast/lib/handlers/table.js", "../node_modules/mdast-util-to-hast/lib/handlers/table-row.js", "../node_modules/mdast-util-to-hast/lib/handlers/table-cell.js", "../node_modules/trim-lines/index.js", "../node_modules/mdast-util-to-hast/lib/handlers/text.js", "../node_modules/mdast-util-to-hast/lib/handlers/thematic-break.js", "../node_modules/mdast-util-to-hast/lib/handlers/index.js", "../node_modules/@ungap/structured-clone/esm/deserialize.js", "../node_modules/@ungap/structured-clone/esm/serialize.js", "../node_modules/@ungap/structured-clone/esm/index.js", "../node_modules/mdast-util-to-hast/lib/footer.js", "../node_modules/mdast-util-to-hast/lib/state.js", "../node_modules/mdast-util-to-hast/lib/index.js", "../node_modules/remark-rehype/lib/index.js", "../node_modules/hast-util-to-parse5/lib/index.js", "../node_modules/hast-util-raw/lib/index.js", "../node_modules/rehype-raw/lib/index.js", "../node_modules/hast-util-sanitize/lib/schema.js", "../node_modules/hast-util-sanitize/lib/index.js", "../node_modules/rehype-sanitize/lib/index.js", "../node_modules/unist-util-find-after/lib/index.js", "../node_modules/hast-util-is-element/lib/index.js", "../node_modules/hast-util-to-text/lib/index.js", "../node_modules/highlight.js/es/languages/arduino.js", "../node_modules/highlight.js/es/languages/bash.js", "../node_modules/highlight.js/es/languages/c.js", "../node_modules/highlight.js/es/languages/cpp.js", "../node_modules/highlight.js/es/languages/csharp.js", "../node_modules/highlight.js/es/languages/css.js", "../node_modules/highlight.js/es/languages/diff.js", "../node_modules/highlight.js/es/languages/go.js", "../node_modules/highlight.js/es/languages/graphql.js", "../node_modules/highlight.js/es/languages/ini.js", "../node_modules/highlight.js/es/languages/java.js", "../node_modules/highlight.js/es/languages/javascript.js", "../node_modules/highlight.js/es/languages/json.js", "../node_modules/highlight.js/es/languages/kotlin.js", "../node_modules/highlight.js/es/languages/less.js", "../node_modules/highlight.js/es/languages/lua.js", "../node_modules/highlight.js/es/languages/makefile.js", "../node_modules/highlight.js/es/languages/markdown.js", "../node_modules/highlight.js/es/languages/objectivec.js", "../node_modules/highlight.js/es/languages/perl.js", "../node_modules/highlight.js/es/languages/php.js", "../node_modules/highlight.js/es/languages/php-template.js", "../node_modules/highlight.js/es/languages/plaintext.js", "../node_modules/highlight.js/es/languages/python.js", "../node_modules/highlight.js/es/languages/python-repl.js", "../node_modules/highlight.js/es/languages/r.js", "../node_modules/highlight.js/es/languages/ruby.js", "../node_modules/highlight.js/es/languages/rust.js", "../node_modules/highlight.js/es/languages/scss.js", "../node_modules/highlight.js/es/languages/shell.js", "../node_modules/highlight.js/es/languages/sql.js", "../node_modules/highlight.js/es/languages/swift.js", "../node_modules/highlight.js/es/languages/typescript.js", "../node_modules/highlight.js/es/languages/vbnet.js", "../node_modules/highlight.js/es/languages/wasm.js", "../node_modules/highlight.js/es/languages/xml.js", "../node_modules/highlight.js/es/languages/yaml.js", "../node_modules/lowlight/lib/common.js", "../node_modules/highlight.js/es/core.js", "../node_modules/lowlight/lib/index.js", "../node_modules/rehype-highlight/lib/index.js", "../src/markdown/plugins/rehypeAccessibleSuggestions.ts", "../src/markdown/plugins/remarkEscapeHtml.ts", "../src/markdown/plugins/rehypeExternalLinks.ts", "../src/markdown/plugins/rehypeUncontrolledInputs.ts", "../src/markdown/plugins/rehypeUnwrapBlockCEs.ts", "../src/markdown/plugins/rehypeLazyContinuation.ts", "../src/markdown/processors.ts", "../src/markdown/components/CopyableCodeBlock.tsx", "../src/markdown/components/BootstrapTable.tsx", "../src/chat/RawHTML.tsx", "../src/chat/ThinkingDisplay.tsx", "../src/chat/ToolRequest.tsx", "../src/chat/ToolCard.tsx", "../src/utils/icons.ts", "../src/chat/useFullscreen.tsx", "../src/markdown/markdownCodeBlock.ts", "../src/chat/ToolRequestBridge.tsx", "../src/chat/ToolResultBridge.tsx", "../src/chat/ToolResult.tsx", "../src/chat/chatTagToComponentMap.ts", "../src/chat/usePrefersReducedMotion.ts", "../src/chat/CommandChip.tsx", "../src/chat/attachment-types.json", "../src/chat/attachments.ts", "../src/chat/TextAttachmentPreview.tsx", "../src/chat/AttachmentLightbox.tsx", "../src/chat/TiptapInput.tsx", "../node_modules/@tiptap/react/src/Context.tsx", "../node_modules/@tiptap/react/src/EditorContent.tsx", "../node_modules/@tiptap/react/src/useEditor.ts", "../node_modules/@tiptap/react/src/useEditorState.ts", "../node_modules/@tiptap/react/src/useReactNodeView.ts", "../node_modules/@tiptap/react/src/NodeViewContent.tsx", "../node_modules/@tiptap/react/src/NodeViewWrapper.tsx", "../node_modules/@tiptap/react/src/ReactMarkViewRenderer.tsx", "../node_modules/@tiptap/react/src/ReactRenderer.tsx", "../node_modules/@tiptap/react/src/ReactNodeViewRenderer.tsx", "../node_modules/@tiptap/react/src/Tiptap.tsx", "../node_modules/@tiptap/react/src/index.ts", "../node_modules/orderedmap/dist/index.js", "../node_modules/prosemirror-model/dist/index.js", "../node_modules/prosemirror-transform/dist/index.js", "../node_modules/prosemirror-state/dist/index.js", "../node_modules/prosemirror-commands/dist/index.js", "../node_modules/prosemirror-schema-list/dist/index.js", "../node_modules/prosemirror-view/dist/index.js", "../node_modules/w3c-keyname/index.js", "../node_modules/prosemirror-keymap/dist/index.js", "../node_modules/@tiptap/core/src/helpers/createChainableState.ts", "../node_modules/@tiptap/core/src/CommandManager.ts", "../node_modules/@tiptap/core/src/commands/index.ts", "../node_modules/@tiptap/core/src/commands/blur.ts", "../node_modules/@tiptap/core/src/commands/clearContent.ts", "../node_modules/@tiptap/core/src/commands/clearNodes.ts", "../node_modules/@tiptap/core/src/commands/command.ts", "../node_modules/@tiptap/core/src/commands/createParagraphNear.ts", "../node_modules/@tiptap/core/src/commands/cut.ts", "../node_modules/@tiptap/core/src/commands/deleteCurrentNode.ts", "../node_modules/@tiptap/core/src/helpers/getNodeType.ts", "../node_modules/@tiptap/core/src/commands/deleteNode.ts", "../node_modules/@tiptap/core/src/commands/deleteRange.ts", "../node_modules/@tiptap/core/src/commands/deleteSelection.ts", "../node_modules/@tiptap/core/src/commands/enter.ts", "../node_modules/@tiptap/core/src/commands/exitCode.ts", "../node_modules/@tiptap/core/src/commands/extendMarkRange.ts", "../node_modules/@tiptap/core/src/utilities/isRegExp.ts", "../node_modules/@tiptap/core/src/utilities/objectIncludes.ts", "../node_modules/@tiptap/core/src/helpers/getMarkRange.ts", "../node_modules/@tiptap/core/src/helpers/getMarkType.ts", "../node_modules/@tiptap/core/src/commands/first.ts", "../node_modules/@tiptap/core/src/helpers/isTextSelection.ts", "../node_modules/@tiptap/core/src/helpers/resolveFocusPosition.ts", "../node_modules/@tiptap/core/src/utilities/minMax.ts", "../node_modules/@tiptap/core/src/utilities/isAndroid.ts", "../node_modules/@tiptap/core/src/utilities/isiOS.ts", "../node_modules/@tiptap/core/src/utilities/isSafari.ts", "../node_modules/@tiptap/core/src/commands/focus.ts", "../node_modules/@tiptap/core/src/commands/forEach.ts", "../node_modules/@tiptap/core/src/commands/insertContent.ts", "../node_modules/@tiptap/core/src/commands/insertContentAt.ts", "../node_modules/@tiptap/core/src/helpers/createNodeFromContent.ts", "../node_modules/@tiptap/core/src/utilities/elementFromString.ts", "../node_modules/@tiptap/core/src/helpers/selectionToInsertionEnd.ts", "../node_modules/@tiptap/core/src/commands/join.ts", "../node_modules/@tiptap/core/src/commands/joinItemBackward.ts", "../node_modules/@tiptap/core/src/commands/joinItemForward.ts", "../node_modules/@tiptap/core/src/commands/joinTextblockBackward.ts", "../node_modules/@tiptap/core/src/commands/joinTextblockForward.ts", "../node_modules/@tiptap/core/src/utilities/isMacOS.ts", "../node_modules/@tiptap/core/src/commands/keyboardShortcut.ts", "../node_modules/@tiptap/core/src/commands/lift.ts", "../node_modules/@tiptap/core/src/helpers/isNodeActive.ts", "../node_modules/@tiptap/core/src/commands/liftEmptyBlock.ts", "../node_modules/@tiptap/core/src/commands/liftListItem.ts", "../node_modules/@tiptap/core/src/commands/newlineInCode.ts", "../node_modules/@tiptap/core/src/helpers/getSchemaTypeNameByName.ts", "../node_modules/@tiptap/core/src/utilities/deleteProps.ts", "../node_modules/@tiptap/core/src/commands/resetAttributes.ts", "../node_modules/@tiptap/core/src/commands/scrollIntoView.ts", "../node_modules/@tiptap/core/src/commands/selectAll.ts", "../node_modules/@tiptap/core/src/commands/selectNodeBackward.ts", "../node_modules/@tiptap/core/src/commands/selectNodeForward.ts", "../node_modules/@tiptap/core/src/commands/selectParentNode.ts", "../node_modules/@tiptap/core/src/commands/selectTextblockEnd.ts", "../node_modules/@tiptap/core/src/commands/selectTextblockStart.ts", "../node_modules/@tiptap/core/src/helpers/createDocument.ts", "../node_modules/@tiptap/core/src/commands/setContent.ts", "../node_modules/@tiptap/core/src/helpers/getMarkAttributes.ts", "../node_modules/@tiptap/core/src/helpers/combineTransactionSteps.ts", "../node_modules/@tiptap/core/src/helpers/defaultBlockAt.ts", "../node_modules/@tiptap/core/src/helpers/findChildren.ts", "../node_modules/@tiptap/core/src/helpers/findChildrenInRange.ts", "../node_modules/@tiptap/core/src/helpers/findParentNodeClosestToPos.ts", "../node_modules/@tiptap/core/src/helpers/findParentNode.ts", "../node_modules/@tiptap/core/src/helpers/getExtensionField.ts", "../node_modules/@tiptap/core/src/helpers/flattenExtensions.ts", "../node_modules/@tiptap/core/src/helpers/generateHTML.ts", "../node_modules/@tiptap/core/src/helpers/getHTMLFromFragment.ts", "../node_modules/@tiptap/core/src/helpers/getSchemaByResolvedExtensions.ts", "../node_modules/@tiptap/core/src/utilities/isFunction.ts", "../node_modules/@tiptap/core/src/utilities/callOrReturn.ts", "../node_modules/@tiptap/core/src/utilities/isEmptyObject.ts", "../node_modules/@tiptap/core/src/helpers/splitExtensions.ts", "../node_modules/@tiptap/core/src/helpers/getAttributesFromExtensions.ts", "../node_modules/@tiptap/core/src/utilities/mergeAttributes.ts", "../node_modules/@tiptap/core/src/helpers/getRenderedAttributes.ts", "../node_modules/@tiptap/core/src/utilities/fromString.ts", "../node_modules/@tiptap/core/src/helpers/injectExtensionAttributesToParseRule.ts", "../node_modules/@tiptap/core/src/utilities/findDuplicates.ts", "../node_modules/@tiptap/core/src/helpers/sortExtensions.ts", "../node_modules/@tiptap/core/src/helpers/resolveExtensions.ts", "../node_modules/@tiptap/core/src/helpers/getSchema.ts", "../node_modules/@tiptap/core/src/helpers/generateJSON.ts", "../node_modules/@tiptap/core/src/helpers/generateText.ts", "../node_modules/@tiptap/core/src/helpers/getTextBetween.ts", "../node_modules/@tiptap/core/src/helpers/getText.ts", "../node_modules/@tiptap/core/src/helpers/getTextSerializersFromSchema.ts", "../node_modules/@tiptap/core/src/helpers/getNodeAttributes.ts", "../node_modules/@tiptap/core/src/helpers/getAttributes.ts", "../node_modules/@tiptap/core/src/utilities/removeDuplicates.ts", "../node_modules/@tiptap/core/src/helpers/getChangedRanges.ts", "../node_modules/@tiptap/core/src/helpers/getDebugJSON.ts", "../node_modules/@tiptap/core/src/helpers/getMarksBetween.ts", "../node_modules/@tiptap/core/src/helpers/getNodeAtPosition.ts", "../node_modules/@tiptap/core/src/helpers/getSchemaTypeByName.ts", "../node_modules/@tiptap/core/src/helpers/getSplittedAttributes.ts", "../node_modules/@tiptap/core/src/helpers/getTextContentFromNodes.ts", "../node_modules/@tiptap/core/src/helpers/isMarkActive.ts", "../node_modules/@tiptap/core/src/helpers/isActive.ts", "../node_modules/@tiptap/core/src/helpers/isAtEndOfNode.ts", "../node_modules/@tiptap/core/src/helpers/isAtStartOfNode.ts", "../node_modules/@tiptap/core/src/helpers/isExtensionRulesEnabled.ts", "../node_modules/@tiptap/core/src/helpers/isList.ts", "../node_modules/@tiptap/core/src/helpers/isNodeEmpty.ts", "../node_modules/@tiptap/core/src/helpers/isNodeSelection.ts", "../node_modules/@tiptap/core/src/helpers/isNodeViewSelected.ts", "../node_modules/@tiptap/core/src/helpers/MappablePosition.ts", "../node_modules/@tiptap/core/src/helpers/posToDOMRect.ts", "../node_modules/@tiptap/core/src/helpers/rewriteUnknownContent.ts", "../node_modules/@tiptap/core/src/commands/setMark.ts", "../node_modules/@tiptap/core/src/commands/setMeta.ts", "../node_modules/@tiptap/core/src/commands/setNode.ts", "../node_modules/@tiptap/core/src/commands/setNodeSelection.ts", "../node_modules/@tiptap/core/src/commands/setTextDirection.ts", "../node_modules/@tiptap/core/src/commands/setTextSelection.ts", "../node_modules/@tiptap/core/src/commands/sinkListItem.ts", "../node_modules/@tiptap/core/src/commands/splitBlock.ts", "../node_modules/@tiptap/core/src/commands/splitListItem.ts", "../node_modules/@tiptap/core/src/commands/toggleList.ts", "../node_modules/@tiptap/core/src/commands/toggleMark.ts", "../node_modules/@tiptap/core/src/commands/toggleNode.ts", "../node_modules/@tiptap/core/src/commands/toggleWrap.ts", "../node_modules/@tiptap/core/src/commands/undoInputRule.ts", "../node_modules/@tiptap/core/src/commands/unsetAllMarks.ts", "../node_modules/@tiptap/core/src/commands/unsetMark.ts", "../node_modules/@tiptap/core/src/commands/unsetTextDirection.ts", "../node_modules/@tiptap/core/src/commands/updateAttributes.ts", "../node_modules/@tiptap/core/src/commands/wrapIn.ts", "../node_modules/@tiptap/core/src/commands/wrapInList.ts", "../node_modules/@tiptap/core/src/Editor.ts", "../node_modules/@tiptap/core/src/EventEmitter.ts", "../node_modules/@tiptap/core/src/ExtensionManager.ts", "../node_modules/@tiptap/core/src/InputRule.ts", "../node_modules/@tiptap/core/src/utilities/isPlainObject.ts", "../node_modules/@tiptap/core/src/utilities/mergeDeep.ts", "../node_modules/@tiptap/core/src/Extendable.ts", "../node_modules/@tiptap/core/src/Mark.ts", "../node_modules/@tiptap/core/src/PasteRule.ts", "../node_modules/@tiptap/core/src/utilities/isNumber.ts", "../node_modules/@tiptap/core/src/extensions/index.ts", "../node_modules/@tiptap/core/src/extensions/clipboardTextSerializer.ts", "../node_modules/@tiptap/core/src/Extension.ts", "../node_modules/@tiptap/core/src/extensions/commands.ts", "../node_modules/@tiptap/core/src/extensions/delete.ts", "../node_modules/@tiptap/core/src/extensions/drop.ts", "../node_modules/@tiptap/core/src/extensions/editable.ts", "../node_modules/@tiptap/core/src/extensions/focusEvents.ts", "../node_modules/@tiptap/core/src/extensions/keymap.ts", "../node_modules/@tiptap/core/src/extensions/paste.ts", "../node_modules/@tiptap/core/src/extensions/tabindex.ts", "../node_modules/@tiptap/core/src/extensions/textDirection.ts", "../node_modules/@tiptap/core/src/NodePos.ts", "../node_modules/@tiptap/core/src/style.ts", "../node_modules/@tiptap/core/src/utilities/createStyleTag.ts", "../node_modules/@tiptap/core/src/inputRules/markInputRule.ts", "../node_modules/@tiptap/core/src/inputRules/nodeInputRule.ts", "../node_modules/@tiptap/core/src/inputRules/textblockTypeInputRule.ts", "../node_modules/@tiptap/core/src/inputRules/textInputRule.ts", "../node_modules/@tiptap/core/src/inputRules/wrappingInputRule.ts", "../node_modules/@tiptap/core/src/jsx-runtime.ts", "../node_modules/@tiptap/core/src/lib/ResizableNodeView.ts", "../node_modules/@tiptap/core/src/utilities/attrsEqual.ts", "../node_modules/@tiptap/core/src/utilities/canInsertNode.ts", "../node_modules/@tiptap/core/src/utilities/escapeForRegEx.ts", "../node_modules/@tiptap/core/src/utilities/getStyleProperty.ts", "../node_modules/@tiptap/core/src/utilities/htmlEntities.ts", "../node_modules/@tiptap/core/src/utilities/isFirefox.ts", "../node_modules/@tiptap/core/src/utilities/isString.ts", "../node_modules/@tiptap/core/src/utilities/markdown/index.ts", "../node_modules/@tiptap/core/src/utilities/markdown/attributeUtils.ts", "../node_modules/@tiptap/core/src/utilities/markdown/createAtomBlockMarkdownSpec.ts", "../node_modules/@tiptap/core/src/utilities/markdown/createBlockMarkdownSpec.ts", "../node_modules/@tiptap/core/src/utilities/markdown/createInlineMarkdownSpec.ts", "../node_modules/@tiptap/core/src/utilities/markdown/parseIndentedBlocks.ts", "../node_modules/@tiptap/core/src/utilities/markdown/renderNestedMarkdownContent.ts", "../node_modules/@tiptap/core/src/utilities/marksEqual.ts", "../node_modules/@tiptap/core/src/MarkView.ts", "../node_modules/@tiptap/core/src/Node.ts", "../node_modules/@tiptap/core/src/NodeView.ts", "../node_modules/@tiptap/core/src/pasteRules/markPasteRule.ts", "../node_modules/@tiptap/core/src/pasteRules/nodePasteRule.ts", "../node_modules/@tiptap/core/src/pasteRules/textPasteRule.ts", "../node_modules/@tiptap/core/src/Tracker.ts", "../node_modules/src/utils.ts", "../node_modules/src/equals.ts", "../node_modules/src/comparator.ts", "../node_modules/src/index.ts", "../node_modules/@tiptap/extension-document/src/document.ts", "../node_modules/@tiptap/extension-document/src/index.ts", "../node_modules/@tiptap/extension-text/src/text.ts", "../node_modules/@tiptap/extension-text/src/index.ts", "../node_modules/@tiptap/extension-hard-break/src/hard-break.ts", "../node_modules/@tiptap/extension-hard-break/src/index.ts", "../node_modules/rope-sequence/dist/index.js", "../node_modules/prosemirror-history/dist/index.js", "../node_modules/@tiptap/extensions/src/undo-redo/undo-redo.ts", "../node_modules/@tiptap/suggestion/src/suggestion.ts", "../node_modules/@tiptap/suggestion/src/findSuggestionMatch.ts", "../node_modules/@tiptap/suggestion/src/index.ts", "../src/chat/tiptap/commandMention.ts", "../src/chat/tiptap/suggestionRender.tsx", "../src/chat/SlashCommandPalette.tsx", "../src/chat/useInputHistory.ts", "../src/chat/useAttachmentStaging.ts", "../src/chat/AttachmentTray.tsx", "../src/chat/MessageErrorBoundary.tsx", "../src/chat/ChatGreeting.tsx", "../src/chat/ChatInput.tsx", "../src/chat/ScrollToBottomButton.tsx", "../src/chat/ExternalLinkDialog.tsx", "../src/chat/RawDOM.tsx", "../src/chat/ChatHistoryDrawer.tsx", "../src/chat/useFillPaddingTransfer.ts", "../src/chat/useOverlapNudge.ts", "../src/transport/types.ts", "../src/transport/shiny-transport.ts", "../src/markdown-stream/markdown-stream-entry.ts", "../src/markdown-stream/MarkdownStream.tsx", "../src/markdown/useAutoScroll.ts"], - "sourcesContent": ["/**\n * @license React\n * scheduler.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nfunction push(heap, node) {\n var index = heap.length;\n heap.push(node);\n a: for (; 0 < index; ) {\n var parentIndex = (index - 1) >>> 1,\n parent = heap[parentIndex];\n if (0 < compare(parent, node))\n (heap[parentIndex] = node), (heap[index] = parent), (index = parentIndex);\n else break a;\n }\n}\nfunction peek(heap) {\n return 0 === heap.length ? null : heap[0];\n}\nfunction pop(heap) {\n if (0 === heap.length) return null;\n var first = heap[0],\n last = heap.pop();\n if (last !== first) {\n heap[0] = last;\n a: for (\n var index = 0, length = heap.length, halfLength = length >>> 1;\n index < halfLength;\n\n ) {\n var leftIndex = 2 * (index + 1) - 1,\n left = heap[leftIndex],\n rightIndex = leftIndex + 1,\n right = heap[rightIndex];\n if (0 > compare(left, last))\n rightIndex < length && 0 > compare(right, left)\n ? ((heap[index] = right),\n (heap[rightIndex] = last),\n (index = rightIndex))\n : ((heap[index] = left),\n (heap[leftIndex] = last),\n (index = leftIndex));\n else if (rightIndex < length && 0 > compare(right, last))\n (heap[index] = right), (heap[rightIndex] = last), (index = rightIndex);\n else break a;\n }\n }\n return first;\n}\nfunction compare(a, b) {\n var diff = a.sortIndex - b.sortIndex;\n return 0 !== diff ? diff : a.id - b.id;\n}\nexports.unstable_now = void 0;\nif (\"object\" === typeof performance && \"function\" === typeof performance.now) {\n var localPerformance = performance;\n exports.unstable_now = function () {\n return localPerformance.now();\n };\n} else {\n var localDate = Date,\n initialTime = localDate.now();\n exports.unstable_now = function () {\n return localDate.now() - initialTime;\n };\n}\nvar taskQueue = [],\n timerQueue = [],\n taskIdCounter = 1,\n currentTask = null,\n currentPriorityLevel = 3,\n isPerformingWork = !1,\n isHostCallbackScheduled = !1,\n isHostTimeoutScheduled = !1,\n needsPaint = !1,\n localSetTimeout = \"function\" === typeof setTimeout ? setTimeout : null,\n localClearTimeout = \"function\" === typeof clearTimeout ? clearTimeout : null,\n localSetImmediate = \"undefined\" !== typeof setImmediate ? setImmediate : null;\nfunction advanceTimers(currentTime) {\n for (var timer = peek(timerQueue); null !== timer; ) {\n if (null === timer.callback) pop(timerQueue);\n else if (timer.startTime <= currentTime)\n pop(timerQueue),\n (timer.sortIndex = timer.expirationTime),\n push(taskQueue, timer);\n else break;\n timer = peek(timerQueue);\n }\n}\nfunction handleTimeout(currentTime) {\n isHostTimeoutScheduled = !1;\n advanceTimers(currentTime);\n if (!isHostCallbackScheduled)\n if (null !== peek(taskQueue))\n (isHostCallbackScheduled = !0),\n isMessageLoopRunning ||\n ((isMessageLoopRunning = !0), schedulePerformWorkUntilDeadline());\n else {\n var firstTimer = peek(timerQueue);\n null !== firstTimer &&\n requestHostTimeout(handleTimeout, firstTimer.startTime - currentTime);\n }\n}\nvar isMessageLoopRunning = !1,\n taskTimeoutID = -1,\n frameInterval = 5,\n startTime = -1;\nfunction shouldYieldToHost() {\n return needsPaint\n ? !0\n : exports.unstable_now() - startTime < frameInterval\n ? !1\n : !0;\n}\nfunction performWorkUntilDeadline() {\n needsPaint = !1;\n if (isMessageLoopRunning) {\n var currentTime = exports.unstable_now();\n startTime = currentTime;\n var hasMoreWork = !0;\n try {\n a: {\n isHostCallbackScheduled = !1;\n isHostTimeoutScheduled &&\n ((isHostTimeoutScheduled = !1),\n localClearTimeout(taskTimeoutID),\n (taskTimeoutID = -1));\n isPerformingWork = !0;\n var previousPriorityLevel = currentPriorityLevel;\n try {\n b: {\n advanceTimers(currentTime);\n for (\n currentTask = peek(taskQueue);\n null !== currentTask &&\n !(\n currentTask.expirationTime > currentTime && shouldYieldToHost()\n );\n\n ) {\n var callback = currentTask.callback;\n if (\"function\" === typeof callback) {\n currentTask.callback = null;\n currentPriorityLevel = currentTask.priorityLevel;\n var continuationCallback = callback(\n currentTask.expirationTime <= currentTime\n );\n currentTime = exports.unstable_now();\n if (\"function\" === typeof continuationCallback) {\n currentTask.callback = continuationCallback;\n advanceTimers(currentTime);\n hasMoreWork = !0;\n break b;\n }\n currentTask === peek(taskQueue) && pop(taskQueue);\n advanceTimers(currentTime);\n } else pop(taskQueue);\n currentTask = peek(taskQueue);\n }\n if (null !== currentTask) hasMoreWork = !0;\n else {\n var firstTimer = peek(timerQueue);\n null !== firstTimer &&\n requestHostTimeout(\n handleTimeout,\n firstTimer.startTime - currentTime\n );\n hasMoreWork = !1;\n }\n }\n break a;\n } finally {\n (currentTask = null),\n (currentPriorityLevel = previousPriorityLevel),\n (isPerformingWork = !1);\n }\n hasMoreWork = void 0;\n }\n } finally {\n hasMoreWork\n ? schedulePerformWorkUntilDeadline()\n : (isMessageLoopRunning = !1);\n }\n }\n}\nvar schedulePerformWorkUntilDeadline;\nif (\"function\" === typeof localSetImmediate)\n schedulePerformWorkUntilDeadline = function () {\n localSetImmediate(performWorkUntilDeadline);\n };\nelse if (\"undefined\" !== typeof MessageChannel) {\n var channel = new MessageChannel(),\n port = channel.port2;\n channel.port1.onmessage = performWorkUntilDeadline;\n schedulePerformWorkUntilDeadline = function () {\n port.postMessage(null);\n };\n} else\n schedulePerformWorkUntilDeadline = function () {\n localSetTimeout(performWorkUntilDeadline, 0);\n };\nfunction requestHostTimeout(callback, ms) {\n taskTimeoutID = localSetTimeout(function () {\n callback(exports.unstable_now());\n }, ms);\n}\nexports.unstable_IdlePriority = 5;\nexports.unstable_ImmediatePriority = 1;\nexports.unstable_LowPriority = 4;\nexports.unstable_NormalPriority = 3;\nexports.unstable_Profiling = null;\nexports.unstable_UserBlockingPriority = 2;\nexports.unstable_cancelCallback = function (task) {\n task.callback = null;\n};\nexports.unstable_forceFrameRate = function (fps) {\n 0 > fps || 125 < fps\n ? console.error(\n \"forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported\"\n )\n : (frameInterval = 0 < fps ? Math.floor(1e3 / fps) : 5);\n};\nexports.unstable_getCurrentPriorityLevel = function () {\n return currentPriorityLevel;\n};\nexports.unstable_next = function (eventHandler) {\n switch (currentPriorityLevel) {\n case 1:\n case 2:\n case 3:\n var priorityLevel = 3;\n break;\n default:\n priorityLevel = currentPriorityLevel;\n }\n var previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = priorityLevel;\n try {\n return eventHandler();\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n};\nexports.unstable_requestPaint = function () {\n needsPaint = !0;\n};\nexports.unstable_runWithPriority = function (priorityLevel, eventHandler) {\n switch (priorityLevel) {\n case 1:\n case 2:\n case 3:\n case 4:\n case 5:\n break;\n default:\n priorityLevel = 3;\n }\n var previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = priorityLevel;\n try {\n return eventHandler();\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n};\nexports.unstable_scheduleCallback = function (\n priorityLevel,\n callback,\n options\n) {\n var currentTime = exports.unstable_now();\n \"object\" === typeof options && null !== options\n ? ((options = options.delay),\n (options =\n \"number\" === typeof options && 0 < options\n ? currentTime + options\n : currentTime))\n : (options = currentTime);\n switch (priorityLevel) {\n case 1:\n var timeout = -1;\n break;\n case 2:\n timeout = 250;\n break;\n case 5:\n timeout = 1073741823;\n break;\n case 4:\n timeout = 1e4;\n break;\n default:\n timeout = 5e3;\n }\n timeout = options + timeout;\n priorityLevel = {\n id: taskIdCounter++,\n callback: callback,\n priorityLevel: priorityLevel,\n startTime: options,\n expirationTime: timeout,\n sortIndex: -1\n };\n options > currentTime\n ? ((priorityLevel.sortIndex = options),\n push(timerQueue, priorityLevel),\n null === peek(taskQueue) &&\n priorityLevel === peek(timerQueue) &&\n (isHostTimeoutScheduled\n ? (localClearTimeout(taskTimeoutID), (taskTimeoutID = -1))\n : (isHostTimeoutScheduled = !0),\n requestHostTimeout(handleTimeout, options - currentTime)))\n : ((priorityLevel.sortIndex = timeout),\n push(taskQueue, priorityLevel),\n isHostCallbackScheduled ||\n isPerformingWork ||\n ((isHostCallbackScheduled = !0),\n isMessageLoopRunning ||\n ((isMessageLoopRunning = !0), schedulePerformWorkUntilDeadline())));\n return priorityLevel;\n};\nexports.unstable_shouldYield = shouldYieldToHost;\nexports.unstable_wrapCallback = function (callback) {\n var parentPriorityLevel = currentPriorityLevel;\n return function () {\n var previousPriorityLevel = currentPriorityLevel;\n currentPriorityLevel = parentPriorityLevel;\n try {\n return callback.apply(this, arguments);\n } finally {\n currentPriorityLevel = previousPriorityLevel;\n }\n };\n};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n", "/**\n * @license React\n * react.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\"),\n REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\"),\n MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nfunction getIteratorFn(maybeIterable) {\n if (null === maybeIterable || \"object\" !== typeof maybeIterable) return null;\n maybeIterable =\n (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||\n maybeIterable[\"@@iterator\"];\n return \"function\" === typeof maybeIterable ? maybeIterable : null;\n}\nvar ReactNoopUpdateQueue = {\n isMounted: function () {\n return !1;\n },\n enqueueForceUpdate: function () {},\n enqueueReplaceState: function () {},\n enqueueSetState: function () {}\n },\n assign = Object.assign,\n emptyObject = {};\nfunction Component(props, context, updater) {\n this.props = props;\n this.context = context;\n this.refs = emptyObject;\n this.updater = updater || ReactNoopUpdateQueue;\n}\nComponent.prototype.isReactComponent = {};\nComponent.prototype.setState = function (partialState, callback) {\n if (\n \"object\" !== typeof partialState &&\n \"function\" !== typeof partialState &&\n null != partialState\n )\n throw Error(\n \"takes an object of state variables to update or a function which returns an object of state variables.\"\n );\n this.updater.enqueueSetState(this, partialState, callback, \"setState\");\n};\nComponent.prototype.forceUpdate = function (callback) {\n this.updater.enqueueForceUpdate(this, callback, \"forceUpdate\");\n};\nfunction ComponentDummy() {}\nComponentDummy.prototype = Component.prototype;\nfunction PureComponent(props, context, updater) {\n this.props = props;\n this.context = context;\n this.refs = emptyObject;\n this.updater = updater || ReactNoopUpdateQueue;\n}\nvar pureComponentPrototype = (PureComponent.prototype = new ComponentDummy());\npureComponentPrototype.constructor = PureComponent;\nassign(pureComponentPrototype, Component.prototype);\npureComponentPrototype.isPureReactComponent = !0;\nvar isArrayImpl = Array.isArray;\nfunction noop() {}\nvar ReactSharedInternals = { H: null, A: null, T: null, S: null },\n hasOwnProperty = Object.prototype.hasOwnProperty;\nfunction ReactElement(type, key, props) {\n var refProp = props.ref;\n return {\n $$typeof: REACT_ELEMENT_TYPE,\n type: type,\n key: key,\n ref: void 0 !== refProp ? refProp : null,\n props: props\n };\n}\nfunction cloneAndReplaceKey(oldElement, newKey) {\n return ReactElement(oldElement.type, newKey, oldElement.props);\n}\nfunction isValidElement(object) {\n return (\n \"object\" === typeof object &&\n null !== object &&\n object.$$typeof === REACT_ELEMENT_TYPE\n );\n}\nfunction escape(key) {\n var escaperLookup = { \"=\": \"=0\", \":\": \"=2\" };\n return (\n \"$\" +\n key.replace(/[=:]/g, function (match) {\n return escaperLookup[match];\n })\n );\n}\nvar userProvidedKeyEscapeRegex = /\\/+/g;\nfunction getElementKey(element, index) {\n return \"object\" === typeof element && null !== element && null != element.key\n ? escape(\"\" + element.key)\n : index.toString(36);\n}\nfunction resolveThenable(thenable) {\n switch (thenable.status) {\n case \"fulfilled\":\n return thenable.value;\n case \"rejected\":\n throw thenable.reason;\n default:\n switch (\n (\"string\" === typeof thenable.status\n ? thenable.then(noop, noop)\n : ((thenable.status = \"pending\"),\n thenable.then(\n function (fulfilledValue) {\n \"pending\" === thenable.status &&\n ((thenable.status = \"fulfilled\"),\n (thenable.value = fulfilledValue));\n },\n function (error) {\n \"pending\" === thenable.status &&\n ((thenable.status = \"rejected\"), (thenable.reason = error));\n }\n )),\n thenable.status)\n ) {\n case \"fulfilled\":\n return thenable.value;\n case \"rejected\":\n throw thenable.reason;\n }\n }\n throw thenable;\n}\nfunction mapIntoArray(children, array, escapedPrefix, nameSoFar, callback) {\n var type = typeof children;\n if (\"undefined\" === type || \"boolean\" === type) children = null;\n var invokeCallback = !1;\n if (null === children) invokeCallback = !0;\n else\n switch (type) {\n case \"bigint\":\n case \"string\":\n case \"number\":\n invokeCallback = !0;\n break;\n case \"object\":\n switch (children.$$typeof) {\n case REACT_ELEMENT_TYPE:\n case REACT_PORTAL_TYPE:\n invokeCallback = !0;\n break;\n case REACT_LAZY_TYPE:\n return (\n (invokeCallback = children._init),\n mapIntoArray(\n invokeCallback(children._payload),\n array,\n escapedPrefix,\n nameSoFar,\n callback\n )\n );\n }\n }\n if (invokeCallback)\n return (\n (callback = callback(children)),\n (invokeCallback =\n \"\" === nameSoFar ? \".\" + getElementKey(children, 0) : nameSoFar),\n isArrayImpl(callback)\n ? ((escapedPrefix = \"\"),\n null != invokeCallback &&\n (escapedPrefix =\n invokeCallback.replace(userProvidedKeyEscapeRegex, \"$&/\") + \"/\"),\n mapIntoArray(callback, array, escapedPrefix, \"\", function (c) {\n return c;\n }))\n : null != callback &&\n (isValidElement(callback) &&\n (callback = cloneAndReplaceKey(\n callback,\n escapedPrefix +\n (null == callback.key ||\n (children && children.key === callback.key)\n ? \"\"\n : (\"\" + callback.key).replace(\n userProvidedKeyEscapeRegex,\n \"$&/\"\n ) + \"/\") +\n invokeCallback\n )),\n array.push(callback)),\n 1\n );\n invokeCallback = 0;\n var nextNamePrefix = \"\" === nameSoFar ? \".\" : nameSoFar + \":\";\n if (isArrayImpl(children))\n for (var i = 0; i < children.length; i++)\n (nameSoFar = children[i]),\n (type = nextNamePrefix + getElementKey(nameSoFar, i)),\n (invokeCallback += mapIntoArray(\n nameSoFar,\n array,\n escapedPrefix,\n type,\n callback\n ));\n else if (((i = getIteratorFn(children)), \"function\" === typeof i))\n for (\n children = i.call(children), i = 0;\n !(nameSoFar = children.next()).done;\n\n )\n (nameSoFar = nameSoFar.value),\n (type = nextNamePrefix + getElementKey(nameSoFar, i++)),\n (invokeCallback += mapIntoArray(\n nameSoFar,\n array,\n escapedPrefix,\n type,\n callback\n ));\n else if (\"object\" === type) {\n if (\"function\" === typeof children.then)\n return mapIntoArray(\n resolveThenable(children),\n array,\n escapedPrefix,\n nameSoFar,\n callback\n );\n array = String(children);\n throw Error(\n \"Objects are not valid as a React child (found: \" +\n (\"[object Object]\" === array\n ? \"object with keys {\" + Object.keys(children).join(\", \") + \"}\"\n : array) +\n \"). If you meant to render a collection of children, use an array instead.\"\n );\n }\n return invokeCallback;\n}\nfunction mapChildren(children, func, context) {\n if (null == children) return children;\n var result = [],\n count = 0;\n mapIntoArray(children, result, \"\", \"\", function (child) {\n return func.call(context, child, count++);\n });\n return result;\n}\nfunction lazyInitializer(payload) {\n if (-1 === payload._status) {\n var ctor = payload._result;\n ctor = ctor();\n ctor.then(\n function (moduleObject) {\n if (0 === payload._status || -1 === payload._status)\n (payload._status = 1), (payload._result = moduleObject);\n },\n function (error) {\n if (0 === payload._status || -1 === payload._status)\n (payload._status = 2), (payload._result = error);\n }\n );\n -1 === payload._status && ((payload._status = 0), (payload._result = ctor));\n }\n if (1 === payload._status) return payload._result.default;\n throw payload._result;\n}\nvar reportGlobalError =\n \"function\" === typeof reportError\n ? reportError\n : function (error) {\n if (\n \"object\" === typeof window &&\n \"function\" === typeof window.ErrorEvent\n ) {\n var event = new window.ErrorEvent(\"error\", {\n bubbles: !0,\n cancelable: !0,\n message:\n \"object\" === typeof error &&\n null !== error &&\n \"string\" === typeof error.message\n ? String(error.message)\n : String(error),\n error: error\n });\n if (!window.dispatchEvent(event)) return;\n } else if (\n \"object\" === typeof process &&\n \"function\" === typeof process.emit\n ) {\n process.emit(\"uncaughtException\", error);\n return;\n }\n console.error(error);\n },\n Children = {\n map: mapChildren,\n forEach: function (children, forEachFunc, forEachContext) {\n mapChildren(\n children,\n function () {\n forEachFunc.apply(this, arguments);\n },\n forEachContext\n );\n },\n count: function (children) {\n var n = 0;\n mapChildren(children, function () {\n n++;\n });\n return n;\n },\n toArray: function (children) {\n return (\n mapChildren(children, function (child) {\n return child;\n }) || []\n );\n },\n only: function (children) {\n if (!isValidElement(children))\n throw Error(\n \"React.Children.only expected to receive a single React element child.\"\n );\n return children;\n }\n };\nexports.Activity = REACT_ACTIVITY_TYPE;\nexports.Children = Children;\nexports.Component = Component;\nexports.Fragment = REACT_FRAGMENT_TYPE;\nexports.Profiler = REACT_PROFILER_TYPE;\nexports.PureComponent = PureComponent;\nexports.StrictMode = REACT_STRICT_MODE_TYPE;\nexports.Suspense = REACT_SUSPENSE_TYPE;\nexports.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =\n ReactSharedInternals;\nexports.__COMPILER_RUNTIME = {\n __proto__: null,\n c: function (size) {\n return ReactSharedInternals.H.useMemoCache(size);\n }\n};\nexports.cache = function (fn) {\n return function () {\n return fn.apply(null, arguments);\n };\n};\nexports.cacheSignal = function () {\n return null;\n};\nexports.cloneElement = function (element, config, children) {\n if (null === element || void 0 === element)\n throw Error(\n \"The argument must be a React element, but you passed \" + element + \".\"\n );\n var props = assign({}, element.props),\n key = element.key;\n if (null != config)\n for (propName in (void 0 !== config.key && (key = \"\" + config.key), config))\n !hasOwnProperty.call(config, propName) ||\n \"key\" === propName ||\n \"__self\" === propName ||\n \"__source\" === propName ||\n (\"ref\" === propName && void 0 === config.ref) ||\n (props[propName] = config[propName]);\n var propName = arguments.length - 2;\n if (1 === propName) props.children = children;\n else if (1 < propName) {\n for (var childArray = Array(propName), i = 0; i < propName; i++)\n childArray[i] = arguments[i + 2];\n props.children = childArray;\n }\n return ReactElement(element.type, key, props);\n};\nexports.createContext = function (defaultValue) {\n defaultValue = {\n $$typeof: REACT_CONTEXT_TYPE,\n _currentValue: defaultValue,\n _currentValue2: defaultValue,\n _threadCount: 0,\n Provider: null,\n Consumer: null\n };\n defaultValue.Provider = defaultValue;\n defaultValue.Consumer = {\n $$typeof: REACT_CONSUMER_TYPE,\n _context: defaultValue\n };\n return defaultValue;\n};\nexports.createElement = function (type, config, children) {\n var propName,\n props = {},\n key = null;\n if (null != config)\n for (propName in (void 0 !== config.key && (key = \"\" + config.key), config))\n hasOwnProperty.call(config, propName) &&\n \"key\" !== propName &&\n \"__self\" !== propName &&\n \"__source\" !== propName &&\n (props[propName] = config[propName]);\n var childrenLength = arguments.length - 2;\n if (1 === childrenLength) props.children = children;\n else if (1 < childrenLength) {\n for (var childArray = Array(childrenLength), i = 0; i < childrenLength; i++)\n childArray[i] = arguments[i + 2];\n props.children = childArray;\n }\n if (type && type.defaultProps)\n for (propName in ((childrenLength = type.defaultProps), childrenLength))\n void 0 === props[propName] &&\n (props[propName] = childrenLength[propName]);\n return ReactElement(type, key, props);\n};\nexports.createRef = function () {\n return { current: null };\n};\nexports.forwardRef = function (render) {\n return { $$typeof: REACT_FORWARD_REF_TYPE, render: render };\n};\nexports.isValidElement = isValidElement;\nexports.lazy = function (ctor) {\n return {\n $$typeof: REACT_LAZY_TYPE,\n _payload: { _status: -1, _result: ctor },\n _init: lazyInitializer\n };\n};\nexports.memo = function (type, compare) {\n return {\n $$typeof: REACT_MEMO_TYPE,\n type: type,\n compare: void 0 === compare ? null : compare\n };\n};\nexports.startTransition = function (scope) {\n var prevTransition = ReactSharedInternals.T,\n currentTransition = {};\n ReactSharedInternals.T = currentTransition;\n try {\n var returnValue = scope(),\n onStartTransitionFinish = ReactSharedInternals.S;\n null !== onStartTransitionFinish &&\n onStartTransitionFinish(currentTransition, returnValue);\n \"object\" === typeof returnValue &&\n null !== returnValue &&\n \"function\" === typeof returnValue.then &&\n returnValue.then(noop, reportGlobalError);\n } catch (error) {\n reportGlobalError(error);\n } finally {\n null !== prevTransition &&\n null !== currentTransition.types &&\n (prevTransition.types = currentTransition.types),\n (ReactSharedInternals.T = prevTransition);\n }\n};\nexports.unstable_useCacheRefresh = function () {\n return ReactSharedInternals.H.useCacheRefresh();\n};\nexports.use = function (usable) {\n return ReactSharedInternals.H.use(usable);\n};\nexports.useActionState = function (action, initialState, permalink) {\n return ReactSharedInternals.H.useActionState(action, initialState, permalink);\n};\nexports.useCallback = function (callback, deps) {\n return ReactSharedInternals.H.useCallback(callback, deps);\n};\nexports.useContext = function (Context) {\n return ReactSharedInternals.H.useContext(Context);\n};\nexports.useDebugValue = function () {};\nexports.useDeferredValue = function (value, initialValue) {\n return ReactSharedInternals.H.useDeferredValue(value, initialValue);\n};\nexports.useEffect = function (create, deps) {\n return ReactSharedInternals.H.useEffect(create, deps);\n};\nexports.useEffectEvent = function (callback) {\n return ReactSharedInternals.H.useEffectEvent(callback);\n};\nexports.useId = function () {\n return ReactSharedInternals.H.useId();\n};\nexports.useImperativeHandle = function (ref, create, deps) {\n return ReactSharedInternals.H.useImperativeHandle(ref, create, deps);\n};\nexports.useInsertionEffect = function (create, deps) {\n return ReactSharedInternals.H.useInsertionEffect(create, deps);\n};\nexports.useLayoutEffect = function (create, deps) {\n return ReactSharedInternals.H.useLayoutEffect(create, deps);\n};\nexports.useMemo = function (create, deps) {\n return ReactSharedInternals.H.useMemo(create, deps);\n};\nexports.useOptimistic = function (passthrough, reducer) {\n return ReactSharedInternals.H.useOptimistic(passthrough, reducer);\n};\nexports.useReducer = function (reducer, initialArg, init) {\n return ReactSharedInternals.H.useReducer(reducer, initialArg, init);\n};\nexports.useRef = function (initialValue) {\n return ReactSharedInternals.H.useRef(initialValue);\n};\nexports.useState = function (initialState) {\n return ReactSharedInternals.H.useState(initialState);\n};\nexports.useSyncExternalStore = function (\n subscribe,\n getSnapshot,\n getServerSnapshot\n) {\n return ReactSharedInternals.H.useSyncExternalStore(\n subscribe,\n getSnapshot,\n getServerSnapshot\n );\n};\nexports.useTransition = function () {\n return ReactSharedInternals.H.useTransition();\n};\nexports.version = \"19.2.4\";\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react.production.js');\n} else {\n module.exports = require('./cjs/react.development.js');\n}\n", "/**\n * @license React\n * react-dom.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n\"use strict\";\nvar React = require(\"react\");\nfunction formatProdErrorMessage(code) {\n var url = \"https://react.dev/errors/\" + code;\n if (1 < arguments.length) {\n url += \"?args[]=\" + encodeURIComponent(arguments[1]);\n for (var i = 2; i < arguments.length; i++)\n url += \"&args[]=\" + encodeURIComponent(arguments[i]);\n }\n return (\n \"Minified React error #\" +\n code +\n \"; visit \" +\n url +\n \" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.\"\n );\n}\nfunction noop() {}\nvar Internals = {\n d: {\n f: noop,\n r: function () {\n throw Error(formatProdErrorMessage(522));\n },\n D: noop,\n C: noop,\n L: noop,\n m: noop,\n X: noop,\n S: noop,\n M: noop\n },\n p: 0,\n findDOMNode: null\n },\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\");\nfunction createPortal$1(children, containerInfo, implementation) {\n var key =\n 3 < arguments.length && void 0 !== arguments[3] ? arguments[3] : null;\n return {\n $$typeof: REACT_PORTAL_TYPE,\n key: null == key ? null : \"\" + key,\n children: children,\n containerInfo: containerInfo,\n implementation: implementation\n };\n}\nvar ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;\nfunction getCrossOriginStringAs(as, input) {\n if (\"font\" === as) return \"\";\n if (\"string\" === typeof input)\n return \"use-credentials\" === input ? input : \"\";\n}\nexports.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE =\n Internals;\nexports.createPortal = function (children, container) {\n var key =\n 2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null;\n if (\n !container ||\n (1 !== container.nodeType &&\n 9 !== container.nodeType &&\n 11 !== container.nodeType)\n )\n throw Error(formatProdErrorMessage(299));\n return createPortal$1(children, container, null, key);\n};\nexports.flushSync = function (fn) {\n var previousTransition = ReactSharedInternals.T,\n previousUpdatePriority = Internals.p;\n try {\n if (((ReactSharedInternals.T = null), (Internals.p = 2), fn)) return fn();\n } finally {\n (ReactSharedInternals.T = previousTransition),\n (Internals.p = previousUpdatePriority),\n Internals.d.f();\n }\n};\nexports.preconnect = function (href, options) {\n \"string\" === typeof href &&\n (options\n ? ((options = options.crossOrigin),\n (options =\n \"string\" === typeof options\n ? \"use-credentials\" === options\n ? options\n : \"\"\n : void 0))\n : (options = null),\n Internals.d.C(href, options));\n};\nexports.prefetchDNS = function (href) {\n \"string\" === typeof href && Internals.d.D(href);\n};\nexports.preinit = function (href, options) {\n if (\"string\" === typeof href && options && \"string\" === typeof options.as) {\n var as = options.as,\n crossOrigin = getCrossOriginStringAs(as, options.crossOrigin),\n integrity =\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n fetchPriority =\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0;\n \"style\" === as\n ? Internals.d.S(\n href,\n \"string\" === typeof options.precedence ? options.precedence : void 0,\n {\n crossOrigin: crossOrigin,\n integrity: integrity,\n fetchPriority: fetchPriority\n }\n )\n : \"script\" === as &&\n Internals.d.X(href, {\n crossOrigin: crossOrigin,\n integrity: integrity,\n fetchPriority: fetchPriority,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0\n });\n }\n};\nexports.preinitModule = function (href, options) {\n if (\"string\" === typeof href)\n if (\"object\" === typeof options && null !== options) {\n if (null == options.as || \"script\" === options.as) {\n var crossOrigin = getCrossOriginStringAs(\n options.as,\n options.crossOrigin\n );\n Internals.d.M(href, {\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0\n });\n }\n } else null == options && Internals.d.M(href);\n};\nexports.preload = function (href, options) {\n if (\n \"string\" === typeof href &&\n \"object\" === typeof options &&\n null !== options &&\n \"string\" === typeof options.as\n ) {\n var as = options.as,\n crossOrigin = getCrossOriginStringAs(as, options.crossOrigin);\n Internals.d.L(href, as, {\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0,\n nonce: \"string\" === typeof options.nonce ? options.nonce : void 0,\n type: \"string\" === typeof options.type ? options.type : void 0,\n fetchPriority:\n \"string\" === typeof options.fetchPriority\n ? options.fetchPriority\n : void 0,\n referrerPolicy:\n \"string\" === typeof options.referrerPolicy\n ? options.referrerPolicy\n : void 0,\n imageSrcSet:\n \"string\" === typeof options.imageSrcSet ? options.imageSrcSet : void 0,\n imageSizes:\n \"string\" === typeof options.imageSizes ? options.imageSizes : void 0,\n media: \"string\" === typeof options.media ? options.media : void 0\n });\n }\n};\nexports.preloadModule = function (href, options) {\n if (\"string\" === typeof href)\n if (options) {\n var crossOrigin = getCrossOriginStringAs(options.as, options.crossOrigin);\n Internals.d.m(href, {\n as:\n \"string\" === typeof options.as && \"script\" !== options.as\n ? options.as\n : void 0,\n crossOrigin: crossOrigin,\n integrity:\n \"string\" === typeof options.integrity ? options.integrity : void 0\n });\n } else Internals.d.m(href);\n};\nexports.requestFormReset = function (form) {\n Internals.d.r(form);\n};\nexports.unstable_batchedUpdates = function (fn, a) {\n return fn(a);\n};\nexports.useFormState = function (action, initialState, permalink) {\n return ReactSharedInternals.H.useFormState(action, initialState, permalink);\n};\nexports.useFormStatus = function () {\n return ReactSharedInternals.H.useHostTransitionStatus();\n};\nexports.version = \"19.2.4\";\n", "'use strict';\n\nfunction checkDCE() {\n /* global __REACT_DEVTOOLS_GLOBAL_HOOK__ */\n if (\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__ === 'undefined' ||\n typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE !== 'function'\n ) {\n return;\n }\n if (process.env.NODE_ENV !== 'production') {\n // This branch is unreachable because this function is only called\n // in production, but the condition is true only in development.\n // Therefore if the branch is still here, dead code elimination wasn't\n // properly applied.\n // Don't change the message. React DevTools relies on it. Also make sure\n // this message doesn't occur elsewhere in this function, or it will cause\n // a false positive.\n throw new Error('^_^');\n }\n try {\n // Verify that the code above has been dead code eliminated (DCE'd).\n __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(checkDCE);\n } catch (err) {\n // DevTools shouldn't crash React, no matter what.\n // We should still report in case we break this code.\n console.error(err);\n }\n}\n\nif (process.env.NODE_ENV === 'production') {\n // DCE check should happen before ReactDOM bundle executes so that\n // DevTools can report bad minification during injection.\n checkDCE();\n module.exports = require('./cjs/react-dom.production.js');\n} else {\n module.exports = require('./cjs/react-dom.development.js');\n}\n", "/**\n * @license React\n * react-dom-client.production.js\n *\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n/*\n Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n\"use strict\";\nvar Scheduler = require(\"scheduler\"),\n React = require(\"react\"),\n ReactDOM = require(\"react-dom\");\nfunction formatProdErrorMessage(code) {\n var url = \"https://react.dev/errors/\" + code;\n if (1 < arguments.length) {\n url += \"?args[]=\" + encodeURIComponent(arguments[1]);\n for (var i = 2; i < arguments.length; i++)\n url += \"&args[]=\" + encodeURIComponent(arguments[i]);\n }\n return (\n \"Minified React error #\" +\n code +\n \"; visit \" +\n url +\n \" for the full message or use the non-minified dev environment for full errors and additional helpful warnings.\"\n );\n}\nfunction isValidContainer(node) {\n return !(\n !node ||\n (1 !== node.nodeType && 9 !== node.nodeType && 11 !== node.nodeType)\n );\n}\nfunction getNearestMountedFiber(fiber) {\n var node = fiber,\n nearestMounted = fiber;\n if (fiber.alternate) for (; node.return; ) node = node.return;\n else {\n fiber = node;\n do\n (node = fiber),\n 0 !== (node.flags & 4098) && (nearestMounted = node.return),\n (fiber = node.return);\n while (fiber);\n }\n return 3 === node.tag ? nearestMounted : null;\n}\nfunction getSuspenseInstanceFromFiber(fiber) {\n if (13 === fiber.tag) {\n var suspenseState = fiber.memoizedState;\n null === suspenseState &&\n ((fiber = fiber.alternate),\n null !== fiber && (suspenseState = fiber.memoizedState));\n if (null !== suspenseState) return suspenseState.dehydrated;\n }\n return null;\n}\nfunction getActivityInstanceFromFiber(fiber) {\n if (31 === fiber.tag) {\n var activityState = fiber.memoizedState;\n null === activityState &&\n ((fiber = fiber.alternate),\n null !== fiber && (activityState = fiber.memoizedState));\n if (null !== activityState) return activityState.dehydrated;\n }\n return null;\n}\nfunction assertIsMounted(fiber) {\n if (getNearestMountedFiber(fiber) !== fiber)\n throw Error(formatProdErrorMessage(188));\n}\nfunction findCurrentFiberUsingSlowPath(fiber) {\n var alternate = fiber.alternate;\n if (!alternate) {\n alternate = getNearestMountedFiber(fiber);\n if (null === alternate) throw Error(formatProdErrorMessage(188));\n return alternate !== fiber ? null : fiber;\n }\n for (var a = fiber, b = alternate; ; ) {\n var parentA = a.return;\n if (null === parentA) break;\n var parentB = parentA.alternate;\n if (null === parentB) {\n b = parentA.return;\n if (null !== b) {\n a = b;\n continue;\n }\n break;\n }\n if (parentA.child === parentB.child) {\n for (parentB = parentA.child; parentB; ) {\n if (parentB === a) return assertIsMounted(parentA), fiber;\n if (parentB === b) return assertIsMounted(parentA), alternate;\n parentB = parentB.sibling;\n }\n throw Error(formatProdErrorMessage(188));\n }\n if (a.return !== b.return) (a = parentA), (b = parentB);\n else {\n for (var didFindChild = !1, child$0 = parentA.child; child$0; ) {\n if (child$0 === a) {\n didFindChild = !0;\n a = parentA;\n b = parentB;\n break;\n }\n if (child$0 === b) {\n didFindChild = !0;\n b = parentA;\n a = parentB;\n break;\n }\n child$0 = child$0.sibling;\n }\n if (!didFindChild) {\n for (child$0 = parentB.child; child$0; ) {\n if (child$0 === a) {\n didFindChild = !0;\n a = parentB;\n b = parentA;\n break;\n }\n if (child$0 === b) {\n didFindChild = !0;\n b = parentB;\n a = parentA;\n break;\n }\n child$0 = child$0.sibling;\n }\n if (!didFindChild) throw Error(formatProdErrorMessage(189));\n }\n }\n if (a.alternate !== b) throw Error(formatProdErrorMessage(190));\n }\n if (3 !== a.tag) throw Error(formatProdErrorMessage(188));\n return a.stateNode.current === a ? fiber : alternate;\n}\nfunction findCurrentHostFiberImpl(node) {\n var tag = node.tag;\n if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return node;\n for (node = node.child; null !== node; ) {\n tag = findCurrentHostFiberImpl(node);\n if (null !== tag) return tag;\n node = node.sibling;\n }\n return null;\n}\nvar assign = Object.assign,\n REACT_LEGACY_ELEMENT_TYPE = Symbol.for(\"react.element\"),\n REACT_ELEMENT_TYPE = Symbol.for(\"react.transitional.element\"),\n REACT_PORTAL_TYPE = Symbol.for(\"react.portal\"),\n REACT_FRAGMENT_TYPE = Symbol.for(\"react.fragment\"),\n REACT_STRICT_MODE_TYPE = Symbol.for(\"react.strict_mode\"),\n REACT_PROFILER_TYPE = Symbol.for(\"react.profiler\"),\n REACT_CONSUMER_TYPE = Symbol.for(\"react.consumer\"),\n REACT_CONTEXT_TYPE = Symbol.for(\"react.context\"),\n REACT_FORWARD_REF_TYPE = Symbol.for(\"react.forward_ref\"),\n REACT_SUSPENSE_TYPE = Symbol.for(\"react.suspense\"),\n REACT_SUSPENSE_LIST_TYPE = Symbol.for(\"react.suspense_list\"),\n REACT_MEMO_TYPE = Symbol.for(\"react.memo\"),\n REACT_LAZY_TYPE = Symbol.for(\"react.lazy\");\nSymbol.for(\"react.scope\");\nvar REACT_ACTIVITY_TYPE = Symbol.for(\"react.activity\");\nSymbol.for(\"react.legacy_hidden\");\nSymbol.for(\"react.tracing_marker\");\nvar REACT_MEMO_CACHE_SENTINEL = Symbol.for(\"react.memo_cache_sentinel\");\nSymbol.for(\"react.view_transition\");\nvar MAYBE_ITERATOR_SYMBOL = Symbol.iterator;\nfunction getIteratorFn(maybeIterable) {\n if (null === maybeIterable || \"object\" !== typeof maybeIterable) return null;\n maybeIterable =\n (MAYBE_ITERATOR_SYMBOL && maybeIterable[MAYBE_ITERATOR_SYMBOL]) ||\n maybeIterable[\"@@iterator\"];\n return \"function\" === typeof maybeIterable ? maybeIterable : null;\n}\nvar REACT_CLIENT_REFERENCE = Symbol.for(\"react.client.reference\");\nfunction getComponentNameFromType(type) {\n if (null == type) return null;\n if (\"function\" === typeof type)\n return type.$$typeof === REACT_CLIENT_REFERENCE\n ? null\n : type.displayName || type.name || null;\n if (\"string\" === typeof type) return type;\n switch (type) {\n case REACT_FRAGMENT_TYPE:\n return \"Fragment\";\n case REACT_PROFILER_TYPE:\n return \"Profiler\";\n case REACT_STRICT_MODE_TYPE:\n return \"StrictMode\";\n case REACT_SUSPENSE_TYPE:\n return \"Suspense\";\n case REACT_SUSPENSE_LIST_TYPE:\n return \"SuspenseList\";\n case REACT_ACTIVITY_TYPE:\n return \"Activity\";\n }\n if (\"object\" === typeof type)\n switch (type.$$typeof) {\n case REACT_PORTAL_TYPE:\n return \"Portal\";\n case REACT_CONTEXT_TYPE:\n return type.displayName || \"Context\";\n case REACT_CONSUMER_TYPE:\n return (type._context.displayName || \"Context\") + \".Consumer\";\n case REACT_FORWARD_REF_TYPE:\n var innerType = type.render;\n type = type.displayName;\n type ||\n ((type = innerType.displayName || innerType.name || \"\"),\n (type = \"\" !== type ? \"ForwardRef(\" + type + \")\" : \"ForwardRef\"));\n return type;\n case REACT_MEMO_TYPE:\n return (\n (innerType = type.displayName || null),\n null !== innerType\n ? innerType\n : getComponentNameFromType(type.type) || \"Memo\"\n );\n case REACT_LAZY_TYPE:\n innerType = type._payload;\n type = type._init;\n try {\n return getComponentNameFromType(type(innerType));\n } catch (x) {}\n }\n return null;\n}\nvar isArrayImpl = Array.isArray,\n ReactSharedInternals =\n React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n ReactDOMSharedInternals =\n ReactDOM.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,\n sharedNotPendingObject = {\n pending: !1,\n data: null,\n method: null,\n action: null\n },\n valueStack = [],\n index = -1;\nfunction createCursor(defaultValue) {\n return { current: defaultValue };\n}\nfunction pop(cursor) {\n 0 > index ||\n ((cursor.current = valueStack[index]), (valueStack[index] = null), index--);\n}\nfunction push(cursor, value) {\n index++;\n valueStack[index] = cursor.current;\n cursor.current = value;\n}\nvar contextStackCursor = createCursor(null),\n contextFiberStackCursor = createCursor(null),\n rootInstanceStackCursor = createCursor(null),\n hostTransitionProviderCursor = createCursor(null);\nfunction pushHostContainer(fiber, nextRootInstance) {\n push(rootInstanceStackCursor, nextRootInstance);\n push(contextFiberStackCursor, fiber);\n push(contextStackCursor, null);\n switch (nextRootInstance.nodeType) {\n case 9:\n case 11:\n fiber = (fiber = nextRootInstance.documentElement)\n ? (fiber = fiber.namespaceURI)\n ? getOwnHostContext(fiber)\n : 0\n : 0;\n break;\n default:\n if (\n ((fiber = nextRootInstance.tagName),\n (nextRootInstance = nextRootInstance.namespaceURI))\n )\n (nextRootInstance = getOwnHostContext(nextRootInstance)),\n (fiber = getChildHostContextProd(nextRootInstance, fiber));\n else\n switch (fiber) {\n case \"svg\":\n fiber = 1;\n break;\n case \"math\":\n fiber = 2;\n break;\n default:\n fiber = 0;\n }\n }\n pop(contextStackCursor);\n push(contextStackCursor, fiber);\n}\nfunction popHostContainer() {\n pop(contextStackCursor);\n pop(contextFiberStackCursor);\n pop(rootInstanceStackCursor);\n}\nfunction pushHostContext(fiber) {\n null !== fiber.memoizedState && push(hostTransitionProviderCursor, fiber);\n var context = contextStackCursor.current;\n var JSCompiler_inline_result = getChildHostContextProd(context, fiber.type);\n context !== JSCompiler_inline_result &&\n (push(contextFiberStackCursor, fiber),\n push(contextStackCursor, JSCompiler_inline_result));\n}\nfunction popHostContext(fiber) {\n contextFiberStackCursor.current === fiber &&\n (pop(contextStackCursor), pop(contextFiberStackCursor));\n hostTransitionProviderCursor.current === fiber &&\n (pop(hostTransitionProviderCursor),\n (HostTransitionContext._currentValue = sharedNotPendingObject));\n}\nvar prefix, suffix;\nfunction describeBuiltInComponentFrame(name) {\n if (void 0 === prefix)\n try {\n throw Error();\n } catch (x) {\n var match = x.stack.trim().match(/\\n( *(at )?)/);\n prefix = (match && match[1]) || \"\";\n suffix =\n -1 < x.stack.indexOf(\"\\n at\")\n ? \" ()\"\n : -1 < x.stack.indexOf(\"@\")\n ? \"@unknown:0:0\"\n : \"\";\n }\n return \"\\n\" + prefix + name + suffix;\n}\nvar reentry = !1;\nfunction describeNativeComponentFrame(fn, construct) {\n if (!fn || reentry) return \"\";\n reentry = !0;\n var previousPrepareStackTrace = Error.prepareStackTrace;\n Error.prepareStackTrace = void 0;\n try {\n var RunInRootFrame = {\n DetermineComponentFrameRoot: function () {\n try {\n if (construct) {\n var Fake = function () {\n throw Error();\n };\n Object.defineProperty(Fake.prototype, \"props\", {\n set: function () {\n throw Error();\n }\n });\n if (\"object\" === typeof Reflect && Reflect.construct) {\n try {\n Reflect.construct(Fake, []);\n } catch (x) {\n var control = x;\n }\n Reflect.construct(fn, [], Fake);\n } else {\n try {\n Fake.call();\n } catch (x$1) {\n control = x$1;\n }\n fn.call(Fake.prototype);\n }\n } else {\n try {\n throw Error();\n } catch (x$2) {\n control = x$2;\n }\n (Fake = fn()) &&\n \"function\" === typeof Fake.catch &&\n Fake.catch(function () {});\n }\n } catch (sample) {\n if (sample && control && \"string\" === typeof sample.stack)\n return [sample.stack, control.stack];\n }\n return [null, null];\n }\n };\n RunInRootFrame.DetermineComponentFrameRoot.displayName =\n \"DetermineComponentFrameRoot\";\n var namePropDescriptor = Object.getOwnPropertyDescriptor(\n RunInRootFrame.DetermineComponentFrameRoot,\n \"name\"\n );\n namePropDescriptor &&\n namePropDescriptor.configurable &&\n Object.defineProperty(\n RunInRootFrame.DetermineComponentFrameRoot,\n \"name\",\n { value: \"DetermineComponentFrameRoot\" }\n );\n var _RunInRootFrame$Deter = RunInRootFrame.DetermineComponentFrameRoot(),\n sampleStack = _RunInRootFrame$Deter[0],\n controlStack = _RunInRootFrame$Deter[1];\n if (sampleStack && controlStack) {\n var sampleLines = sampleStack.split(\"\\n\"),\n controlLines = controlStack.split(\"\\n\");\n for (\n namePropDescriptor = RunInRootFrame = 0;\n RunInRootFrame < sampleLines.length &&\n !sampleLines[RunInRootFrame].includes(\"DetermineComponentFrameRoot\");\n\n )\n RunInRootFrame++;\n for (\n ;\n namePropDescriptor < controlLines.length &&\n !controlLines[namePropDescriptor].includes(\n \"DetermineComponentFrameRoot\"\n );\n\n )\n namePropDescriptor++;\n if (\n RunInRootFrame === sampleLines.length ||\n namePropDescriptor === controlLines.length\n )\n for (\n RunInRootFrame = sampleLines.length - 1,\n namePropDescriptor = controlLines.length - 1;\n 1 <= RunInRootFrame &&\n 0 <= namePropDescriptor &&\n sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor];\n\n )\n namePropDescriptor--;\n for (\n ;\n 1 <= RunInRootFrame && 0 <= namePropDescriptor;\n RunInRootFrame--, namePropDescriptor--\n )\n if (sampleLines[RunInRootFrame] !== controlLines[namePropDescriptor]) {\n if (1 !== RunInRootFrame || 1 !== namePropDescriptor) {\n do\n if (\n (RunInRootFrame--,\n namePropDescriptor--,\n 0 > namePropDescriptor ||\n sampleLines[RunInRootFrame] !==\n controlLines[namePropDescriptor])\n ) {\n var frame =\n \"\\n\" +\n sampleLines[RunInRootFrame].replace(\" at new \", \" at \");\n fn.displayName &&\n frame.includes(\"\") &&\n (frame = frame.replace(\"\", fn.displayName));\n return frame;\n }\n while (1 <= RunInRootFrame && 0 <= namePropDescriptor);\n }\n break;\n }\n }\n } finally {\n (reentry = !1), (Error.prepareStackTrace = previousPrepareStackTrace);\n }\n return (previousPrepareStackTrace = fn ? fn.displayName || fn.name : \"\")\n ? describeBuiltInComponentFrame(previousPrepareStackTrace)\n : \"\";\n}\nfunction describeFiber(fiber, childFiber) {\n switch (fiber.tag) {\n case 26:\n case 27:\n case 5:\n return describeBuiltInComponentFrame(fiber.type);\n case 16:\n return describeBuiltInComponentFrame(\"Lazy\");\n case 13:\n return fiber.child !== childFiber && null !== childFiber\n ? describeBuiltInComponentFrame(\"Suspense Fallback\")\n : describeBuiltInComponentFrame(\"Suspense\");\n case 19:\n return describeBuiltInComponentFrame(\"SuspenseList\");\n case 0:\n case 15:\n return describeNativeComponentFrame(fiber.type, !1);\n case 11:\n return describeNativeComponentFrame(fiber.type.render, !1);\n case 1:\n return describeNativeComponentFrame(fiber.type, !0);\n case 31:\n return describeBuiltInComponentFrame(\"Activity\");\n default:\n return \"\";\n }\n}\nfunction getStackByFiberInDevAndProd(workInProgress) {\n try {\n var info = \"\",\n previous = null;\n do\n (info += describeFiber(workInProgress, previous)),\n (previous = workInProgress),\n (workInProgress = workInProgress.return);\n while (workInProgress);\n return info;\n } catch (x) {\n return \"\\nError generating stack: \" + x.message + \"\\n\" + x.stack;\n }\n}\nvar hasOwnProperty = Object.prototype.hasOwnProperty,\n scheduleCallback$3 = Scheduler.unstable_scheduleCallback,\n cancelCallback$1 = Scheduler.unstable_cancelCallback,\n shouldYield = Scheduler.unstable_shouldYield,\n requestPaint = Scheduler.unstable_requestPaint,\n now = Scheduler.unstable_now,\n getCurrentPriorityLevel = Scheduler.unstable_getCurrentPriorityLevel,\n ImmediatePriority = Scheduler.unstable_ImmediatePriority,\n UserBlockingPriority = Scheduler.unstable_UserBlockingPriority,\n NormalPriority$1 = Scheduler.unstable_NormalPriority,\n LowPriority = Scheduler.unstable_LowPriority,\n IdlePriority = Scheduler.unstable_IdlePriority,\n log$1 = Scheduler.log,\n unstable_setDisableYieldValue = Scheduler.unstable_setDisableYieldValue,\n rendererID = null,\n injectedHook = null;\nfunction setIsStrictModeForDevtools(newIsStrictMode) {\n \"function\" === typeof log$1 && unstable_setDisableYieldValue(newIsStrictMode);\n if (injectedHook && \"function\" === typeof injectedHook.setStrictMode)\n try {\n injectedHook.setStrictMode(rendererID, newIsStrictMode);\n } catch (err) {}\n}\nvar clz32 = Math.clz32 ? Math.clz32 : clz32Fallback,\n log = Math.log,\n LN2 = Math.LN2;\nfunction clz32Fallback(x) {\n x >>>= 0;\n return 0 === x ? 32 : (31 - ((log(x) / LN2) | 0)) | 0;\n}\nvar nextTransitionUpdateLane = 256,\n nextTransitionDeferredLane = 262144,\n nextRetryLane = 4194304;\nfunction getHighestPriorityLanes(lanes) {\n var pendingSyncLanes = lanes & 42;\n if (0 !== pendingSyncLanes) return pendingSyncLanes;\n switch (lanes & -lanes) {\n case 1:\n return 1;\n case 2:\n return 2;\n case 4:\n return 4;\n case 8:\n return 8;\n case 16:\n return 16;\n case 32:\n return 32;\n case 64:\n return 64;\n case 128:\n return 128;\n case 256:\n case 512:\n case 1024:\n case 2048:\n case 4096:\n case 8192:\n case 16384:\n case 32768:\n case 65536:\n case 131072:\n return lanes & 261888;\n case 262144:\n case 524288:\n case 1048576:\n case 2097152:\n return lanes & 3932160;\n case 4194304:\n case 8388608:\n case 16777216:\n case 33554432:\n return lanes & 62914560;\n case 67108864:\n return 67108864;\n case 134217728:\n return 134217728;\n case 268435456:\n return 268435456;\n case 536870912:\n return 536870912;\n case 1073741824:\n return 0;\n default:\n return lanes;\n }\n}\nfunction getNextLanes(root, wipLanes, rootHasPendingCommit) {\n var pendingLanes = root.pendingLanes;\n if (0 === pendingLanes) return 0;\n var nextLanes = 0,\n suspendedLanes = root.suspendedLanes,\n pingedLanes = root.pingedLanes;\n root = root.warmLanes;\n var nonIdlePendingLanes = pendingLanes & 134217727;\n 0 !== nonIdlePendingLanes\n ? ((pendingLanes = nonIdlePendingLanes & ~suspendedLanes),\n 0 !== pendingLanes\n ? (nextLanes = getHighestPriorityLanes(pendingLanes))\n : ((pingedLanes &= nonIdlePendingLanes),\n 0 !== pingedLanes\n ? (nextLanes = getHighestPriorityLanes(pingedLanes))\n : rootHasPendingCommit ||\n ((rootHasPendingCommit = nonIdlePendingLanes & ~root),\n 0 !== rootHasPendingCommit &&\n (nextLanes = getHighestPriorityLanes(rootHasPendingCommit)))))\n : ((nonIdlePendingLanes = pendingLanes & ~suspendedLanes),\n 0 !== nonIdlePendingLanes\n ? (nextLanes = getHighestPriorityLanes(nonIdlePendingLanes))\n : 0 !== pingedLanes\n ? (nextLanes = getHighestPriorityLanes(pingedLanes))\n : rootHasPendingCommit ||\n ((rootHasPendingCommit = pendingLanes & ~root),\n 0 !== rootHasPendingCommit &&\n (nextLanes = getHighestPriorityLanes(rootHasPendingCommit))));\n return 0 === nextLanes\n ? 0\n : 0 !== wipLanes &&\n wipLanes !== nextLanes &&\n 0 === (wipLanes & suspendedLanes) &&\n ((suspendedLanes = nextLanes & -nextLanes),\n (rootHasPendingCommit = wipLanes & -wipLanes),\n suspendedLanes >= rootHasPendingCommit ||\n (32 === suspendedLanes && 0 !== (rootHasPendingCommit & 4194048)))\n ? wipLanes\n : nextLanes;\n}\nfunction checkIfRootIsPrerendering(root, renderLanes) {\n return (\n 0 ===\n (root.pendingLanes &\n ~(root.suspendedLanes & ~root.pingedLanes) &\n renderLanes)\n );\n}\nfunction computeExpirationTime(lane, currentTime) {\n switch (lane) {\n case 1:\n case 2:\n case 4:\n case 8:\n case 64:\n return currentTime + 250;\n case 16:\n case 32:\n case 128:\n case 256:\n case 512:\n case 1024:\n case 2048:\n case 4096:\n case 8192:\n case 16384:\n case 32768:\n case 65536:\n case 131072:\n case 262144:\n case 524288:\n case 1048576:\n case 2097152:\n return currentTime + 5e3;\n case 4194304:\n case 8388608:\n case 16777216:\n case 33554432:\n return -1;\n case 67108864:\n case 134217728:\n case 268435456:\n case 536870912:\n case 1073741824:\n return -1;\n default:\n return -1;\n }\n}\nfunction claimNextRetryLane() {\n var lane = nextRetryLane;\n nextRetryLane <<= 1;\n 0 === (nextRetryLane & 62914560) && (nextRetryLane = 4194304);\n return lane;\n}\nfunction createLaneMap(initial) {\n for (var laneMap = [], i = 0; 31 > i; i++) laneMap.push(initial);\n return laneMap;\n}\nfunction markRootUpdated$1(root, updateLane) {\n root.pendingLanes |= updateLane;\n 268435456 !== updateLane &&\n ((root.suspendedLanes = 0), (root.pingedLanes = 0), (root.warmLanes = 0));\n}\nfunction markRootFinished(\n root,\n finishedLanes,\n remainingLanes,\n spawnedLane,\n updatedLanes,\n suspendedRetryLanes\n) {\n var previouslyPendingLanes = root.pendingLanes;\n root.pendingLanes = remainingLanes;\n root.suspendedLanes = 0;\n root.pingedLanes = 0;\n root.warmLanes = 0;\n root.expiredLanes &= remainingLanes;\n root.entangledLanes &= remainingLanes;\n root.errorRecoveryDisabledLanes &= remainingLanes;\n root.shellSuspendCounter = 0;\n var entanglements = root.entanglements,\n expirationTimes = root.expirationTimes,\n hiddenUpdates = root.hiddenUpdates;\n for (\n remainingLanes = previouslyPendingLanes & ~remainingLanes;\n 0 < remainingLanes;\n\n ) {\n var index$7 = 31 - clz32(remainingLanes),\n lane = 1 << index$7;\n entanglements[index$7] = 0;\n expirationTimes[index$7] = -1;\n var hiddenUpdatesForLane = hiddenUpdates[index$7];\n if (null !== hiddenUpdatesForLane)\n for (\n hiddenUpdates[index$7] = null, index$7 = 0;\n index$7 < hiddenUpdatesForLane.length;\n index$7++\n ) {\n var update = hiddenUpdatesForLane[index$7];\n null !== update && (update.lane &= -536870913);\n }\n remainingLanes &= ~lane;\n }\n 0 !== spawnedLane && markSpawnedDeferredLane(root, spawnedLane, 0);\n 0 !== suspendedRetryLanes &&\n 0 === updatedLanes &&\n 0 !== root.tag &&\n (root.suspendedLanes |=\n suspendedRetryLanes & ~(previouslyPendingLanes & ~finishedLanes));\n}\nfunction markSpawnedDeferredLane(root, spawnedLane, entangledLanes) {\n root.pendingLanes |= spawnedLane;\n root.suspendedLanes &= ~spawnedLane;\n var spawnedLaneIndex = 31 - clz32(spawnedLane);\n root.entangledLanes |= spawnedLane;\n root.entanglements[spawnedLaneIndex] =\n root.entanglements[spawnedLaneIndex] |\n 1073741824 |\n (entangledLanes & 261930);\n}\nfunction markRootEntangled(root, entangledLanes) {\n var rootEntangledLanes = (root.entangledLanes |= entangledLanes);\n for (root = root.entanglements; rootEntangledLanes; ) {\n var index$8 = 31 - clz32(rootEntangledLanes),\n lane = 1 << index$8;\n (lane & entangledLanes) | (root[index$8] & entangledLanes) &&\n (root[index$8] |= entangledLanes);\n rootEntangledLanes &= ~lane;\n }\n}\nfunction getBumpedLaneForHydration(root, renderLanes) {\n var renderLane = renderLanes & -renderLanes;\n renderLane =\n 0 !== (renderLane & 42) ? 1 : getBumpedLaneForHydrationByLane(renderLane);\n return 0 !== (renderLane & (root.suspendedLanes | renderLanes))\n ? 0\n : renderLane;\n}\nfunction getBumpedLaneForHydrationByLane(lane) {\n switch (lane) {\n case 2:\n lane = 1;\n break;\n case 8:\n lane = 4;\n break;\n case 32:\n lane = 16;\n break;\n case 256:\n case 512:\n case 1024:\n case 2048:\n case 4096:\n case 8192:\n case 16384:\n case 32768:\n case 65536:\n case 131072:\n case 262144:\n case 524288:\n case 1048576:\n case 2097152:\n case 4194304:\n case 8388608:\n case 16777216:\n case 33554432:\n lane = 128;\n break;\n case 268435456:\n lane = 134217728;\n break;\n default:\n lane = 0;\n }\n return lane;\n}\nfunction lanesToEventPriority(lanes) {\n lanes &= -lanes;\n return 2 < lanes\n ? 8 < lanes\n ? 0 !== (lanes & 134217727)\n ? 32\n : 268435456\n : 8\n : 2;\n}\nfunction resolveUpdatePriority() {\n var updatePriority = ReactDOMSharedInternals.p;\n if (0 !== updatePriority) return updatePriority;\n updatePriority = window.event;\n return void 0 === updatePriority ? 32 : getEventPriority(updatePriority.type);\n}\nfunction runWithPriority(priority, fn) {\n var previousPriority = ReactDOMSharedInternals.p;\n try {\n return (ReactDOMSharedInternals.p = priority), fn();\n } finally {\n ReactDOMSharedInternals.p = previousPriority;\n }\n}\nvar randomKey = Math.random().toString(36).slice(2),\n internalInstanceKey = \"__reactFiber$\" + randomKey,\n internalPropsKey = \"__reactProps$\" + randomKey,\n internalContainerInstanceKey = \"__reactContainer$\" + randomKey,\n internalEventHandlersKey = \"__reactEvents$\" + randomKey,\n internalEventHandlerListenersKey = \"__reactListeners$\" + randomKey,\n internalEventHandlesSetKey = \"__reactHandles$\" + randomKey,\n internalRootNodeResourcesKey = \"__reactResources$\" + randomKey,\n internalHoistableMarker = \"__reactMarker$\" + randomKey;\nfunction detachDeletedInstance(node) {\n delete node[internalInstanceKey];\n delete node[internalPropsKey];\n delete node[internalEventHandlersKey];\n delete node[internalEventHandlerListenersKey];\n delete node[internalEventHandlesSetKey];\n}\nfunction getClosestInstanceFromNode(targetNode) {\n var targetInst = targetNode[internalInstanceKey];\n if (targetInst) return targetInst;\n for (var parentNode = targetNode.parentNode; parentNode; ) {\n if (\n (targetInst =\n parentNode[internalContainerInstanceKey] ||\n parentNode[internalInstanceKey])\n ) {\n parentNode = targetInst.alternate;\n if (\n null !== targetInst.child ||\n (null !== parentNode && null !== parentNode.child)\n )\n for (\n targetNode = getParentHydrationBoundary(targetNode);\n null !== targetNode;\n\n ) {\n if ((parentNode = targetNode[internalInstanceKey])) return parentNode;\n targetNode = getParentHydrationBoundary(targetNode);\n }\n return targetInst;\n }\n targetNode = parentNode;\n parentNode = targetNode.parentNode;\n }\n return null;\n}\nfunction getInstanceFromNode(node) {\n if (\n (node = node[internalInstanceKey] || node[internalContainerInstanceKey])\n ) {\n var tag = node.tag;\n if (\n 5 === tag ||\n 6 === tag ||\n 13 === tag ||\n 31 === tag ||\n 26 === tag ||\n 27 === tag ||\n 3 === tag\n )\n return node;\n }\n return null;\n}\nfunction getNodeFromInstance(inst) {\n var tag = inst.tag;\n if (5 === tag || 26 === tag || 27 === tag || 6 === tag) return inst.stateNode;\n throw Error(formatProdErrorMessage(33));\n}\nfunction getResourcesFromRoot(root) {\n var resources = root[internalRootNodeResourcesKey];\n resources ||\n (resources = root[internalRootNodeResourcesKey] =\n { hoistableStyles: new Map(), hoistableScripts: new Map() });\n return resources;\n}\nfunction markNodeAsHoistable(node) {\n node[internalHoistableMarker] = !0;\n}\nvar allNativeEvents = new Set(),\n registrationNameDependencies = {};\nfunction registerTwoPhaseEvent(registrationName, dependencies) {\n registerDirectEvent(registrationName, dependencies);\n registerDirectEvent(registrationName + \"Capture\", dependencies);\n}\nfunction registerDirectEvent(registrationName, dependencies) {\n registrationNameDependencies[registrationName] = dependencies;\n for (\n registrationName = 0;\n registrationName < dependencies.length;\n registrationName++\n )\n allNativeEvents.add(dependencies[registrationName]);\n}\nvar VALID_ATTRIBUTE_NAME_REGEX = RegExp(\n \"^[: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]*$\"\n ),\n illegalAttributeNameCache = {},\n validatedAttributeNameCache = {};\nfunction isAttributeNameSafe(attributeName) {\n if (hasOwnProperty.call(validatedAttributeNameCache, attributeName))\n return !0;\n if (hasOwnProperty.call(illegalAttributeNameCache, attributeName)) return !1;\n if (VALID_ATTRIBUTE_NAME_REGEX.test(attributeName))\n return (validatedAttributeNameCache[attributeName] = !0);\n illegalAttributeNameCache[attributeName] = !0;\n return !1;\n}\nfunction setValueForAttribute(node, name, value) {\n if (isAttributeNameSafe(name))\n if (null === value) node.removeAttribute(name);\n else {\n switch (typeof value) {\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n node.removeAttribute(name);\n return;\n case \"boolean\":\n var prefix$10 = name.toLowerCase().slice(0, 5);\n if (\"data-\" !== prefix$10 && \"aria-\" !== prefix$10) {\n node.removeAttribute(name);\n return;\n }\n }\n node.setAttribute(name, \"\" + value);\n }\n}\nfunction setValueForKnownAttribute(node, name, value) {\n if (null === value) node.removeAttribute(name);\n else {\n switch (typeof value) {\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n case \"boolean\":\n node.removeAttribute(name);\n return;\n }\n node.setAttribute(name, \"\" + value);\n }\n}\nfunction setValueForNamespacedAttribute(node, namespace, name, value) {\n if (null === value) node.removeAttribute(name);\n else {\n switch (typeof value) {\n case \"undefined\":\n case \"function\":\n case \"symbol\":\n case \"boolean\":\n node.removeAttribute(name);\n return;\n }\n node.setAttributeNS(namespace, name, \"\" + value);\n }\n}\nfunction getToStringValue(value) {\n switch (typeof value) {\n case \"bigint\":\n case \"boolean\":\n case \"number\":\n case \"string\":\n case \"undefined\":\n return value;\n case \"object\":\n return value;\n default:\n return \"\";\n }\n}\nfunction isCheckable(elem) {\n var type = elem.type;\n return (\n (elem = elem.nodeName) &&\n \"input\" === elem.toLowerCase() &&\n (\"checkbox\" === type || \"radio\" === type)\n );\n}\nfunction trackValueOnNode(node, valueField, currentValue) {\n var descriptor = Object.getOwnPropertyDescriptor(\n node.constructor.prototype,\n valueField\n );\n if (\n !node.hasOwnProperty(valueField) &&\n \"undefined\" !== typeof descriptor &&\n \"function\" === typeof descriptor.get &&\n \"function\" === typeof descriptor.set\n ) {\n var get = descriptor.get,\n set = descriptor.set;\n Object.defineProperty(node, valueField, {\n configurable: !0,\n get: function () {\n return get.call(this);\n },\n set: function (value) {\n currentValue = \"\" + value;\n set.call(this, value);\n }\n });\n Object.defineProperty(node, valueField, {\n enumerable: descriptor.enumerable\n });\n return {\n getValue: function () {\n return currentValue;\n },\n setValue: function (value) {\n currentValue = \"\" + value;\n },\n stopTracking: function () {\n node._valueTracker = null;\n delete node[valueField];\n }\n };\n }\n}\nfunction track(node) {\n if (!node._valueTracker) {\n var valueField = isCheckable(node) ? \"checked\" : \"value\";\n node._valueTracker = trackValueOnNode(\n node,\n valueField,\n \"\" + node[valueField]\n );\n }\n}\nfunction updateValueIfChanged(node) {\n if (!node) return !1;\n var tracker = node._valueTracker;\n if (!tracker) return !0;\n var lastValue = tracker.getValue();\n var value = \"\";\n node &&\n (value = isCheckable(node)\n ? node.checked\n ? \"true\"\n : \"false\"\n : node.value);\n node = value;\n return node !== lastValue ? (tracker.setValue(node), !0) : !1;\n}\nfunction getActiveElement(doc) {\n doc = doc || (\"undefined\" !== typeof document ? document : void 0);\n if (\"undefined\" === typeof doc) return null;\n try {\n return doc.activeElement || doc.body;\n } catch (e) {\n return doc.body;\n }\n}\nvar escapeSelectorAttributeValueInsideDoubleQuotesRegex = /[\\n\"\\\\]/g;\nfunction escapeSelectorAttributeValueInsideDoubleQuotes(value) {\n return value.replace(\n escapeSelectorAttributeValueInsideDoubleQuotesRegex,\n function (ch) {\n return \"\\\\\" + ch.charCodeAt(0).toString(16) + \" \";\n }\n );\n}\nfunction updateInput(\n element,\n value,\n defaultValue,\n lastDefaultValue,\n checked,\n defaultChecked,\n type,\n name\n) {\n element.name = \"\";\n null != type &&\n \"function\" !== typeof type &&\n \"symbol\" !== typeof type &&\n \"boolean\" !== typeof type\n ? (element.type = type)\n : element.removeAttribute(\"type\");\n if (null != value)\n if (\"number\" === type) {\n if ((0 === value && \"\" === element.value) || element.value != value)\n element.value = \"\" + getToStringValue(value);\n } else\n element.value !== \"\" + getToStringValue(value) &&\n (element.value = \"\" + getToStringValue(value));\n else\n (\"submit\" !== type && \"reset\" !== type) || element.removeAttribute(\"value\");\n null != value\n ? setDefaultValue(element, type, getToStringValue(value))\n : null != defaultValue\n ? setDefaultValue(element, type, getToStringValue(defaultValue))\n : null != lastDefaultValue && element.removeAttribute(\"value\");\n null == checked &&\n null != defaultChecked &&\n (element.defaultChecked = !!defaultChecked);\n null != checked &&\n (element.checked =\n checked && \"function\" !== typeof checked && \"symbol\" !== typeof checked);\n null != name &&\n \"function\" !== typeof name &&\n \"symbol\" !== typeof name &&\n \"boolean\" !== typeof name\n ? (element.name = \"\" + getToStringValue(name))\n : element.removeAttribute(\"name\");\n}\nfunction initInput(\n element,\n value,\n defaultValue,\n checked,\n defaultChecked,\n type,\n name,\n isHydrating\n) {\n null != type &&\n \"function\" !== typeof type &&\n \"symbol\" !== typeof type &&\n \"boolean\" !== typeof type &&\n (element.type = type);\n if (null != value || null != defaultValue) {\n if (\n !(\n (\"submit\" !== type && \"reset\" !== type) ||\n (void 0 !== value && null !== value)\n )\n ) {\n track(element);\n return;\n }\n defaultValue =\n null != defaultValue ? \"\" + getToStringValue(defaultValue) : \"\";\n value = null != value ? \"\" + getToStringValue(value) : defaultValue;\n isHydrating || value === element.value || (element.value = value);\n element.defaultValue = value;\n }\n checked = null != checked ? checked : defaultChecked;\n checked =\n \"function\" !== typeof checked && \"symbol\" !== typeof checked && !!checked;\n element.checked = isHydrating ? element.checked : !!checked;\n element.defaultChecked = !!checked;\n null != name &&\n \"function\" !== typeof name &&\n \"symbol\" !== typeof name &&\n \"boolean\" !== typeof name &&\n (element.name = name);\n track(element);\n}\nfunction setDefaultValue(node, type, value) {\n (\"number\" === type && getActiveElement(node.ownerDocument) === node) ||\n node.defaultValue === \"\" + value ||\n (node.defaultValue = \"\" + value);\n}\nfunction updateOptions(node, multiple, propValue, setDefaultSelected) {\n node = node.options;\n if (multiple) {\n multiple = {};\n for (var i = 0; i < propValue.length; i++)\n multiple[\"$\" + propValue[i]] = !0;\n for (propValue = 0; propValue < node.length; propValue++)\n (i = multiple.hasOwnProperty(\"$\" + node[propValue].value)),\n node[propValue].selected !== i && (node[propValue].selected = i),\n i && setDefaultSelected && (node[propValue].defaultSelected = !0);\n } else {\n propValue = \"\" + getToStringValue(propValue);\n multiple = null;\n for (i = 0; i < node.length; i++) {\n if (node[i].value === propValue) {\n node[i].selected = !0;\n setDefaultSelected && (node[i].defaultSelected = !0);\n return;\n }\n null !== multiple || node[i].disabled || (multiple = node[i]);\n }\n null !== multiple && (multiple.selected = !0);\n }\n}\nfunction updateTextarea(element, value, defaultValue) {\n if (\n null != value &&\n ((value = \"\" + getToStringValue(value)),\n value !== element.value && (element.value = value),\n null == defaultValue)\n ) {\n element.defaultValue !== value && (element.defaultValue = value);\n return;\n }\n element.defaultValue =\n null != defaultValue ? \"\" + getToStringValue(defaultValue) : \"\";\n}\nfunction initTextarea(element, value, defaultValue, children) {\n if (null == value) {\n if (null != children) {\n if (null != defaultValue) throw Error(formatProdErrorMessage(92));\n if (isArrayImpl(children)) {\n if (1 < children.length) throw Error(formatProdErrorMessage(93));\n children = children[0];\n }\n defaultValue = children;\n }\n null == defaultValue && (defaultValue = \"\");\n value = defaultValue;\n }\n defaultValue = getToStringValue(value);\n element.defaultValue = defaultValue;\n children = element.textContent;\n children === defaultValue &&\n \"\" !== children &&\n null !== children &&\n (element.value = children);\n track(element);\n}\nfunction setTextContent(node, text) {\n if (text) {\n var firstChild = node.firstChild;\n if (\n firstChild &&\n firstChild === node.lastChild &&\n 3 === firstChild.nodeType\n ) {\n firstChild.nodeValue = text;\n return;\n }\n }\n node.textContent = text;\n}\nvar unitlessNumbers = new Set(\n \"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(\n \" \"\n )\n);\nfunction setValueForStyle(style, styleName, value) {\n var isCustomProperty = 0 === styleName.indexOf(\"--\");\n null == value || \"boolean\" === typeof value || \"\" === value\n ? isCustomProperty\n ? style.setProperty(styleName, \"\")\n : \"float\" === styleName\n ? (style.cssFloat = \"\")\n : (style[styleName] = \"\")\n : isCustomProperty\n ? style.setProperty(styleName, value)\n : \"number\" !== typeof value ||\n 0 === value ||\n unitlessNumbers.has(styleName)\n ? \"float\" === styleName\n ? (style.cssFloat = value)\n : (style[styleName] = (\"\" + value).trim())\n : (style[styleName] = value + \"px\");\n}\nfunction setValueForStyles(node, styles, prevStyles) {\n if (null != styles && \"object\" !== typeof styles)\n throw Error(formatProdErrorMessage(62));\n node = node.style;\n if (null != prevStyles) {\n for (var styleName in prevStyles)\n !prevStyles.hasOwnProperty(styleName) ||\n (null != styles && styles.hasOwnProperty(styleName)) ||\n (0 === styleName.indexOf(\"--\")\n ? node.setProperty(styleName, \"\")\n : \"float\" === styleName\n ? (node.cssFloat = \"\")\n : (node[styleName] = \"\"));\n for (var styleName$16 in styles)\n (styleName = styles[styleName$16]),\n styles.hasOwnProperty(styleName$16) &&\n prevStyles[styleName$16] !== styleName &&\n setValueForStyle(node, styleName$16, styleName);\n } else\n for (var styleName$17 in styles)\n styles.hasOwnProperty(styleName$17) &&\n setValueForStyle(node, styleName$17, styles[styleName$17]);\n}\nfunction isCustomElement(tagName) {\n if (-1 === tagName.indexOf(\"-\")) return !1;\n switch (tagName) {\n case \"annotation-xml\":\n case \"color-profile\":\n case \"font-face\":\n case \"font-face-src\":\n case \"font-face-uri\":\n case \"font-face-format\":\n case \"font-face-name\":\n case \"missing-glyph\":\n return !1;\n default:\n return !0;\n }\n}\nvar aliases = new Map([\n [\"acceptCharset\", \"accept-charset\"],\n [\"htmlFor\", \"for\"],\n [\"httpEquiv\", \"http-equiv\"],\n [\"crossOrigin\", \"crossorigin\"],\n [\"accentHeight\", \"accent-height\"],\n [\"alignmentBaseline\", \"alignment-baseline\"],\n [\"arabicForm\", \"arabic-form\"],\n [\"baselineShift\", \"baseline-shift\"],\n [\"capHeight\", \"cap-height\"],\n [\"clipPath\", \"clip-path\"],\n [\"clipRule\", \"clip-rule\"],\n [\"colorInterpolation\", \"color-interpolation\"],\n [\"colorInterpolationFilters\", \"color-interpolation-filters\"],\n [\"colorProfile\", \"color-profile\"],\n [\"colorRendering\", \"color-rendering\"],\n [\"dominantBaseline\", \"dominant-baseline\"],\n [\"enableBackground\", \"enable-background\"],\n [\"fillOpacity\", \"fill-opacity\"],\n [\"fillRule\", \"fill-rule\"],\n [\"floodColor\", \"flood-color\"],\n [\"floodOpacity\", \"flood-opacity\"],\n [\"fontFamily\", \"font-family\"],\n [\"fontSize\", \"font-size\"],\n [\"fontSizeAdjust\", \"font-size-adjust\"],\n [\"fontStretch\", \"font-stretch\"],\n [\"fontStyle\", \"font-style\"],\n [\"fontVariant\", \"font-variant\"],\n [\"fontWeight\", \"font-weight\"],\n [\"glyphName\", \"glyph-name\"],\n [\"glyphOrientationHorizontal\", \"glyph-orientation-horizontal\"],\n [\"glyphOrientationVertical\", \"glyph-orientation-vertical\"],\n [\"horizAdvX\", \"horiz-adv-x\"],\n [\"horizOriginX\", \"horiz-origin-x\"],\n [\"imageRendering\", \"image-rendering\"],\n [\"letterSpacing\", \"letter-spacing\"],\n [\"lightingColor\", \"lighting-color\"],\n [\"markerEnd\", \"marker-end\"],\n [\"markerMid\", \"marker-mid\"],\n [\"markerStart\", \"marker-start\"],\n [\"overlinePosition\", \"overline-position\"],\n [\"overlineThickness\", \"overline-thickness\"],\n [\"paintOrder\", \"paint-order\"],\n [\"panose-1\", \"panose-1\"],\n [\"pointerEvents\", \"pointer-events\"],\n [\"renderingIntent\", \"rendering-intent\"],\n [\"shapeRendering\", \"shape-rendering\"],\n [\"stopColor\", \"stop-color\"],\n [\"stopOpacity\", \"stop-opacity\"],\n [\"strikethroughPosition\", \"strikethrough-position\"],\n [\"strikethroughThickness\", \"strikethrough-thickness\"],\n [\"strokeDasharray\", \"stroke-dasharray\"],\n [\"strokeDashoffset\", \"stroke-dashoffset\"],\n [\"strokeLinecap\", \"stroke-linecap\"],\n [\"strokeLinejoin\", \"stroke-linejoin\"],\n [\"strokeMiterlimit\", \"stroke-miterlimit\"],\n [\"strokeOpacity\", \"stroke-opacity\"],\n [\"strokeWidth\", \"stroke-width\"],\n [\"textAnchor\", \"text-anchor\"],\n [\"textDecoration\", \"text-decoration\"],\n [\"textRendering\", \"text-rendering\"],\n [\"transformOrigin\", \"transform-origin\"],\n [\"underlinePosition\", \"underline-position\"],\n [\"underlineThickness\", \"underline-thickness\"],\n [\"unicodeBidi\", \"unicode-bidi\"],\n [\"unicodeRange\", \"unicode-range\"],\n [\"unitsPerEm\", \"units-per-em\"],\n [\"vAlphabetic\", \"v-alphabetic\"],\n [\"vHanging\", \"v-hanging\"],\n [\"vIdeographic\", \"v-ideographic\"],\n [\"vMathematical\", \"v-mathematical\"],\n [\"vectorEffect\", \"vector-effect\"],\n [\"vertAdvY\", \"vert-adv-y\"],\n [\"vertOriginX\", \"vert-origin-x\"],\n [\"vertOriginY\", \"vert-origin-y\"],\n [\"wordSpacing\", \"word-spacing\"],\n [\"writingMode\", \"writing-mode\"],\n [\"xmlnsXlink\", \"xmlns:xlink\"],\n [\"xHeight\", \"x-height\"]\n ]),\n isJavaScriptProtocol =\n /^[\\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;\nfunction sanitizeURL(url) {\n return isJavaScriptProtocol.test(\"\" + url)\n ? \"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')\"\n : url;\n}\nfunction noop$1() {}\nvar currentReplayingEvent = null;\nfunction getEventTarget(nativeEvent) {\n nativeEvent = nativeEvent.target || nativeEvent.srcElement || window;\n nativeEvent.correspondingUseElement &&\n (nativeEvent = nativeEvent.correspondingUseElement);\n return 3 === nativeEvent.nodeType ? nativeEvent.parentNode : nativeEvent;\n}\nvar restoreTarget = null,\n restoreQueue = null;\nfunction restoreStateOfTarget(target) {\n var internalInstance = getInstanceFromNode(target);\n if (internalInstance && (target = internalInstance.stateNode)) {\n var props = target[internalPropsKey] || null;\n a: switch (((target = internalInstance.stateNode), internalInstance.type)) {\n case \"input\":\n updateInput(\n target,\n props.value,\n props.defaultValue,\n props.defaultValue,\n props.checked,\n props.defaultChecked,\n props.type,\n props.name\n );\n internalInstance = props.name;\n if (\"radio\" === props.type && null != internalInstance) {\n for (props = target; props.parentNode; ) props = props.parentNode;\n props = props.querySelectorAll(\n 'input[name=\"' +\n escapeSelectorAttributeValueInsideDoubleQuotes(\n \"\" + internalInstance\n ) +\n '\"][type=\"radio\"]'\n );\n for (\n internalInstance = 0;\n internalInstance < props.length;\n internalInstance++\n ) {\n var otherNode = props[internalInstance];\n if (otherNode !== target && otherNode.form === target.form) {\n var otherProps = otherNode[internalPropsKey] || null;\n if (!otherProps) throw Error(formatProdErrorMessage(90));\n updateInput(\n otherNode,\n otherProps.value,\n otherProps.defaultValue,\n otherProps.defaultValue,\n otherProps.checked,\n otherProps.defaultChecked,\n otherProps.type,\n otherProps.name\n );\n }\n }\n for (\n internalInstance = 0;\n internalInstance < props.length;\n internalInstance++\n )\n (otherNode = props[internalInstance]),\n otherNode.form === target.form && updateValueIfChanged(otherNode);\n }\n break a;\n case \"textarea\":\n updateTextarea(target, props.value, props.defaultValue);\n break a;\n case \"select\":\n (internalInstance = props.value),\n null != internalInstance &&\n updateOptions(target, !!props.multiple, internalInstance, !1);\n }\n }\n}\nvar isInsideEventHandler = !1;\nfunction batchedUpdates$1(fn, a, b) {\n if (isInsideEventHandler) return fn(a, b);\n isInsideEventHandler = !0;\n try {\n var JSCompiler_inline_result = fn(a);\n return JSCompiler_inline_result;\n } finally {\n if (\n ((isInsideEventHandler = !1),\n null !== restoreTarget || null !== restoreQueue)\n )\n if (\n (flushSyncWork$1(),\n restoreTarget &&\n ((a = restoreTarget),\n (fn = restoreQueue),\n (restoreQueue = restoreTarget = null),\n restoreStateOfTarget(a),\n fn))\n )\n for (a = 0; a < fn.length; a++) restoreStateOfTarget(fn[a]);\n }\n}\nfunction getListener(inst, registrationName) {\n var stateNode = inst.stateNode;\n if (null === stateNode) return null;\n var props = stateNode[internalPropsKey] || null;\n if (null === props) return null;\n stateNode = props[registrationName];\n a: switch (registrationName) {\n case \"onClick\":\n case \"onClickCapture\":\n case \"onDoubleClick\":\n case \"onDoubleClickCapture\":\n case \"onMouseDown\":\n case \"onMouseDownCapture\":\n case \"onMouseMove\":\n case \"onMouseMoveCapture\":\n case \"onMouseUp\":\n case \"onMouseUpCapture\":\n case \"onMouseEnter\":\n (props = !props.disabled) ||\n ((inst = inst.type),\n (props = !(\n \"button\" === inst ||\n \"input\" === inst ||\n \"select\" === inst ||\n \"textarea\" === inst\n )));\n inst = !props;\n break a;\n default:\n inst = !1;\n }\n if (inst) return null;\n if (stateNode && \"function\" !== typeof stateNode)\n throw Error(\n formatProdErrorMessage(231, registrationName, typeof stateNode)\n );\n return stateNode;\n}\nvar canUseDOM = !(\n \"undefined\" === typeof window ||\n \"undefined\" === typeof window.document ||\n \"undefined\" === typeof window.document.createElement\n ),\n passiveBrowserEventsSupported = !1;\nif (canUseDOM)\n try {\n var options = {};\n Object.defineProperty(options, \"passive\", {\n get: function () {\n passiveBrowserEventsSupported = !0;\n }\n });\n window.addEventListener(\"test\", options, options);\n window.removeEventListener(\"test\", options, options);\n } catch (e) {\n passiveBrowserEventsSupported = !1;\n }\nvar root = null,\n startText = null,\n fallbackText = null;\nfunction getData() {\n if (fallbackText) return fallbackText;\n var start,\n startValue = startText,\n startLength = startValue.length,\n end,\n endValue = \"value\" in root ? root.value : root.textContent,\n endLength = endValue.length;\n for (\n start = 0;\n start < startLength && startValue[start] === endValue[start];\n start++\n );\n var minEnd = startLength - start;\n for (\n end = 1;\n end <= minEnd &&\n startValue[startLength - end] === endValue[endLength - end];\n end++\n );\n return (fallbackText = endValue.slice(start, 1 < end ? 1 - end : void 0));\n}\nfunction getEventCharCode(nativeEvent) {\n var keyCode = nativeEvent.keyCode;\n \"charCode\" in nativeEvent\n ? ((nativeEvent = nativeEvent.charCode),\n 0 === nativeEvent && 13 === keyCode && (nativeEvent = 13))\n : (nativeEvent = keyCode);\n 10 === nativeEvent && (nativeEvent = 13);\n return 32 <= nativeEvent || 13 === nativeEvent ? nativeEvent : 0;\n}\nfunction functionThatReturnsTrue() {\n return !0;\n}\nfunction functionThatReturnsFalse() {\n return !1;\n}\nfunction createSyntheticEvent(Interface) {\n function SyntheticBaseEvent(\n reactName,\n reactEventType,\n targetInst,\n nativeEvent,\n nativeEventTarget\n ) {\n this._reactName = reactName;\n this._targetInst = targetInst;\n this.type = reactEventType;\n this.nativeEvent = nativeEvent;\n this.target = nativeEventTarget;\n this.currentTarget = null;\n for (var propName in Interface)\n Interface.hasOwnProperty(propName) &&\n ((reactName = Interface[propName]),\n (this[propName] = reactName\n ? reactName(nativeEvent)\n : nativeEvent[propName]));\n this.isDefaultPrevented = (\n null != nativeEvent.defaultPrevented\n ? nativeEvent.defaultPrevented\n : !1 === nativeEvent.returnValue\n )\n ? functionThatReturnsTrue\n : functionThatReturnsFalse;\n this.isPropagationStopped = functionThatReturnsFalse;\n return this;\n }\n assign(SyntheticBaseEvent.prototype, {\n preventDefault: function () {\n this.defaultPrevented = !0;\n var event = this.nativeEvent;\n event &&\n (event.preventDefault\n ? event.preventDefault()\n : \"unknown\" !== typeof event.returnValue && (event.returnValue = !1),\n (this.isDefaultPrevented = functionThatReturnsTrue));\n },\n stopPropagation: function () {\n var event = this.nativeEvent;\n event &&\n (event.stopPropagation\n ? event.stopPropagation()\n : \"unknown\" !== typeof event.cancelBubble &&\n (event.cancelBubble = !0),\n (this.isPropagationStopped = functionThatReturnsTrue));\n },\n persist: function () {},\n isPersistent: functionThatReturnsTrue\n });\n return SyntheticBaseEvent;\n}\nvar EventInterface = {\n eventPhase: 0,\n bubbles: 0,\n cancelable: 0,\n timeStamp: function (event) {\n return event.timeStamp || Date.now();\n },\n defaultPrevented: 0,\n isTrusted: 0\n },\n SyntheticEvent = createSyntheticEvent(EventInterface),\n UIEventInterface = assign({}, EventInterface, { view: 0, detail: 0 }),\n SyntheticUIEvent = createSyntheticEvent(UIEventInterface),\n lastMovementX,\n lastMovementY,\n lastMouseEvent,\n MouseEventInterface = assign({}, UIEventInterface, {\n screenX: 0,\n screenY: 0,\n clientX: 0,\n clientY: 0,\n pageX: 0,\n pageY: 0,\n ctrlKey: 0,\n shiftKey: 0,\n altKey: 0,\n metaKey: 0,\n getModifierState: getEventModifierState,\n button: 0,\n buttons: 0,\n relatedTarget: function (event) {\n return void 0 === event.relatedTarget\n ? event.fromElement === event.srcElement\n ? event.toElement\n : event.fromElement\n : event.relatedTarget;\n },\n movementX: function (event) {\n if (\"movementX\" in event) return event.movementX;\n event !== lastMouseEvent &&\n (lastMouseEvent && \"mousemove\" === event.type\n ? ((lastMovementX = event.screenX - lastMouseEvent.screenX),\n (lastMovementY = event.screenY - lastMouseEvent.screenY))\n : (lastMovementY = lastMovementX = 0),\n (lastMouseEvent = event));\n return lastMovementX;\n },\n movementY: function (event) {\n return \"movementY\" in event ? event.movementY : lastMovementY;\n }\n }),\n SyntheticMouseEvent = createSyntheticEvent(MouseEventInterface),\n DragEventInterface = assign({}, MouseEventInterface, { dataTransfer: 0 }),\n SyntheticDragEvent = createSyntheticEvent(DragEventInterface),\n FocusEventInterface = assign({}, UIEventInterface, { relatedTarget: 0 }),\n SyntheticFocusEvent = createSyntheticEvent(FocusEventInterface),\n AnimationEventInterface = assign({}, EventInterface, {\n animationName: 0,\n elapsedTime: 0,\n pseudoElement: 0\n }),\n SyntheticAnimationEvent = createSyntheticEvent(AnimationEventInterface),\n ClipboardEventInterface = assign({}, EventInterface, {\n clipboardData: function (event) {\n return \"clipboardData\" in event\n ? event.clipboardData\n : window.clipboardData;\n }\n }),\n SyntheticClipboardEvent = createSyntheticEvent(ClipboardEventInterface),\n CompositionEventInterface = assign({}, EventInterface, { data: 0 }),\n SyntheticCompositionEvent = createSyntheticEvent(CompositionEventInterface),\n normalizeKey = {\n Esc: \"Escape\",\n Spacebar: \" \",\n Left: \"ArrowLeft\",\n Up: \"ArrowUp\",\n Right: \"ArrowRight\",\n Down: \"ArrowDown\",\n Del: \"Delete\",\n Win: \"OS\",\n Menu: \"ContextMenu\",\n Apps: \"ContextMenu\",\n Scroll: \"ScrollLock\",\n MozPrintableKey: \"Unidentified\"\n },\n translateToKey = {\n 8: \"Backspace\",\n 9: \"Tab\",\n 12: \"Clear\",\n 13: \"Enter\",\n 16: \"Shift\",\n 17: \"Control\",\n 18: \"Alt\",\n 19: \"Pause\",\n 20: \"CapsLock\",\n 27: \"Escape\",\n 32: \" \",\n 33: \"PageUp\",\n 34: \"PageDown\",\n 35: \"End\",\n 36: \"Home\",\n 37: \"ArrowLeft\",\n 38: \"ArrowUp\",\n 39: \"ArrowRight\",\n 40: \"ArrowDown\",\n 45: \"Insert\",\n 46: \"Delete\",\n 112: \"F1\",\n 113: \"F2\",\n 114: \"F3\",\n 115: \"F4\",\n 116: \"F5\",\n 117: \"F6\",\n 118: \"F7\",\n 119: \"F8\",\n 120: \"F9\",\n 121: \"F10\",\n 122: \"F11\",\n 123: \"F12\",\n 144: \"NumLock\",\n 145: \"ScrollLock\",\n 224: \"Meta\"\n },\n modifierKeyToProp = {\n Alt: \"altKey\",\n Control: \"ctrlKey\",\n Meta: \"metaKey\",\n Shift: \"shiftKey\"\n };\nfunction modifierStateGetter(keyArg) {\n var nativeEvent = this.nativeEvent;\n return nativeEvent.getModifierState\n ? nativeEvent.getModifierState(keyArg)\n : (keyArg = modifierKeyToProp[keyArg])\n ? !!nativeEvent[keyArg]\n : !1;\n}\nfunction getEventModifierState() {\n return modifierStateGetter;\n}\nvar KeyboardEventInterface = assign({}, UIEventInterface, {\n key: function (nativeEvent) {\n if (nativeEvent.key) {\n var key = normalizeKey[nativeEvent.key] || nativeEvent.key;\n if (\"Unidentified\" !== key) return key;\n }\n return \"keypress\" === nativeEvent.type\n ? ((nativeEvent = getEventCharCode(nativeEvent)),\n 13 === nativeEvent ? \"Enter\" : String.fromCharCode(nativeEvent))\n : \"keydown\" === nativeEvent.type || \"keyup\" === nativeEvent.type\n ? translateToKey[nativeEvent.keyCode] || \"Unidentified\"\n : \"\";\n },\n code: 0,\n location: 0,\n ctrlKey: 0,\n shiftKey: 0,\n altKey: 0,\n metaKey: 0,\n repeat: 0,\n locale: 0,\n getModifierState: getEventModifierState,\n charCode: function (event) {\n return \"keypress\" === event.type ? getEventCharCode(event) : 0;\n },\n keyCode: function (event) {\n return \"keydown\" === event.type || \"keyup\" === event.type\n ? event.keyCode\n : 0;\n },\n which: function (event) {\n return \"keypress\" === event.type\n ? getEventCharCode(event)\n : \"keydown\" === event.type || \"keyup\" === event.type\n ? event.keyCode\n : 0;\n }\n }),\n SyntheticKeyboardEvent = createSyntheticEvent(KeyboardEventInterface),\n PointerEventInterface = assign({}, MouseEventInterface, {\n pointerId: 0,\n width: 0,\n height: 0,\n pressure: 0,\n tangentialPressure: 0,\n tiltX: 0,\n tiltY: 0,\n twist: 0,\n pointerType: 0,\n isPrimary: 0\n }),\n SyntheticPointerEvent = createSyntheticEvent(PointerEventInterface),\n TouchEventInterface = assign({}, UIEventInterface, {\n touches: 0,\n targetTouches: 0,\n changedTouches: 0,\n altKey: 0,\n metaKey: 0,\n ctrlKey: 0,\n shiftKey: 0,\n getModifierState: getEventModifierState\n }),\n SyntheticTouchEvent = createSyntheticEvent(TouchEventInterface),\n TransitionEventInterface = assign({}, EventInterface, {\n propertyName: 0,\n elapsedTime: 0,\n pseudoElement: 0\n }),\n SyntheticTransitionEvent = createSyntheticEvent(TransitionEventInterface),\n WheelEventInterface = assign({}, MouseEventInterface, {\n deltaX: function (event) {\n return \"deltaX\" in event\n ? event.deltaX\n : \"wheelDeltaX\" in event\n ? -event.wheelDeltaX\n : 0;\n },\n deltaY: function (event) {\n return \"deltaY\" in event\n ? event.deltaY\n : \"wheelDeltaY\" in event\n ? -event.wheelDeltaY\n : \"wheelDelta\" in event\n ? -event.wheelDelta\n : 0;\n },\n deltaZ: 0,\n deltaMode: 0\n }),\n SyntheticWheelEvent = createSyntheticEvent(WheelEventInterface),\n ToggleEventInterface = assign({}, EventInterface, {\n newState: 0,\n oldState: 0\n }),\n SyntheticToggleEvent = createSyntheticEvent(ToggleEventInterface),\n END_KEYCODES = [9, 13, 27, 32],\n canUseCompositionEvent = canUseDOM && \"CompositionEvent\" in window,\n documentMode = null;\ncanUseDOM &&\n \"documentMode\" in document &&\n (documentMode = document.documentMode);\nvar canUseTextInputEvent = canUseDOM && \"TextEvent\" in window && !documentMode,\n useFallbackCompositionData =\n canUseDOM &&\n (!canUseCompositionEvent ||\n (documentMode && 8 < documentMode && 11 >= documentMode)),\n SPACEBAR_CHAR = String.fromCharCode(32),\n hasSpaceKeypress = !1;\nfunction isFallbackCompositionEnd(domEventName, nativeEvent) {\n switch (domEventName) {\n case \"keyup\":\n return -1 !== END_KEYCODES.indexOf(nativeEvent.keyCode);\n case \"keydown\":\n return 229 !== nativeEvent.keyCode;\n case \"keypress\":\n case \"mousedown\":\n case \"focusout\":\n return !0;\n default:\n return !1;\n }\n}\nfunction getDataFromCustomEvent(nativeEvent) {\n nativeEvent = nativeEvent.detail;\n return \"object\" === typeof nativeEvent && \"data\" in nativeEvent\n ? nativeEvent.data\n : null;\n}\nvar isComposing = !1;\nfunction getNativeBeforeInputChars(domEventName, nativeEvent) {\n switch (domEventName) {\n case \"compositionend\":\n return getDataFromCustomEvent(nativeEvent);\n case \"keypress\":\n if (32 !== nativeEvent.which) return null;\n hasSpaceKeypress = !0;\n return SPACEBAR_CHAR;\n case \"textInput\":\n return (\n (domEventName = nativeEvent.data),\n domEventName === SPACEBAR_CHAR && hasSpaceKeypress ? null : domEventName\n );\n default:\n return null;\n }\n}\nfunction getFallbackBeforeInputChars(domEventName, nativeEvent) {\n if (isComposing)\n return \"compositionend\" === domEventName ||\n (!canUseCompositionEvent &&\n isFallbackCompositionEnd(domEventName, nativeEvent))\n ? ((domEventName = getData()),\n (fallbackText = startText = root = null),\n (isComposing = !1),\n domEventName)\n : null;\n switch (domEventName) {\n case \"paste\":\n return null;\n case \"keypress\":\n if (\n !(nativeEvent.ctrlKey || nativeEvent.altKey || nativeEvent.metaKey) ||\n (nativeEvent.ctrlKey && nativeEvent.altKey)\n ) {\n if (nativeEvent.char && 1 < nativeEvent.char.length)\n return nativeEvent.char;\n if (nativeEvent.which) return String.fromCharCode(nativeEvent.which);\n }\n return null;\n case \"compositionend\":\n return useFallbackCompositionData && \"ko\" !== nativeEvent.locale\n ? null\n : nativeEvent.data;\n default:\n return null;\n }\n}\nvar supportedInputTypes = {\n color: !0,\n date: !0,\n datetime: !0,\n \"datetime-local\": !0,\n email: !0,\n month: !0,\n number: !0,\n password: !0,\n range: !0,\n search: !0,\n tel: !0,\n text: !0,\n time: !0,\n url: !0,\n week: !0\n};\nfunction isTextInputElement(elem) {\n var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();\n return \"input\" === nodeName\n ? !!supportedInputTypes[elem.type]\n : \"textarea\" === nodeName\n ? !0\n : !1;\n}\nfunction createAndAccumulateChangeEvent(\n dispatchQueue,\n inst,\n nativeEvent,\n target\n) {\n restoreTarget\n ? restoreQueue\n ? restoreQueue.push(target)\n : (restoreQueue = [target])\n : (restoreTarget = target);\n inst = accumulateTwoPhaseListeners(inst, \"onChange\");\n 0 < inst.length &&\n ((nativeEvent = new SyntheticEvent(\n \"onChange\",\n \"change\",\n null,\n nativeEvent,\n target\n )),\n dispatchQueue.push({ event: nativeEvent, listeners: inst }));\n}\nvar activeElement$1 = null,\n activeElementInst$1 = null;\nfunction runEventInBatch(dispatchQueue) {\n processDispatchQueue(dispatchQueue, 0);\n}\nfunction getInstIfValueChanged(targetInst) {\n var targetNode = getNodeFromInstance(targetInst);\n if (updateValueIfChanged(targetNode)) return targetInst;\n}\nfunction getTargetInstForChangeEvent(domEventName, targetInst) {\n if (\"change\" === domEventName) return targetInst;\n}\nvar isInputEventSupported = !1;\nif (canUseDOM) {\n var JSCompiler_inline_result$jscomp$286;\n if (canUseDOM) {\n var isSupported$jscomp$inline_427 = \"oninput\" in document;\n if (!isSupported$jscomp$inline_427) {\n var element$jscomp$inline_428 = document.createElement(\"div\");\n element$jscomp$inline_428.setAttribute(\"oninput\", \"return;\");\n isSupported$jscomp$inline_427 =\n \"function\" === typeof element$jscomp$inline_428.oninput;\n }\n JSCompiler_inline_result$jscomp$286 = isSupported$jscomp$inline_427;\n } else JSCompiler_inline_result$jscomp$286 = !1;\n isInputEventSupported =\n JSCompiler_inline_result$jscomp$286 &&\n (!document.documentMode || 9 < document.documentMode);\n}\nfunction stopWatchingForValueChange() {\n activeElement$1 &&\n (activeElement$1.detachEvent(\"onpropertychange\", handlePropertyChange),\n (activeElementInst$1 = activeElement$1 = null));\n}\nfunction handlePropertyChange(nativeEvent) {\n if (\n \"value\" === nativeEvent.propertyName &&\n getInstIfValueChanged(activeElementInst$1)\n ) {\n var dispatchQueue = [];\n createAndAccumulateChangeEvent(\n dispatchQueue,\n activeElementInst$1,\n nativeEvent,\n getEventTarget(nativeEvent)\n );\n batchedUpdates$1(runEventInBatch, dispatchQueue);\n }\n}\nfunction handleEventsForInputEventPolyfill(domEventName, target, targetInst) {\n \"focusin\" === domEventName\n ? (stopWatchingForValueChange(),\n (activeElement$1 = target),\n (activeElementInst$1 = targetInst),\n activeElement$1.attachEvent(\"onpropertychange\", handlePropertyChange))\n : \"focusout\" === domEventName && stopWatchingForValueChange();\n}\nfunction getTargetInstForInputEventPolyfill(domEventName) {\n if (\n \"selectionchange\" === domEventName ||\n \"keyup\" === domEventName ||\n \"keydown\" === domEventName\n )\n return getInstIfValueChanged(activeElementInst$1);\n}\nfunction getTargetInstForClickEvent(domEventName, targetInst) {\n if (\"click\" === domEventName) return getInstIfValueChanged(targetInst);\n}\nfunction getTargetInstForInputOrChangeEvent(domEventName, targetInst) {\n if (\"input\" === domEventName || \"change\" === domEventName)\n return getInstIfValueChanged(targetInst);\n}\nfunction is(x, y) {\n return (x === y && (0 !== x || 1 / x === 1 / y)) || (x !== x && y !== y);\n}\nvar objectIs = \"function\" === typeof Object.is ? Object.is : is;\nfunction shallowEqual(objA, objB) {\n if (objectIs(objA, objB)) return !0;\n if (\n \"object\" !== typeof objA ||\n null === objA ||\n \"object\" !== typeof objB ||\n null === objB\n )\n return !1;\n var keysA = Object.keys(objA),\n keysB = Object.keys(objB);\n if (keysA.length !== keysB.length) return !1;\n for (keysB = 0; keysB < keysA.length; keysB++) {\n var currentKey = keysA[keysB];\n if (\n !hasOwnProperty.call(objB, currentKey) ||\n !objectIs(objA[currentKey], objB[currentKey])\n )\n return !1;\n }\n return !0;\n}\nfunction getLeafNode(node) {\n for (; node && node.firstChild; ) node = node.firstChild;\n return node;\n}\nfunction getNodeForCharacterOffset(root, offset) {\n var node = getLeafNode(root);\n root = 0;\n for (var nodeEnd; node; ) {\n if (3 === node.nodeType) {\n nodeEnd = root + node.textContent.length;\n if (root <= offset && nodeEnd >= offset)\n return { node: node, offset: offset - root };\n root = nodeEnd;\n }\n a: {\n for (; node; ) {\n if (node.nextSibling) {\n node = node.nextSibling;\n break a;\n }\n node = node.parentNode;\n }\n node = void 0;\n }\n node = getLeafNode(node);\n }\n}\nfunction containsNode(outerNode, innerNode) {\n return outerNode && innerNode\n ? outerNode === innerNode\n ? !0\n : outerNode && 3 === outerNode.nodeType\n ? !1\n : innerNode && 3 === innerNode.nodeType\n ? containsNode(outerNode, innerNode.parentNode)\n : \"contains\" in outerNode\n ? outerNode.contains(innerNode)\n : outerNode.compareDocumentPosition\n ? !!(outerNode.compareDocumentPosition(innerNode) & 16)\n : !1\n : !1;\n}\nfunction getActiveElementDeep(containerInfo) {\n containerInfo =\n null != containerInfo &&\n null != containerInfo.ownerDocument &&\n null != containerInfo.ownerDocument.defaultView\n ? containerInfo.ownerDocument.defaultView\n : window;\n for (\n var element = getActiveElement(containerInfo.document);\n element instanceof containerInfo.HTMLIFrameElement;\n\n ) {\n try {\n var JSCompiler_inline_result =\n \"string\" === typeof element.contentWindow.location.href;\n } catch (err) {\n JSCompiler_inline_result = !1;\n }\n if (JSCompiler_inline_result) containerInfo = element.contentWindow;\n else break;\n element = getActiveElement(containerInfo.document);\n }\n return element;\n}\nfunction hasSelectionCapabilities(elem) {\n var nodeName = elem && elem.nodeName && elem.nodeName.toLowerCase();\n return (\n nodeName &&\n ((\"input\" === nodeName &&\n (\"text\" === elem.type ||\n \"search\" === elem.type ||\n \"tel\" === elem.type ||\n \"url\" === elem.type ||\n \"password\" === elem.type)) ||\n \"textarea\" === nodeName ||\n \"true\" === elem.contentEditable)\n );\n}\nvar skipSelectionChangeEvent =\n canUseDOM && \"documentMode\" in document && 11 >= document.documentMode,\n activeElement = null,\n activeElementInst = null,\n lastSelection = null,\n mouseDown = !1;\nfunction constructSelectEvent(dispatchQueue, nativeEvent, nativeEventTarget) {\n var doc =\n nativeEventTarget.window === nativeEventTarget\n ? nativeEventTarget.document\n : 9 === nativeEventTarget.nodeType\n ? nativeEventTarget\n : nativeEventTarget.ownerDocument;\n mouseDown ||\n null == activeElement ||\n activeElement !== getActiveElement(doc) ||\n ((doc = activeElement),\n \"selectionStart\" in doc && hasSelectionCapabilities(doc)\n ? (doc = { start: doc.selectionStart, end: doc.selectionEnd })\n : ((doc = (\n (doc.ownerDocument && doc.ownerDocument.defaultView) ||\n window\n ).getSelection()),\n (doc = {\n anchorNode: doc.anchorNode,\n anchorOffset: doc.anchorOffset,\n focusNode: doc.focusNode,\n focusOffset: doc.focusOffset\n })),\n (lastSelection && shallowEqual(lastSelection, doc)) ||\n ((lastSelection = doc),\n (doc = accumulateTwoPhaseListeners(activeElementInst, \"onSelect\")),\n 0 < doc.length &&\n ((nativeEvent = new SyntheticEvent(\n \"onSelect\",\n \"select\",\n null,\n nativeEvent,\n nativeEventTarget\n )),\n dispatchQueue.push({ event: nativeEvent, listeners: doc }),\n (nativeEvent.target = activeElement))));\n}\nfunction makePrefixMap(styleProp, eventName) {\n var prefixes = {};\n prefixes[styleProp.toLowerCase()] = eventName.toLowerCase();\n prefixes[\"Webkit\" + styleProp] = \"webkit\" + eventName;\n prefixes[\"Moz\" + styleProp] = \"moz\" + eventName;\n return prefixes;\n}\nvar vendorPrefixes = {\n animationend: makePrefixMap(\"Animation\", \"AnimationEnd\"),\n animationiteration: makePrefixMap(\"Animation\", \"AnimationIteration\"),\n animationstart: makePrefixMap(\"Animation\", \"AnimationStart\"),\n transitionrun: makePrefixMap(\"Transition\", \"TransitionRun\"),\n transitionstart: makePrefixMap(\"Transition\", \"TransitionStart\"),\n transitioncancel: makePrefixMap(\"Transition\", \"TransitionCancel\"),\n transitionend: makePrefixMap(\"Transition\", \"TransitionEnd\")\n },\n prefixedEventNames = {},\n style = {};\ncanUseDOM &&\n ((style = document.createElement(\"div\").style),\n \"AnimationEvent\" in window ||\n (delete vendorPrefixes.animationend.animation,\n delete vendorPrefixes.animationiteration.animation,\n delete vendorPrefixes.animationstart.animation),\n \"TransitionEvent\" in window ||\n delete vendorPrefixes.transitionend.transition);\nfunction getVendorPrefixedEventName(eventName) {\n if (prefixedEventNames[eventName]) return prefixedEventNames[eventName];\n if (!vendorPrefixes[eventName]) return eventName;\n var prefixMap = vendorPrefixes[eventName],\n styleProp;\n for (styleProp in prefixMap)\n if (prefixMap.hasOwnProperty(styleProp) && styleProp in style)\n return (prefixedEventNames[eventName] = prefixMap[styleProp]);\n return eventName;\n}\nvar ANIMATION_END = getVendorPrefixedEventName(\"animationend\"),\n ANIMATION_ITERATION = getVendorPrefixedEventName(\"animationiteration\"),\n ANIMATION_START = getVendorPrefixedEventName(\"animationstart\"),\n TRANSITION_RUN = getVendorPrefixedEventName(\"transitionrun\"),\n TRANSITION_START = getVendorPrefixedEventName(\"transitionstart\"),\n TRANSITION_CANCEL = getVendorPrefixedEventName(\"transitioncancel\"),\n TRANSITION_END = getVendorPrefixedEventName(\"transitionend\"),\n topLevelEventsToReactNames = new Map(),\n simpleEventPluginEvents =\n \"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(\n \" \"\n );\nsimpleEventPluginEvents.push(\"scrollEnd\");\nfunction registerSimpleEvent(domEventName, reactName) {\n topLevelEventsToReactNames.set(domEventName, reactName);\n registerTwoPhaseEvent(reactName, [domEventName]);\n}\nvar reportGlobalError =\n \"function\" === typeof reportError\n ? reportError\n : function (error) {\n if (\n \"object\" === typeof window &&\n \"function\" === typeof window.ErrorEvent\n ) {\n var event = new window.ErrorEvent(\"error\", {\n bubbles: !0,\n cancelable: !0,\n message:\n \"object\" === typeof error &&\n null !== error &&\n \"string\" === typeof error.message\n ? String(error.message)\n : String(error),\n error: error\n });\n if (!window.dispatchEvent(event)) return;\n } else if (\n \"object\" === typeof process &&\n \"function\" === typeof process.emit\n ) {\n process.emit(\"uncaughtException\", error);\n return;\n }\n console.error(error);\n },\n concurrentQueues = [],\n concurrentQueuesIndex = 0,\n concurrentlyUpdatedLanes = 0;\nfunction finishQueueingConcurrentUpdates() {\n for (\n var endIndex = concurrentQueuesIndex,\n i = (concurrentlyUpdatedLanes = concurrentQueuesIndex = 0);\n i < endIndex;\n\n ) {\n var fiber = concurrentQueues[i];\n concurrentQueues[i++] = null;\n var queue = concurrentQueues[i];\n concurrentQueues[i++] = null;\n var update = concurrentQueues[i];\n concurrentQueues[i++] = null;\n var lane = concurrentQueues[i];\n concurrentQueues[i++] = null;\n if (null !== queue && null !== update) {\n var pending = queue.pending;\n null === pending\n ? (update.next = update)\n : ((update.next = pending.next), (pending.next = update));\n queue.pending = update;\n }\n 0 !== lane && markUpdateLaneFromFiberToRoot(fiber, update, lane);\n }\n}\nfunction enqueueUpdate$1(fiber, queue, update, lane) {\n concurrentQueues[concurrentQueuesIndex++] = fiber;\n concurrentQueues[concurrentQueuesIndex++] = queue;\n concurrentQueues[concurrentQueuesIndex++] = update;\n concurrentQueues[concurrentQueuesIndex++] = lane;\n concurrentlyUpdatedLanes |= lane;\n fiber.lanes |= lane;\n fiber = fiber.alternate;\n null !== fiber && (fiber.lanes |= lane);\n}\nfunction enqueueConcurrentHookUpdate(fiber, queue, update, lane) {\n enqueueUpdate$1(fiber, queue, update, lane);\n return getRootForUpdatedFiber(fiber);\n}\nfunction enqueueConcurrentRenderForLane(fiber, lane) {\n enqueueUpdate$1(fiber, null, null, lane);\n return getRootForUpdatedFiber(fiber);\n}\nfunction markUpdateLaneFromFiberToRoot(sourceFiber, update, lane) {\n sourceFiber.lanes |= lane;\n var alternate = sourceFiber.alternate;\n null !== alternate && (alternate.lanes |= lane);\n for (var isHidden = !1, parent = sourceFiber.return; null !== parent; )\n (parent.childLanes |= lane),\n (alternate = parent.alternate),\n null !== alternate && (alternate.childLanes |= lane),\n 22 === parent.tag &&\n ((sourceFiber = parent.stateNode),\n null === sourceFiber || sourceFiber._visibility & 1 || (isHidden = !0)),\n (sourceFiber = parent),\n (parent = parent.return);\n return 3 === sourceFiber.tag\n ? ((parent = sourceFiber.stateNode),\n isHidden &&\n null !== update &&\n ((isHidden = 31 - clz32(lane)),\n (sourceFiber = parent.hiddenUpdates),\n (alternate = sourceFiber[isHidden]),\n null === alternate\n ? (sourceFiber[isHidden] = [update])\n : alternate.push(update),\n (update.lane = lane | 536870912)),\n parent)\n : null;\n}\nfunction getRootForUpdatedFiber(sourceFiber) {\n if (50 < nestedUpdateCount)\n throw (\n ((nestedUpdateCount = 0),\n (rootWithNestedUpdates = null),\n Error(formatProdErrorMessage(185)))\n );\n for (var parent = sourceFiber.return; null !== parent; )\n (sourceFiber = parent), (parent = sourceFiber.return);\n return 3 === sourceFiber.tag ? sourceFiber.stateNode : null;\n}\nvar emptyContextObject = {};\nfunction FiberNode(tag, pendingProps, key, mode) {\n this.tag = tag;\n this.key = key;\n this.sibling =\n this.child =\n this.return =\n this.stateNode =\n this.type =\n this.elementType =\n null;\n this.index = 0;\n this.refCleanup = this.ref = null;\n this.pendingProps = pendingProps;\n this.dependencies =\n this.memoizedState =\n this.updateQueue =\n this.memoizedProps =\n null;\n this.mode = mode;\n this.subtreeFlags = this.flags = 0;\n this.deletions = null;\n this.childLanes = this.lanes = 0;\n this.alternate = null;\n}\nfunction createFiberImplClass(tag, pendingProps, key, mode) {\n return new FiberNode(tag, pendingProps, key, mode);\n}\nfunction shouldConstruct(Component) {\n Component = Component.prototype;\n return !(!Component || !Component.isReactComponent);\n}\nfunction createWorkInProgress(current, pendingProps) {\n var workInProgress = current.alternate;\n null === workInProgress\n ? ((workInProgress = createFiberImplClass(\n current.tag,\n pendingProps,\n current.key,\n current.mode\n )),\n (workInProgress.elementType = current.elementType),\n (workInProgress.type = current.type),\n (workInProgress.stateNode = current.stateNode),\n (workInProgress.alternate = current),\n (current.alternate = workInProgress))\n : ((workInProgress.pendingProps = pendingProps),\n (workInProgress.type = current.type),\n (workInProgress.flags = 0),\n (workInProgress.subtreeFlags = 0),\n (workInProgress.deletions = null));\n workInProgress.flags = current.flags & 65011712;\n workInProgress.childLanes = current.childLanes;\n workInProgress.lanes = current.lanes;\n workInProgress.child = current.child;\n workInProgress.memoizedProps = current.memoizedProps;\n workInProgress.memoizedState = current.memoizedState;\n workInProgress.updateQueue = current.updateQueue;\n pendingProps = current.dependencies;\n workInProgress.dependencies =\n null === pendingProps\n ? null\n : { lanes: pendingProps.lanes, firstContext: pendingProps.firstContext };\n workInProgress.sibling = current.sibling;\n workInProgress.index = current.index;\n workInProgress.ref = current.ref;\n workInProgress.refCleanup = current.refCleanup;\n return workInProgress;\n}\nfunction resetWorkInProgress(workInProgress, renderLanes) {\n workInProgress.flags &= 65011714;\n var current = workInProgress.alternate;\n null === current\n ? ((workInProgress.childLanes = 0),\n (workInProgress.lanes = renderLanes),\n (workInProgress.child = null),\n (workInProgress.subtreeFlags = 0),\n (workInProgress.memoizedProps = null),\n (workInProgress.memoizedState = null),\n (workInProgress.updateQueue = null),\n (workInProgress.dependencies = null),\n (workInProgress.stateNode = null))\n : ((workInProgress.childLanes = current.childLanes),\n (workInProgress.lanes = current.lanes),\n (workInProgress.child = current.child),\n (workInProgress.subtreeFlags = 0),\n (workInProgress.deletions = null),\n (workInProgress.memoizedProps = current.memoizedProps),\n (workInProgress.memoizedState = current.memoizedState),\n (workInProgress.updateQueue = current.updateQueue),\n (workInProgress.type = current.type),\n (renderLanes = current.dependencies),\n (workInProgress.dependencies =\n null === renderLanes\n ? null\n : {\n lanes: renderLanes.lanes,\n firstContext: renderLanes.firstContext\n }));\n return workInProgress;\n}\nfunction createFiberFromTypeAndProps(\n type,\n key,\n pendingProps,\n owner,\n mode,\n lanes\n) {\n var fiberTag = 0;\n owner = type;\n if (\"function\" === typeof type) shouldConstruct(type) && (fiberTag = 1);\n else if (\"string\" === typeof type)\n fiberTag = isHostHoistableType(\n type,\n pendingProps,\n contextStackCursor.current\n )\n ? 26\n : \"html\" === type || \"head\" === type || \"body\" === type\n ? 27\n : 5;\n else\n a: switch (type) {\n case REACT_ACTIVITY_TYPE:\n return (\n (type = createFiberImplClass(31, pendingProps, key, mode)),\n (type.elementType = REACT_ACTIVITY_TYPE),\n (type.lanes = lanes),\n type\n );\n case REACT_FRAGMENT_TYPE:\n return createFiberFromFragment(pendingProps.children, mode, lanes, key);\n case REACT_STRICT_MODE_TYPE:\n fiberTag = 8;\n mode |= 24;\n break;\n case REACT_PROFILER_TYPE:\n return (\n (type = createFiberImplClass(12, pendingProps, key, mode | 2)),\n (type.elementType = REACT_PROFILER_TYPE),\n (type.lanes = lanes),\n type\n );\n case REACT_SUSPENSE_TYPE:\n return (\n (type = createFiberImplClass(13, pendingProps, key, mode)),\n (type.elementType = REACT_SUSPENSE_TYPE),\n (type.lanes = lanes),\n type\n );\n case REACT_SUSPENSE_LIST_TYPE:\n return (\n (type = createFiberImplClass(19, pendingProps, key, mode)),\n (type.elementType = REACT_SUSPENSE_LIST_TYPE),\n (type.lanes = lanes),\n type\n );\n default:\n if (\"object\" === typeof type && null !== type)\n switch (type.$$typeof) {\n case REACT_CONTEXT_TYPE:\n fiberTag = 10;\n break a;\n case REACT_CONSUMER_TYPE:\n fiberTag = 9;\n break a;\n case REACT_FORWARD_REF_TYPE:\n fiberTag = 11;\n break a;\n case REACT_MEMO_TYPE:\n fiberTag = 14;\n break a;\n case REACT_LAZY_TYPE:\n fiberTag = 16;\n owner = null;\n break a;\n }\n fiberTag = 29;\n pendingProps = Error(\n formatProdErrorMessage(130, null === type ? \"null\" : typeof type, \"\")\n );\n owner = null;\n }\n key = createFiberImplClass(fiberTag, pendingProps, key, mode);\n key.elementType = type;\n key.type = owner;\n key.lanes = lanes;\n return key;\n}\nfunction createFiberFromFragment(elements, mode, lanes, key) {\n elements = createFiberImplClass(7, elements, key, mode);\n elements.lanes = lanes;\n return elements;\n}\nfunction createFiberFromText(content, mode, lanes) {\n content = createFiberImplClass(6, content, null, mode);\n content.lanes = lanes;\n return content;\n}\nfunction createFiberFromDehydratedFragment(dehydratedNode) {\n var fiber = createFiberImplClass(18, null, null, 0);\n fiber.stateNode = dehydratedNode;\n return fiber;\n}\nfunction createFiberFromPortal(portal, mode, lanes) {\n mode = createFiberImplClass(\n 4,\n null !== portal.children ? portal.children : [],\n portal.key,\n mode\n );\n mode.lanes = lanes;\n mode.stateNode = {\n containerInfo: portal.containerInfo,\n pendingChildren: null,\n implementation: portal.implementation\n };\n return mode;\n}\nvar CapturedStacks = new WeakMap();\nfunction createCapturedValueAtFiber(value, source) {\n if (\"object\" === typeof value && null !== value) {\n var existing = CapturedStacks.get(value);\n if (void 0 !== existing) return existing;\n source = {\n value: value,\n source: source,\n stack: getStackByFiberInDevAndProd(source)\n };\n CapturedStacks.set(value, source);\n return source;\n }\n return {\n value: value,\n source: source,\n stack: getStackByFiberInDevAndProd(source)\n };\n}\nvar forkStack = [],\n forkStackIndex = 0,\n treeForkProvider = null,\n treeForkCount = 0,\n idStack = [],\n idStackIndex = 0,\n treeContextProvider = null,\n treeContextId = 1,\n treeContextOverflow = \"\";\nfunction pushTreeFork(workInProgress, totalChildren) {\n forkStack[forkStackIndex++] = treeForkCount;\n forkStack[forkStackIndex++] = treeForkProvider;\n treeForkProvider = workInProgress;\n treeForkCount = totalChildren;\n}\nfunction pushTreeId(workInProgress, totalChildren, index) {\n idStack[idStackIndex++] = treeContextId;\n idStack[idStackIndex++] = treeContextOverflow;\n idStack[idStackIndex++] = treeContextProvider;\n treeContextProvider = workInProgress;\n var baseIdWithLeadingBit = treeContextId;\n workInProgress = treeContextOverflow;\n var baseLength = 32 - clz32(baseIdWithLeadingBit) - 1;\n baseIdWithLeadingBit &= ~(1 << baseLength);\n index += 1;\n var length = 32 - clz32(totalChildren) + baseLength;\n if (30 < length) {\n var numberOfOverflowBits = baseLength - (baseLength % 5);\n length = (\n baseIdWithLeadingBit &\n ((1 << numberOfOverflowBits) - 1)\n ).toString(32);\n baseIdWithLeadingBit >>= numberOfOverflowBits;\n baseLength -= numberOfOverflowBits;\n treeContextId =\n (1 << (32 - clz32(totalChildren) + baseLength)) |\n (index << baseLength) |\n baseIdWithLeadingBit;\n treeContextOverflow = length + workInProgress;\n } else\n (treeContextId =\n (1 << length) | (index << baseLength) | baseIdWithLeadingBit),\n (treeContextOverflow = workInProgress);\n}\nfunction pushMaterializedTreeId(workInProgress) {\n null !== workInProgress.return &&\n (pushTreeFork(workInProgress, 1), pushTreeId(workInProgress, 1, 0));\n}\nfunction popTreeContext(workInProgress) {\n for (; workInProgress === treeForkProvider; )\n (treeForkProvider = forkStack[--forkStackIndex]),\n (forkStack[forkStackIndex] = null),\n (treeForkCount = forkStack[--forkStackIndex]),\n (forkStack[forkStackIndex] = null);\n for (; workInProgress === treeContextProvider; )\n (treeContextProvider = idStack[--idStackIndex]),\n (idStack[idStackIndex] = null),\n (treeContextOverflow = idStack[--idStackIndex]),\n (idStack[idStackIndex] = null),\n (treeContextId = idStack[--idStackIndex]),\n (idStack[idStackIndex] = null);\n}\nfunction restoreSuspendedTreeContext(workInProgress, suspendedContext) {\n idStack[idStackIndex++] = treeContextId;\n idStack[idStackIndex++] = treeContextOverflow;\n idStack[idStackIndex++] = treeContextProvider;\n treeContextId = suspendedContext.id;\n treeContextOverflow = suspendedContext.overflow;\n treeContextProvider = workInProgress;\n}\nvar hydrationParentFiber = null,\n nextHydratableInstance = null,\n isHydrating = !1,\n hydrationErrors = null,\n rootOrSingletonContext = !1,\n HydrationMismatchException = Error(formatProdErrorMessage(519));\nfunction throwOnHydrationMismatch(fiber) {\n var error = Error(\n formatProdErrorMessage(\n 418,\n 1 < arguments.length && void 0 !== arguments[1] && arguments[1]\n ? \"text\"\n : \"HTML\",\n \"\"\n )\n );\n queueHydrationError(createCapturedValueAtFiber(error, fiber));\n throw HydrationMismatchException;\n}\nfunction prepareToHydrateHostInstance(fiber) {\n var instance = fiber.stateNode,\n type = fiber.type,\n props = fiber.memoizedProps;\n instance[internalInstanceKey] = fiber;\n instance[internalPropsKey] = props;\n switch (type) {\n case \"dialog\":\n listenToNonDelegatedEvent(\"cancel\", instance);\n listenToNonDelegatedEvent(\"close\", instance);\n break;\n case \"iframe\":\n case \"object\":\n case \"embed\":\n listenToNonDelegatedEvent(\"load\", instance);\n break;\n case \"video\":\n case \"audio\":\n for (type = 0; type < mediaEventTypes.length; type++)\n listenToNonDelegatedEvent(mediaEventTypes[type], instance);\n break;\n case \"source\":\n listenToNonDelegatedEvent(\"error\", instance);\n break;\n case \"img\":\n case \"image\":\n case \"link\":\n listenToNonDelegatedEvent(\"error\", instance);\n listenToNonDelegatedEvent(\"load\", instance);\n break;\n case \"details\":\n listenToNonDelegatedEvent(\"toggle\", instance);\n break;\n case \"input\":\n listenToNonDelegatedEvent(\"invalid\", instance);\n initInput(\n instance,\n props.value,\n props.defaultValue,\n props.checked,\n props.defaultChecked,\n props.type,\n props.name,\n !0\n );\n break;\n case \"select\":\n listenToNonDelegatedEvent(\"invalid\", instance);\n break;\n case \"textarea\":\n listenToNonDelegatedEvent(\"invalid\", instance),\n initTextarea(instance, props.value, props.defaultValue, props.children);\n }\n type = props.children;\n (\"string\" !== typeof type &&\n \"number\" !== typeof type &&\n \"bigint\" !== typeof type) ||\n instance.textContent === \"\" + type ||\n !0 === props.suppressHydrationWarning ||\n checkForUnmatchedText(instance.textContent, type)\n ? (null != props.popover &&\n (listenToNonDelegatedEvent(\"beforetoggle\", instance),\n listenToNonDelegatedEvent(\"toggle\", instance)),\n null != props.onScroll && listenToNonDelegatedEvent(\"scroll\", instance),\n null != props.onScrollEnd &&\n listenToNonDelegatedEvent(\"scrollend\", instance),\n null != props.onClick && (instance.onclick = noop$1),\n (instance = !0))\n : (instance = !1);\n instance || throwOnHydrationMismatch(fiber, !0);\n}\nfunction popToNextHostParent(fiber) {\n for (hydrationParentFiber = fiber.return; hydrationParentFiber; )\n switch (hydrationParentFiber.tag) {\n case 5:\n case 31:\n case 13:\n rootOrSingletonContext = !1;\n return;\n case 27:\n case 3:\n rootOrSingletonContext = !0;\n return;\n default:\n hydrationParentFiber = hydrationParentFiber.return;\n }\n}\nfunction popHydrationState(fiber) {\n if (fiber !== hydrationParentFiber) return !1;\n if (!isHydrating) return popToNextHostParent(fiber), (isHydrating = !0), !1;\n var tag = fiber.tag,\n JSCompiler_temp;\n if ((JSCompiler_temp = 3 !== tag && 27 !== tag)) {\n if ((JSCompiler_temp = 5 === tag))\n (JSCompiler_temp = fiber.type),\n (JSCompiler_temp =\n !(\"form\" !== JSCompiler_temp && \"button\" !== JSCompiler_temp) ||\n shouldSetTextContent(fiber.type, fiber.memoizedProps));\n JSCompiler_temp = !JSCompiler_temp;\n }\n JSCompiler_temp && nextHydratableInstance && throwOnHydrationMismatch(fiber);\n popToNextHostParent(fiber);\n if (13 === tag) {\n fiber = fiber.memoizedState;\n fiber = null !== fiber ? fiber.dehydrated : null;\n if (!fiber) throw Error(formatProdErrorMessage(317));\n nextHydratableInstance =\n getNextHydratableInstanceAfterHydrationBoundary(fiber);\n } else if (31 === tag) {\n fiber = fiber.memoizedState;\n fiber = null !== fiber ? fiber.dehydrated : null;\n if (!fiber) throw Error(formatProdErrorMessage(317));\n nextHydratableInstance =\n getNextHydratableInstanceAfterHydrationBoundary(fiber);\n } else\n 27 === tag\n ? ((tag = nextHydratableInstance),\n isSingletonScope(fiber.type)\n ? ((fiber = previousHydratableOnEnteringScopedSingleton),\n (previousHydratableOnEnteringScopedSingleton = null),\n (nextHydratableInstance = fiber))\n : (nextHydratableInstance = tag))\n : (nextHydratableInstance = hydrationParentFiber\n ? getNextHydratable(fiber.stateNode.nextSibling)\n : null);\n return !0;\n}\nfunction resetHydrationState() {\n nextHydratableInstance = hydrationParentFiber = null;\n isHydrating = !1;\n}\nfunction upgradeHydrationErrorsToRecoverable() {\n var queuedErrors = hydrationErrors;\n null !== queuedErrors &&\n (null === workInProgressRootRecoverableErrors\n ? (workInProgressRootRecoverableErrors = queuedErrors)\n : workInProgressRootRecoverableErrors.push.apply(\n workInProgressRootRecoverableErrors,\n queuedErrors\n ),\n (hydrationErrors = null));\n return queuedErrors;\n}\nfunction queueHydrationError(error) {\n null === hydrationErrors\n ? (hydrationErrors = [error])\n : hydrationErrors.push(error);\n}\nvar valueCursor = createCursor(null),\n currentlyRenderingFiber$1 = null,\n lastContextDependency = null;\nfunction pushProvider(providerFiber, context, nextValue) {\n push(valueCursor, context._currentValue);\n context._currentValue = nextValue;\n}\nfunction popProvider(context) {\n context._currentValue = valueCursor.current;\n pop(valueCursor);\n}\nfunction scheduleContextWorkOnParentPath(parent, renderLanes, propagationRoot) {\n for (; null !== parent; ) {\n var alternate = parent.alternate;\n (parent.childLanes & renderLanes) !== renderLanes\n ? ((parent.childLanes |= renderLanes),\n null !== alternate && (alternate.childLanes |= renderLanes))\n : null !== alternate &&\n (alternate.childLanes & renderLanes) !== renderLanes &&\n (alternate.childLanes |= renderLanes);\n if (parent === propagationRoot) break;\n parent = parent.return;\n }\n}\nfunction propagateContextChanges(\n workInProgress,\n contexts,\n renderLanes,\n forcePropagateEntireTree\n) {\n var fiber = workInProgress.child;\n null !== fiber && (fiber.return = workInProgress);\n for (; null !== fiber; ) {\n var list = fiber.dependencies;\n if (null !== list) {\n var nextFiber = fiber.child;\n list = list.firstContext;\n a: for (; null !== list; ) {\n var dependency = list;\n list = fiber;\n for (var i = 0; i < contexts.length; i++)\n if (dependency.context === contexts[i]) {\n list.lanes |= renderLanes;\n dependency = list.alternate;\n null !== dependency && (dependency.lanes |= renderLanes);\n scheduleContextWorkOnParentPath(\n list.return,\n renderLanes,\n workInProgress\n );\n forcePropagateEntireTree || (nextFiber = null);\n break a;\n }\n list = dependency.next;\n }\n } else if (18 === fiber.tag) {\n nextFiber = fiber.return;\n if (null === nextFiber) throw Error(formatProdErrorMessage(341));\n nextFiber.lanes |= renderLanes;\n list = nextFiber.alternate;\n null !== list && (list.lanes |= renderLanes);\n scheduleContextWorkOnParentPath(nextFiber, renderLanes, workInProgress);\n nextFiber = null;\n } else nextFiber = fiber.child;\n if (null !== nextFiber) nextFiber.return = fiber;\n else\n for (nextFiber = fiber; null !== nextFiber; ) {\n if (nextFiber === workInProgress) {\n nextFiber = null;\n break;\n }\n fiber = nextFiber.sibling;\n if (null !== fiber) {\n fiber.return = nextFiber.return;\n nextFiber = fiber;\n break;\n }\n nextFiber = nextFiber.return;\n }\n fiber = nextFiber;\n }\n}\nfunction propagateParentContextChanges(\n current,\n workInProgress,\n renderLanes,\n forcePropagateEntireTree\n) {\n current = null;\n for (\n var parent = workInProgress, isInsidePropagationBailout = !1;\n null !== parent;\n\n ) {\n if (!isInsidePropagationBailout)\n if (0 !== (parent.flags & 524288)) isInsidePropagationBailout = !0;\n else if (0 !== (parent.flags & 262144)) break;\n if (10 === parent.tag) {\n var currentParent = parent.alternate;\n if (null === currentParent) throw Error(formatProdErrorMessage(387));\n currentParent = currentParent.memoizedProps;\n if (null !== currentParent) {\n var context = parent.type;\n objectIs(parent.pendingProps.value, currentParent.value) ||\n (null !== current ? current.push(context) : (current = [context]));\n }\n } else if (parent === hostTransitionProviderCursor.current) {\n currentParent = parent.alternate;\n if (null === currentParent) throw Error(formatProdErrorMessage(387));\n currentParent.memoizedState.memoizedState !==\n parent.memoizedState.memoizedState &&\n (null !== current\n ? current.push(HostTransitionContext)\n : (current = [HostTransitionContext]));\n }\n parent = parent.return;\n }\n null !== current &&\n propagateContextChanges(\n workInProgress,\n current,\n renderLanes,\n forcePropagateEntireTree\n );\n workInProgress.flags |= 262144;\n}\nfunction checkIfContextChanged(currentDependencies) {\n for (\n currentDependencies = currentDependencies.firstContext;\n null !== currentDependencies;\n\n ) {\n if (\n !objectIs(\n currentDependencies.context._currentValue,\n currentDependencies.memoizedValue\n )\n )\n return !0;\n currentDependencies = currentDependencies.next;\n }\n return !1;\n}\nfunction prepareToReadContext(workInProgress) {\n currentlyRenderingFiber$1 = workInProgress;\n lastContextDependency = null;\n workInProgress = workInProgress.dependencies;\n null !== workInProgress && (workInProgress.firstContext = null);\n}\nfunction readContext(context) {\n return readContextForConsumer(currentlyRenderingFiber$1, context);\n}\nfunction readContextDuringReconciliation(consumer, context) {\n null === currentlyRenderingFiber$1 && prepareToReadContext(consumer);\n return readContextForConsumer(consumer, context);\n}\nfunction readContextForConsumer(consumer, context) {\n var value = context._currentValue;\n context = { context: context, memoizedValue: value, next: null };\n if (null === lastContextDependency) {\n if (null === consumer) throw Error(formatProdErrorMessage(308));\n lastContextDependency = context;\n consumer.dependencies = { lanes: 0, firstContext: context };\n consumer.flags |= 524288;\n } else lastContextDependency = lastContextDependency.next = context;\n return value;\n}\nvar AbortControllerLocal =\n \"undefined\" !== typeof AbortController\n ? AbortController\n : function () {\n var listeners = [],\n signal = (this.signal = {\n aborted: !1,\n addEventListener: function (type, listener) {\n listeners.push(listener);\n }\n });\n this.abort = function () {\n signal.aborted = !0;\n listeners.forEach(function (listener) {\n return listener();\n });\n };\n },\n scheduleCallback$2 = Scheduler.unstable_scheduleCallback,\n NormalPriority = Scheduler.unstable_NormalPriority,\n CacheContext = {\n $$typeof: REACT_CONTEXT_TYPE,\n Consumer: null,\n Provider: null,\n _currentValue: null,\n _currentValue2: null,\n _threadCount: 0\n };\nfunction createCache() {\n return {\n controller: new AbortControllerLocal(),\n data: new Map(),\n refCount: 0\n };\n}\nfunction releaseCache(cache) {\n cache.refCount--;\n 0 === cache.refCount &&\n scheduleCallback$2(NormalPriority, function () {\n cache.controller.abort();\n });\n}\nvar currentEntangledListeners = null,\n currentEntangledPendingCount = 0,\n currentEntangledLane = 0,\n currentEntangledActionThenable = null;\nfunction entangleAsyncAction(transition, thenable) {\n if (null === currentEntangledListeners) {\n var entangledListeners = (currentEntangledListeners = []);\n currentEntangledPendingCount = 0;\n currentEntangledLane = requestTransitionLane();\n currentEntangledActionThenable = {\n status: \"pending\",\n value: void 0,\n then: function (resolve) {\n entangledListeners.push(resolve);\n }\n };\n }\n currentEntangledPendingCount++;\n thenable.then(pingEngtangledActionScope, pingEngtangledActionScope);\n return thenable;\n}\nfunction pingEngtangledActionScope() {\n if (\n 0 === --currentEntangledPendingCount &&\n null !== currentEntangledListeners\n ) {\n null !== currentEntangledActionThenable &&\n (currentEntangledActionThenable.status = \"fulfilled\");\n var listeners = currentEntangledListeners;\n currentEntangledListeners = null;\n currentEntangledLane = 0;\n currentEntangledActionThenable = null;\n for (var i = 0; i < listeners.length; i++) (0, listeners[i])();\n }\n}\nfunction chainThenableValue(thenable, result) {\n var listeners = [],\n thenableWithOverride = {\n status: \"pending\",\n value: null,\n reason: null,\n then: function (resolve) {\n listeners.push(resolve);\n }\n };\n thenable.then(\n function () {\n thenableWithOverride.status = \"fulfilled\";\n thenableWithOverride.value = result;\n for (var i = 0; i < listeners.length; i++) (0, listeners[i])(result);\n },\n function (error) {\n thenableWithOverride.status = \"rejected\";\n thenableWithOverride.reason = error;\n for (error = 0; error < listeners.length; error++)\n (0, listeners[error])(void 0);\n }\n );\n return thenableWithOverride;\n}\nvar prevOnStartTransitionFinish = ReactSharedInternals.S;\nReactSharedInternals.S = function (transition, returnValue) {\n globalMostRecentTransitionTime = now();\n \"object\" === typeof returnValue &&\n null !== returnValue &&\n \"function\" === typeof returnValue.then &&\n entangleAsyncAction(transition, returnValue);\n null !== prevOnStartTransitionFinish &&\n prevOnStartTransitionFinish(transition, returnValue);\n};\nvar resumedCache = createCursor(null);\nfunction peekCacheFromPool() {\n var cacheResumedFromPreviousRender = resumedCache.current;\n return null !== cacheResumedFromPreviousRender\n ? cacheResumedFromPreviousRender\n : workInProgressRoot.pooledCache;\n}\nfunction pushTransition(offscreenWorkInProgress, prevCachePool) {\n null === prevCachePool\n ? push(resumedCache, resumedCache.current)\n : push(resumedCache, prevCachePool.pool);\n}\nfunction getSuspendedCache() {\n var cacheFromPool = peekCacheFromPool();\n return null === cacheFromPool\n ? null\n : { parent: CacheContext._currentValue, pool: cacheFromPool };\n}\nvar SuspenseException = Error(formatProdErrorMessage(460)),\n SuspenseyCommitException = Error(formatProdErrorMessage(474)),\n SuspenseActionException = Error(formatProdErrorMessage(542)),\n noopSuspenseyCommitThenable = { then: function () {} };\nfunction isThenableResolved(thenable) {\n thenable = thenable.status;\n return \"fulfilled\" === thenable || \"rejected\" === thenable;\n}\nfunction trackUsedThenable(thenableState, thenable, index) {\n index = thenableState[index];\n void 0 === index\n ? thenableState.push(thenable)\n : index !== thenable && (thenable.then(noop$1, noop$1), (thenable = index));\n switch (thenable.status) {\n case \"fulfilled\":\n return thenable.value;\n case \"rejected\":\n throw (\n ((thenableState = thenable.reason),\n checkIfUseWrappedInAsyncCatch(thenableState),\n thenableState)\n );\n default:\n if (\"string\" === typeof thenable.status) thenable.then(noop$1, noop$1);\n else {\n thenableState = workInProgressRoot;\n if (null !== thenableState && 100 < thenableState.shellSuspendCounter)\n throw Error(formatProdErrorMessage(482));\n thenableState = thenable;\n thenableState.status = \"pending\";\n thenableState.then(\n function (fulfilledValue) {\n if (\"pending\" === thenable.status) {\n var fulfilledThenable = thenable;\n fulfilledThenable.status = \"fulfilled\";\n fulfilledThenable.value = fulfilledValue;\n }\n },\n function (error) {\n if (\"pending\" === thenable.status) {\n var rejectedThenable = thenable;\n rejectedThenable.status = \"rejected\";\n rejectedThenable.reason = error;\n }\n }\n );\n }\n switch (thenable.status) {\n case \"fulfilled\":\n return thenable.value;\n case \"rejected\":\n throw (\n ((thenableState = thenable.reason),\n checkIfUseWrappedInAsyncCatch(thenableState),\n thenableState)\n );\n }\n suspendedThenable = thenable;\n throw SuspenseException;\n }\n}\nfunction resolveLazy(lazyType) {\n try {\n var init = lazyType._init;\n return init(lazyType._payload);\n } catch (x) {\n if (null !== x && \"object\" === typeof x && \"function\" === typeof x.then)\n throw ((suspendedThenable = x), SuspenseException);\n throw x;\n }\n}\nvar suspendedThenable = null;\nfunction getSuspendedThenable() {\n if (null === suspendedThenable) throw Error(formatProdErrorMessage(459));\n var thenable = suspendedThenable;\n suspendedThenable = null;\n return thenable;\n}\nfunction checkIfUseWrappedInAsyncCatch(rejectedReason) {\n if (\n rejectedReason === SuspenseException ||\n rejectedReason === SuspenseActionException\n )\n throw Error(formatProdErrorMessage(483));\n}\nvar thenableState$1 = null,\n thenableIndexCounter$1 = 0;\nfunction unwrapThenable(thenable) {\n var index = thenableIndexCounter$1;\n thenableIndexCounter$1 += 1;\n null === thenableState$1 && (thenableState$1 = []);\n return trackUsedThenable(thenableState$1, thenable, index);\n}\nfunction coerceRef(workInProgress, element) {\n element = element.props.ref;\n workInProgress.ref = void 0 !== element ? element : null;\n}\nfunction throwOnInvalidObjectTypeImpl(returnFiber, newChild) {\n if (newChild.$$typeof === REACT_LEGACY_ELEMENT_TYPE)\n throw Error(formatProdErrorMessage(525));\n returnFiber = Object.prototype.toString.call(newChild);\n throw Error(\n formatProdErrorMessage(\n 31,\n \"[object Object]\" === returnFiber\n ? \"object with keys {\" + Object.keys(newChild).join(\", \") + \"}\"\n : returnFiber\n )\n );\n}\nfunction createChildReconciler(shouldTrackSideEffects) {\n function deleteChild(returnFiber, childToDelete) {\n if (shouldTrackSideEffects) {\n var deletions = returnFiber.deletions;\n null === deletions\n ? ((returnFiber.deletions = [childToDelete]), (returnFiber.flags |= 16))\n : deletions.push(childToDelete);\n }\n }\n function deleteRemainingChildren(returnFiber, currentFirstChild) {\n if (!shouldTrackSideEffects) return null;\n for (; null !== currentFirstChild; )\n deleteChild(returnFiber, currentFirstChild),\n (currentFirstChild = currentFirstChild.sibling);\n return null;\n }\n function mapRemainingChildren(currentFirstChild) {\n for (var existingChildren = new Map(); null !== currentFirstChild; )\n null !== currentFirstChild.key\n ? existingChildren.set(currentFirstChild.key, currentFirstChild)\n : existingChildren.set(currentFirstChild.index, currentFirstChild),\n (currentFirstChild = currentFirstChild.sibling);\n return existingChildren;\n }\n function useFiber(fiber, pendingProps) {\n fiber = createWorkInProgress(fiber, pendingProps);\n fiber.index = 0;\n fiber.sibling = null;\n return fiber;\n }\n function placeChild(newFiber, lastPlacedIndex, newIndex) {\n newFiber.index = newIndex;\n if (!shouldTrackSideEffects)\n return (newFiber.flags |= 1048576), lastPlacedIndex;\n newIndex = newFiber.alternate;\n if (null !== newIndex)\n return (\n (newIndex = newIndex.index),\n newIndex < lastPlacedIndex\n ? ((newFiber.flags |= 67108866), lastPlacedIndex)\n : newIndex\n );\n newFiber.flags |= 67108866;\n return lastPlacedIndex;\n }\n function placeSingleChild(newFiber) {\n shouldTrackSideEffects &&\n null === newFiber.alternate &&\n (newFiber.flags |= 67108866);\n return newFiber;\n }\n function updateTextNode(returnFiber, current, textContent, lanes) {\n if (null === current || 6 !== current.tag)\n return (\n (current = createFiberFromText(textContent, returnFiber.mode, lanes)),\n (current.return = returnFiber),\n current\n );\n current = useFiber(current, textContent);\n current.return = returnFiber;\n return current;\n }\n function updateElement(returnFiber, current, element, lanes) {\n var elementType = element.type;\n if (elementType === REACT_FRAGMENT_TYPE)\n return updateFragment(\n returnFiber,\n current,\n element.props.children,\n lanes,\n element.key\n );\n if (\n null !== current &&\n (current.elementType === elementType ||\n (\"object\" === typeof elementType &&\n null !== elementType &&\n elementType.$$typeof === REACT_LAZY_TYPE &&\n resolveLazy(elementType) === current.type))\n )\n return (\n (current = useFiber(current, element.props)),\n coerceRef(current, element),\n (current.return = returnFiber),\n current\n );\n current = createFiberFromTypeAndProps(\n element.type,\n element.key,\n element.props,\n null,\n returnFiber.mode,\n lanes\n );\n coerceRef(current, element);\n current.return = returnFiber;\n return current;\n }\n function updatePortal(returnFiber, current, portal, lanes) {\n if (\n null === current ||\n 4 !== current.tag ||\n current.stateNode.containerInfo !== portal.containerInfo ||\n current.stateNode.implementation !== portal.implementation\n )\n return (\n (current = createFiberFromPortal(portal, returnFiber.mode, lanes)),\n (current.return = returnFiber),\n current\n );\n current = useFiber(current, portal.children || []);\n current.return = returnFiber;\n return current;\n }\n function updateFragment(returnFiber, current, fragment, lanes, key) {\n if (null === current || 7 !== current.tag)\n return (\n (current = createFiberFromFragment(\n fragment,\n returnFiber.mode,\n lanes,\n key\n )),\n (current.return = returnFiber),\n current\n );\n current = useFiber(current, fragment);\n current.return = returnFiber;\n return current;\n }\n function createChild(returnFiber, newChild, lanes) {\n if (\n (\"string\" === typeof newChild && \"\" !== newChild) ||\n \"number\" === typeof newChild ||\n \"bigint\" === typeof newChild\n )\n return (\n (newChild = createFiberFromText(\n \"\" + newChild,\n returnFiber.mode,\n lanes\n )),\n (newChild.return = returnFiber),\n newChild\n );\n if (\"object\" === typeof newChild && null !== newChild) {\n switch (newChild.$$typeof) {\n case REACT_ELEMENT_TYPE:\n return (\n (lanes = createFiberFromTypeAndProps(\n newChild.type,\n newChild.key,\n newChild.props,\n null,\n returnFiber.mode,\n lanes\n )),\n coerceRef(lanes, newChild),\n (lanes.return = returnFiber),\n lanes\n );\n case REACT_PORTAL_TYPE:\n return (\n (newChild = createFiberFromPortal(\n newChild,\n returnFiber.mode,\n lanes\n )),\n (newChild.return = returnFiber),\n newChild\n );\n case REACT_LAZY_TYPE:\n return (\n (newChild = resolveLazy(newChild)),\n createChild(returnFiber, newChild, lanes)\n );\n }\n if (isArrayImpl(newChild) || getIteratorFn(newChild))\n return (\n (newChild = createFiberFromFragment(\n newChild,\n returnFiber.mode,\n lanes,\n null\n )),\n (newChild.return = returnFiber),\n newChild\n );\n if (\"function\" === typeof newChild.then)\n return createChild(returnFiber, unwrapThenable(newChild), lanes);\n if (newChild.$$typeof === REACT_CONTEXT_TYPE)\n return createChild(\n returnFiber,\n readContextDuringReconciliation(returnFiber, newChild),\n lanes\n );\n throwOnInvalidObjectTypeImpl(returnFiber, newChild);\n }\n return null;\n }\n function updateSlot(returnFiber, oldFiber, newChild, lanes) {\n var key = null !== oldFiber ? oldFiber.key : null;\n if (\n (\"string\" === typeof newChild && \"\" !== newChild) ||\n \"number\" === typeof newChild ||\n \"bigint\" === typeof newChild\n )\n return null !== key\n ? null\n : updateTextNode(returnFiber, oldFiber, \"\" + newChild, lanes);\n if (\"object\" === typeof newChild && null !== newChild) {\n switch (newChild.$$typeof) {\n case REACT_ELEMENT_TYPE:\n return newChild.key === key\n ? updateElement(returnFiber, oldFiber, newChild, lanes)\n : null;\n case REACT_PORTAL_TYPE:\n return newChild.key === key\n ? updatePortal(returnFiber, oldFiber, newChild, lanes)\n : null;\n case REACT_LAZY_TYPE:\n return (\n (newChild = resolveLazy(newChild)),\n updateSlot(returnFiber, oldFiber, newChild, lanes)\n );\n }\n if (isArrayImpl(newChild) || getIteratorFn(newChild))\n return null !== key\n ? null\n : updateFragment(returnFiber, oldFiber, newChild, lanes, null);\n if (\"function\" === typeof newChild.then)\n return updateSlot(\n returnFiber,\n oldFiber,\n unwrapThenable(newChild),\n lanes\n );\n if (newChild.$$typeof === REACT_CONTEXT_TYPE)\n return updateSlot(\n returnFiber,\n oldFiber,\n readContextDuringReconciliation(returnFiber, newChild),\n lanes\n );\n throwOnInvalidObjectTypeImpl(returnFiber, newChild);\n }\n return null;\n }\n function updateFromMap(\n existingChildren,\n returnFiber,\n newIdx,\n newChild,\n lanes\n ) {\n if (\n (\"string\" === typeof newChild && \"\" !== newChild) ||\n \"number\" === typeof newChild ||\n \"bigint\" === typeof newChild\n )\n return (\n (existingChildren = existingChildren.get(newIdx) || null),\n updateTextNode(returnFiber, existingChildren, \"\" + newChild, lanes)\n );\n if (\"object\" === typeof newChild && null !== newChild) {\n switch (newChild.$$typeof) {\n case REACT_ELEMENT_TYPE:\n return (\n (existingChildren =\n existingChildren.get(\n null === newChild.key ? newIdx : newChild.key\n ) || null),\n updateElement(returnFiber, existingChildren, newChild, lanes)\n );\n case REACT_PORTAL_TYPE:\n return (\n (existingChildren =\n existingChildren.get(\n null === newChild.key ? newIdx : newChild.key\n ) || null),\n updatePortal(returnFiber, existingChildren, newChild, lanes)\n );\n case REACT_LAZY_TYPE:\n return (\n (newChild = resolveLazy(newChild)),\n updateFromMap(\n existingChildren,\n returnFiber,\n newIdx,\n newChild,\n lanes\n )\n );\n }\n if (isArrayImpl(newChild) || getIteratorFn(newChild))\n return (\n (existingChildren = existingChildren.get(newIdx) || null),\n updateFragment(returnFiber, existingChildren, newChild, lanes, null)\n );\n if (\"function\" === typeof newChild.then)\n return updateFromMap(\n existingChildren,\n returnFiber,\n newIdx,\n unwrapThenable(newChild),\n lanes\n );\n if (newChild.$$typeof === REACT_CONTEXT_TYPE)\n return updateFromMap(\n existingChildren,\n returnFiber,\n newIdx,\n readContextDuringReconciliation(returnFiber, newChild),\n lanes\n );\n throwOnInvalidObjectTypeImpl(returnFiber, newChild);\n }\n return null;\n }\n function reconcileChildrenArray(\n returnFiber,\n currentFirstChild,\n newChildren,\n lanes\n ) {\n for (\n var resultingFirstChild = null,\n previousNewFiber = null,\n oldFiber = currentFirstChild,\n newIdx = (currentFirstChild = 0),\n nextOldFiber = null;\n null !== oldFiber && newIdx < newChildren.length;\n newIdx++\n ) {\n oldFiber.index > newIdx\n ? ((nextOldFiber = oldFiber), (oldFiber = null))\n : (nextOldFiber = oldFiber.sibling);\n var newFiber = updateSlot(\n returnFiber,\n oldFiber,\n newChildren[newIdx],\n lanes\n );\n if (null === newFiber) {\n null === oldFiber && (oldFiber = nextOldFiber);\n break;\n }\n shouldTrackSideEffects &&\n oldFiber &&\n null === newFiber.alternate &&\n deleteChild(returnFiber, oldFiber);\n currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx);\n null === previousNewFiber\n ? (resultingFirstChild = newFiber)\n : (previousNewFiber.sibling = newFiber);\n previousNewFiber = newFiber;\n oldFiber = nextOldFiber;\n }\n if (newIdx === newChildren.length)\n return (\n deleteRemainingChildren(returnFiber, oldFiber),\n isHydrating && pushTreeFork(returnFiber, newIdx),\n resultingFirstChild\n );\n if (null === oldFiber) {\n for (; newIdx < newChildren.length; newIdx++)\n (oldFiber = createChild(returnFiber, newChildren[newIdx], lanes)),\n null !== oldFiber &&\n ((currentFirstChild = placeChild(\n oldFiber,\n currentFirstChild,\n newIdx\n )),\n null === previousNewFiber\n ? (resultingFirstChild = oldFiber)\n : (previousNewFiber.sibling = oldFiber),\n (previousNewFiber = oldFiber));\n isHydrating && pushTreeFork(returnFiber, newIdx);\n return resultingFirstChild;\n }\n for (\n oldFiber = mapRemainingChildren(oldFiber);\n newIdx < newChildren.length;\n newIdx++\n )\n (nextOldFiber = updateFromMap(\n oldFiber,\n returnFiber,\n newIdx,\n newChildren[newIdx],\n lanes\n )),\n null !== nextOldFiber &&\n (shouldTrackSideEffects &&\n null !== nextOldFiber.alternate &&\n oldFiber.delete(\n null === nextOldFiber.key ? newIdx : nextOldFiber.key\n ),\n (currentFirstChild = placeChild(\n nextOldFiber,\n currentFirstChild,\n newIdx\n )),\n null === previousNewFiber\n ? (resultingFirstChild = nextOldFiber)\n : (previousNewFiber.sibling = nextOldFiber),\n (previousNewFiber = nextOldFiber));\n shouldTrackSideEffects &&\n oldFiber.forEach(function (child) {\n return deleteChild(returnFiber, child);\n });\n isHydrating && pushTreeFork(returnFiber, newIdx);\n return resultingFirstChild;\n }\n function reconcileChildrenIterator(\n returnFiber,\n currentFirstChild,\n newChildren,\n lanes\n ) {\n if (null == newChildren) throw Error(formatProdErrorMessage(151));\n for (\n var resultingFirstChild = null,\n previousNewFiber = null,\n oldFiber = currentFirstChild,\n newIdx = (currentFirstChild = 0),\n nextOldFiber = null,\n step = newChildren.next();\n null !== oldFiber && !step.done;\n newIdx++, step = newChildren.next()\n ) {\n oldFiber.index > newIdx\n ? ((nextOldFiber = oldFiber), (oldFiber = null))\n : (nextOldFiber = oldFiber.sibling);\n var newFiber = updateSlot(returnFiber, oldFiber, step.value, lanes);\n if (null === newFiber) {\n null === oldFiber && (oldFiber = nextOldFiber);\n break;\n }\n shouldTrackSideEffects &&\n oldFiber &&\n null === newFiber.alternate &&\n deleteChild(returnFiber, oldFiber);\n currentFirstChild = placeChild(newFiber, currentFirstChild, newIdx);\n null === previousNewFiber\n ? (resultingFirstChild = newFiber)\n : (previousNewFiber.sibling = newFiber);\n previousNewFiber = newFiber;\n oldFiber = nextOldFiber;\n }\n if (step.done)\n return (\n deleteRemainingChildren(returnFiber, oldFiber),\n isHydrating && pushTreeFork(returnFiber, newIdx),\n resultingFirstChild\n );\n if (null === oldFiber) {\n for (; !step.done; newIdx++, step = newChildren.next())\n (step = createChild(returnFiber, step.value, lanes)),\n null !== step &&\n ((currentFirstChild = placeChild(step, currentFirstChild, newIdx)),\n null === previousNewFiber\n ? (resultingFirstChild = step)\n : (previousNewFiber.sibling = step),\n (previousNewFiber = step));\n isHydrating && pushTreeFork(returnFiber, newIdx);\n return resultingFirstChild;\n }\n for (\n oldFiber = mapRemainingChildren(oldFiber);\n !step.done;\n newIdx++, step = newChildren.next()\n )\n (step = updateFromMap(oldFiber, returnFiber, newIdx, step.value, lanes)),\n null !== step &&\n (shouldTrackSideEffects &&\n null !== step.alternate &&\n oldFiber.delete(null === step.key ? newIdx : step.key),\n (currentFirstChild = placeChild(step, currentFirstChild, newIdx)),\n null === previousNewFiber\n ? (resultingFirstChild = step)\n : (previousNewFiber.sibling = step),\n (previousNewFiber = step));\n shouldTrackSideEffects &&\n oldFiber.forEach(function (child) {\n return deleteChild(returnFiber, child);\n });\n isHydrating && pushTreeFork(returnFiber, newIdx);\n return resultingFirstChild;\n }\n function reconcileChildFibersImpl(\n returnFiber,\n currentFirstChild,\n newChild,\n lanes\n ) {\n \"object\" === typeof newChild &&\n null !== newChild &&\n newChild.type === REACT_FRAGMENT_TYPE &&\n null === newChild.key &&\n (newChild = newChild.props.children);\n if (\"object\" === typeof newChild && null !== newChild) {\n switch (newChild.$$typeof) {\n case REACT_ELEMENT_TYPE:\n a: {\n for (var key = newChild.key; null !== currentFirstChild; ) {\n if (currentFirstChild.key === key) {\n key = newChild.type;\n if (key === REACT_FRAGMENT_TYPE) {\n if (7 === currentFirstChild.tag) {\n deleteRemainingChildren(\n returnFiber,\n currentFirstChild.sibling\n );\n lanes = useFiber(\n currentFirstChild,\n newChild.props.children\n );\n lanes.return = returnFiber;\n returnFiber = lanes;\n break a;\n }\n } else if (\n currentFirstChild.elementType === key ||\n (\"object\" === typeof key &&\n null !== key &&\n key.$$typeof === REACT_LAZY_TYPE &&\n resolveLazy(key) === currentFirstChild.type)\n ) {\n deleteRemainingChildren(\n returnFiber,\n currentFirstChild.sibling\n );\n lanes = useFiber(currentFirstChild, newChild.props);\n coerceRef(lanes, newChild);\n lanes.return = returnFiber;\n returnFiber = lanes;\n break a;\n }\n deleteRemainingChildren(returnFiber, currentFirstChild);\n break;\n } else deleteChild(returnFiber, currentFirstChild);\n currentFirstChild = currentFirstChild.sibling;\n }\n newChild.type === REACT_FRAGMENT_TYPE\n ? ((lanes = createFiberFromFragment(\n newChild.props.children,\n returnFiber.mode,\n lanes,\n newChild.key\n )),\n (lanes.return = returnFiber),\n (returnFiber = lanes))\n : ((lanes = createFiberFromTypeAndProps(\n newChild.type,\n newChild.key,\n newChild.props,\n null,\n returnFiber.mode,\n lanes\n )),\n coerceRef(lanes, newChild),\n (lanes.return = returnFiber),\n (returnFiber = lanes));\n }\n return placeSingleChild(returnFiber);\n case REACT_PORTAL_TYPE:\n a: {\n for (key = newChild.key; null !== currentFirstChild; ) {\n if (currentFirstChild.key === key)\n if (\n 4 === currentFirstChild.tag &&\n currentFirstChild.stateNode.containerInfo ===\n newChild.containerInfo &&\n currentFirstChild.stateNode.implementation ===\n newChild.implementation\n ) {\n deleteRemainingChildren(\n returnFiber,\n currentFirstChild.sibling\n );\n lanes = useFiber(currentFirstChild, newChild.children || []);\n lanes.return = returnFiber;\n returnFiber = lanes;\n break a;\n } else {\n deleteRemainingChildren(returnFiber, currentFirstChild);\n break;\n }\n else deleteChild(returnFiber, currentFirstChild);\n currentFirstChild = currentFirstChild.sibling;\n }\n lanes = createFiberFromPortal(newChild, returnFiber.mode, lanes);\n lanes.return = returnFiber;\n returnFiber = lanes;\n }\n return placeSingleChild(returnFiber);\n case REACT_LAZY_TYPE:\n return (\n (newChild = resolveLazy(newChild)),\n reconcileChildFibersImpl(\n returnFiber,\n currentFirstChild,\n newChild,\n lanes\n )\n );\n }\n if (isArrayImpl(newChild))\n return reconcileChildrenArray(\n returnFiber,\n currentFirstChild,\n newChild,\n lanes\n );\n if (getIteratorFn(newChild)) {\n key = getIteratorFn(newChild);\n if (\"function\" !== typeof key) throw Error(formatProdErrorMessage(150));\n newChild = key.call(newChild);\n return reconcileChildrenIterator(\n returnFiber,\n currentFirstChild,\n newChild,\n lanes\n );\n }\n if (\"function\" === typeof newChild.then)\n return reconcileChildFibersImpl(\n returnFiber,\n currentFirstChild,\n unwrapThenable(newChild),\n lanes\n );\n if (newChild.$$typeof === REACT_CONTEXT_TYPE)\n return reconcileChildFibersImpl(\n returnFiber,\n currentFirstChild,\n readContextDuringReconciliation(returnFiber, newChild),\n lanes\n );\n throwOnInvalidObjectTypeImpl(returnFiber, newChild);\n }\n return (\"string\" === typeof newChild && \"\" !== newChild) ||\n \"number\" === typeof newChild ||\n \"bigint\" === typeof newChild\n ? ((newChild = \"\" + newChild),\n null !== currentFirstChild && 6 === currentFirstChild.tag\n ? (deleteRemainingChildren(returnFiber, currentFirstChild.sibling),\n (lanes = useFiber(currentFirstChild, newChild)),\n (lanes.return = returnFiber),\n (returnFiber = lanes))\n : (deleteRemainingChildren(returnFiber, currentFirstChild),\n (lanes = createFiberFromText(newChild, returnFiber.mode, lanes)),\n (lanes.return = returnFiber),\n (returnFiber = lanes)),\n placeSingleChild(returnFiber))\n : deleteRemainingChildren(returnFiber, currentFirstChild);\n }\n return function (returnFiber, currentFirstChild, newChild, lanes) {\n try {\n thenableIndexCounter$1 = 0;\n var firstChildFiber = reconcileChildFibersImpl(\n returnFiber,\n currentFirstChild,\n newChild,\n lanes\n );\n thenableState$1 = null;\n return firstChildFiber;\n } catch (x) {\n if (x === SuspenseException || x === SuspenseActionException) throw x;\n var fiber = createFiberImplClass(29, x, null, returnFiber.mode);\n fiber.lanes = lanes;\n fiber.return = returnFiber;\n return fiber;\n } finally {\n }\n };\n}\nvar reconcileChildFibers = createChildReconciler(!0),\n mountChildFibers = createChildReconciler(!1),\n hasForceUpdate = !1;\nfunction initializeUpdateQueue(fiber) {\n fiber.updateQueue = {\n baseState: fiber.memoizedState,\n firstBaseUpdate: null,\n lastBaseUpdate: null,\n shared: { pending: null, lanes: 0, hiddenCallbacks: null },\n callbacks: null\n };\n}\nfunction cloneUpdateQueue(current, workInProgress) {\n current = current.updateQueue;\n workInProgress.updateQueue === current &&\n (workInProgress.updateQueue = {\n baseState: current.baseState,\n firstBaseUpdate: current.firstBaseUpdate,\n lastBaseUpdate: current.lastBaseUpdate,\n shared: current.shared,\n callbacks: null\n });\n}\nfunction createUpdate(lane) {\n return { lane: lane, tag: 0, payload: null, callback: null, next: null };\n}\nfunction enqueueUpdate(fiber, update, lane) {\n var updateQueue = fiber.updateQueue;\n if (null === updateQueue) return null;\n updateQueue = updateQueue.shared;\n if (0 !== (executionContext & 2)) {\n var pending = updateQueue.pending;\n null === pending\n ? (update.next = update)\n : ((update.next = pending.next), (pending.next = update));\n updateQueue.pending = update;\n update = getRootForUpdatedFiber(fiber);\n markUpdateLaneFromFiberToRoot(fiber, null, lane);\n return update;\n }\n enqueueUpdate$1(fiber, updateQueue, update, lane);\n return getRootForUpdatedFiber(fiber);\n}\nfunction entangleTransitions(root, fiber, lane) {\n fiber = fiber.updateQueue;\n if (null !== fiber && ((fiber = fiber.shared), 0 !== (lane & 4194048))) {\n var queueLanes = fiber.lanes;\n queueLanes &= root.pendingLanes;\n lane |= queueLanes;\n fiber.lanes = lane;\n markRootEntangled(root, lane);\n }\n}\nfunction enqueueCapturedUpdate(workInProgress, capturedUpdate) {\n var queue = workInProgress.updateQueue,\n current = workInProgress.alternate;\n if (\n null !== current &&\n ((current = current.updateQueue), queue === current)\n ) {\n var newFirst = null,\n newLast = null;\n queue = queue.firstBaseUpdate;\n if (null !== queue) {\n do {\n var clone = {\n lane: queue.lane,\n tag: queue.tag,\n payload: queue.payload,\n callback: null,\n next: null\n };\n null === newLast\n ? (newFirst = newLast = clone)\n : (newLast = newLast.next = clone);\n queue = queue.next;\n } while (null !== queue);\n null === newLast\n ? (newFirst = newLast = capturedUpdate)\n : (newLast = newLast.next = capturedUpdate);\n } else newFirst = newLast = capturedUpdate;\n queue = {\n baseState: current.baseState,\n firstBaseUpdate: newFirst,\n lastBaseUpdate: newLast,\n shared: current.shared,\n callbacks: current.callbacks\n };\n workInProgress.updateQueue = queue;\n return;\n }\n workInProgress = queue.lastBaseUpdate;\n null === workInProgress\n ? (queue.firstBaseUpdate = capturedUpdate)\n : (workInProgress.next = capturedUpdate);\n queue.lastBaseUpdate = capturedUpdate;\n}\nvar didReadFromEntangledAsyncAction = !1;\nfunction suspendIfUpdateReadFromEntangledAsyncAction() {\n if (didReadFromEntangledAsyncAction) {\n var entangledActionThenable = currentEntangledActionThenable;\n if (null !== entangledActionThenable) throw entangledActionThenable;\n }\n}\nfunction processUpdateQueue(\n workInProgress$jscomp$0,\n props,\n instance$jscomp$0,\n renderLanes\n) {\n didReadFromEntangledAsyncAction = !1;\n var queue = workInProgress$jscomp$0.updateQueue;\n hasForceUpdate = !1;\n var firstBaseUpdate = queue.firstBaseUpdate,\n lastBaseUpdate = queue.lastBaseUpdate,\n pendingQueue = queue.shared.pending;\n if (null !== pendingQueue) {\n queue.shared.pending = null;\n var lastPendingUpdate = pendingQueue,\n firstPendingUpdate = lastPendingUpdate.next;\n lastPendingUpdate.next = null;\n null === lastBaseUpdate\n ? (firstBaseUpdate = firstPendingUpdate)\n : (lastBaseUpdate.next = firstPendingUpdate);\n lastBaseUpdate = lastPendingUpdate;\n var current = workInProgress$jscomp$0.alternate;\n null !== current &&\n ((current = current.updateQueue),\n (pendingQueue = current.lastBaseUpdate),\n pendingQueue !== lastBaseUpdate &&\n (null === pendingQueue\n ? (current.firstBaseUpdate = firstPendingUpdate)\n : (pendingQueue.next = firstPendingUpdate),\n (current.lastBaseUpdate = lastPendingUpdate)));\n }\n if (null !== firstBaseUpdate) {\n var newState = queue.baseState;\n lastBaseUpdate = 0;\n current = firstPendingUpdate = lastPendingUpdate = null;\n pendingQueue = firstBaseUpdate;\n do {\n var updateLane = pendingQueue.lane & -536870913,\n isHiddenUpdate = updateLane !== pendingQueue.lane;\n if (\n isHiddenUpdate\n ? (workInProgressRootRenderLanes & updateLane) === updateLane\n : (renderLanes & updateLane) === updateLane\n ) {\n 0 !== updateLane &&\n updateLane === currentEntangledLane &&\n (didReadFromEntangledAsyncAction = !0);\n null !== current &&\n (current = current.next =\n {\n lane: 0,\n tag: pendingQueue.tag,\n payload: pendingQueue.payload,\n callback: null,\n next: null\n });\n a: {\n var workInProgress = workInProgress$jscomp$0,\n update = pendingQueue;\n updateLane = props;\n var instance = instance$jscomp$0;\n switch (update.tag) {\n case 1:\n workInProgress = update.payload;\n if (\"function\" === typeof workInProgress) {\n newState = workInProgress.call(instance, newState, updateLane);\n break a;\n }\n newState = workInProgress;\n break a;\n case 3:\n workInProgress.flags = (workInProgress.flags & -65537) | 128;\n case 0:\n workInProgress = update.payload;\n updateLane =\n \"function\" === typeof workInProgress\n ? workInProgress.call(instance, newState, updateLane)\n : workInProgress;\n if (null === updateLane || void 0 === updateLane) break a;\n newState = assign({}, newState, updateLane);\n break a;\n case 2:\n hasForceUpdate = !0;\n }\n }\n updateLane = pendingQueue.callback;\n null !== updateLane &&\n ((workInProgress$jscomp$0.flags |= 64),\n isHiddenUpdate && (workInProgress$jscomp$0.flags |= 8192),\n (isHiddenUpdate = queue.callbacks),\n null === isHiddenUpdate\n ? (queue.callbacks = [updateLane])\n : isHiddenUpdate.push(updateLane));\n } else\n (isHiddenUpdate = {\n lane: updateLane,\n tag: pendingQueue.tag,\n payload: pendingQueue.payload,\n callback: pendingQueue.callback,\n next: null\n }),\n null === current\n ? ((firstPendingUpdate = current = isHiddenUpdate),\n (lastPendingUpdate = newState))\n : (current = current.next = isHiddenUpdate),\n (lastBaseUpdate |= updateLane);\n pendingQueue = pendingQueue.next;\n if (null === pendingQueue)\n if (((pendingQueue = queue.shared.pending), null === pendingQueue))\n break;\n else\n (isHiddenUpdate = pendingQueue),\n (pendingQueue = isHiddenUpdate.next),\n (isHiddenUpdate.next = null),\n (queue.lastBaseUpdate = isHiddenUpdate),\n (queue.shared.pending = null);\n } while (1);\n null === current && (lastPendingUpdate = newState);\n queue.baseState = lastPendingUpdate;\n queue.firstBaseUpdate = firstPendingUpdate;\n queue.lastBaseUpdate = current;\n null === firstBaseUpdate && (queue.shared.lanes = 0);\n workInProgressRootSkippedLanes |= lastBaseUpdate;\n workInProgress$jscomp$0.lanes = lastBaseUpdate;\n workInProgress$jscomp$0.memoizedState = newState;\n }\n}\nfunction callCallback(callback, context) {\n if (\"function\" !== typeof callback)\n throw Error(formatProdErrorMessage(191, callback));\n callback.call(context);\n}\nfunction commitCallbacks(updateQueue, context) {\n var callbacks = updateQueue.callbacks;\n if (null !== callbacks)\n for (\n updateQueue.callbacks = null, updateQueue = 0;\n updateQueue < callbacks.length;\n updateQueue++\n )\n callCallback(callbacks[updateQueue], context);\n}\nvar currentTreeHiddenStackCursor = createCursor(null),\n prevEntangledRenderLanesCursor = createCursor(0);\nfunction pushHiddenContext(fiber, context) {\n fiber = entangledRenderLanes;\n push(prevEntangledRenderLanesCursor, fiber);\n push(currentTreeHiddenStackCursor, context);\n entangledRenderLanes = fiber | context.baseLanes;\n}\nfunction reuseHiddenContextOnStack() {\n push(prevEntangledRenderLanesCursor, entangledRenderLanes);\n push(currentTreeHiddenStackCursor, currentTreeHiddenStackCursor.current);\n}\nfunction popHiddenContext() {\n entangledRenderLanes = prevEntangledRenderLanesCursor.current;\n pop(currentTreeHiddenStackCursor);\n pop(prevEntangledRenderLanesCursor);\n}\nvar suspenseHandlerStackCursor = createCursor(null),\n shellBoundary = null;\nfunction pushPrimaryTreeSuspenseHandler(handler) {\n var current = handler.alternate;\n push(suspenseStackCursor, suspenseStackCursor.current & 1);\n push(suspenseHandlerStackCursor, handler);\n null === shellBoundary &&\n (null === current || null !== currentTreeHiddenStackCursor.current\n ? (shellBoundary = handler)\n : null !== current.memoizedState && (shellBoundary = handler));\n}\nfunction pushDehydratedActivitySuspenseHandler(fiber) {\n push(suspenseStackCursor, suspenseStackCursor.current);\n push(suspenseHandlerStackCursor, fiber);\n null === shellBoundary && (shellBoundary = fiber);\n}\nfunction pushOffscreenSuspenseHandler(fiber) {\n 22 === fiber.tag\n ? (push(suspenseStackCursor, suspenseStackCursor.current),\n push(suspenseHandlerStackCursor, fiber),\n null === shellBoundary && (shellBoundary = fiber))\n : reuseSuspenseHandlerOnStack(fiber);\n}\nfunction reuseSuspenseHandlerOnStack() {\n push(suspenseStackCursor, suspenseStackCursor.current);\n push(suspenseHandlerStackCursor, suspenseHandlerStackCursor.current);\n}\nfunction popSuspenseHandler(fiber) {\n pop(suspenseHandlerStackCursor);\n shellBoundary === fiber && (shellBoundary = null);\n pop(suspenseStackCursor);\n}\nvar suspenseStackCursor = createCursor(0);\nfunction findFirstSuspended(row) {\n for (var node = row; null !== node; ) {\n if (13 === node.tag) {\n var state = node.memoizedState;\n if (\n null !== state &&\n ((state = state.dehydrated),\n null === state ||\n isSuspenseInstancePending(state) ||\n isSuspenseInstanceFallback(state))\n )\n return node;\n } else if (\n 19 === node.tag &&\n (\"forwards\" === node.memoizedProps.revealOrder ||\n \"backwards\" === node.memoizedProps.revealOrder ||\n \"unstable_legacy-backwards\" === node.memoizedProps.revealOrder ||\n \"together\" === node.memoizedProps.revealOrder)\n ) {\n if (0 !== (node.flags & 128)) return node;\n } else if (null !== node.child) {\n node.child.return = node;\n node = node.child;\n continue;\n }\n if (node === row) break;\n for (; null === node.sibling; ) {\n if (null === node.return || node.return === row) return null;\n node = node.return;\n }\n node.sibling.return = node.return;\n node = node.sibling;\n }\n return null;\n}\nvar renderLanes = 0,\n currentlyRenderingFiber = null,\n currentHook = null,\n workInProgressHook = null,\n didScheduleRenderPhaseUpdate = !1,\n didScheduleRenderPhaseUpdateDuringThisPass = !1,\n shouldDoubleInvokeUserFnsInHooksDEV = !1,\n localIdCounter = 0,\n thenableIndexCounter = 0,\n thenableState = null,\n globalClientIdCounter = 0;\nfunction throwInvalidHookError() {\n throw Error(formatProdErrorMessage(321));\n}\nfunction areHookInputsEqual(nextDeps, prevDeps) {\n if (null === prevDeps) return !1;\n for (var i = 0; i < prevDeps.length && i < nextDeps.length; i++)\n if (!objectIs(nextDeps[i], prevDeps[i])) return !1;\n return !0;\n}\nfunction renderWithHooks(\n current,\n workInProgress,\n Component,\n props,\n secondArg,\n nextRenderLanes\n) {\n renderLanes = nextRenderLanes;\n currentlyRenderingFiber = workInProgress;\n workInProgress.memoizedState = null;\n workInProgress.updateQueue = null;\n workInProgress.lanes = 0;\n ReactSharedInternals.H =\n null === current || null === current.memoizedState\n ? HooksDispatcherOnMount\n : HooksDispatcherOnUpdate;\n shouldDoubleInvokeUserFnsInHooksDEV = !1;\n nextRenderLanes = Component(props, secondArg);\n shouldDoubleInvokeUserFnsInHooksDEV = !1;\n didScheduleRenderPhaseUpdateDuringThisPass &&\n (nextRenderLanes = renderWithHooksAgain(\n workInProgress,\n Component,\n props,\n secondArg\n ));\n finishRenderingHooks(current);\n return nextRenderLanes;\n}\nfunction finishRenderingHooks(current) {\n ReactSharedInternals.H = ContextOnlyDispatcher;\n var didRenderTooFewHooks = null !== currentHook && null !== currentHook.next;\n renderLanes = 0;\n workInProgressHook = currentHook = currentlyRenderingFiber = null;\n didScheduleRenderPhaseUpdate = !1;\n thenableIndexCounter = 0;\n thenableState = null;\n if (didRenderTooFewHooks) throw Error(formatProdErrorMessage(300));\n null === current ||\n didReceiveUpdate ||\n ((current = current.dependencies),\n null !== current &&\n checkIfContextChanged(current) &&\n (didReceiveUpdate = !0));\n}\nfunction renderWithHooksAgain(workInProgress, Component, props, secondArg) {\n currentlyRenderingFiber = workInProgress;\n var numberOfReRenders = 0;\n do {\n didScheduleRenderPhaseUpdateDuringThisPass && (thenableState = null);\n thenableIndexCounter = 0;\n didScheduleRenderPhaseUpdateDuringThisPass = !1;\n if (25 <= numberOfReRenders) throw Error(formatProdErrorMessage(301));\n numberOfReRenders += 1;\n workInProgressHook = currentHook = null;\n if (null != workInProgress.updateQueue) {\n var children = workInProgress.updateQueue;\n children.lastEffect = null;\n children.events = null;\n children.stores = null;\n null != children.memoCache && (children.memoCache.index = 0);\n }\n ReactSharedInternals.H = HooksDispatcherOnRerender;\n children = Component(props, secondArg);\n } while (didScheduleRenderPhaseUpdateDuringThisPass);\n return children;\n}\nfunction TransitionAwareHostComponent() {\n var dispatcher = ReactSharedInternals.H,\n maybeThenable = dispatcher.useState()[0];\n maybeThenable =\n \"function\" === typeof maybeThenable.then\n ? useThenable(maybeThenable)\n : maybeThenable;\n dispatcher = dispatcher.useState()[0];\n (null !== currentHook ? currentHook.memoizedState : null) !== dispatcher &&\n (currentlyRenderingFiber.flags |= 1024);\n return maybeThenable;\n}\nfunction checkDidRenderIdHook() {\n var didRenderIdHook = 0 !== localIdCounter;\n localIdCounter = 0;\n return didRenderIdHook;\n}\nfunction bailoutHooks(current, workInProgress, lanes) {\n workInProgress.updateQueue = current.updateQueue;\n workInProgress.flags &= -2053;\n current.lanes &= ~lanes;\n}\nfunction resetHooksOnUnwind(workInProgress) {\n if (didScheduleRenderPhaseUpdate) {\n for (\n workInProgress = workInProgress.memoizedState;\n null !== workInProgress;\n\n ) {\n var queue = workInProgress.queue;\n null !== queue && (queue.pending = null);\n workInProgress = workInProgress.next;\n }\n didScheduleRenderPhaseUpdate = !1;\n }\n renderLanes = 0;\n workInProgressHook = currentHook = currentlyRenderingFiber = null;\n didScheduleRenderPhaseUpdateDuringThisPass = !1;\n thenableIndexCounter = localIdCounter = 0;\n thenableState = null;\n}\nfunction mountWorkInProgressHook() {\n var hook = {\n memoizedState: null,\n baseState: null,\n baseQueue: null,\n queue: null,\n next: null\n };\n null === workInProgressHook\n ? (currentlyRenderingFiber.memoizedState = workInProgressHook = hook)\n : (workInProgressHook = workInProgressHook.next = hook);\n return workInProgressHook;\n}\nfunction updateWorkInProgressHook() {\n if (null === currentHook) {\n var nextCurrentHook = currentlyRenderingFiber.alternate;\n nextCurrentHook =\n null !== nextCurrentHook ? nextCurrentHook.memoizedState : null;\n } else nextCurrentHook = currentHook.next;\n var nextWorkInProgressHook =\n null === workInProgressHook\n ? currentlyRenderingFiber.memoizedState\n : workInProgressHook.next;\n if (null !== nextWorkInProgressHook)\n (workInProgressHook = nextWorkInProgressHook),\n (currentHook = nextCurrentHook);\n else {\n if (null === nextCurrentHook) {\n if (null === currentlyRenderingFiber.alternate)\n throw Error(formatProdErrorMessage(467));\n throw Error(formatProdErrorMessage(310));\n }\n currentHook = nextCurrentHook;\n nextCurrentHook = {\n memoizedState: currentHook.memoizedState,\n baseState: currentHook.baseState,\n baseQueue: currentHook.baseQueue,\n queue: currentHook.queue,\n next: null\n };\n null === workInProgressHook\n ? (currentlyRenderingFiber.memoizedState = workInProgressHook =\n nextCurrentHook)\n : (workInProgressHook = workInProgressHook.next = nextCurrentHook);\n }\n return workInProgressHook;\n}\nfunction createFunctionComponentUpdateQueue() {\n return { lastEffect: null, events: null, stores: null, memoCache: null };\n}\nfunction useThenable(thenable) {\n var index = thenableIndexCounter;\n thenableIndexCounter += 1;\n null === thenableState && (thenableState = []);\n thenable = trackUsedThenable(thenableState, thenable, index);\n index = currentlyRenderingFiber;\n null ===\n (null === workInProgressHook\n ? index.memoizedState\n : workInProgressHook.next) &&\n ((index = index.alternate),\n (ReactSharedInternals.H =\n null === index || null === index.memoizedState\n ? HooksDispatcherOnMount\n : HooksDispatcherOnUpdate));\n return thenable;\n}\nfunction use(usable) {\n if (null !== usable && \"object\" === typeof usable) {\n if (\"function\" === typeof usable.then) return useThenable(usable);\n if (usable.$$typeof === REACT_CONTEXT_TYPE) return readContext(usable);\n }\n throw Error(formatProdErrorMessage(438, String(usable)));\n}\nfunction useMemoCache(size) {\n var memoCache = null,\n updateQueue = currentlyRenderingFiber.updateQueue;\n null !== updateQueue && (memoCache = updateQueue.memoCache);\n if (null == memoCache) {\n var current = currentlyRenderingFiber.alternate;\n null !== current &&\n ((current = current.updateQueue),\n null !== current &&\n ((current = current.memoCache),\n null != current &&\n (memoCache = {\n data: current.data.map(function (array) {\n return array.slice();\n }),\n index: 0\n })));\n }\n null == memoCache && (memoCache = { data: [], index: 0 });\n null === updateQueue &&\n ((updateQueue = createFunctionComponentUpdateQueue()),\n (currentlyRenderingFiber.updateQueue = updateQueue));\n updateQueue.memoCache = memoCache;\n updateQueue = memoCache.data[memoCache.index];\n if (void 0 === updateQueue)\n for (\n updateQueue = memoCache.data[memoCache.index] = Array(size), current = 0;\n current < size;\n current++\n )\n updateQueue[current] = REACT_MEMO_CACHE_SENTINEL;\n memoCache.index++;\n return updateQueue;\n}\nfunction basicStateReducer(state, action) {\n return \"function\" === typeof action ? action(state) : action;\n}\nfunction updateReducer(reducer) {\n var hook = updateWorkInProgressHook();\n return updateReducerImpl(hook, currentHook, reducer);\n}\nfunction updateReducerImpl(hook, current, reducer) {\n var queue = hook.queue;\n if (null === queue) throw Error(formatProdErrorMessage(311));\n queue.lastRenderedReducer = reducer;\n var baseQueue = hook.baseQueue,\n pendingQueue = queue.pending;\n if (null !== pendingQueue) {\n if (null !== baseQueue) {\n var baseFirst = baseQueue.next;\n baseQueue.next = pendingQueue.next;\n pendingQueue.next = baseFirst;\n }\n current.baseQueue = baseQueue = pendingQueue;\n queue.pending = null;\n }\n pendingQueue = hook.baseState;\n if (null === baseQueue) hook.memoizedState = pendingQueue;\n else {\n current = baseQueue.next;\n var newBaseQueueFirst = (baseFirst = null),\n newBaseQueueLast = null,\n update = current,\n didReadFromEntangledAsyncAction$60 = !1;\n do {\n var updateLane = update.lane & -536870913;\n if (\n updateLane !== update.lane\n ? (workInProgressRootRenderLanes & updateLane) === updateLane\n : (renderLanes & updateLane) === updateLane\n ) {\n var revertLane = update.revertLane;\n if (0 === revertLane)\n null !== newBaseQueueLast &&\n (newBaseQueueLast = newBaseQueueLast.next =\n {\n lane: 0,\n revertLane: 0,\n gesture: null,\n action: update.action,\n hasEagerState: update.hasEagerState,\n eagerState: update.eagerState,\n next: null\n }),\n updateLane === currentEntangledLane &&\n (didReadFromEntangledAsyncAction$60 = !0);\n else if ((renderLanes & revertLane) === revertLane) {\n update = update.next;\n revertLane === currentEntangledLane &&\n (didReadFromEntangledAsyncAction$60 = !0);\n continue;\n } else\n (updateLane = {\n lane: 0,\n revertLane: update.revertLane,\n gesture: null,\n action: update.action,\n hasEagerState: update.hasEagerState,\n eagerState: update.eagerState,\n next: null\n }),\n null === newBaseQueueLast\n ? ((newBaseQueueFirst = newBaseQueueLast = updateLane),\n (baseFirst = pendingQueue))\n : (newBaseQueueLast = newBaseQueueLast.next = updateLane),\n (currentlyRenderingFiber.lanes |= revertLane),\n (workInProgressRootSkippedLanes |= revertLane);\n updateLane = update.action;\n shouldDoubleInvokeUserFnsInHooksDEV &&\n reducer(pendingQueue, updateLane);\n pendingQueue = update.hasEagerState\n ? update.eagerState\n : reducer(pendingQueue, updateLane);\n } else\n (revertLane = {\n lane: updateLane,\n revertLane: update.revertLane,\n gesture: update.gesture,\n action: update.action,\n hasEagerState: update.hasEagerState,\n eagerState: update.eagerState,\n next: null\n }),\n null === newBaseQueueLast\n ? ((newBaseQueueFirst = newBaseQueueLast = revertLane),\n (baseFirst = pendingQueue))\n : (newBaseQueueLast = newBaseQueueLast.next = revertLane),\n (currentlyRenderingFiber.lanes |= updateLane),\n (workInProgressRootSkippedLanes |= updateLane);\n update = update.next;\n } while (null !== update && update !== current);\n null === newBaseQueueLast\n ? (baseFirst = pendingQueue)\n : (newBaseQueueLast.next = newBaseQueueFirst);\n if (\n !objectIs(pendingQueue, hook.memoizedState) &&\n ((didReceiveUpdate = !0),\n didReadFromEntangledAsyncAction$60 &&\n ((reducer = currentEntangledActionThenable), null !== reducer))\n )\n throw reducer;\n hook.memoizedState = pendingQueue;\n hook.baseState = baseFirst;\n hook.baseQueue = newBaseQueueLast;\n queue.lastRenderedState = pendingQueue;\n }\n null === baseQueue && (queue.lanes = 0);\n return [hook.memoizedState, queue.dispatch];\n}\nfunction rerenderReducer(reducer) {\n var hook = updateWorkInProgressHook(),\n queue = hook.queue;\n if (null === queue) throw Error(formatProdErrorMessage(311));\n queue.lastRenderedReducer = reducer;\n var dispatch = queue.dispatch,\n lastRenderPhaseUpdate = queue.pending,\n newState = hook.memoizedState;\n if (null !== lastRenderPhaseUpdate) {\n queue.pending = null;\n var update = (lastRenderPhaseUpdate = lastRenderPhaseUpdate.next);\n do (newState = reducer(newState, update.action)), (update = update.next);\n while (update !== lastRenderPhaseUpdate);\n objectIs(newState, hook.memoizedState) || (didReceiveUpdate = !0);\n hook.memoizedState = newState;\n null === hook.baseQueue && (hook.baseState = newState);\n queue.lastRenderedState = newState;\n }\n return [newState, dispatch];\n}\nfunction updateSyncExternalStore(subscribe, getSnapshot, getServerSnapshot) {\n var fiber = currentlyRenderingFiber,\n hook = updateWorkInProgressHook(),\n isHydrating$jscomp$0 = isHydrating;\n if (isHydrating$jscomp$0) {\n if (void 0 === getServerSnapshot) throw Error(formatProdErrorMessage(407));\n getServerSnapshot = getServerSnapshot();\n } else getServerSnapshot = getSnapshot();\n var snapshotChanged = !objectIs(\n (currentHook || hook).memoizedState,\n getServerSnapshot\n );\n snapshotChanged &&\n ((hook.memoizedState = getServerSnapshot), (didReceiveUpdate = !0));\n hook = hook.queue;\n updateEffect(subscribeToStore.bind(null, fiber, hook, subscribe), [\n subscribe\n ]);\n if (\n hook.getSnapshot !== getSnapshot ||\n snapshotChanged ||\n (null !== workInProgressHook && workInProgressHook.memoizedState.tag & 1)\n ) {\n fiber.flags |= 2048;\n pushSimpleEffect(\n 9,\n { destroy: void 0 },\n updateStoreInstance.bind(\n null,\n fiber,\n hook,\n getServerSnapshot,\n getSnapshot\n ),\n null\n );\n if (null === workInProgressRoot) throw Error(formatProdErrorMessage(349));\n isHydrating$jscomp$0 ||\n 0 !== (renderLanes & 127) ||\n pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);\n }\n return getServerSnapshot;\n}\nfunction pushStoreConsistencyCheck(fiber, getSnapshot, renderedSnapshot) {\n fiber.flags |= 16384;\n fiber = { getSnapshot: getSnapshot, value: renderedSnapshot };\n getSnapshot = currentlyRenderingFiber.updateQueue;\n null === getSnapshot\n ? ((getSnapshot = createFunctionComponentUpdateQueue()),\n (currentlyRenderingFiber.updateQueue = getSnapshot),\n (getSnapshot.stores = [fiber]))\n : ((renderedSnapshot = getSnapshot.stores),\n null === renderedSnapshot\n ? (getSnapshot.stores = [fiber])\n : renderedSnapshot.push(fiber));\n}\nfunction updateStoreInstance(fiber, inst, nextSnapshot, getSnapshot) {\n inst.value = nextSnapshot;\n inst.getSnapshot = getSnapshot;\n checkIfSnapshotChanged(inst) && forceStoreRerender(fiber);\n}\nfunction subscribeToStore(fiber, inst, subscribe) {\n return subscribe(function () {\n checkIfSnapshotChanged(inst) && forceStoreRerender(fiber);\n });\n}\nfunction checkIfSnapshotChanged(inst) {\n var latestGetSnapshot = inst.getSnapshot;\n inst = inst.value;\n try {\n var nextValue = latestGetSnapshot();\n return !objectIs(inst, nextValue);\n } catch (error) {\n return !0;\n }\n}\nfunction forceStoreRerender(fiber) {\n var root = enqueueConcurrentRenderForLane(fiber, 2);\n null !== root && scheduleUpdateOnFiber(root, fiber, 2);\n}\nfunction mountStateImpl(initialState) {\n var hook = mountWorkInProgressHook();\n if (\"function\" === typeof initialState) {\n var initialStateInitializer = initialState;\n initialState = initialStateInitializer();\n if (shouldDoubleInvokeUserFnsInHooksDEV) {\n setIsStrictModeForDevtools(!0);\n try {\n initialStateInitializer();\n } finally {\n setIsStrictModeForDevtools(!1);\n }\n }\n }\n hook.memoizedState = hook.baseState = initialState;\n hook.queue = {\n pending: null,\n lanes: 0,\n dispatch: null,\n lastRenderedReducer: basicStateReducer,\n lastRenderedState: initialState\n };\n return hook;\n}\nfunction updateOptimisticImpl(hook, current, passthrough, reducer) {\n hook.baseState = passthrough;\n return updateReducerImpl(\n hook,\n currentHook,\n \"function\" === typeof reducer ? reducer : basicStateReducer\n );\n}\nfunction dispatchActionState(\n fiber,\n actionQueue,\n setPendingState,\n setState,\n payload\n) {\n if (isRenderPhaseUpdate(fiber)) throw Error(formatProdErrorMessage(485));\n fiber = actionQueue.action;\n if (null !== fiber) {\n var actionNode = {\n payload: payload,\n action: fiber,\n next: null,\n isTransition: !0,\n status: \"pending\",\n value: null,\n reason: null,\n listeners: [],\n then: function (listener) {\n actionNode.listeners.push(listener);\n }\n };\n null !== ReactSharedInternals.T\n ? setPendingState(!0)\n : (actionNode.isTransition = !1);\n setState(actionNode);\n setPendingState = actionQueue.pending;\n null === setPendingState\n ? ((actionNode.next = actionQueue.pending = actionNode),\n runActionStateAction(actionQueue, actionNode))\n : ((actionNode.next = setPendingState.next),\n (actionQueue.pending = setPendingState.next = actionNode));\n }\n}\nfunction runActionStateAction(actionQueue, node) {\n var action = node.action,\n payload = node.payload,\n prevState = actionQueue.state;\n if (node.isTransition) {\n var prevTransition = ReactSharedInternals.T,\n currentTransition = {};\n ReactSharedInternals.T = currentTransition;\n try {\n var returnValue = action(prevState, payload),\n onStartTransitionFinish = ReactSharedInternals.S;\n null !== onStartTransitionFinish &&\n onStartTransitionFinish(currentTransition, returnValue);\n handleActionReturnValue(actionQueue, node, returnValue);\n } catch (error) {\n onActionError(actionQueue, node, error);\n } finally {\n null !== prevTransition &&\n null !== currentTransition.types &&\n (prevTransition.types = currentTransition.types),\n (ReactSharedInternals.T = prevTransition);\n }\n } else\n try {\n (prevTransition = action(prevState, payload)),\n handleActionReturnValue(actionQueue, node, prevTransition);\n } catch (error$66) {\n onActionError(actionQueue, node, error$66);\n }\n}\nfunction handleActionReturnValue(actionQueue, node, returnValue) {\n null !== returnValue &&\n \"object\" === typeof returnValue &&\n \"function\" === typeof returnValue.then\n ? returnValue.then(\n function (nextState) {\n onActionSuccess(actionQueue, node, nextState);\n },\n function (error) {\n return onActionError(actionQueue, node, error);\n }\n )\n : onActionSuccess(actionQueue, node, returnValue);\n}\nfunction onActionSuccess(actionQueue, actionNode, nextState) {\n actionNode.status = \"fulfilled\";\n actionNode.value = nextState;\n notifyActionListeners(actionNode);\n actionQueue.state = nextState;\n actionNode = actionQueue.pending;\n null !== actionNode &&\n ((nextState = actionNode.next),\n nextState === actionNode\n ? (actionQueue.pending = null)\n : ((nextState = nextState.next),\n (actionNode.next = nextState),\n runActionStateAction(actionQueue, nextState)));\n}\nfunction onActionError(actionQueue, actionNode, error) {\n var last = actionQueue.pending;\n actionQueue.pending = null;\n if (null !== last) {\n last = last.next;\n do\n (actionNode.status = \"rejected\"),\n (actionNode.reason = error),\n notifyActionListeners(actionNode),\n (actionNode = actionNode.next);\n while (actionNode !== last);\n }\n actionQueue.action = null;\n}\nfunction notifyActionListeners(actionNode) {\n actionNode = actionNode.listeners;\n for (var i = 0; i < actionNode.length; i++) (0, actionNode[i])();\n}\nfunction actionStateReducer(oldState, newState) {\n return newState;\n}\nfunction mountActionState(action, initialStateProp) {\n if (isHydrating) {\n var ssrFormState = workInProgressRoot.formState;\n if (null !== ssrFormState) {\n a: {\n var JSCompiler_inline_result = currentlyRenderingFiber;\n if (isHydrating) {\n if (nextHydratableInstance) {\n b: {\n var JSCompiler_inline_result$jscomp$0 = nextHydratableInstance;\n for (\n var inRootOrSingleton = rootOrSingletonContext;\n 8 !== JSCompiler_inline_result$jscomp$0.nodeType;\n\n ) {\n if (!inRootOrSingleton) {\n JSCompiler_inline_result$jscomp$0 = null;\n break b;\n }\n JSCompiler_inline_result$jscomp$0 = getNextHydratable(\n JSCompiler_inline_result$jscomp$0.nextSibling\n );\n if (null === JSCompiler_inline_result$jscomp$0) {\n JSCompiler_inline_result$jscomp$0 = null;\n break b;\n }\n }\n inRootOrSingleton = JSCompiler_inline_result$jscomp$0.data;\n JSCompiler_inline_result$jscomp$0 =\n \"F!\" === inRootOrSingleton || \"F\" === inRootOrSingleton\n ? JSCompiler_inline_result$jscomp$0\n : null;\n }\n if (JSCompiler_inline_result$jscomp$0) {\n nextHydratableInstance = getNextHydratable(\n JSCompiler_inline_result$jscomp$0.nextSibling\n );\n JSCompiler_inline_result =\n \"F!\" === JSCompiler_inline_result$jscomp$0.data;\n break a;\n }\n }\n throwOnHydrationMismatch(JSCompiler_inline_result);\n }\n JSCompiler_inline_result = !1;\n }\n JSCompiler_inline_result && (initialStateProp = ssrFormState[0]);\n }\n }\n ssrFormState = mountWorkInProgressHook();\n ssrFormState.memoizedState = ssrFormState.baseState = initialStateProp;\n JSCompiler_inline_result = {\n pending: null,\n lanes: 0,\n dispatch: null,\n lastRenderedReducer: actionStateReducer,\n lastRenderedState: initialStateProp\n };\n ssrFormState.queue = JSCompiler_inline_result;\n ssrFormState = dispatchSetState.bind(\n null,\n currentlyRenderingFiber,\n JSCompiler_inline_result\n );\n JSCompiler_inline_result.dispatch = ssrFormState;\n JSCompiler_inline_result = mountStateImpl(!1);\n inRootOrSingleton = dispatchOptimisticSetState.bind(\n null,\n currentlyRenderingFiber,\n !1,\n JSCompiler_inline_result.queue\n );\n JSCompiler_inline_result = mountWorkInProgressHook();\n JSCompiler_inline_result$jscomp$0 = {\n state: initialStateProp,\n dispatch: null,\n action: action,\n pending: null\n };\n JSCompiler_inline_result.queue = JSCompiler_inline_result$jscomp$0;\n ssrFormState = dispatchActionState.bind(\n null,\n currentlyRenderingFiber,\n JSCompiler_inline_result$jscomp$0,\n inRootOrSingleton,\n ssrFormState\n );\n JSCompiler_inline_result$jscomp$0.dispatch = ssrFormState;\n JSCompiler_inline_result.memoizedState = action;\n return [initialStateProp, ssrFormState, !1];\n}\nfunction updateActionState(action) {\n var stateHook = updateWorkInProgressHook();\n return updateActionStateImpl(stateHook, currentHook, action);\n}\nfunction updateActionStateImpl(stateHook, currentStateHook, action) {\n currentStateHook = updateReducerImpl(\n stateHook,\n currentStateHook,\n actionStateReducer\n )[0];\n stateHook = updateReducer(basicStateReducer)[0];\n if (\n \"object\" === typeof currentStateHook &&\n null !== currentStateHook &&\n \"function\" === typeof currentStateHook.then\n )\n try {\n var state = useThenable(currentStateHook);\n } catch (x) {\n if (x === SuspenseException) throw SuspenseActionException;\n throw x;\n }\n else state = currentStateHook;\n currentStateHook = updateWorkInProgressHook();\n var actionQueue = currentStateHook.queue,\n dispatch = actionQueue.dispatch;\n action !== currentStateHook.memoizedState &&\n ((currentlyRenderingFiber.flags |= 2048),\n pushSimpleEffect(\n 9,\n { destroy: void 0 },\n actionStateActionEffect.bind(null, actionQueue, action),\n null\n ));\n return [state, dispatch, stateHook];\n}\nfunction actionStateActionEffect(actionQueue, action) {\n actionQueue.action = action;\n}\nfunction rerenderActionState(action) {\n var stateHook = updateWorkInProgressHook(),\n currentStateHook = currentHook;\n if (null !== currentStateHook)\n return updateActionStateImpl(stateHook, currentStateHook, action);\n updateWorkInProgressHook();\n stateHook = stateHook.memoizedState;\n currentStateHook = updateWorkInProgressHook();\n var dispatch = currentStateHook.queue.dispatch;\n currentStateHook.memoizedState = action;\n return [stateHook, dispatch, !1];\n}\nfunction pushSimpleEffect(tag, inst, create, deps) {\n tag = { tag: tag, create: create, deps: deps, inst: inst, next: null };\n inst = currentlyRenderingFiber.updateQueue;\n null === inst &&\n ((inst = createFunctionComponentUpdateQueue()),\n (currentlyRenderingFiber.updateQueue = inst));\n create = inst.lastEffect;\n null === create\n ? (inst.lastEffect = tag.next = tag)\n : ((deps = create.next),\n (create.next = tag),\n (tag.next = deps),\n (inst.lastEffect = tag));\n return tag;\n}\nfunction updateRef() {\n return updateWorkInProgressHook().memoizedState;\n}\nfunction mountEffectImpl(fiberFlags, hookFlags, create, deps) {\n var hook = mountWorkInProgressHook();\n currentlyRenderingFiber.flags |= fiberFlags;\n hook.memoizedState = pushSimpleEffect(\n 1 | hookFlags,\n { destroy: void 0 },\n create,\n void 0 === deps ? null : deps\n );\n}\nfunction updateEffectImpl(fiberFlags, hookFlags, create, deps) {\n var hook = updateWorkInProgressHook();\n deps = void 0 === deps ? null : deps;\n var inst = hook.memoizedState.inst;\n null !== currentHook &&\n null !== deps &&\n areHookInputsEqual(deps, currentHook.memoizedState.deps)\n ? (hook.memoizedState = pushSimpleEffect(hookFlags, inst, create, deps))\n : ((currentlyRenderingFiber.flags |= fiberFlags),\n (hook.memoizedState = pushSimpleEffect(\n 1 | hookFlags,\n inst,\n create,\n deps\n )));\n}\nfunction mountEffect(create, deps) {\n mountEffectImpl(8390656, 8, create, deps);\n}\nfunction updateEffect(create, deps) {\n updateEffectImpl(2048, 8, create, deps);\n}\nfunction useEffectEventImpl(payload) {\n currentlyRenderingFiber.flags |= 4;\n var componentUpdateQueue = currentlyRenderingFiber.updateQueue;\n if (null === componentUpdateQueue)\n (componentUpdateQueue = createFunctionComponentUpdateQueue()),\n (currentlyRenderingFiber.updateQueue = componentUpdateQueue),\n (componentUpdateQueue.events = [payload]);\n else {\n var events = componentUpdateQueue.events;\n null === events\n ? (componentUpdateQueue.events = [payload])\n : events.push(payload);\n }\n}\nfunction updateEvent(callback) {\n var ref = updateWorkInProgressHook().memoizedState;\n useEffectEventImpl({ ref: ref, nextImpl: callback });\n return function () {\n if (0 !== (executionContext & 2)) throw Error(formatProdErrorMessage(440));\n return ref.impl.apply(void 0, arguments);\n };\n}\nfunction updateInsertionEffect(create, deps) {\n return updateEffectImpl(4, 2, create, deps);\n}\nfunction updateLayoutEffect(create, deps) {\n return updateEffectImpl(4, 4, create, deps);\n}\nfunction imperativeHandleEffect(create, ref) {\n if (\"function\" === typeof ref) {\n create = create();\n var refCleanup = ref(create);\n return function () {\n \"function\" === typeof refCleanup ? refCleanup() : ref(null);\n };\n }\n if (null !== ref && void 0 !== ref)\n return (\n (create = create()),\n (ref.current = create),\n function () {\n ref.current = null;\n }\n );\n}\nfunction updateImperativeHandle(ref, create, deps) {\n deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;\n updateEffectImpl(4, 4, imperativeHandleEffect.bind(null, create, ref), deps);\n}\nfunction mountDebugValue() {}\nfunction updateCallback(callback, deps) {\n var hook = updateWorkInProgressHook();\n deps = void 0 === deps ? null : deps;\n var prevState = hook.memoizedState;\n if (null !== deps && areHookInputsEqual(deps, prevState[1]))\n return prevState[0];\n hook.memoizedState = [callback, deps];\n return callback;\n}\nfunction updateMemo(nextCreate, deps) {\n var hook = updateWorkInProgressHook();\n deps = void 0 === deps ? null : deps;\n var prevState = hook.memoizedState;\n if (null !== deps && areHookInputsEqual(deps, prevState[1]))\n return prevState[0];\n prevState = nextCreate();\n if (shouldDoubleInvokeUserFnsInHooksDEV) {\n setIsStrictModeForDevtools(!0);\n try {\n nextCreate();\n } finally {\n setIsStrictModeForDevtools(!1);\n }\n }\n hook.memoizedState = [prevState, deps];\n return prevState;\n}\nfunction mountDeferredValueImpl(hook, value, initialValue) {\n if (\n void 0 === initialValue ||\n (0 !== (renderLanes & 1073741824) &&\n 0 === (workInProgressRootRenderLanes & 261930))\n )\n return (hook.memoizedState = value);\n hook.memoizedState = initialValue;\n hook = requestDeferredLane();\n currentlyRenderingFiber.lanes |= hook;\n workInProgressRootSkippedLanes |= hook;\n return initialValue;\n}\nfunction updateDeferredValueImpl(hook, prevValue, value, initialValue) {\n if (objectIs(value, prevValue)) return value;\n if (null !== currentTreeHiddenStackCursor.current)\n return (\n (hook = mountDeferredValueImpl(hook, value, initialValue)),\n objectIs(hook, prevValue) || (didReceiveUpdate = !0),\n hook\n );\n if (\n 0 === (renderLanes & 42) ||\n (0 !== (renderLanes & 1073741824) &&\n 0 === (workInProgressRootRenderLanes & 261930))\n )\n return (didReceiveUpdate = !0), (hook.memoizedState = value);\n hook = requestDeferredLane();\n currentlyRenderingFiber.lanes |= hook;\n workInProgressRootSkippedLanes |= hook;\n return prevValue;\n}\nfunction startTransition(fiber, queue, pendingState, finishedState, callback) {\n var previousPriority = ReactDOMSharedInternals.p;\n ReactDOMSharedInternals.p =\n 0 !== previousPriority && 8 > previousPriority ? previousPriority : 8;\n var prevTransition = ReactSharedInternals.T,\n currentTransition = {};\n ReactSharedInternals.T = currentTransition;\n dispatchOptimisticSetState(fiber, !1, queue, pendingState);\n try {\n var returnValue = callback(),\n onStartTransitionFinish = ReactSharedInternals.S;\n null !== onStartTransitionFinish &&\n onStartTransitionFinish(currentTransition, returnValue);\n if (\n null !== returnValue &&\n \"object\" === typeof returnValue &&\n \"function\" === typeof returnValue.then\n ) {\n var thenableForFinishedState = chainThenableValue(\n returnValue,\n finishedState\n );\n dispatchSetStateInternal(\n fiber,\n queue,\n thenableForFinishedState,\n requestUpdateLane(fiber)\n );\n } else\n dispatchSetStateInternal(\n fiber,\n queue,\n finishedState,\n requestUpdateLane(fiber)\n );\n } catch (error) {\n dispatchSetStateInternal(\n fiber,\n queue,\n { then: function () {}, status: \"rejected\", reason: error },\n requestUpdateLane()\n );\n } finally {\n (ReactDOMSharedInternals.p = previousPriority),\n null !== prevTransition &&\n null !== currentTransition.types &&\n (prevTransition.types = currentTransition.types),\n (ReactSharedInternals.T = prevTransition);\n }\n}\nfunction noop() {}\nfunction startHostTransition(formFiber, pendingState, action, formData) {\n if (5 !== formFiber.tag) throw Error(formatProdErrorMessage(476));\n var queue = ensureFormComponentIsStateful(formFiber).queue;\n startTransition(\n formFiber,\n queue,\n pendingState,\n sharedNotPendingObject,\n null === action\n ? noop\n : function () {\n requestFormReset$1(formFiber);\n return action(formData);\n }\n );\n}\nfunction ensureFormComponentIsStateful(formFiber) {\n var existingStateHook = formFiber.memoizedState;\n if (null !== existingStateHook) return existingStateHook;\n existingStateHook = {\n memoizedState: sharedNotPendingObject,\n baseState: sharedNotPendingObject,\n baseQueue: null,\n queue: {\n pending: null,\n lanes: 0,\n dispatch: null,\n lastRenderedReducer: basicStateReducer,\n lastRenderedState: sharedNotPendingObject\n },\n next: null\n };\n var initialResetState = {};\n existingStateHook.next = {\n memoizedState: initialResetState,\n baseState: initialResetState,\n baseQueue: null,\n queue: {\n pending: null,\n lanes: 0,\n dispatch: null,\n lastRenderedReducer: basicStateReducer,\n lastRenderedState: initialResetState\n },\n next: null\n };\n formFiber.memoizedState = existingStateHook;\n formFiber = formFiber.alternate;\n null !== formFiber && (formFiber.memoizedState = existingStateHook);\n return existingStateHook;\n}\nfunction requestFormReset$1(formFiber) {\n var stateHook = ensureFormComponentIsStateful(formFiber);\n null === stateHook.next && (stateHook = formFiber.alternate.memoizedState);\n dispatchSetStateInternal(\n formFiber,\n stateHook.next.queue,\n {},\n requestUpdateLane()\n );\n}\nfunction useHostTransitionStatus() {\n return readContext(HostTransitionContext);\n}\nfunction updateId() {\n return updateWorkInProgressHook().memoizedState;\n}\nfunction updateRefresh() {\n return updateWorkInProgressHook().memoizedState;\n}\nfunction refreshCache(fiber) {\n for (var provider = fiber.return; null !== provider; ) {\n switch (provider.tag) {\n case 24:\n case 3:\n var lane = requestUpdateLane();\n fiber = createUpdate(lane);\n var root$69 = enqueueUpdate(provider, fiber, lane);\n null !== root$69 &&\n (scheduleUpdateOnFiber(root$69, provider, lane),\n entangleTransitions(root$69, provider, lane));\n provider = { cache: createCache() };\n fiber.payload = provider;\n return;\n }\n provider = provider.return;\n }\n}\nfunction dispatchReducerAction(fiber, queue, action) {\n var lane = requestUpdateLane();\n action = {\n lane: lane,\n revertLane: 0,\n gesture: null,\n action: action,\n hasEagerState: !1,\n eagerState: null,\n next: null\n };\n isRenderPhaseUpdate(fiber)\n ? enqueueRenderPhaseUpdate(queue, action)\n : ((action = enqueueConcurrentHookUpdate(fiber, queue, action, lane)),\n null !== action &&\n (scheduleUpdateOnFiber(action, fiber, lane),\n entangleTransitionUpdate(action, queue, lane)));\n}\nfunction dispatchSetState(fiber, queue, action) {\n var lane = requestUpdateLane();\n dispatchSetStateInternal(fiber, queue, action, lane);\n}\nfunction dispatchSetStateInternal(fiber, queue, action, lane) {\n var update = {\n lane: lane,\n revertLane: 0,\n gesture: null,\n action: action,\n hasEagerState: !1,\n eagerState: null,\n next: null\n };\n if (isRenderPhaseUpdate(fiber)) enqueueRenderPhaseUpdate(queue, update);\n else {\n var alternate = fiber.alternate;\n if (\n 0 === fiber.lanes &&\n (null === alternate || 0 === alternate.lanes) &&\n ((alternate = queue.lastRenderedReducer), null !== alternate)\n )\n try {\n var currentState = queue.lastRenderedState,\n eagerState = alternate(currentState, action);\n update.hasEagerState = !0;\n update.eagerState = eagerState;\n if (objectIs(eagerState, currentState))\n return (\n enqueueUpdate$1(fiber, queue, update, 0),\n null === workInProgressRoot && finishQueueingConcurrentUpdates(),\n !1\n );\n } catch (error) {\n } finally {\n }\n action = enqueueConcurrentHookUpdate(fiber, queue, update, lane);\n if (null !== action)\n return (\n scheduleUpdateOnFiber(action, fiber, lane),\n entangleTransitionUpdate(action, queue, lane),\n !0\n );\n }\n return !1;\n}\nfunction dispatchOptimisticSetState(fiber, throwIfDuringRender, queue, action) {\n action = {\n lane: 2,\n revertLane: requestTransitionLane(),\n gesture: null,\n action: action,\n hasEagerState: !1,\n eagerState: null,\n next: null\n };\n if (isRenderPhaseUpdate(fiber)) {\n if (throwIfDuringRender) throw Error(formatProdErrorMessage(479));\n } else\n (throwIfDuringRender = enqueueConcurrentHookUpdate(\n fiber,\n queue,\n action,\n 2\n )),\n null !== throwIfDuringRender &&\n scheduleUpdateOnFiber(throwIfDuringRender, fiber, 2);\n}\nfunction isRenderPhaseUpdate(fiber) {\n var alternate = fiber.alternate;\n return (\n fiber === currentlyRenderingFiber ||\n (null !== alternate && alternate === currentlyRenderingFiber)\n );\n}\nfunction enqueueRenderPhaseUpdate(queue, update) {\n didScheduleRenderPhaseUpdateDuringThisPass = didScheduleRenderPhaseUpdate =\n !0;\n var pending = queue.pending;\n null === pending\n ? (update.next = update)\n : ((update.next = pending.next), (pending.next = update));\n queue.pending = update;\n}\nfunction entangleTransitionUpdate(root, queue, lane) {\n if (0 !== (lane & 4194048)) {\n var queueLanes = queue.lanes;\n queueLanes &= root.pendingLanes;\n lane |= queueLanes;\n queue.lanes = lane;\n markRootEntangled(root, lane);\n }\n}\nvar ContextOnlyDispatcher = {\n readContext: readContext,\n use: use,\n useCallback: throwInvalidHookError,\n useContext: throwInvalidHookError,\n useEffect: throwInvalidHookError,\n useImperativeHandle: throwInvalidHookError,\n useLayoutEffect: throwInvalidHookError,\n useInsertionEffect: throwInvalidHookError,\n useMemo: throwInvalidHookError,\n useReducer: throwInvalidHookError,\n useRef: throwInvalidHookError,\n useState: throwInvalidHookError,\n useDebugValue: throwInvalidHookError,\n useDeferredValue: throwInvalidHookError,\n useTransition: throwInvalidHookError,\n useSyncExternalStore: throwInvalidHookError,\n useId: throwInvalidHookError,\n useHostTransitionStatus: throwInvalidHookError,\n useFormState: throwInvalidHookError,\n useActionState: throwInvalidHookError,\n useOptimistic: throwInvalidHookError,\n useMemoCache: throwInvalidHookError,\n useCacheRefresh: throwInvalidHookError\n};\nContextOnlyDispatcher.useEffectEvent = throwInvalidHookError;\nvar HooksDispatcherOnMount = {\n readContext: readContext,\n use: use,\n useCallback: function (callback, deps) {\n mountWorkInProgressHook().memoizedState = [\n callback,\n void 0 === deps ? null : deps\n ];\n return callback;\n },\n useContext: readContext,\n useEffect: mountEffect,\n useImperativeHandle: function (ref, create, deps) {\n deps = null !== deps && void 0 !== deps ? deps.concat([ref]) : null;\n mountEffectImpl(\n 4194308,\n 4,\n imperativeHandleEffect.bind(null, create, ref),\n deps\n );\n },\n useLayoutEffect: function (create, deps) {\n return mountEffectImpl(4194308, 4, create, deps);\n },\n useInsertionEffect: function (create, deps) {\n mountEffectImpl(4, 2, create, deps);\n },\n useMemo: function (nextCreate, deps) {\n var hook = mountWorkInProgressHook();\n deps = void 0 === deps ? null : deps;\n var nextValue = nextCreate();\n if (shouldDoubleInvokeUserFnsInHooksDEV) {\n setIsStrictModeForDevtools(!0);\n try {\n nextCreate();\n } finally {\n setIsStrictModeForDevtools(!1);\n }\n }\n hook.memoizedState = [nextValue, deps];\n return nextValue;\n },\n useReducer: function (reducer, initialArg, init) {\n var hook = mountWorkInProgressHook();\n if (void 0 !== init) {\n var initialState = init(initialArg);\n if (shouldDoubleInvokeUserFnsInHooksDEV) {\n setIsStrictModeForDevtools(!0);\n try {\n init(initialArg);\n } finally {\n setIsStrictModeForDevtools(!1);\n }\n }\n } else initialState = initialArg;\n hook.memoizedState = hook.baseState = initialState;\n reducer = {\n pending: null,\n lanes: 0,\n dispatch: null,\n lastRenderedReducer: reducer,\n lastRenderedState: initialState\n };\n hook.queue = reducer;\n reducer = reducer.dispatch = dispatchReducerAction.bind(\n null,\n currentlyRenderingFiber,\n reducer\n );\n return [hook.memoizedState, reducer];\n },\n useRef: function (initialValue) {\n var hook = mountWorkInProgressHook();\n initialValue = { current: initialValue };\n return (hook.memoizedState = initialValue);\n },\n useState: function (initialState) {\n initialState = mountStateImpl(initialState);\n var queue = initialState.queue,\n dispatch = dispatchSetState.bind(null, currentlyRenderingFiber, queue);\n queue.dispatch = dispatch;\n return [initialState.memoizedState, dispatch];\n },\n useDebugValue: mountDebugValue,\n useDeferredValue: function (value, initialValue) {\n var hook = mountWorkInProgressHook();\n return mountDeferredValueImpl(hook, value, initialValue);\n },\n useTransition: function () {\n var stateHook = mountStateImpl(!1);\n stateHook = startTransition.bind(\n null,\n currentlyRenderingFiber,\n stateHook.queue,\n !0,\n !1\n );\n mountWorkInProgressHook().memoizedState = stateHook;\n return [!1, stateHook];\n },\n useSyncExternalStore: function (subscribe, getSnapshot, getServerSnapshot) {\n var fiber = currentlyRenderingFiber,\n hook = mountWorkInProgressHook();\n if (isHydrating) {\n if (void 0 === getServerSnapshot)\n throw Error(formatProdErrorMessage(407));\n getServerSnapshot = getServerSnapshot();\n } else {\n getServerSnapshot = getSnapshot();\n if (null === workInProgressRoot)\n throw Error(formatProdErrorMessage(349));\n 0 !== (workInProgressRootRenderLanes & 127) ||\n pushStoreConsistencyCheck(fiber, getSnapshot, getServerSnapshot);\n }\n hook.memoizedState = getServerSnapshot;\n var inst = { value: getServerSnapshot, getSnapshot: getSnapshot };\n hook.queue = inst;\n mountEffect(subscribeToStore.bind(null, fiber, inst, subscribe), [\n subscribe\n ]);\n fiber.flags |= 2048;\n pushSimpleEffect(\n 9,\n { destroy: void 0 },\n updateStoreInstance.bind(\n null,\n fiber,\n inst,\n getServerSnapshot,\n getSnapshot\n ),\n null\n );\n return getServerSnapshot;\n },\n useId: function () {\n var hook = mountWorkInProgressHook(),\n identifierPrefix = workInProgressRoot.identifierPrefix;\n if (isHydrating) {\n var JSCompiler_inline_result = treeContextOverflow;\n var idWithLeadingBit = treeContextId;\n JSCompiler_inline_result =\n (\n idWithLeadingBit & ~(1 << (32 - clz32(idWithLeadingBit) - 1))\n ).toString(32) + JSCompiler_inline_result;\n identifierPrefix =\n \"_\" + identifierPrefix + \"R_\" + JSCompiler_inline_result;\n JSCompiler_inline_result = localIdCounter++;\n 0 < JSCompiler_inline_result &&\n (identifierPrefix += \"H\" + JSCompiler_inline_result.toString(32));\n identifierPrefix += \"_\";\n } else\n (JSCompiler_inline_result = globalClientIdCounter++),\n (identifierPrefix =\n \"_\" +\n identifierPrefix +\n \"r_\" +\n JSCompiler_inline_result.toString(32) +\n \"_\");\n return (hook.memoizedState = identifierPrefix);\n },\n useHostTransitionStatus: useHostTransitionStatus,\n useFormState: mountActionState,\n useActionState: mountActionState,\n useOptimistic: function (passthrough) {\n var hook = mountWorkInProgressHook();\n hook.memoizedState = hook.baseState = passthrough;\n var queue = {\n pending: null,\n lanes: 0,\n dispatch: null,\n lastRenderedReducer: null,\n lastRenderedState: null\n };\n hook.queue = queue;\n hook = dispatchOptimisticSetState.bind(\n null,\n currentlyRenderingFiber,\n !0,\n queue\n );\n queue.dispatch = hook;\n return [passthrough, hook];\n },\n useMemoCache: useMemoCache,\n useCacheRefresh: function () {\n return (mountWorkInProgressHook().memoizedState = refreshCache.bind(\n null,\n currentlyRenderingFiber\n ));\n },\n useEffectEvent: function (callback) {\n var hook = mountWorkInProgressHook(),\n ref = { impl: callback };\n hook.memoizedState = ref;\n return function () {\n if (0 !== (executionContext & 2))\n throw Error(formatProdErrorMessage(440));\n return ref.impl.apply(void 0, arguments);\n };\n }\n },\n HooksDispatcherOnUpdate = {\n readContext: readContext,\n use: use,\n useCallback: updateCallback,\n useContext: readContext,\n useEffect: updateEffect,\n useImperativeHandle: updateImperativeHandle,\n useInsertionEffect: updateInsertionEffect,\n useLayoutEffect: updateLayoutEffect,\n useMemo: updateMemo,\n useReducer: updateReducer,\n useRef: updateRef,\n useState: function () {\n return updateReducer(basicStateReducer);\n },\n useDebugValue: mountDebugValue,\n useDeferredValue: function (value, initialValue) {\n var hook = updateWorkInProgressHook();\n return updateDeferredValueImpl(\n hook,\n currentHook.memoizedState,\n value,\n initialValue\n );\n },\n useTransition: function () {\n var booleanOrThenable = updateReducer(basicStateReducer)[0],\n start = updateWorkInProgressHook().memoizedState;\n return [\n \"boolean\" === typeof booleanOrThenable\n ? booleanOrThenable\n : useThenable(booleanOrThenable),\n start\n ];\n },\n useSyncExternalStore: updateSyncExternalStore,\n useId: updateId,\n useHostTransitionStatus: useHostTransitionStatus,\n useFormState: updateActionState,\n useActionState: updateActionState,\n useOptimistic: function (passthrough, reducer) {\n var hook = updateWorkInProgressHook();\n return updateOptimisticImpl(hook, currentHook, passthrough, reducer);\n },\n useMemoCache: useMemoCache,\n useCacheRefresh: updateRefresh\n };\nHooksDispatcherOnUpdate.useEffectEvent = updateEvent;\nvar HooksDispatcherOnRerender = {\n readContext: readContext,\n use: use,\n useCallback: updateCallback,\n useContext: readContext,\n useEffect: updateEffect,\n useImperativeHandle: updateImperativeHandle,\n useInsertionEffect: updateInsertionEffect,\n useLayoutEffect: updateLayoutEffect,\n useMemo: updateMemo,\n useReducer: rerenderReducer,\n useRef: updateRef,\n useState: function () {\n return rerenderReducer(basicStateReducer);\n },\n useDebugValue: mountDebugValue,\n useDeferredValue: function (value, initialValue) {\n var hook = updateWorkInProgressHook();\n return null === currentHook\n ? mountDeferredValueImpl(hook, value, initialValue)\n : updateDeferredValueImpl(\n hook,\n currentHook.memoizedState,\n value,\n initialValue\n );\n },\n useTransition: function () {\n var booleanOrThenable = rerenderReducer(basicStateReducer)[0],\n start = updateWorkInProgressHook().memoizedState;\n return [\n \"boolean\" === typeof booleanOrThenable\n ? booleanOrThenable\n : useThenable(booleanOrThenable),\n start\n ];\n },\n useSyncExternalStore: updateSyncExternalStore,\n useId: updateId,\n useHostTransitionStatus: useHostTransitionStatus,\n useFormState: rerenderActionState,\n useActionState: rerenderActionState,\n useOptimistic: function (passthrough, reducer) {\n var hook = updateWorkInProgressHook();\n if (null !== currentHook)\n return updateOptimisticImpl(hook, currentHook, passthrough, reducer);\n hook.baseState = passthrough;\n return [passthrough, hook.queue.dispatch];\n },\n useMemoCache: useMemoCache,\n useCacheRefresh: updateRefresh\n};\nHooksDispatcherOnRerender.useEffectEvent = updateEvent;\nfunction applyDerivedStateFromProps(\n workInProgress,\n ctor,\n getDerivedStateFromProps,\n nextProps\n) {\n ctor = workInProgress.memoizedState;\n getDerivedStateFromProps = getDerivedStateFromProps(nextProps, ctor);\n getDerivedStateFromProps =\n null === getDerivedStateFromProps || void 0 === getDerivedStateFromProps\n ? ctor\n : assign({}, ctor, getDerivedStateFromProps);\n workInProgress.memoizedState = getDerivedStateFromProps;\n 0 === workInProgress.lanes &&\n (workInProgress.updateQueue.baseState = getDerivedStateFromProps);\n}\nvar classComponentUpdater = {\n enqueueSetState: function (inst, payload, callback) {\n inst = inst._reactInternals;\n var lane = requestUpdateLane(),\n update = createUpdate(lane);\n update.payload = payload;\n void 0 !== callback && null !== callback && (update.callback = callback);\n payload = enqueueUpdate(inst, update, lane);\n null !== payload &&\n (scheduleUpdateOnFiber(payload, inst, lane),\n entangleTransitions(payload, inst, lane));\n },\n enqueueReplaceState: function (inst, payload, callback) {\n inst = inst._reactInternals;\n var lane = requestUpdateLane(),\n update = createUpdate(lane);\n update.tag = 1;\n update.payload = payload;\n void 0 !== callback && null !== callback && (update.callback = callback);\n payload = enqueueUpdate(inst, update, lane);\n null !== payload &&\n (scheduleUpdateOnFiber(payload, inst, lane),\n entangleTransitions(payload, inst, lane));\n },\n enqueueForceUpdate: function (inst, callback) {\n inst = inst._reactInternals;\n var lane = requestUpdateLane(),\n update = createUpdate(lane);\n update.tag = 2;\n void 0 !== callback && null !== callback && (update.callback = callback);\n callback = enqueueUpdate(inst, update, lane);\n null !== callback &&\n (scheduleUpdateOnFiber(callback, inst, lane),\n entangleTransitions(callback, inst, lane));\n }\n};\nfunction checkShouldComponentUpdate(\n workInProgress,\n ctor,\n oldProps,\n newProps,\n oldState,\n newState,\n nextContext\n) {\n workInProgress = workInProgress.stateNode;\n return \"function\" === typeof workInProgress.shouldComponentUpdate\n ? workInProgress.shouldComponentUpdate(newProps, newState, nextContext)\n : ctor.prototype && ctor.prototype.isPureReactComponent\n ? !shallowEqual(oldProps, newProps) || !shallowEqual(oldState, newState)\n : !0;\n}\nfunction callComponentWillReceiveProps(\n workInProgress,\n instance,\n newProps,\n nextContext\n) {\n workInProgress = instance.state;\n \"function\" === typeof instance.componentWillReceiveProps &&\n instance.componentWillReceiveProps(newProps, nextContext);\n \"function\" === typeof instance.UNSAFE_componentWillReceiveProps &&\n instance.UNSAFE_componentWillReceiveProps(newProps, nextContext);\n instance.state !== workInProgress &&\n classComponentUpdater.enqueueReplaceState(instance, instance.state, null);\n}\nfunction resolveClassComponentProps(Component, baseProps) {\n var newProps = baseProps;\n if (\"ref\" in baseProps) {\n newProps = {};\n for (var propName in baseProps)\n \"ref\" !== propName && (newProps[propName] = baseProps[propName]);\n }\n if ((Component = Component.defaultProps)) {\n newProps === baseProps && (newProps = assign({}, newProps));\n for (var propName$73 in Component)\n void 0 === newProps[propName$73] &&\n (newProps[propName$73] = Component[propName$73]);\n }\n return newProps;\n}\nfunction defaultOnUncaughtError(error) {\n reportGlobalError(error);\n}\nfunction defaultOnCaughtError(error) {\n console.error(error);\n}\nfunction defaultOnRecoverableError(error) {\n reportGlobalError(error);\n}\nfunction logUncaughtError(root, errorInfo) {\n try {\n var onUncaughtError = root.onUncaughtError;\n onUncaughtError(errorInfo.value, { componentStack: errorInfo.stack });\n } catch (e$74) {\n setTimeout(function () {\n throw e$74;\n });\n }\n}\nfunction logCaughtError(root, boundary, errorInfo) {\n try {\n var onCaughtError = root.onCaughtError;\n onCaughtError(errorInfo.value, {\n componentStack: errorInfo.stack,\n errorBoundary: 1 === boundary.tag ? boundary.stateNode : null\n });\n } catch (e$75) {\n setTimeout(function () {\n throw e$75;\n });\n }\n}\nfunction createRootErrorUpdate(root, errorInfo, lane) {\n lane = createUpdate(lane);\n lane.tag = 3;\n lane.payload = { element: null };\n lane.callback = function () {\n logUncaughtError(root, errorInfo);\n };\n return lane;\n}\nfunction createClassErrorUpdate(lane) {\n lane = createUpdate(lane);\n lane.tag = 3;\n return lane;\n}\nfunction initializeClassErrorUpdate(update, root, fiber, errorInfo) {\n var getDerivedStateFromError = fiber.type.getDerivedStateFromError;\n if (\"function\" === typeof getDerivedStateFromError) {\n var error = errorInfo.value;\n update.payload = function () {\n return getDerivedStateFromError(error);\n };\n update.callback = function () {\n logCaughtError(root, fiber, errorInfo);\n };\n }\n var inst = fiber.stateNode;\n null !== inst &&\n \"function\" === typeof inst.componentDidCatch &&\n (update.callback = function () {\n logCaughtError(root, fiber, errorInfo);\n \"function\" !== typeof getDerivedStateFromError &&\n (null === legacyErrorBoundariesThatAlreadyFailed\n ? (legacyErrorBoundariesThatAlreadyFailed = new Set([this]))\n : legacyErrorBoundariesThatAlreadyFailed.add(this));\n var stack = errorInfo.stack;\n this.componentDidCatch(errorInfo.value, {\n componentStack: null !== stack ? stack : \"\"\n });\n });\n}\nfunction throwException(\n root,\n returnFiber,\n sourceFiber,\n value,\n rootRenderLanes\n) {\n sourceFiber.flags |= 32768;\n if (\n null !== value &&\n \"object\" === typeof value &&\n \"function\" === typeof value.then\n ) {\n returnFiber = sourceFiber.alternate;\n null !== returnFiber &&\n propagateParentContextChanges(\n returnFiber,\n sourceFiber,\n rootRenderLanes,\n !0\n );\n sourceFiber = suspenseHandlerStackCursor.current;\n if (null !== sourceFiber) {\n switch (sourceFiber.tag) {\n case 31:\n case 13:\n return (\n null === shellBoundary\n ? renderDidSuspendDelayIfPossible()\n : null === sourceFiber.alternate &&\n 0 === workInProgressRootExitStatus &&\n (workInProgressRootExitStatus = 3),\n (sourceFiber.flags &= -257),\n (sourceFiber.flags |= 65536),\n (sourceFiber.lanes = rootRenderLanes),\n value === noopSuspenseyCommitThenable\n ? (sourceFiber.flags |= 16384)\n : ((returnFiber = sourceFiber.updateQueue),\n null === returnFiber\n ? (sourceFiber.updateQueue = new Set([value]))\n : returnFiber.add(value),\n attachPingListener(root, value, rootRenderLanes)),\n !1\n );\n case 22:\n return (\n (sourceFiber.flags |= 65536),\n value === noopSuspenseyCommitThenable\n ? (sourceFiber.flags |= 16384)\n : ((returnFiber = sourceFiber.updateQueue),\n null === returnFiber\n ? ((returnFiber = {\n transitions: null,\n markerInstances: null,\n retryQueue: new Set([value])\n }),\n (sourceFiber.updateQueue = returnFiber))\n : ((sourceFiber = returnFiber.retryQueue),\n null === sourceFiber\n ? (returnFiber.retryQueue = new Set([value]))\n : sourceFiber.add(value)),\n attachPingListener(root, value, rootRenderLanes)),\n !1\n );\n }\n throw Error(formatProdErrorMessage(435, sourceFiber.tag));\n }\n attachPingListener(root, value, rootRenderLanes);\n renderDidSuspendDelayIfPossible();\n return !1;\n }\n if (isHydrating)\n return (\n (returnFiber = suspenseHandlerStackCursor.current),\n null !== returnFiber\n ? (0 === (returnFiber.flags & 65536) && (returnFiber.flags |= 256),\n (returnFiber.flags |= 65536),\n (returnFiber.lanes = rootRenderLanes),\n value !== HydrationMismatchException &&\n ((root = Error(formatProdErrorMessage(422), { cause: value })),\n queueHydrationError(createCapturedValueAtFiber(root, sourceFiber))))\n : (value !== HydrationMismatchException &&\n ((returnFiber = Error(formatProdErrorMessage(423), {\n cause: value\n })),\n queueHydrationError(\n createCapturedValueAtFiber(returnFiber, sourceFiber)\n )),\n (root = root.current.alternate),\n (root.flags |= 65536),\n (rootRenderLanes &= -rootRenderLanes),\n (root.lanes |= rootRenderLanes),\n (value = createCapturedValueAtFiber(value, sourceFiber)),\n (rootRenderLanes = createRootErrorUpdate(\n root.stateNode,\n value,\n rootRenderLanes\n )),\n enqueueCapturedUpdate(root, rootRenderLanes),\n 4 !== workInProgressRootExitStatus &&\n (workInProgressRootExitStatus = 2)),\n !1\n );\n var wrapperError = Error(formatProdErrorMessage(520), { cause: value });\n wrapperError = createCapturedValueAtFiber(wrapperError, sourceFiber);\n null === workInProgressRootConcurrentErrors\n ? (workInProgressRootConcurrentErrors = [wrapperError])\n : workInProgressRootConcurrentErrors.push(wrapperError);\n 4 !== workInProgressRootExitStatus && (workInProgressRootExitStatus = 2);\n if (null === returnFiber) return !0;\n value = createCapturedValueAtFiber(value, sourceFiber);\n sourceFiber = returnFiber;\n do {\n switch (sourceFiber.tag) {\n case 3:\n return (\n (sourceFiber.flags |= 65536),\n (root = rootRenderLanes & -rootRenderLanes),\n (sourceFiber.lanes |= root),\n (root = createRootErrorUpdate(sourceFiber.stateNode, value, root)),\n enqueueCapturedUpdate(sourceFiber, root),\n !1\n );\n case 1:\n if (\n ((returnFiber = sourceFiber.type),\n (wrapperError = sourceFiber.stateNode),\n 0 === (sourceFiber.flags & 128) &&\n (\"function\" === typeof returnFiber.getDerivedStateFromError ||\n (null !== wrapperError &&\n \"function\" === typeof wrapperError.componentDidCatch &&\n (null === legacyErrorBoundariesThatAlreadyFailed ||\n !legacyErrorBoundariesThatAlreadyFailed.has(wrapperError)))))\n )\n return (\n (sourceFiber.flags |= 65536),\n (rootRenderLanes &= -rootRenderLanes),\n (sourceFiber.lanes |= rootRenderLanes),\n (rootRenderLanes = createClassErrorUpdate(rootRenderLanes)),\n initializeClassErrorUpdate(\n rootRenderLanes,\n root,\n sourceFiber,\n value\n ),\n enqueueCapturedUpdate(sourceFiber, rootRenderLanes),\n !1\n );\n }\n sourceFiber = sourceFiber.return;\n } while (null !== sourceFiber);\n return !1;\n}\nvar SelectiveHydrationException = Error(formatProdErrorMessage(461)),\n didReceiveUpdate = !1;\nfunction reconcileChildren(current, workInProgress, nextChildren, renderLanes) {\n workInProgress.child =\n null === current\n ? mountChildFibers(workInProgress, null, nextChildren, renderLanes)\n : reconcileChildFibers(\n workInProgress,\n current.child,\n nextChildren,\n renderLanes\n );\n}\nfunction updateForwardRef(\n current,\n workInProgress,\n Component,\n nextProps,\n renderLanes\n) {\n Component = Component.render;\n var ref = workInProgress.ref;\n if (\"ref\" in nextProps) {\n var propsWithoutRef = {};\n for (var key in nextProps)\n \"ref\" !== key && (propsWithoutRef[key] = nextProps[key]);\n } else propsWithoutRef = nextProps;\n prepareToReadContext(workInProgress);\n nextProps = renderWithHooks(\n current,\n workInProgress,\n Component,\n propsWithoutRef,\n ref,\n renderLanes\n );\n key = checkDidRenderIdHook();\n if (null !== current && !didReceiveUpdate)\n return (\n bailoutHooks(current, workInProgress, renderLanes),\n bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)\n );\n isHydrating && key && pushMaterializedTreeId(workInProgress);\n workInProgress.flags |= 1;\n reconcileChildren(current, workInProgress, nextProps, renderLanes);\n return workInProgress.child;\n}\nfunction updateMemoComponent(\n current,\n workInProgress,\n Component,\n nextProps,\n renderLanes\n) {\n if (null === current) {\n var type = Component.type;\n if (\n \"function\" === typeof type &&\n !shouldConstruct(type) &&\n void 0 === type.defaultProps &&\n null === Component.compare\n )\n return (\n (workInProgress.tag = 15),\n (workInProgress.type = type),\n updateSimpleMemoComponent(\n current,\n workInProgress,\n type,\n nextProps,\n renderLanes\n )\n );\n current = createFiberFromTypeAndProps(\n Component.type,\n null,\n nextProps,\n workInProgress,\n workInProgress.mode,\n renderLanes\n );\n current.ref = workInProgress.ref;\n current.return = workInProgress;\n return (workInProgress.child = current);\n }\n type = current.child;\n if (!checkScheduledUpdateOrContext(current, renderLanes)) {\n var prevProps = type.memoizedProps;\n Component = Component.compare;\n Component = null !== Component ? Component : shallowEqual;\n if (Component(prevProps, nextProps) && current.ref === workInProgress.ref)\n return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);\n }\n workInProgress.flags |= 1;\n current = createWorkInProgress(type, nextProps);\n current.ref = workInProgress.ref;\n current.return = workInProgress;\n return (workInProgress.child = current);\n}\nfunction updateSimpleMemoComponent(\n current,\n workInProgress,\n Component,\n nextProps,\n renderLanes\n) {\n if (null !== current) {\n var prevProps = current.memoizedProps;\n if (\n shallowEqual(prevProps, nextProps) &&\n current.ref === workInProgress.ref\n )\n if (\n ((didReceiveUpdate = !1),\n (workInProgress.pendingProps = nextProps = prevProps),\n checkScheduledUpdateOrContext(current, renderLanes))\n )\n 0 !== (current.flags & 131072) && (didReceiveUpdate = !0);\n else\n return (\n (workInProgress.lanes = current.lanes),\n bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)\n );\n }\n return updateFunctionComponent(\n current,\n workInProgress,\n Component,\n nextProps,\n renderLanes\n );\n}\nfunction updateOffscreenComponent(\n current,\n workInProgress,\n renderLanes,\n nextProps\n) {\n var nextChildren = nextProps.children,\n prevState = null !== current ? current.memoizedState : null;\n null === current &&\n null === workInProgress.stateNode &&\n (workInProgress.stateNode = {\n _visibility: 1,\n _pendingMarkers: null,\n _retryCache: null,\n _transitions: null\n });\n if (\"hidden\" === nextProps.mode) {\n if (0 !== (workInProgress.flags & 128)) {\n prevState =\n null !== prevState ? prevState.baseLanes | renderLanes : renderLanes;\n if (null !== current) {\n nextProps = workInProgress.child = current.child;\n for (nextChildren = 0; null !== nextProps; )\n (nextChildren =\n nextChildren | nextProps.lanes | nextProps.childLanes),\n (nextProps = nextProps.sibling);\n nextProps = nextChildren & ~prevState;\n } else (nextProps = 0), (workInProgress.child = null);\n return deferHiddenOffscreenComponent(\n current,\n workInProgress,\n prevState,\n renderLanes,\n nextProps\n );\n }\n if (0 !== (renderLanes & 536870912))\n (workInProgress.memoizedState = { baseLanes: 0, cachePool: null }),\n null !== current &&\n pushTransition(\n workInProgress,\n null !== prevState ? prevState.cachePool : null\n ),\n null !== prevState\n ? pushHiddenContext(workInProgress, prevState)\n : reuseHiddenContextOnStack(),\n pushOffscreenSuspenseHandler(workInProgress);\n else\n return (\n (nextProps = workInProgress.lanes = 536870912),\n deferHiddenOffscreenComponent(\n current,\n workInProgress,\n null !== prevState ? prevState.baseLanes | renderLanes : renderLanes,\n renderLanes,\n nextProps\n )\n );\n } else\n null !== prevState\n ? (pushTransition(workInProgress, prevState.cachePool),\n pushHiddenContext(workInProgress, prevState),\n reuseSuspenseHandlerOnStack(workInProgress),\n (workInProgress.memoizedState = null))\n : (null !== current && pushTransition(workInProgress, null),\n reuseHiddenContextOnStack(),\n reuseSuspenseHandlerOnStack(workInProgress));\n reconcileChildren(current, workInProgress, nextChildren, renderLanes);\n return workInProgress.child;\n}\nfunction bailoutOffscreenComponent(current, workInProgress) {\n (null !== current && 22 === current.tag) ||\n null !== workInProgress.stateNode ||\n (workInProgress.stateNode = {\n _visibility: 1,\n _pendingMarkers: null,\n _retryCache: null,\n _transitions: null\n });\n return workInProgress.sibling;\n}\nfunction deferHiddenOffscreenComponent(\n current,\n workInProgress,\n nextBaseLanes,\n renderLanes,\n remainingChildLanes\n) {\n var JSCompiler_inline_result = peekCacheFromPool();\n JSCompiler_inline_result =\n null === JSCompiler_inline_result\n ? null\n : { parent: CacheContext._currentValue, pool: JSCompiler_inline_result };\n workInProgress.memoizedState = {\n baseLanes: nextBaseLanes,\n cachePool: JSCompiler_inline_result\n };\n null !== current && pushTransition(workInProgress, null);\n reuseHiddenContextOnStack();\n pushOffscreenSuspenseHandler(workInProgress);\n null !== current &&\n propagateParentContextChanges(current, workInProgress, renderLanes, !0);\n workInProgress.childLanes = remainingChildLanes;\n return null;\n}\nfunction mountActivityChildren(workInProgress, nextProps) {\n nextProps = mountWorkInProgressOffscreenFiber(\n { mode: nextProps.mode, children: nextProps.children },\n workInProgress.mode\n );\n nextProps.ref = workInProgress.ref;\n workInProgress.child = nextProps;\n nextProps.return = workInProgress;\n return nextProps;\n}\nfunction retryActivityComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n) {\n reconcileChildFibers(workInProgress, current.child, null, renderLanes);\n current = mountActivityChildren(workInProgress, workInProgress.pendingProps);\n current.flags |= 2;\n popSuspenseHandler(workInProgress);\n workInProgress.memoizedState = null;\n return current;\n}\nfunction updateActivityComponent(current, workInProgress, renderLanes) {\n var nextProps = workInProgress.pendingProps,\n didSuspend = 0 !== (workInProgress.flags & 128);\n workInProgress.flags &= -129;\n if (null === current) {\n if (isHydrating) {\n if (\"hidden\" === nextProps.mode)\n return (\n (current = mountActivityChildren(workInProgress, nextProps)),\n (workInProgress.lanes = 536870912),\n bailoutOffscreenComponent(null, current)\n );\n pushDehydratedActivitySuspenseHandler(workInProgress);\n (current = nextHydratableInstance)\n ? ((current = canHydrateHydrationBoundary(\n current,\n rootOrSingletonContext\n )),\n (current = null !== current && \"&\" === current.data ? current : null),\n null !== current &&\n ((workInProgress.memoizedState = {\n dehydrated: current,\n treeContext:\n null !== treeContextProvider\n ? { id: treeContextId, overflow: treeContextOverflow }\n : null,\n retryLane: 536870912,\n hydrationErrors: null\n }),\n (renderLanes = createFiberFromDehydratedFragment(current)),\n (renderLanes.return = workInProgress),\n (workInProgress.child = renderLanes),\n (hydrationParentFiber = workInProgress),\n (nextHydratableInstance = null)))\n : (current = null);\n if (null === current) throw throwOnHydrationMismatch(workInProgress);\n workInProgress.lanes = 536870912;\n return null;\n }\n return mountActivityChildren(workInProgress, nextProps);\n }\n var prevState = current.memoizedState;\n if (null !== prevState) {\n var dehydrated = prevState.dehydrated;\n pushDehydratedActivitySuspenseHandler(workInProgress);\n if (didSuspend)\n if (workInProgress.flags & 256)\n (workInProgress.flags &= -257),\n (workInProgress = retryActivityComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n ));\n else if (null !== workInProgress.memoizedState)\n (workInProgress.child = current.child),\n (workInProgress.flags |= 128),\n (workInProgress = null);\n else throw Error(formatProdErrorMessage(558));\n else if (\n (didReceiveUpdate ||\n propagateParentContextChanges(current, workInProgress, renderLanes, !1),\n (didSuspend = 0 !== (renderLanes & current.childLanes)),\n didReceiveUpdate || didSuspend)\n ) {\n nextProps = workInProgressRoot;\n if (\n null !== nextProps &&\n ((dehydrated = getBumpedLaneForHydration(nextProps, renderLanes)),\n 0 !== dehydrated && dehydrated !== prevState.retryLane)\n )\n throw (\n ((prevState.retryLane = dehydrated),\n enqueueConcurrentRenderForLane(current, dehydrated),\n scheduleUpdateOnFiber(nextProps, current, dehydrated),\n SelectiveHydrationException)\n );\n renderDidSuspendDelayIfPossible();\n workInProgress = retryActivityComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n );\n } else\n (current = prevState.treeContext),\n (nextHydratableInstance = getNextHydratable(dehydrated.nextSibling)),\n (hydrationParentFiber = workInProgress),\n (isHydrating = !0),\n (hydrationErrors = null),\n (rootOrSingletonContext = !1),\n null !== current &&\n restoreSuspendedTreeContext(workInProgress, current),\n (workInProgress = mountActivityChildren(workInProgress, nextProps)),\n (workInProgress.flags |= 4096);\n return workInProgress;\n }\n current = createWorkInProgress(current.child, {\n mode: nextProps.mode,\n children: nextProps.children\n });\n current.ref = workInProgress.ref;\n workInProgress.child = current;\n current.return = workInProgress;\n return current;\n}\nfunction markRef(current, workInProgress) {\n var ref = workInProgress.ref;\n if (null === ref)\n null !== current &&\n null !== current.ref &&\n (workInProgress.flags |= 4194816);\n else {\n if (\"function\" !== typeof ref && \"object\" !== typeof ref)\n throw Error(formatProdErrorMessage(284));\n if (null === current || current.ref !== ref)\n workInProgress.flags |= 4194816;\n }\n}\nfunction updateFunctionComponent(\n current,\n workInProgress,\n Component,\n nextProps,\n renderLanes\n) {\n prepareToReadContext(workInProgress);\n Component = renderWithHooks(\n current,\n workInProgress,\n Component,\n nextProps,\n void 0,\n renderLanes\n );\n nextProps = checkDidRenderIdHook();\n if (null !== current && !didReceiveUpdate)\n return (\n bailoutHooks(current, workInProgress, renderLanes),\n bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)\n );\n isHydrating && nextProps && pushMaterializedTreeId(workInProgress);\n workInProgress.flags |= 1;\n reconcileChildren(current, workInProgress, Component, renderLanes);\n return workInProgress.child;\n}\nfunction replayFunctionComponent(\n current,\n workInProgress,\n nextProps,\n Component,\n secondArg,\n renderLanes\n) {\n prepareToReadContext(workInProgress);\n workInProgress.updateQueue = null;\n nextProps = renderWithHooksAgain(\n workInProgress,\n Component,\n nextProps,\n secondArg\n );\n finishRenderingHooks(current);\n Component = checkDidRenderIdHook();\n if (null !== current && !didReceiveUpdate)\n return (\n bailoutHooks(current, workInProgress, renderLanes),\n bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes)\n );\n isHydrating && Component && pushMaterializedTreeId(workInProgress);\n workInProgress.flags |= 1;\n reconcileChildren(current, workInProgress, nextProps, renderLanes);\n return workInProgress.child;\n}\nfunction updateClassComponent(\n current,\n workInProgress,\n Component,\n nextProps,\n renderLanes\n) {\n prepareToReadContext(workInProgress);\n if (null === workInProgress.stateNode) {\n var context = emptyContextObject,\n contextType = Component.contextType;\n \"object\" === typeof contextType &&\n null !== contextType &&\n (context = readContext(contextType));\n context = new Component(nextProps, context);\n workInProgress.memoizedState =\n null !== context.state && void 0 !== context.state ? context.state : null;\n context.updater = classComponentUpdater;\n workInProgress.stateNode = context;\n context._reactInternals = workInProgress;\n context = workInProgress.stateNode;\n context.props = nextProps;\n context.state = workInProgress.memoizedState;\n context.refs = {};\n initializeUpdateQueue(workInProgress);\n contextType = Component.contextType;\n context.context =\n \"object\" === typeof contextType && null !== contextType\n ? readContext(contextType)\n : emptyContextObject;\n context.state = workInProgress.memoizedState;\n contextType = Component.getDerivedStateFromProps;\n \"function\" === typeof contextType &&\n (applyDerivedStateFromProps(\n workInProgress,\n Component,\n contextType,\n nextProps\n ),\n (context.state = workInProgress.memoizedState));\n \"function\" === typeof Component.getDerivedStateFromProps ||\n \"function\" === typeof context.getSnapshotBeforeUpdate ||\n (\"function\" !== typeof context.UNSAFE_componentWillMount &&\n \"function\" !== typeof context.componentWillMount) ||\n ((contextType = context.state),\n \"function\" === typeof context.componentWillMount &&\n context.componentWillMount(),\n \"function\" === typeof context.UNSAFE_componentWillMount &&\n context.UNSAFE_componentWillMount(),\n contextType !== context.state &&\n classComponentUpdater.enqueueReplaceState(context, context.state, null),\n processUpdateQueue(workInProgress, nextProps, context, renderLanes),\n suspendIfUpdateReadFromEntangledAsyncAction(),\n (context.state = workInProgress.memoizedState));\n \"function\" === typeof context.componentDidMount &&\n (workInProgress.flags |= 4194308);\n nextProps = !0;\n } else if (null === current) {\n context = workInProgress.stateNode;\n var unresolvedOldProps = workInProgress.memoizedProps,\n oldProps = resolveClassComponentProps(Component, unresolvedOldProps);\n context.props = oldProps;\n var oldContext = context.context,\n contextType$jscomp$0 = Component.contextType;\n contextType = emptyContextObject;\n \"object\" === typeof contextType$jscomp$0 &&\n null !== contextType$jscomp$0 &&\n (contextType = readContext(contextType$jscomp$0));\n var getDerivedStateFromProps = Component.getDerivedStateFromProps;\n contextType$jscomp$0 =\n \"function\" === typeof getDerivedStateFromProps ||\n \"function\" === typeof context.getSnapshotBeforeUpdate;\n unresolvedOldProps = workInProgress.pendingProps !== unresolvedOldProps;\n contextType$jscomp$0 ||\n (\"function\" !== typeof context.UNSAFE_componentWillReceiveProps &&\n \"function\" !== typeof context.componentWillReceiveProps) ||\n ((unresolvedOldProps || oldContext !== contextType) &&\n callComponentWillReceiveProps(\n workInProgress,\n context,\n nextProps,\n contextType\n ));\n hasForceUpdate = !1;\n var oldState = workInProgress.memoizedState;\n context.state = oldState;\n processUpdateQueue(workInProgress, nextProps, context, renderLanes);\n suspendIfUpdateReadFromEntangledAsyncAction();\n oldContext = workInProgress.memoizedState;\n unresolvedOldProps || oldState !== oldContext || hasForceUpdate\n ? (\"function\" === typeof getDerivedStateFromProps &&\n (applyDerivedStateFromProps(\n workInProgress,\n Component,\n getDerivedStateFromProps,\n nextProps\n ),\n (oldContext = workInProgress.memoizedState)),\n (oldProps =\n hasForceUpdate ||\n checkShouldComponentUpdate(\n workInProgress,\n Component,\n oldProps,\n nextProps,\n oldState,\n oldContext,\n contextType\n ))\n ? (contextType$jscomp$0 ||\n (\"function\" !== typeof context.UNSAFE_componentWillMount &&\n \"function\" !== typeof context.componentWillMount) ||\n (\"function\" === typeof context.componentWillMount &&\n context.componentWillMount(),\n \"function\" === typeof context.UNSAFE_componentWillMount &&\n context.UNSAFE_componentWillMount()),\n \"function\" === typeof context.componentDidMount &&\n (workInProgress.flags |= 4194308))\n : (\"function\" === typeof context.componentDidMount &&\n (workInProgress.flags |= 4194308),\n (workInProgress.memoizedProps = nextProps),\n (workInProgress.memoizedState = oldContext)),\n (context.props = nextProps),\n (context.state = oldContext),\n (context.context = contextType),\n (nextProps = oldProps))\n : (\"function\" === typeof context.componentDidMount &&\n (workInProgress.flags |= 4194308),\n (nextProps = !1));\n } else {\n context = workInProgress.stateNode;\n cloneUpdateQueue(current, workInProgress);\n contextType = workInProgress.memoizedProps;\n contextType$jscomp$0 = resolveClassComponentProps(Component, contextType);\n context.props = contextType$jscomp$0;\n getDerivedStateFromProps = workInProgress.pendingProps;\n oldState = context.context;\n oldContext = Component.contextType;\n oldProps = emptyContextObject;\n \"object\" === typeof oldContext &&\n null !== oldContext &&\n (oldProps = readContext(oldContext));\n unresolvedOldProps = Component.getDerivedStateFromProps;\n (oldContext =\n \"function\" === typeof unresolvedOldProps ||\n \"function\" === typeof context.getSnapshotBeforeUpdate) ||\n (\"function\" !== typeof context.UNSAFE_componentWillReceiveProps &&\n \"function\" !== typeof context.componentWillReceiveProps) ||\n ((contextType !== getDerivedStateFromProps || oldState !== oldProps) &&\n callComponentWillReceiveProps(\n workInProgress,\n context,\n nextProps,\n oldProps\n ));\n hasForceUpdate = !1;\n oldState = workInProgress.memoizedState;\n context.state = oldState;\n processUpdateQueue(workInProgress, nextProps, context, renderLanes);\n suspendIfUpdateReadFromEntangledAsyncAction();\n var newState = workInProgress.memoizedState;\n contextType !== getDerivedStateFromProps ||\n oldState !== newState ||\n hasForceUpdate ||\n (null !== current &&\n null !== current.dependencies &&\n checkIfContextChanged(current.dependencies))\n ? (\"function\" === typeof unresolvedOldProps &&\n (applyDerivedStateFromProps(\n workInProgress,\n Component,\n unresolvedOldProps,\n nextProps\n ),\n (newState = workInProgress.memoizedState)),\n (contextType$jscomp$0 =\n hasForceUpdate ||\n checkShouldComponentUpdate(\n workInProgress,\n Component,\n contextType$jscomp$0,\n nextProps,\n oldState,\n newState,\n oldProps\n ) ||\n (null !== current &&\n null !== current.dependencies &&\n checkIfContextChanged(current.dependencies)))\n ? (oldContext ||\n (\"function\" !== typeof context.UNSAFE_componentWillUpdate &&\n \"function\" !== typeof context.componentWillUpdate) ||\n (\"function\" === typeof context.componentWillUpdate &&\n context.componentWillUpdate(nextProps, newState, oldProps),\n \"function\" === typeof context.UNSAFE_componentWillUpdate &&\n context.UNSAFE_componentWillUpdate(\n nextProps,\n newState,\n oldProps\n )),\n \"function\" === typeof context.componentDidUpdate &&\n (workInProgress.flags |= 4),\n \"function\" === typeof context.getSnapshotBeforeUpdate &&\n (workInProgress.flags |= 1024))\n : (\"function\" !== typeof context.componentDidUpdate ||\n (contextType === current.memoizedProps &&\n oldState === current.memoizedState) ||\n (workInProgress.flags |= 4),\n \"function\" !== typeof context.getSnapshotBeforeUpdate ||\n (contextType === current.memoizedProps &&\n oldState === current.memoizedState) ||\n (workInProgress.flags |= 1024),\n (workInProgress.memoizedProps = nextProps),\n (workInProgress.memoizedState = newState)),\n (context.props = nextProps),\n (context.state = newState),\n (context.context = oldProps),\n (nextProps = contextType$jscomp$0))\n : (\"function\" !== typeof context.componentDidUpdate ||\n (contextType === current.memoizedProps &&\n oldState === current.memoizedState) ||\n (workInProgress.flags |= 4),\n \"function\" !== typeof context.getSnapshotBeforeUpdate ||\n (contextType === current.memoizedProps &&\n oldState === current.memoizedState) ||\n (workInProgress.flags |= 1024),\n (nextProps = !1));\n }\n context = nextProps;\n markRef(current, workInProgress);\n nextProps = 0 !== (workInProgress.flags & 128);\n context || nextProps\n ? ((context = workInProgress.stateNode),\n (Component =\n nextProps && \"function\" !== typeof Component.getDerivedStateFromError\n ? null\n : context.render()),\n (workInProgress.flags |= 1),\n null !== current && nextProps\n ? ((workInProgress.child = reconcileChildFibers(\n workInProgress,\n current.child,\n null,\n renderLanes\n )),\n (workInProgress.child = reconcileChildFibers(\n workInProgress,\n null,\n Component,\n renderLanes\n )))\n : reconcileChildren(current, workInProgress, Component, renderLanes),\n (workInProgress.memoizedState = context.state),\n (current = workInProgress.child))\n : (current = bailoutOnAlreadyFinishedWork(\n current,\n workInProgress,\n renderLanes\n ));\n return current;\n}\nfunction mountHostRootWithoutHydrating(\n current,\n workInProgress,\n nextChildren,\n renderLanes\n) {\n resetHydrationState();\n workInProgress.flags |= 256;\n reconcileChildren(current, workInProgress, nextChildren, renderLanes);\n return workInProgress.child;\n}\nvar SUSPENDED_MARKER = {\n dehydrated: null,\n treeContext: null,\n retryLane: 0,\n hydrationErrors: null\n};\nfunction mountSuspenseOffscreenState(renderLanes) {\n return { baseLanes: renderLanes, cachePool: getSuspendedCache() };\n}\nfunction getRemainingWorkInPrimaryTree(\n current,\n primaryTreeDidDefer,\n renderLanes\n) {\n current = null !== current ? current.childLanes & ~renderLanes : 0;\n primaryTreeDidDefer && (current |= workInProgressDeferredLane);\n return current;\n}\nfunction updateSuspenseComponent(current, workInProgress, renderLanes) {\n var nextProps = workInProgress.pendingProps,\n showFallback = !1,\n didSuspend = 0 !== (workInProgress.flags & 128),\n JSCompiler_temp;\n (JSCompiler_temp = didSuspend) ||\n (JSCompiler_temp =\n null !== current && null === current.memoizedState\n ? !1\n : 0 !== (suspenseStackCursor.current & 2));\n JSCompiler_temp && ((showFallback = !0), (workInProgress.flags &= -129));\n JSCompiler_temp = 0 !== (workInProgress.flags & 32);\n workInProgress.flags &= -33;\n if (null === current) {\n if (isHydrating) {\n showFallback\n ? pushPrimaryTreeSuspenseHandler(workInProgress)\n : reuseSuspenseHandlerOnStack(workInProgress);\n (current = nextHydratableInstance)\n ? ((current = canHydrateHydrationBoundary(\n current,\n rootOrSingletonContext\n )),\n (current = null !== current && \"&\" !== current.data ? current : null),\n null !== current &&\n ((workInProgress.memoizedState = {\n dehydrated: current,\n treeContext:\n null !== treeContextProvider\n ? { id: treeContextId, overflow: treeContextOverflow }\n : null,\n retryLane: 536870912,\n hydrationErrors: null\n }),\n (renderLanes = createFiberFromDehydratedFragment(current)),\n (renderLanes.return = workInProgress),\n (workInProgress.child = renderLanes),\n (hydrationParentFiber = workInProgress),\n (nextHydratableInstance = null)))\n : (current = null);\n if (null === current) throw throwOnHydrationMismatch(workInProgress);\n isSuspenseInstanceFallback(current)\n ? (workInProgress.lanes = 32)\n : (workInProgress.lanes = 536870912);\n return null;\n }\n var nextPrimaryChildren = nextProps.children;\n nextProps = nextProps.fallback;\n if (showFallback)\n return (\n reuseSuspenseHandlerOnStack(workInProgress),\n (showFallback = workInProgress.mode),\n (nextPrimaryChildren = mountWorkInProgressOffscreenFiber(\n { mode: \"hidden\", children: nextPrimaryChildren },\n showFallback\n )),\n (nextProps = createFiberFromFragment(\n nextProps,\n showFallback,\n renderLanes,\n null\n )),\n (nextPrimaryChildren.return = workInProgress),\n (nextProps.return = workInProgress),\n (nextPrimaryChildren.sibling = nextProps),\n (workInProgress.child = nextPrimaryChildren),\n (nextProps = workInProgress.child),\n (nextProps.memoizedState = mountSuspenseOffscreenState(renderLanes)),\n (nextProps.childLanes = getRemainingWorkInPrimaryTree(\n current,\n JSCompiler_temp,\n renderLanes\n )),\n (workInProgress.memoizedState = SUSPENDED_MARKER),\n bailoutOffscreenComponent(null, nextProps)\n );\n pushPrimaryTreeSuspenseHandler(workInProgress);\n return mountSuspensePrimaryChildren(workInProgress, nextPrimaryChildren);\n }\n var prevState = current.memoizedState;\n if (\n null !== prevState &&\n ((nextPrimaryChildren = prevState.dehydrated), null !== nextPrimaryChildren)\n ) {\n if (didSuspend)\n workInProgress.flags & 256\n ? (pushPrimaryTreeSuspenseHandler(workInProgress),\n (workInProgress.flags &= -257),\n (workInProgress = retrySuspenseComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n )))\n : null !== workInProgress.memoizedState\n ? (reuseSuspenseHandlerOnStack(workInProgress),\n (workInProgress.child = current.child),\n (workInProgress.flags |= 128),\n (workInProgress = null))\n : (reuseSuspenseHandlerOnStack(workInProgress),\n (nextPrimaryChildren = nextProps.fallback),\n (showFallback = workInProgress.mode),\n (nextProps = mountWorkInProgressOffscreenFiber(\n { mode: \"visible\", children: nextProps.children },\n showFallback\n )),\n (nextPrimaryChildren = createFiberFromFragment(\n nextPrimaryChildren,\n showFallback,\n renderLanes,\n null\n )),\n (nextPrimaryChildren.flags |= 2),\n (nextProps.return = workInProgress),\n (nextPrimaryChildren.return = workInProgress),\n (nextProps.sibling = nextPrimaryChildren),\n (workInProgress.child = nextProps),\n reconcileChildFibers(\n workInProgress,\n current.child,\n null,\n renderLanes\n ),\n (nextProps = workInProgress.child),\n (nextProps.memoizedState =\n mountSuspenseOffscreenState(renderLanes)),\n (nextProps.childLanes = getRemainingWorkInPrimaryTree(\n current,\n JSCompiler_temp,\n renderLanes\n )),\n (workInProgress.memoizedState = SUSPENDED_MARKER),\n (workInProgress = bailoutOffscreenComponent(null, nextProps)));\n else if (\n (pushPrimaryTreeSuspenseHandler(workInProgress),\n isSuspenseInstanceFallback(nextPrimaryChildren))\n ) {\n JSCompiler_temp =\n nextPrimaryChildren.nextSibling &&\n nextPrimaryChildren.nextSibling.dataset;\n if (JSCompiler_temp) var digest = JSCompiler_temp.dgst;\n JSCompiler_temp = digest;\n nextProps = Error(formatProdErrorMessage(419));\n nextProps.stack = \"\";\n nextProps.digest = JSCompiler_temp;\n queueHydrationError({ value: nextProps, source: null, stack: null });\n workInProgress = retrySuspenseComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n );\n } else if (\n (didReceiveUpdate ||\n propagateParentContextChanges(current, workInProgress, renderLanes, !1),\n (JSCompiler_temp = 0 !== (renderLanes & current.childLanes)),\n didReceiveUpdate || JSCompiler_temp)\n ) {\n JSCompiler_temp = workInProgressRoot;\n if (\n null !== JSCompiler_temp &&\n ((nextProps = getBumpedLaneForHydration(JSCompiler_temp, renderLanes)),\n 0 !== nextProps && nextProps !== prevState.retryLane)\n )\n throw (\n ((prevState.retryLane = nextProps),\n enqueueConcurrentRenderForLane(current, nextProps),\n scheduleUpdateOnFiber(JSCompiler_temp, current, nextProps),\n SelectiveHydrationException)\n );\n isSuspenseInstancePending(nextPrimaryChildren) ||\n renderDidSuspendDelayIfPossible();\n workInProgress = retrySuspenseComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n );\n } else\n isSuspenseInstancePending(nextPrimaryChildren)\n ? ((workInProgress.flags |= 192),\n (workInProgress.child = current.child),\n (workInProgress = null))\n : ((current = prevState.treeContext),\n (nextHydratableInstance = getNextHydratable(\n nextPrimaryChildren.nextSibling\n )),\n (hydrationParentFiber = workInProgress),\n (isHydrating = !0),\n (hydrationErrors = null),\n (rootOrSingletonContext = !1),\n null !== current &&\n restoreSuspendedTreeContext(workInProgress, current),\n (workInProgress = mountSuspensePrimaryChildren(\n workInProgress,\n nextProps.children\n )),\n (workInProgress.flags |= 4096));\n return workInProgress;\n }\n if (showFallback)\n return (\n reuseSuspenseHandlerOnStack(workInProgress),\n (nextPrimaryChildren = nextProps.fallback),\n (showFallback = workInProgress.mode),\n (prevState = current.child),\n (digest = prevState.sibling),\n (nextProps = createWorkInProgress(prevState, {\n mode: \"hidden\",\n children: nextProps.children\n })),\n (nextProps.subtreeFlags = prevState.subtreeFlags & 65011712),\n null !== digest\n ? (nextPrimaryChildren = createWorkInProgress(\n digest,\n nextPrimaryChildren\n ))\n : ((nextPrimaryChildren = createFiberFromFragment(\n nextPrimaryChildren,\n showFallback,\n renderLanes,\n null\n )),\n (nextPrimaryChildren.flags |= 2)),\n (nextPrimaryChildren.return = workInProgress),\n (nextProps.return = workInProgress),\n (nextProps.sibling = nextPrimaryChildren),\n (workInProgress.child = nextProps),\n bailoutOffscreenComponent(null, nextProps),\n (nextProps = workInProgress.child),\n (nextPrimaryChildren = current.child.memoizedState),\n null === nextPrimaryChildren\n ? (nextPrimaryChildren = mountSuspenseOffscreenState(renderLanes))\n : ((showFallback = nextPrimaryChildren.cachePool),\n null !== showFallback\n ? ((prevState = CacheContext._currentValue),\n (showFallback =\n showFallback.parent !== prevState\n ? { parent: prevState, pool: prevState }\n : showFallback))\n : (showFallback = getSuspendedCache()),\n (nextPrimaryChildren = {\n baseLanes: nextPrimaryChildren.baseLanes | renderLanes,\n cachePool: showFallback\n })),\n (nextProps.memoizedState = nextPrimaryChildren),\n (nextProps.childLanes = getRemainingWorkInPrimaryTree(\n current,\n JSCompiler_temp,\n renderLanes\n )),\n (workInProgress.memoizedState = SUSPENDED_MARKER),\n bailoutOffscreenComponent(current.child, nextProps)\n );\n pushPrimaryTreeSuspenseHandler(workInProgress);\n renderLanes = current.child;\n current = renderLanes.sibling;\n renderLanes = createWorkInProgress(renderLanes, {\n mode: \"visible\",\n children: nextProps.children\n });\n renderLanes.return = workInProgress;\n renderLanes.sibling = null;\n null !== current &&\n ((JSCompiler_temp = workInProgress.deletions),\n null === JSCompiler_temp\n ? ((workInProgress.deletions = [current]), (workInProgress.flags |= 16))\n : JSCompiler_temp.push(current));\n workInProgress.child = renderLanes;\n workInProgress.memoizedState = null;\n return renderLanes;\n}\nfunction mountSuspensePrimaryChildren(workInProgress, primaryChildren) {\n primaryChildren = mountWorkInProgressOffscreenFiber(\n { mode: \"visible\", children: primaryChildren },\n workInProgress.mode\n );\n primaryChildren.return = workInProgress;\n return (workInProgress.child = primaryChildren);\n}\nfunction mountWorkInProgressOffscreenFiber(offscreenProps, mode) {\n offscreenProps = createFiberImplClass(22, offscreenProps, null, mode);\n offscreenProps.lanes = 0;\n return offscreenProps;\n}\nfunction retrySuspenseComponentWithoutHydrating(\n current,\n workInProgress,\n renderLanes\n) {\n reconcileChildFibers(workInProgress, current.child, null, renderLanes);\n current = mountSuspensePrimaryChildren(\n workInProgress,\n workInProgress.pendingProps.children\n );\n current.flags |= 2;\n workInProgress.memoizedState = null;\n return current;\n}\nfunction scheduleSuspenseWorkOnFiber(fiber, renderLanes, propagationRoot) {\n fiber.lanes |= renderLanes;\n var alternate = fiber.alternate;\n null !== alternate && (alternate.lanes |= renderLanes);\n scheduleContextWorkOnParentPath(fiber.return, renderLanes, propagationRoot);\n}\nfunction initSuspenseListRenderState(\n workInProgress,\n isBackwards,\n tail,\n lastContentRow,\n tailMode,\n treeForkCount\n) {\n var renderState = workInProgress.memoizedState;\n null === renderState\n ? (workInProgress.memoizedState = {\n isBackwards: isBackwards,\n rendering: null,\n renderingStartTime: 0,\n last: lastContentRow,\n tail: tail,\n tailMode: tailMode,\n treeForkCount: treeForkCount\n })\n : ((renderState.isBackwards = isBackwards),\n (renderState.rendering = null),\n (renderState.renderingStartTime = 0),\n (renderState.last = lastContentRow),\n (renderState.tail = tail),\n (renderState.tailMode = tailMode),\n (renderState.treeForkCount = treeForkCount));\n}\nfunction updateSuspenseListComponent(current, workInProgress, renderLanes) {\n var nextProps = workInProgress.pendingProps,\n revealOrder = nextProps.revealOrder,\n tailMode = nextProps.tail;\n nextProps = nextProps.children;\n var suspenseContext = suspenseStackCursor.current,\n shouldForceFallback = 0 !== (suspenseContext & 2);\n shouldForceFallback\n ? ((suspenseContext = (suspenseContext & 1) | 2),\n (workInProgress.flags |= 128))\n : (suspenseContext &= 1);\n push(suspenseStackCursor, suspenseContext);\n reconcileChildren(current, workInProgress, nextProps, renderLanes);\n nextProps = isHydrating ? treeForkCount : 0;\n if (!shouldForceFallback && null !== current && 0 !== (current.flags & 128))\n a: for (current = workInProgress.child; null !== current; ) {\n if (13 === current.tag)\n null !== current.memoizedState &&\n scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);\n else if (19 === current.tag)\n scheduleSuspenseWorkOnFiber(current, renderLanes, workInProgress);\n else if (null !== current.child) {\n current.child.return = current;\n current = current.child;\n continue;\n }\n if (current === workInProgress) break a;\n for (; null === current.sibling; ) {\n if (null === current.return || current.return === workInProgress)\n break a;\n current = current.return;\n }\n current.sibling.return = current.return;\n current = current.sibling;\n }\n switch (revealOrder) {\n case \"forwards\":\n renderLanes = workInProgress.child;\n for (revealOrder = null; null !== renderLanes; )\n (current = renderLanes.alternate),\n null !== current &&\n null === findFirstSuspended(current) &&\n (revealOrder = renderLanes),\n (renderLanes = renderLanes.sibling);\n renderLanes = revealOrder;\n null === renderLanes\n ? ((revealOrder = workInProgress.child), (workInProgress.child = null))\n : ((revealOrder = renderLanes.sibling), (renderLanes.sibling = null));\n initSuspenseListRenderState(\n workInProgress,\n !1,\n revealOrder,\n renderLanes,\n tailMode,\n nextProps\n );\n break;\n case \"backwards\":\n case \"unstable_legacy-backwards\":\n renderLanes = null;\n revealOrder = workInProgress.child;\n for (workInProgress.child = null; null !== revealOrder; ) {\n current = revealOrder.alternate;\n if (null !== current && null === findFirstSuspended(current)) {\n workInProgress.child = revealOrder;\n break;\n }\n current = revealOrder.sibling;\n revealOrder.sibling = renderLanes;\n renderLanes = revealOrder;\n revealOrder = current;\n }\n initSuspenseListRenderState(\n workInProgress,\n !0,\n renderLanes,\n null,\n tailMode,\n nextProps\n );\n break;\n case \"together\":\n initSuspenseListRenderState(\n workInProgress,\n !1,\n null,\n null,\n void 0,\n nextProps\n );\n break;\n default:\n workInProgress.memoizedState = null;\n }\n return workInProgress.child;\n}\nfunction bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes) {\n null !== current && (workInProgress.dependencies = current.dependencies);\n workInProgressRootSkippedLanes |= workInProgress.lanes;\n if (0 === (renderLanes & workInProgress.childLanes))\n if (null !== current) {\n if (\n (propagateParentContextChanges(\n current,\n workInProgress,\n renderLanes,\n !1\n ),\n 0 === (renderLanes & workInProgress.childLanes))\n )\n return null;\n } else return null;\n if (null !== current && workInProgress.child !== current.child)\n throw Error(formatProdErrorMessage(153));\n if (null !== workInProgress.child) {\n current = workInProgress.child;\n renderLanes = createWorkInProgress(current, current.pendingProps);\n workInProgress.child = renderLanes;\n for (renderLanes.return = workInProgress; null !== current.sibling; )\n (current = current.sibling),\n (renderLanes = renderLanes.sibling =\n createWorkInProgress(current, current.pendingProps)),\n (renderLanes.return = workInProgress);\n renderLanes.sibling = null;\n }\n return workInProgress.child;\n}\nfunction checkScheduledUpdateOrContext(current, renderLanes) {\n if (0 !== (current.lanes & renderLanes)) return !0;\n current = current.dependencies;\n return null !== current && checkIfContextChanged(current) ? !0 : !1;\n}\nfunction attemptEarlyBailoutIfNoScheduledUpdate(\n current,\n workInProgress,\n renderLanes\n) {\n switch (workInProgress.tag) {\n case 3:\n pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);\n pushProvider(workInProgress, CacheContext, current.memoizedState.cache);\n resetHydrationState();\n break;\n case 27:\n case 5:\n pushHostContext(workInProgress);\n break;\n case 4:\n pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);\n break;\n case 10:\n pushProvider(\n workInProgress,\n workInProgress.type,\n workInProgress.memoizedProps.value\n );\n break;\n case 31:\n if (null !== workInProgress.memoizedState)\n return (\n (workInProgress.flags |= 128),\n pushDehydratedActivitySuspenseHandler(workInProgress),\n null\n );\n break;\n case 13:\n var state$102 = workInProgress.memoizedState;\n if (null !== state$102) {\n if (null !== state$102.dehydrated)\n return (\n pushPrimaryTreeSuspenseHandler(workInProgress),\n (workInProgress.flags |= 128),\n null\n );\n if (0 !== (renderLanes & workInProgress.child.childLanes))\n return updateSuspenseComponent(current, workInProgress, renderLanes);\n pushPrimaryTreeSuspenseHandler(workInProgress);\n current = bailoutOnAlreadyFinishedWork(\n current,\n workInProgress,\n renderLanes\n );\n return null !== current ? current.sibling : null;\n }\n pushPrimaryTreeSuspenseHandler(workInProgress);\n break;\n case 19:\n var didSuspendBefore = 0 !== (current.flags & 128);\n state$102 = 0 !== (renderLanes & workInProgress.childLanes);\n state$102 ||\n (propagateParentContextChanges(\n current,\n workInProgress,\n renderLanes,\n !1\n ),\n (state$102 = 0 !== (renderLanes & workInProgress.childLanes)));\n if (didSuspendBefore) {\n if (state$102)\n return updateSuspenseListComponent(\n current,\n workInProgress,\n renderLanes\n );\n workInProgress.flags |= 128;\n }\n didSuspendBefore = workInProgress.memoizedState;\n null !== didSuspendBefore &&\n ((didSuspendBefore.rendering = null),\n (didSuspendBefore.tail = null),\n (didSuspendBefore.lastEffect = null));\n push(suspenseStackCursor, suspenseStackCursor.current);\n if (state$102) break;\n else return null;\n case 22:\n return (\n (workInProgress.lanes = 0),\n updateOffscreenComponent(\n current,\n workInProgress,\n renderLanes,\n workInProgress.pendingProps\n )\n );\n case 24:\n pushProvider(workInProgress, CacheContext, current.memoizedState.cache);\n }\n return bailoutOnAlreadyFinishedWork(current, workInProgress, renderLanes);\n}\nfunction beginWork(current, workInProgress, renderLanes) {\n if (null !== current)\n if (current.memoizedProps !== workInProgress.pendingProps)\n didReceiveUpdate = !0;\n else {\n if (\n !checkScheduledUpdateOrContext(current, renderLanes) &&\n 0 === (workInProgress.flags & 128)\n )\n return (\n (didReceiveUpdate = !1),\n attemptEarlyBailoutIfNoScheduledUpdate(\n current,\n workInProgress,\n renderLanes\n )\n );\n didReceiveUpdate = 0 !== (current.flags & 131072) ? !0 : !1;\n }\n else\n (didReceiveUpdate = !1),\n isHydrating &&\n 0 !== (workInProgress.flags & 1048576) &&\n pushTreeId(workInProgress, treeForkCount, workInProgress.index);\n workInProgress.lanes = 0;\n switch (workInProgress.tag) {\n case 16:\n a: {\n var props = workInProgress.pendingProps;\n current = resolveLazy(workInProgress.elementType);\n workInProgress.type = current;\n if (\"function\" === typeof current)\n shouldConstruct(current)\n ? ((props = resolveClassComponentProps(current, props)),\n (workInProgress.tag = 1),\n (workInProgress = updateClassComponent(\n null,\n workInProgress,\n current,\n props,\n renderLanes\n )))\n : ((workInProgress.tag = 0),\n (workInProgress = updateFunctionComponent(\n null,\n workInProgress,\n current,\n props,\n renderLanes\n )));\n else {\n if (void 0 !== current && null !== current) {\n var $$typeof = current.$$typeof;\n if ($$typeof === REACT_FORWARD_REF_TYPE) {\n workInProgress.tag = 11;\n workInProgress = updateForwardRef(\n null,\n workInProgress,\n current,\n props,\n renderLanes\n );\n break a;\n } else if ($$typeof === REACT_MEMO_TYPE) {\n workInProgress.tag = 14;\n workInProgress = updateMemoComponent(\n null,\n workInProgress,\n current,\n props,\n renderLanes\n );\n break a;\n }\n }\n workInProgress = getComponentNameFromType(current) || current;\n throw Error(formatProdErrorMessage(306, workInProgress, \"\"));\n }\n }\n return workInProgress;\n case 0:\n return updateFunctionComponent(\n current,\n workInProgress,\n workInProgress.type,\n workInProgress.pendingProps,\n renderLanes\n );\n case 1:\n return (\n (props = workInProgress.type),\n ($$typeof = resolveClassComponentProps(\n props,\n workInProgress.pendingProps\n )),\n updateClassComponent(\n current,\n workInProgress,\n props,\n $$typeof,\n renderLanes\n )\n );\n case 3:\n a: {\n pushHostContainer(\n workInProgress,\n workInProgress.stateNode.containerInfo\n );\n if (null === current) throw Error(formatProdErrorMessage(387));\n props = workInProgress.pendingProps;\n var prevState = workInProgress.memoizedState;\n $$typeof = prevState.element;\n cloneUpdateQueue(current, workInProgress);\n processUpdateQueue(workInProgress, props, null, renderLanes);\n var nextState = workInProgress.memoizedState;\n props = nextState.cache;\n pushProvider(workInProgress, CacheContext, props);\n props !== prevState.cache &&\n propagateContextChanges(\n workInProgress,\n [CacheContext],\n renderLanes,\n !0\n );\n suspendIfUpdateReadFromEntangledAsyncAction();\n props = nextState.element;\n if (prevState.isDehydrated)\n if (\n ((prevState = {\n element: props,\n isDehydrated: !1,\n cache: nextState.cache\n }),\n (workInProgress.updateQueue.baseState = prevState),\n (workInProgress.memoizedState = prevState),\n workInProgress.flags & 256)\n ) {\n workInProgress = mountHostRootWithoutHydrating(\n current,\n workInProgress,\n props,\n renderLanes\n );\n break a;\n } else if (props !== $$typeof) {\n $$typeof = createCapturedValueAtFiber(\n Error(formatProdErrorMessage(424)),\n workInProgress\n );\n queueHydrationError($$typeof);\n workInProgress = mountHostRootWithoutHydrating(\n current,\n workInProgress,\n props,\n renderLanes\n );\n break a;\n } else {\n current = workInProgress.stateNode.containerInfo;\n switch (current.nodeType) {\n case 9:\n current = current.body;\n break;\n default:\n current =\n \"HTML\" === current.nodeName\n ? current.ownerDocument.body\n : current;\n }\n nextHydratableInstance = getNextHydratable(current.firstChild);\n hydrationParentFiber = workInProgress;\n isHydrating = !0;\n hydrationErrors = null;\n rootOrSingletonContext = !0;\n renderLanes = mountChildFibers(\n workInProgress,\n null,\n props,\n renderLanes\n );\n for (workInProgress.child = renderLanes; renderLanes; )\n (renderLanes.flags = (renderLanes.flags & -3) | 4096),\n (renderLanes = renderLanes.sibling);\n }\n else {\n resetHydrationState();\n if (props === $$typeof) {\n workInProgress = bailoutOnAlreadyFinishedWork(\n current,\n workInProgress,\n renderLanes\n );\n break a;\n }\n reconcileChildren(current, workInProgress, props, renderLanes);\n }\n workInProgress = workInProgress.child;\n }\n return workInProgress;\n case 26:\n return (\n markRef(current, workInProgress),\n null === current\n ? (renderLanes = getResource(\n workInProgress.type,\n null,\n workInProgress.pendingProps,\n null\n ))\n ? (workInProgress.memoizedState = renderLanes)\n : isHydrating ||\n ((renderLanes = workInProgress.type),\n (current = workInProgress.pendingProps),\n (props = getOwnerDocumentFromRootContainer(\n rootInstanceStackCursor.current\n ).createElement(renderLanes)),\n (props[internalInstanceKey] = workInProgress),\n (props[internalPropsKey] = current),\n setInitialProperties(props, renderLanes, current),\n markNodeAsHoistable(props),\n (workInProgress.stateNode = props))\n : (workInProgress.memoizedState = getResource(\n workInProgress.type,\n current.memoizedProps,\n workInProgress.pendingProps,\n current.memoizedState\n )),\n null\n );\n case 27:\n return (\n pushHostContext(workInProgress),\n null === current &&\n isHydrating &&\n ((props = workInProgress.stateNode =\n resolveSingletonInstance(\n workInProgress.type,\n workInProgress.pendingProps,\n rootInstanceStackCursor.current\n )),\n (hydrationParentFiber = workInProgress),\n (rootOrSingletonContext = !0),\n ($$typeof = nextHydratableInstance),\n isSingletonScope(workInProgress.type)\n ? ((previousHydratableOnEnteringScopedSingleton = $$typeof),\n (nextHydratableInstance = getNextHydratable(props.firstChild)))\n : (nextHydratableInstance = $$typeof)),\n reconcileChildren(\n current,\n workInProgress,\n workInProgress.pendingProps.children,\n renderLanes\n ),\n markRef(current, workInProgress),\n null === current && (workInProgress.flags |= 4194304),\n workInProgress.child\n );\n case 5:\n if (null === current && isHydrating) {\n if (($$typeof = props = nextHydratableInstance))\n (props = canHydrateInstance(\n props,\n workInProgress.type,\n workInProgress.pendingProps,\n rootOrSingletonContext\n )),\n null !== props\n ? ((workInProgress.stateNode = props),\n (hydrationParentFiber = workInProgress),\n (nextHydratableInstance = getNextHydratable(props.firstChild)),\n (rootOrSingletonContext = !1),\n ($$typeof = !0))\n : ($$typeof = !1);\n $$typeof || throwOnHydrationMismatch(workInProgress);\n }\n pushHostContext(workInProgress);\n $$typeof = workInProgress.type;\n prevState = workInProgress.pendingProps;\n nextState = null !== current ? current.memoizedProps : null;\n props = prevState.children;\n shouldSetTextContent($$typeof, prevState)\n ? (props = null)\n : null !== nextState &&\n shouldSetTextContent($$typeof, nextState) &&\n (workInProgress.flags |= 32);\n null !== workInProgress.memoizedState &&\n (($$typeof = renderWithHooks(\n current,\n workInProgress,\n TransitionAwareHostComponent,\n null,\n null,\n renderLanes\n )),\n (HostTransitionContext._currentValue = $$typeof));\n markRef(current, workInProgress);\n reconcileChildren(current, workInProgress, props, renderLanes);\n return workInProgress.child;\n case 6:\n if (null === current && isHydrating) {\n if ((current = renderLanes = nextHydratableInstance))\n (renderLanes = canHydrateTextInstance(\n renderLanes,\n workInProgress.pendingProps,\n rootOrSingletonContext\n )),\n null !== renderLanes\n ? ((workInProgress.stateNode = renderLanes),\n (hydrationParentFiber = workInProgress),\n (nextHydratableInstance = null),\n (current = !0))\n : (current = !1);\n current || throwOnHydrationMismatch(workInProgress);\n }\n return null;\n case 13:\n return updateSuspenseComponent(current, workInProgress, renderLanes);\n case 4:\n return (\n pushHostContainer(\n workInProgress,\n workInProgress.stateNode.containerInfo\n ),\n (props = workInProgress.pendingProps),\n null === current\n ? (workInProgress.child = reconcileChildFibers(\n workInProgress,\n null,\n props,\n renderLanes\n ))\n : reconcileChildren(current, workInProgress, props, renderLanes),\n workInProgress.child\n );\n case 11:\n return updateForwardRef(\n current,\n workInProgress,\n workInProgress.type,\n workInProgress.pendingProps,\n renderLanes\n );\n case 7:\n return (\n reconcileChildren(\n current,\n workInProgress,\n workInProgress.pendingProps,\n renderLanes\n ),\n workInProgress.child\n );\n case 8:\n return (\n reconcileChildren(\n current,\n workInProgress,\n workInProgress.pendingProps.children,\n renderLanes\n ),\n workInProgress.child\n );\n case 12:\n return (\n reconcileChildren(\n current,\n workInProgress,\n workInProgress.pendingProps.children,\n renderLanes\n ),\n workInProgress.child\n );\n case 10:\n return (\n (props = workInProgress.pendingProps),\n pushProvider(workInProgress, workInProgress.type, props.value),\n reconcileChildren(current, workInProgress, props.children, renderLanes),\n workInProgress.child\n );\n case 9:\n return (\n ($$typeof = workInProgress.type._context),\n (props = workInProgress.pendingProps.children),\n prepareToReadContext(workInProgress),\n ($$typeof = readContext($$typeof)),\n (props = props($$typeof)),\n (workInProgress.flags |= 1),\n reconcileChildren(current, workInProgress, props, renderLanes),\n workInProgress.child\n );\n case 14:\n return updateMemoComponent(\n current,\n workInProgress,\n workInProgress.type,\n workInProgress.pendingProps,\n renderLanes\n );\n case 15:\n return updateSimpleMemoComponent(\n current,\n workInProgress,\n workInProgress.type,\n workInProgress.pendingProps,\n renderLanes\n );\n case 19:\n return updateSuspenseListComponent(current, workInProgress, renderLanes);\n case 31:\n return updateActivityComponent(current, workInProgress, renderLanes);\n case 22:\n return updateOffscreenComponent(\n current,\n workInProgress,\n renderLanes,\n workInProgress.pendingProps\n );\n case 24:\n return (\n prepareToReadContext(workInProgress),\n (props = readContext(CacheContext)),\n null === current\n ? (($$typeof = peekCacheFromPool()),\n null === $$typeof &&\n (($$typeof = workInProgressRoot),\n (prevState = createCache()),\n ($$typeof.pooledCache = prevState),\n prevState.refCount++,\n null !== prevState && ($$typeof.pooledCacheLanes |= renderLanes),\n ($$typeof = prevState)),\n (workInProgress.memoizedState = { parent: props, cache: $$typeof }),\n initializeUpdateQueue(workInProgress),\n pushProvider(workInProgress, CacheContext, $$typeof))\n : (0 !== (current.lanes & renderLanes) &&\n (cloneUpdateQueue(current, workInProgress),\n processUpdateQueue(workInProgress, null, null, renderLanes),\n suspendIfUpdateReadFromEntangledAsyncAction()),\n ($$typeof = current.memoizedState),\n (prevState = workInProgress.memoizedState),\n $$typeof.parent !== props\n ? (($$typeof = { parent: props, cache: props }),\n (workInProgress.memoizedState = $$typeof),\n 0 === workInProgress.lanes &&\n (workInProgress.memoizedState =\n workInProgress.updateQueue.baseState =\n $$typeof),\n pushProvider(workInProgress, CacheContext, props))\n : ((props = prevState.cache),\n pushProvider(workInProgress, CacheContext, props),\n props !== $$typeof.cache &&\n propagateContextChanges(\n workInProgress,\n [CacheContext],\n renderLanes,\n !0\n ))),\n reconcileChildren(\n current,\n workInProgress,\n workInProgress.pendingProps.children,\n renderLanes\n ),\n workInProgress.child\n );\n case 29:\n throw workInProgress.pendingProps;\n }\n throw Error(formatProdErrorMessage(156, workInProgress.tag));\n}\nfunction markUpdate(workInProgress) {\n workInProgress.flags |= 4;\n}\nfunction preloadInstanceAndSuspendIfNeeded(\n workInProgress,\n type,\n oldProps,\n newProps,\n renderLanes\n) {\n if ((type = 0 !== (workInProgress.mode & 32))) type = !1;\n if (type) {\n if (\n ((workInProgress.flags |= 16777216),\n (renderLanes & 335544128) === renderLanes)\n )\n if (workInProgress.stateNode.complete) workInProgress.flags |= 8192;\n else if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192;\n else\n throw (\n ((suspendedThenable = noopSuspenseyCommitThenable),\n SuspenseyCommitException)\n );\n } else workInProgress.flags &= -16777217;\n}\nfunction preloadResourceAndSuspendIfNeeded(workInProgress, resource) {\n if (\"stylesheet\" !== resource.type || 0 !== (resource.state.loading & 4))\n workInProgress.flags &= -16777217;\n else if (((workInProgress.flags |= 16777216), !preloadResource(resource)))\n if (shouldRemainOnPreviousScreen()) workInProgress.flags |= 8192;\n else\n throw (\n ((suspendedThenable = noopSuspenseyCommitThenable),\n SuspenseyCommitException)\n );\n}\nfunction scheduleRetryEffect(workInProgress, retryQueue) {\n null !== retryQueue && (workInProgress.flags |= 4);\n workInProgress.flags & 16384 &&\n ((retryQueue =\n 22 !== workInProgress.tag ? claimNextRetryLane() : 536870912),\n (workInProgress.lanes |= retryQueue),\n (workInProgressSuspendedRetryLanes |= retryQueue));\n}\nfunction cutOffTailIfNeeded(renderState, hasRenderedATailFallback) {\n if (!isHydrating)\n switch (renderState.tailMode) {\n case \"hidden\":\n hasRenderedATailFallback = renderState.tail;\n for (var lastTailNode = null; null !== hasRenderedATailFallback; )\n null !== hasRenderedATailFallback.alternate &&\n (lastTailNode = hasRenderedATailFallback),\n (hasRenderedATailFallback = hasRenderedATailFallback.sibling);\n null === lastTailNode\n ? (renderState.tail = null)\n : (lastTailNode.sibling = null);\n break;\n case \"collapsed\":\n lastTailNode = renderState.tail;\n for (var lastTailNode$106 = null; null !== lastTailNode; )\n null !== lastTailNode.alternate && (lastTailNode$106 = lastTailNode),\n (lastTailNode = lastTailNode.sibling);\n null === lastTailNode$106\n ? hasRenderedATailFallback || null === renderState.tail\n ? (renderState.tail = null)\n : (renderState.tail.sibling = null)\n : (lastTailNode$106.sibling = null);\n }\n}\nfunction bubbleProperties(completedWork) {\n var didBailout =\n null !== completedWork.alternate &&\n completedWork.alternate.child === completedWork.child,\n newChildLanes = 0,\n subtreeFlags = 0;\n if (didBailout)\n for (var child$107 = completedWork.child; null !== child$107; )\n (newChildLanes |= child$107.lanes | child$107.childLanes),\n (subtreeFlags |= child$107.subtreeFlags & 65011712),\n (subtreeFlags |= child$107.flags & 65011712),\n (child$107.return = completedWork),\n (child$107 = child$107.sibling);\n else\n for (child$107 = completedWork.child; null !== child$107; )\n (newChildLanes |= child$107.lanes | child$107.childLanes),\n (subtreeFlags |= child$107.subtreeFlags),\n (subtreeFlags |= child$107.flags),\n (child$107.return = completedWork),\n (child$107 = child$107.sibling);\n completedWork.subtreeFlags |= subtreeFlags;\n completedWork.childLanes = newChildLanes;\n return didBailout;\n}\nfunction completeWork(current, workInProgress, renderLanes) {\n var newProps = workInProgress.pendingProps;\n popTreeContext(workInProgress);\n switch (workInProgress.tag) {\n case 16:\n case 15:\n case 0:\n case 11:\n case 7:\n case 8:\n case 12:\n case 9:\n case 14:\n return bubbleProperties(workInProgress), null;\n case 1:\n return bubbleProperties(workInProgress), null;\n case 3:\n renderLanes = workInProgress.stateNode;\n newProps = null;\n null !== current && (newProps = current.memoizedState.cache);\n workInProgress.memoizedState.cache !== newProps &&\n (workInProgress.flags |= 2048);\n popProvider(CacheContext);\n popHostContainer();\n renderLanes.pendingContext &&\n ((renderLanes.context = renderLanes.pendingContext),\n (renderLanes.pendingContext = null));\n if (null === current || null === current.child)\n popHydrationState(workInProgress)\n ? markUpdate(workInProgress)\n : null === current ||\n (current.memoizedState.isDehydrated &&\n 0 === (workInProgress.flags & 256)) ||\n ((workInProgress.flags |= 1024),\n upgradeHydrationErrorsToRecoverable());\n bubbleProperties(workInProgress);\n return null;\n case 26:\n var type = workInProgress.type,\n nextResource = workInProgress.memoizedState;\n null === current\n ? (markUpdate(workInProgress),\n null !== nextResource\n ? (bubbleProperties(workInProgress),\n preloadResourceAndSuspendIfNeeded(workInProgress, nextResource))\n : (bubbleProperties(workInProgress),\n preloadInstanceAndSuspendIfNeeded(\n workInProgress,\n type,\n null,\n newProps,\n renderLanes\n )))\n : nextResource\n ? nextResource !== current.memoizedState\n ? (markUpdate(workInProgress),\n bubbleProperties(workInProgress),\n preloadResourceAndSuspendIfNeeded(workInProgress, nextResource))\n : (bubbleProperties(workInProgress),\n (workInProgress.flags &= -16777217))\n : ((current = current.memoizedProps),\n current !== newProps && markUpdate(workInProgress),\n bubbleProperties(workInProgress),\n preloadInstanceAndSuspendIfNeeded(\n workInProgress,\n type,\n current,\n newProps,\n renderLanes\n ));\n return null;\n case 27:\n popHostContext(workInProgress);\n renderLanes = rootInstanceStackCursor.current;\n type = workInProgress.type;\n if (null !== current && null != workInProgress.stateNode)\n current.memoizedProps !== newProps && markUpdate(workInProgress);\n else {\n if (!newProps) {\n if (null === workInProgress.stateNode)\n throw Error(formatProdErrorMessage(166));\n bubbleProperties(workInProgress);\n return null;\n }\n current = contextStackCursor.current;\n popHydrationState(workInProgress)\n ? prepareToHydrateHostInstance(workInProgress, current)\n : ((current = resolveSingletonInstance(type, newProps, renderLanes)),\n (workInProgress.stateNode = current),\n markUpdate(workInProgress));\n }\n bubbleProperties(workInProgress);\n return null;\n case 5:\n popHostContext(workInProgress);\n type = workInProgress.type;\n if (null !== current && null != workInProgress.stateNode)\n current.memoizedProps !== newProps && markUpdate(workInProgress);\n else {\n if (!newProps) {\n if (null === workInProgress.stateNode)\n throw Error(formatProdErrorMessage(166));\n bubbleProperties(workInProgress);\n return null;\n }\n nextResource = contextStackCursor.current;\n if (popHydrationState(workInProgress))\n prepareToHydrateHostInstance(workInProgress, nextResource);\n else {\n var ownerDocument = getOwnerDocumentFromRootContainer(\n rootInstanceStackCursor.current\n );\n switch (nextResource) {\n case 1:\n nextResource = ownerDocument.createElementNS(\n \"http://www.w3.org/2000/svg\",\n type\n );\n break;\n case 2:\n nextResource = ownerDocument.createElementNS(\n \"http://www.w3.org/1998/Math/MathML\",\n type\n );\n break;\n default:\n switch (type) {\n case \"svg\":\n nextResource = ownerDocument.createElementNS(\n \"http://www.w3.org/2000/svg\",\n type\n );\n break;\n case \"math\":\n nextResource = ownerDocument.createElementNS(\n \"http://www.w3.org/1998/Math/MathML\",\n type\n );\n break;\n case \"script\":\n nextResource = ownerDocument.createElement(\"div\");\n nextResource.innerHTML = \"\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationRawTagOpen(code) {\n if (code === 47) {\n effects.consume(code);\n buffer = '';\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In raw continuation, after ` | \n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function continuationRawEndTag(code) {\n if (code === 62) {\n const name = buffer.toLowerCase();\n if (htmlRawNames.includes(name)) {\n effects.consume(code);\n return continuationClose;\n }\n return continuation(code);\n }\n if (asciiAlpha(code) && buffer.length < 8) {\n // Always the case.\n effects.consume(code);\n buffer += String.fromCharCode(code);\n return continuationRawEndTag;\n }\n return continuation(code);\n }\n\n /**\n * In cdata continuation, after `]`, expecting `]>`.\n *\n * ```markdown\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationCdataInside(code) {\n if (code === 93) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In declaration or instruction continuation, at `>`.\n *\n * ```markdown\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | \n * ^\n * > | &<]]>\n * ^\n * ```\n *\n * @type {State}\n */\n function continuationDeclarationInside(code) {\n if (code === 62) {\n effects.consume(code);\n return continuationClose;\n }\n\n // More dashes.\n if (code === 45 && marker === 2) {\n effects.consume(code);\n return continuationDeclarationInside;\n }\n return continuation(code);\n }\n\n /**\n * In closed continuation: everything we get until the eol/eof is part of it.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationClose(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"htmlFlowData\");\n return continuationAfter(code);\n }\n effects.consume(code);\n return continuationClose;\n }\n\n /**\n * Done.\n *\n * ```markdown\n * > | \n * ^\n * ```\n *\n * @type {State}\n */\n function continuationAfter(code) {\n effects.exit(\"htmlFlow\");\n // // Feel free to interrupt.\n // tokenizer.interrupt = false\n // // No longer concrete.\n // tokenizer.concrete = false\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeNonLazyContinuationStart(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * At eol, before continuation.\n *\n * ```markdown\n * > | * ```js\n * ^\n * | b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (markdownLineEnding(code)) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * A continuation.\n *\n * ```markdown\n * | * ```js\n * > | b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n return self.parser.lazy[self.now().line] ? nok(code) : ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeBlankLineBefore(effects, ok, nok) {\n return start;\n\n /**\n * Before eol, expecting blank line.\n *\n * ```markdown\n * > |
\n * ^\n * |\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return effects.attempt(blankLine, ok, nok);\n }\n}", "/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiAlphanumeric, asciiAlpha, markdownLineEndingOrSpace, markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeHtmlText(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable | undefined} */\n let marker;\n /** @type {number} */\n let index;\n /** @type {State} */\n let returnState;\n return start;\n\n /**\n * Start of HTML (text).\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"htmlText\");\n effects.enter(\"htmlTextData\");\n effects.consume(code);\n return open;\n }\n\n /**\n * After `<`, at tag name or other stuff.\n *\n * ```markdown\n * > | a c\n * ^\n * > | a c\n * ^\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 33) {\n effects.consume(code);\n return declarationOpen;\n }\n if (code === 47) {\n effects.consume(code);\n return tagCloseStart;\n }\n if (code === 63) {\n effects.consume(code);\n return instruction;\n }\n\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagOpen;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * > | a c\n * ^\n * > | a &<]]> c\n * ^\n * ```\n *\n * @type {State}\n */\n function declarationOpen(code) {\n if (code === 45) {\n effects.consume(code);\n return commentOpenInside;\n }\n if (code === 91) {\n effects.consume(code);\n index = 0;\n return cdataOpenInside;\n }\n if (asciiAlpha(code)) {\n effects.consume(code);\n return declaration;\n }\n return nok(code);\n }\n\n /**\n * In a comment, after ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentOpenInside(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return nok(code);\n }\n\n /**\n * In comment.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function comment(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 45) {\n effects.consume(code);\n return commentClose;\n }\n if (markdownLineEnding(code)) {\n returnState = comment;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return comment;\n }\n\n /**\n * In comment, after `-`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentClose(code) {\n if (code === 45) {\n effects.consume(code);\n return commentEnd;\n }\n return comment(code);\n }\n\n /**\n * In comment, after `--`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function commentEnd(code) {\n return code === 62 ? end(code) : code === 45 ? commentClose(code) : comment(code);\n }\n\n /**\n * After ` | a &<]]> b\n * ^^^^^^\n * ```\n *\n * @type {State}\n */\n function cdataOpenInside(code) {\n const value = \"CDATA[\";\n if (code === value.charCodeAt(index++)) {\n effects.consume(code);\n return index === value.length ? cdata : cdataOpenInside;\n }\n return nok(code);\n }\n\n /**\n * In CDATA.\n *\n * ```markdown\n * > | a &<]]> b\n * ^^^\n * ```\n *\n * @type {State}\n */\n function cdata(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataClose;\n }\n if (markdownLineEnding(code)) {\n returnState = cdata;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return cdata;\n }\n\n /**\n * In CDATA, after `]`, at another `]`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataClose(code) {\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In CDATA, after `]]`, at `>`.\n *\n * ```markdown\n * > | a &<]]> b\n * ^\n * ```\n *\n * @type {State}\n */\n function cdataEnd(code) {\n if (code === 62) {\n return end(code);\n }\n if (code === 93) {\n effects.consume(code);\n return cdataEnd;\n }\n return cdata(code);\n }\n\n /**\n * In declaration.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function declaration(code) {\n if (code === null || code === 62) {\n return end(code);\n }\n if (markdownLineEnding(code)) {\n returnState = declaration;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return declaration;\n }\n\n /**\n * In instruction.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instruction(code) {\n if (code === null) {\n return nok(code);\n }\n if (code === 63) {\n effects.consume(code);\n return instructionClose;\n }\n if (markdownLineEnding(code)) {\n returnState = instruction;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return instruction;\n }\n\n /**\n * In instruction, after `?`, at `>`.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function instructionClose(code) {\n return code === 62 ? end(code) : instruction(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseStart(code) {\n // ASCII alphabetical.\n if (asciiAlpha(code)) {\n effects.consume(code);\n return tagClose;\n }\n return nok(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagClose(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagClose;\n }\n return tagCloseBetween(code);\n }\n\n /**\n * In closing tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagCloseBetween(code) {\n if (markdownLineEnding(code)) {\n returnState = tagCloseBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagCloseBetween;\n }\n return end(code);\n }\n\n /**\n * After ` | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpen(code) {\n // ASCII alphanumerical and `-`.\n if (code === 45 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpen;\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In opening tag, after tag name.\n *\n * ```markdown\n * > | a c\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenBetween(code) {\n if (code === 47) {\n effects.consume(code);\n return end;\n }\n\n // ASCII alphabetical and `:` and `_`.\n if (code === 58 || code === 95 || asciiAlpha(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenBetween;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenBetween;\n }\n return end(code);\n }\n\n /**\n * In attribute name.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeName(code) {\n // ASCII alphabetical and `-`, `.`, `:`, and `_`.\n if (code === 45 || code === 46 || code === 58 || code === 95 || asciiAlphanumeric(code)) {\n effects.consume(code);\n return tagOpenAttributeName;\n }\n return tagOpenAttributeNameAfter(code);\n }\n\n /**\n * After attribute name, before initializer, the end of the tag, or\n * whitespace.\n *\n * ```markdown\n * > | a d\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeNameAfter(code) {\n if (code === 61) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeNameAfter;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeNameAfter;\n }\n return tagOpenBetween(code);\n }\n\n /**\n * Before unquoted, double quoted, or single quoted attribute value, allowing\n * whitespace.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueBefore(code) {\n if (code === null || code === 60 || code === 61 || code === 62 || code === 96) {\n return nok(code);\n }\n if (code === 34 || code === 39) {\n effects.consume(code);\n marker = code;\n return tagOpenAttributeValueQuoted;\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueBefore;\n return lineEndingBefore(code);\n }\n if (markdownSpace(code)) {\n effects.consume(code);\n return tagOpenAttributeValueBefore;\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * In double or single quoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuoted(code) {\n if (code === marker) {\n effects.consume(code);\n marker = undefined;\n return tagOpenAttributeValueQuotedAfter;\n }\n if (code === null) {\n return nok(code);\n }\n if (markdownLineEnding(code)) {\n returnState = tagOpenAttributeValueQuoted;\n return lineEndingBefore(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueQuoted;\n }\n\n /**\n * In unquoted attribute value.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueUnquoted(code) {\n if (code === null || code === 34 || code === 39 || code === 60 || code === 61 || code === 96) {\n return nok(code);\n }\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n effects.consume(code);\n return tagOpenAttributeValueUnquoted;\n }\n\n /**\n * After double or single quoted attribute value, before whitespace or the end\n * of the tag.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function tagOpenAttributeValueQuotedAfter(code) {\n if (code === 47 || code === 62 || markdownLineEndingOrSpace(code)) {\n return tagOpenBetween(code);\n }\n return nok(code);\n }\n\n /**\n * In certain circumstances of a tag where only an `>` is allowed.\n *\n * ```markdown\n * > | a e\n * ^\n * ```\n *\n * @type {State}\n */\n function end(code) {\n if (code === 62) {\n effects.consume(code);\n effects.exit(\"htmlTextData\");\n effects.exit(\"htmlText\");\n return ok;\n }\n return nok(code);\n }\n\n /**\n * At eol.\n *\n * > \uD83D\uDC49 **Note**: we can\u2019t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * > | a \n * ```\n *\n * @type {State}\n */\n function lineEndingBefore(code) {\n effects.exit(\"htmlTextData\");\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return lineEndingAfter;\n }\n\n /**\n * After eol, at optional whitespace.\n *\n * > \uD83D\uDC49 **Note**: we can\u2019t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfter(code) {\n // Always populated by defaults.\n\n return markdownSpace(code) ? factorySpace(effects, lineEndingAfterPrefix, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code) : lineEndingAfterPrefix(code);\n }\n\n /**\n * After eol, after optional whitespace.\n *\n * > \uD83D\uDC49 **Note**: we can\u2019t have blank lines in text, so no need to worry about\n * > empty tokens.\n *\n * ```markdown\n * | a \n * ^\n * ```\n *\n * @type {State}\n */\n function lineEndingAfterPrefix(code) {\n effects.enter(\"htmlTextData\");\n return returnState(code);\n }\n}", "/**\n * @import {\n * Construct,\n * Event,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer,\n * Token\n * } from 'micromark-util-types'\n */\n\nimport { factoryDestination } from 'micromark-factory-destination';\nimport { factoryLabel } from 'micromark-factory-label';\nimport { factoryTitle } from 'micromark-factory-title';\nimport { factoryWhitespace } from 'micromark-factory-whitespace';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/** @type {Construct} */\nexport const labelEnd = {\n name: 'labelEnd',\n resolveAll: resolveAllLabelEnd,\n resolveTo: resolveToLabelEnd,\n tokenize: tokenizeLabelEnd\n};\n\n/** @type {Construct} */\nconst resourceConstruct = {\n tokenize: tokenizeResource\n};\n/** @type {Construct} */\nconst referenceFullConstruct = {\n tokenize: tokenizeReferenceFull\n};\n/** @type {Construct} */\nconst referenceCollapsedConstruct = {\n tokenize: tokenizeReferenceCollapsed\n};\n\n/** @type {Resolver} */\nfunction resolveAllLabelEnd(events) {\n let index = -1;\n /** @type {Array} */\n const newEvents = [];\n while (++index < events.length) {\n const token = events[index][1];\n newEvents.push(events[index]);\n if (token.type === \"labelImage\" || token.type === \"labelLink\" || token.type === \"labelEnd\") {\n // Remove the marker.\n const offset = token.type === \"labelImage\" ? 4 : 2;\n token.type = \"data\";\n index += offset;\n }\n }\n\n // If the events are equal, we don't have to copy newEvents to events\n if (events.length !== newEvents.length) {\n splice(events, 0, events.length, newEvents);\n }\n return events;\n}\n\n/** @type {Resolver} */\nfunction resolveToLabelEnd(events, context) {\n let index = events.length;\n let offset = 0;\n /** @type {Token} */\n let token;\n /** @type {number | undefined} */\n let open;\n /** @type {number | undefined} */\n let close;\n /** @type {Array} */\n let media;\n\n // Find an opening.\n while (index--) {\n token = events[index][1];\n if (open) {\n // If we see another link, or inactive link label, we\u2019ve been here before.\n if (token.type === \"link\" || token.type === \"labelLink\" && token._inactive) {\n break;\n }\n\n // Mark other link openings as inactive, as we can\u2019t have links in\n // links.\n if (events[index][0] === 'enter' && token.type === \"labelLink\") {\n token._inactive = true;\n }\n } else if (close) {\n if (events[index][0] === 'enter' && (token.type === \"labelImage\" || token.type === \"labelLink\") && !token._balanced) {\n open = index;\n if (token.type !== \"labelLink\") {\n offset = 2;\n break;\n }\n }\n } else if (token.type === \"labelEnd\") {\n close = index;\n }\n }\n const group = {\n type: events[open][1].type === \"labelLink\" ? \"link\" : \"image\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n const label = {\n type: \"label\",\n start: {\n ...events[open][1].start\n },\n end: {\n ...events[close][1].end\n }\n };\n const text = {\n type: \"labelText\",\n start: {\n ...events[open + offset + 2][1].end\n },\n end: {\n ...events[close - 2][1].start\n }\n };\n media = [['enter', group, context], ['enter', label, context]];\n\n // Opening marker.\n media = push(media, events.slice(open + 1, open + offset + 3));\n\n // Text open.\n media = push(media, [['enter', text, context]]);\n\n // Always populated by defaults.\n\n // Between.\n media = push(media, resolveAll(context.parser.constructs.insideSpan.null, events.slice(open + offset + 4, close - 3), context));\n\n // Text close, marker close, label close.\n media = push(media, [['exit', text, context], events[close - 2], events[close - 1], ['exit', label, context]]);\n\n // Reference, resource, or so.\n media = push(media, events.slice(close + 1));\n\n // Media close.\n media = push(media, [['exit', group, context]]);\n splice(events, open, events.length, media);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelEnd(effects, ok, nok) {\n const self = this;\n let index = self.events.length;\n /** @type {Token} */\n let labelStart;\n /** @type {boolean} */\n let defined;\n\n // Find an opening.\n while (index--) {\n if ((self.events[index][1].type === \"labelImage\" || self.events[index][1].type === \"labelLink\") && !self.events[index][1]._balanced) {\n labelStart = self.events[index][1];\n break;\n }\n }\n return start;\n\n /**\n * Start of label end.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // If there is not an okay opening.\n if (!labelStart) {\n return nok(code);\n }\n\n // If the corresponding label (link) start is marked as inactive,\n // it means we\u2019d be wrapping a link, like this:\n //\n // ```markdown\n // > | a [b [c](d) e](f) g.\n // ^\n // ```\n //\n // We can\u2019t have that, so it\u2019s just balanced brackets.\n if (labelStart._inactive) {\n return labelEndNok(code);\n }\n defined = self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })));\n effects.enter(\"labelEnd\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelEnd\");\n return after;\n }\n\n /**\n * After `]`.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Note: `markdown-rs` also parses GFM footnotes here, which for us is in\n // an extension.\n\n // Resource (`[asd](fgh)`)?\n if (code === 40) {\n return effects.attempt(resourceConstruct, labelEndOk, defined ? labelEndOk : labelEndNok)(code);\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(referenceFullConstruct, labelEndOk, defined ? referenceNotFull : labelEndNok)(code);\n }\n\n // Shortcut (`[asd]`) reference?\n return defined ? labelEndOk(code) : labelEndNok(code);\n }\n\n /**\n * After `]`, at `[`, but not at a full reference.\n *\n * > \uD83D\uDC49 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceNotFull(code) {\n return effects.attempt(referenceCollapsedConstruct, labelEndOk, labelEndNok)(code);\n }\n\n /**\n * Done, we found something.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * > | [a][b] c\n * ^\n * > | [a][] b\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndOk(code) {\n // Note: `markdown-rs` does a bunch of stuff here.\n return ok(code);\n }\n\n /**\n * Done, it\u2019s nothing.\n *\n * There was an okay opening, but we didn\u2019t match anything.\n *\n * ```markdown\n * > | [a](b c\n * ^\n * > | [a][b c\n * ^\n * > | [a] b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEndNok(code) {\n labelStart._balanced = true;\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeResource(effects, ok, nok) {\n return resourceStart;\n\n /**\n * At a resource.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceStart(code) {\n effects.enter(\"resource\");\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n return resourceBefore;\n }\n\n /**\n * In resource, after `(`, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBefore(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceOpen)(code) : resourceOpen(code);\n }\n\n /**\n * In resource, after optional whitespace, at `)` or a destination.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceOpen(code) {\n if (code === 41) {\n return resourceEnd(code);\n }\n return factoryDestination(effects, resourceDestinationAfter, resourceDestinationMissing, \"resourceDestination\", \"resourceDestinationLiteral\", \"resourceDestinationLiteralMarker\", \"resourceDestinationRaw\", \"resourceDestinationString\", 32)(code);\n }\n\n /**\n * In resource, after destination, at optional whitespace.\n *\n * ```markdown\n * > | [a](b) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceBetween)(code) : resourceEnd(code);\n }\n\n /**\n * At invalid destination.\n *\n * ```markdown\n * > | [a](<<) b\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceDestinationMissing(code) {\n return nok(code);\n }\n\n /**\n * In resource, after destination and whitespace, at `(` or title.\n *\n * ```markdown\n * > | [a](b ) c\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceBetween(code) {\n if (code === 34 || code === 39 || code === 40) {\n return factoryTitle(effects, resourceTitleAfter, nok, \"resourceTitle\", \"resourceTitleMarker\", \"resourceTitleString\")(code);\n }\n return resourceEnd(code);\n }\n\n /**\n * In resource, after title, at optional whitespace.\n *\n * ```markdown\n * > | [a](b \"c\") d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceTitleAfter(code) {\n return markdownLineEndingOrSpace(code) ? factoryWhitespace(effects, resourceEnd)(code) : resourceEnd(code);\n }\n\n /**\n * In resource, at `)`.\n *\n * ```markdown\n * > | [a](b) d\n * ^\n * ```\n *\n * @type {State}\n */\n function resourceEnd(code) {\n if (code === 41) {\n effects.enter(\"resourceMarker\");\n effects.consume(code);\n effects.exit(\"resourceMarker\");\n effects.exit(\"resource\");\n return ok;\n }\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceFull(effects, ok, nok) {\n const self = this;\n return referenceFull;\n\n /**\n * In a reference (full), at the `[`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFull(code) {\n return factoryLabel.call(self, effects, referenceFullAfter, referenceFullMissing, \"reference\", \"referenceMarker\", \"referenceString\")(code);\n }\n\n /**\n * In a reference (full), after `]`.\n *\n * ```markdown\n * > | [a][b] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullAfter(code) {\n return self.parser.defined.includes(normalizeIdentifier(self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1))) ? ok(code) : nok(code);\n }\n\n /**\n * In reference (full) that was missing.\n *\n * ```markdown\n * > | [a][b d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceFullMissing(code) {\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeReferenceCollapsed(effects, ok, nok) {\n return referenceCollapsedStart;\n\n /**\n * In reference (collapsed), at `[`.\n *\n * > \uD83D\uDC49 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedStart(code) {\n // We only attempt a collapsed label if there\u2019s a `[`.\n\n effects.enter(\"reference\");\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n return referenceCollapsedOpen;\n }\n\n /**\n * In reference (collapsed), at `]`.\n *\n * > \uD83D\uDC49 **Note**: we only get here if the label is defined.\n *\n * ```markdown\n * > | [a][] d\n * ^\n * ```\n *\n * @type {State}\n */\n function referenceCollapsedOpen(code) {\n if (code === 93) {\n effects.enter(\"referenceMarker\");\n effects.consume(code);\n effects.exit(\"referenceMarker\");\n effects.exit(\"reference\");\n return ok;\n }\n return nok(code);\n }\n}", "/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartImage\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartImage(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (image) start.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelImage\");\n effects.enter(\"labelImageMarker\");\n effects.consume(code);\n effects.exit(\"labelImageMarker\");\n return open;\n }\n\n /**\n * After `!`, at `[`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (code === 91) {\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelImage\");\n return after;\n }\n return nok(code);\n }\n\n /**\n * After `![`.\n *\n * ```markdown\n * > | a ![b] c\n * ^\n * ```\n *\n * This is needed in because, when GFM footnotes are enabled, images never\n * form when started with a `^`.\n * Instead, links form:\n *\n * ```markdown\n * ![^a](b)\n *\n * ![^a][b]\n *\n * [b]: c\n * ```\n *\n * ```html\n *

!^a

\n *

!^a

\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // To do: use a new field to do this, this is still needed for\n // `micromark-extension-gfm-footnote`, but the `label-start-link`\n // behavior isn\u2019t.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}", "/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { labelEnd } from './label-end.js';\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n resolveAll: labelEnd.resolveAll,\n tokenize: tokenizeLabelStartLink\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLabelStartLink(effects, ok, nok) {\n const self = this;\n return start;\n\n /**\n * Start of label (link) start.\n *\n * ```markdown\n * > | a [b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"labelLink\");\n effects.enter(\"labelMarker\");\n effects.consume(code);\n effects.exit(\"labelMarker\");\n effects.exit(\"labelLink\");\n return after;\n }\n\n /** @type {State} */\n function after(code) {\n // To do: this isn\u2019t needed in `micromark-extension-gfm-footnote`,\n // remove.\n // Hidden footnotes hook.\n /* c8 ignore next 3 */\n return code === 94 && '_hiddenFootnoteSupport' in self.parser.constructs ? nok(code) : ok(code);\n }\n}", "/**\n * @import {\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {Construct} */\nexport const lineEnding = {\n name: 'lineEnding',\n tokenize: tokenizeLineEnding\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeLineEnding(effects, ok) {\n return start;\n\n /** @type {State} */\n function start(code) {\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return factorySpace(effects, ok, \"linePrefix\");\n }\n}", "/**\n * @import {\n * Code,\n * Construct,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const thematicBreak = {\n name: 'thematicBreak',\n tokenize: tokenizeThematicBreak\n};\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeThematicBreak(effects, ok, nok) {\n let size = 0;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * Start of thematic break.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter(\"thematicBreak\");\n // To do: parse indent like `markdown-rs`.\n return before(code);\n }\n\n /**\n * After optional whitespace, at marker.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n marker = code;\n return atBreak(code);\n }\n\n /**\n * After something, before something else.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function atBreak(code) {\n if (code === marker) {\n effects.enter(\"thematicBreakSequence\");\n return sequence(code);\n }\n if (size >= 3 && (code === null || markdownLineEnding(code))) {\n effects.exit(\"thematicBreak\");\n return ok(code);\n }\n return nok(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * > | ***\n * ^\n * ```\n *\n * @type {State}\n */\n function sequence(code) {\n if (code === marker) {\n effects.consume(code);\n size++;\n return sequence;\n }\n effects.exit(\"thematicBreakSequence\");\n return markdownSpace(code) ? factorySpace(effects, atBreak, \"whitespace\")(code) : atBreak(code);\n }\n}", "/**\n * @import {\n * Code,\n * Construct,\n * Exiter,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { asciiDigit, markdownSpace } from 'micromark-util-character';\nimport { blankLine } from './blank-line.js';\nimport { thematicBreak } from './thematic-break.js';\n\n/** @type {Construct} */\nexport const list = {\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd,\n name: 'list',\n tokenize: tokenizeListStart\n};\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n partial: true,\n tokenize: tokenizeListItemPrefixWhitespace\n};\n\n/** @type {Construct} */\nconst indentConstruct = {\n partial: true,\n tokenize: tokenizeIndent\n};\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this;\n const tail = self.events[self.events.length - 1];\n let initialSize = tail && tail[1].type === \"linePrefix\" ? tail[2].sliceSerialize(tail[1], true).length : 0;\n let size = 0;\n return start;\n\n /** @type {State} */\n function start(code) {\n const kind = self.containerState.type || (code === 42 || code === 43 || code === 45 ? \"listUnordered\" : \"listOrdered\");\n if (kind === \"listUnordered\" ? !self.containerState.marker || code === self.containerState.marker : asciiDigit(code)) {\n if (!self.containerState.type) {\n self.containerState.type = kind;\n effects.enter(kind, {\n _container: true\n });\n }\n if (kind === \"listUnordered\") {\n effects.enter(\"listItemPrefix\");\n return code === 42 || code === 45 ? effects.check(thematicBreak, nok, atMarker)(code) : atMarker(code);\n }\n if (!self.interrupt || code === 49) {\n effects.enter(\"listItemPrefix\");\n effects.enter(\"listItemValue\");\n return inside(code);\n }\n }\n return nok(code);\n }\n\n /** @type {State} */\n function inside(code) {\n if (asciiDigit(code) && ++size < 10) {\n effects.consume(code);\n return inside;\n }\n if ((!self.interrupt || size < 2) && (self.containerState.marker ? code === self.containerState.marker : code === 41 || code === 46)) {\n effects.exit(\"listItemValue\");\n return atMarker(code);\n }\n return nok(code);\n }\n\n /**\n * @type {State}\n **/\n function atMarker(code) {\n effects.enter(\"listItemMarker\");\n effects.consume(code);\n effects.exit(\"listItemMarker\");\n self.containerState.marker = self.containerState.marker || code;\n return effects.check(blankLine,\n // Can\u2019t be empty when interrupting.\n self.interrupt ? nok : onBlank, effects.attempt(listItemPrefixWhitespaceConstruct, endOfPrefix, otherPrefix));\n }\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.initialBlankLine = true;\n initialSize++;\n return endOfPrefix(code);\n }\n\n /** @type {State} */\n function otherPrefix(code) {\n if (markdownSpace(code)) {\n effects.enter(\"listItemPrefixWhitespace\");\n effects.consume(code);\n effects.exit(\"listItemPrefixWhitespace\");\n return endOfPrefix;\n }\n return nok(code);\n }\n\n /** @type {State} */\n function endOfPrefix(code) {\n self.containerState.size = initialSize + self.sliceSerialize(effects.exit(\"listItemPrefix\"), true).length;\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListContinuation(effects, ok, nok) {\n const self = this;\n self.containerState._closeFlow = undefined;\n return effects.check(blankLine, onBlank, notBlank);\n\n /** @type {State} */\n function onBlank(code) {\n self.containerState.furtherBlankLines = self.containerState.furtherBlankLines || self.containerState.initialBlankLine;\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(effects, ok, \"listItemIndent\", self.containerState.size + 1)(code);\n }\n\n /** @type {State} */\n function notBlank(code) {\n if (self.containerState.furtherBlankLines || !markdownSpace(code)) {\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return notInCurrentItem(code);\n }\n self.containerState.furtherBlankLines = undefined;\n self.containerState.initialBlankLine = undefined;\n return effects.attempt(indentConstruct, ok, notInCurrentItem)(code);\n }\n\n /** @type {State} */\n function notInCurrentItem(code) {\n // While we do continue, we signal that the flow should be closed.\n self.containerState._closeFlow = true;\n // As we\u2019re closing flow, we\u2019re no longer interrupting.\n self.interrupt = undefined;\n // Always populated by defaults.\n\n return factorySpace(effects, effects.attempt(list, ok, nok), \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, \"listItemIndent\", self.containerState.size + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === \"listItemIndent\" && tail[2].sliceSerialize(tail[1], true).length === self.containerState.size ? ok(code) : nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Exiter}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type);\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this;\n\n // Always populated by defaults.\n\n return factorySpace(effects, afterPrefix, \"listItemPrefixWhitespace\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4 + 1);\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return !markdownSpace(code) && tail && tail[1].type === \"listItemPrefixWhitespace\" ? ok(code) : nok(code);\n }\n}", "/**\n * @import {\n * Code,\n * Construct,\n * Resolver,\n * State,\n * TokenizeContext,\n * Tokenizer\n * } from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownSpace } from 'micromark-util-character';\n/** @type {Construct} */\nexport const setextUnderline = {\n name: 'setextUnderline',\n resolveTo: resolveToSetextUnderline,\n tokenize: tokenizeSetextUnderline\n};\n\n/** @type {Resolver} */\nfunction resolveToSetextUnderline(events, context) {\n // To do: resolve like `markdown-rs`.\n let index = events.length;\n /** @type {number | undefined} */\n let content;\n /** @type {number | undefined} */\n let text;\n /** @type {number | undefined} */\n let definition;\n\n // Find the opening of the content.\n // It\u2019ll always exist: we don\u2019t tokenize if it isn\u2019t there.\n while (index--) {\n if (events[index][0] === 'enter') {\n if (events[index][1].type === \"content\") {\n content = index;\n break;\n }\n if (events[index][1].type === \"paragraph\") {\n text = index;\n }\n }\n // Exit\n else {\n if (events[index][1].type === \"content\") {\n // Remove the content end (if needed we\u2019ll add it later)\n events.splice(index, 1);\n }\n if (!definition && events[index][1].type === \"definition\") {\n definition = index;\n }\n }\n }\n const heading = {\n type: \"setextHeading\",\n start: {\n ...events[content][1].start\n },\n end: {\n ...events[events.length - 1][1].end\n }\n };\n\n // Change the paragraph to setext heading text.\n events[text][1].type = \"setextHeadingText\";\n\n // If we have definitions in the content, we\u2019ll keep on having content,\n // but we need move it.\n if (definition) {\n events.splice(text, 0, ['enter', heading, context]);\n events.splice(definition + 1, 0, ['exit', events[content][1], context]);\n events[content][1].end = {\n ...events[definition][1].end\n };\n } else {\n events[content][1] = heading;\n }\n\n // Add the heading exit at the end.\n events.push(['exit', heading, context]);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * Context.\n * @type {Tokenizer}\n */\nfunction tokenizeSetextUnderline(effects, ok, nok) {\n const self = this;\n /** @type {NonNullable} */\n let marker;\n return start;\n\n /**\n * At start of heading (setext) underline.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n let index = self.events.length;\n /** @type {boolean | undefined} */\n let paragraph;\n // Find an opening.\n while (index--) {\n // Skip enter/exit of line ending, line prefix, and content.\n // We can now either have a definition or a paragraph.\n if (self.events[index][1].type !== \"lineEnding\" && self.events[index][1].type !== \"linePrefix\" && self.events[index][1].type !== \"content\") {\n paragraph = self.events[index][1].type === \"paragraph\";\n break;\n }\n }\n\n // To do: handle lazy/pierce like `markdown-rs`.\n // To do: parse indent like `markdown-rs`.\n if (!self.parser.lazy[self.now().line] && (self.interrupt || paragraph)) {\n effects.enter(\"setextHeadingLine\");\n marker = code;\n return before(code);\n }\n return nok(code);\n }\n\n /**\n * After optional whitespace, at `-` or `=`.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function before(code) {\n effects.enter(\"setextHeadingLineSequence\");\n return inside(code);\n }\n\n /**\n * In sequence.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n if (code === marker) {\n effects.consume(code);\n return inside;\n }\n effects.exit(\"setextHeadingLineSequence\");\n return markdownSpace(code) ? factorySpace(effects, after, \"lineSuffix\")(code) : after(code);\n }\n\n /**\n * After sequence, after optional whitespace.\n *\n * ```markdown\n * | aa\n * > | ==\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n if (code === null || markdownLineEnding(code)) {\n effects.exit(\"setextHeadingLine\");\n return ok(code);\n }\n return nok(code);\n }\n}", "/**\n * @import {\n * InitialConstruct,\n * Initializer,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nimport { blankLine, content } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding } from 'micromark-util-character';\n/** @type {InitialConstruct} */\nexport const flow = {\n tokenize: initializeFlow\n};\n\n/**\n * @this {TokenizeContext}\n * Self.\n * @type {Initializer}\n * Initializer.\n */\nfunction initializeFlow(effects) {\n const self = this;\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine, atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(this.parser.constructs.flowInitial, afterConstruct, factorySpace(effects, effects.attempt(this.parser.constructs.flow, afterConstruct, effects.attempt(content, afterConstruct)), \"linePrefix\")));\n return initial;\n\n /** @type {State} */\n function atBlankEnding(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEndingBlank\");\n effects.consume(code);\n effects.exit(\"lineEndingBlank\");\n self.currentConstruct = undefined;\n return initial;\n }\n\n /** @type {State} */\n function afterConstruct(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n self.currentConstruct = undefined;\n return initial;\n }\n}", "/**\n * @import {\n * Code,\n * InitialConstruct,\n * Initializer,\n * Resolver,\n * State,\n * TokenizeContext\n * } from 'micromark-util-types'\n */\n\nexport const resolver = {\n resolveAll: createResolver()\n};\nexport const string = initializeFactory('string');\nexport const text = initializeFactory('text');\n\n/**\n * @param {'string' | 'text'} field\n * Field.\n * @returns {InitialConstruct}\n * Construct.\n */\nfunction initializeFactory(field) {\n return {\n resolveAll: createResolver(field === 'text' ? resolveAllLineSuffixes : undefined),\n tokenize: initializeText\n };\n\n /**\n * @this {TokenizeContext}\n * Context.\n * @type {Initializer}\n */\n function initializeText(effects) {\n const self = this;\n const constructs = this.parser.constructs[field];\n const text = effects.attempt(constructs, start, notText);\n return start;\n\n /** @type {State} */\n function start(code) {\n return atBreak(code) ? text(code) : notText(code);\n }\n\n /** @type {State} */\n function notText(code) {\n if (code === null) {\n effects.consume(code);\n return;\n }\n effects.enter(\"data\");\n effects.consume(code);\n return data;\n }\n\n /** @type {State} */\n function data(code) {\n if (atBreak(code)) {\n effects.exit(\"data\");\n return text(code);\n }\n\n // Data.\n effects.consume(code);\n return data;\n }\n\n /**\n * @param {Code} code\n * Code.\n * @returns {boolean}\n * Whether the code is a break.\n */\n function atBreak(code) {\n if (code === null) {\n return true;\n }\n const list = constructs[code];\n let index = -1;\n if (list) {\n // Always populated by defaults.\n\n while (++index < list.length) {\n const item = list[index];\n if (!item.previous || item.previous.call(self, self.previous)) {\n return true;\n }\n }\n }\n return false;\n }\n }\n}\n\n/**\n * @param {Resolver | undefined} [extraResolver]\n * Resolver.\n * @returns {Resolver}\n * Resolver.\n */\nfunction createResolver(extraResolver) {\n return resolveAllText;\n\n /** @type {Resolver} */\n function resolveAllText(events, context) {\n let index = -1;\n /** @type {number | undefined} */\n let enter;\n\n // A rather boring computation (to merge adjacent `data` events) which\n // improves mm performance by 29%.\n while (++index <= events.length) {\n if (enter === undefined) {\n if (events[index] && events[index][1].type === \"data\") {\n enter = index;\n index++;\n }\n } else if (!events[index] || events[index][1].type !== \"data\") {\n // Don\u2019t do anything if there is one data token.\n if (index !== enter + 2) {\n events[enter][1].end = events[index - 1][1].end;\n events.splice(enter + 2, index - enter - 2);\n index = enter + 2;\n }\n enter = undefined;\n }\n }\n return extraResolver ? extraResolver(events, context) : events;\n }\n}\n\n/**\n * A rather ugly set of instructions which again looks at chunks in the input\n * stream.\n * The reason to do this here is that it is *much* faster to parse in reverse.\n * And that we can\u2019t hook into `null` to split the line suffix before an EOF.\n * To do: figure out if we can make this into a clean utility, or even in core.\n * As it will be useful for GFMs literal autolink extension (and maybe even\n * tables?)\n *\n * @type {Resolver}\n */\nfunction resolveAllLineSuffixes(events, context) {\n let eventIndex = 0; // Skip first.\n\n while (++eventIndex <= events.length) {\n if ((eventIndex === events.length || events[eventIndex][1].type === \"lineEnding\") && events[eventIndex - 1][1].type === \"data\") {\n const data = events[eventIndex - 1][1];\n const chunks = context.sliceStream(data);\n let index = chunks.length;\n let bufferIndex = -1;\n let size = 0;\n /** @type {boolean | undefined} */\n let tabs;\n while (index--) {\n const chunk = chunks[index];\n if (typeof chunk === 'string') {\n bufferIndex = chunk.length;\n while (chunk.charCodeAt(bufferIndex - 1) === 32) {\n size++;\n bufferIndex--;\n }\n if (bufferIndex) break;\n bufferIndex = -1;\n }\n // Number\n else if (chunk === -2) {\n tabs = true;\n size++;\n } else if (chunk === -1) {\n // Empty\n } else {\n // Replacement character, exit.\n index++;\n break;\n }\n }\n\n // Allow final trailing whitespace.\n if (context._contentTypeTextTrailing && eventIndex === events.length) {\n size = 0;\n }\n if (size) {\n const token = {\n type: eventIndex === events.length || tabs || size < 2 ? \"lineSuffix\" : \"hardBreakTrailing\",\n start: {\n _bufferIndex: index ? bufferIndex : data.start._bufferIndex + bufferIndex,\n _index: data.start._index + index,\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size\n },\n end: {\n ...data.end\n }\n };\n data.end = {\n ...token.start\n };\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token);\n } else {\n events.splice(eventIndex, 0, ['enter', token, context], ['exit', token, context]);\n eventIndex += 2;\n }\n }\n eventIndex++;\n }\n }\n return events;\n}", "/**\n * @import {Extension} from 'micromark-util-types'\n */\n\nimport { attention, autolink, blockQuote, characterEscape, characterReference, codeFenced, codeIndented, codeText, definition, hardBreakEscape, headingAtx, htmlFlow, htmlText, labelEnd, labelStartImage, labelStartLink, lineEnding, list, setextUnderline, thematicBreak } from 'micromark-core-commonmark';\nimport { resolver as resolveText } from './initialize/text.js';\n\n/** @satisfies {Extension['document']} */\nexport const document = {\n [42]: list,\n [43]: list,\n [45]: list,\n [48]: list,\n [49]: list,\n [50]: list,\n [51]: list,\n [52]: list,\n [53]: list,\n [54]: list,\n [55]: list,\n [56]: list,\n [57]: list,\n [62]: blockQuote\n};\n\n/** @satisfies {Extension['contentInitial']} */\nexport const contentInitial = {\n [91]: definition\n};\n\n/** @satisfies {Extension['flowInitial']} */\nexport const flowInitial = {\n [-2]: codeIndented,\n [-1]: codeIndented,\n [32]: codeIndented\n};\n\n/** @satisfies {Extension['flow']} */\nexport const flow = {\n [35]: headingAtx,\n [42]: thematicBreak,\n [45]: [setextUnderline, thematicBreak],\n [60]: htmlFlow,\n [61]: setextUnderline,\n [95]: thematicBreak,\n [96]: codeFenced,\n [126]: codeFenced\n};\n\n/** @satisfies {Extension['string']} */\nexport const string = {\n [38]: characterReference,\n [92]: characterEscape\n};\n\n/** @satisfies {Extension['text']} */\nexport const text = {\n [-5]: lineEnding,\n [-4]: lineEnding,\n [-3]: lineEnding,\n [33]: labelStartImage,\n [38]: characterReference,\n [42]: attention,\n [60]: [autolink, htmlText],\n [91]: labelStartLink,\n [92]: [hardBreakEscape, characterEscape],\n [93]: labelEnd,\n [95]: attention,\n [96]: codeText\n};\n\n/** @satisfies {Extension['insideSpan']} */\nexport const insideSpan = {\n null: [attention, resolveText]\n};\n\n/** @satisfies {Extension['attentionMarkers']} */\nexport const attentionMarkers = {\n null: [42, 95]\n};\n\n/** @satisfies {Extension['disable']} */\nexport const disable = {\n null: []\n};", "/**\n * @import {\n * Chunk,\n * Code,\n * ConstructRecord,\n * Construct,\n * Effects,\n * InitialConstruct,\n * ParseContext,\n * Point,\n * State,\n * TokenizeContext,\n * Token\n * } from 'micromark-util-types'\n */\n\n/**\n * @callback Restore\n * Restore the state.\n * @returns {undefined}\n * Nothing.\n *\n * @typedef Info\n * Info.\n * @property {Restore} restore\n * Restore.\n * @property {number} from\n * From.\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * Construct.\n * @param {Info} info\n * Info.\n * @returns {undefined}\n * Nothing.\n */\n\nimport { markdownLineEnding } from 'micromark-util-character';\nimport { push, splice } from 'micromark-util-chunked';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create a tokenizer.\n * Tokenizers deal with one type of data (e.g., containers, flow, text).\n * The parser is the object dealing with it all.\n * `initialize` works like other constructs, except that only its `tokenize`\n * function is used, in which case it doesn\u2019t receive an `ok` or `nok`.\n * `from` can be given to set the point before the first character, although\n * when further lines are indented, they must be set with `defineSkip`.\n *\n * @param {ParseContext} parser\n * Parser.\n * @param {InitialConstruct} initialize\n * Construct.\n * @param {Omit | undefined} [from]\n * Point (optional).\n * @returns {TokenizeContext}\n * Context.\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = {\n _bufferIndex: -1,\n _index: 0,\n line: from && from.line || 1,\n column: from && from.column || 1,\n offset: from && from.offset || 0\n };\n /** @type {Record} */\n const columnStart = {};\n /** @type {Array} */\n const resolveAllConstructs = [];\n /** @type {Array} */\n let chunks = [];\n /** @type {Array} */\n let stack = [];\n /** @type {boolean | undefined} */\n let consumed = true;\n\n /**\n * Tools used for tokenizing.\n *\n * @type {Effects}\n */\n const effects = {\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\n consume,\n enter,\n exit,\n interrupt: constructFactory(onsuccessfulcheck, {\n interrupt: true\n })\n };\n\n /**\n * State and tools for resolving and serializing.\n *\n * @type {TokenizeContext}\n */\n const context = {\n code: null,\n containerState: {},\n defineSkip,\n events: [],\n now,\n parser,\n previous: null,\n sliceSerialize,\n sliceStream,\n write\n };\n\n /**\n * The state function.\n *\n * @type {State | undefined}\n */\n let state = initialize.tokenize.call(context, effects);\n\n /**\n * Track which character we expect to be consumed, to catch bugs.\n *\n * @type {Code}\n */\n let expectedCode;\n if (initialize.resolveAll) {\n resolveAllConstructs.push(initialize);\n }\n return context;\n\n /** @type {TokenizeContext['write']} */\n function write(slice) {\n chunks = push(chunks, slice);\n main();\n\n // Exit if we\u2019re not done, resolve might change stuff.\n if (chunks[chunks.length - 1] !== null) {\n return [];\n }\n addResult(initialize, 0);\n\n // Otherwise, resolve, and exit.\n context.events = resolveAll(resolveAllConstructs, context.events, context);\n return context.events;\n }\n\n //\n // Tools.\n //\n\n /** @type {TokenizeContext['sliceSerialize']} */\n function sliceSerialize(token, expandTabs) {\n return serializeChunks(sliceStream(token), expandTabs);\n }\n\n /** @type {TokenizeContext['sliceStream']} */\n function sliceStream(token) {\n return sliceChunks(chunks, token);\n }\n\n /** @type {TokenizeContext['now']} */\n function now() {\n // This is a hot path, so we clone manually instead of `Object.assign({}, point)`\n const {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n } = point;\n return {\n _bufferIndex,\n _index,\n line,\n column,\n offset\n };\n }\n\n /** @type {TokenizeContext['defineSkip']} */\n function defineSkip(value) {\n columnStart[value.line] = value.column;\n accountForPotentialSkip();\n }\n\n //\n // State management.\n //\n\n /**\n * Main loop (note that `_index` and `_bufferIndex` in `point` are modified by\n * `consume`).\n * Here is where we walk through the chunks, which either include strings of\n * several characters, or numerical character codes.\n * The reason to do this in a loop instead of a call is so the stack can\n * drain.\n *\n * @returns {undefined}\n * Nothing.\n */\n function main() {\n /** @type {number} */\n let chunkIndex;\n while (point._index < chunks.length) {\n const chunk = chunks[point._index];\n\n // If we\u2019re in a buffer chunk, loop through it.\n if (typeof chunk === 'string') {\n chunkIndex = point._index;\n if (point._bufferIndex < 0) {\n point._bufferIndex = 0;\n }\n while (point._index === chunkIndex && point._bufferIndex < chunk.length) {\n go(chunk.charCodeAt(point._bufferIndex));\n }\n } else {\n go(chunk);\n }\n }\n }\n\n /**\n * Deal with one code.\n *\n * @param {Code} code\n * Code.\n * @returns {undefined}\n * Nothing.\n */\n function go(code) {\n consumed = undefined;\n expectedCode = code;\n state = state(code);\n }\n\n /** @type {Effects['consume']} */\n function consume(code) {\n if (markdownLineEnding(code)) {\n point.line++;\n point.column = 1;\n point.offset += code === -3 ? 2 : 1;\n accountForPotentialSkip();\n } else if (code !== -1) {\n point.column++;\n point.offset++;\n }\n\n // Not in a string chunk.\n if (point._bufferIndex < 0) {\n point._index++;\n } else {\n point._bufferIndex++;\n\n // At end of string chunk.\n if (point._bufferIndex ===\n // Points w/ non-negative `_bufferIndex` reference\n // strings.\n /** @type {string} */\n chunks[point._index].length) {\n point._bufferIndex = -1;\n point._index++;\n }\n }\n\n // Expose the previous character.\n context.previous = code;\n\n // Mark as consumed.\n consumed = true;\n }\n\n /** @type {Effects['enter']} */\n function enter(type, fields) {\n /** @type {Token} */\n // @ts-expect-error Patch instead of assign required fields to help GC.\n const token = fields || {};\n token.type = type;\n token.start = now();\n context.events.push(['enter', token, context]);\n stack.push(token);\n return token;\n }\n\n /** @type {Effects['exit']} */\n function exit(type) {\n const token = stack.pop();\n token.end = now();\n context.events.push(['exit', token, context]);\n return token;\n }\n\n /**\n * Use results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulconstruct(construct, info) {\n addResult(construct, info.from);\n }\n\n /**\n * Discard results.\n *\n * @type {ReturnHandle}\n */\n function onsuccessfulcheck(_, info) {\n info.restore();\n }\n\n /**\n * Factory to attempt/check/interrupt.\n *\n * @param {ReturnHandle} onreturn\n * Callback.\n * @param {{interrupt?: boolean | undefined} | undefined} [fields]\n * Fields.\n */\n function constructFactory(onreturn, fields) {\n return hook;\n\n /**\n * Handle either an object mapping codes to constructs, a list of\n * constructs, or a single construct.\n *\n * @param {Array | ConstructRecord | Construct} constructs\n * Constructs.\n * @param {State} returnState\n * State.\n * @param {State | undefined} [bogusState]\n * State.\n * @returns {State}\n * State.\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {ReadonlyArray} */\n let listOfConstructs;\n /** @type {number} */\n let constructIndex;\n /** @type {Construct} */\n let currentConstruct;\n /** @type {Info} */\n let info;\n return Array.isArray(constructs) ? /* c8 ignore next 1 */\n handleListOfConstructs(constructs) : 'tokenize' in constructs ?\n // Looks like a construct.\n handleListOfConstructs([(/** @type {Construct} */constructs)]) : handleMapOfConstructs(constructs);\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleMapOfConstructs(map) {\n return start;\n\n /** @type {State} */\n function start(code) {\n const left = code !== null && map[code];\n const all = code !== null && map.null;\n const list = [\n // To do: add more extension tests.\n /* c8 ignore next 2 */\n ...(Array.isArray(left) ? left : left ? [left] : []), ...(Array.isArray(all) ? all : all ? [all] : [])];\n return handleListOfConstructs(list)(code);\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {ReadonlyArray} list\n * Constructs.\n * @returns {State}\n * State.\n */\n function handleListOfConstructs(list) {\n listOfConstructs = list;\n constructIndex = 0;\n if (list.length === 0) {\n return bogusState;\n }\n return handleConstruct(list[constructIndex]);\n }\n\n /**\n * Handle a single construct.\n *\n * @param {Construct} construct\n * Construct.\n * @returns {State}\n * State.\n */\n function handleConstruct(construct) {\n return start;\n\n /** @type {State} */\n function start(code) {\n // To do: not needed to store if there is no bogus state, probably?\n // Currently doesn\u2019t work because `inspect` in document does a check\n // w/o a bogus, which doesn\u2019t make sense. But it does seem to help perf\n // by not storing.\n info = store();\n currentConstruct = construct;\n if (!construct.partial) {\n context.currentConstruct = construct;\n }\n\n // Always populated by defaults.\n\n if (construct.name && context.parser.constructs.disable.null.includes(construct.name)) {\n return nok(code);\n }\n return construct.tokenize.call(\n // If we do have fields, create an object w/ `context` as its\n // prototype.\n // This allows a \u201Clive binding\u201D, which is needed for `interrupt`.\n fields ? Object.assign(Object.create(context), fields) : context, effects, ok, nok)(code);\n }\n }\n\n /** @type {State} */\n function ok(code) {\n consumed = true;\n onreturn(currentConstruct, info);\n return returnState;\n }\n\n /** @type {State} */\n function nok(code) {\n consumed = true;\n info.restore();\n if (++constructIndex < listOfConstructs.length) {\n return handleConstruct(listOfConstructs[constructIndex]);\n }\n return bogusState;\n }\n }\n }\n\n /**\n * @param {Construct} construct\n * Construct.\n * @param {number} from\n * From.\n * @returns {undefined}\n * Nothing.\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct);\n }\n if (construct.resolve) {\n splice(context.events, from, context.events.length - from, construct.resolve(context.events.slice(from), context));\n }\n if (construct.resolveTo) {\n context.events = construct.resolveTo(context.events, context);\n }\n }\n\n /**\n * Store state.\n *\n * @returns {Info}\n * Info.\n */\n function store() {\n const startPoint = now();\n const startPrevious = context.previous;\n const startCurrentConstruct = context.currentConstruct;\n const startEventsIndex = context.events.length;\n const startStack = Array.from(stack);\n return {\n from: startEventsIndex,\n restore\n };\n\n /**\n * Restore state.\n *\n * @returns {undefined}\n * Nothing.\n */\n function restore() {\n point = startPoint;\n context.previous = startPrevious;\n context.currentConstruct = startCurrentConstruct;\n context.events.length = startEventsIndex;\n stack = startStack;\n accountForPotentialSkip();\n }\n }\n\n /**\n * Move the current point a bit forward in the line when it\u2019s on a column\n * skip.\n *\n * @returns {undefined}\n * Nothing.\n */\n function accountForPotentialSkip() {\n if (point.line in columnStart && point.column < 2) {\n point.column = columnStart[point.line];\n point.offset += columnStart[point.line] - 1;\n }\n }\n}\n\n/**\n * Get the chunks from a slice of chunks in the range of a token.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {Pick} token\n * Token.\n * @returns {Array}\n * Chunks.\n */\nfunction sliceChunks(chunks, token) {\n const startIndex = token.start._index;\n const startBufferIndex = token.start._bufferIndex;\n const endIndex = token.end._index;\n const endBufferIndex = token.end._bufferIndex;\n /** @type {Array} */\n let view;\n if (startIndex === endIndex) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view = [chunks[startIndex].slice(startBufferIndex, endBufferIndex)];\n } else {\n view = chunks.slice(startIndex, endIndex);\n if (startBufferIndex > -1) {\n const head = view[0];\n if (typeof head === 'string') {\n view[0] = head.slice(startBufferIndex);\n /* c8 ignore next 4 -- used to be used, no longer */\n } else {\n view.shift();\n }\n }\n if (endBufferIndex > 0) {\n // @ts-expect-error `_bufferIndex` is used on string chunks.\n view.push(chunks[endIndex].slice(0, endBufferIndex));\n }\n }\n return view;\n}\n\n/**\n * Get the string value of a slice of chunks.\n *\n * @param {ReadonlyArray} chunks\n * Chunks.\n * @param {boolean | undefined} [expandTabs=false]\n * Whether to expand tabs (default: `false`).\n * @returns {string}\n * Result.\n */\nfunction serializeChunks(chunks, expandTabs) {\n let index = -1;\n /** @type {Array} */\n const result = [];\n /** @type {boolean | undefined} */\n let atTab;\n while (++index < chunks.length) {\n const chunk = chunks[index];\n /** @type {string} */\n let value;\n if (typeof chunk === 'string') {\n value = chunk;\n } else switch (chunk) {\n case -5:\n {\n value = \"\\r\";\n break;\n }\n case -4:\n {\n value = \"\\n\";\n break;\n }\n case -3:\n {\n value = \"\\r\" + \"\\n\";\n break;\n }\n case -2:\n {\n value = expandTabs ? \" \" : \"\\t\";\n break;\n }\n case -1:\n {\n if (!expandTabs && atTab) continue;\n value = \" \";\n break;\n }\n default:\n {\n // Currently only replacement character.\n value = String.fromCharCode(chunk);\n }\n }\n atTab = chunk === -2;\n result.push(value);\n }\n return result.join('');\n}", "/**\n * @import {\n * Create,\n * FullNormalizedExtension,\n * InitialConstruct,\n * ParseContext,\n * ParseOptions\n * } from 'micromark-util-types'\n */\n\nimport { combineExtensions } from 'micromark-util-combine-extensions';\nimport { content } from './initialize/content.js';\nimport { document } from './initialize/document.js';\nimport { flow } from './initialize/flow.js';\nimport { string, text } from './initialize/text.js';\nimport * as defaultConstructs from './constructs.js';\nimport { createTokenizer } from './create-tokenizer.js';\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ParseContext}\n * Parser.\n */\nexport function parse(options) {\n const settings = options || {};\n const constructs = /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])]);\n\n /** @type {ParseContext} */\n const parser = {\n constructs,\n content: create(content),\n defined: [],\n document: create(document),\n flow: create(flow),\n lazy: {},\n string: create(string),\n text: create(text)\n };\n return parser;\n\n /**\n * @param {InitialConstruct} initial\n * Construct to start with.\n * @returns {Create}\n * Create a tokenizer.\n */\n function create(initial) {\n return creator;\n /** @type {Create} */\n function creator(from) {\n return createTokenizer(parser, initial, from);\n }\n }\n}", "/**\n * @import {Event} from 'micromark-util-types'\n */\n\nimport { subtokenize } from 'micromark-util-subtokenize';\n\n/**\n * @param {Array} events\n * Events.\n * @returns {Array}\n * Events.\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events;\n}", "/**\n * @import {Chunk, Code, Encoding, Value} from 'micromark-util-types'\n */\n\n/**\n * @callback Preprocessor\n * Preprocess a value.\n * @param {Value} value\n * Value.\n * @param {Encoding | null | undefined} [encoding]\n * Encoding when `value` is a typed array (optional).\n * @param {boolean | null | undefined} [end=false]\n * Whether this is the last chunk (default: `false`).\n * @returns {Array}\n * Chunks.\n */\n\nconst search = /[\\0\\t\\n\\r]/g;\n\n/**\n * @returns {Preprocessor}\n * Preprocess a value.\n */\nexport function preprocess() {\n let column = 1;\n let buffer = '';\n /** @type {boolean | undefined} */\n let start = true;\n /** @type {boolean | undefined} */\n let atCarriageReturn;\n return preprocessor;\n\n /** @type {Preprocessor} */\n // eslint-disable-next-line complexity\n function preprocessor(value, encoding, end) {\n /** @type {Array} */\n const chunks = [];\n /** @type {RegExpMatchArray | null} */\n let match;\n /** @type {number} */\n let next;\n /** @type {number} */\n let startPosition;\n /** @type {number} */\n let endPosition;\n /** @type {Code} */\n let code;\n value = buffer + (typeof value === 'string' ? value.toString() : new TextDecoder(encoding || undefined).decode(value));\n startPosition = 0;\n buffer = '';\n if (start) {\n // To do: `markdown-rs` actually parses BOMs (byte order mark).\n if (value.charCodeAt(0) === 65279) {\n startPosition++;\n }\n start = undefined;\n }\n while (startPosition < value.length) {\n search.lastIndex = startPosition;\n match = search.exec(value);\n endPosition = match && match.index !== undefined ? match.index : value.length;\n code = value.charCodeAt(endPosition);\n if (!match) {\n buffer = value.slice(startPosition);\n break;\n }\n if (code === 10 && startPosition === endPosition && atCarriageReturn) {\n chunks.push(-3);\n atCarriageReturn = undefined;\n } else {\n if (atCarriageReturn) {\n chunks.push(-5);\n atCarriageReturn = undefined;\n }\n if (startPosition < endPosition) {\n chunks.push(value.slice(startPosition, endPosition));\n column += endPosition - startPosition;\n }\n switch (code) {\n case 0:\n {\n chunks.push(65533);\n column++;\n break;\n }\n case 9:\n {\n next = Math.ceil(column / 4) * 4;\n chunks.push(-2);\n while (column++ < next) chunks.push(-1);\n break;\n }\n case 10:\n {\n chunks.push(-4);\n column = 1;\n break;\n }\n default:\n {\n atCarriageReturn = true;\n column = 1;\n }\n }\n }\n startPosition = endPosition + 1;\n }\n if (end) {\n if (atCarriageReturn) chunks.push(-5);\n if (buffer) chunks.push(buffer);\n chunks.push(null);\n }\n return chunks;\n }\n}", "import { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nconst characterEscapeOrReference = /\\\\([!-/:-@[-`{-~])|&(#(?:\\d{1,7}|x[\\da-f]{1,6})|[\\da-z]{1,31});/gi;\n\n/**\n * Decode markdown strings (which occur in places such as fenced code info\n * strings, destinations, labels, and titles).\n *\n * The \u201Cstring\u201D content type allows character escapes and -references.\n * This decodes those.\n *\n * @param {string} value\n * Value to decode.\n * @returns {string}\n * Decoded value.\n */\nexport function decodeString(value) {\n return value.replace(characterEscapeOrReference, decode);\n}\n\n/**\n * @param {string} $0\n * Match.\n * @param {string} $1\n * Character escape.\n * @param {string} $2\n * Character reference.\n * @returns {string}\n * Decoded value\n */\nfunction decode($0, $1, $2) {\n if ($1) {\n // Escape.\n return $1;\n }\n\n // Reference.\n const head = $2.charCodeAt(0);\n if (head === 35) {\n const head = $2.charCodeAt(1);\n const hex = head === 120 || head === 88;\n return decodeNumericCharacterReference($2.slice(hex ? 2 : 1), hex ? 16 : 10);\n }\n return decodeNamedCharacterReference($2) || $0;\n}", "/**\n * @import {\n * Break,\n * Blockquote,\n * Code,\n * Definition,\n * Emphasis,\n * Heading,\n * Html,\n * Image,\n * InlineCode,\n * Link,\n * ListItem,\n * List,\n * Nodes,\n * Paragraph,\n * PhrasingContent,\n * ReferenceType,\n * Root,\n * Strong,\n * Text,\n * ThematicBreak\n * } from 'mdast'\n * @import {\n * Encoding,\n * Event,\n * Token,\n * Value\n * } from 'micromark-util-types'\n * @import {Point} from 'unist'\n * @import {\n * CompileContext,\n * CompileData,\n * Config,\n * Extension,\n * Handle,\n * OnEnterError,\n * Options\n * } from './types.js'\n */\n\nimport { toString } from 'mdast-util-to-string';\nimport { parse, postprocess, preprocess } from 'micromark';\nimport { decodeNumericCharacterReference } from 'micromark-util-decode-numeric-character-reference';\nimport { decodeString } from 'micromark-util-decode-string';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nimport { decodeNamedCharacterReference } from 'decode-named-character-reference';\nimport { stringifyPosition } from 'unist-util-stringify-position';\nconst own = {}.hasOwnProperty;\n\n/**\n * Turn markdown into a syntax tree.\n *\n * @overload\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @overload\n * @param {Value} value\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n *\n * @param {Value} value\n * Markdown to parse.\n * @param {Encoding | Options | null | undefined} [encoding]\n * Character encoding for when `value` is `Buffer`.\n * @param {Options | null | undefined} [options]\n * Configuration.\n * @returns {Root}\n * mdast tree.\n */\nexport function fromMarkdown(value, encoding, options) {\n if (encoding && typeof encoding === 'object') {\n options = encoding;\n encoding = undefined;\n }\n return compiler(options)(postprocess(parse(options).document().write(preprocess()(value, encoding, true))));\n}\n\n/**\n * Note this compiler only understand complete buffering, not streaming.\n *\n * @param {Options | null | undefined} [options]\n */\nfunction compiler(options) {\n /** @type {Config} */\n const config = {\n transforms: [],\n canContainEols: ['emphasis', 'fragment', 'heading', 'paragraph', 'strong'],\n enter: {\n autolink: opener(link),\n autolinkProtocol: onenterdata,\n autolinkEmail: onenterdata,\n atxHeading: opener(heading),\n blockQuote: opener(blockQuote),\n characterEscape: onenterdata,\n characterReference: onenterdata,\n codeFenced: opener(codeFlow),\n codeFencedFenceInfo: buffer,\n codeFencedFenceMeta: buffer,\n codeIndented: opener(codeFlow, buffer),\n codeText: opener(codeText, buffer),\n codeTextData: onenterdata,\n data: onenterdata,\n codeFlowValue: onenterdata,\n definition: opener(definition),\n definitionDestinationString: buffer,\n definitionLabelString: buffer,\n definitionTitleString: buffer,\n emphasis: opener(emphasis),\n hardBreakEscape: opener(hardBreak),\n hardBreakTrailing: opener(hardBreak),\n htmlFlow: opener(html, buffer),\n htmlFlowData: onenterdata,\n htmlText: opener(html, buffer),\n htmlTextData: onenterdata,\n image: opener(image),\n label: buffer,\n link: opener(link),\n listItem: opener(listItem),\n listItemValue: onenterlistitemvalue,\n listOrdered: opener(list, onenterlistordered),\n listUnordered: opener(list),\n paragraph: opener(paragraph),\n reference: onenterreference,\n referenceString: buffer,\n resourceDestinationString: buffer,\n resourceTitleString: buffer,\n setextHeading: opener(heading),\n strong: opener(strong),\n thematicBreak: opener(thematicBreak)\n },\n exit: {\n atxHeading: closer(),\n atxHeadingSequence: onexitatxheadingsequence,\n autolink: closer(),\n autolinkEmail: onexitautolinkemail,\n autolinkProtocol: onexitautolinkprotocol,\n blockQuote: closer(),\n characterEscapeValue: onexitdata,\n characterReferenceMarkerHexadecimal: onexitcharacterreferencemarker,\n characterReferenceMarkerNumeric: onexitcharacterreferencemarker,\n characterReferenceValue: onexitcharacterreferencevalue,\n characterReference: onexitcharacterreference,\n codeFenced: closer(onexitcodefenced),\n codeFencedFence: onexitcodefencedfence,\n codeFencedFenceInfo: onexitcodefencedfenceinfo,\n codeFencedFenceMeta: onexitcodefencedfencemeta,\n codeFlowValue: onexitdata,\n codeIndented: closer(onexitcodeindented),\n codeText: closer(onexitcodetext),\n codeTextData: onexitdata,\n data: onexitdata,\n definition: closer(),\n definitionDestinationString: onexitdefinitiondestinationstring,\n definitionLabelString: onexitdefinitionlabelstring,\n definitionTitleString: onexitdefinitiontitlestring,\n emphasis: closer(),\n hardBreakEscape: closer(onexithardbreak),\n hardBreakTrailing: closer(onexithardbreak),\n htmlFlow: closer(onexithtmlflow),\n htmlFlowData: onexitdata,\n htmlText: closer(onexithtmltext),\n htmlTextData: onexitdata,\n image: closer(onexitimage),\n label: onexitlabel,\n labelText: onexitlabeltext,\n lineEnding: onexitlineending,\n link: closer(onexitlink),\n listItem: closer(),\n listOrdered: closer(),\n listUnordered: closer(),\n paragraph: closer(),\n referenceString: onexitreferencestring,\n resourceDestinationString: onexitresourcedestinationstring,\n resourceTitleString: onexitresourcetitlestring,\n resource: onexitresource,\n setextHeading: closer(onexitsetextheading),\n setextHeadingLineSequence: onexitsetextheadinglinesequence,\n setextHeadingText: onexitsetextheadingtext,\n strong: closer(),\n thematicBreak: closer()\n }\n };\n configure(config, (options || {}).mdastExtensions || []);\n\n /** @type {CompileData} */\n const data = {};\n return compile;\n\n /**\n * Turn micromark events into an mdast tree.\n *\n * @param {Array} events\n * Events.\n * @returns {Root}\n * mdast tree.\n */\n function compile(events) {\n /** @type {Root} */\n let tree = {\n type: 'root',\n children: []\n };\n /** @type {Omit} */\n const context = {\n stack: [tree],\n tokenStack: [],\n config,\n enter,\n exit,\n buffer,\n resume,\n data\n };\n /** @type {Array} */\n const listStack = [];\n let index = -1;\n while (++index < events.length) {\n // We preprocess lists to add `listItem` tokens, and to infer whether\n // items the list itself are spread out.\n if (events[index][1].type === \"listOrdered\" || events[index][1].type === \"listUnordered\") {\n if (events[index][0] === 'enter') {\n listStack.push(index);\n } else {\n const tail = listStack.pop();\n index = prepareList(events, tail, index);\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n const handler = config[events[index][0]];\n if (own.call(handler, events[index][1].type)) {\n handler[events[index][1].type].call(Object.assign({\n sliceSerialize: events[index][2].sliceSerialize\n }, context), events[index][1]);\n }\n }\n\n // Handle tokens still being open.\n if (context.tokenStack.length > 0) {\n const tail = context.tokenStack[context.tokenStack.length - 1];\n const handler = tail[1] || defaultOnError;\n handler.call(context, undefined, tail[0]);\n }\n\n // Figure out `root` position.\n tree.position = {\n start: point(events.length > 0 ? events[0][1].start : {\n line: 1,\n column: 1,\n offset: 0\n }),\n end: point(events.length > 0 ? events[events.length - 2][1].end : {\n line: 1,\n column: 1,\n offset: 0\n })\n };\n\n // Call transforms.\n index = -1;\n while (++index < config.transforms.length) {\n tree = config.transforms[index](tree) || tree;\n }\n return tree;\n }\n\n /**\n * @param {Array} events\n * @param {number} start\n * @param {number} length\n * @returns {number}\n */\n function prepareList(events, start, length) {\n let index = start - 1;\n let containerBalance = -1;\n let listSpread = false;\n /** @type {Token | undefined} */\n let listItem;\n /** @type {number | undefined} */\n let lineIndex;\n /** @type {number | undefined} */\n let firstBlankLineIndex;\n /** @type {boolean | undefined} */\n let atMarker;\n while (++index <= length) {\n const event = events[index];\n switch (event[1].type) {\n case \"listUnordered\":\n case \"listOrdered\":\n case \"blockQuote\":\n {\n if (event[0] === 'enter') {\n containerBalance++;\n } else {\n containerBalance--;\n }\n atMarker = undefined;\n break;\n }\n case \"lineEndingBlank\":\n {\n if (event[0] === 'enter') {\n if (listItem && !atMarker && !containerBalance && !firstBlankLineIndex) {\n firstBlankLineIndex = index;\n }\n atMarker = undefined;\n }\n break;\n }\n case \"linePrefix\":\n case \"listItemValue\":\n case \"listItemMarker\":\n case \"listItemPrefix\":\n case \"listItemPrefixWhitespace\":\n {\n // Empty.\n\n break;\n }\n default:\n {\n atMarker = undefined;\n }\n }\n if (!containerBalance && event[0] === 'enter' && event[1].type === \"listItemPrefix\" || containerBalance === -1 && event[0] === 'exit' && (event[1].type === \"listUnordered\" || event[1].type === \"listOrdered\")) {\n if (listItem) {\n let tailIndex = index;\n lineIndex = undefined;\n while (tailIndex--) {\n const tailEvent = events[tailIndex];\n if (tailEvent[1].type === \"lineEnding\" || tailEvent[1].type === \"lineEndingBlank\") {\n if (tailEvent[0] === 'exit') continue;\n if (lineIndex) {\n events[lineIndex][1].type = \"lineEndingBlank\";\n listSpread = true;\n }\n tailEvent[1].type = \"lineEnding\";\n lineIndex = tailIndex;\n } else if (tailEvent[1].type === \"linePrefix\" || tailEvent[1].type === \"blockQuotePrefix\" || tailEvent[1].type === \"blockQuotePrefixWhitespace\" || tailEvent[1].type === \"blockQuoteMarker\" || tailEvent[1].type === \"listItemIndent\") {\n // Empty\n } else {\n break;\n }\n }\n if (firstBlankLineIndex && (!lineIndex || firstBlankLineIndex < lineIndex)) {\n listItem._spread = true;\n }\n\n // Fix position.\n listItem.end = Object.assign({}, lineIndex ? events[lineIndex][1].start : event[1].end);\n events.splice(lineIndex || index, 0, ['exit', listItem, event[2]]);\n index++;\n length++;\n }\n\n // Create a new list item.\n if (event[1].type === \"listItemPrefix\") {\n /** @type {Token} */\n const item = {\n type: 'listItem',\n _spread: false,\n start: Object.assign({}, event[1].start),\n // @ts-expect-error: we\u2019ll add `end` in a second.\n end: undefined\n };\n listItem = item;\n events.splice(index, 0, ['enter', item, event[2]]);\n index++;\n length++;\n firstBlankLineIndex = undefined;\n atMarker = true;\n }\n }\n }\n events[start][1]._spread = listSpread;\n return length;\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Nodes} create\n * Create a node.\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function opener(create, and) {\n return open;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function open(token) {\n enter.call(this, create(token), token);\n if (and) and.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['buffer']}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n });\n }\n\n /**\n * @type {CompileContext['enter']}\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = parent.children;\n siblings.push(node);\n this.stack.push(node);\n this.tokenStack.push([token, errorHandler || undefined]);\n node.position = {\n start: point(token.start),\n // @ts-expect-error: `end` will be patched later.\n end: undefined\n };\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle | undefined} [and]\n * Optional function to also run.\n * @returns {Handle}\n * Handle.\n */\n function closer(and) {\n return close;\n\n /**\n * @this {CompileContext}\n * @param {Token} token\n * @returns {undefined}\n */\n function close(token) {\n if (and) and.call(this, token);\n exit.call(this, token);\n }\n }\n\n /**\n * @type {CompileContext['exit']}\n */\n function exit(token, onExitError) {\n const node = this.stack.pop();\n const open = this.tokenStack.pop();\n if (!open) {\n throw new Error('Cannot close `' + token.type + '` (' + stringifyPosition({\n start: token.start,\n end: token.end\n }) + '): it\u2019s not open');\n } else if (open[0].type !== token.type) {\n if (onExitError) {\n onExitError.call(this, token, open[0]);\n } else {\n const handler = open[1] || defaultOnError;\n handler.call(this, token, open[0]);\n }\n }\n node.position.end = point(token.end);\n }\n\n /**\n * @type {CompileContext['resume']}\n */\n function resume() {\n return toString(this.stack.pop());\n }\n\n //\n // Handlers.\n //\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistordered() {\n this.data.expectingFirstListItemValue = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (this.data.expectingFirstListItemValue) {\n const ancestor = this.stack[this.stack.length - 2];\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10);\n this.data.expectingFirstListItemValue = undefined;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfenceinfo() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.lang = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfencemeta() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.meta = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefencedfence() {\n // Exit if this is the closing fence.\n if (this.data.flowCodeInside) return;\n this.buffer();\n this.data.flowCodeInside = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodefenced() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/^(\\r?\\n|\\r)|(\\r?\\n|\\r)$/g, '');\n this.data.flowCodeInside = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcodeindented() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data.replace(/(\\r?\\n|\\r)$/g, '');\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitionlabelstring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.label = label;\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiontitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitdefinitiondestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitatxheadingsequence(token) {\n const node = this.stack[this.stack.length - 1];\n if (!node.depth) {\n const depth = this.sliceSerialize(token).length;\n node.depth = depth;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadingtext() {\n this.data.setextHeadingSlurpLineEnding = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheadinglinesequence(token) {\n const node = this.stack[this.stack.length - 1];\n node.depth = this.sliceSerialize(token).codePointAt(0) === 61 ? 1 : 2;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n this.data.setextHeadingSlurpLineEnding = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterdata(token) {\n const node = this.stack[this.stack.length - 1];\n /** @type {Array} */\n const siblings = node.children;\n let tail = siblings[siblings.length - 1];\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text();\n tail.position = {\n start: point(token.start),\n // @ts-expect-error: we\u2019ll add `end` later.\n end: undefined\n };\n siblings.push(tail);\n }\n this.stack.push(tail);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitdata(token) {\n const tail = this.stack.pop();\n tail.value += this.sliceSerialize(token);\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlineending(token) {\n const context = this.stack[this.stack.length - 1];\n // If we\u2019re at a hard break, include the line ending in there.\n if (this.data.atHardBreak) {\n const tail = context.children[context.children.length - 1];\n tail.position.end = point(token.end);\n this.data.atHardBreak = undefined;\n return;\n }\n if (!this.data.setextHeadingSlurpLineEnding && config.canContainEols.includes(context.type)) {\n onenterdata.call(this, token);\n onexitdata.call(this, token);\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithardbreak() {\n this.data.atHardBreak = true;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmlflow() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexithtmltext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcodetext() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.value = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlink() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitimage() {\n const node = this.stack[this.stack.length - 1];\n // Note: there are also `identifier` and `label` fields on this link node!\n // These are used / cleaned here.\n\n // To do: clean.\n if (this.data.inReference) {\n /** @type {ReferenceType} */\n const referenceType = this.data.referenceType || 'shortcut';\n node.type += 'Reference';\n // @ts-expect-error: mutate.\n node.referenceType = referenceType;\n // @ts-expect-error: mutate.\n delete node.url;\n delete node.title;\n } else {\n // @ts-expect-error: mutate.\n delete node.identifier;\n // @ts-expect-error: mutate.\n delete node.label;\n }\n this.data.referenceType = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabeltext(token) {\n const string = this.sliceSerialize(token);\n const ancestor = this.stack[this.stack.length - 2];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n ancestor.label = decodeString(string);\n // @ts-expect-error: same as above.\n ancestor.identifier = normalizeIdentifier(string).toLowerCase();\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitlabel() {\n const fragment = this.stack[this.stack.length - 1];\n const value = this.resume();\n const node = this.stack[this.stack.length - 1];\n // Assume a reference.\n this.data.inReference = true;\n if (node.type === 'link') {\n /** @type {Array} */\n const children = fragment.children;\n node.children = children;\n } else {\n node.alt = value;\n }\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcedestinationstring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.url = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresourcetitlestring() {\n const data = this.resume();\n const node = this.stack[this.stack.length - 1];\n node.title = data;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitresource() {\n this.data.inReference = undefined;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n this.data.referenceType = 'collapsed';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitreferencestring(token) {\n const label = this.resume();\n const node = this.stack[this.stack.length - 1];\n // @ts-expect-error: stash this on the node, as it might become a reference\n // later.\n node.label = label;\n // @ts-expect-error: same as above.\n node.identifier = normalizeIdentifier(this.sliceSerialize(token)).toLowerCase();\n this.data.referenceType = 'full';\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n this.data.characterReferenceType = token.type;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreferencevalue(token) {\n const data = this.sliceSerialize(token);\n const type = this.data.characterReferenceType;\n /** @type {string} */\n let value;\n if (type) {\n value = decodeNumericCharacterReference(data, type === \"characterReferenceMarkerNumeric\" ? 10 : 16);\n this.data.characterReferenceType = undefined;\n } else {\n const result = decodeNamedCharacterReference(data);\n value = result;\n }\n const tail = this.stack[this.stack.length - 1];\n tail.value += value;\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitcharacterreference(token) {\n const tail = this.stack.pop();\n tail.position.end = point(token.end);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkprotocol(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = this.sliceSerialize(token);\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitautolinkemail(token) {\n onexitdata.call(this, token);\n const node = this.stack[this.stack.length - 1];\n node.url = 'mailto:' + this.sliceSerialize(token);\n }\n\n //\n // Creaters.\n //\n\n /** @returns {Blockquote} */\n function blockQuote() {\n return {\n type: 'blockquote',\n children: []\n };\n }\n\n /** @returns {Code} */\n function codeFlow() {\n return {\n type: 'code',\n lang: null,\n meta: null,\n value: ''\n };\n }\n\n /** @returns {InlineCode} */\n function codeText() {\n return {\n type: 'inlineCode',\n value: ''\n };\n }\n\n /** @returns {Definition} */\n function definition() {\n return {\n type: 'definition',\n identifier: '',\n label: null,\n title: null,\n url: ''\n };\n }\n\n /** @returns {Emphasis} */\n function emphasis() {\n return {\n type: 'emphasis',\n children: []\n };\n }\n\n /** @returns {Heading} */\n function heading() {\n return {\n type: 'heading',\n // @ts-expect-error `depth` will be set later.\n depth: 0,\n children: []\n };\n }\n\n /** @returns {Break} */\n function hardBreak() {\n return {\n type: 'break'\n };\n }\n\n /** @returns {Html} */\n function html() {\n return {\n type: 'html',\n value: ''\n };\n }\n\n /** @returns {Image} */\n function image() {\n return {\n type: 'image',\n title: null,\n url: '',\n alt: null\n };\n }\n\n /** @returns {Link} */\n function link() {\n return {\n type: 'link',\n title: null,\n url: '',\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {List}\n */\n function list(token) {\n return {\n type: 'list',\n ordered: token.type === 'listOrdered',\n start: null,\n spread: token._spread,\n children: []\n };\n }\n\n /**\n * @param {Token} token\n * @returns {ListItem}\n */\n function listItem(token) {\n return {\n type: 'listItem',\n spread: token._spread,\n checked: null,\n children: []\n };\n }\n\n /** @returns {Paragraph} */\n function paragraph() {\n return {\n type: 'paragraph',\n children: []\n };\n }\n\n /** @returns {Strong} */\n function strong() {\n return {\n type: 'strong',\n children: []\n };\n }\n\n /** @returns {Text} */\n function text() {\n return {\n type: 'text',\n value: ''\n };\n }\n\n /** @returns {ThematicBreak} */\n function thematicBreak() {\n return {\n type: 'thematicBreak'\n };\n }\n}\n\n/**\n * Copy a point-like value.\n *\n * @param {Point} d\n * Point-like value.\n * @returns {Point}\n * unist point.\n */\nfunction point(d) {\n return {\n line: d.line,\n column: d.column,\n offset: d.offset\n };\n}\n\n/**\n * @param {Config} combined\n * @param {Array | Extension>} extensions\n * @returns {undefined}\n */\nfunction configure(combined, extensions) {\n let index = -1;\n while (++index < extensions.length) {\n const value = extensions[index];\n if (Array.isArray(value)) {\n configure(combined, value);\n } else {\n extension(combined, value);\n }\n }\n}\n\n/**\n * @param {Config} combined\n * @param {Extension} extension\n * @returns {undefined}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key;\n for (key in extension) {\n if (own.call(extension, key)) {\n switch (key) {\n case 'canContainEols':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'transforms':\n {\n const right = extension[key];\n if (right) {\n combined[key].push(...right);\n }\n break;\n }\n case 'enter':\n case 'exit':\n {\n const right = extension[key];\n if (right) {\n Object.assign(combined[key], right);\n }\n break;\n }\n // No default\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error('Cannot close `' + left.type + '` (' + stringifyPosition({\n start: left.start,\n end: left.end\n }) + '): a different token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is open');\n } else {\n throw new Error('Cannot close document, a token (`' + right.type + '`, ' + stringifyPosition({\n start: right.start,\n end: right.end\n }) + ') is still open');\n }\n}", "/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} FromMarkdownOptions\n * @typedef {import('unified').Parser} Parser\n * @typedef {import('unified').Processor} Processor\n */\n\n/**\n * @typedef {Omit} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * Aadd support for parsing from markdown.\n *\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function remarkParse(options) {\n /** @type {Processor} */\n // @ts-expect-error: TS in JSDoc generates wrong types if `this` is typed regularly.\n const self = this\n\n self.parser = parser\n\n /**\n * @type {Parser}\n */\n function parser(doc) {\n return fromMarkdown(doc, {\n ...self.data('settings'),\n ...options,\n // Note: these options are not in the readme.\n // The goal is for them to be set by plugins on `data` instead of being\n // passed by users.\n extensions: self.data('micromarkExtensions') || [],\n mdastExtensions: self.data('fromMarkdownExtensions') || []\n })\n }\n}\n", "export default function escapeStringRegexp(string) {\n\tif (typeof string !== 'string') {\n\t\tthrow new TypeError('Expected a string');\n\t}\n\n\t// Escape characters with special meaning either inside or outside character sets.\n\t// Use a simple backslash escape when it\u2019s always valid, and a `\\xnn` escape when the simpler form would be disallowed by Unicode patterns\u2019 stricter grammar.\n\treturn string\n\t\t.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&')\n\t\t.replace(/-/g, '\\\\x2d');\n}\n", "/**\n * @import {Nodes, Parents, PhrasingContent, Root, Text} from 'mdast'\n * @import {BuildVisitor, Test, VisitorResult} from 'unist-util-visit-parents'\n */\n\n/**\n * @typedef RegExpMatchObject\n * Info on the match.\n * @property {number} index\n * The index of the search at which the result was found.\n * @property {string} input\n * A copy of the search string in the text node.\n * @property {[...Array, Text]} stack\n * All ancestors of the text node, where the last node is the text itself.\n *\n * @typedef {RegExp | string} Find\n * Pattern to find.\n *\n * Strings are escaped and then turned into global expressions.\n *\n * @typedef {Array} FindAndReplaceList\n * Several find and replaces, in array form.\n *\n * @typedef {[Find, Replace?]} FindAndReplaceTuple\n * Find and replace in tuple form.\n *\n * @typedef {ReplaceFunction | string | null | undefined} Replace\n * Thing to replace with.\n *\n * @callback ReplaceFunction\n * Callback called when a search matches.\n * @param {...any} parameters\n * The parameters are the result of corresponding search expression:\n *\n * * `value` (`string`) \u2014 whole match\n * * `...capture` (`Array`) \u2014 matches from regex capture groups\n * * `match` (`RegExpMatchObject`) \u2014 info on the match\n * @returns {Array | PhrasingContent | string | false | null | undefined}\n * Thing to replace with.\n *\n * * when `null`, `undefined`, `''`, remove the match\n * * \u2026or when `false`, do not replace at all\n * * \u2026or when `string`, replace with a text node of that value\n * * \u2026or when `Node` or `Array`, replace with those nodes\n *\n * @typedef {[RegExp, ReplaceFunction]} Pair\n * Normalized find and replace.\n *\n * @typedef {Array} Pairs\n * All find and replaced.\n *\n * @typedef Options\n * Configuration.\n * @property {Test | null | undefined} [ignore]\n * Test for which nodes to ignore (optional).\n */\n\nimport escape from 'escape-string-regexp'\nimport {visitParents} from 'unist-util-visit-parents'\nimport {convert} from 'unist-util-is'\n\n/**\n * Find patterns in a tree and replace them.\n *\n * The algorithm searches the tree in *preorder* for complete values in `Text`\n * nodes.\n * Partial matches are not supported.\n *\n * @param {Nodes} tree\n * Tree to change.\n * @param {FindAndReplaceList | FindAndReplaceTuple} list\n * Patterns to find.\n * @param {Options | null | undefined} [options]\n * Configuration (when `find` is not `Find`).\n * @returns {undefined}\n * Nothing.\n */\nexport function findAndReplace(tree, list, options) {\n const settings = options || {}\n const ignored = convert(settings.ignore || [])\n const pairs = toPairs(list)\n let pairIndex = -1\n\n while (++pairIndex < pairs.length) {\n visitParents(tree, 'text', visitor)\n }\n\n /** @type {BuildVisitor} */\n function visitor(node, parents) {\n let index = -1\n /** @type {Parents | undefined} */\n let grandparent\n\n while (++index < parents.length) {\n const parent = parents[index]\n /** @type {Array | undefined} */\n const siblings = grandparent ? grandparent.children : undefined\n\n if (\n ignored(\n parent,\n siblings ? siblings.indexOf(parent) : undefined,\n grandparent\n )\n ) {\n return\n }\n\n grandparent = parent\n }\n\n if (grandparent) {\n return handler(node, parents)\n }\n }\n\n /**\n * Handle a text node which is not in an ignored parent.\n *\n * @param {Text} node\n * Text node.\n * @param {Array} parents\n * Parents.\n * @returns {VisitorResult}\n * Result.\n */\n function handler(node, parents) {\n const parent = parents[parents.length - 1]\n const find = pairs[pairIndex][0]\n const replace = pairs[pairIndex][1]\n let start = 0\n /** @type {Array} */\n const siblings = parent.children\n const index = siblings.indexOf(node)\n let change = false\n /** @type {Array} */\n let nodes = []\n\n find.lastIndex = 0\n\n let match = find.exec(node.value)\n\n while (match) {\n const position = match.index\n /** @type {RegExpMatchObject} */\n const matchObject = {\n index: match.index,\n input: match.input,\n stack: [...parents, node]\n }\n let value = replace(...match, matchObject)\n\n if (typeof value === 'string') {\n value = value.length > 0 ? {type: 'text', value} : undefined\n }\n\n // It wasn\u2019t a match after all.\n if (value === false) {\n // False acts as if there was no match.\n // So we need to reset `lastIndex`, which currently being at the end of\n // the current match, to the beginning.\n find.lastIndex = position + 1\n } else {\n if (start !== position) {\n nodes.push({\n type: 'text',\n value: node.value.slice(start, position)\n })\n }\n\n if (Array.isArray(value)) {\n nodes.push(...value)\n } else if (value) {\n nodes.push(value)\n }\n\n start = position + match[0].length\n change = true\n }\n\n if (!find.global) {\n break\n }\n\n match = find.exec(node.value)\n }\n\n if (change) {\n if (start < node.value.length) {\n nodes.push({type: 'text', value: node.value.slice(start)})\n }\n\n parent.children.splice(index, 1, ...nodes)\n } else {\n nodes = [node]\n }\n\n return index + nodes.length\n }\n}\n\n/**\n * Turn a tuple or a list of tuples into pairs.\n *\n * @param {FindAndReplaceList | FindAndReplaceTuple} tupleOrList\n * Schema.\n * @returns {Pairs}\n * Clean pairs.\n */\nfunction toPairs(tupleOrList) {\n /** @type {Pairs} */\n const result = []\n\n if (!Array.isArray(tupleOrList)) {\n throw new TypeError('Expected find and replace tuple or list of tuples')\n }\n\n /** @type {FindAndReplaceList} */\n // @ts-expect-error: correct.\n const list =\n !tupleOrList[0] || Array.isArray(tupleOrList[0])\n ? tupleOrList\n : [tupleOrList]\n\n let index = -1\n\n while (++index < list.length) {\n const tuple = list[index]\n result.push([toExpression(tuple[0]), toFunction(tuple[1])])\n }\n\n return result\n}\n\n/**\n * Turn a find into an expression.\n *\n * @param {Find} find\n * Find.\n * @returns {RegExp}\n * Expression.\n */\nfunction toExpression(find) {\n return typeof find === 'string' ? new RegExp(escape(find), 'g') : find\n}\n\n/**\n * Turn a replace into a function.\n *\n * @param {Replace} replace\n * Replace.\n * @returns {ReplaceFunction}\n * Function.\n */\nfunction toFunction(replace) {\n return typeof replace === 'function'\n ? replace\n : function () {\n return replace\n }\n}\n", "/**\n * @import {RegExpMatchObject, ReplaceFunction} from 'mdast-util-find-and-replace'\n * @import {CompileContext, Extension as FromMarkdownExtension, Handle as FromMarkdownHandle, Transform as FromMarkdownTransform} from 'mdast-util-from-markdown'\n * @import {ConstructName, Options as ToMarkdownExtension} from 'mdast-util-to-markdown'\n * @import {Link, PhrasingContent} from 'mdast'\n */\n\nimport {ccount} from 'ccount'\nimport {ok as assert} from 'devlop'\nimport {unicodePunctuation, unicodeWhitespace} from 'micromark-util-character'\nimport {findAndReplace} from 'mdast-util-find-and-replace'\n\n/** @type {ConstructName} */\nconst inConstruct = 'phrasing'\n/** @type {Array} */\nconst notInConstruct = ['autolink', 'link', 'image', 'label']\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM autolink\n * literals in markdown.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable GFM autolink literals.\n */\nexport function gfmAutolinkLiteralFromMarkdown() {\n return {\n transforms: [transformGfmAutolinkLiterals],\n enter: {\n literalAutolink: enterLiteralAutolink,\n literalAutolinkEmail: enterLiteralAutolinkValue,\n literalAutolinkHttp: enterLiteralAutolinkValue,\n literalAutolinkWww: enterLiteralAutolinkValue\n },\n exit: {\n literalAutolink: exitLiteralAutolink,\n literalAutolinkEmail: exitLiteralAutolinkEmail,\n literalAutolinkHttp: exitLiteralAutolinkHttp,\n literalAutolinkWww: exitLiteralAutolinkWww\n }\n }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM autolink\n * literals in markdown.\n *\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable GFM autolink literals.\n */\nexport function gfmAutolinkLiteralToMarkdown() {\n return {\n unsafe: [\n {\n character: '@',\n before: '[+\\\\-.\\\\w]',\n after: '[\\\\-.\\\\w]',\n inConstruct,\n notInConstruct\n },\n {\n character: '.',\n before: '[Ww]',\n after: '[\\\\-.\\\\w]',\n inConstruct,\n notInConstruct\n },\n {\n character: ':',\n before: '[ps]',\n after: '\\\\/',\n inConstruct,\n notInConstruct\n }\n ]\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterLiteralAutolink(token) {\n this.enter({type: 'link', title: null, url: '', children: []}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterLiteralAutolinkValue(token) {\n this.config.enter.autolinkProtocol.call(this, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolinkHttp(token) {\n this.config.exit.autolinkProtocol.call(this, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolinkWww(token) {\n this.config.exit.data.call(this, token)\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'link')\n node.url = 'http://' + this.sliceSerialize(token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolinkEmail(token) {\n this.config.exit.autolinkEmail.call(this, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitLiteralAutolink(token) {\n this.exit(token)\n}\n\n/** @type {FromMarkdownTransform} */\nfunction transformGfmAutolinkLiterals(tree) {\n findAndReplace(\n tree,\n [\n [/(https?:\\/\\/|www(?=\\.))([-.\\w]+)([^ \\t\\r\\n]*)/gi, findUrl],\n [/(?<=^|\\s|\\p{P}|\\p{S})([-.\\w+]+)@([-\\w]+(?:\\.[-\\w]+)+)/gu, findEmail]\n ],\n {ignore: ['link', 'linkReference']}\n )\n}\n\n/**\n * @type {ReplaceFunction}\n * @param {string} _\n * @param {string} protocol\n * @param {string} domain\n * @param {string} path\n * @param {RegExpMatchObject} match\n * @returns {Array | Link | false}\n */\n// eslint-disable-next-line max-params\nfunction findUrl(_, protocol, domain, path, match) {\n let prefix = ''\n\n // Not an expected previous character.\n if (!previous(match)) {\n return false\n }\n\n // Treat `www` as part of the domain.\n if (/^w/i.test(protocol)) {\n domain = protocol + domain\n protocol = ''\n prefix = 'http://'\n }\n\n if (!isCorrectDomain(domain)) {\n return false\n }\n\n const parts = splitUrl(domain + path)\n\n if (!parts[0]) return false\n\n /** @type {Link} */\n const result = {\n type: 'link',\n title: null,\n url: prefix + protocol + parts[0],\n children: [{type: 'text', value: protocol + parts[0]}]\n }\n\n if (parts[1]) {\n return [result, {type: 'text', value: parts[1]}]\n }\n\n return result\n}\n\n/**\n * @type {ReplaceFunction}\n * @param {string} _\n * @param {string} atext\n * @param {string} label\n * @param {RegExpMatchObject} match\n * @returns {Link | false}\n */\nfunction findEmail(_, atext, label, match) {\n if (\n // Not an expected previous character.\n !previous(match, true) ||\n // Label ends in not allowed character.\n /[-\\d_]$/.test(label)\n ) {\n return false\n }\n\n return {\n type: 'link',\n title: null,\n url: 'mailto:' + atext + '@' + label,\n children: [{type: 'text', value: atext + '@' + label}]\n }\n}\n\n/**\n * @param {string} domain\n * @returns {boolean}\n */\nfunction isCorrectDomain(domain) {\n const parts = domain.split('.')\n\n if (\n parts.length < 2 ||\n (parts[parts.length - 1] &&\n (/_/.test(parts[parts.length - 1]) ||\n !/[a-zA-Z\\d]/.test(parts[parts.length - 1]))) ||\n (parts[parts.length - 2] &&\n (/_/.test(parts[parts.length - 2]) ||\n !/[a-zA-Z\\d]/.test(parts[parts.length - 2])))\n ) {\n return false\n }\n\n return true\n}\n\n/**\n * @param {string} url\n * @returns {[string, string | undefined]}\n */\nfunction splitUrl(url) {\n const trailExec = /[!\"&'),.:;<>?\\]}]+$/.exec(url)\n\n if (!trailExec) {\n return [url, undefined]\n }\n\n url = url.slice(0, trailExec.index)\n\n let trail = trailExec[0]\n let closingParenIndex = trail.indexOf(')')\n const openingParens = ccount(url, '(')\n let closingParens = ccount(url, ')')\n\n while (closingParenIndex !== -1 && openingParens > closingParens) {\n url += trail.slice(0, closingParenIndex + 1)\n trail = trail.slice(closingParenIndex + 1)\n closingParenIndex = trail.indexOf(')')\n closingParens++\n }\n\n return [url, trail]\n}\n\n/**\n * @param {RegExpMatchObject} match\n * @param {boolean | null | undefined} [email=false]\n * @returns {boolean}\n */\nfunction previous(match, email) {\n const code = match.input.charCodeAt(match.index - 1)\n\n return (\n (match.index === 0 ||\n unicodeWhitespace(code) ||\n unicodePunctuation(code)) &&\n // If it\u2019s an email, the previous character should not be a slash.\n (!email || code !== 47)\n )\n}\n", "/**\n * @import {\n * CompileContext,\n * Extension as FromMarkdownExtension,\n * Handle as FromMarkdownHandle\n * } from 'mdast-util-from-markdown'\n * @import {ToMarkdownOptions} from 'mdast-util-gfm-footnote'\n * @import {\n * Handle as ToMarkdownHandle,\n * Map,\n * Options as ToMarkdownExtension\n * } from 'mdast-util-to-markdown'\n * @import {FootnoteDefinition, FootnoteReference} from 'mdast'\n */\n\nimport {ok as assert} from 'devlop'\nimport {normalizeIdentifier} from 'micromark-util-normalize-identifier'\n\nfootnoteReference.peek = footnoteReferencePeek\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteCallString() {\n this.buffer()\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteCall(token) {\n this.enter({type: 'footnoteReference', identifier: '', label: ''}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteDefinitionLabelString() {\n this.buffer()\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterFootnoteDefinition(token) {\n this.enter(\n {type: 'footnoteDefinition', identifier: '', label: '', children: []},\n token\n )\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteCallString(token) {\n const label = this.resume()\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'footnoteReference')\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase()\n node.label = label\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteCall(token) {\n this.exit(token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteDefinitionLabelString(token) {\n const label = this.resume()\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'footnoteDefinition')\n node.identifier = normalizeIdentifier(\n this.sliceSerialize(token)\n ).toLowerCase()\n node.label = label\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitFootnoteDefinition(token) {\n this.exit(token)\n}\n\n/** @type {ToMarkdownHandle} */\nfunction footnoteReferencePeek() {\n return '['\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {FootnoteReference} node\n */\nfunction footnoteReference(node, _, state, info) {\n const tracker = state.createTracker(info)\n let value = tracker.move('[^')\n const exit = state.enter('footnoteReference')\n const subexit = state.enter('reference')\n value += tracker.move(\n state.safe(state.associationId(node), {after: ']', before: value})\n )\n subexit()\n exit()\n value += tracker.move(']')\n return value\n}\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM footnotes\n * in markdown.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-from-markdown`.\n */\nexport function gfmFootnoteFromMarkdown() {\n return {\n enter: {\n gfmFootnoteCallString: enterFootnoteCallString,\n gfmFootnoteCall: enterFootnoteCall,\n gfmFootnoteDefinitionLabelString: enterFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: enterFootnoteDefinition\n },\n exit: {\n gfmFootnoteCallString: exitFootnoteCallString,\n gfmFootnoteCall: exitFootnoteCall,\n gfmFootnoteDefinitionLabelString: exitFootnoteDefinitionLabelString,\n gfmFootnoteDefinition: exitFootnoteDefinition\n }\n }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM footnotes\n * in markdown.\n *\n * @param {ToMarkdownOptions | null | undefined} [options]\n * Configuration (optional).\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown`.\n */\nexport function gfmFootnoteToMarkdown(options) {\n // To do: next major: change default.\n let firstLineBlank = false\n\n if (options && options.firstLineBlank) {\n firstLineBlank = true\n }\n\n return {\n handlers: {footnoteDefinition, footnoteReference},\n // This is on by default already.\n unsafe: [{character: '[', inConstruct: ['label', 'phrasing', 'reference']}]\n }\n\n /**\n * @type {ToMarkdownHandle}\n * @param {FootnoteDefinition} node\n */\n function footnoteDefinition(node, _, state, info) {\n const tracker = state.createTracker(info)\n let value = tracker.move('[^')\n const exit = state.enter('footnoteDefinition')\n const subexit = state.enter('label')\n value += tracker.move(\n state.safe(state.associationId(node), {before: value, after: ']'})\n )\n subexit()\n\n value += tracker.move(']:')\n\n if (node.children && node.children.length > 0) {\n tracker.shift(4)\n\n value += tracker.move(\n (firstLineBlank ? '\\n' : ' ') +\n state.indentLines(\n state.containerFlow(node, tracker.current()),\n firstLineBlank ? mapAll : mapExceptFirst\n )\n )\n }\n\n exit()\n\n return value\n }\n}\n\n/** @type {Map} */\nfunction mapExceptFirst(line, index, blank) {\n return index === 0 ? line : mapAll(line, index, blank)\n}\n\n/** @type {Map} */\nfunction mapAll(line, index, blank) {\n return (blank ? '' : ' ') + line\n}\n", "/**\n * @typedef {import('mdast').Delete} Delete\n *\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n *\n * @typedef {import('mdast-util-to-markdown').ConstructName} ConstructName\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n */\n\n/**\n * List of constructs that occur in phrasing (paragraphs, headings), but cannot\n * contain strikethrough.\n * So they sort of cancel each other out.\n * Note: could use a better name.\n *\n * Note: keep in sync with: \n *\n * @type {Array}\n */\nconst constructsWithoutStrikethrough = [\n 'autolink',\n 'destinationLiteral',\n 'destinationRaw',\n 'reference',\n 'titleQuote',\n 'titleApostrophe'\n]\n\nhandleDelete.peek = peekDelete\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM\n * strikethrough in markdown.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-from-markdown` to enable GFM strikethrough.\n */\nexport function gfmStrikethroughFromMarkdown() {\n return {\n canContainEols: ['delete'],\n enter: {strikethrough: enterStrikethrough},\n exit: {strikethrough: exitStrikethrough}\n }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM\n * strikethrough in markdown.\n *\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable GFM strikethrough.\n */\nexport function gfmStrikethroughToMarkdown() {\n return {\n unsafe: [\n {\n character: '~',\n inConstruct: 'phrasing',\n notInConstruct: constructsWithoutStrikethrough\n }\n ],\n handlers: {delete: handleDelete}\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterStrikethrough(token) {\n this.enter({type: 'delete', children: []}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitStrikethrough(token) {\n this.exit(token)\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {Delete} node\n */\nfunction handleDelete(node, _, state, info) {\n const tracker = state.createTracker(info)\n const exit = state.enter('strikethrough')\n let value = tracker.move('~~')\n value += state.containerPhrasing(node, {\n ...tracker.current(),\n before: value,\n after: '~'\n })\n value += tracker.move('~~')\n exit()\n return value\n}\n\n/** @type {ToMarkdownHandle} */\nfunction peekDelete() {\n return '~'\n}\n", "// To do: next major: remove.\n/**\n * @typedef {Options} MarkdownTableOptions\n * Configuration.\n */\n\n/**\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [alignDelimiters=true]\n * Whether to align the delimiters (default: `true`);\n * they are aligned by default:\n *\n * ```markdown\n * | Alpha | B |\n * | ----- | ----- |\n * | C | Delta |\n * ```\n *\n * Pass `false` to make them staggered:\n *\n * ```markdown\n * | Alpha | B |\n * | - | - |\n * | C | Delta |\n * ```\n * @property {ReadonlyArray | string | null | undefined} [align]\n * How to align columns (default: `''`);\n * one style for all columns or styles for their respective columns;\n * each style is either `'l'` (left), `'r'` (right), or `'c'` (center);\n * other values are treated as `''`, which doesn\u2019t place the colon in the\n * alignment row but does align left;\n * *only the lowercased first character is used, so `Right` is fine.*\n * @property {boolean | null | undefined} [delimiterEnd=true]\n * Whether to end each row with the delimiter (default: `true`).\n *\n * > \uD83D\uDC49 **Note**: please don\u2019t use this: it could create fragile structures\n * > that aren\u2019t understandable to some markdown parsers.\n *\n * When `true`, there are ending delimiters:\n *\n * ```markdown\n * | Alpha | B |\n * | ----- | ----- |\n * | C | Delta |\n * ```\n *\n * When `false`, there are no ending delimiters:\n *\n * ```markdown\n * | Alpha | B\n * | ----- | -----\n * | C | Delta\n * ```\n * @property {boolean | null | undefined} [delimiterStart=true]\n * Whether to begin each row with the delimiter (default: `true`).\n *\n * > \uD83D\uDC49 **Note**: please don\u2019t use this: it could create fragile structures\n * > that aren\u2019t understandable to some markdown parsers.\n *\n * When `true`, there are starting delimiters:\n *\n * ```markdown\n * | Alpha | B |\n * | ----- | ----- |\n * | C | Delta |\n * ```\n *\n * When `false`, there are no starting delimiters:\n *\n * ```markdown\n * Alpha | B |\n * ----- | ----- |\n * C | Delta |\n * ```\n * @property {boolean | null | undefined} [padding=true]\n * Whether to add a space of padding between delimiters and cells\n * (default: `true`).\n *\n * When `true`, there is padding:\n *\n * ```markdown\n * | Alpha | B |\n * | ----- | ----- |\n * | C | Delta |\n * ```\n *\n * When `false`, there is no padding:\n *\n * ```markdown\n * |Alpha|B |\n * |-----|-----|\n * |C |Delta|\n * ```\n * @property {((value: string) => number) | null | undefined} [stringLength]\n * Function to detect the length of table cell content (optional);\n * this is used when aligning the delimiters (`|`) between table cells;\n * full-width characters and emoji mess up delimiter alignment when viewing\n * the markdown source;\n * to fix this, you can pass this function,\n * which receives the cell content and returns its \u201Cvisible\u201D size;\n * note that what is and isn\u2019t visible depends on where the text is displayed.\n *\n * Without such a function, the following:\n *\n * ```js\n * markdownTable([\n * ['Alpha', 'Bravo'],\n * ['\u4E2D\u6587', 'Charlie'],\n * ['\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69', 'Delta']\n * ])\n * ```\n *\n * Yields:\n *\n * ```markdown\n * | Alpha | Bravo |\n * | - | - |\n * | \u4E2D\u6587 | Charlie |\n * | \uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69 | Delta |\n * ```\n *\n * With [`string-width`](https://github.com/sindresorhus/string-width):\n *\n * ```js\n * import stringWidth from 'string-width'\n *\n * markdownTable(\n * [\n * ['Alpha', 'Bravo'],\n * ['\u4E2D\u6587', 'Charlie'],\n * ['\uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69', 'Delta']\n * ],\n * {stringLength: stringWidth}\n * )\n * ```\n *\n * Yields:\n *\n * ```markdown\n * | Alpha | Bravo |\n * | ----- | ------- |\n * | \u4E2D\u6587 | Charlie |\n * | \uD83D\uDC69\u200D\u2764\uFE0F\u200D\uD83D\uDC69 | Delta |\n * ```\n */\n\n/**\n * @param {string} value\n * Cell value.\n * @returns {number}\n * Cell size.\n */\nfunction defaultStringLength(value) {\n return value.length\n}\n\n/**\n * Generate a markdown\n * ([GFM](https://docs.github.com/en/github/writing-on-github/working-with-advanced-formatting/organizing-information-with-tables))\n * table.\n *\n * @param {ReadonlyArray>} table\n * Table data (matrix of strings).\n * @param {Readonly | null | undefined} [options]\n * Configuration (optional).\n * @returns {string}\n * Result.\n */\nexport function markdownTable(table, options) {\n const settings = options || {}\n // To do: next major: change to spread.\n const align = (settings.align || []).concat()\n const stringLength = settings.stringLength || defaultStringLength\n /** @type {Array} Character codes as symbols for alignment per column. */\n const alignments = []\n /** @type {Array>} Cells per row. */\n const cellMatrix = []\n /** @type {Array>} Sizes of each cell per row. */\n const sizeMatrix = []\n /** @type {Array} */\n const longestCellByColumn = []\n let mostCellsPerRow = 0\n let rowIndex = -1\n\n // This is a superfluous loop if we don\u2019t align delimiters, but otherwise we\u2019d\n // do superfluous work when aligning, so optimize for aligning.\n while (++rowIndex < table.length) {\n /** @type {Array} */\n const row = []\n /** @type {Array} */\n const sizes = []\n let columnIndex = -1\n\n if (table[rowIndex].length > mostCellsPerRow) {\n mostCellsPerRow = table[rowIndex].length\n }\n\n while (++columnIndex < table[rowIndex].length) {\n const cell = serialize(table[rowIndex][columnIndex])\n\n if (settings.alignDelimiters !== false) {\n const size = stringLength(cell)\n sizes[columnIndex] = size\n\n if (\n longestCellByColumn[columnIndex] === undefined ||\n size > longestCellByColumn[columnIndex]\n ) {\n longestCellByColumn[columnIndex] = size\n }\n }\n\n row.push(cell)\n }\n\n cellMatrix[rowIndex] = row\n sizeMatrix[rowIndex] = sizes\n }\n\n // Figure out which alignments to use.\n let columnIndex = -1\n\n if (typeof align === 'object' && 'length' in align) {\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = toAlignment(align[columnIndex])\n }\n } else {\n const code = toAlignment(align)\n\n while (++columnIndex < mostCellsPerRow) {\n alignments[columnIndex] = code\n }\n }\n\n // Inject the alignment row.\n columnIndex = -1\n /** @type {Array} */\n const row = []\n /** @type {Array} */\n const sizes = []\n\n while (++columnIndex < mostCellsPerRow) {\n const code = alignments[columnIndex]\n let before = ''\n let after = ''\n\n if (code === 99 /* `c` */) {\n before = ':'\n after = ':'\n } else if (code === 108 /* `l` */) {\n before = ':'\n } else if (code === 114 /* `r` */) {\n after = ':'\n }\n\n // There *must* be at least one hyphen-minus in each alignment cell.\n let size =\n settings.alignDelimiters === false\n ? 1\n : Math.max(\n 1,\n longestCellByColumn[columnIndex] - before.length - after.length\n )\n\n const cell = before + '-'.repeat(size) + after\n\n if (settings.alignDelimiters !== false) {\n size = before.length + size + after.length\n\n if (size > longestCellByColumn[columnIndex]) {\n longestCellByColumn[columnIndex] = size\n }\n\n sizes[columnIndex] = size\n }\n\n row[columnIndex] = cell\n }\n\n // Inject the alignment row.\n cellMatrix.splice(1, 0, row)\n sizeMatrix.splice(1, 0, sizes)\n\n rowIndex = -1\n /** @type {Array} */\n const lines = []\n\n while (++rowIndex < cellMatrix.length) {\n const row = cellMatrix[rowIndex]\n const sizes = sizeMatrix[rowIndex]\n columnIndex = -1\n /** @type {Array} */\n const line = []\n\n while (++columnIndex < mostCellsPerRow) {\n const cell = row[columnIndex] || ''\n let before = ''\n let after = ''\n\n if (settings.alignDelimiters !== false) {\n const size =\n longestCellByColumn[columnIndex] - (sizes[columnIndex] || 0)\n const code = alignments[columnIndex]\n\n if (code === 114 /* `r` */) {\n before = ' '.repeat(size)\n } else if (code === 99 /* `c` */) {\n if (size % 2) {\n before = ' '.repeat(size / 2 + 0.5)\n after = ' '.repeat(size / 2 - 0.5)\n } else {\n before = ' '.repeat(size / 2)\n after = before\n }\n } else {\n after = ' '.repeat(size)\n }\n }\n\n if (settings.delimiterStart !== false && !columnIndex) {\n line.push('|')\n }\n\n if (\n settings.padding !== false &&\n // Don\u2019t add the opening space if we\u2019re not aligning and the cell is\n // empty: there will be a closing space.\n !(settings.alignDelimiters === false && cell === '') &&\n (settings.delimiterStart !== false || columnIndex)\n ) {\n line.push(' ')\n }\n\n if (settings.alignDelimiters !== false) {\n line.push(before)\n }\n\n line.push(cell)\n\n if (settings.alignDelimiters !== false) {\n line.push(after)\n }\n\n if (settings.padding !== false) {\n line.push(' ')\n }\n\n if (\n settings.delimiterEnd !== false ||\n columnIndex !== mostCellsPerRow - 1\n ) {\n line.push('|')\n }\n }\n\n lines.push(\n settings.delimiterEnd === false\n ? line.join('').replace(/ +$/, '')\n : line.join('')\n )\n }\n\n return lines.join('\\n')\n}\n\n/**\n * @param {string | null | undefined} [value]\n * Value to serialize.\n * @returns {string}\n * Result.\n */\nfunction serialize(value) {\n return value === null || value === undefined ? '' : String(value)\n}\n\n/**\n * @param {string | null | undefined} value\n * Value.\n * @returns {number}\n * Alignment.\n */\nfunction toAlignment(value) {\n const code = typeof value === 'string' ? value.codePointAt(0) : 0\n\n return code === 67 /* `C` */ || code === 99 /* `c` */\n ? 99 /* `c` */\n : code === 76 /* `L` */ || code === 108 /* `l` */\n ? 108 /* `l` */\n : code === 82 /* `R` */ || code === 114 /* `r` */\n ? 114 /* `r` */\n : 0\n}\n", "/**\n * @import {Blockquote, Parents} from 'mdast'\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Blockquote} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function blockquote(node, _, state, info) {\n const exit = state.enter('blockquote')\n const tracker = state.createTracker(info)\n tracker.move('> ')\n tracker.shift(2)\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map\n )\n exit()\n return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n return '>' + (blank ? '' : ' ') + line\n}\n", "/**\n * @import {ConstructName, Unsafe} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {Array} stack\n * @param {Unsafe} pattern\n * @returns {boolean}\n */\nexport function patternInScope(stack, pattern) {\n return (\n listInScope(stack, pattern.inConstruct, true) &&\n !listInScope(stack, pattern.notInConstruct, false)\n )\n}\n\n/**\n * @param {Array} stack\n * @param {Unsafe['inConstruct']} list\n * @param {boolean} none\n * @returns {boolean}\n */\nfunction listInScope(stack, list, none) {\n if (typeof list === 'string') {\n list = [list]\n }\n\n if (!list || list.length === 0) {\n return none\n }\n\n let index = -1\n\n while (++index < list.length) {\n if (stack.includes(list[index])) {\n return true\n }\n }\n\n return false\n}\n", "/**\n * @import {Break, Parents} from 'mdast'\n * @import {Info, State} from 'mdast-util-to-markdown'\n */\n\nimport {patternInScope} from '../util/pattern-in-scope.js'\n\n/**\n * @param {Break} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function hardBreak(_, _1, state, info) {\n let index = -1\n\n while (++index < state.unsafe.length) {\n // If we can\u2019t put eols in this construct (setext headings, tables), use a\n // space instead.\n if (\n state.unsafe[index].character === '\\n' &&\n patternInScope(state.stack, state.unsafe[index])\n ) {\n return /[ \\t]/.test(info.before) ? '' : ' '\n }\n }\n\n return '\\\\\\n'\n}\n", "/**\n * Get the count of the longest repeating streak of `substring` in `value`.\n *\n * @param {string} value\n * Content to search in.\n * @param {string} substring\n * Substring to look for, typically one character.\n * @returns {number}\n * Count of most frequent adjacent `substring`s in `value`.\n */\nexport function longestStreak(value, substring) {\n const source = String(value)\n let index = source.indexOf(substring)\n let expected = index\n let count = 0\n let max = 0\n\n if (typeof substring !== 'string') {\n throw new TypeError('Expected substring')\n }\n\n while (index !== -1) {\n if (index === expected) {\n if (++count > max) {\n max = count\n }\n } else {\n count = 1\n }\n\n expected = index + substring.length\n index = source.indexOf(substring, expected)\n }\n\n return max\n}\n", "/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Code} from 'mdast'\n */\n\n/**\n * @param {Code} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatCodeAsIndented(node, state) {\n return Boolean(\n state.options.fences === false &&\n node.value &&\n // If there\u2019s no info\u2026\n !node.lang &&\n // And there\u2019s a non-whitespace character\u2026\n /[^ \\r\\n]/.test(node.value) &&\n // And the value doesn\u2019t start or end in a blank\u2026\n !/^[\\t ]*(?:[\\r\\n]|$)|(?:^|[\\r\\n])[\\t ]*$/.test(node.value)\n )\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkFence(state) {\n const marker = state.options.fence || '`'\n\n if (marker !== '`' && marker !== '~') {\n throw new Error(\n 'Cannot serialize code with `' +\n marker +\n '` for `options.fence`, expected `` ` `` or `~`'\n )\n }\n\n return marker\n}\n", "/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {Code, Parents} from 'mdast'\n */\n\nimport {longestStreak} from 'longest-streak'\nimport {formatCodeAsIndented} from '../util/format-code-as-indented.js'\nimport {checkFence} from '../util/check-fence.js'\n\n/**\n * @param {Code} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function code(node, _, state, info) {\n const marker = checkFence(state)\n const raw = node.value || ''\n const suffix = marker === '`' ? 'GraveAccent' : 'Tilde'\n\n if (formatCodeAsIndented(node, state)) {\n const exit = state.enter('codeIndented')\n const value = state.indentLines(raw, map)\n exit()\n return value\n }\n\n const tracker = state.createTracker(info)\n const sequence = marker.repeat(Math.max(longestStreak(raw, marker) + 1, 3))\n const exit = state.enter('codeFenced')\n let value = tracker.move(sequence)\n\n if (node.lang) {\n const subexit = state.enter(`codeFencedLang${suffix}`)\n value += tracker.move(\n state.safe(node.lang, {\n before: value,\n after: ' ',\n encode: ['`'],\n ...tracker.current()\n })\n )\n subexit()\n }\n\n if (node.lang && node.meta) {\n const subexit = state.enter(`codeFencedMeta${suffix}`)\n value += tracker.move(' ')\n value += tracker.move(\n state.safe(node.meta, {\n before: value,\n after: '\\n',\n encode: ['`'],\n ...tracker.current()\n })\n )\n subexit()\n }\n\n value += tracker.move('\\n')\n\n if (raw) {\n value += tracker.move(raw + '\\n')\n }\n\n value += tracker.move(sequence)\n exit()\n return value\n}\n\n/** @type {Map} */\nfunction map(line, _, blank) {\n return (blank ? '' : ' ') + line\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkQuote(state) {\n const marker = state.options.quote || '\"'\n\n if (marker !== '\"' && marker !== \"'\") {\n throw new Error(\n 'Cannot serialize title with `' +\n marker +\n '` for `options.quote`, expected `\"`, or `\\'`'\n )\n }\n\n return marker\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Definition, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\n/**\n * @param {Definition} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function definition(node, _, state, info) {\n const quote = checkQuote(state)\n const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n const exit = state.enter('definition')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('[')\n value += tracker.move(\n state.safe(state.associationId(node), {\n before: value,\n after: ']',\n ...tracker.current()\n })\n )\n value += tracker.move(']: ')\n\n subexit()\n\n if (\n // If there\u2019s no url, or\u2026\n !node.url ||\n // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter('destinationLiteral')\n value += tracker.move('<')\n value += tracker.move(\n state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n )\n value += tracker.move('>')\n } else {\n // No whitespace, raw is prettier.\n subexit = state.enter('destinationRaw')\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? ' ' : '\\n',\n ...tracker.current()\n })\n )\n }\n\n subexit()\n\n if (node.title) {\n subexit = state.enter(`title${suffix}`)\n value += tracker.move(' ' + quote)\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n )\n value += tracker.move(quote)\n subexit()\n }\n\n exit()\n\n return value\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkEmphasis(state) {\n const marker = state.options.emphasis || '*'\n\n if (marker !== '*' && marker !== '_') {\n throw new Error(\n 'Cannot serialize emphasis with `' +\n marker +\n '` for `options.emphasis`, expected `*`, or `_`'\n )\n }\n\n return marker\n}\n", "/**\n * Encode a code point as a character reference.\n *\n * @param {number} code\n * Code point to encode.\n * @returns {string}\n * Encoded character reference.\n */\nexport function encodeCharacterReference(code) {\n return '&#x' + code.toString(16).toUpperCase() + ';'\n}\n", "/**\n * @import {EncodeSides} from '../types.js'\n */\n\nimport {classifyCharacter} from 'micromark-util-classify-character'\n\n/**\n * Check whether to encode (as a character reference) the characters\n * surrounding an attention run.\n *\n * Which characters are around an attention run influence whether it works or\n * not.\n *\n * See for more info.\n * See this markdown in a particular renderer to see what works:\n *\n * ```markdown\n * | | A (letter inside) | B (punctuation inside) | C (whitespace inside) | D (nothing inside) |\n * | ----------------------- | ----------------- | ---------------------- | --------------------- | ------------------ |\n * | 1 (letter outside) | x*y*z | x*.*z | x* *z | x**z |\n * | 2 (punctuation outside) | .*y*. | .*.*. | .* *. | .**. |\n * | 3 (whitespace outside) | x *y* z | x *.* z | x * * z | x ** z |\n * | 4 (nothing outside) | *x* | *.* | * * | ** |\n * ```\n *\n * @param {number} outside\n * Code point on the outer side of the run.\n * @param {number} inside\n * Code point on the inner side of the run.\n * @param {'*' | '_'} marker\n * Marker of the run.\n * Underscores are handled more strictly (they form less often) than\n * asterisks.\n * @returns {EncodeSides}\n * Whether to encode characters.\n */\n// Important: punctuation must never be encoded.\n// Punctuation is solely used by markdown constructs.\n// And by encoding itself.\n// Encoding them will break constructs or double encode things.\nexport function encodeInfo(outside, inside, marker) {\n const outsideKind = classifyCharacter(outside)\n const insideKind = classifyCharacter(inside)\n\n // Letter outside:\n if (outsideKind === undefined) {\n return insideKind === undefined\n ? // Letter inside:\n // we have to encode *both* letters for `_` as it is looser.\n // it already forms for `*` (and GFMs `~`).\n marker === '_'\n ? {inside: true, outside: true}\n : {inside: false, outside: false}\n : insideKind === 1\n ? // Whitespace inside: encode both (letter, whitespace).\n {inside: true, outside: true}\n : // Punctuation inside: encode outer (letter)\n {inside: false, outside: true}\n }\n\n // Whitespace outside:\n if (outsideKind === 1) {\n return insideKind === undefined\n ? // Letter inside: already forms.\n {inside: false, outside: false}\n : insideKind === 1\n ? // Whitespace inside: encode both (whitespace).\n {inside: true, outside: true}\n : // Punctuation inside: already forms.\n {inside: false, outside: false}\n }\n\n // Punctuation outside:\n return insideKind === undefined\n ? // Letter inside: already forms.\n {inside: false, outside: false}\n : insideKind === 1\n ? // Whitespace inside: encode inner (whitespace).\n {inside: true, outside: false}\n : // Punctuation inside: already forms.\n {inside: false, outside: false}\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Emphasis, Parents} from 'mdast'\n */\n\nimport {checkEmphasis} from '../util/check-emphasis.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nemphasis.peek = emphasisPeek\n\n/**\n * @param {Emphasis} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function emphasis(node, _, state, info) {\n const marker = checkEmphasis(state)\n const exit = state.enter('emphasis')\n const tracker = state.createTracker(info)\n const before = tracker.move(marker)\n\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n )\n const betweenHead = between.charCodeAt(0)\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n )\n\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1)\n }\n\n const betweenTail = between.charCodeAt(between.length - 1)\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n }\n\n const after = tracker.move(marker)\n\n exit()\n\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n }\n return before + between + after\n}\n\n/**\n * @param {Emphasis} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction emphasisPeek(_, _1, state) {\n return state.options.emphasis || '*'\n}\n", "/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Heading} from 'mdast'\n */\n\nimport {EXIT, visit} from 'unist-util-visit'\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Heading} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatHeadingAsSetext(node, state) {\n let literalWithBreak = false\n\n // Look for literals with a line break.\n // Note that this also\n visit(node, function (node) {\n if (\n ('value' in node && /\\r?\\n|\\r/.test(node.value)) ||\n node.type === 'break'\n ) {\n literalWithBreak = true\n return EXIT\n }\n })\n\n return Boolean(\n (!node.depth || node.depth < 3) &&\n toString(node) &&\n (state.options.setext || literalWithBreak)\n )\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Heading, Parents} from 'mdast'\n */\n\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {formatHeadingAsSetext} from '../util/format-heading-as-setext.js'\n\n/**\n * @param {Heading} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function heading(node, _, state, info) {\n const rank = Math.max(Math.min(6, node.depth || 1), 1)\n const tracker = state.createTracker(info)\n\n if (formatHeadingAsSetext(node, state)) {\n const exit = state.enter('headingSetext')\n const subexit = state.enter('phrasing')\n const value = state.containerPhrasing(node, {\n ...tracker.current(),\n before: '\\n',\n after: '\\n'\n })\n subexit()\n exit()\n\n return (\n value +\n '\\n' +\n (rank === 1 ? '=' : '-').repeat(\n // The whole size\u2026\n value.length -\n // Minus the position of the character after the last EOL (or\n // 0 if there is none)\u2026\n (Math.max(value.lastIndexOf('\\r'), value.lastIndexOf('\\n')) + 1)\n )\n )\n }\n\n const sequence = '#'.repeat(rank)\n const exit = state.enter('headingAtx')\n const subexit = state.enter('phrasing')\n\n // Note: for proper tracking, we should reset the output positions when there\n // is no content returned, because then the space is not output.\n // Practically, in that case, there is no content, so it doesn\u2019t matter that\n // we\u2019ve tracked one too many characters.\n tracker.move(sequence + ' ')\n\n let value = state.containerPhrasing(node, {\n before: '# ',\n after: '\\n',\n ...tracker.current()\n })\n\n if (/^[\\t ]/.test(value)) {\n // To do: what effect has the character reference on tracking?\n value = encodeCharacterReference(value.charCodeAt(0)) + value.slice(1)\n }\n\n value = value ? sequence + ' ' + value : sequence\n\n if (state.options.closeAtx) {\n value += ' ' + sequence\n }\n\n subexit()\n exit()\n\n return value\n}\n", "/**\n * @import {Html} from 'mdast'\n */\n\nhtml.peek = htmlPeek\n\n/**\n * @param {Html} node\n * @returns {string}\n */\nexport function html(node) {\n return node.value || ''\n}\n\n/**\n * @returns {string}\n */\nfunction htmlPeek() {\n return '<'\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Image, Parents} from 'mdast'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\n\nimage.peek = imagePeek\n\n/**\n * @param {Image} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function image(node, _, state, info) {\n const quote = checkQuote(state)\n const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n const exit = state.enter('image')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('![')\n value += tracker.move(\n state.safe(node.alt, {before: value, after: ']', ...tracker.current()})\n )\n value += tracker.move('](')\n\n subexit()\n\n if (\n // If there\u2019s no url but there is a title\u2026\n (!node.url && node.title) ||\n // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter('destinationLiteral')\n value += tracker.move('<')\n value += tracker.move(\n state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n )\n value += tracker.move('>')\n } else {\n // No whitespace, raw is prettier.\n subexit = state.enter('destinationRaw')\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? ' ' : ')',\n ...tracker.current()\n })\n )\n }\n\n subexit()\n\n if (node.title) {\n subexit = state.enter(`title${suffix}`)\n value += tracker.move(' ' + quote)\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n )\n value += tracker.move(quote)\n subexit()\n }\n\n value += tracker.move(')')\n exit()\n\n return value\n}\n\n/**\n * @returns {string}\n */\nfunction imagePeek() {\n return '!'\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {ImageReference, Parents} from 'mdast'\n */\n\nimageReference.peek = imageReferencePeek\n\n/**\n * @param {ImageReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function imageReference(node, _, state, info) {\n const type = node.referenceType\n const exit = state.enter('imageReference')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('![')\n const alt = state.safe(node.alt, {\n before: value,\n after: ']',\n ...tracker.current()\n })\n value += tracker.move(alt + '][')\n\n subexit()\n // Hide the fact that we\u2019re in phrasing, because escapes don\u2019t work.\n const stack = state.stack\n state.stack = []\n subexit = state.enter('reference')\n // Note: for proper tracking, we should reset the output positions when we end\n // up making a `shortcut` reference, because then there is no brace output.\n // Practically, in that case, there is no content, so it doesn\u2019t matter that\n // we\u2019ve tracked one too many characters.\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: ']',\n ...tracker.current()\n })\n subexit()\n state.stack = stack\n exit()\n\n if (type === 'full' || !alt || alt !== reference) {\n value += tracker.move(reference + ']')\n } else if (type === 'shortcut') {\n // Remove the unwanted `[`.\n value = value.slice(0, -1)\n } else {\n value += tracker.move(']')\n }\n\n return value\n}\n\n/**\n * @returns {string}\n */\nfunction imageReferencePeek() {\n return '!'\n}\n", "/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {InlineCode, Parents} from 'mdast'\n */\n\ninlineCode.peek = inlineCodePeek\n\n/**\n * @param {InlineCode} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nexport function inlineCode(node, _, state) {\n let value = node.value || ''\n let sequence = '`'\n let index = -1\n\n // If there is a single grave accent on its own in the code, use a fence of\n // two.\n // If there are two in a row, use one.\n while (new RegExp('(^|[^`])' + sequence + '([^`]|$)').test(value)) {\n sequence += '`'\n }\n\n // If this is not just spaces or eols (tabs don\u2019t count), and either the\n // first or last character are a space, eol, or tick, then pad with spaces.\n if (\n /[^ \\r\\n]/.test(value) &&\n ((/^[ \\r\\n]/.test(value) && /[ \\r\\n]$/.test(value)) || /^`|`$/.test(value))\n ) {\n value = ' ' + value + ' '\n }\n\n // We have a potential problem: certain characters after eols could result in\n // blocks being seen.\n // For example, if someone injected the string `'\\n# b'`, then that would\n // result in an ATX heading.\n // We can\u2019t escape characters in `inlineCode`, but because eols are\n // transformed to spaces when going from markdown to HTML anyway, we can swap\n // them out.\n while (++index < state.unsafe.length) {\n const pattern = state.unsafe[index]\n const expression = state.compilePattern(pattern)\n /** @type {RegExpExecArray | null} */\n let match\n\n // Only look for `atBreak`s.\n // Btw: note that `atBreak` patterns will always start the regex at LF or\n // CR.\n if (!pattern.atBreak) continue\n\n while ((match = expression.exec(value))) {\n let position = match.index\n\n // Support CRLF (patterns only look for one of the characters).\n if (\n value.charCodeAt(position) === 10 /* `\\n` */ &&\n value.charCodeAt(position - 1) === 13 /* `\\r` */\n ) {\n position--\n }\n\n value = value.slice(0, position) + ' ' + value.slice(match.index + 1)\n }\n }\n\n return sequence + value + sequence\n}\n\n/**\n * @returns {string}\n */\nfunction inlineCodePeek() {\n return '`'\n}\n", "/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Link} from 'mdast'\n */\n\nimport {toString} from 'mdast-util-to-string'\n\n/**\n * @param {Link} node\n * @param {State} state\n * @returns {boolean}\n */\nexport function formatLinkAsAutolink(node, state) {\n const raw = toString(node)\n\n return Boolean(\n !state.options.resourceLink &&\n // If there\u2019s a url\u2026\n node.url &&\n // And there\u2019s a no title\u2026\n !node.title &&\n // And the content of `node` is a single text node\u2026\n node.children &&\n node.children.length === 1 &&\n node.children[0].type === 'text' &&\n // And if the url is the same as the content\u2026\n (raw === node.url || 'mailto:' + raw === node.url) &&\n // And that starts w/ a protocol\u2026\n /^[a-z][a-z+.-]+:/i.test(node.url) &&\n // And that doesn\u2019t contain ASCII control codes (character escapes and\n // references don\u2019t work), space, or angle brackets\u2026\n !/[\\0- <>\\u007F]/.test(node.url)\n )\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Link, Parents} from 'mdast'\n * @import {Exit} from '../types.js'\n */\n\nimport {checkQuote} from '../util/check-quote.js'\nimport {formatLinkAsAutolink} from '../util/format-link-as-autolink.js'\n\nlink.peek = linkPeek\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function link(node, _, state, info) {\n const quote = checkQuote(state)\n const suffix = quote === '\"' ? 'Quote' : 'Apostrophe'\n const tracker = state.createTracker(info)\n /** @type {Exit} */\n let exit\n /** @type {Exit} */\n let subexit\n\n if (formatLinkAsAutolink(node, state)) {\n // Hide the fact that we\u2019re in phrasing, because escapes don\u2019t work.\n const stack = state.stack\n state.stack = []\n exit = state.enter('autolink')\n let value = tracker.move('<')\n value += tracker.move(\n state.containerPhrasing(node, {\n before: value,\n after: '>',\n ...tracker.current()\n })\n )\n value += tracker.move('>')\n exit()\n state.stack = stack\n return value\n }\n\n exit = state.enter('link')\n subexit = state.enter('label')\n let value = tracker.move('[')\n value += tracker.move(\n state.containerPhrasing(node, {\n before: value,\n after: '](',\n ...tracker.current()\n })\n )\n value += tracker.move('](')\n subexit()\n\n if (\n // If there\u2019s no url but there is a title\u2026\n (!node.url && node.title) ||\n // If there are control characters or whitespace.\n /[\\0- \\u007F]/.test(node.url)\n ) {\n subexit = state.enter('destinationLiteral')\n value += tracker.move('<')\n value += tracker.move(\n state.safe(node.url, {before: value, after: '>', ...tracker.current()})\n )\n value += tracker.move('>')\n } else {\n // No whitespace, raw is prettier.\n subexit = state.enter('destinationRaw')\n value += tracker.move(\n state.safe(node.url, {\n before: value,\n after: node.title ? ' ' : ')',\n ...tracker.current()\n })\n )\n }\n\n subexit()\n\n if (node.title) {\n subexit = state.enter(`title${suffix}`)\n value += tracker.move(' ' + quote)\n value += tracker.move(\n state.safe(node.title, {\n before: value,\n after: quote,\n ...tracker.current()\n })\n )\n value += tracker.move(quote)\n subexit()\n }\n\n value += tracker.move(')')\n\n exit()\n return value\n}\n\n/**\n * @param {Link} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @returns {string}\n */\nfunction linkPeek(node, _, state) {\n return formatLinkAsAutolink(node, state) ? '<' : '['\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {LinkReference, Parents} from 'mdast'\n */\n\nlinkReference.peek = linkReferencePeek\n\n/**\n * @param {LinkReference} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function linkReference(node, _, state, info) {\n const type = node.referenceType\n const exit = state.enter('linkReference')\n let subexit = state.enter('label')\n const tracker = state.createTracker(info)\n let value = tracker.move('[')\n const text = state.containerPhrasing(node, {\n before: value,\n after: ']',\n ...tracker.current()\n })\n value += tracker.move(text + '][')\n\n subexit()\n // Hide the fact that we\u2019re in phrasing, because escapes don\u2019t work.\n const stack = state.stack\n state.stack = []\n subexit = state.enter('reference')\n // Note: for proper tracking, we should reset the output positions when we end\n // up making a `shortcut` reference, because then there is no brace output.\n // Practically, in that case, there is no content, so it doesn\u2019t matter that\n // we\u2019ve tracked one too many characters.\n const reference = state.safe(state.associationId(node), {\n before: value,\n after: ']',\n ...tracker.current()\n })\n subexit()\n state.stack = stack\n exit()\n\n if (type === 'full' || !text || text !== reference) {\n value += tracker.move(reference + ']')\n } else if (type === 'shortcut') {\n // Remove the unwanted `[`.\n value = value.slice(0, -1)\n } else {\n value += tracker.move(']')\n }\n\n return value\n}\n\n/**\n * @returns {string}\n */\nfunction linkReferencePeek() {\n return '['\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkBullet(state) {\n const marker = state.options.bullet || '*'\n\n if (marker !== '*' && marker !== '+' && marker !== '-') {\n throw new Error(\n 'Cannot serialize items with `' +\n marker +\n '` for `options.bullet`, expected `*`, `+`, or `-`'\n )\n }\n\n return marker\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\nimport {checkBullet} from './check-bullet.js'\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkBulletOther(state) {\n const bullet = checkBullet(state)\n const bulletOther = state.options.bulletOther\n\n if (!bulletOther) {\n return bullet === '*' ? '-' : '*'\n }\n\n if (bulletOther !== '*' && bulletOther !== '+' && bulletOther !== '-') {\n throw new Error(\n 'Cannot serialize items with `' +\n bulletOther +\n '` for `options.bulletOther`, expected `*`, `+`, or `-`'\n )\n }\n\n if (bulletOther === bullet) {\n throw new Error(\n 'Expected `bullet` (`' +\n bullet +\n '`) and `bulletOther` (`' +\n bulletOther +\n '`) to be different'\n )\n }\n\n return bulletOther\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkBulletOrdered(state) {\n const marker = state.options.bulletOrdered || '.'\n\n if (marker !== '.' && marker !== ')') {\n throw new Error(\n 'Cannot serialize items with `' +\n marker +\n '` for `options.bulletOrdered`, expected `.` or `)`'\n )\n }\n\n return marker\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkRule(state) {\n const marker = state.options.rule || '*'\n\n if (marker !== '*' && marker !== '-' && marker !== '_') {\n throw new Error(\n 'Cannot serialize rules with `' +\n marker +\n '` for `options.rule`, expected `*`, `-`, or `_`'\n )\n }\n\n return marker\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {List, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkBulletOther} from '../util/check-bullet-other.js'\nimport {checkBulletOrdered} from '../util/check-bullet-ordered.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {List} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function list(node, parent, state, info) {\n const exit = state.enter('list')\n const bulletCurrent = state.bulletCurrent\n /** @type {string} */\n let bullet = node.ordered ? checkBulletOrdered(state) : checkBullet(state)\n /** @type {string} */\n const bulletOther = node.ordered\n ? bullet === '.'\n ? ')'\n : '.'\n : checkBulletOther(state)\n let useDifferentMarker =\n parent && state.bulletLastUsed ? bullet === state.bulletLastUsed : false\n\n if (!node.ordered) {\n const firstListItem = node.children ? node.children[0] : undefined\n\n // If there\u2019s an empty first list item directly in two list items,\n // we have to use a different bullet:\n //\n // ```markdown\n // * - *\n // ```\n //\n // \u2026because otherwise it would become one big thematic break.\n if (\n // Bullet could be used as a thematic break marker:\n (bullet === '*' || bullet === '-') &&\n // Empty first list item:\n firstListItem &&\n (!firstListItem.children || !firstListItem.children[0]) &&\n // Directly in two other list items:\n state.stack[state.stack.length - 1] === 'list' &&\n state.stack[state.stack.length - 2] === 'listItem' &&\n state.stack[state.stack.length - 3] === 'list' &&\n state.stack[state.stack.length - 4] === 'listItem' &&\n // That are each the first child.\n state.indexStack[state.indexStack.length - 1] === 0 &&\n state.indexStack[state.indexStack.length - 2] === 0 &&\n state.indexStack[state.indexStack.length - 3] === 0\n ) {\n useDifferentMarker = true\n }\n\n // If there\u2019s a thematic break at the start of the first list item,\n // we have to use a different bullet:\n //\n // ```markdown\n // * ---\n // ```\n //\n // \u2026because otherwise it would become one big thematic break.\n if (checkRule(state) === bullet && firstListItem) {\n let index = -1\n\n while (++index < node.children.length) {\n const item = node.children[index]\n\n if (\n item &&\n item.type === 'listItem' &&\n item.children &&\n item.children[0] &&\n item.children[0].type === 'thematicBreak'\n ) {\n useDifferentMarker = true\n break\n }\n }\n }\n }\n\n if (useDifferentMarker) {\n bullet = bulletOther\n }\n\n state.bulletCurrent = bullet\n const value = state.containerFlow(node, info)\n state.bulletLastUsed = bullet\n state.bulletCurrent = bulletCurrent\n exit()\n return value\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkListItemIndent(state) {\n const style = state.options.listItemIndent || 'one'\n\n if (style !== 'tab' && style !== 'one' && style !== 'mixed') {\n throw new Error(\n 'Cannot serialize items with `' +\n style +\n '` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`'\n )\n }\n\n return style\n}\n", "/**\n * @import {Info, Map, State} from 'mdast-util-to-markdown'\n * @import {ListItem, Parents} from 'mdast'\n */\n\nimport {checkBullet} from '../util/check-bullet.js'\nimport {checkListItemIndent} from '../util/check-list-item-indent.js'\n\n/**\n * @param {ListItem} node\n * @param {Parents | undefined} parent\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function listItem(node, parent, state, info) {\n const listItemIndent = checkListItemIndent(state)\n let bullet = state.bulletCurrent || checkBullet(state)\n\n // Add the marker value for ordered lists.\n if (parent && parent.type === 'list' && parent.ordered) {\n bullet =\n (typeof parent.start === 'number' && parent.start > -1\n ? parent.start\n : 1) +\n (state.options.incrementListMarker === false\n ? 0\n : parent.children.indexOf(node)) +\n bullet\n }\n\n let size = bullet.length + 1\n\n if (\n listItemIndent === 'tab' ||\n (listItemIndent === 'mixed' &&\n ((parent && parent.type === 'list' && parent.spread) || node.spread))\n ) {\n size = Math.ceil(size / 4) * 4\n }\n\n const tracker = state.createTracker(info)\n tracker.move(bullet + ' '.repeat(size - bullet.length))\n tracker.shift(size)\n const exit = state.enter('listItem')\n const value = state.indentLines(\n state.containerFlow(node, tracker.current()),\n map\n )\n exit()\n\n return value\n\n /** @type {Map} */\n function map(line, index, blank) {\n if (index) {\n return (blank ? '' : ' '.repeat(size)) + line\n }\n\n return (blank ? bullet : bullet + ' '.repeat(size - bullet.length)) + line\n }\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Paragraph, Parents} from 'mdast'\n */\n\n/**\n * @param {Paragraph} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function paragraph(node, _, state, info) {\n const exit = state.enter('paragraph')\n const subexit = state.enter('phrasing')\n const value = state.containerPhrasing(node, info)\n subexit()\n exit()\n return value\n}\n", "/**\n * @typedef {import('mdast').Html} Html\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n */\n\nimport {convert} from 'unist-util-is'\n\n/**\n * Check if the given value is *phrasing content*.\n *\n * > \uD83D\uDC49 **Note**: Excludes `html`, which can be both phrasing or flow.\n *\n * @param node\n * Thing to check, typically `Node`.\n * @returns\n * Whether `value` is phrasing content.\n */\n\nexport const phrasing =\n /** @type {(node?: unknown) => node is Exclude} */\n (\n convert([\n 'break',\n 'delete',\n 'emphasis',\n // To do: next major: removed since footnotes were added to GFM.\n 'footnote',\n 'footnoteReference',\n 'image',\n 'imageReference',\n 'inlineCode',\n // Enabled by `mdast-util-math`:\n 'inlineMath',\n 'link',\n 'linkReference',\n // Enabled by `mdast-util-mdx`:\n 'mdxJsxTextElement',\n // Enabled by `mdast-util-mdx`:\n 'mdxTextExpression',\n 'strong',\n 'text',\n // Enabled by `mdast-util-directive`:\n 'textDirective'\n ])\n )\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Root} from 'mdast'\n */\n\nimport {phrasing} from 'mdast-util-phrasing'\n\n/**\n * @param {Root} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function root(node, _, state, info) {\n // Note: `html` nodes are ambiguous.\n const hasPhrasing = node.children.some(function (d) {\n return phrasing(d)\n })\n\n const container = hasPhrasing ? state.containerPhrasing : state.containerFlow\n return container.call(state, node, info)\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkStrong(state) {\n const marker = state.options.strong || '*'\n\n if (marker !== '*' && marker !== '_') {\n throw new Error(\n 'Cannot serialize strong with `' +\n marker +\n '` for `options.strong`, expected `*`, or `_`'\n )\n }\n\n return marker\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Strong} from 'mdast'\n */\n\nimport {checkStrong} from '../util/check-strong.js'\nimport {encodeCharacterReference} from '../util/encode-character-reference.js'\nimport {encodeInfo} from '../util/encode-info.js'\n\nstrong.peek = strongPeek\n\n/**\n * @param {Strong} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function strong(node, _, state, info) {\n const marker = checkStrong(state)\n const exit = state.enter('strong')\n const tracker = state.createTracker(info)\n const before = tracker.move(marker + marker)\n\n let between = tracker.move(\n state.containerPhrasing(node, {\n after: marker,\n before,\n ...tracker.current()\n })\n )\n const betweenHead = between.charCodeAt(0)\n const open = encodeInfo(\n info.before.charCodeAt(info.before.length - 1),\n betweenHead,\n marker\n )\n\n if (open.inside) {\n between = encodeCharacterReference(betweenHead) + between.slice(1)\n }\n\n const betweenTail = between.charCodeAt(between.length - 1)\n const close = encodeInfo(info.after.charCodeAt(0), betweenTail, marker)\n\n if (close.inside) {\n between = between.slice(0, -1) + encodeCharacterReference(betweenTail)\n }\n\n const after = tracker.move(marker + marker)\n\n exit()\n\n state.attentionEncodeSurroundingInfo = {\n after: close.outside,\n before: open.outside\n }\n return before + between + after\n}\n\n/**\n * @param {Strong} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nfunction strongPeek(_, _1, state) {\n return state.options.strong || '*'\n}\n", "/**\n * @import {Info, State} from 'mdast-util-to-markdown'\n * @import {Parents, Text} from 'mdast'\n */\n\n/**\n * @param {Text} node\n * @param {Parents | undefined} _\n * @param {State} state\n * @param {Info} info\n * @returns {string}\n */\nexport function text(node, _, state, info) {\n return state.safe(node.value, info)\n}\n", "/**\n * @import {Options, State} from 'mdast-util-to-markdown'\n */\n\n/**\n * @param {State} state\n * @returns {Exclude}\n */\nexport function checkRuleRepetition(state) {\n const repetition = state.options.ruleRepetition || 3\n\n if (repetition < 3) {\n throw new Error(\n 'Cannot serialize rules with repetition `' +\n repetition +\n '` for `options.ruleRepetition`, expected `3` or more'\n )\n }\n\n return repetition\n}\n", "/**\n * @import {State} from 'mdast-util-to-markdown'\n * @import {Parents, ThematicBreak} from 'mdast'\n */\n\nimport {checkRuleRepetition} from '../util/check-rule-repetition.js'\nimport {checkRule} from '../util/check-rule.js'\n\n/**\n * @param {ThematicBreak} _\n * @param {Parents | undefined} _1\n * @param {State} state\n * @returns {string}\n */\nexport function thematicBreak(_, _1, state) {\n const value = (\n checkRule(state) + (state.options.ruleSpaces ? ' ' : '')\n ).repeat(checkRuleRepetition(state))\n\n return state.options.ruleSpaces ? value.slice(0, -1) : value\n}\n", "import {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {definition} from './definition.js'\nimport {emphasis} from './emphasis.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {image} from './image.js'\nimport {imageReference} from './image-reference.js'\nimport {inlineCode} from './inline-code.js'\nimport {link} from './link.js'\nimport {linkReference} from './link-reference.js'\nimport {list} from './list.js'\nimport {listItem} from './list-item.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default (CommonMark) handlers.\n */\nexport const handle = {\n blockquote,\n break: hardBreak,\n code,\n definition,\n emphasis,\n hardBreak,\n heading,\n html,\n image,\n imageReference,\n inlineCode,\n link,\n linkReference,\n list,\n listItem,\n paragraph,\n root,\n strong,\n text,\n thematicBreak\n}\n", "/**\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('mdast').Table} Table\n * @typedef {import('mdast').TableCell} TableCell\n * @typedef {import('mdast').TableRow} TableRow\n *\n * @typedef {import('markdown-table').Options} MarkdownTableOptions\n *\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n *\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').State} State\n * @typedef {import('mdast-util-to-markdown').Info} Info\n */\n\n/**\n * @typedef Options\n * Configuration.\n * @property {boolean | null | undefined} [tableCellPadding=true]\n * Whether to add a space of padding between delimiters and cells (default:\n * `true`).\n * @property {boolean | null | undefined} [tablePipeAlign=true]\n * Whether to align the delimiters (default: `true`).\n * @property {MarkdownTableOptions['stringLength'] | null | undefined} [stringLength]\n * Function to detect the length of table cell content, used when aligning\n * the delimiters between cells (optional).\n */\n\nimport {ok as assert} from 'devlop'\nimport {markdownTable} from 'markdown-table'\nimport {defaultHandlers} from 'mdast-util-to-markdown'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM tables in\n * markdown.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-from-markdown` to enable GFM tables.\n */\nexport function gfmTableFromMarkdown() {\n return {\n enter: {\n table: enterTable,\n tableData: enterCell,\n tableHeader: enterCell,\n tableRow: enterRow\n },\n exit: {\n codeText: exitCodeText,\n table: exitTable,\n tableData: exit,\n tableHeader: exit,\n tableRow: exit\n }\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterTable(token) {\n const align = token._align\n assert(align, 'expected `_align` on table')\n this.enter(\n {\n type: 'table',\n align: align.map(function (d) {\n return d === 'none' ? null : d\n }),\n children: []\n },\n token\n )\n this.data.inTable = true\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitTable(token) {\n this.exit(token)\n this.data.inTable = undefined\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterRow(token) {\n this.enter({type: 'tableRow', children: []}, token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exit(token) {\n this.exit(token)\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction enterCell(token) {\n this.enter({type: 'tableCell', children: []}, token)\n}\n\n// Overwrite the default code text data handler to unescape escaped pipes when\n// they are in tables.\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitCodeText(token) {\n let value = this.resume()\n\n if (this.data.inTable) {\n value = value.replace(/\\\\([\\\\|])/g, replace)\n }\n\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'inlineCode')\n node.value = value\n this.exit(token)\n}\n\n/**\n * @param {string} $0\n * @param {string} $1\n * @returns {string}\n */\nfunction replace($0, $1) {\n // Pipes work, backslashes don\u2019t (but can\u2019t escape pipes).\n return $1 === '|' ? $1 : $0\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM tables in\n * markdown.\n *\n * @param {Options | null | undefined} [options]\n * Configuration.\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable GFM tables.\n */\nexport function gfmTableToMarkdown(options) {\n const settings = options || {}\n const padding = settings.tableCellPadding\n const alignDelimiters = settings.tablePipeAlign\n const stringLength = settings.stringLength\n const around = padding ? ' ' : '|'\n\n return {\n unsafe: [\n {character: '\\r', inConstruct: 'tableCell'},\n {character: '\\n', inConstruct: 'tableCell'},\n // A pipe, when followed by a tab or space (padding), or a dash or colon\n // (unpadded delimiter row), could result in a table.\n {atBreak: true, character: '|', after: '[\\t :-]'},\n // A pipe in a cell must be encoded.\n {character: '|', inConstruct: 'tableCell'},\n // A colon must be followed by a dash, in which case it could start a\n // delimiter row.\n {atBreak: true, character: ':', after: '-'},\n // A delimiter row can also start with a dash, when followed by more\n // dashes, a colon, or a pipe.\n // This is a stricter version than the built in check for lists, thematic\n // breaks, and setex heading underlines though:\n // \n {atBreak: true, character: '-', after: '[:|-]'}\n ],\n handlers: {\n inlineCode: inlineCodeWithTable,\n table: handleTable,\n tableCell: handleTableCell,\n tableRow: handleTableRow\n }\n }\n\n /**\n * @type {ToMarkdownHandle}\n * @param {Table} node\n */\n function handleTable(node, _, state, info) {\n return serializeData(handleTableAsData(node, state, info), node.align)\n }\n\n /**\n * This function isn\u2019t really used normally, because we handle rows at the\n * table level.\n * But, if someone passes in a table row, this ensures we make somewhat sense.\n *\n * @type {ToMarkdownHandle}\n * @param {TableRow} node\n */\n function handleTableRow(node, _, state, info) {\n const row = handleTableRowAsData(node, state, info)\n const value = serializeData([row])\n // `markdown-table` will always add an align row\n return value.slice(0, value.indexOf('\\n'))\n }\n\n /**\n * @type {ToMarkdownHandle}\n * @param {TableCell} node\n */\n function handleTableCell(node, _, state, info) {\n const exit = state.enter('tableCell')\n const subexit = state.enter('phrasing')\n const value = state.containerPhrasing(node, {\n ...info,\n before: around,\n after: around\n })\n subexit()\n exit()\n return value\n }\n\n /**\n * @param {Array>} matrix\n * @param {Array | null | undefined} [align]\n */\n function serializeData(matrix, align) {\n return markdownTable(matrix, {\n align,\n // @ts-expect-error: `markdown-table` types should support `null`.\n alignDelimiters,\n // @ts-expect-error: `markdown-table` types should support `null`.\n padding,\n // @ts-expect-error: `markdown-table` types should support `null`.\n stringLength\n })\n }\n\n /**\n * @param {Table} node\n * @param {State} state\n * @param {Info} info\n */\n function handleTableAsData(node, state, info) {\n const children = node.children\n let index = -1\n /** @type {Array>} */\n const result = []\n const subexit = state.enter('table')\n\n while (++index < children.length) {\n result[index] = handleTableRowAsData(children[index], state, info)\n }\n\n subexit()\n\n return result\n }\n\n /**\n * @param {TableRow} node\n * @param {State} state\n * @param {Info} info\n */\n function handleTableRowAsData(node, state, info) {\n const children = node.children\n let index = -1\n /** @type {Array} */\n const result = []\n const subexit = state.enter('tableRow')\n\n while (++index < children.length) {\n // Note: the positional info as used here is incorrect.\n // Making it correct would be impossible due to aligning cells?\n // And it would need copy/pasting `markdown-table` into this project.\n result[index] = handleTableCell(children[index], node, state, info)\n }\n\n subexit()\n\n return result\n }\n\n /**\n * @type {ToMarkdownHandle}\n * @param {InlineCode} node\n */\n function inlineCodeWithTable(node, parent, state) {\n let value = defaultHandlers.inlineCode(node, parent, state)\n\n if (state.stack.includes('tableCell')) {\n value = value.replace(/\\|/g, '\\\\$&')\n }\n\n return value\n }\n}\n", "/**\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('mdast-util-from-markdown').CompileContext} CompileContext\n * @typedef {import('mdast-util-from-markdown').Extension} FromMarkdownExtension\n * @typedef {import('mdast-util-from-markdown').Handle} FromMarkdownHandle\n * @typedef {import('mdast-util-to-markdown').Options} ToMarkdownExtension\n * @typedef {import('mdast-util-to-markdown').Handle} ToMarkdownHandle\n */\n\nimport {ok as assert} from 'devlop'\nimport {defaultHandlers} from 'mdast-util-to-markdown'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM task\n * list items in markdown.\n *\n * @returns {FromMarkdownExtension}\n * Extension for `mdast-util-from-markdown` to enable GFM task list items.\n */\nexport function gfmTaskListItemFromMarkdown() {\n return {\n exit: {\n taskListCheckValueChecked: exitCheck,\n taskListCheckValueUnchecked: exitCheck,\n paragraph: exitParagraphWithTaskListItem\n }\n }\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM task list\n * items in markdown.\n *\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable GFM task list items.\n */\nexport function gfmTaskListItemToMarkdown() {\n return {\n unsafe: [{atBreak: true, character: '-', after: '[:|-]'}],\n handlers: {listItem: listItemWithTaskListItem}\n }\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitCheck(token) {\n // We\u2019re always in a paragraph, in a list item.\n const node = this.stack[this.stack.length - 2]\n assert(node.type === 'listItem')\n node.checked = token.type === 'taskListCheckValueChecked'\n}\n\n/**\n * @this {CompileContext}\n * @type {FromMarkdownHandle}\n */\nfunction exitParagraphWithTaskListItem(token) {\n const parent = this.stack[this.stack.length - 2]\n\n if (\n parent &&\n parent.type === 'listItem' &&\n typeof parent.checked === 'boolean'\n ) {\n const node = this.stack[this.stack.length - 1]\n assert(node.type === 'paragraph')\n const head = node.children[0]\n\n if (head && head.type === 'text') {\n const siblings = parent.children\n let index = -1\n /** @type {Paragraph | undefined} */\n let firstParaghraph\n\n while (++index < siblings.length) {\n const sibling = siblings[index]\n if (sibling.type === 'paragraph') {\n firstParaghraph = sibling\n break\n }\n }\n\n if (firstParaghraph === node) {\n // Must start with a space or a tab.\n head.value = head.value.slice(1)\n\n if (head.value.length === 0) {\n node.children.shift()\n } else if (\n node.position &&\n head.position &&\n typeof head.position.start.offset === 'number'\n ) {\n head.position.start.column++\n head.position.start.offset++\n node.position.start = Object.assign({}, head.position.start)\n }\n }\n }\n }\n\n this.exit(token)\n}\n\n/**\n * @type {ToMarkdownHandle}\n * @param {ListItem} node\n */\nfunction listItemWithTaskListItem(node, parent, state, info) {\n const head = node.children[0]\n const checkable =\n typeof node.checked === 'boolean' && head && head.type === 'paragraph'\n const checkbox = '[' + (node.checked ? 'x' : ' ') + '] '\n const tracker = state.createTracker(info)\n\n if (checkable) {\n tracker.move(checkbox)\n }\n\n let value = defaultHandlers.listItem(node, parent, state, {\n ...info,\n ...tracker.current()\n })\n\n if (checkable) {\n value = value.replace(/^(?:[*+-]|\\d+\\.)([\\r\\n]| {1,3})/, check)\n }\n\n return value\n\n /**\n * @param {string} $0\n * @returns {string}\n */\n function check($0) {\n return $0 + checkbox\n }\n}\n", "/**\n * @import {Extension as FromMarkdownExtension} from 'mdast-util-from-markdown'\n * @import {Options} from 'mdast-util-gfm'\n * @import {Options as ToMarkdownExtension} from 'mdast-util-to-markdown'\n */\n\nimport {\n gfmAutolinkLiteralFromMarkdown,\n gfmAutolinkLiteralToMarkdown\n} from 'mdast-util-gfm-autolink-literal'\nimport {\n gfmFootnoteFromMarkdown,\n gfmFootnoteToMarkdown\n} from 'mdast-util-gfm-footnote'\nimport {\n gfmStrikethroughFromMarkdown,\n gfmStrikethroughToMarkdown\n} from 'mdast-util-gfm-strikethrough'\nimport {gfmTableFromMarkdown, gfmTableToMarkdown} from 'mdast-util-gfm-table'\nimport {\n gfmTaskListItemFromMarkdown,\n gfmTaskListItemToMarkdown\n} from 'mdast-util-gfm-task-list-item'\n\n/**\n * Create an extension for `mdast-util-from-markdown` to enable GFM (autolink\n * literals, footnotes, strikethrough, tables, tasklists).\n *\n * @returns {Array}\n * Extension for `mdast-util-from-markdown` to enable GFM (autolink literals,\n * footnotes, strikethrough, tables, tasklists).\n */\nexport function gfmFromMarkdown() {\n return [\n gfmAutolinkLiteralFromMarkdown(),\n gfmFootnoteFromMarkdown(),\n gfmStrikethroughFromMarkdown(),\n gfmTableFromMarkdown(),\n gfmTaskListItemFromMarkdown()\n ]\n}\n\n/**\n * Create an extension for `mdast-util-to-markdown` to enable GFM (autolink\n * literals, footnotes, strikethrough, tables, tasklists).\n *\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {ToMarkdownExtension}\n * Extension for `mdast-util-to-markdown` to enable GFM (autolink literals,\n * footnotes, strikethrough, tables, tasklists).\n */\nexport function gfmToMarkdown(options) {\n return {\n extensions: [\n gfmAutolinkLiteralToMarkdown(),\n gfmFootnoteToMarkdown(options),\n gfmStrikethroughToMarkdown(),\n gfmTableToMarkdown(options),\n gfmTaskListItemToMarkdown()\n ]\n }\n}\n", "/**\n * @import {Code, ConstructRecord, Event, Extension, Previous, State, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { asciiAlpha, asciiAlphanumeric, asciiControl, markdownLineEndingOrSpace, unicodePunctuation, unicodeWhitespace } from 'micromark-util-character';\nconst wwwPrefix = {\n tokenize: tokenizeWwwPrefix,\n partial: true\n};\nconst domain = {\n tokenize: tokenizeDomain,\n partial: true\n};\nconst path = {\n tokenize: tokenizePath,\n partial: true\n};\nconst trail = {\n tokenize: tokenizeTrail,\n partial: true\n};\nconst emailDomainDotTrail = {\n tokenize: tokenizeEmailDomainDotTrail,\n partial: true\n};\nconst wwwAutolink = {\n name: 'wwwAutolink',\n tokenize: tokenizeWwwAutolink,\n previous: previousWww\n};\nconst protocolAutolink = {\n name: 'protocolAutolink',\n tokenize: tokenizeProtocolAutolink,\n previous: previousProtocol\n};\nconst emailAutolink = {\n name: 'emailAutolink',\n tokenize: tokenizeEmailAutolink,\n previous: previousEmail\n};\n\n/** @type {ConstructRecord} */\nconst text = {};\n\n/**\n * Create an extension for `micromark` to support GitHub autolink literal\n * syntax.\n *\n * @returns {Extension}\n * Extension for `micromark` that can be passed in `extensions` to enable GFM\n * autolink literal syntax.\n */\nexport function gfmAutolinkLiteral() {\n return {\n text\n };\n}\n\n/** @type {Code} */\nlet code = 48;\n\n// Add alphanumerics.\nwhile (code < 123) {\n text[code] = emailAutolink;\n code++;\n if (code === 58) code = 65;else if (code === 91) code = 97;\n}\ntext[43] = emailAutolink;\ntext[45] = emailAutolink;\ntext[46] = emailAutolink;\ntext[95] = emailAutolink;\ntext[72] = [emailAutolink, protocolAutolink];\ntext[104] = [emailAutolink, protocolAutolink];\ntext[87] = [emailAutolink, wwwAutolink];\ntext[119] = [emailAutolink, wwwAutolink];\n\n// To do: perform email autolink literals on events, afterwards.\n// That\u2019s where `markdown-rs` and `cmark-gfm` perform it.\n// It should look for `@`, then for atext backwards, and then for a label\n// forwards.\n// To do: `mailto:`, `xmpp:` protocol as prefix.\n\n/**\n * Email autolink literal.\n *\n * ```markdown\n * > | a contact@example.org b\n * ^^^^^^^^^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeEmailAutolink(effects, ok, nok) {\n const self = this;\n /** @type {boolean | undefined} */\n let dot;\n /** @type {boolean} */\n let data;\n return start;\n\n /**\n * Start of email autolink literal.\n *\n * ```markdown\n * > | a contact@example.org b\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n if (!gfmAtext(code) || !previousEmail.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code);\n }\n effects.enter('literalAutolink');\n effects.enter('literalAutolinkEmail');\n return atext(code);\n }\n\n /**\n * In email atext.\n *\n * ```markdown\n * > | a contact@example.org b\n * ^\n * ```\n *\n * @type {State}\n */\n function atext(code) {\n if (gfmAtext(code)) {\n effects.consume(code);\n return atext;\n }\n if (code === 64) {\n effects.consume(code);\n return emailDomain;\n }\n return nok(code);\n }\n\n /**\n * In email domain.\n *\n * The reference code is a bit overly complex as it handles the `@`, of which\n * there may be just one.\n * Source: \n *\n * ```markdown\n * > | a contact@example.org b\n * ^\n * ```\n *\n * @type {State}\n */\n function emailDomain(code) {\n // Dot followed by alphanumerical (not `-` or `_`).\n if (code === 46) {\n return effects.check(emailDomainDotTrail, emailDomainAfter, emailDomainDot)(code);\n }\n\n // Alphanumerical, `-`, and `_`.\n if (code === 45 || code === 95 || asciiAlphanumeric(code)) {\n data = true;\n effects.consume(code);\n return emailDomain;\n }\n\n // To do: `/` if xmpp.\n\n // Note: normally we\u2019d truncate trailing punctuation from the link.\n // However, email autolink literals cannot contain any of those markers,\n // except for `.`, but that can only occur if it isn\u2019t trailing.\n // So we can ignore truncating!\n return emailDomainAfter(code);\n }\n\n /**\n * In email domain, on dot that is not a trail.\n *\n * ```markdown\n * > | a contact@example.org b\n * ^\n * ```\n *\n * @type {State}\n */\n function emailDomainDot(code) {\n effects.consume(code);\n dot = true;\n return emailDomain;\n }\n\n /**\n * After email domain.\n *\n * ```markdown\n * > | a contact@example.org b\n * ^\n * ```\n *\n * @type {State}\n */\n function emailDomainAfter(code) {\n // Domain must not be empty, must include a dot, and must end in alphabetical.\n // Source: .\n if (data && dot && asciiAlpha(self.previous)) {\n effects.exit('literalAutolinkEmail');\n effects.exit('literalAutolink');\n return ok(code);\n }\n return nok(code);\n }\n}\n\n/**\n * `www` autolink literal.\n *\n * ```markdown\n * > | a www.example.org b\n * ^^^^^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeWwwAutolink(effects, ok, nok) {\n const self = this;\n return wwwStart;\n\n /**\n * Start of www autolink literal.\n *\n * ```markdown\n * > | www.example.com/a?b#c\n * ^\n * ```\n *\n * @type {State}\n */\n function wwwStart(code) {\n if (code !== 87 && code !== 119 || !previousWww.call(self, self.previous) || previousUnbalanced(self.events)) {\n return nok(code);\n }\n effects.enter('literalAutolink');\n effects.enter('literalAutolinkWww');\n // Note: we *check*, so we can discard the `www.` we parsed.\n // If it worked, we consider it as a part of the domain.\n return effects.check(wwwPrefix, effects.attempt(domain, effects.attempt(path, wwwAfter), nok), nok)(code);\n }\n\n /**\n * After a www autolink literal.\n *\n * ```markdown\n * > | www.example.com/a?b#c\n * ^\n * ```\n *\n * @type {State}\n */\n function wwwAfter(code) {\n effects.exit('literalAutolinkWww');\n effects.exit('literalAutolink');\n return ok(code);\n }\n}\n\n/**\n * Protocol autolink literal.\n *\n * ```markdown\n * > | a https://example.org b\n * ^^^^^^^^^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeProtocolAutolink(effects, ok, nok) {\n const self = this;\n let buffer = '';\n let seen = false;\n return protocolStart;\n\n /**\n * Start of protocol autolink literal.\n *\n * ```markdown\n * > | https://example.com/a?b#c\n * ^\n * ```\n *\n * @type {State}\n */\n function protocolStart(code) {\n if ((code === 72 || code === 104) && previousProtocol.call(self, self.previous) && !previousUnbalanced(self.events)) {\n effects.enter('literalAutolink');\n effects.enter('literalAutolinkHttp');\n buffer += String.fromCodePoint(code);\n effects.consume(code);\n return protocolPrefixInside;\n }\n return nok(code);\n }\n\n /**\n * In protocol.\n *\n * ```markdown\n * > | https://example.com/a?b#c\n * ^^^^^\n * ```\n *\n * @type {State}\n */\n function protocolPrefixInside(code) {\n // `5` is size of `https`\n if (asciiAlpha(code) && buffer.length < 5) {\n // @ts-expect-error: definitely number.\n buffer += String.fromCodePoint(code);\n effects.consume(code);\n return protocolPrefixInside;\n }\n if (code === 58) {\n const protocol = buffer.toLowerCase();\n if (protocol === 'http' || protocol === 'https') {\n effects.consume(code);\n return protocolSlashesInside;\n }\n }\n return nok(code);\n }\n\n /**\n * In slashes.\n *\n * ```markdown\n * > | https://example.com/a?b#c\n * ^^\n * ```\n *\n * @type {State}\n */\n function protocolSlashesInside(code) {\n if (code === 47) {\n effects.consume(code);\n if (seen) {\n return afterProtocol;\n }\n seen = true;\n return protocolSlashesInside;\n }\n return nok(code);\n }\n\n /**\n * After protocol, before domain.\n *\n * ```markdown\n * > | https://example.com/a?b#c\n * ^\n * ```\n *\n * @type {State}\n */\n function afterProtocol(code) {\n // To do: this is different from `markdown-rs`:\n // https://github.com/wooorm/markdown-rs/blob/b3a921c761309ae00a51fe348d8a43adbc54b518/src/construct/gfm_autolink_literal.rs#L172-L182\n return code === null || asciiControl(code) || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || unicodePunctuation(code) ? nok(code) : effects.attempt(domain, effects.attempt(path, protocolAfter), nok)(code);\n }\n\n /**\n * After a protocol autolink literal.\n *\n * ```markdown\n * > | https://example.com/a?b#c\n * ^\n * ```\n *\n * @type {State}\n */\n function protocolAfter(code) {\n effects.exit('literalAutolinkHttp');\n effects.exit('literalAutolink');\n return ok(code);\n }\n}\n\n/**\n * `www` prefix.\n *\n * ```markdown\n * > | a www.example.org b\n * ^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeWwwPrefix(effects, ok, nok) {\n let size = 0;\n return wwwPrefixInside;\n\n /**\n * In www prefix.\n *\n * ```markdown\n * > | www.example.com\n * ^^^^\n * ```\n *\n * @type {State}\n */\n function wwwPrefixInside(code) {\n if ((code === 87 || code === 119) && size < 3) {\n size++;\n effects.consume(code);\n return wwwPrefixInside;\n }\n if (code === 46 && size === 3) {\n effects.consume(code);\n return wwwPrefixAfter;\n }\n return nok(code);\n }\n\n /**\n * After www prefix.\n *\n * ```markdown\n * > | www.example.com\n * ^\n * ```\n *\n * @type {State}\n */\n function wwwPrefixAfter(code) {\n // If there is *anything*, we can link.\n return code === null ? nok(code) : ok(code);\n }\n}\n\n/**\n * Domain.\n *\n * ```markdown\n * > | a https://example.org b\n * ^^^^^^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDomain(effects, ok, nok) {\n /** @type {boolean | undefined} */\n let underscoreInLastSegment;\n /** @type {boolean | undefined} */\n let underscoreInLastLastSegment;\n /** @type {boolean | undefined} */\n let seen;\n return domainInside;\n\n /**\n * In domain.\n *\n * ```markdown\n * > | https://example.com/a\n * ^^^^^^^^^^^\n * ```\n *\n * @type {State}\n */\n function domainInside(code) {\n // Check whether this marker, which is a trailing punctuation\n // marker, optionally followed by more trailing markers, and then\n // followed by an end.\n if (code === 46 || code === 95) {\n return effects.check(trail, domainAfter, domainAtPunctuation)(code);\n }\n\n // GH documents that only alphanumerics (other than `-`, `.`, and `_`) can\n // occur, which sounds like ASCII only, but they also support `www.\u9EDE\u770B.com`,\n // so that\u2019s Unicode.\n // Instead of some new production for Unicode alphanumerics, markdown\n // already has that for Unicode punctuation and whitespace, so use those.\n // Source: .\n if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code) || code !== 45 && unicodePunctuation(code)) {\n return domainAfter(code);\n }\n seen = true;\n effects.consume(code);\n return domainInside;\n }\n\n /**\n * In domain, at potential trailing punctuation, that was not trailing.\n *\n * ```markdown\n * > | https://example.com\n * ^\n * ```\n *\n * @type {State}\n */\n function domainAtPunctuation(code) {\n // There is an underscore in the last segment of the domain\n if (code === 95) {\n underscoreInLastSegment = true;\n }\n // Otherwise, it\u2019s a `.`: save the last segment underscore in the\n // penultimate segment slot.\n else {\n underscoreInLastLastSegment = underscoreInLastSegment;\n underscoreInLastSegment = undefined;\n }\n effects.consume(code);\n return domainInside;\n }\n\n /**\n * After domain.\n *\n * ```markdown\n * > | https://example.com/a\n * ^\n * ```\n *\n * @type {State} */\n function domainAfter(code) {\n // Note: that\u2019s GH says a dot is needed, but it\u2019s not true:\n // \n if (underscoreInLastLastSegment || underscoreInLastSegment || !seen) {\n return nok(code);\n }\n return ok(code);\n }\n}\n\n/**\n * Path.\n *\n * ```markdown\n * > | a https://example.org/stuff b\n * ^^^^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizePath(effects, ok) {\n let sizeOpen = 0;\n let sizeClose = 0;\n return pathInside;\n\n /**\n * In path.\n *\n * ```markdown\n * > | https://example.com/a\n * ^^\n * ```\n *\n * @type {State}\n */\n function pathInside(code) {\n if (code === 40) {\n sizeOpen++;\n effects.consume(code);\n return pathInside;\n }\n\n // To do: `markdown-rs` also needs this.\n // If this is a paren, and there are less closings than openings,\n // we don\u2019t check for a trail.\n if (code === 41 && sizeClose < sizeOpen) {\n return pathAtPunctuation(code);\n }\n\n // Check whether this trailing punctuation marker is optionally\n // followed by more trailing markers, and then followed\n // by an end.\n if (code === 33 || code === 34 || code === 38 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 60 || code === 63 || code === 93 || code === 95 || code === 126) {\n return effects.check(trail, ok, pathAtPunctuation)(code);\n }\n if (code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n return ok(code);\n }\n effects.consume(code);\n return pathInside;\n }\n\n /**\n * In path, at potential trailing punctuation, that was not trailing.\n *\n * ```markdown\n * > | https://example.com/a\"b\n * ^\n * ```\n *\n * @type {State}\n */\n function pathAtPunctuation(code) {\n // Count closing parens.\n if (code === 41) {\n sizeClose++;\n }\n effects.consume(code);\n return pathInside;\n }\n}\n\n/**\n * Trail.\n *\n * This calls `ok` if this *is* the trail, followed by an end, which means\n * the entire trail is not part of the link.\n * It calls `nok` if this *is* part of the link.\n *\n * ```markdown\n * > | https://example.com\").\n * ^^^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTrail(effects, ok, nok) {\n return trail;\n\n /**\n * In trail of domain or path.\n *\n * ```markdown\n * > | https://example.com\").\n * ^\n * ```\n *\n * @type {State}\n */\n function trail(code) {\n // Regular trailing punctuation.\n if (code === 33 || code === 34 || code === 39 || code === 41 || code === 42 || code === 44 || code === 46 || code === 58 || code === 59 || code === 63 || code === 95 || code === 126) {\n effects.consume(code);\n return trail;\n }\n\n // `&` followed by one or more alphabeticals and then a `;`, is\n // as a whole considered as trailing punctuation.\n // In all other cases, it is considered as continuation of the URL.\n if (code === 38) {\n effects.consume(code);\n return trailCharacterReferenceStart;\n }\n\n // Needed because we allow literals after `[`, as we fix:\n // .\n // Check that it is not followed by `(` or `[`.\n if (code === 93) {\n effects.consume(code);\n return trailBracketAfter;\n }\n if (\n // `<` is an end.\n code === 60 ||\n // So is whitespace.\n code === null || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n return ok(code);\n }\n return nok(code);\n }\n\n /**\n * In trail, after `]`.\n *\n * > \uD83D\uDC49 **Note**: this deviates from `cmark-gfm` to fix a bug.\n * > See end of for more.\n *\n * ```markdown\n * > | https://example.com](\n * ^\n * ```\n *\n * @type {State}\n */\n function trailBracketAfter(code) {\n // Whitespace or something that could start a resource or reference is the end.\n // Switch back to trail otherwise.\n if (code === null || code === 40 || code === 91 || markdownLineEndingOrSpace(code) || unicodeWhitespace(code)) {\n return ok(code);\n }\n return trail(code);\n }\n\n /**\n * In character-reference like trail, after `&`.\n *\n * ```markdown\n * > | https://example.com&).\n * ^\n * ```\n *\n * @type {State}\n */\n function trailCharacterReferenceStart(code) {\n // When non-alpha, it\u2019s not a trail.\n return asciiAlpha(code) ? trailCharacterReferenceInside(code) : nok(code);\n }\n\n /**\n * In character-reference like trail.\n *\n * ```markdown\n * > | https://example.com&).\n * ^\n * ```\n *\n * @type {State}\n */\n function trailCharacterReferenceInside(code) {\n // Switch back to trail if this is well-formed.\n if (code === 59) {\n effects.consume(code);\n return trail;\n }\n if (asciiAlpha(code)) {\n effects.consume(code);\n return trailCharacterReferenceInside;\n }\n\n // It\u2019s not a trail.\n return nok(code);\n }\n}\n\n/**\n * Dot in email domain trail.\n *\n * This calls `ok` if this *is* the trail, followed by an end, which means\n * the trail is not part of the link.\n * It calls `nok` if this *is* part of the link.\n *\n * ```markdown\n * > | contact@example.org.\n * ^\n * ```\n *\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeEmailDomainDotTrail(effects, ok, nok) {\n return start;\n\n /**\n * Dot.\n *\n * ```markdown\n * > | contact@example.org.\n * ^ ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n // Must be dot.\n effects.consume(code);\n return after;\n }\n\n /**\n * After dot.\n *\n * ```markdown\n * > | contact@example.org.\n * ^ ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // Not a trail if alphanumeric.\n return asciiAlphanumeric(code) ? nok(code) : ok(code);\n }\n}\n\n/**\n * See:\n * .\n *\n * @type {Previous}\n */\nfunction previousWww(code) {\n return code === null || code === 40 || code === 42 || code === 95 || code === 91 || code === 93 || code === 126 || markdownLineEndingOrSpace(code);\n}\n\n/**\n * See:\n * .\n *\n * @type {Previous}\n */\nfunction previousProtocol(code) {\n return !asciiAlpha(code);\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Previous}\n */\nfunction previousEmail(code) {\n // Do not allow a slash \u201Cinside\u201D atext.\n // The reference code is a bit weird, but that\u2019s what it results in.\n // Source: .\n // Other than slash, every preceding character is allowed.\n return !(code === 47 || gfmAtext(code));\n}\n\n/**\n * @param {Code} code\n * @returns {boolean}\n */\nfunction gfmAtext(code) {\n return code === 43 || code === 45 || code === 46 || code === 95 || asciiAlphanumeric(code);\n}\n\n/**\n * @param {Array} events\n * @returns {boolean}\n */\nfunction previousUnbalanced(events) {\n let index = events.length;\n let result = false;\n while (index--) {\n const token = events[index][1];\n if ((token.type === 'labelLink' || token.type === 'labelImage') && !token._balanced) {\n result = true;\n break;\n }\n\n // If we\u2019ve seen this token, and it was marked as not having any unbalanced\n // bracket before it, we can exit.\n if (token._gfmAutolinkLiteralWalkedInto) {\n result = false;\n break;\n }\n }\n if (events.length > 0 && !result) {\n // Mark the last token as \u201Cwalked into\u201D w/o finding\n // anything.\n events[events.length - 1][1]._gfmAutolinkLiteralWalkedInto = true;\n }\n return result;\n}", "/**\n * @import {Event, Exiter, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { blankLine } from 'micromark-core-commonmark';\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEndingOrSpace } from 'micromark-util-character';\nimport { normalizeIdentifier } from 'micromark-util-normalize-identifier';\nconst indent = {\n tokenize: tokenizeIndent,\n partial: true\n};\n\n// To do: micromark should support a `_hiddenGfmFootnoteSupport`, which only\n// affects label start (image).\n// That will let us drop `tokenizePotentialGfmFootnote*`.\n// It currently has a `_hiddenFootnoteSupport`, which affects that and more.\n// That can be removed when `micromark-extension-footnote` is archived.\n\n/**\n * Create an extension for `micromark` to enable GFM footnote syntax.\n *\n * @returns {Extension}\n * Extension for `micromark` that can be passed in `extensions` to\n * enable GFM footnote syntax.\n */\nexport function gfmFootnote() {\n /** @type {Extension} */\n return {\n document: {\n [91]: {\n name: 'gfmFootnoteDefinition',\n tokenize: tokenizeDefinitionStart,\n continuation: {\n tokenize: tokenizeDefinitionContinuation\n },\n exit: gfmFootnoteDefinitionEnd\n }\n },\n text: {\n [91]: {\n name: 'gfmFootnoteCall',\n tokenize: tokenizeGfmFootnoteCall\n },\n [93]: {\n name: 'gfmPotentialFootnoteCall',\n add: 'after',\n tokenize: tokenizePotentialGfmFootnoteCall,\n resolveTo: resolveToPotentialGfmFootnoteCall\n }\n }\n };\n}\n\n// To do: remove after micromark update.\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizePotentialGfmFootnoteCall(effects, ok, nok) {\n const self = this;\n let index = self.events.length;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n /** @type {Token} */\n let labelStart;\n\n // Find an opening.\n while (index--) {\n const token = self.events[index][1];\n if (token.type === \"labelImage\") {\n labelStart = token;\n break;\n }\n\n // Exit if we\u2019ve walked far enough.\n if (token.type === 'gfmFootnoteCall' || token.type === \"labelLink\" || token.type === \"label\" || token.type === \"image\" || token.type === \"link\") {\n break;\n }\n }\n return start;\n\n /**\n * @type {State}\n */\n function start(code) {\n if (!labelStart || !labelStart._balanced) {\n return nok(code);\n }\n const id = normalizeIdentifier(self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n }));\n if (id.codePointAt(0) !== 94 || !defined.includes(id.slice(1))) {\n return nok(code);\n }\n effects.enter('gfmFootnoteCallLabelMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteCallLabelMarker');\n return ok(code);\n }\n}\n\n// To do: remove after micromark update.\n/** @type {Resolver} */\nfunction resolveToPotentialGfmFootnoteCall(events, context) {\n let index = events.length;\n /** @type {Token | undefined} */\n let labelStart;\n\n // Find an opening.\n while (index--) {\n if (events[index][1].type === \"labelImage\" && events[index][0] === 'enter') {\n labelStart = events[index][1];\n break;\n }\n }\n // Change the `labelImageMarker` to a `data`.\n events[index + 1][1].type = \"data\";\n events[index + 3][1].type = 'gfmFootnoteCallLabelMarker';\n\n // The whole (without `!`):\n /** @type {Token} */\n const call = {\n type: 'gfmFootnoteCall',\n start: Object.assign({}, events[index + 3][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n };\n // The `^` marker\n /** @type {Token} */\n const marker = {\n type: 'gfmFootnoteCallMarker',\n start: Object.assign({}, events[index + 3][1].end),\n end: Object.assign({}, events[index + 3][1].end)\n };\n // Increment the end 1 character.\n marker.end.column++;\n marker.end.offset++;\n marker.end._bufferIndex++;\n /** @type {Token} */\n const string = {\n type: 'gfmFootnoteCallString',\n start: Object.assign({}, marker.end),\n end: Object.assign({}, events[events.length - 1][1].start)\n };\n /** @type {Token} */\n const chunk = {\n type: \"chunkString\",\n contentType: 'string',\n start: Object.assign({}, string.start),\n end: Object.assign({}, string.end)\n };\n\n /** @type {Array} */\n const replacement = [\n // Take the `labelImageMarker` (now `data`, the `!`)\n events[index + 1], events[index + 2], ['enter', call, context],\n // The `[`\n events[index + 3], events[index + 4],\n // The `^`.\n ['enter', marker, context], ['exit', marker, context],\n // Everything in between.\n ['enter', string, context], ['enter', chunk, context], ['exit', chunk, context], ['exit', string, context],\n // The ending (`]`, properly parsed and labelled).\n events[events.length - 2], events[events.length - 1], ['exit', call, context]];\n events.splice(index, events.length - index + 1, ...replacement);\n return events;\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeGfmFootnoteCall(effects, ok, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n let size = 0;\n /** @type {boolean} */\n let data;\n\n // Note: the implementation of `markdown-rs` is different, because it houses\n // core *and* extensions in one project.\n // Therefore, it can include footnote logic inside `label-end`.\n // We can\u2019t do that, but luckily, we can parse footnotes in a simpler way than\n // needed for labels.\n return start;\n\n /**\n * Start of footnote label.\n *\n * ```markdown\n * > | a [^b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter('gfmFootnoteCall');\n effects.enter('gfmFootnoteCallLabelMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteCallLabelMarker');\n return callStart;\n }\n\n /**\n * After `[`, at `^`.\n *\n * ```markdown\n * > | a [^b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function callStart(code) {\n if (code !== 94) return nok(code);\n effects.enter('gfmFootnoteCallMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteCallMarker');\n effects.enter('gfmFootnoteCallString');\n effects.enter('chunkString').contentType = 'string';\n return callData;\n }\n\n /**\n * In label.\n *\n * ```markdown\n * > | a [^b] c\n * ^\n * ```\n *\n * @type {State}\n */\n function callData(code) {\n if (\n // Too long.\n size > 999 ||\n // Closing brace with nothing.\n code === 93 && !data ||\n // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code === null || code === 91 || markdownLineEndingOrSpace(code)) {\n return nok(code);\n }\n if (code === 93) {\n effects.exit('chunkString');\n const token = effects.exit('gfmFootnoteCallString');\n if (!defined.includes(normalizeIdentifier(self.sliceSerialize(token)))) {\n return nok(code);\n }\n effects.enter('gfmFootnoteCallLabelMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteCallLabelMarker');\n effects.exit('gfmFootnoteCall');\n return ok;\n }\n if (!markdownLineEndingOrSpace(code)) {\n data = true;\n }\n size++;\n effects.consume(code);\n return code === 92 ? callEscape : callData;\n }\n\n /**\n * On character after escape.\n *\n * ```markdown\n * > | a [^b\\c] d\n * ^\n * ```\n *\n * @type {State}\n */\n function callEscape(code) {\n if (code === 91 || code === 92 || code === 93) {\n effects.consume(code);\n size++;\n return callData;\n }\n return callData(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDefinitionStart(effects, ok, nok) {\n const self = this;\n const defined = self.parser.gfmFootnotes || (self.parser.gfmFootnotes = []);\n /** @type {string} */\n let identifier;\n let size = 0;\n /** @type {boolean | undefined} */\n let data;\n return start;\n\n /**\n * Start of GFM footnote definition.\n *\n * ```markdown\n * > | [^a]: b\n * ^\n * ```\n *\n * @type {State}\n */\n function start(code) {\n effects.enter('gfmFootnoteDefinition')._container = true;\n effects.enter('gfmFootnoteDefinitionLabel');\n effects.enter('gfmFootnoteDefinitionLabelMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteDefinitionLabelMarker');\n return labelAtMarker;\n }\n\n /**\n * In label, at caret.\n *\n * ```markdown\n * > | [^a]: b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelAtMarker(code) {\n if (code === 94) {\n effects.enter('gfmFootnoteDefinitionMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteDefinitionMarker');\n effects.enter('gfmFootnoteDefinitionLabelString');\n effects.enter('chunkString').contentType = 'string';\n return labelInside;\n }\n return nok(code);\n }\n\n /**\n * In label.\n *\n * > \uD83D\uDC49 **Note**: `cmark-gfm` prevents whitespace from occurring in footnote\n * > definition labels.\n *\n * ```markdown\n * > | [^a]: b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelInside(code) {\n if (\n // Too long.\n size > 999 ||\n // Closing brace with nothing.\n code === 93 && !data ||\n // Space or tab is not supported by GFM for some reason.\n // `\\n` and `[` not being supported makes sense.\n code === null || code === 91 || markdownLineEndingOrSpace(code)) {\n return nok(code);\n }\n if (code === 93) {\n effects.exit('chunkString');\n const token = effects.exit('gfmFootnoteDefinitionLabelString');\n identifier = normalizeIdentifier(self.sliceSerialize(token));\n effects.enter('gfmFootnoteDefinitionLabelMarker');\n effects.consume(code);\n effects.exit('gfmFootnoteDefinitionLabelMarker');\n effects.exit('gfmFootnoteDefinitionLabel');\n return labelAfter;\n }\n if (!markdownLineEndingOrSpace(code)) {\n data = true;\n }\n size++;\n effects.consume(code);\n return code === 92 ? labelEscape : labelInside;\n }\n\n /**\n * After `\\`, at a special character.\n *\n * > \uD83D\uDC49 **Note**: `cmark-gfm` currently does not support escaped brackets:\n * > \n *\n * ```markdown\n * > | [^a\\*b]: c\n * ^\n * ```\n *\n * @type {State}\n */\n function labelEscape(code) {\n if (code === 91 || code === 92 || code === 93) {\n effects.consume(code);\n size++;\n return labelInside;\n }\n return labelInside(code);\n }\n\n /**\n * After definition label.\n *\n * ```markdown\n * > | [^a]: b\n * ^\n * ```\n *\n * @type {State}\n */\n function labelAfter(code) {\n if (code === 58) {\n effects.enter('definitionMarker');\n effects.consume(code);\n effects.exit('definitionMarker');\n if (!defined.includes(identifier)) {\n defined.push(identifier);\n }\n\n // Any whitespace after the marker is eaten, forming indented code\n // is not possible.\n // No space is also fine, just like a block quote marker.\n return factorySpace(effects, whitespaceAfter, 'gfmFootnoteDefinitionWhitespace');\n }\n return nok(code);\n }\n\n /**\n * After definition prefix.\n *\n * ```markdown\n * > | [^a]: b\n * ^\n * ```\n *\n * @type {State}\n */\n function whitespaceAfter(code) {\n // `markdown-rs` has a wrapping token for the prefix that is closed here.\n return ok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeDefinitionContinuation(effects, ok, nok) {\n /// Start of footnote definition continuation.\n ///\n /// ```markdown\n /// | [^a]: b\n /// > | c\n /// ^\n /// ```\n //\n // Either a blank line, which is okay, or an indented thing.\n return effects.check(blankLine, ok, effects.attempt(indent, ok, nok));\n}\n\n/** @type {Exiter} */\nfunction gfmFootnoteDefinitionEnd(effects) {\n effects.exit('gfmFootnoteDefinition');\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this;\n return factorySpace(effects, afterPrefix, 'gfmFootnoteDefinitionIndent', 4 + 1);\n\n /**\n * @type {State}\n */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1];\n return tail && tail[1].type === 'gfmFootnoteDefinitionIndent' && tail[2].sliceSerialize(tail[1], true).length === 4 ? ok(code) : nok(code);\n }\n}", "/**\n * @import {Options} from 'micromark-extension-gfm-strikethrough'\n * @import {Event, Extension, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { splice } from 'micromark-util-chunked';\nimport { classifyCharacter } from 'micromark-util-classify-character';\nimport { resolveAll } from 'micromark-util-resolve-all';\n/**\n * Create an extension for `micromark` to enable GFM strikethrough syntax.\n *\n * @param {Options | null | undefined} [options={}]\n * Configuration.\n * @returns {Extension}\n * Extension for `micromark` that can be passed in `extensions`, to\n * enable GFM strikethrough syntax.\n */\nexport function gfmStrikethrough(options) {\n const options_ = options || {};\n let single = options_.singleTilde;\n const tokenizer = {\n name: 'strikethrough',\n tokenize: tokenizeStrikethrough,\n resolveAll: resolveAllStrikethrough\n };\n if (single === null || single === undefined) {\n single = true;\n }\n return {\n text: {\n [126]: tokenizer\n },\n insideSpan: {\n null: [tokenizer]\n },\n attentionMarkers: {\n null: [126]\n }\n };\n\n /**\n * Take events and resolve strikethrough.\n *\n * @type {Resolver}\n */\n function resolveAllStrikethrough(events, context) {\n let index = -1;\n\n // Walk through all events.\n while (++index < events.length) {\n // Find a token that can close.\n if (events[index][0] === 'enter' && events[index][1].type === 'strikethroughSequenceTemporary' && events[index][1]._close) {\n let open = index;\n\n // Now walk back to find an opener.\n while (open--) {\n // Find a token that can open the closer.\n if (events[open][0] === 'exit' && events[open][1].type === 'strikethroughSequenceTemporary' && events[open][1]._open &&\n // If the sizes are the same:\n events[index][1].end.offset - events[index][1].start.offset === events[open][1].end.offset - events[open][1].start.offset) {\n events[index][1].type = 'strikethroughSequence';\n events[open][1].type = 'strikethroughSequence';\n\n /** @type {Token} */\n const strikethrough = {\n type: 'strikethrough',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[index][1].end)\n };\n\n /** @type {Token} */\n const text = {\n type: 'strikethroughText',\n start: Object.assign({}, events[open][1].end),\n end: Object.assign({}, events[index][1].start)\n };\n\n // Opening.\n /** @type {Array} */\n const nextEvents = [['enter', strikethrough, context], ['enter', events[open][1], context], ['exit', events[open][1], context], ['enter', text, context]];\n const insideSpan = context.parser.constructs.insideSpan.null;\n if (insideSpan) {\n // Between.\n splice(nextEvents, nextEvents.length, 0, resolveAll(insideSpan, events.slice(open + 1, index), context));\n }\n\n // Closing.\n splice(nextEvents, nextEvents.length, 0, [['exit', text, context], ['enter', events[index][1], context], ['exit', events[index][1], context], ['exit', strikethrough, context]]);\n splice(events, open - 1, index - open + 3, nextEvents);\n index = open + nextEvents.length - 2;\n break;\n }\n }\n }\n }\n index = -1;\n while (++index < events.length) {\n if (events[index][1].type === 'strikethroughSequenceTemporary') {\n events[index][1].type = \"data\";\n }\n }\n return events;\n }\n\n /**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\n function tokenizeStrikethrough(effects, ok, nok) {\n const previous = this.previous;\n const events = this.events;\n let size = 0;\n return start;\n\n /** @type {State} */\n function start(code) {\n if (previous === 126 && events[events.length - 1][1].type !== \"characterEscape\") {\n return nok(code);\n }\n effects.enter('strikethroughSequenceTemporary');\n return more(code);\n }\n\n /** @type {State} */\n function more(code) {\n const before = classifyCharacter(previous);\n if (code === 126) {\n // If this is the third marker, exit.\n if (size > 1) return nok(code);\n effects.consume(code);\n size++;\n return more;\n }\n if (size < 2 && !single) return nok(code);\n const token = effects.exit('strikethroughSequenceTemporary');\n const after = classifyCharacter(code);\n token._open = !after || after === 2 && Boolean(before);\n token._close = !before || before === 2 && Boolean(after);\n return ok(code);\n }\n }\n}", "/**\n * @import {Event} from 'micromark-util-types'\n */\n\n// Port of `edit_map.rs` from `markdown-rs`.\n// This should move to `markdown-js` later.\n\n// Deal with several changes in events, batching them together.\n//\n// Preferably, changes should be kept to a minimum.\n// Sometimes, it\u2019s needed to change the list of events, because parsing can be\n// messy, and it helps to expose a cleaner interface of events to the compiler\n// and other users.\n// It can also help to merge many adjacent similar events.\n// And, in other cases, it\u2019s needed to parse subcontent: pass some events\n// through another tokenizer and inject the result.\n\n/**\n * @typedef {[number, number, Array]} Change\n * @typedef {[number, number, number]} Jump\n */\n\n/**\n * Tracks a bunch of edits.\n */\nexport class EditMap {\n /**\n * Create a new edit map.\n */\n constructor() {\n /**\n * Record of changes.\n *\n * @type {Array}\n */\n this.map = [];\n }\n\n /**\n * Create an edit: a remove and/or add at a certain place.\n *\n * @param {number} index\n * @param {number} remove\n * @param {Array} add\n * @returns {undefined}\n */\n add(index, remove, add) {\n addImplementation(this, index, remove, add);\n }\n\n // To do: add this when moving to `micromark`.\n // /**\n // * Create an edit: but insert `add` before existing additions.\n // *\n // * @param {number} index\n // * @param {number} remove\n // * @param {Array} add\n // * @returns {undefined}\n // */\n // addBefore(index, remove, add) {\n // addImplementation(this, index, remove, add, true)\n // }\n\n /**\n * Done, change the events.\n *\n * @param {Array} events\n * @returns {undefined}\n */\n consume(events) {\n this.map.sort(function (a, b) {\n return a[0] - b[0];\n });\n\n /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */\n if (this.map.length === 0) {\n return;\n }\n\n // To do: if links are added in events, like they are in `markdown-rs`,\n // this is needed.\n // // Calculate jumps: where items in the current list move to.\n // /** @type {Array} */\n // const jumps = []\n // let index = 0\n // let addAcc = 0\n // let removeAcc = 0\n // while (index < this.map.length) {\n // const [at, remove, add] = this.map[index]\n // removeAcc += remove\n // addAcc += add.length\n // jumps.push([at, removeAcc, addAcc])\n // index += 1\n // }\n //\n // . shiftLinks(events, jumps)\n\n let index = this.map.length;\n /** @type {Array>} */\n const vecs = [];\n while (index > 0) {\n index -= 1;\n vecs.push(events.slice(this.map[index][0] + this.map[index][1]), this.map[index][2]);\n\n // Truncate rest.\n events.length = this.map[index][0];\n }\n vecs.push(events.slice());\n events.length = 0;\n let slice = vecs.pop();\n while (slice) {\n for (const element of slice) {\n events.push(element);\n }\n slice = vecs.pop();\n }\n\n // Truncate everything.\n this.map.length = 0;\n }\n}\n\n/**\n * Create an edit.\n *\n * @param {EditMap} editMap\n * @param {number} at\n * @param {number} remove\n * @param {Array} add\n * @returns {undefined}\n */\nfunction addImplementation(editMap, at, remove, add) {\n let index = 0;\n\n /* c8 ignore next 3 -- `resolve` is never called without tables, so without edits. */\n if (remove === 0 && add.length === 0) {\n return;\n }\n while (index < editMap.map.length) {\n if (editMap.map[index][0] === at) {\n editMap.map[index][1] += remove;\n\n // To do: before not used by tables, use when moving to micromark.\n // if (before) {\n // add.push(...editMap.map[index][2])\n // editMap.map[index][2] = add\n // } else {\n editMap.map[index][2].push(...add);\n // }\n\n return;\n }\n index += 1;\n }\n editMap.map.push([at, remove, add]);\n}\n\n// /**\n// * Shift `previous` and `next` links according to `jumps`.\n// *\n// * This fixes links in case there are events removed or added between them.\n// *\n// * @param {Array} events\n// * @param {Array} jumps\n// */\n// function shiftLinks(events, jumps) {\n// let jumpIndex = 0\n// let index = 0\n// let add = 0\n// let rm = 0\n\n// while (index < events.length) {\n// const rmCurr = rm\n\n// while (jumpIndex < jumps.length && jumps[jumpIndex][0] <= index) {\n// add = jumps[jumpIndex][2]\n// rm = jumps[jumpIndex][1]\n// jumpIndex += 1\n// }\n\n// // Ignore items that will be removed.\n// if (rm > rmCurr) {\n// index += rm - rmCurr\n// } else {\n// // ?\n// // if let Some(link) = &events[index].link {\n// // if let Some(next) = link.next {\n// // events[next].link.as_mut().unwrap().previous = Some(index + add - rm);\n// // while jumpIndex < jumps.len() && jumps[jumpIndex].0 <= next {\n// // add = jumps[jumpIndex].2;\n// // rm = jumps[jumpIndex].1;\n// // jumpIndex += 1;\n// // }\n// // events[index].link.as_mut().unwrap().next = Some(next + add - rm);\n// // index = next;\n// // continue;\n// // }\n// // }\n// index += 1\n// }\n// }\n// }", "/**\n * @import {Event} from 'micromark-util-types'\n */\n\n/**\n * @typedef {'center' | 'left' | 'none' | 'right'} Align\n */\n\n/**\n * Figure out the alignment of a GFM table.\n *\n * @param {Readonly>} events\n * List of events.\n * @param {number} index\n * Table enter event.\n * @returns {Array}\n * List of aligns.\n */\nexport function gfmTableAlign(events, index) {\n let inDelimiterRow = false;\n /** @type {Array} */\n const align = [];\n while (index < events.length) {\n const event = events[index];\n if (inDelimiterRow) {\n if (event[0] === 'enter') {\n // Start of alignment value: set a new column.\n // To do: `markdown-rs` uses `tableDelimiterCellValue`.\n if (event[1].type === 'tableContent') {\n align.push(events[index + 1][1].type === 'tableDelimiterMarker' ? 'left' : 'none');\n }\n }\n // Exits:\n // End of alignment value: change the column.\n // To do: `markdown-rs` uses `tableDelimiterCellValue`.\n else if (event[1].type === 'tableContent') {\n if (events[index - 1][1].type === 'tableDelimiterMarker') {\n const alignIndex = align.length - 1;\n align[alignIndex] = align[alignIndex] === 'left' ? 'center' : 'right';\n }\n }\n // Done!\n else if (event[1].type === 'tableDelimiterRow') {\n break;\n }\n } else if (event[0] === 'enter' && event[1].type === 'tableDelimiterRow') {\n inDelimiterRow = true;\n }\n index += 1;\n }\n return align;\n}", "/**\n * @import {Event, Extension, Point, Resolver, State, Token, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\n/**\n * @typedef {[number, number, number, number]} Range\n * Cell info.\n *\n * @typedef {0 | 1 | 2 | 3} RowKind\n * Where we are: `1` for head row, `2` for delimiter row, `3` for body row.\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character';\nimport { EditMap } from './edit-map.js';\nimport { gfmTableAlign } from './infer.js';\n\n/**\n * Create an HTML extension for `micromark` to support GitHub tables syntax.\n *\n * @returns {Extension}\n * Extension for `micromark` that can be passed in `extensions` to enable GFM\n * table syntax.\n */\nexport function gfmTable() {\n return {\n flow: {\n null: {\n name: 'table',\n tokenize: tokenizeTable,\n resolveAll: resolveTable\n }\n }\n };\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTable(effects, ok, nok) {\n const self = this;\n let size = 0;\n let sizeB = 0;\n /** @type {boolean | undefined} */\n let seen;\n return start;\n\n /**\n * Start of a GFM table.\n *\n * If there is a valid table row or table head before, then we try to parse\n * another row.\n * Otherwise, we try to parse a head.\n *\n * ```markdown\n * > | | a |\n * ^\n * | | - |\n * > | | b |\n * ^\n * ```\n * @type {State}\n */\n function start(code) {\n let index = self.events.length - 1;\n while (index > -1) {\n const type = self.events[index][1].type;\n if (type === \"lineEnding\" ||\n // Note: markdown-rs uses `whitespace` instead of `linePrefix`\n type === \"linePrefix\") index--;else break;\n }\n const tail = index > -1 ? self.events[index][1].type : null;\n const next = tail === 'tableHead' || tail === 'tableRow' ? bodyRowStart : headRowBefore;\n\n // Don\u2019t allow lazy body rows.\n if (next === bodyRowStart && self.parser.lazy[self.now().line]) {\n return nok(code);\n }\n return next(code);\n }\n\n /**\n * Before table head row.\n *\n * ```markdown\n * > | | a |\n * ^\n * | | - |\n * | | b |\n * ```\n *\n * @type {State}\n */\n function headRowBefore(code) {\n effects.enter('tableHead');\n effects.enter('tableRow');\n return headRowStart(code);\n }\n\n /**\n * Before table head row, after whitespace.\n *\n * ```markdown\n * > | | a |\n * ^\n * | | - |\n * | | b |\n * ```\n *\n * @type {State}\n */\n function headRowStart(code) {\n if (code === 124) {\n return headRowBreak(code);\n }\n\n // To do: micromark-js should let us parse our own whitespace in extensions,\n // like `markdown-rs`:\n //\n // ```js\n // // 4+ spaces.\n // if (markdownSpace(code)) {\n // return nok(code)\n // }\n // ```\n\n seen = true;\n // Count the first character, that isn\u2019t a pipe, double.\n sizeB += 1;\n return headRowBreak(code);\n }\n\n /**\n * At break in table head row.\n *\n * ```markdown\n * > | | a |\n * ^\n * ^\n * ^\n * | | - |\n * | | b |\n * ```\n *\n * @type {State}\n */\n function headRowBreak(code) {\n if (code === null) {\n // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don\u2018t.\n return nok(code);\n }\n if (markdownLineEnding(code)) {\n // If anything other than one pipe (ignoring whitespace) was used, it\u2019s fine.\n if (sizeB > 1) {\n sizeB = 0;\n // To do: check if this works.\n // Feel free to interrupt:\n self.interrupt = true;\n effects.exit('tableRow');\n effects.enter(\"lineEnding\");\n effects.consume(code);\n effects.exit(\"lineEnding\");\n return headDelimiterStart;\n }\n\n // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don\u2018t.\n return nok(code);\n }\n if (markdownSpace(code)) {\n // To do: check if this is fine.\n // effects.attempt(State::Next(StateName::GfmTableHeadRowBreak), State::Nok)\n // State::Retry(space_or_tab(tokenizer))\n return factorySpace(effects, headRowBreak, \"whitespace\")(code);\n }\n sizeB += 1;\n if (seen) {\n seen = false;\n // Header cell count.\n size += 1;\n }\n if (code === 124) {\n effects.enter('tableCellDivider');\n effects.consume(code);\n effects.exit('tableCellDivider');\n // Whether a delimiter was seen.\n seen = true;\n return headRowBreak;\n }\n\n // Anything else is cell data.\n effects.enter(\"data\");\n return headRowData(code);\n }\n\n /**\n * In table head row data.\n *\n * ```markdown\n * > | | a |\n * ^\n * | | - |\n * | | b |\n * ```\n *\n * @type {State}\n */\n function headRowData(code) {\n if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {\n effects.exit(\"data\");\n return headRowBreak(code);\n }\n effects.consume(code);\n return code === 92 ? headRowEscape : headRowData;\n }\n\n /**\n * In table head row escape.\n *\n * ```markdown\n * > | | a\\-b |\n * ^\n * | | ---- |\n * | | c |\n * ```\n *\n * @type {State}\n */\n function headRowEscape(code) {\n if (code === 92 || code === 124) {\n effects.consume(code);\n return headRowData;\n }\n return headRowData(code);\n }\n\n /**\n * Before delimiter row.\n *\n * ```markdown\n * | | a |\n * > | | - |\n * ^\n * | | b |\n * ```\n *\n * @type {State}\n */\n function headDelimiterStart(code) {\n // Reset `interrupt`.\n self.interrupt = false;\n\n // Note: in `markdown-rs`, we need to handle piercing here too.\n if (self.parser.lazy[self.now().line]) {\n return nok(code);\n }\n effects.enter('tableDelimiterRow');\n // Track if we\u2019ve seen a `:` or `|`.\n seen = false;\n if (markdownSpace(code)) {\n return factorySpace(effects, headDelimiterBefore, \"linePrefix\", self.parser.constructs.disable.null.includes('codeIndented') ? undefined : 4)(code);\n }\n return headDelimiterBefore(code);\n }\n\n /**\n * Before delimiter row, after optional whitespace.\n *\n * Reused when a `|` is found later, to parse another cell.\n *\n * ```markdown\n * | | a |\n * > | | - |\n * ^\n * | | b |\n * ```\n *\n * @type {State}\n */\n function headDelimiterBefore(code) {\n if (code === 45 || code === 58) {\n return headDelimiterValueBefore(code);\n }\n if (code === 124) {\n seen = true;\n // If we start with a pipe, we open a cell marker.\n effects.enter('tableCellDivider');\n effects.consume(code);\n effects.exit('tableCellDivider');\n return headDelimiterCellBefore;\n }\n\n // More whitespace / empty row not allowed at start.\n return headDelimiterNok(code);\n }\n\n /**\n * After `|`, before delimiter cell.\n *\n * ```markdown\n * | | a |\n * > | | - |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterCellBefore(code) {\n if (markdownSpace(code)) {\n return factorySpace(effects, headDelimiterValueBefore, \"whitespace\")(code);\n }\n return headDelimiterValueBefore(code);\n }\n\n /**\n * Before delimiter cell value.\n *\n * ```markdown\n * | | a |\n * > | | - |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterValueBefore(code) {\n // Align: left.\n if (code === 58) {\n sizeB += 1;\n seen = true;\n effects.enter('tableDelimiterMarker');\n effects.consume(code);\n effects.exit('tableDelimiterMarker');\n return headDelimiterLeftAlignmentAfter;\n }\n\n // Align: none.\n if (code === 45) {\n sizeB += 1;\n // To do: seems weird that this *isn\u2019t* left aligned, but that state is used?\n return headDelimiterLeftAlignmentAfter(code);\n }\n if (code === null || markdownLineEnding(code)) {\n return headDelimiterCellAfter(code);\n }\n return headDelimiterNok(code);\n }\n\n /**\n * After delimiter cell left alignment marker.\n *\n * ```markdown\n * | | a |\n * > | | :- |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterLeftAlignmentAfter(code) {\n if (code === 45) {\n effects.enter('tableDelimiterFiller');\n return headDelimiterFiller(code);\n }\n\n // Anything else is not ok after the left-align colon.\n return headDelimiterNok(code);\n }\n\n /**\n * In delimiter cell filler.\n *\n * ```markdown\n * | | a |\n * > | | - |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterFiller(code) {\n if (code === 45) {\n effects.consume(code);\n return headDelimiterFiller;\n }\n\n // Align is `center` if it was `left`, `right` otherwise.\n if (code === 58) {\n seen = true;\n effects.exit('tableDelimiterFiller');\n effects.enter('tableDelimiterMarker');\n effects.consume(code);\n effects.exit('tableDelimiterMarker');\n return headDelimiterRightAlignmentAfter;\n }\n effects.exit('tableDelimiterFiller');\n return headDelimiterRightAlignmentAfter(code);\n }\n\n /**\n * After delimiter cell right alignment marker.\n *\n * ```markdown\n * | | a |\n * > | | -: |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterRightAlignmentAfter(code) {\n if (markdownSpace(code)) {\n return factorySpace(effects, headDelimiterCellAfter, \"whitespace\")(code);\n }\n return headDelimiterCellAfter(code);\n }\n\n /**\n * After delimiter cell.\n *\n * ```markdown\n * | | a |\n * > | | -: |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterCellAfter(code) {\n if (code === 124) {\n return headDelimiterBefore(code);\n }\n if (code === null || markdownLineEnding(code)) {\n // Exit when:\n // * there was no `:` or `|` at all (it\u2019s a thematic break or setext\n // underline instead)\n // * the header cell count is not the delimiter cell count\n if (!seen || size !== sizeB) {\n return headDelimiterNok(code);\n }\n\n // Note: in markdown-rs`, a reset is needed here.\n effects.exit('tableDelimiterRow');\n effects.exit('tableHead');\n // To do: in `markdown-rs`, resolvers need to be registered manually.\n // effects.register_resolver(ResolveName::GfmTable)\n return ok(code);\n }\n return headDelimiterNok(code);\n }\n\n /**\n * In delimiter row, at a disallowed byte.\n *\n * ```markdown\n * | | a |\n * > | | x |\n * ^\n * ```\n *\n * @type {State}\n */\n function headDelimiterNok(code) {\n // Note: in `markdown-rs`, we need to reset, in `micromark-js` we don\u2018t.\n return nok(code);\n }\n\n /**\n * Before table body row.\n *\n * ```markdown\n * | | a |\n * | | - |\n * > | | b |\n * ^\n * ```\n *\n * @type {State}\n */\n function bodyRowStart(code) {\n // Note: in `markdown-rs` we need to manually take care of a prefix,\n // but in `micromark-js` that is done for us, so if we\u2019re here, we\u2019re\n // never at whitespace.\n effects.enter('tableRow');\n return bodyRowBreak(code);\n }\n\n /**\n * At break in table body row.\n *\n * ```markdown\n * | | a |\n * | | - |\n * > | | b |\n * ^\n * ^\n * ^\n * ```\n *\n * @type {State}\n */\n function bodyRowBreak(code) {\n if (code === 124) {\n effects.enter('tableCellDivider');\n effects.consume(code);\n effects.exit('tableCellDivider');\n return bodyRowBreak;\n }\n if (code === null || markdownLineEnding(code)) {\n effects.exit('tableRow');\n return ok(code);\n }\n if (markdownSpace(code)) {\n return factorySpace(effects, bodyRowBreak, \"whitespace\")(code);\n }\n\n // Anything else is cell content.\n effects.enter(\"data\");\n return bodyRowData(code);\n }\n\n /**\n * In table body row data.\n *\n * ```markdown\n * | | a |\n * | | - |\n * > | | b |\n * ^\n * ```\n *\n * @type {State}\n */\n function bodyRowData(code) {\n if (code === null || code === 124 || markdownLineEndingOrSpace(code)) {\n effects.exit(\"data\");\n return bodyRowBreak(code);\n }\n effects.consume(code);\n return code === 92 ? bodyRowEscape : bodyRowData;\n }\n\n /**\n * In table body row escape.\n *\n * ```markdown\n * | | a |\n * | | ---- |\n * > | | b\\-c |\n * ^\n * ```\n *\n * @type {State}\n */\n function bodyRowEscape(code) {\n if (code === 92 || code === 124) {\n effects.consume(code);\n return bodyRowData;\n }\n return bodyRowData(code);\n }\n}\n\n/** @type {Resolver} */\n\nfunction resolveTable(events, context) {\n let index = -1;\n let inFirstCellAwaitingPipe = true;\n /** @type {RowKind} */\n let rowKind = 0;\n /** @type {Range} */\n let lastCell = [0, 0, 0, 0];\n /** @type {Range} */\n let cell = [0, 0, 0, 0];\n let afterHeadAwaitingFirstBodyRow = false;\n let lastTableEnd = 0;\n /** @type {Token | undefined} */\n let currentTable;\n /** @type {Token | undefined} */\n let currentBody;\n /** @type {Token | undefined} */\n let currentCell;\n const map = new EditMap();\n while (++index < events.length) {\n const event = events[index];\n const token = event[1];\n if (event[0] === 'enter') {\n // Start of head.\n if (token.type === 'tableHead') {\n afterHeadAwaitingFirstBodyRow = false;\n\n // Inject previous (body end and) table end.\n if (lastTableEnd !== 0) {\n flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);\n currentBody = undefined;\n lastTableEnd = 0;\n }\n\n // Inject table start.\n currentTable = {\n type: 'table',\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map.add(index, 0, [['enter', currentTable, context]]);\n } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') {\n inFirstCellAwaitingPipe = true;\n currentCell = undefined;\n lastCell = [0, 0, 0, 0];\n cell = [0, index + 1, 0, 0];\n\n // Inject table body start.\n if (afterHeadAwaitingFirstBodyRow) {\n afterHeadAwaitingFirstBodyRow = false;\n currentBody = {\n type: 'tableBody',\n start: Object.assign({}, token.start),\n // Note: correct end is set later.\n end: Object.assign({}, token.end)\n };\n map.add(index, 0, [['enter', currentBody, context]]);\n }\n rowKind = token.type === 'tableDelimiterRow' ? 2 : currentBody ? 3 : 1;\n }\n // Cell data.\n else if (rowKind && (token.type === \"data\" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) {\n inFirstCellAwaitingPipe = false;\n\n // First value in cell.\n if (cell[2] === 0) {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell);\n lastCell = [0, 0, 0, 0];\n }\n cell[2] = index;\n }\n } else if (token.type === 'tableCellDivider') {\n if (inFirstCellAwaitingPipe) {\n inFirstCellAwaitingPipe = false;\n } else {\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map, context, lastCell, rowKind, undefined, currentCell);\n }\n lastCell = cell;\n cell = [lastCell[1], index, 0, 0];\n }\n }\n }\n // Exit events.\n else if (token.type === 'tableHead') {\n afterHeadAwaitingFirstBodyRow = true;\n lastTableEnd = index;\n } else if (token.type === 'tableRow' || token.type === 'tableDelimiterRow') {\n lastTableEnd = index;\n if (lastCell[1] !== 0) {\n cell[0] = cell[1];\n currentCell = flushCell(map, context, lastCell, rowKind, index, currentCell);\n } else if (cell[1] !== 0) {\n currentCell = flushCell(map, context, cell, rowKind, index, currentCell);\n }\n rowKind = 0;\n } else if (rowKind && (token.type === \"data\" || token.type === 'tableDelimiterMarker' || token.type === 'tableDelimiterFiller')) {\n cell[3] = index;\n }\n }\n if (lastTableEnd !== 0) {\n flushTableEnd(map, context, lastTableEnd, currentTable, currentBody);\n }\n map.consume(context.events);\n\n // To do: move this into `html`, when events are exposed there.\n // That\u2019s what `markdown-rs` does.\n // That needs updates to `mdast-util-gfm-table`.\n index = -1;\n while (++index < context.events.length) {\n const event = context.events[index];\n if (event[0] === 'enter' && event[1].type === 'table') {\n event[1]._align = gfmTableAlign(context.events, index);\n }\n }\n return events;\n}\n\n/**\n * Generate a cell.\n *\n * @param {EditMap} map\n * @param {Readonly} context\n * @param {Readonly} range\n * @param {RowKind} rowKind\n * @param {number | undefined} rowEnd\n * @param {Token | undefined} previousCell\n * @returns {Token | undefined}\n */\n// eslint-disable-next-line max-params\nfunction flushCell(map, context, range, rowKind, rowEnd, previousCell) {\n // `markdown-rs` uses:\n // rowKind === 2 ? 'tableDelimiterCell' : 'tableCell'\n const groupName = rowKind === 1 ? 'tableHeader' : rowKind === 2 ? 'tableDelimiter' : 'tableData';\n // `markdown-rs` uses:\n // rowKind === 2 ? 'tableDelimiterCellValue' : 'tableCellText'\n const valueName = 'tableContent';\n\n // Insert an exit for the previous cell, if there is one.\n //\n // ```markdown\n // > | | aa | bb | cc |\n // ^-- exit\n // ^^^^-- this cell\n // ```\n if (range[0] !== 0) {\n previousCell.end = Object.assign({}, getPoint(context.events, range[0]));\n map.add(range[0], 0, [['exit', previousCell, context]]);\n }\n\n // Insert enter of this cell.\n //\n // ```markdown\n // > | | aa | bb | cc |\n // ^-- enter\n // ^^^^-- this cell\n // ```\n const now = getPoint(context.events, range[1]);\n previousCell = {\n type: groupName,\n start: Object.assign({}, now),\n // Note: correct end is set later.\n end: Object.assign({}, now)\n };\n map.add(range[1], 0, [['enter', previousCell, context]]);\n\n // Insert text start at first data start and end at last data end, and\n // remove events between.\n //\n // ```markdown\n // > | | aa | bb | cc |\n // ^-- enter\n // ^-- exit\n // ^^^^-- this cell\n // ```\n if (range[2] !== 0) {\n const relatedStart = getPoint(context.events, range[2]);\n const relatedEnd = getPoint(context.events, range[3]);\n /** @type {Token} */\n const valueToken = {\n type: valueName,\n start: Object.assign({}, relatedStart),\n end: Object.assign({}, relatedEnd)\n };\n map.add(range[2], 0, [['enter', valueToken, context]]);\n if (rowKind !== 2) {\n // Fix positional info on remaining events\n const start = context.events[range[2]];\n const end = context.events[range[3]];\n start[1].end = Object.assign({}, end[1].end);\n start[1].type = \"chunkText\";\n start[1].contentType = \"text\";\n\n // Remove if needed.\n if (range[3] > range[2] + 1) {\n const a = range[2] + 1;\n const b = range[3] - range[2] - 1;\n map.add(a, b, []);\n }\n }\n map.add(range[3] + 1, 0, [['exit', valueToken, context]]);\n }\n\n // Insert an exit for the last cell, if at the row end.\n //\n // ```markdown\n // > | | aa | bb | cc |\n // ^-- exit\n // ^^^^^^-- this cell (the last one contains two \u201Cbetween\u201D parts)\n // ```\n if (rowEnd !== undefined) {\n previousCell.end = Object.assign({}, getPoint(context.events, rowEnd));\n map.add(rowEnd, 0, [['exit', previousCell, context]]);\n previousCell = undefined;\n }\n return previousCell;\n}\n\n/**\n * Generate table end (and table body end).\n *\n * @param {Readonly} map\n * @param {Readonly} context\n * @param {number} index\n * @param {Token} table\n * @param {Token | undefined} tableBody\n */\n// eslint-disable-next-line max-params\nfunction flushTableEnd(map, context, index, table, tableBody) {\n /** @type {Array} */\n const exits = [];\n const related = getPoint(context.events, index);\n if (tableBody) {\n tableBody.end = Object.assign({}, related);\n exits.push(['exit', tableBody, context]);\n }\n table.end = Object.assign({}, related);\n exits.push(['exit', table, context]);\n map.add(index + 1, 0, exits);\n}\n\n/**\n * @param {Readonly>} events\n * @param {number} index\n * @returns {Readonly}\n */\nfunction getPoint(events, index) {\n const event = events[index];\n const side = event[0] === 'enter' ? 'start' : 'end';\n return event[1][side];\n}", "/**\n * @import {Extension, State, TokenizeContext, Tokenizer} from 'micromark-util-types'\n */\n\nimport { factorySpace } from 'micromark-factory-space';\nimport { markdownLineEnding, markdownLineEndingOrSpace, markdownSpace } from 'micromark-util-character';\nconst tasklistCheck = {\n name: 'tasklistCheck',\n tokenize: tokenizeTasklistCheck\n};\n\n/**\n * Create an HTML extension for `micromark` to support GFM task list items\n * syntax.\n *\n * @returns {Extension}\n * Extension for `micromark` that can be passed in `htmlExtensions` to\n * support GFM task list items when serializing to HTML.\n */\nexport function gfmTaskListItem() {\n return {\n text: {\n [91]: tasklistCheck\n }\n };\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction tokenizeTasklistCheck(effects, ok, nok) {\n const self = this;\n return open;\n\n /**\n * At start of task list item check.\n *\n * ```markdown\n * > | * [x] y.\n * ^\n * ```\n *\n * @type {State}\n */\n function open(code) {\n if (\n // Exit if there\u2019s stuff before.\n self.previous !== null ||\n // Exit if not in the first content that is the first child of a list\n // item.\n !self._gfmTasklistFirstContentOfListItem) {\n return nok(code);\n }\n effects.enter('taskListCheck');\n effects.enter('taskListCheckMarker');\n effects.consume(code);\n effects.exit('taskListCheckMarker');\n return inside;\n }\n\n /**\n * In task list item check.\n *\n * ```markdown\n * > | * [x] y.\n * ^\n * ```\n *\n * @type {State}\n */\n function inside(code) {\n // Currently we match how GH works in files.\n // To match how GH works in comments, use `markdownSpace` (`[\\t ]`) instead\n // of `markdownLineEndingOrSpace` (`[\\t\\n\\r ]`).\n if (markdownLineEndingOrSpace(code)) {\n effects.enter('taskListCheckValueUnchecked');\n effects.consume(code);\n effects.exit('taskListCheckValueUnchecked');\n return close;\n }\n if (code === 88 || code === 120) {\n effects.enter('taskListCheckValueChecked');\n effects.consume(code);\n effects.exit('taskListCheckValueChecked');\n return close;\n }\n return nok(code);\n }\n\n /**\n * At close of task list item check.\n *\n * ```markdown\n * > | * [x] y.\n * ^\n * ```\n *\n * @type {State}\n */\n function close(code) {\n if (code === 93) {\n effects.enter('taskListCheckMarker');\n effects.consume(code);\n effects.exit('taskListCheckMarker');\n effects.exit('taskListCheck');\n return after;\n }\n return nok(code);\n }\n\n /**\n * @type {State}\n */\n function after(code) {\n // EOL in paragraph means there must be something else after it.\n if (markdownLineEnding(code)) {\n return ok(code);\n }\n\n // Space or tab?\n // Check what comes after.\n if (markdownSpace(code)) {\n return effects.check({\n tokenize: spaceThenNonSpace\n }, ok, nok)(code);\n }\n\n // EOF, or non-whitespace, both wrong.\n return nok(code);\n }\n}\n\n/**\n * @this {TokenizeContext}\n * @type {Tokenizer}\n */\nfunction spaceThenNonSpace(effects, ok, nok) {\n return factorySpace(effects, after, \"whitespace\");\n\n /**\n * After whitespace, after task list item check.\n *\n * ```markdown\n * > | * [x] y.\n * ^\n * ```\n *\n * @type {State}\n */\n function after(code) {\n // EOF means there was nothing, so bad.\n // EOL means there\u2019s content after it, so good.\n // Impossible to have more spaces.\n // Anything else is good.\n return code === null ? nok(code) : ok(code);\n }\n}", "/**\n * @typedef {import('micromark-extension-gfm-footnote').HtmlOptions} HtmlOptions\n * @typedef {import('micromark-extension-gfm-strikethrough').Options} Options\n * @typedef {import('micromark-util-types').Extension} Extension\n * @typedef {import('micromark-util-types').HtmlExtension} HtmlExtension\n */\n\nimport {\n combineExtensions,\n combineHtmlExtensions\n} from 'micromark-util-combine-extensions'\nimport {\n gfmAutolinkLiteral,\n gfmAutolinkLiteralHtml\n} from 'micromark-extension-gfm-autolink-literal'\nimport {gfmFootnote, gfmFootnoteHtml} from 'micromark-extension-gfm-footnote'\nimport {\n gfmStrikethrough,\n gfmStrikethroughHtml\n} from 'micromark-extension-gfm-strikethrough'\nimport {gfmTable, gfmTableHtml} from 'micromark-extension-gfm-table'\nimport {gfmTagfilterHtml} from 'micromark-extension-gfm-tagfilter'\nimport {\n gfmTaskListItem,\n gfmTaskListItemHtml\n} from 'micromark-extension-gfm-task-list-item'\n\n/**\n * Create an extension for `micromark` to enable GFM syntax.\n *\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n *\n * Passed to `micromark-extens-gfm-strikethrough`.\n * @returns {Extension}\n * Extension for `micromark` that can be passed in `extensions` to enable GFM\n * syntax.\n */\nexport function gfm(options) {\n return combineExtensions([\n gfmAutolinkLiteral(),\n gfmFootnote(),\n gfmStrikethrough(options),\n gfmTable(),\n gfmTaskListItem()\n ])\n}\n\n/**\n * Create an extension for `micromark` to support GFM when serializing to HTML.\n *\n * @param {HtmlOptions | null | undefined} [options]\n * Configuration (optional).\n *\n * Passed to `micromark-extens-gfm-footnote`.\n * @returns {HtmlExtension}\n * Extension for `micromark` that can be passed in `htmlExtensions` to\n * support GFM when serializing to HTML.\n */\nexport function gfmHtml(options) {\n return combineHtmlExtensions([\n gfmAutolinkLiteralHtml(),\n gfmFootnoteHtml(options),\n gfmStrikethroughHtml(),\n gfmTableHtml(),\n gfmTagfilterHtml(),\n gfmTaskListItemHtml()\n ])\n}\n", "/**\n * @import {Root} from 'mdast'\n * @import {Options} from 'remark-gfm'\n * @import {} from 'remark-parse'\n * @import {} from 'remark-stringify'\n * @import {Processor} from 'unified'\n */\n\nimport {gfmFromMarkdown, gfmToMarkdown} from 'mdast-util-gfm'\nimport {gfm} from 'micromark-extension-gfm'\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Add support GFM (autolink literals, footnotes, strikethrough, tables,\n * tasklists).\n *\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {undefined}\n * Nothing.\n */\nexport default function remarkGfm(options) {\n // @ts-expect-error: TS is wrong about `this`.\n // eslint-disable-next-line unicorn/no-this-assignment\n const self = /** @type {Processor} */ (this)\n const settings = options || emptyOptions\n const data = self.data()\n\n const micromarkExtensions =\n data.micromarkExtensions || (data.micromarkExtensions = [])\n const fromMarkdownExtensions =\n data.fromMarkdownExtensions || (data.fromMarkdownExtensions = [])\n const toMarkdownExtensions =\n data.toMarkdownExtensions || (data.toMarkdownExtensions = [])\n\n micromarkExtensions.push(gfm(settings))\n fromMarkdownExtensions.push(gfmFromMarkdown())\n toMarkdownExtensions.push(gfmToMarkdown(settings))\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Blockquote} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `blockquote` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Blockquote} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function blockquote(state, node) {\n /** @type {Element} */\n const result = {\n type: 'element',\n tagName: 'blockquote',\n properties: {},\n children: state.wrap(state.all(node), true)\n }\n state.patch(node, result)\n return state.applyData(node, result)\n}\n", "/**\n * @import {Element, Text} from 'hast'\n * @import {Break} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `break` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Break} node\n * mdast node.\n * @returns {Array}\n * hast element content.\n */\nexport function hardBreak(state, node) {\n /** @type {Element} */\n const result = {type: 'element', tagName: 'br', properties: {}, children: []}\n state.patch(node, result)\n return [state.applyData(node, result), {type: 'text', value: '\\n'}]\n}\n", "/**\n * @import {Element, Properties} from 'hast'\n * @import {Code} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `code` node into hast.\n *\n * @param {State} state\n * Info passed around.\n * @param {Code} node\n * mdast node.\n * @returns {Element}\n * hast node.\n */\nexport function code(state, node) {\n const value = node.value ? node.value + '\\n' : ''\n /** @type {Properties} */\n const properties = {}\n // Someone can write `js python ruby`.\n const language = node.lang ? node.lang.split(/\\s+/) : []\n\n // GH/CM still drop the non-first languages.\n if (language.length > 0) {\n properties.className = ['language-' + language[0]]\n }\n\n // Create ``.\n /** @type {Element} */\n let result = {\n type: 'element',\n tagName: 'code',\n properties,\n children: [{type: 'text', value}]\n }\n\n if (node.meta) {\n result.data = {meta: node.meta}\n }\n\n state.patch(node, result)\n result = state.applyData(node, result)\n\n // Create `
`.\n  result = {type: 'element', tagName: 'pre', properties: {}, children: [result]}\n  state.patch(node, result)\n  return result\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Delete} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `delete` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Delete} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strikethrough(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'del',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Emphasis} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `emphasis` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Emphasis} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function emphasis(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'em',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {FootnoteReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `footnoteReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {FootnoteReference} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnoteReference(state, node) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const id = String(node.identifier).toUpperCase()\n  const safeId = normalizeUri(id.toLowerCase())\n  const index = state.footnoteOrder.indexOf(id)\n  /** @type {number} */\n  let counter\n\n  let reuseCounter = state.footnoteCounts.get(id)\n\n  if (reuseCounter === undefined) {\n    reuseCounter = 0\n    state.footnoteOrder.push(id)\n    counter = state.footnoteOrder.length\n  } else {\n    counter = index + 1\n  }\n\n  reuseCounter += 1\n  state.footnoteCounts.set(id, reuseCounter)\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + clobberPrefix + 'fn-' + safeId,\n      id:\n        clobberPrefix +\n        'fnref-' +\n        safeId +\n        (reuseCounter > 1 ? '-' + reuseCounter : ''),\n      dataFootnoteRef: true,\n      ariaDescribedBy: ['footnote-label']\n    },\n    children: [{type: 'text', value: String(counter)}]\n  }\n  state.patch(node, link)\n\n  /** @type {Element} */\n  const sup = {\n    type: 'element',\n    tagName: 'sup',\n    properties: {},\n    children: [link]\n  }\n  state.patch(node, sup)\n  return state.applyData(node, sup)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Heading} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `heading` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Heading} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function heading(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'h' + node.depth,\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Html} from 'mdast'\n * @import {State} from '../state.js'\n * @import {Raw} from '../../index.js'\n */\n\n/**\n * Turn an mdast `html` node into hast (`raw` node in dangerous mode, otherwise\n * nothing).\n *\n * @param {State} state\n *   Info passed around.\n * @param {Html} node\n *   mdast node.\n * @returns {Element | Raw | undefined}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.options.allowDangerousHtml) {\n    /** @type {Raw} */\n    const result = {type: 'raw', value: node.value}\n    state.patch(node, result)\n    return state.applyData(node, result)\n  }\n\n  return undefined\n}\n", "/**\n * @import {ElementContent} from 'hast'\n * @import {Reference, Nodes} from 'mdast'\n * @import {State} from './state.js'\n */\n\n/**\n * Return the content of a reference without definition as plain text.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Extract} node\n *   Reference node (image, link).\n * @returns {Array}\n *   hast content.\n */\nexport function revert(state, node) {\n  const subtype = node.referenceType\n  let suffix = ']'\n\n  if (subtype === 'collapsed') {\n    suffix += '[]'\n  } else if (subtype === 'full') {\n    suffix += '[' + (node.label || node.identifier) + ']'\n  }\n\n  if (node.type === 'imageReference') {\n    return [{type: 'text', value: '![' + node.alt + suffix}]\n  }\n\n  const contents = state.all(node)\n  const head = contents[0]\n\n  if (head && head.type === 'text') {\n    head.value = '[' + head.value\n  } else {\n    contents.unshift({type: 'text', value: '['})\n  }\n\n  const tail = contents[contents.length - 1]\n\n  if (tail && tail.type === 'text') {\n    tail.value += suffix\n  } else {\n    contents.push({type: 'text', value: suffix})\n  }\n\n  return contents\n}\n", "/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ImageReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `imageReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ImageReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(definition.url || ''), alt: node.alt}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element, Properties} from 'hast'\n * @import {Image} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `image` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Image} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function image(state, node) {\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(node.url)}\n\n  if (node.alt !== null && node.alt !== undefined) {\n    properties.alt = node.alt\n  }\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'img', properties, children: []}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element, Text} from 'hast'\n * @import {InlineCode} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `inlineCode` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {InlineCode} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function inlineCode(state, node) {\n  /** @type {Text} */\n  const text = {type: 'text', value: node.value.replace(/\\r?\\n|\\r/g, ' ')}\n  state.patch(node, text)\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'code',\n    properties: {},\n    children: [text]\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {LinkReference} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\nimport {revert} from '../revert.js'\n\n/**\n * Turn an mdast `linkReference` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {LinkReference} node\n *   mdast node.\n * @returns {Array | ElementContent}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const id = String(node.identifier).toUpperCase()\n  const definition = state.definitionById.get(id)\n\n  if (!definition) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(definition.url || '')}\n\n  if (definition.title !== null && definition.title !== undefined) {\n    properties.title = definition.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element, Properties} from 'hast'\n * @import {Link} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Turn an mdast `link` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Link} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function link(state, node) {\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(node.url)}\n\n  if (node.title !== null && node.title !== undefined) {\n    properties.title = node.title\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'a',\n    properties,\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {ElementContent, Element, Properties} from 'hast'\n * @import {ListItem, Parents} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `listItem` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ListItem} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function listItem(state, node, parent) {\n  const results = state.all(node)\n  const loose = parent ? listLoose(parent) : listItemLoose(node)\n  /** @type {Properties} */\n  const properties = {}\n  /** @type {Array} */\n  const children = []\n\n  if (typeof node.checked === 'boolean') {\n    const head = results[0]\n    /** @type {Element} */\n    let paragraph\n\n    if (head && head.type === 'element' && head.tagName === 'p') {\n      paragraph = head\n    } else {\n      paragraph = {type: 'element', tagName: 'p', properties: {}, children: []}\n      results.unshift(paragraph)\n    }\n\n    if (paragraph.children.length > 0) {\n      paragraph.children.unshift({type: 'text', value: ' '})\n    }\n\n    paragraph.children.unshift({\n      type: 'element',\n      tagName: 'input',\n      properties: {type: 'checkbox', checked: node.checked, disabled: true},\n      children: []\n    })\n\n    // According to github-markdown-css, this class hides bullet.\n    // See: .\n    properties.className = ['task-list-item']\n  }\n\n  let index = -1\n\n  while (++index < results.length) {\n    const child = results[index]\n\n    // Add eols before nodes, except if this is a loose, first paragraph.\n    if (\n      loose ||\n      index !== 0 ||\n      child.type !== 'element' ||\n      child.tagName !== 'p'\n    ) {\n      children.push({type: 'text', value: '\\n'})\n    }\n\n    if (child.type === 'element' && child.tagName === 'p' && !loose) {\n      children.push(...child.children)\n    } else {\n      children.push(child)\n    }\n  }\n\n  const tail = results[results.length - 1]\n\n  // Add a final eol.\n  if (tail && (loose || tail.type !== 'element' || tail.tagName !== 'p')) {\n    children.push({type: 'text', value: '\\n'})\n  }\n\n  /** @type {Element} */\n  const result = {type: 'element', tagName: 'li', properties, children}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n\n/**\n * @param {Parents} node\n * @return {Boolean}\n */\nfunction listLoose(node) {\n  let loose = false\n  if (node.type === 'list') {\n    loose = node.spread || false\n    const children = node.children\n    let index = -1\n\n    while (!loose && ++index < children.length) {\n      loose = listItemLoose(children[index])\n    }\n  }\n\n  return loose\n}\n\n/**\n * @param {ListItem} node\n * @return {Boolean}\n */\nfunction listItemLoose(node) {\n  const spread = node.spread\n\n  return spread === null || spread === undefined\n    ? node.children.length > 1\n    : spread\n}\n", "/**\n * @import {Element, Properties} from 'hast'\n * @import {List} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `list` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {List} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function list(state, node) {\n  /** @type {Properties} */\n  const properties = {}\n  const results = state.all(node)\n  let index = -1\n\n  if (typeof node.start === 'number' && node.start !== 1) {\n    properties.start = node.start\n  }\n\n  // Like GitHub, add a class for custom styling.\n  while (++index < results.length) {\n    const child = results[index]\n\n    if (\n      child.type === 'element' &&\n      child.tagName === 'li' &&\n      child.properties &&\n      Array.isArray(child.properties.className) &&\n      child.properties.className.includes('task-list-item')\n    ) {\n      properties.className = ['contains-task-list']\n      break\n    }\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: node.ordered ? 'ol' : 'ul',\n    properties,\n    children: state.wrap(results, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Paragraph} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `paragraph` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Paragraph} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function paragraph(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'p',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Parents as HastParents, Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `root` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastRoot} node\n *   mdast node.\n * @returns {HastParents}\n *   hast node.\n */\nexport function root(state, node) {\n  /** @type {HastRoot} */\n  const result = {type: 'root', children: state.wrap(state.all(node))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {Strong} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `strong` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Strong} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function strong(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'strong',\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Table} from 'mdast'\n * @import {Element} from 'hast'\n * @import {State} from '../state.js'\n */\n\nimport {pointEnd, pointStart} from 'unist-util-position'\n\n/**\n * Turn an mdast `table` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Table} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function table(state, node) {\n  const rows = state.all(node)\n  const firstRow = rows.shift()\n  /** @type {Array} */\n  const tableContent = []\n\n  if (firstRow) {\n    /** @type {Element} */\n    const head = {\n      type: 'element',\n      tagName: 'thead',\n      properties: {},\n      children: state.wrap([firstRow], true)\n    }\n    state.patch(node.children[0], head)\n    tableContent.push(head)\n  }\n\n  if (rows.length > 0) {\n    /** @type {Element} */\n    const body = {\n      type: 'element',\n      tagName: 'tbody',\n      properties: {},\n      children: state.wrap(rows, true)\n    }\n\n    const start = pointStart(node.children[1])\n    const end = pointEnd(node.children[node.children.length - 1])\n    if (start && end) body.position = {start, end}\n    tableContent.push(body)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'table',\n    properties: {},\n    children: state.wrap(tableContent, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element, ElementContent, Properties} from 'hast'\n * @import {Parents, TableRow} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableRow` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableRow} node\n *   mdast node.\n * @param {Parents | undefined} parent\n *   Parent of `node`.\n * @returns {Element}\n *   hast node.\n */\nexport function tableRow(state, node, parent) {\n  const siblings = parent ? parent.children : undefined\n  // Generate a body row when without parent.\n  const rowIndex = siblings ? siblings.indexOf(node) : 1\n  const tagName = rowIndex === 0 ? 'th' : 'td'\n  // To do: option to use `style`?\n  const align = parent && parent.type === 'table' ? parent.align : undefined\n  const length = align ? align.length : node.children.length\n  let cellIndex = -1\n  /** @type {Array} */\n  const cells = []\n\n  while (++cellIndex < length) {\n    // Note: can also be undefined.\n    const cell = node.children[cellIndex]\n    /** @type {Properties} */\n    const properties = {}\n    const alignValue = align ? align[cellIndex] : undefined\n\n    if (alignValue) {\n      properties.align = alignValue\n    }\n\n    /** @type {Element} */\n    let result = {type: 'element', tagName, properties, children: []}\n\n    if (cell) {\n      result.children = state.all(cell)\n      state.patch(cell, result)\n      result = state.applyData(cell, result)\n    }\n\n    cells.push(result)\n  }\n\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'tr',\n    properties: {},\n    children: state.wrap(cells, true)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {TableCell} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `tableCell` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {TableCell} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function tableCell(state, node) {\n  // Note: this function is normally not called: see `table-row` for how rows\n  // and their cells are compiled.\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'td', // Assume body cell.\n    properties: {},\n    children: state.all(node)\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "const tab = 9 /* `\\t` */\nconst space = 32 /* ` ` */\n\n/**\n * Remove initial and final spaces and tabs at the line breaks in `value`.\n * Does not trim initial and final spaces and tabs of the value itself.\n *\n * @param {string} value\n *   Value to trim.\n * @returns {string}\n *   Trimmed value.\n */\nexport function trimLines(value) {\n  const source = String(value)\n  const search = /\\r?\\n|\\r/g\n  let match = search.exec(source)\n  let last = 0\n  /** @type {Array} */\n  const lines = []\n\n  while (match) {\n    lines.push(\n      trimLine(source.slice(last, match.index), last > 0, true),\n      match[0]\n    )\n\n    last = match.index + match[0].length\n    match = search.exec(source)\n  }\n\n  lines.push(trimLine(source.slice(last), last > 0, false))\n\n  return lines.join('')\n}\n\n/**\n * @param {string} value\n *   Line to trim.\n * @param {boolean} start\n *   Whether to trim the start of the line.\n * @param {boolean} end\n *   Whether to trim the end of the line.\n * @returns {string}\n *   Trimmed line.\n */\nfunction trimLine(value, start, end) {\n  let startIndex = 0\n  let endIndex = value.length\n\n  if (start) {\n    let code = value.codePointAt(startIndex)\n\n    while (code === tab || code === space) {\n      startIndex++\n      code = value.codePointAt(startIndex)\n    }\n  }\n\n  if (end) {\n    let code = value.codePointAt(endIndex - 1)\n\n    while (code === tab || code === space) {\n      endIndex--\n      code = value.codePointAt(endIndex - 1)\n    }\n  }\n\n  return endIndex > startIndex ? value.slice(startIndex, endIndex) : ''\n}\n", "/**\n * @import {Element as HastElement, Text as HastText} from 'hast'\n * @import {Text as MdastText} from 'mdast'\n * @import {State} from '../state.js'\n */\n\nimport {trimLines} from 'trim-lines'\n\n/**\n * Turn an mdast `text` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastText} node\n *   mdast node.\n * @returns {HastElement | HastText}\n *   hast node.\n */\nexport function text(state, node) {\n  /** @type {HastText} */\n  const result = {type: 'text', value: trimLines(String(node.value))}\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Element} from 'hast'\n * @import {ThematicBreak} from 'mdast'\n * @import {State} from '../state.js'\n */\n\n/**\n * Turn an mdast `thematicBreak` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {ThematicBreak} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function thematicBreak(state, node) {\n  /** @type {Element} */\n  const result = {\n    type: 'element',\n    tagName: 'hr',\n    properties: {},\n    children: []\n  }\n  state.patch(node, result)\n  return state.applyData(node, result)\n}\n", "/**\n * @import {Handlers} from '../state.js'\n */\n\nimport {blockquote} from './blockquote.js'\nimport {hardBreak} from './break.js'\nimport {code} from './code.js'\nimport {strikethrough} from './delete.js'\nimport {emphasis} from './emphasis.js'\nimport {footnoteReference} from './footnote-reference.js'\nimport {heading} from './heading.js'\nimport {html} from './html.js'\nimport {imageReference} from './image-reference.js'\nimport {image} from './image.js'\nimport {inlineCode} from './inline-code.js'\nimport {linkReference} from './link-reference.js'\nimport {link} from './link.js'\nimport {listItem} from './list-item.js'\nimport {list} from './list.js'\nimport {paragraph} from './paragraph.js'\nimport {root} from './root.js'\nimport {strong} from './strong.js'\nimport {table} from './table.js'\nimport {tableRow} from './table-row.js'\nimport {tableCell} from './table-cell.js'\nimport {text} from './text.js'\nimport {thematicBreak} from './thematic-break.js'\n\n/**\n * Default handlers for nodes.\n *\n * @satisfies {Handlers}\n */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\n  // @ts-expect-error: root is different, but hard to type.\n  root,\n  strong,\n  table,\n  tableCell,\n  tableRow,\n  text,\n  thematicBreak,\n  toml: ignore,\n  yaml: ignore,\n  definition: ignore,\n  footnoteDefinition: ignore\n}\n\n// Return nothing for nodes that are ignored.\nfunction ignore() {\n  return undefined\n}\n", "import {\n  VOID, PRIMITIVE,\n  ARRAY, OBJECT,\n  DATE, REGEXP, MAP, SET,\n  ERROR, BIGINT\n} from './types.js';\n\nconst env = typeof self === 'object' ? self : globalThis;\n\nconst deserializer = ($, _) => {\n  const as = (out, index) => {\n    $.set(index, out);\n    return out;\n  };\n\n  const unpair = index => {\n    if ($.has(index))\n      return $.get(index);\n\n    const [type, value] = _[index];\n    switch (type) {\n      case PRIMITIVE:\n      case VOID:\n        return as(value, index);\n      case ARRAY: {\n        const arr = as([], index);\n        for (const index of value)\n          arr.push(unpair(index));\n        return arr;\n      }\n      case OBJECT: {\n        const object = as({}, index);\n        for (const [key, index] of value)\n          object[unpair(key)] = unpair(index);\n        return object;\n      }\n      case DATE:\n        return as(new Date(value), index);\n      case REGEXP: {\n        const {source, flags} = value;\n        return as(new RegExp(source, flags), index);\n      }\n      case MAP: {\n        const map = as(new Map, index);\n        for (const [key, index] of value)\n          map.set(unpair(key), unpair(index));\n        return map;\n      }\n      case SET: {\n        const set = as(new Set, index);\n        for (const index of value)\n          set.add(unpair(index));\n        return set;\n      }\n      case ERROR: {\n        const {name, message} = value;\n        return as(new env[name](message), index);\n      }\n      case BIGINT:\n        return as(BigInt(value), index);\n      case 'BigInt':\n        return as(Object(BigInt(value)), index);\n      case 'ArrayBuffer':\n        return as(new Uint8Array(value).buffer, value);\n      case 'DataView': {\n        const { buffer } = new Uint8Array(value);\n        return as(new DataView(buffer), value);\n      }\n    }\n    return as(new env[type](value), index);\n  };\n\n  return unpair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns a deserialized value from a serialized array of Records.\n * @param {Record[]} serialized a previously serialized value.\n * @returns {any}\n */\nexport const deserialize = serialized => deserializer(new Map, serialized)(0);\n", "import {\n  VOID, PRIMITIVE,\n  ARRAY, OBJECT,\n  DATE, REGEXP, MAP, SET,\n  ERROR, BIGINT\n} from './types.js';\n\nconst EMPTY = '';\n\nconst {toString} = {};\nconst {keys} = Object;\n\nconst typeOf = value => {\n  const type = typeof value;\n  if (type !== 'object' || !value)\n    return [PRIMITIVE, type];\n\n  const asString = toString.call(value).slice(8, -1);\n  switch (asString) {\n    case 'Array':\n      return [ARRAY, EMPTY];\n    case 'Object':\n      return [OBJECT, EMPTY];\n    case 'Date':\n      return [DATE, EMPTY];\n    case 'RegExp':\n      return [REGEXP, EMPTY];\n    case 'Map':\n      return [MAP, EMPTY];\n    case 'Set':\n      return [SET, EMPTY];\n    case 'DataView':\n      return [ARRAY, asString];\n  }\n\n  if (asString.includes('Array'))\n    return [ARRAY, asString];\n\n  if (asString.includes('Error'))\n    return [ERROR, asString];\n\n  return [OBJECT, asString];\n};\n\nconst shouldSkip = ([TYPE, type]) => (\n  TYPE === PRIMITIVE &&\n  (type === 'function' || type === 'symbol')\n);\n\nconst serializer = (strict, json, $, _) => {\n\n  const as = (out, value) => {\n    const index = _.push(out) - 1;\n    $.set(value, index);\n    return index;\n  };\n\n  const pair = value => {\n    if ($.has(value))\n      return $.get(value);\n\n    let [TYPE, type] = typeOf(value);\n    switch (TYPE) {\n      case PRIMITIVE: {\n        let entry = value;\n        switch (type) {\n          case 'bigint':\n            TYPE = BIGINT;\n            entry = value.toString();\n            break;\n          case 'function':\n          case 'symbol':\n            if (strict)\n              throw new TypeError('unable to serialize ' + type);\n            entry = null;\n            break;\n          case 'undefined':\n            return as([VOID], value);\n        }\n        return as([TYPE, entry], value);\n      }\n      case ARRAY: {\n        if (type) {\n          let spread = value;\n          if (type === 'DataView') {\n            spread = new Uint8Array(value.buffer);\n          }\n          else if (type === 'ArrayBuffer') {\n            spread = new Uint8Array(value);\n          }\n          return as([type, [...spread]], value);\n        }\n\n        const arr = [];\n        const index = as([TYPE, arr], value);\n        for (const entry of value)\n          arr.push(pair(entry));\n        return index;\n      }\n      case OBJECT: {\n        if (type) {\n          switch (type) {\n            case 'BigInt':\n              return as([type, value.toString()], value);\n            case 'Boolean':\n            case 'Number':\n            case 'String':\n              return as([type, value.valueOf()], value);\n          }\n        }\n\n        if (json && ('toJSON' in value))\n          return pair(value.toJSON());\n\n        const entries = [];\n        const index = as([TYPE, entries], value);\n        for (const key of keys(value)) {\n          if (strict || !shouldSkip(typeOf(value[key])))\n            entries.push([pair(key), pair(value[key])]);\n        }\n        return index;\n      }\n      case DATE:\n        return as([TYPE, value.toISOString()], value);\n      case REGEXP: {\n        const {source, flags} = value;\n        return as([TYPE, {source, flags}], value);\n      }\n      case MAP: {\n        const entries = [];\n        const index = as([TYPE, entries], value);\n        for (const [key, entry] of value) {\n          if (strict || !(shouldSkip(typeOf(key)) || shouldSkip(typeOf(entry))))\n            entries.push([pair(key), pair(entry)]);\n        }\n        return index;\n      }\n      case SET: {\n        const entries = [];\n        const index = as([TYPE, entries], value);\n        for (const entry of value) {\n          if (strict || !shouldSkip(typeOf(entry)))\n            entries.push(pair(entry));\n        }\n        return index;\n      }\n    }\n\n    const {message} = value;\n    return as([TYPE, {name: type, message}], value);\n  };\n\n  return pair;\n};\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} value a serializable value.\n * @param {{json?: boolean, lossy?: boolean}?} options an object with a `lossy` or `json` property that,\n *  if `true`, will not throw errors on incompatible types, and behave more\n *  like JSON stringify would behave. Symbol and Function will be discarded.\n * @returns {Record[]}\n */\n export const serialize = (value, {json, lossy} = {}) => {\n  const _ = [];\n  return serializer(!(json || lossy), !!json, new Map, _)(value), _;\n};\n", "import {deserialize} from './deserialize.js';\nimport {serialize} from './serialize.js';\n\n/**\n * @typedef {Array} Record a type representation\n */\n\n/**\n * Returns an array of serialized Records.\n * @param {any} any a serializable value.\n * @param {{transfer?: any[], json?: boolean, lossy?: boolean}?} options an object with\n * a transfer option (ignored when polyfilled) and/or non standard fields that\n * fallback to the polyfill if present.\n * @returns {Record[]}\n */\nexport default typeof structuredClone === \"function\" ?\n  /* c8 ignore start */\n  (any, options) => (\n    options && ('json' in options || 'lossy' in options) ?\n      deserialize(serialize(any, options)) : structuredClone(any)\n  ) :\n  (any, options) => deserialize(serialize(any, options));\n  /* c8 ignore stop */\n\nexport {deserialize, serialize};\n", "/**\n * @import {ElementContent, Element} from 'hast'\n * @import {State} from './state.js'\n */\n\n/**\n * @callback FootnoteBackContentTemplate\n *   Generate content for the backreference dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array | ElementContent | string}\n *   Content for the backreference when linking back from definitions to their\n *   reference.\n *\n * @callback FootnoteBackLabelTemplate\n *   Generate a back label dynamically.\n *\n *   For the following markdown:\n *\n *   ```markdown\n *   Alpha[^micromark], bravo[^micromark], and charlie[^remark].\n *\n *   [^remark]: things about remark\n *   [^micromark]: things about micromark\n *   ```\n *\n *   This function will be called with:\n *\n *   *  `0` and `0` for the backreference from `things about micromark` to\n *      `alpha`, as it is the first used definition, and the first call to it\n *   *  `0` and `1` for the backreference from `things about micromark` to\n *      `bravo`, as it is the first used definition, and the second call to it\n *   *  `1` and `0` for the backreference from `things about remark` to\n *      `charlie`, as it is the second used definition\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Back label to use when linking back from definitions to their reference.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\n\n/**\n * Generate the default content that GitHub uses on backreferences.\n *\n * @param {number} _\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {Array}\n *   Content.\n */\nexport function defaultFootnoteBackContent(_, rereferenceIndex) {\n  /** @type {Array} */\n  const result = [{type: 'text', value: '\u21A9'}]\n\n  if (rereferenceIndex > 1) {\n    result.push({\n      type: 'element',\n      tagName: 'sup',\n      properties: {},\n      children: [{type: 'text', value: String(rereferenceIndex)}]\n    })\n  }\n\n  return result\n}\n\n/**\n * Generate the default label that GitHub uses on backreferences.\n *\n * @param {number} referenceIndex\n *   Index of the definition in the order that they are first referenced,\n *   0-indexed.\n * @param {number} rereferenceIndex\n *   Index of calls to the same definition, 0-indexed.\n * @returns {string}\n *   Label.\n */\nexport function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n  return (\n    'Back to reference ' +\n    (referenceIndex + 1) +\n    (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n  )\n}\n\n/**\n * Generate a hast footer for called footnote definitions.\n *\n * @param {State} state\n *   Info passed around.\n * @returns {Element | undefined}\n *   `section` element or `undefined`.\n */\n// eslint-disable-next-line complexity\nexport function footer(state) {\n  const clobberPrefix =\n    typeof state.options.clobberPrefix === 'string'\n      ? state.options.clobberPrefix\n      : 'user-content-'\n  const footnoteBackContent =\n    state.options.footnoteBackContent || defaultFootnoteBackContent\n  const footnoteBackLabel =\n    state.options.footnoteBackLabel || defaultFootnoteBackLabel\n  const footnoteLabel = state.options.footnoteLabel || 'Footnotes'\n  const footnoteLabelTagName = state.options.footnoteLabelTagName || 'h2'\n  const footnoteLabelProperties = state.options.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  /** @type {Array} */\n  const listItems = []\n  let referenceIndex = -1\n\n  while (++referenceIndex < state.footnoteOrder.length) {\n    const definition = state.footnoteById.get(\n      state.footnoteOrder[referenceIndex]\n    )\n\n    if (!definition) {\n      continue\n    }\n\n    const content = state.all(definition)\n    const id = String(definition.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let rereferenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n    const counts = state.footnoteCounts.get(id)\n\n    // eslint-disable-next-line no-unmodified-loop-condition\n    while (counts !== undefined && ++rereferenceIndex <= counts) {\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      let children =\n        typeof footnoteBackContent === 'string'\n          ? footnoteBackContent\n          : footnoteBackContent(referenceIndex, rereferenceIndex)\n\n      if (typeof children === 'string') {\n        children = {type: 'text', value: children}\n      }\n\n      backReferences.push({\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            clobberPrefix +\n            'fnref-' +\n            safeId +\n            (rereferenceIndex > 1 ? '-' + rereferenceIndex : ''),\n          dataFootnoteBackref: '',\n          ariaLabel:\n            typeof footnoteBackLabel === 'string'\n              ? footnoteBackLabel\n              : footnoteBackLabel(referenceIndex, rereferenceIndex),\n          className: ['data-footnote-backref']\n        },\n        children: Array.isArray(children) ? children : [children]\n      })\n    }\n\n    const tail = content[content.length - 1]\n\n    if (tail && tail.type === 'element' && tail.tagName === 'p') {\n      const tailTail = tail.children[tail.children.length - 1]\n      if (tailTail && tailTail.type === 'text') {\n        tailTail.value += ' '\n      } else {\n        tail.children.push({type: 'text', value: ' '})\n      }\n\n      tail.children.push(...backReferences)\n    } else {\n      content.push(...backReferences)\n    }\n\n    /** @type {Element} */\n    const listItem = {\n      type: 'element',\n      tagName: 'li',\n      properties: {id: clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(definition, listItem)\n\n    listItems.push(listItem)\n  }\n\n  if (listItems.length === 0) {\n    return\n  }\n\n  return {\n    type: 'element',\n    tagName: 'section',\n    properties: {dataFootnotes: true, className: ['footnotes']},\n    children: [\n      {\n        type: 'element',\n        tagName: footnoteLabelTagName,\n        properties: {\n          ...structuredClone(footnoteLabelProperties),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: footnoteLabel}]\n      },\n      {type: 'text', value: '\\n'},\n      {\n        type: 'element',\n        tagName: 'ol',\n        properties: {},\n        children: state.wrap(listItems, true)\n      },\n      {type: 'text', value: '\\n'}\n    ]\n  }\n}\n", "/**\n * @import {\n *   ElementContent as HastElementContent,\n *   Element as HastElement,\n *   Nodes as HastNodes,\n *   Properties as HastProperties,\n *   RootContent as HastRootContent,\n *   Text as HastText\n * } from 'hast'\n * @import {\n *   Definition as MdastDefinition,\n *   FootnoteDefinition as MdastFootnoteDefinition,\n *   Nodes as MdastNodes,\n *   Parents as MdastParents\n * } from 'mdast'\n * @import {VFile} from 'vfile'\n * @import {\n *   FootnoteBackContentTemplate,\n *   FootnoteBackLabelTemplate\n * } from './footer.js'\n */\n\n/**\n * @callback Handler\n *   Handle a node.\n * @param {State} state\n *   Info passed around.\n * @param {any} node\n *   mdast node to handle.\n * @param {MdastParents | undefined} parent\n *   Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n *   hast node.\n *\n * @typedef {Partial>} Handlers\n *   Handle nodes.\n *\n * @typedef Options\n *   Configuration (optional).\n * @property {boolean | null | undefined} [allowDangerousHtml=false]\n *   Whether to persist raw HTML in markdown in the hast tree (default:\n *   `false`).\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` property on footnotes to prevent them from\n *   *clobbering* (default: `'user-content-'`).\n *\n *   Pass `''` for trusted markdown and when you are careful with\n *   polyfilling.\n *   You could pass a different prefix.\n *\n *   DOM clobbering is this:\n *\n *   ```html\n *   

\n * \n * ```\n *\n * The above example shows that elements are made available by browsers, by\n * their ID, on the `window` object.\n * This is a security risk because you might be expecting some other variable\n * at that place.\n * It can also break polyfills.\n * Using a prefix solves these problems.\n * @property {VFile | null | undefined} [file]\n * Corresponding virtual file representing the input document (optional).\n * @property {FootnoteBackContentTemplate | string | null | undefined} [footnoteBackContent]\n * Content of the backreference back to references (default: `defaultFootnoteBackContent`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackContent(_, rereferenceIndex) {\n * const result = [{type: 'text', value: '\u21A9'}]\n *\n * if (rereferenceIndex > 1) {\n * result.push({\n * type: 'element',\n * tagName: 'sup',\n * properties: {},\n * children: [{type: 'text', value: String(rereferenceIndex)}]\n * })\n * }\n *\n * return result\n * }\n * ```\n *\n * This content is used in the `a` element of each backreference (the `\u21A9`\n * links).\n * @property {FootnoteBackLabelTemplate | string | null | undefined} [footnoteBackLabel]\n * Label to describe the backreference back to references (default:\n * `defaultFootnoteBackLabel`).\n *\n * The default value is:\n *\n * ```js\n * function defaultFootnoteBackLabel(referenceIndex, rereferenceIndex) {\n * return (\n * 'Back to reference ' +\n * (referenceIndex + 1) +\n * (rereferenceIndex > 1 ? '-' + rereferenceIndex : '')\n * )\n * }\n * ```\n *\n * Change it when the markdown is not in English.\n *\n * This label is used in the `ariaLabel` property on each backreference\n * (the `\u21A9` links).\n * It affects users of assistive technology.\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n * Textual label to use for the footnotes section (default: `'Footnotes'`).\n *\n * Change it when the markdown is not in English.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n * Properties to use on the footnote label (default: `{className:\n * ['sr-only']}`).\n *\n * Change it to show the label and add other properties.\n *\n * This label is typically hidden visually (assuming an `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass an empty string.\n * You can also add different properties.\n *\n * > **Note**: `id: 'footnote-label'` is always added, because footnote\n * > calls use it with `aria-describedby` to provide an accessible label.\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n * HTML tag name to use for the footnote label element (default: `'h2'`).\n *\n * Change it to match your document structure.\n *\n * This label is typically hidden visually (assuming a `sr-only` CSS class\n * is defined that does that) and so affects screen readers only.\n * If you do have such a class, but want to show this section to everyone,\n * pass different properties with the `footnoteLabelProperties` option.\n * @property {Handlers | null | undefined} [handlers]\n * Extra handlers for nodes (optional).\n * @property {Array | null | undefined} [passThrough]\n * List of custom mdast node types to pass through (keep) in hast (note that\n * the node itself is passed, but eventual children are transformed)\n * (optional).\n * @property {Handler | null | undefined} [unknownHandler]\n * Handler for all unknown nodes (optional).\n *\n * @typedef State\n * Info passed around.\n * @property {(node: MdastNodes) => Array} all\n * Transform the children of an mdast parent to hast.\n * @property {(from: MdastNodes, to: Type) => HastElement | Type} applyData\n * Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {Map} definitionById\n * Definitions by their identifier.\n * @property {Map} footnoteById\n * Footnote definitions by their identifier.\n * @property {Map} footnoteCounts\n * Counts for how often the same footnote was called.\n * @property {Array} footnoteOrder\n * Identifiers of order when footnote calls first appear in tree order.\n * @property {Handlers} handlers\n * Applied handlers.\n * @property {(node: MdastNodes, parent: MdastParents | undefined) => Array | HastElementContent | undefined} one\n * Transform an mdast node to hast.\n * @property {Options} options\n * Configuration.\n * @property {(from: MdastNodes, node: HastNodes) => undefined} patch\n * Copy a node\u2019s positional info.\n * @property {(nodes: Array, loose?: boolean | undefined) => Array} wrap\n * Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {visit} from 'unist-util-visit'\nimport {position} from 'unist-util-position'\nimport {handlers as defaultHandlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\n\n/** @type {Options} */\nconst emptyOptions = {}\n\n/**\n * Create `state` from an mdast tree.\n *\n * @param {MdastNodes} tree\n * mdast node to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {State}\n * `state` function.\n */\nexport function createState(tree, options) {\n const settings = options || emptyOptions\n /** @type {Map} */\n const definitionById = new Map()\n /** @type {Map} */\n const footnoteById = new Map()\n /** @type {Map} */\n const footnoteCounts = new Map()\n /** @type {Handlers} */\n // @ts-expect-error: the root handler returns a root.\n // Hard to type.\n const handlers = {...defaultHandlers, ...settings.handlers}\n\n /** @type {State} */\n const state = {\n all,\n applyData,\n definitionById,\n footnoteById,\n footnoteCounts,\n footnoteOrder: [],\n handlers,\n one,\n options: settings,\n patch,\n wrap\n }\n\n visit(tree, function (node) {\n if (node.type === 'definition' || node.type === 'footnoteDefinition') {\n const map = node.type === 'definition' ? definitionById : footnoteById\n const id = String(node.identifier).toUpperCase()\n\n // Mimick CM behavior of link definitions.\n // See: .\n if (!map.has(id)) {\n // @ts-expect-error: node type matches map.\n map.set(id, node)\n }\n }\n })\n\n return state\n\n /**\n * Transform an mdast node into a hast node.\n *\n * @param {MdastNodes} node\n * mdast node.\n * @param {MdastParents | undefined} [parent]\n * Parent of `node`.\n * @returns {Array | HastElementContent | undefined}\n * Resulting hast node.\n */\n function one(node, parent) {\n const type = node.type\n const handle = state.handlers[type]\n\n if (own.call(state.handlers, type) && handle) {\n return handle(state, node, parent)\n }\n\n if (state.options.passThrough && state.options.passThrough.includes(type)) {\n if ('children' in node) {\n const {children, ...shallow} = node\n const result = structuredClone(shallow)\n // @ts-expect-error: TS doesn\u2019t understand\u2026\n result.children = state.all(node)\n // @ts-expect-error: TS doesn\u2019t understand\u2026\n return result\n }\n\n // @ts-expect-error: it\u2019s custom.\n return structuredClone(node)\n }\n\n const unknown = state.options.unknownHandler || defaultUnknownHandler\n\n return unknown(state, node, parent)\n }\n\n /**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {MdastNodes} parent\n * mdast node to compile\n * @returns {Array}\n * Resulting hast nodes.\n */\n function all(parent) {\n /** @type {Array} */\n const values = []\n\n if ('children' in parent) {\n const nodes = parent.children\n let index = -1\n while (++index < nodes.length) {\n const result = state.one(nodes[index], parent)\n\n // To do: see if we van clean this? Can we merge texts?\n if (result) {\n if (index && nodes[index - 1].type === 'break') {\n if (!Array.isArray(result) && result.type === 'text') {\n result.value = trimMarkdownSpaceStart(result.value)\n }\n\n if (!Array.isArray(result) && result.type === 'element') {\n const head = result.children[0]\n\n if (head && head.type === 'text') {\n head.value = trimMarkdownSpaceStart(head.value)\n }\n }\n }\n\n if (Array.isArray(result)) {\n values.push(...result)\n } else {\n values.push(result)\n }\n }\n }\n }\n\n return values\n }\n}\n\n/**\n * Copy a node\u2019s positional info.\n *\n * @param {MdastNodes} from\n * mdast node to copy from.\n * @param {HastNodes} to\n * hast node to copy into.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n if (from.position) to.position = position(from)\n}\n\n/**\n * Honor the `data` of `from` and maybe generate an element instead of `to`.\n *\n * @template {HastNodes} Type\n * Node type.\n * @param {MdastNodes} from\n * mdast node to use data from.\n * @param {Type} to\n * hast node to change.\n * @returns {HastElement | Type}\n * Nothing.\n */\nfunction applyData(from, to) {\n /** @type {HastElement | Type} */\n let result = to\n\n // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n if (from && from.data) {\n const hName = from.data.hName\n const hChildren = from.data.hChildren\n const hProperties = from.data.hProperties\n\n if (typeof hName === 'string') {\n // Transforming the node resulted in an element with a different name\n // than wanted:\n if (result.type === 'element') {\n result.tagName = hName\n }\n // Transforming the node resulted in a non-element, which happens for\n // raw, text, and root nodes (unless custom handlers are passed).\n // The intent of `hName` is to create an element, but likely also to keep\n // the content around (otherwise: pass `hChildren`).\n else {\n /** @type {Array} */\n // @ts-expect-error: assume no doctypes in `root`.\n const children = 'children' in result ? result.children : [result]\n result = {type: 'element', tagName: hName, properties: {}, children}\n }\n }\n\n if (result.type === 'element' && hProperties) {\n Object.assign(result.properties, structuredClone(hProperties))\n }\n\n if (\n 'children' in result &&\n result.children &&\n hChildren !== null &&\n hChildren !== undefined\n ) {\n result.children = hChildren\n }\n }\n\n return result\n}\n\n/**\n * Transform an unknown node.\n *\n * @param {State} state\n * Info passed around.\n * @param {MdastNodes} node\n * Unknown mdast node.\n * @returns {HastElement | HastText}\n * Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n const data = node.data || {}\n /** @type {HastElement | HastText} */\n const result =\n 'value' in node &&\n !(own.call(data, 'hProperties') || own.call(data, 'hChildren'))\n ? {type: 'text', value: node.value}\n : {\n type: 'element',\n tagName: 'div',\n properties: {},\n children: state.all(node)\n }\n\n state.patch(node, result)\n return state.applyData(node, result)\n}\n\n/**\n * Wrap `nodes` with line endings between each node.\n *\n * @template {HastRootContent} Type\n * Node type.\n * @param {Array} nodes\n * List of nodes to wrap.\n * @param {boolean | undefined} [loose=false]\n * Whether to add line endings at start and end (default: `false`).\n * @returns {Array}\n * Wrapped nodes.\n */\nexport function wrap(nodes, loose) {\n /** @type {Array} */\n const result = []\n let index = -1\n\n if (loose) {\n result.push({type: 'text', value: '\\n'})\n }\n\n while (++index < nodes.length) {\n if (index) result.push({type: 'text', value: '\\n'})\n result.push(nodes[index])\n }\n\n if (loose && nodes.length > 0) {\n result.push({type: 'text', value: '\\n'})\n }\n\n return result\n}\n\n/**\n * Trim spaces and tabs at the start of `value`.\n *\n * @param {string} value\n * Value to trim.\n * @returns {string}\n * Result.\n */\nfunction trimMarkdownSpaceStart(value) {\n let index = 0\n let code = value.charCodeAt(index)\n\n while (code === 9 || code === 32) {\n index++\n code = value.charCodeAt(index)\n }\n\n return value.slice(index)\n}\n", "/**\n * @import {Nodes as HastNodes} from 'hast'\n * @import {Nodes as MdastNodes} from 'mdast'\n * @import {Options} from './state.js'\n */\n\nimport {ok as assert} from 'devlop'\nimport {footer} from './footer.js'\nimport {createState} from './state.js'\n\n/**\n * Transform mdast to hast.\n *\n * ##### Notes\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most utilities ignore `raw` nodes but two notable ones don\u2019t:\n *\n * * `hast-util-to-html` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful\n * if you completely trust authors\n * * `hast-util-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc).\n * This is a heavy task as it needs a full HTML parser, but it is the only\n * way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark, which we follow by default.\n * They are supported by GitHub, so footnotes can be enabled in markdown with\n * `mdast-util-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes, which is hidden for sighted users but shown to\n * assistive technology.\n * When your page is not in English, you must define translated values.\n *\n * Back references use ARIA attributes, but the section label itself uses a\n * heading that is hidden with an `sr-only` class.\n * To show it to sighted users, define different attributes in\n * `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem, as it links footnote calls to footnote\n * definitions on the page through `id` attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * Example: headings (DOM clobbering) in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn\u2019t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value` (and doesn\u2019t have `data.hName`,\n * `data.hProperties`, or `data.hChildren`, see later), create a hast `text`\n * node\n * * otherwise, create a `
` element (which could be changed with\n * `data.hName`), with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @param {MdastNodes} tree\n * mdast tree.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {HastNodes}\n * hast tree.\n */\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, undefined)\n const foot = footer(state)\n /** @type {HastNodes} */\n const result = Array.isArray(node)\n ? {type: 'root', children: node}\n : node || {type: 'root', children: []}\n\n if (foot) {\n // If there\u2019s a footer, there were definitions, meaning block\n // content.\n // So `result` is a parent node.\n assert('children' in result)\n result.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n return result\n}\n", "/**\n * @import {Root as HastRoot} from 'hast'\n * @import {Root as MdastRoot} from 'mdast'\n * @import {Options as ToHastOptions} from 'mdast-util-to-hast'\n * @import {Processor} from 'unified'\n * @import {VFile} from 'vfile'\n */\n\n/**\n * @typedef {Omit} Options\n *\n * @callback TransformBridge\n * Bridge-mode.\n *\n * Runs the destination with the new hast tree.\n * Discards result.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {Promise}\n * Nothing.\n *\n * @callback TransformMutate\n * Mutate-mode.\n *\n * Further transformers run on the hast tree.\n * @param {MdastRoot} tree\n * Tree.\n * @param {VFile} file\n * File.\n * @returns {HastRoot}\n * Tree (hast).\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n/**\n * Turn markdown into HTML.\n *\n * ##### Notes\n *\n * ###### Signature\n *\n * * if a processor is given,\n * runs the (rehype) plugins used on it with a hast tree,\n * then discards the result (*bridge mode*)\n * * otherwise,\n * returns a hast tree,\n * the plugins used after `remarkRehype` are rehype plugins (*mutate mode*)\n *\n * > \uD83D\uDC49 **Note**:\n * > It\u2019s highly unlikely that you want to pass a `processor`.\n *\n * ###### HTML\n *\n * Raw HTML is available in mdast as `html` nodes and can be embedded in hast\n * as semistandard `raw` nodes.\n * Most plugins ignore `raw` nodes but two notable ones don\u2019t:\n *\n * * `rehype-stringify` also has an option `allowDangerousHtml` which will\n * output the raw HTML.\n * This is typically discouraged as noted by the option name but is useful if\n * you completely trust authors\n * * `rehype-raw` can handle the raw embedded HTML strings by parsing them\n * into standard hast nodes (`element`, `text`, etc);\n * this is a heavy task as it needs a full HTML parser,\n * but it is the only way to support untrusted content\n *\n * ###### Footnotes\n *\n * Many options supported here relate to footnotes.\n * Footnotes are not specified by CommonMark,\n * which we follow by default.\n * They are supported by GitHub,\n * so footnotes can be enabled in markdown with `remark-gfm`.\n *\n * The options `footnoteBackLabel` and `footnoteLabel` define natural language\n * that explains footnotes,\n * which is hidden for sighted users but shown to assistive technology.\n * When your page is not in English,\n * you must define translated values.\n *\n * Back references use ARIA attributes,\n * but the section label itself uses a heading that is hidden with an\n * `sr-only` class.\n * To show it to sighted users,\n * define different attributes in `footnoteLabelProperties`.\n *\n * ###### Clobbering\n *\n * Footnotes introduces a problem,\n * as it links footnote calls to footnote definitions on the page through `id`\n * attributes generated from user content,\n * which results in DOM clobbering.\n *\n * DOM clobbering is this:\n *\n * ```html\n *

\n * \n * ```\n *\n * Elements by their ID are made available by browsers on the `window` object,\n * which is a security risk.\n * Using a prefix solves this problem.\n *\n * More information on how to handle clobbering and the prefix is explained in\n * *Example: headings (DOM clobbering)* in `rehype-sanitize`.\n *\n * ###### Unknown nodes\n *\n * Unknown nodes are nodes with a type that isn\u2019t in `handlers` or `passThrough`.\n * The default behavior for unknown nodes is:\n *\n * * when the node has a `value`\n * (and doesn\u2019t have `data.hName`, `data.hProperties`, or `data.hChildren`,\n * see later),\n * create a hast `text` node\n * * otherwise,\n * create a `
` element (which could be changed with `data.hName`),\n * with its children mapped from mdast to hast as well\n *\n * This behavior can be changed by passing an `unknownHandler`.\n *\n * @overload\n * @param {Processor} processor\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge}\n *\n * @overload\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformMutate}\n *\n * @overload\n * @param {Readonly | Processor | null | undefined} [destination]\n * @param {Readonly | null | undefined} [options]\n * @returns {TransformBridge | TransformMutate}\n *\n * @param {Readonly | Processor | null | undefined} [destination]\n * Processor or configuration (optional).\n * @param {Readonly | null | undefined} [options]\n * When a processor was given,\n * configuration (optional).\n * @returns {TransformBridge | TransformMutate}\n * Transform.\n */\nexport default function remarkRehype(destination, options) {\n if (destination && 'run' in destination) {\n /**\n * @type {TransformBridge}\n */\n return async function (tree, file) {\n // Cast because root in -> root out.\n const hastTree = /** @type {HastRoot} */ (\n toHast(tree, {file, ...options})\n )\n await destination.run(hastTree, file)\n }\n }\n\n /**\n * @type {TransformMutate}\n */\n return function (tree, file) {\n // Cast because root in -> root out.\n // To do: in the future, disallow ` || options` fallback.\n // With `unified-engine`, `destination` can be `undefined` but\n // `options` will be the file set.\n // We should not pass that as `options`.\n return /** @type {HastRoot} */ (\n toHast(tree, {file, ...(destination || options)})\n )\n }\n}\n", "/**\n * @import {Comment, Doctype, Element, Nodes, RootContent, Root, Text} from 'hast'\n * @import {DefaultTreeAdapterMap, Token} from 'parse5'\n * @import {Schema} from 'property-information'\n */\n\n/**\n * @typedef {DefaultTreeAdapterMap['document']} Parse5Document\n * @typedef {DefaultTreeAdapterMap['documentFragment']} Parse5Fragment\n * @typedef {DefaultTreeAdapterMap['element']} Parse5Element\n * @typedef {DefaultTreeAdapterMap['node']} Parse5Nodes\n * @typedef {DefaultTreeAdapterMap['documentType']} Parse5Doctype\n * @typedef {DefaultTreeAdapterMap['commentNode']} Parse5Comment\n * @typedef {DefaultTreeAdapterMap['textNode']} Parse5Text\n * @typedef {DefaultTreeAdapterMap['parentNode']} Parse5Parent\n * @typedef {Token.Attribute} Parse5Attribute\n *\n * @typedef Options\n * Configuration.\n * @property {Space | null | undefined} [space='html']\n * Which space the document is in (default: `'html'`).\n *\n * When an `` element is found in the HTML space, this package already\n * automatically switches to and from the SVG space when entering and exiting\n * it.\n *\n * @typedef {Exclude} Parse5Content\n *\n * @typedef {'html' | 'svg'} Space\n */\n\nimport {stringify as commas} from 'comma-separated-tokens'\nimport {ok as assert} from 'devlop'\nimport {find, html, svg} from 'property-information'\nimport {stringify as spaces} from 'space-separated-tokens'\nimport {webNamespaces} from 'web-namespaces'\nimport {zwitch} from 'zwitch'\n\n/** @type {Options} */\nconst emptyOptions = {}\n\nconst own = {}.hasOwnProperty\n\nconst one = zwitch('type', {handlers: {root, element, text, comment, doctype}})\n\n/**\n * Transform a hast tree to a `parse5` AST.\n *\n * @param {Nodes} tree\n * Tree to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {Parse5Nodes}\n * `parse5` node.\n */\nexport function toParse5(tree, options) {\n const settings = options || emptyOptions\n const space = settings.space\n return one(tree, space === 'svg' ? svg : html)\n}\n\n/**\n * @param {Root} node\n * Node (hast) to transform.\n * @param {Schema} schema\n * Current schema.\n * @returns {Parse5Document}\n * Parse5 node.\n */\nfunction root(node, schema) {\n /** @type {Parse5Document} */\n const result = {\n nodeName: '#document',\n // @ts-expect-error: `parse5` uses enums, which are actually strings.\n mode: (node.data || {}).quirksMode ? 'quirks' : 'no-quirks',\n childNodes: []\n }\n result.childNodes = all(node.children, result, schema)\n patch(node, result)\n return result\n}\n\n/**\n * @param {Root} node\n * Node (hast) to transform.\n * @param {Schema} schema\n * Current schema.\n * @returns {Parse5Fragment}\n * Parse5 node.\n */\nfunction fragment(node, schema) {\n /** @type {Parse5Fragment} */\n const result = {nodeName: '#document-fragment', childNodes: []}\n result.childNodes = all(node.children, result, schema)\n patch(node, result)\n return result\n}\n\n/**\n * @param {Doctype} node\n * Node (hast) to transform.\n * @returns {Parse5Doctype}\n * Parse5 node.\n */\nfunction doctype(node) {\n /** @type {Parse5Doctype} */\n const result = {\n nodeName: '#documentType',\n name: 'html',\n publicId: '',\n systemId: '',\n parentNode: null\n }\n\n patch(node, result)\n return result\n}\n\n/**\n * @param {Text} node\n * Node (hast) to transform.\n * @returns {Parse5Text}\n * Parse5 node.\n */\nfunction text(node) {\n /** @type {Parse5Text} */\n const result = {\n nodeName: '#text',\n value: node.value,\n parentNode: null\n }\n patch(node, result)\n return result\n}\n\n/**\n * @param {Comment} node\n * Node (hast) to transform.\n * @returns {Parse5Comment}\n * Parse5 node.\n */\nfunction comment(node) {\n /** @type {Parse5Comment} */\n const result = {\n nodeName: '#comment',\n data: node.value,\n parentNode: null\n }\n\n patch(node, result)\n\n return result\n}\n\n/**\n * @param {Element} node\n * Node (hast) to transform.\n * @param {Schema} schema\n * Current schema.\n * @returns {Parse5Element}\n * Parse5 node.\n */\nfunction element(node, schema) {\n const parentSchema = schema\n let currentSchema = parentSchema\n\n if (\n node.type === 'element' &&\n node.tagName.toLowerCase() === 'svg' &&\n parentSchema.space === 'html'\n ) {\n currentSchema = svg\n }\n\n /** @type {Array} */\n const attrs = []\n /** @type {string} */\n let prop\n\n if (node.properties) {\n for (prop in node.properties) {\n if (prop !== 'children' && own.call(node.properties, prop)) {\n const result = createProperty(\n currentSchema,\n prop,\n node.properties[prop]\n )\n\n if (result) {\n attrs.push(result)\n }\n }\n }\n }\n\n const space = currentSchema.space\n // `html` and `svg` both have a space.\n assert(space)\n\n /** @type {Parse5Element} */\n const result = {\n nodeName: node.tagName,\n tagName: node.tagName,\n attrs,\n // @ts-expect-error: `parse5` types are wrong.\n namespaceURI: webNamespaces[space],\n childNodes: [],\n parentNode: null\n }\n result.childNodes = all(node.children, result, currentSchema)\n patch(node, result)\n\n if (node.tagName === 'template' && node.content) {\n // @ts-expect-error: `parse5` types are wrong.\n result.content = fragment(node.content, currentSchema)\n }\n\n return result\n}\n\n/**\n * Handle a property.\n *\n * @param {Schema} schema\n * Current schema.\n * @param {string} prop\n * Key.\n * @param {Array | boolean | number | string | null | undefined} value\n * hast property value.\n * @returns {Parse5Attribute | undefined}\n * Field for runtime, optional.\n */\nfunction createProperty(schema, prop, value) {\n const info = find(schema, prop)\n\n // Ignore nullish and `NaN` values.\n if (\n value === false ||\n value === null ||\n value === undefined ||\n (typeof value === 'number' && Number.isNaN(value)) ||\n (!value && info.boolean)\n ) {\n return\n }\n\n if (Array.isArray(value)) {\n // Accept `array`.\n // Most props are space-separated.\n value = info.commaSeparated ? commas(value) : spaces(value)\n }\n\n /** @type {Parse5Attribute} */\n const attribute = {\n name: info.attribute,\n value: value === true ? '' : String(value)\n }\n\n if (info.space && info.space !== 'html' && info.space !== 'svg') {\n const index = attribute.name.indexOf(':')\n\n if (index < 0) {\n attribute.prefix = ''\n } else {\n attribute.name = attribute.name.slice(index + 1)\n attribute.prefix = info.attribute.slice(0, index)\n }\n\n attribute.namespace = webNamespaces[info.space]\n }\n\n return attribute\n}\n\n/**\n * Transform all hast nodes.\n *\n * @param {Array} children\n * List of children.\n * @param {Parse5Parent} parentNode\n * `parse5` parent node.\n * @param {Schema} schema\n * Current schema.\n * @returns {Array}\n * Transformed children.\n */\nfunction all(children, parentNode, schema) {\n let index = -1\n /** @type {Array} */\n const results = []\n\n if (children) {\n while (++index < children.length) {\n /** @type {Parse5Content} */\n const child = one(children[index], schema)\n\n child.parentNode = parentNode\n\n results.push(child)\n }\n }\n\n return results\n}\n\n/**\n * Add position info from `from` to `to`.\n *\n * @param {Nodes} from\n * hast node.\n * @param {Parse5Nodes} to\n * `parse5` node.\n * @returns {undefined}\n * Nothing.\n */\nfunction patch(from, to) {\n const position = from.position\n\n if (position && position.start && position.end) {\n assert(typeof position.start.offset === 'number')\n assert(typeof position.end.offset === 'number')\n\n to.sourceCodeLocation = {\n startLine: position.start.line,\n startCol: position.start.column,\n startOffset: position.start.offset,\n endLine: position.end.line,\n endCol: position.end.column,\n endOffset: position.end.offset\n }\n }\n}\n", "/**\n * @import {Options} from 'hast-util-raw'\n * @import {Comment, Doctype, Element, Nodes, RootContent, Root, Text} from 'hast'\n * @import {Raw} from 'mdast-util-to-hast'\n * @import {DefaultTreeAdapterMap, ParserOptions} from 'parse5'\n * @import {Point} from 'unist'\n */\n\n/**\n * @typedef State\n * Info passed around about the current state.\n * @property {(node: Nodes) => undefined} handle\n * Add a hast node to the parser.\n * @property {Options} options\n * User configuration.\n * @property {Parser} parser\n * Current parser.\n * @property {boolean} stitches\n * Whether there are stitches.\n */\n\n/**\n * @typedef Stitch\n * Custom comment-like value we pass through parse5, which contains a\n * replacement node that we\u2019ll swap back in afterwards.\n * @property {'comment'} type\n * Node type.\n * @property {{stitch: Nodes}} value\n * Replacement value.\n */\n\nimport structuredClone from '@ungap/structured-clone'\nimport {fromParse5} from 'hast-util-from-parse5'\nimport {toParse5} from 'hast-util-to-parse5'\nimport {htmlVoidElements} from 'html-void-elements'\nimport {Parser, Token, TokenizerMode, html} from 'parse5'\nimport {pointEnd, pointStart} from 'unist-util-position'\nimport {visit} from 'unist-util-visit'\nimport {webNamespaces} from 'web-namespaces'\nimport {zwitch} from 'zwitch'\n\nconst gfmTagfilterExpression =\n /<(\\/?)(iframe|noembed|noframes|plaintext|script|style|textarea|title|xmp)(?=[\\t\\n\\f\\r />])/gi\n\n// Node types associated with MDX.\n// \nconst knownMdxNames = new Set([\n 'mdxFlowExpression',\n 'mdxJsxFlowElement',\n 'mdxJsxTextElement',\n 'mdxTextExpression',\n 'mdxjsEsm'\n])\n\n/** @type {ParserOptions} */\nconst parseOptions = {sourceCodeLocationInfo: true, scriptingEnabled: false}\n\n/**\n * Pass a hast tree through an HTML parser, which will fix nesting, and turn\n * raw nodes into actual nodes.\n *\n * @param {Nodes} tree\n * Original hast tree to transform.\n * @param {Options | null | undefined} [options]\n * Configuration (optional).\n * @returns {Nodes}\n * Parsed again tree.\n */\nexport function raw(tree, options) {\n const document = documentMode(tree)\n /** @type {(node: Nodes, state: State) => undefined} */\n const one = zwitch('type', {\n handlers: {root, element, text, comment, doctype, raw: handleRaw},\n unknown\n })\n\n /** @type {State} */\n const state = {\n parser: document\n ? new Parser(parseOptions)\n : Parser.getFragmentParser(undefined, parseOptions),\n handle(node) {\n one(node, state)\n },\n stitches: false,\n options: options || {}\n }\n\n one(tree, state)\n resetTokenizer(state, pointStart())\n\n const p5 = document ? state.parser.document : state.parser.getFragment()\n const result = fromParse5(p5, {\n // To do: support `space`?\n file: state.options.file\n })\n\n if (state.stitches) {\n visit(result, 'comment', function (node, index, parent) {\n const stitch = /** @type {Stitch} */ (/** @type {unknown} */ (node))\n if (stitch.value.stitch && parent && index !== undefined) {\n /** @type {Array} */\n const siblings = parent.children\n // @ts-expect-error: assume the stitch is allowed.\n siblings[index] = stitch.value.stitch\n return index\n }\n })\n }\n\n // Unpack if possible and when not given a `root`.\n if (\n result.type === 'root' &&\n result.children.length === 1 &&\n result.children[0].type === tree.type\n ) {\n return result.children[0]\n }\n\n return result\n}\n\n/**\n * Transform all nodes\n *\n * @param {Array} nodes\n * hast content.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction all(nodes, state) {\n let index = -1\n\n /* istanbul ignore else - invalid nodes, see rehypejs/rehype-raw#7. */\n if (nodes) {\n while (++index < nodes.length) {\n state.handle(nodes[index])\n }\n }\n}\n\n/**\n * Transform a root.\n *\n * @param {Root} node\n * hast root node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction root(node, state) {\n all(node.children, state)\n}\n\n/**\n * Transform an element.\n *\n * @param {Element} node\n * hast element node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction element(node, state) {\n startTag(node, state)\n\n all(node.children, state)\n\n endTag(node, state)\n}\n\n/**\n * Transform a text.\n *\n * @param {Text} node\n * hast text node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction text(node, state) {\n // Allow `DATA` through `PLAINTEXT`,\n // but when hanging in a tag for example,\n // switch back to `DATA`.\n // Note: `State` is not exposed by `parse5`, so these numbers are fragile.\n // See: \n if (state.parser.tokenizer.state > 4) {\n state.parser.tokenizer.state = 0\n }\n\n /** @type {Token.CharacterToken} */\n const token = {\n type: Token.TokenType.CHARACTER,\n chars: node.value,\n location: createParse5Location(node)\n }\n\n resetTokenizer(state, pointStart(node))\n // @ts-expect-error: private.\n state.parser.currentToken = token\n // @ts-expect-error: private.\n state.parser._processToken(state.parser.currentToken)\n}\n\n/**\n * Transform a doctype.\n *\n * @param {Doctype} node\n * hast doctype node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction doctype(node, state) {\n /** @type {Token.DoctypeToken} */\n const token = {\n type: Token.TokenType.DOCTYPE,\n name: 'html',\n forceQuirks: false,\n publicId: '',\n systemId: '',\n location: createParse5Location(node)\n }\n\n resetTokenizer(state, pointStart(node))\n // @ts-expect-error: private.\n state.parser.currentToken = token\n // @ts-expect-error: private.\n state.parser._processToken(state.parser.currentToken)\n}\n\n/**\n * Transform a stitch.\n *\n * @param {Nodes} node\n * unknown node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction stitch(node, state) {\n // Mark that there are stitches, so we need to walk the tree and revert them.\n state.stitches = true\n\n /** @type {Nodes} */\n const clone = cloneWithoutChildren(node)\n\n // Recurse, because to somewhat handle `[]` (where `[]` denotes the\n // passed through node).\n if ('children' in node && 'children' in clone) {\n // Root in root out.\n const fakeRoot = /** @type {Root} */ (\n raw({type: 'root', children: node.children}, state.options)\n )\n clone.children = fakeRoot.children\n }\n\n // Hack: `value` is supposed to be a string, but as none of the tools\n // (`parse5` or `hast-util-from-parse5`) looks at it, we can pass nodes\n // through.\n comment({type: 'comment', value: {stitch: clone}}, state)\n}\n\n/**\n * Transform a comment (or stitch).\n *\n * @param {Comment | Stitch} node\n * hast comment node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction comment(node, state) {\n /** @type {string} */\n // @ts-expect-error: we pass stitches through.\n const data = node.value\n\n /** @type {Token.CommentToken} */\n const token = {\n type: Token.TokenType.COMMENT,\n data,\n location: createParse5Location(node)\n }\n resetTokenizer(state, pointStart(node))\n // @ts-expect-error: private.\n state.parser.currentToken = token\n // @ts-expect-error: private.\n state.parser._processToken(state.parser.currentToken)\n}\n\n/**\n * Transform a raw node.\n *\n * @param {Raw} node\n * hast raw node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction handleRaw(node, state) {\n // Reset preprocessor:\n // See: .\n state.parser.tokenizer.preprocessor.html = ''\n state.parser.tokenizer.preprocessor.pos = -1\n // @ts-expect-error: private.\n // type-coverage:ignore-next-line\n state.parser.tokenizer.preprocessor.lastGapPos = -2\n // @ts-expect-error: private.\n // type-coverage:ignore-next-line\n state.parser.tokenizer.preprocessor.gapStack = []\n // @ts-expect-error: private.\n // type-coverage:ignore-next-line\n state.parser.tokenizer.preprocessor.skipNextNewLine = false\n state.parser.tokenizer.preprocessor.lastChunkWritten = false\n state.parser.tokenizer.preprocessor.endOfChunkHit = false\n // @ts-expect-error: private.\n // type-coverage:ignore-next-line\n state.parser.tokenizer.preprocessor.isEol = false\n\n // Now pass `node.value`.\n setPoint(state, pointStart(node))\n\n state.parser.tokenizer.write(\n state.options.tagfilter\n ? node.value.replace(gfmTagfilterExpression, '<$1$2')\n : node.value,\n false\n )\n // @ts-expect-error: private.\n state.parser.tokenizer._runParsingLoop()\n\n // Character references hang, so if we ended there, we need to flush\n // those too.\n // We reset the preprocessor as if the document ends here.\n // Then one single call to the relevant state does the trick, parse5\n // consumes the whole token.\n\n // Note: `State` is not exposed by `parse5`, so these numbers are fragile.\n // See: \n // Note: a change to `parse5`, which breaks this, was merged but not released.\n // Investigate when it is.\n // To do: remove next major.\n /* c8 ignore next 12 -- removed in */\n if (\n state.parser.tokenizer.state === 72 /* NAMED_CHARACTER_REFERENCE */ ||\n // @ts-expect-error: removed.\n state.parser.tokenizer.state === 78 /* NUMERIC_CHARACTER_REFERENCE_END */\n ) {\n state.parser.tokenizer.preprocessor.lastChunkWritten = true\n /** @type {number} */\n // @ts-expect-error: private.\n const cp = state.parser.tokenizer._consume()\n // @ts-expect-error: private.\n state.parser.tokenizer._callState(cp)\n }\n}\n\n/**\n * Crash on an unknown node.\n *\n * @param {unknown} node_\n * unknown node.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Never.\n */\nfunction unknown(node_, state) {\n const node = /** @type {Nodes} */ (node_)\n\n if (\n state.options.passThrough &&\n state.options.passThrough.includes(node.type)\n ) {\n stitch(node, state)\n } else {\n let extra = ''\n\n if (knownMdxNames.has(node.type)) {\n extra =\n \". It looks like you are using MDX nodes with `hast-util-raw` (or `rehype-raw`). If you use this because you are using remark or rehype plugins that inject `'html'` nodes, then please raise an issue with that plugin, as its a bad and slow idea. If you use this because you are using markdown syntax, then you have to configure this utility (or plugin) to pass through these nodes (see `passThrough` in docs), but you can also migrate to use the MDX syntax\"\n }\n\n throw new Error('Cannot compile `' + node.type + '` node' + extra)\n }\n}\n\n/**\n * Reset the tokenizer of a parser.\n *\n * @param {State} state\n * Info passed around about the current state.\n * @param {Point | undefined} point\n * Point.\n * @returns {undefined}\n * Nothing.\n */\nfunction resetTokenizer(state, point) {\n setPoint(state, point)\n\n // Process final characters if they\u2019re still there after hibernating.\n /** @type {Token.CharacterToken} */\n // @ts-expect-error: private.\n const token = state.parser.tokenizer.currentCharacterToken\n\n if (token && token.location) {\n token.location.endLine = state.parser.tokenizer.preprocessor.line\n token.location.endCol = state.parser.tokenizer.preprocessor.col + 1\n token.location.endOffset = state.parser.tokenizer.preprocessor.offset + 1\n // @ts-expect-error: private.\n state.parser.currentToken = token\n // @ts-expect-error: private.\n state.parser._processToken(state.parser.currentToken)\n }\n\n // Reset tokenizer:\n // See: .\n // Especially putting it back in the `data` state is useful: some elements,\n // like textareas and iframes, change the state.\n // See GH-7.\n // But also if broken HTML is in `raw`, and then a correct element is given.\n // See GH-11.\n // @ts-expect-error: private.\n state.parser.tokenizer.paused = false\n // @ts-expect-error: private.\n state.parser.tokenizer.inLoop = false\n\n // Note: don\u2019t reset `state`, `inForeignNode`, or `lastStartTagName`, we\n // manually update those when needed.\n state.parser.tokenizer.active = false\n // @ts-expect-error: private.\n state.parser.tokenizer.returnState = TokenizerMode.DATA\n // @ts-expect-error: private.\n state.parser.tokenizer.charRefCode = -1\n // @ts-expect-error: private.\n state.parser.tokenizer.consumedAfterSnapshot = -1\n // @ts-expect-error: private.\n state.parser.tokenizer.currentLocation = null\n // @ts-expect-error: private.\n state.parser.tokenizer.currentCharacterToken = null\n // @ts-expect-error: private.\n state.parser.tokenizer.currentToken = null\n // @ts-expect-error: private.\n state.parser.tokenizer.currentAttr = {name: '', value: ''}\n}\n\n/**\n * Set current location.\n *\n * @param {State} state\n * Info passed around about the current state.\n * @param {Point | undefined} point\n * Point.\n * @returns {undefined}\n * Nothing.\n */\nfunction setPoint(state, point) {\n if (point && point.offset !== undefined) {\n /** @type {Token.Location} */\n const location = {\n startLine: point.line,\n startCol: point.column,\n startOffset: point.offset,\n endLine: -1,\n endCol: -1,\n endOffset: -1\n }\n\n // @ts-expect-error: private.\n // type-coverage:ignore-next-line\n state.parser.tokenizer.preprocessor.lineStartPos = -point.column + 1 // Looks weird, but ensures we get correct positional info.\n state.parser.tokenizer.preprocessor.droppedBufferSize = point.offset\n state.parser.tokenizer.preprocessor.line = point.line\n // @ts-expect-error: private.\n state.parser.tokenizer.currentLocation = location\n }\n}\n\n/**\n * Emit a start tag.\n *\n * @param {Element} node\n * Element.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction startTag(node, state) {\n const tagName = node.tagName.toLowerCase()\n\n // Ignore tags if we\u2019re in plain text.\n if (state.parser.tokenizer.state === TokenizerMode.PLAINTEXT) return\n\n resetTokenizer(state, pointStart(node))\n\n const current = state.parser.openElements.current\n let ns = 'namespaceURI' in current ? current.namespaceURI : webNamespaces.html\n\n if (ns === webNamespaces.html && tagName === 'svg') {\n ns = webNamespaces.svg\n }\n\n const result = toParse5(\n // Shallow clone to not delve into `children`: we only need the attributes.\n {...node, children: []},\n {space: ns === webNamespaces.svg ? 'svg' : 'html'}\n )\n\n /** @type {Token.TagToken} */\n const tag = {\n type: Token.TokenType.START_TAG,\n tagName,\n tagID: html.getTagID(tagName),\n // We always send start and end tags.\n selfClosing: false,\n ackSelfClosing: false,\n // Always element.\n /* c8 ignore next */\n attrs: 'attrs' in result ? result.attrs : [],\n location: createParse5Location(node)\n }\n\n // The HTML parsing algorithm works by doing half of the state management in\n // the tokenizer and half in the parser.\n // We can\u2019t use the tokenizer here, as we don\u2019t have strings.\n // So we act *as if* the tokenizer emits tokens:\n\n // @ts-expect-error: private.\n state.parser.currentToken = tag\n // @ts-expect-error: private.\n state.parser._processToken(state.parser.currentToken)\n\n // \u2026but then we still need a bunch of work that the tokenizer would normally\n // do, such as:\n\n // Set a tag name, similar to how the tokenizer would do it.\n state.parser.tokenizer.lastStartTagName = tagName\n\n // `inForeignNode` is correctly set by the parser.\n}\n\n/**\n * Emit an end tag.\n *\n * @param {Element} node\n * Element.\n * @param {State} state\n * Info passed around about the current state.\n * @returns {undefined}\n * Nothing.\n */\nfunction endTag(node, state) {\n const tagName = node.tagName.toLowerCase()\n // Do not emit closing tags for HTML void elements.\n if (\n !state.parser.tokenizer.inForeignNode &&\n htmlVoidElements.includes(tagName)\n ) {\n return\n }\n\n // Ignore tags if we\u2019re in plain text.\n if (state.parser.tokenizer.state === TokenizerMode.PLAINTEXT) return\n\n resetTokenizer(state, pointEnd(node))\n\n /** @type {Token.TagToken} */\n const tag = {\n type: Token.TokenType.END_TAG,\n tagName,\n tagID: html.getTagID(tagName),\n selfClosing: false,\n ackSelfClosing: false,\n attrs: [],\n location: createParse5Location(node)\n }\n\n // The HTML parsing algorithm works by doing half of the state management in\n // the tokenizer and half in the parser.\n // We can\u2019t use the tokenizer here, as we don\u2019t have strings.\n // So we act *as if* the tokenizer emits tokens:\n\n // @ts-expect-error: private.\n state.parser.currentToken = tag\n // @ts-expect-error: private.\n state.parser._processToken(state.parser.currentToken)\n\n // \u2026but then we still need a bunch of work that the tokenizer would normally\n // do, such as:\n\n // Switch back to the data state after alternative states that don\u2019t accept\n // tags:\n if (\n // Current element is closed.\n tagName === state.parser.tokenizer.lastStartTagName &&\n // `