diff --git a/js/dist/extension/tailwind.css b/js/dist/extension/tailwind.css index ecb79f8..3068b27 100644 --- a/js/dist/extension/tailwind.css +++ b/js/dist/extension/tailwind.css @@ -896,6 +896,36 @@ html { color: var(--fallback-bc,oklch(var(--bc)/var(--tw-text-opacity))); } +.btm-nav { + position: fixed; + bottom: 0px; + left: 0px; + right: 0px; + display: flex; + width: 100%; + flex-direction: row; + align-items: center; + justify-content: space-around; + padding-bottom: env(safe-area-inset-bottom); + height: 4rem; + --tw-bg-opacity: 1; + background-color: var(--fallback-b1,oklch(var(--b1)/var(--tw-bg-opacity))); + color: currentColor; +} + +.btm-nav > * { + position: relative; + display: flex; + height: 100%; + flex-basis: 100%; + cursor: pointer; + flex-direction: column; + align-items: center; + justify-content: center; + gap: 0.25rem; + border-color: currentColor; +} + @media (hover:hover) { .checkbox-accent:hover { --tw-border-opacity: 1; @@ -2492,6 +2522,10 @@ input.tab:checked + .tab-content, color: var(--fallback-er,oklch(var(--er)/var(--tw-text-opacity))); } +.btm-nav > *:not(.active) { + padding-top: 0.125rem; +} + .btm-nav > *:where(.active) { border-top-width: 2px; --tw-bg-opacity: 1; @@ -2508,16 +2542,16 @@ input.tab:checked + .tab-content, --tw-text-opacity: 0.2; } -.btm-nav > * .\!label { - font-size: 1rem !important; - line-height: 1.5rem !important; -} - .btm-nav > * .label { font-size: 1rem; line-height: 1.5rem; } +.btm-nav > * .\!label { + font-size: 1rem !important; + line-height: 1.5rem !important; +} + .btn:active:hover, .btn:active:focus { animation: button-pop 0s ease-out; @@ -5060,6 +5094,10 @@ details.collapse summary::-webkit-details-marker { margin-bottom: 1.5rem; } +.mb-16 { + margin-bottom: 4rem; +} + .mb-4 { margin-bottom: 1rem; } @@ -5614,7 +5652,19 @@ details.collapse summary::-webkit-details-marker { a: a; } +@media (min-width: 640px) { + .sm\:mx-4 { + margin-left: 1rem; + margin-right: 1rem; + } +} + @media (min-width: 1024px) { + .lg\:mx-16 { + margin-left: 4rem; + margin-right: 4rem; + } + .lg\:mx-\[6vw\] { margin-left: 6vw; margin-right: 6vw; diff --git a/js/dist/site/index.js b/js/dist/site/index.js index 022d396..c9f1e23 100644 --- a/js/dist/site/index.js +++ b/js/dist/site/index.js @@ -1,15 +1,15 @@ -"use strict";(()=>{var d3=Object.create;var Bd=Object.defineProperty;var p3=Object.getOwnPropertyDescriptor;var m3=Object.getOwnPropertyNames;var h3=Object.getPrototypeOf,g3=Object.prototype.hasOwnProperty;var CR=(t,e)=>()=>(t&&(e=t(t=0)),e);var Be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),Jd=(t,e)=>{for(var n in e)Bd(t,n,{get:e[n],enumerable:!0})},TR=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of m3(e))!g3.call(t,o)&&o!==n&&Bd(t,o,{get:()=>e[o],enumerable:!(r=p3(e,o))||r.enumerable});return t};var q=(t,e,n)=>(n=t!=null?d3(h3(t)):{},TR(e||!t||!t.__esModule?Bd(n,"default",{value:t,enumerable:!0}):n,t)),PR=t=>TR(Bd({},"__esModule",{value:!0}),t);var UR=Be(Ae=>{"use strict";var sc=Symbol.for("react.element"),y3=Symbol.for("react.portal"),v3=Symbol.for("react.fragment"),w3=Symbol.for("react.strict_mode"),x3=Symbol.for("react.profiler"),S3=Symbol.for("react.provider"),k3=Symbol.for("react.context"),b3=Symbol.for("react.forward_ref"),E3=Symbol.for("react.suspense"),R3=Symbol.for("react.memo"),C3=Symbol.for("react.lazy"),OR=Symbol.iterator;function T3(t){return t===null||typeof t!="object"?null:(t=OR&&t[OR]||t["@@iterator"],typeof t=="function"?t:null)}var IR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},AR=Object.assign,LR={};function $a(t,e,n){this.props=t,this.context=e,this.refs=LR,this.updater=n||IR}$a.prototype.isReactComponent={};$a.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};$a.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function DR(){}DR.prototype=$a.prototype;function t0(t,e,n){this.props=t,this.context=e,this.refs=LR,this.updater=n||IR}var n0=t0.prototype=new DR;n0.constructor=t0;AR(n0,$a.prototype);n0.isPureReactComponent=!0;var NR=Array.isArray,FR=Object.prototype.hasOwnProperty,r0={current:null},BR={key:!0,ref:!0,__self:!0,__source:!0};function JR(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)FR.call(e,r)&&!BR.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1{"use strict";_R.exports=UR()});var YR=Be(Ye=>{"use strict";function l0(t,e){var n=t.length;t.push(e);e:for(;0>>1,o=t[r];if(0>>1;rVd(a,n))lVd(u,a)?(t[r]=u,t[l]=n,r=l):(t[r]=a,t[s]=n,r=s);else if(lVd(u,n))t[r]=u,t[l]=n,r=l;else break e}}return e}function Vd(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(zR=performance,Ye.unstable_now=function(){return zR.now()}):(i0=Date,VR=i0.now(),Ye.unstable_now=function(){return i0.now()-VR});var zR,i0,VR,co=[],Ri=[],I3=1,vr=null,mn=3,Hd=!1,Ts=!1,lc=!1,HR=typeof setTimeout=="function"?setTimeout:null,$R=typeof clearTimeout=="function"?clearTimeout:null,qR=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function u0(t){for(var e=jr(Ri);e!==null;){if(e.callback===null)jd(Ri);else if(e.startTime<=t)jd(Ri),e.sortIndex=e.expirationTime,l0(co,e);else break;e=jr(Ri)}}function c0(t){if(lc=!1,u0(t),!Ts)if(jr(co)!==null)Ts=!0,d0(f0);else{var e=jr(Ri);e!==null&&p0(c0,e.startTime-t)}}function f0(t,e){Ts=!1,lc&&(lc=!1,$R(uc),uc=-1),Hd=!0;var n=mn;try{for(u0(e),vr=jr(co);vr!==null&&(!(vr.expirationTime>e)||t&&!KR());){var r=vr.callback;if(typeof r=="function"){vr.callback=null,mn=vr.priorityLevel;var o=r(vr.expirationTime<=e);e=Ye.unstable_now(),typeof o=="function"?vr.callback=o:vr===jr(co)&&jd(co),u0(e)}else jd(co);vr=jr(co)}if(vr!==null)var i=!0;else{var s=jr(Ri);s!==null&&p0(c0,s.startTime-e),i=!1}return i}finally{vr=null,mn=n,Hd=!1}}var $d=!1,qd=null,uc=-1,WR=5,GR=-1;function KR(){return!(Ye.unstable_now()-GRt||125r?(t.sortIndex=n,l0(Ri,t),jr(co)===null&&t===jr(Ri)&&(lc?($R(uc),uc=-1):lc=!0,p0(c0,n-r))):(t.sortIndex=o,l0(co,t),Ts||Hd||(Ts=!0,d0(f0))),t};Ye.unstable_shouldYield=KR;Ye.unstable_wrapCallback=function(t){var e=mn;return function(){var n=mn;mn=e;try{return t.apply(this,arguments)}finally{mn=n}}}});var QR=Be((IW,XR)=>{"use strict";XR.exports=YR()});var oO=Be(or=>{"use strict";var iT=ge(),nr=QR();function $(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),F0=Object.prototype.hasOwnProperty,A3=/^[: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]*$/,ZR={},eC={};function L3(t){return F0.call(eC,t)?!0:F0.call(ZR,t)?!1:A3.test(t)?eC[t]=!0:(ZR[t]=!0,!1)}function D3(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function F3(t,e,n,r){if(e===null||typeof e>"u"||D3(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function In(t,e,n,r,o,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var tn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){tn[t]=new In(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];tn[e]=new In(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){tn[t]=new In(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){tn[t]=new In(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){tn[t]=new In(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){tn[t]=new In(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){tn[t]=new In(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){tn[t]=new In(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){tn[t]=new In(t,5,!1,t.toLowerCase(),null,!1,!1)});var Pw=/[\-:]([a-z])/g;function Ow(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Pw,Ow);tn[e]=new In(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Pw,Ow);tn[e]=new In(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Pw,Ow);tn[e]=new In(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){tn[t]=new In(t,1,!1,t.toLowerCase(),null,!1,!1)});tn.xlinkHref=new In("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){tn[t]=new In(t,1,!1,t.toLowerCase(),null,!0,!0)});function Nw(t,e,n,r){var o=tn.hasOwnProperty(e)?tn[e]:null;(o!==null?o.type!==0:r||!(2{var y3=Object.create;var _d=Object.defineProperty;var v3=Object.getOwnPropertyDescriptor;var w3=Object.getOwnPropertyNames;var x3=Object.getPrototypeOf,S3=Object.prototype.hasOwnProperty;var NR=(t,e)=>()=>(t&&(e=t(t=0)),e);var Be=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),zd=(t,e)=>{for(var n in e)_d(t,n,{get:e[n],enumerable:!0})},MR=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of w3(e))!S3.call(t,o)&&o!==n&&_d(t,o,{get:()=>e[o],enumerable:!(r=v3(e,o))||r.enumerable});return t};var q=(t,e,n)=>(n=t!=null?y3(x3(t)):{},MR(e||!t||!t.__esModule?_d(n,"default",{value:t,enumerable:!0}):n,t)),IR=t=>MR(_d({},"__esModule",{value:!0}),t);var qR=Be(Ae=>{"use strict";var lc=Symbol.for("react.element"),k3=Symbol.for("react.portal"),b3=Symbol.for("react.fragment"),E3=Symbol.for("react.strict_mode"),R3=Symbol.for("react.profiler"),C3=Symbol.for("react.provider"),T3=Symbol.for("react.context"),P3=Symbol.for("react.forward_ref"),O3=Symbol.for("react.suspense"),N3=Symbol.for("react.memo"),M3=Symbol.for("react.lazy"),AR=Symbol.iterator;function I3(t){return t===null||typeof t!="object"?null:(t=AR&&t[AR]||t["@@iterator"],typeof t=="function"?t:null)}var FR={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},BR=Object.assign,JR={};function Ka(t,e,n){this.props=t,this.context=e,this.refs=JR,this.updater=n||FR}Ka.prototype.isReactComponent={};Ka.prototype.setState=function(t,e){if(typeof t!="object"&&typeof t!="function"&&t!=null)throw Error("setState(...): takes an object of state variables to update or a function which returns an object of state variables.");this.updater.enqueueSetState(this,t,e,"setState")};Ka.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")};function UR(){}UR.prototype=Ka.prototype;function o0(t,e,n){this.props=t,this.context=e,this.refs=JR,this.updater=n||FR}var i0=o0.prototype=new UR;i0.constructor=o0;BR(i0,Ka.prototype);i0.isPureReactComponent=!0;var LR=Array.isArray,_R=Object.prototype.hasOwnProperty,s0={current:null},zR={key:!0,ref:!0,__self:!0,__source:!0};function VR(t,e,n){var r,o={},i=null,s=null;if(e!=null)for(r in e.ref!==void 0&&(s=e.ref),e.key!==void 0&&(i=""+e.key),e)_R.call(e,r)&&!zR.hasOwnProperty(r)&&(o[r]=e[r]);var a=arguments.length-2;if(a===1)o.children=n;else if(1{"use strict";jR.exports=qR()});var eC=Be(Ye=>{"use strict";function f0(t,e){var n=t.length;t.push(e);e:for(;0>>1,o=t[r];if(0>>1;rHd(a,n))lHd(u,a)?(t[r]=u,t[l]=n,r=l):(t[r]=a,t[s]=n,r=s);else if(lHd(u,n))t[r]=u,t[l]=n,r=l;else break e}}return e}function Hd(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}typeof performance=="object"&&typeof performance.now=="function"?(HR=performance,Ye.unstable_now=function(){return HR.now()}):(l0=Date,$R=l0.now(),Ye.unstable_now=function(){return l0.now()-$R});var HR,l0,$R,fo=[],Ci=[],B3=1,xr=null,mn=3,Gd=!1,Os=!1,cc=!1,KR=typeof setTimeout=="function"?setTimeout:null,YR=typeof clearTimeout=="function"?clearTimeout:null,WR=typeof setImmediate<"u"?setImmediate:null;typeof navigator<"u"&&navigator.scheduling!==void 0&&navigator.scheduling.isInputPending!==void 0&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function d0(t){for(var e=$r(Ci);e!==null;){if(e.callback===null)Wd(Ci);else if(e.startTime<=t)Wd(Ci),e.sortIndex=e.expirationTime,f0(fo,e);else break;e=$r(Ci)}}function p0(t){if(cc=!1,d0(t),!Os)if($r(fo)!==null)Os=!0,h0(m0);else{var e=$r(Ci);e!==null&&g0(p0,e.startTime-t)}}function m0(t,e){Os=!1,cc&&(cc=!1,YR(fc),fc=-1),Gd=!0;var n=mn;try{for(d0(e),xr=$r(fo);xr!==null&&(!(xr.expirationTime>e)||t&&!ZR());){var r=xr.callback;if(typeof r=="function"){xr.callback=null,mn=xr.priorityLevel;var o=r(xr.expirationTime<=e);e=Ye.unstable_now(),typeof o=="function"?xr.callback=o:xr===$r(fo)&&Wd(fo),d0(e)}else Wd(fo);xr=$r(fo)}if(xr!==null)var i=!0;else{var s=$r(Ci);s!==null&&g0(p0,s.startTime-e),i=!1}return i}finally{xr=null,mn=n,Gd=!1}}var Kd=!1,$d=null,fc=-1,XR=5,QR=-1;function ZR(){return!(Ye.unstable_now()-QRt||125r?(t.sortIndex=n,f0(Ci,t),$r(fo)===null&&t===$r(Ci)&&(cc?(YR(fc),fc=-1):cc=!0,g0(p0,n-r))):(t.sortIndex=o,f0(fo,t),Os||Gd||(Os=!0,h0(m0))),t};Ye.unstable_shouldYield=ZR;Ye.unstable_wrapCallback=function(t){var e=mn;return function(){var n=mn;mn=e;try{return t.apply(this,arguments)}finally{mn=n}}}});var nC=Be((JW,tC)=>{"use strict";tC.exports=eC()});var lO=Be(ir=>{"use strict";var uT=he(),rr=nC();function $(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),U0=Object.prototype.hasOwnProperty,J3=/^[: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]*$/,rC={},oC={};function U3(t){return U0.call(oC,t)?!0:U0.call(rC,t)?!1:J3.test(t)?oC[t]=!0:(rC[t]=!0,!1)}function _3(t,e,n,r){if(n!==null&&n.type===0)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return r?!1:n!==null?!n.acceptsBooleans:(t=t.toLowerCase().slice(0,5),t!=="data-"&&t!=="aria-");default:return!1}}function z3(t,e,n,r){if(e===null||typeof e>"u"||_3(t,e,n,r))return!0;if(r)return!1;if(n!==null)switch(n.type){case 3:return!e;case 4:return e===!1;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function An(t,e,n,r,o,i,s){this.acceptsBooleans=e===2||e===3||e===4,this.attributeName=r,this.attributeNamespace=o,this.mustUseProperty=n,this.propertyName=t,this.type=e,this.sanitizeURL=i,this.removeEmptyString=s}var nn={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){nn[t]=new An(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];nn[e]=new An(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){nn[t]=new An(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){nn[t]=new An(t,2,!1,t,null,!1,!1)});"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){nn[t]=new An(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){nn[t]=new An(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){nn[t]=new An(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){nn[t]=new An(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){nn[t]=new An(t,5,!1,t.toLowerCase(),null,!1,!1)});var Mw=/[\-:]([a-z])/g;function Iw(t){return t[1].toUpperCase()}"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(Mw,Iw);nn[e]=new An(e,1,!1,t,null,!1,!1)});"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(Mw,Iw);nn[e]=new An(e,1,!1,t,"http://www.w3.org/1999/xlink",!1,!1)});["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(Mw,Iw);nn[e]=new An(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){nn[t]=new An(t,1,!1,t.toLowerCase(),null,!1,!1)});nn.xlinkHref=new An("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){nn[t]=new An(t,1,!1,t.toLowerCase(),null,!0,!0)});function Aw(t,e,n,r){var o=nn.hasOwnProperty(e)?nn[e]:null;(o!==null?o.type!==0:r||!(2a||o[s]!==i[a]){var l=` -`+o[s].replace(" at new "," at ");return t.displayName&&l.includes("")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{h0=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?vc(t):""}function B3(t){switch(t.tag){case 5:return vc(t.type);case 16:return vc("Lazy");case 13:return vc("Suspense");case 19:return vc("SuspenseList");case 0:case 2:case 15:return t=g0(t.type,!1),t;case 11:return t=g0(t.type.render,!1),t;case 1:return t=g0(t.type,!0),t;default:return""}}function _0(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Ya:return"Fragment";case Ka:return"Portal";case B0:return"Profiler";case Mw:return"StrictMode";case J0:return"Suspense";case U0:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case lT:return(t.displayName||"Context")+".Consumer";case aT:return(t._context.displayName||"Context")+".Provider";case Iw:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Aw:return e=t.displayName||null,e!==null?e:_0(t.type)||"Memo";case Ti:e=t._payload,t=t._init;try{return _0(t(e))}catch{}}return null}function J3(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return _0(e);case 8:return e===Mw?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function zi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function cT(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function U3(t){var e=cT(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Gd(t){t._valueTracker||(t._valueTracker=U3(t))}function fT(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=cT(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function kp(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function z0(t,e){var n=e.checked;return pt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function nC(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=zi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function dT(t,e){e=e.checked,e!=null&&Nw(t,"checked",e,!1)}function V0(t,e){dT(t,e);var n=zi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?q0(t,e.type,n):e.hasOwnProperty("defaultValue")&&q0(t,e.type,zi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function rC(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function q0(t,e,n){(e!=="number"||kp(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var wc=Array.isArray;function al(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o"+e.valueOf().toString()+"",e=Kd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ic(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var kc={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},_3=["Webkit","ms","Moz","O"];Object.keys(kc).forEach(function(t){_3.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),kc[e]=kc[t]})});function gT(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||kc.hasOwnProperty(t)&&kc[t]?(""+e).trim():e+"px"}function yT(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=gT(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var z3=pt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function $0(t,e){if(e){if(z3[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error($(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error($(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error($(61))}if(e.style!=null&&typeof e.style!="object")throw Error($(62))}}function W0(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var G0=null;function Lw(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var K0=null,ll=null,ul=null;function sC(t){if(t=Yc(t)){if(typeof K0!="function")throw Error($(280));var e=t.stateNode;e&&(e=Yp(e),K0(t.stateNode,t.type,e))}}function vT(t){ll?ul?ul.push(t):ul=[t]:ll=t}function wT(){if(ll){var t=ll,e=ul;if(ul=ll=null,sC(t),e)for(t=0;t>>=0,t===0?32:31-(Q3(t)/Z3|0)|0}var Yd=64,Xd=4194304;function xc(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Cp(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=xc(a):(i&=s,i!==0&&(r=xc(i)))}else s=n&~o,s!==0?r=xc(s):i!==0&&(r=xc(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&o)&&(o=r&-r,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Gc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Kr(e),t[e]=n}function rJ(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Ec),hC=String.fromCharCode(32),gC=!1;function UT(t,e){switch(t){case"keyup":return MJ.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function _T(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Xa=!1;function AJ(t,e){switch(t){case"compositionend":return _T(e);case"keypress":return e.which!==32?null:(gC=!0,hC);case"textInput":return t=e.data,t===hC&&gC?null:t;default:return null}}function LJ(t,e){if(Xa)return t==="compositionend"||!Vw&&UT(t,e)?(t=BT(),pp=Uw=Mi=null,Xa=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=wC(n)}}function jT(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?jT(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function HT(){for(var t=window,e=kp();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=kp(t.document)}return e}function qw(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function qJ(t){var e=HT(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&&jT(n.ownerDocument.documentElement,n)){if(r!==null&&qw(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!t.extend&&i>r&&(o=r,r=i,i=o),o=xC(n,i);var s=xC(n,r);o&&s&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,Qa=null,tw=null,Cc=null,nw=!1;function SC(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;nw||Qa==null||Qa!==kp(r)||(r=Qa,"selectionStart"in r&&qw(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}),Cc&&Jc(Cc,r)||(Cc=r,r=Op(tw,"onSelect"),0tl||(t.current=lw[tl],lw[tl]=null,tl--)}function Xe(t,e){tl++,lw[tl]=t.current,t.current=e}var Vi={},vn=ji(Vi),Hn=ji(!1),Ds=Vi;function ml(t,e){var n=t.type.contextTypes;if(!n)return Vi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function $n(t){return t=t.childContextTypes,t!=null}function Mp(){tt(Hn),tt(vn)}function NC(t,e,n){if(vn.current!==Vi)throw Error($(168));Xe(vn,e),Xe(Hn,n)}function eP(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error($(108,J3(t)||"Unknown",o));return pt({},n,r)}function Ip(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Vi,Ds=vn.current,Xe(vn,t),Xe(Hn,Hn.current),!0}function MC(t,e,n){var r=t.stateNode;if(!r)throw Error($(169));n?(t=eP(t,e,Ds),r.__reactInternalMemoizedMergedChildContext=t,tt(Hn),tt(vn),Xe(vn,t)):tt(Hn),Xe(Hn,n)}var Vo=null,Xp=!1,T0=!1;function tP(t){Vo===null?Vo=[t]:Vo.push(t)}function ZJ(t){Xp=!0,tP(t)}function Hi(){if(!T0&&Vo!==null){T0=!0;var t=0,e=qe;try{var n=Vo;for(qe=1;t>=s,o-=s,qo=1<<32-Kr(e)+o|n<E?(O=T,T=null):O=T.sibling;var A=d(g,T,k[E],S);if(A===null){T===null&&(T=O);break}t&&T&&A.alternate===null&&e(g,T),v=i(A,v,E),x===null?b=A:x.sibling=A,x=A,T=O}if(E===k.length)return n(g,T),st&&Ps(g,E),b;if(T===null){for(;EE?(O=T,T=null):O=T.sibling;var B=d(g,T,A.value,S);if(B===null){T===null&&(T=O);break}t&&T&&B.alternate===null&&e(g,T),v=i(B,v,E),x===null?b=B:x.sibling=B,x=B,T=O}if(A.done)return n(g,T),st&&Ps(g,E),b;if(T===null){for(;!A.done;E++,A=k.next())A=f(g,A.value,S),A!==null&&(v=i(A,v,E),x===null?b=A:x.sibling=A,x=A);return st&&Ps(g,E),b}for(T=r(g,T);!A.done;E++,A=k.next())A=p(T,g,E,A.value,S),A!==null&&(t&&A.alternate!==null&&T.delete(A.key===null?E:A.key),v=i(A,v,E),x===null?b=A:x.sibling=A,x=A);return t&&T.forEach(function(L){return e(g,L)}),st&&Ps(g,E),b}function w(g,v,k,S){if(typeof k=="object"&&k!==null&&k.type===Ya&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Wd:e:{for(var b=k.key,x=v;x!==null;){if(x.key===b){if(b=k.type,b===Ya){if(x.tag===7){n(g,x.sibling),v=o(x,k.props.children),v.return=g,g=v;break e}}else if(x.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Ti&&JC(b)===x.type){n(g,x.sibling),v=o(x,k.props),v.ref=mc(g,x,k),v.return=g,g=v;break e}n(g,x);break}else e(g,x);x=x.sibling}k.type===Ya?(v=Ls(k.props.children,g.mode,S,k.key),v.return=g,g=v):(S=Sp(k.type,k.key,k.props,null,g.mode,S),S.ref=mc(g,v,k),S.return=g,g=S)}return s(g);case Ka:e:{for(x=k.key;v!==null;){if(v.key===x)if(v.tag===4&&v.stateNode.containerInfo===k.containerInfo&&v.stateNode.implementation===k.implementation){n(g,v.sibling),v=o(v,k.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else e(g,v);v=v.sibling}v=D0(k,g.mode,S),v.return=g,g=v}return s(g);case Ti:return x=k._init,w(g,v,x(k._payload),S)}if(wc(k))return m(g,v,k,S);if(cc(k))return y(g,v,k,S);lp(g,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,k),v.return=g,g=v):(n(g,v),v=L0(k,g.mode,S),v.return=g,g=v),s(g)):n(g,v)}return w}var gl=uP(!0),cP=uP(!1),Xc={},go=ji(Xc),Vc=ji(Xc),qc=ji(Xc);function Is(t){if(t===Xc)throw Error($(174));return t}function Qw(t,e){switch(Xe(qc,e),Xe(Vc,t),Xe(go,Xc),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:H0(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=H0(e,t)}tt(go),Xe(go,e)}function yl(){tt(go),tt(Vc),tt(qc)}function fP(t){Is(qc.current);var e=Is(go.current),n=H0(e,t.type);e!==n&&(Xe(Vc,t),Xe(go,n))}function Zw(t){Vc.current===t&&(tt(go),tt(Vc))}var ft=ji(0);function Jp(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var P0=[];function ex(){for(var t=0;tn?n:4,t(!0);var r=O0.transition;O0.transition={};try{t(!1),e()}finally{qe=n,O0.transition=r}}function TP(){return Er().memoizedState}function rU(t,e,n){var r=Ui(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},PP(t))OP(e,n);else if(n=iP(t,e,n,r),n!==null){var o=Mn();Yr(n,t,r,o),NP(n,e,r)}}function oU(t,e,n){var r=Ui(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(PP(t))OP(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Xr(a,s)){var l=e.interleaved;l===null?(o.next=o,Yw(e)):(o.next=l.next,l.next=o),e.interleaved=o;return}}catch{}finally{}n=iP(t,e,o,r),n!==null&&(o=Mn(),Yr(n,t,r,o),NP(n,e,r))}}function PP(t){var e=t.alternate;return t===dt||e!==null&&e===dt}function OP(t,e){Tc=Up=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function NP(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Fw(t,n)}}var _p={readContext:br,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},iU={readContext:br,useCallback:function(t,e){return po().memoizedState=[t,e===void 0?null:e],t},useContext:br,useEffect:_C,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,yp(4194308,4,kP.bind(null,e,t),n)},useLayoutEffect:function(t,e){return yp(4194308,4,t,e)},useInsertionEffect:function(t,e){return yp(4,2,t,e)},useMemo:function(t,e){var n=po();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=po();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=rU.bind(null,dt,t),[r.memoizedState,t]},useRef:function(t){var e=po();return t={current:t},e.memoizedState=t},useState:UC,useDebugValue:ix,useDeferredValue:function(t){return po().memoizedState=t},useTransition:function(){var t=UC(!1),e=t[0];return t=nU.bind(null,t[1]),po().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=dt,o=po();if(st){if(n===void 0)throw Error($(407));n=n()}else{if(n=e(),Vt===null)throw Error($(349));Bs&30||mP(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,_C(gP.bind(null,r,i,t),[t]),r.flags|=2048,$c(9,hP.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=po(),e=Vt.identifierPrefix;if(st){var n=jo,r=qo;n=(r&~(1<<32-Kr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=jc++,0")&&(l=l.replace("",t.displayName)),l}while(1<=s&&0<=a);break}}}finally{v0=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?xc(t):""}function V3(t){switch(t.tag){case 5:return xc(t.type);case 16:return xc("Lazy");case 13:return xc("Suspense");case 19:return xc("SuspenseList");case 0:case 2:case 15:return t=w0(t.type,!1),t;case 11:return t=w0(t.type.render,!1),t;case 1:return t=w0(t.type,!0),t;default:return""}}function q0(t){if(t==null)return null;if(typeof t=="function")return t.displayName||t.name||null;if(typeof t=="string")return t;switch(t){case Za:return"Fragment";case Qa:return"Portal";case _0:return"Profiler";case Lw:return"StrictMode";case z0:return"Suspense";case V0:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case dT:return(t.displayName||"Context")+".Consumer";case fT:return(t._context.displayName||"Context")+".Provider";case Dw:var e=t.render;return t=t.displayName,t||(t=e.displayName||e.name||"",t=t!==""?"ForwardRef("+t+")":"ForwardRef"),t;case Fw:return e=t.displayName||null,e!==null?e:q0(t.type)||"Memo";case Pi:e=t._payload,t=t._init;try{return q0(t(e))}catch{}}return null}function q3(t){var e=t.type;switch(t.tag){case 24:return"Cache";case 9:return(e.displayName||"Context")+".Consumer";case 10:return(e._context.displayName||"Context")+".Provider";case 18:return"DehydratedFragment";case 11:return t=e.render,t=t.displayName||t.name||"",e.displayName||(t!==""?"ForwardRef("+t+")":"ForwardRef");case 7:return"Fragment";case 5:return e;case 4:return"Portal";case 3:return"Root";case 6:return"Text";case 16:return q0(e);case 8:return e===Lw?"StrictMode":"Mode";case 22:return"Offscreen";case 12:return"Profiler";case 21:return"Scope";case 13:return"Suspense";case 19:return"SuspenseList";case 25:return"TracingMarker";case 1:case 0:case 17:case 2:case 14:case 15:if(typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e}return null}function Vi(t){switch(typeof t){case"boolean":case"number":case"string":case"undefined":return t;case"object":return t;default:return""}}function mT(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function j3(t){var e=mT(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&typeof n<"u"&&typeof n.get=="function"&&typeof n.set=="function"){var o=n.get,i=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return o.call(this)},set:function(s){r=""+s,i.call(this,s)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(s){r=""+s},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function Xd(t){t._valueTracker||(t._valueTracker=j3(t))}function hT(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=mT(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Rp(t){if(t=t||(typeof document<"u"?document:void 0),typeof t>"u")return null;try{return t.activeElement||t.body}catch{return t.body}}function j0(t,e){var n=e.checked;return pt({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n??t._wrapperState.initialChecked})}function sC(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Vi(e.value!=null?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:e.type==="checkbox"||e.type==="radio"?e.checked!=null:e.value!=null}}function gT(t,e){e=e.checked,e!=null&&Aw(t,"checked",e,!1)}function H0(t,e){gT(t,e);var n=Vi(e.value),r=e.type;if(n!=null)r==="number"?(n===0&&t.value===""||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n);else if(r==="submit"||r==="reset"){t.removeAttribute("value");return}e.hasOwnProperty("value")?$0(t,e.type,n):e.hasOwnProperty("defaultValue")&&$0(t,e.type,Vi(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function aC(t,e,n){if(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue")){var r=e.type;if(!(r!=="submit"&&r!=="reset"||e.value!==void 0&&e.value!==null))return;e=""+t._wrapperState.initialValue,n||e===t.value||(t.value=e),t.defaultValue=e}n=t.name,n!==""&&(t.name=""),t.defaultChecked=!!t._wrapperState.initialChecked,n!==""&&(t.name=n)}function $0(t,e,n){(e!=="number"||Rp(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}var Sc=Array.isArray;function cl(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o"+e.valueOf().toString()+"",e=Qd.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Lc(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Ec={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},H3=["Webkit","ms","Moz","O"];Object.keys(Ec).forEach(function(t){H3.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Ec[e]=Ec[t]})});function xT(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Ec.hasOwnProperty(t)&&Ec[t]?(""+e).trim():e+"px"}function ST(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=xT(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var $3=pt({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});function K0(t,e){if(e){if($3[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error($(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error($(60));if(typeof e.dangerouslySetInnerHTML!="object"||!("__html"in e.dangerouslySetInnerHTML))throw Error($(61))}if(e.style!=null&&typeof e.style!="object")throw Error($(62))}}function Y0(t,e){if(t.indexOf("-")===-1)return typeof e.is=="string";switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}var X0=null;function Bw(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Q0=null,fl=null,dl=null;function cC(t){if(t=Qc(t)){if(typeof Q0!="function")throw Error($(280));var e=t.stateNode;e&&(e=Zp(e),Q0(t.stateNode,t.type,e))}}function kT(t){fl?dl?dl.push(t):dl=[t]:fl=t}function bT(){if(fl){var t=fl,e=dl;if(dl=fl=null,cC(t),e)for(t=0;t>>=0,t===0?32:31-(rJ(t)/oJ|0)|0}var Zd=64,ep=4194304;function kc(t){switch(t&-t){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: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&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return t&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;default:return t}}function Op(t,e){var n=t.pendingLanes;if(n===0)return 0;var r=0,o=t.suspendedLanes,i=t.pingedLanes,s=n&268435455;if(s!==0){var a=s&~o;a!==0?r=kc(a):(i&=s,i!==0&&(r=kc(i)))}else s=n&~o,s!==0?r=kc(s):i!==0&&(r=kc(i));if(r===0)return 0;if(e!==0&&e!==r&&!(e&o)&&(o=r&-r,i=e&-e,o>=i||o===16&&(i&4194240)!==0))return e;if(r&4&&(r|=n&16),e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0n;n++)e.push(t);return e}function Yc(t,e,n){t.pendingLanes|=e,e!==536870912&&(t.suspendedLanes=0,t.pingedLanes=0),t=t.eventTimes,e=31-Xr(e),t[e]=n}function lJ(t,e){var n=t.pendingLanes&~e;t.pendingLanes=e,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=e,t.mutableReadLanes&=e,t.entangledLanes&=e,e=t.entanglements;var r=t.eventTimes;for(t=t.expirationTimes;0=Cc),wC=String.fromCharCode(32),xC=!1;function qT(t,e){switch(t){case"keyup":return FJ.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function jT(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var el=!1;function JJ(t,e){switch(t){case"compositionend":return jT(e);case"keypress":return e.which!==32?null:(xC=!0,wC);case"textInput":return t=e.data,t===wC&&xC?null:t;default:return null}}function UJ(t,e){if(el)return t==="compositionend"||!Hw&&qT(t,e)?(t=zT(),gp=Vw=Ii=null,el=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1=e)return{node:n,offset:e-t};t=r}e:{for(;n;){if(n.nextSibling){n=n.nextSibling;break e}n=n.parentNode}n=void 0}n=bC(n)}}function GT(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?GT(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function KT(){for(var t=window,e=Rp();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Rp(t.document)}return e}function $w(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&(e==="input"&&(t.type==="text"||t.type==="search"||t.type==="tel"||t.type==="url"||t.type==="password")||e==="textarea"||t.contentEditable==="true")}function GJ(t){var e=KT(),n=t.focusedElem,r=t.selectionRange;if(e!==n&&n&&n.ownerDocument&>(n.ownerDocument.documentElement,n)){if(r!==null&&$w(n)){if(e=r.start,t=r.end,t===void 0&&(t=e),"selectionStart"in n)n.selectionStart=e,n.selectionEnd=Math.min(t,n.value.length);else if(t=(e=n.ownerDocument||document)&&e.defaultView||window,t.getSelection){t=t.getSelection();var o=n.textContent.length,i=Math.min(r.start,o);r=r.end===void 0?i:Math.min(r.end,o),!t.extend&&i>r&&(o=r,r=i,i=o),o=EC(n,i);var s=EC(n,r);o&&s&&(t.rangeCount!==1||t.anchorNode!==o.node||t.anchorOffset!==o.offset||t.focusNode!==s.node||t.focusOffset!==s.offset)&&(e=e.createRange(),e.setStart(o.node,o.offset),t.removeAllRanges(),i>r?(t.addRange(e),t.extend(s.node,s.offset)):(e.setEnd(s.node,s.offset),t.addRange(e)))}}for(e=[],t=n;t=t.parentNode;)t.nodeType===1&&e.push({element:t,left:t.scrollLeft,top:t.scrollTop});for(typeof n.focus=="function"&&n.focus(),n=0;n=document.documentMode,tl=null,ow=null,Pc=null,iw=!1;function RC(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;iw||tl==null||tl!==Rp(r)||(r=tl,"selectionStart"in r&&$w(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}),Pc&&_c(Pc,r)||(Pc=r,r=Ip(ow,"onSelect"),0ol||(t.current=fw[ol],fw[ol]=null,ol--)}function Xe(t,e){ol++,fw[ol]=t.current,t.current=e}var qi={},vn=Hi(qi),$n=Hi(!1),Bs=qi;function yl(t,e){var n=t.type.contextTypes;if(!n)return qi;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var o={},i;for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function Wn(t){return t=t.childContextTypes,t!=null}function Lp(){tt($n),tt(vn)}function LC(t,e,n){if(vn.current!==qi)throw Error($(168));Xe(vn,e),Xe($n,n)}function oP(t,e,n){var r=t.stateNode;if(e=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in e))throw Error($(108,q3(t)||"Unknown",o));return pt({},n,r)}function Dp(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||qi,Bs=vn.current,Xe(vn,t),Xe($n,$n.current),!0}function DC(t,e,n){var r=t.stateNode;if(!r)throw Error($(169));n?(t=oP(t,e,Bs),r.__reactInternalMemoizedMergedChildContext=t,tt($n),tt(vn),Xe(vn,t)):tt($n),Xe($n,n)}var qo=null,em=!1,N0=!1;function iP(t){qo===null?qo=[t]:qo.push(t)}function oU(t){em=!0,iP(t)}function $i(){if(!N0&&qo!==null){N0=!0;var t=0,e=qe;try{var n=qo;for(qe=1;t>=s,o-=s,jo=1<<32-Xr(e)+o|n<E?(O=R,R=null):O=R.sibling;var I=d(g,R,k[E],S);if(I===null){R===null&&(R=O);break}t&&R&&I.alternate===null&&e(g,R),v=i(I,v,E),x===null?b=I:x.sibling=I,x=I,R=O}if(E===k.length)return n(g,R),st&&Ns(g,E),b;if(R===null){for(;EE?(O=R,R=null):O=R.sibling;var B=d(g,R,I.value,S);if(B===null){R===null&&(R=O);break}t&&R&&B.alternate===null&&e(g,R),v=i(B,v,E),x===null?b=B:x.sibling=B,x=B,R=O}if(I.done)return n(g,R),st&&Ns(g,E),b;if(R===null){for(;!I.done;E++,I=k.next())I=f(g,I.value,S),I!==null&&(v=i(I,v,E),x===null?b=I:x.sibling=I,x=I);return st&&Ns(g,E),b}for(R=r(g,R);!I.done;E++,I=k.next())I=p(R,g,E,I.value,S),I!==null&&(t&&I.alternate!==null&&R.delete(I.key===null?E:I.key),v=i(I,v,E),x===null?b=I:x.sibling=I,x=I);return t&&R.forEach(function(L){return e(g,L)}),st&&Ns(g,E),b}function w(g,v,k,S){if(typeof k=="object"&&k!==null&&k.type===Za&&k.key===null&&(k=k.props.children),typeof k=="object"&&k!==null){switch(k.$$typeof){case Yd:e:{for(var b=k.key,x=v;x!==null;){if(x.key===b){if(b=k.type,b===Za){if(x.tag===7){n(g,x.sibling),v=o(x,k.props.children),v.return=g,g=v;break e}}else if(x.elementType===b||typeof b=="object"&&b!==null&&b.$$typeof===Pi&&VC(b)===x.type){n(g,x.sibling),v=o(x,k.props),v.ref=gc(g,x,k),v.return=g,g=v;break e}n(g,x);break}else e(g,x);x=x.sibling}k.type===Za?(v=Fs(k.props.children,g.mode,S,k.key),v.return=g,g=v):(S=Ep(k.type,k.key,k.props,null,g.mode,S),S.ref=gc(g,v,k),S.return=g,g=S)}return s(g);case Qa:e:{for(x=k.key;v!==null;){if(v.key===x)if(v.tag===4&&v.stateNode.containerInfo===k.containerInfo&&v.stateNode.implementation===k.implementation){n(g,v.sibling),v=o(v,k.children||[]),v.return=g,g=v;break e}else{n(g,v);break}else e(g,v);v=v.sibling}v=J0(k,g.mode,S),v.return=g,g=v}return s(g);case Pi:return x=k._init,w(g,v,x(k._payload),S)}if(Sc(k))return m(g,v,k,S);if(dc(k))return y(g,v,k,S);fp(g,k)}return typeof k=="string"&&k!==""||typeof k=="number"?(k=""+k,v!==null&&v.tag===6?(n(g,v.sibling),v=o(v,k),v.return=g,g=v):(n(g,v),v=B0(k,g.mode,S),v.return=g,g=v),s(g)):n(g,v)}return w}var wl=pP(!0),mP=pP(!1),Zc={},yo=Hi(Zc),jc=Hi(Zc),Hc=Hi(Zc);function Ls(t){if(t===Zc)throw Error($(174));return t}function tx(t,e){switch(Xe(Hc,e),Xe(jc,t),Xe(yo,Zc),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:G0(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=G0(e,t)}tt(yo),Xe(yo,e)}function xl(){tt(yo),tt(jc),tt(Hc)}function hP(t){Ls(Hc.current);var e=Ls(yo.current),n=G0(e,t.type);e!==n&&(Xe(jc,t),Xe(yo,n))}function nx(t){jc.current===t&&(tt(yo),tt(jc))}var ft=Hi(0);function zp(t){for(var e=t;e!==null;){if(e.tag===13){var n=e.memoizedState;if(n!==null&&(n=n.dehydrated,n===null||n.data==="$?"||n.data==="$!"))return e}else if(e.tag===19&&e.memoizedProps.revealOrder!==void 0){if(e.flags&128)return e}else if(e.child!==null){e.child.return=e,e=e.child;continue}if(e===t)break;for(;e.sibling===null;){if(e.return===null||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}return null}var M0=[];function rx(){for(var t=0;tn?n:4,t(!0);var r=I0.transition;I0.transition={};try{t(!1),e()}finally{qe=n,I0.transition=r}}function MP(){return Cr().memoizedState}function lU(t,e,n){var r=_i(t);if(n={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null},IP(t))AP(e,n);else if(n=uP(t,e,n,r),n!==null){var o=In();Qr(n,t,r,o),LP(n,e,r)}}function uU(t,e,n){var r=_i(t),o={lane:r,action:n,hasEagerState:!1,eagerState:null,next:null};if(IP(t))AP(e,o);else{var i=t.alternate;if(t.lanes===0&&(i===null||i.lanes===0)&&(i=e.lastRenderedReducer,i!==null))try{var s=e.lastRenderedState,a=i(s,n);if(o.hasEagerState=!0,o.eagerState=a,Zr(a,s)){var l=e.interleaved;l===null?(o.next=o,Zw(e)):(o.next=l.next,l.next=o),e.interleaved=o;return}}catch{}finally{}n=uP(t,e,o,r),n!==null&&(o=In(),Qr(n,t,r,o),LP(n,e,r))}}function IP(t){var e=t.alternate;return t===dt||e!==null&&e===dt}function AP(t,e){Oc=Vp=!0;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}function LP(t,e,n){if(n&4194240){var r=e.lanes;r&=t.pendingLanes,n|=r,e.lanes=n,Uw(t,n)}}var qp={readContext:Rr,useCallback:hn,useContext:hn,useEffect:hn,useImperativeHandle:hn,useInsertionEffect:hn,useLayoutEffect:hn,useMemo:hn,useReducer:hn,useRef:hn,useState:hn,useDebugValue:hn,useDeferredValue:hn,useTransition:hn,useMutableSource:hn,useSyncExternalStore:hn,useId:hn,unstable_isNewReconciler:!1},cU={readContext:Rr,useCallback:function(t,e){return mo().memoizedState=[t,e===void 0?null:e],t},useContext:Rr,useEffect:jC,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,xp(4194308,4,CP.bind(null,e,t),n)},useLayoutEffect:function(t,e){return xp(4194308,4,t,e)},useInsertionEffect:function(t,e){return xp(4,2,t,e)},useMemo:function(t,e){var n=mo();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=mo();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},r.queue=t,t=t.dispatch=lU.bind(null,dt,t),[r.memoizedState,t]},useRef:function(t){var e=mo();return t={current:t},e.memoizedState=t},useState:qC,useDebugValue:lx,useDeferredValue:function(t){return mo().memoizedState=t},useTransition:function(){var t=qC(!1),e=t[0];return t=aU.bind(null,t[1]),mo().memoizedState=t,[e,t]},useMutableSource:function(){},useSyncExternalStore:function(t,e,n){var r=dt,o=mo();if(st){if(n===void 0)throw Error($(407));n=n()}else{if(n=e(),Vt===null)throw Error($(349));Us&30||vP(r,e,n)}o.memoizedState=n;var i={value:n,getSnapshot:e};return o.queue=i,jC(xP.bind(null,r,i,t),[t]),r.flags|=2048,Gc(9,wP.bind(null,r,i,n,e),void 0,null),n},useId:function(){var t=mo(),e=Vt.identifierPrefix;if(st){var n=Ho,r=jo;n=(r&~(1<<32-Xr(r)-1)).toString(32)+n,e=":"+e+"R"+n,n=$c++,0<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[mo]=e,t[zc]=r,UP(t,e,!1,!1),e.stateNode=t;e:{switch(s=W0(n,r),n){case"dialog":et("cancel",t),et("close",t),o=r;break;case"iframe":case"object":case"embed":et("load",t),o=r;break;case"video":case"audio":for(o=0;owl&&(e.flags|=128,r=!0,hc(i,!1),e.lanes=4194304)}else{if(!r)if(t=Jp(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),hc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!st)return gn(e),null}else 2*bt()-i.renderingStartTime>wl&&n!==1073741824&&(e.flags|=128,r=!0,hc(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=bt(),e.sibling=null,n=ft.current,Xe(ft,r?n&1|2:n&1),e):(gn(e),null);case 22:case 23:return fx(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?Zn&1073741824&&(gn(e),e.subtreeFlags&6&&(e.flags|=8192)):gn(e),null;case 24:return null;case 25:return null}throw Error($(156,e.tag))}function pU(t,e){switch(Hw(e),e.tag){case 1:return $n(e.type)&&Mp(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return yl(),tt(Hn),tt(vn),ex(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return Zw(e),null;case 13:if(tt(ft),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error($(340));hl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(ft),null;case 4:return yl(),null;case 10:return Kw(e.type._context),null;case 22:case 23:return fx(),null;case 24:return null;default:return null}}var cp=!1,yn=!1,mU=typeof WeakSet=="function"?WeakSet:Set,re=null;function il(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){yt(t,e,r)}else n.current=null}function xw(t,e,n){try{n()}catch(r){yt(t,e,r)}}var KC=!1;function hU(t,e){if(rw=Tp,t=HT(),qw(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var p;f!==n||o!==0&&f.nodeType!==3||(a=s+o),f!==i||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)d=f,f=p;for(;;){if(f===t)break t;if(d===n&&++u===o&&(a=s),d===i&&++c===r&&(l=s),(p=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(ow={focusedElem:t,selectionRange:n},Tp=!1,re=e;re!==null;)if(e=re,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,re=t;else for(;re!==null;){e=re;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,w=m.memoizedState,g=e.stateNode,v=g.getSnapshotBeforeUpdate(e.elementType===e.type?y:$r(e.type,y),w);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(S){yt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,re=t;break}re=e.return}return m=KC,KC=!1,m}function Pc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&xw(e,n,i)}o=o.next}while(o!==r)}}function em(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Sw(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function VP(t){var e=t.alternate;e!==null&&(t.alternate=null,VP(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[mo],delete e[zc],delete e[aw],delete e[XJ],delete e[QJ])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function qP(t){return t.tag===5||t.tag===3||t.tag===4}function YC(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||qP(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function kw(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Np));else if(r!==4&&(t=t.child,t!==null))for(kw(t,e,n),t=t.sibling;t!==null;)kw(t,e,n),t=t.sibling}function bw(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(bw(t,e,n),t=t.sibling;t!==null;)bw(t,e,n),t=t.sibling}var Zt=null,Wr=!1;function Ci(t,e,n){for(n=n.child;n!==null;)jP(t,e,n),n=n.sibling}function jP(t,e,n){if(ho&&typeof ho.onCommitFiberUnmount=="function")try{ho.onCommitFiberUnmount($p,n)}catch{}switch(n.tag){case 5:yn||il(n,e);case 6:var r=Zt,o=Wr;Zt=null,Ci(t,e,n),Zt=r,Wr=o,Zt!==null&&(Wr?(t=Zt,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):Zt.removeChild(n.stateNode));break;case 18:Zt!==null&&(Wr?(t=Zt,n=n.stateNode,t.nodeType===8?C0(t.parentNode,n):t.nodeType===1&&C0(t,n),Fc(t)):C0(Zt,n.stateNode));break;case 4:r=Zt,o=Wr,Zt=n.stateNode.containerInfo,Wr=!0,Ci(t,e,n),Zt=r,Wr=o;break;case 0:case 11:case 14:case 15:if(!yn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&xw(n,e,s),o=o.next}while(o!==r)}Ci(t,e,n);break;case 1:if(!yn&&(il(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){yt(n,e,a)}Ci(t,e,n);break;case 21:Ci(t,e,n);break;case 22:n.mode&1?(yn=(r=yn)||n.memoizedState!==null,Ci(t,e,n),yn=r):Ci(t,e,n);break;default:Ci(t,e,n)}}function XC(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new mU),e.forEach(function(r){var o=EU.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Hr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=bt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*yU(r/1960))-r,10t?16:t,Ii===null)var r=!1;else{if(t=Ii,Ii=null,qp=0,Je&6)throw Error($(331));var o=Je;for(Je|=4,re=t.current;re!==null;){var i=re,s=i.child;if(re.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lbt()-ux?As(t,0):lx|=n),Wn(t,e)}function QP(t,e){e===0&&(t.mode&1?(e=Xd,Xd<<=1,!(Xd&130023424)&&(Xd=4194304)):e=1);var n=Mn();t=Go(t,e),t!==null&&(Gc(t,e,n),Wn(t,n))}function bU(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),QP(t,n)}function EU(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error($(314))}r!==null&&r.delete(e),QP(t,n)}var ZP;ZP=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||Hn.current)jn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return jn=!1,fU(t,e,n);jn=!!(t.flags&131072)}else jn=!1,st&&e.flags&1048576&&nP(e,Lp,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;vp(t,e),t=e.pendingProps;var o=ml(e,vn.current);fl(e,n),o=nx(null,e,r,t,o,n);var i=rx();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,$n(r)?(i=!0,Ip(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Xw(e),o.updater=Qp,e.stateNode=o,o._reactInternals=e,pw(e,r,t,n),e=gw(null,e,r,!0,i,n)):(e.tag=0,st&&i&&jw(e),Nn(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(vp(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=CU(r),t=$r(r,t),o){case 0:e=hw(null,e,r,t,n);break e;case 1:e=$C(null,e,r,t,n);break e;case 11:e=jC(null,e,r,t,n);break e;case 14:e=HC(null,e,r,$r(r.type,t),n);break e}throw Error($(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:$r(r,o),hw(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:$r(r,o),$C(t,e,r,o,n);case 3:e:{if(FP(e),t===null)throw Error($(387));r=e.pendingProps,i=e.memoizedState,o=i.element,sP(t,e),Bp(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=vl(Error($(423)),e),e=WC(t,e,r,n,o);break e}else if(r!==o){o=vl(Error($(424)),e),e=WC(t,e,r,n,o);break e}else for(er=Fi(e.stateNode.containerInfo.firstChild),tr=e,st=!0,Gr=null,n=cP(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(hl(),r===o){e=Ko(t,e,n);break e}Nn(t,e,r,n)}e=e.child}return e;case 5:return fP(e),t===null&&cw(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,iw(r,o)?s=null:i!==null&&iw(r,i)&&(e.flags|=32),DP(t,e),Nn(t,e,s,n),e.child;case 6:return t===null&&cw(e),null;case 13:return BP(t,e,n);case 4:return Qw(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=gl(e,null,r,n):Nn(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:$r(r,o),jC(t,e,r,o,n);case 7:return Nn(t,e,e.pendingProps,n),e.child;case 8:return Nn(t,e,e.pendingProps.children,n),e.child;case 12:return Nn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Xe(Dp,r._currentValue),r._currentValue=s,i!==null)if(Xr(i.value,s)){if(i.children===o.children&&!Hn.current){e=Ko(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=Ho(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),fw(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error($(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),fw(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Nn(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,fl(e,n),o=br(o),r=r(o),e.flags|=1,Nn(t,e,r,n),e.child;case 14:return r=e.type,o=$r(r,e.pendingProps),o=$r(r.type,o),HC(t,e,r,o,n);case 15:return AP(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:$r(r,o),vp(t,e),e.tag=1,$n(r)?(t=!0,Ip(e)):t=!1,fl(e,n),lP(e,r,o),pw(e,r,o,n),gw(null,e,r,!0,t,n);case 19:return JP(t,e,n);case 22:return LP(t,e,n)}throw Error($(156,e.tag))};function eO(t,e){return CT(t,e)}function RU(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Sr(t,e,n,r){return new RU(t,e,n,r)}function px(t){return t=t.prototype,!(!t||!t.isReactComponent)}function CU(t){if(typeof t=="function")return px(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Iw)return 11;if(t===Aw)return 14}return 2}function _i(t,e){var n=t.alternate;return n===null?(n=Sr(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Sp(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")px(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Ya:return Ls(n.children,o,i,e);case Mw:s=8,o|=8;break;case B0:return t=Sr(12,n,e,o|2),t.elementType=B0,t.lanes=i,t;case J0:return t=Sr(13,n,e,o),t.elementType=J0,t.lanes=i,t;case U0:return t=Sr(19,n,e,o),t.elementType=U0,t.lanes=i,t;case uT:return nm(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case aT:s=10;break e;case lT:s=9;break e;case Iw:s=11;break e;case Aw:s=14;break e;case Ti:s=16,r=null;break e}throw Error($(130,t==null?t:typeof t,""))}return e=Sr(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Ls(t,e,n,r){return t=Sr(7,t,r,e),t.lanes=n,t}function nm(t,e,n,r){return t=Sr(22,t,r,e),t.elementType=uT,t.lanes=n,t.stateNode={isHidden:!1},t}function L0(t,e,n){return t=Sr(6,t,null,e),t.lanes=n,t}function D0(t,e,n){return e=Sr(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function TU(t,e,n,r,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=v0(0),this.expirationTimes=v0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=v0(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function mx(t,e,n,r,o,i,s,a,l){return t=new TU(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=Sr(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},Xw(i),t}function PU(t,e,n){var r=3{"use strict";function iO(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(iO)}catch(t){console.error(t)}}iO(),sO.exports=oO()});var lO=Be(wx=>{"use strict";var aO=vx();wx.createRoot=aO.createRoot,wx.hydrateRoot=aO.hydrateRoot;var DW});var cO=Be(xx=>{var uO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");xx.encode=function(t){if(0<=t&&t{var fO=cO(),Sx=5,dO=1<>1;return e?-n:n}kx.encode=function(e){var n="",r,o=AU(e);do r=o&pO,o>>>=Sx,o>0&&(r|=mO),n+=fO.encode(r);while(o>0);return n};kx.decode=function(e,n,r){var o=e.length,i=0,s=0,a,l;do{if(n>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(l=fO.decode(e.charCodeAt(n++)),l===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));a=!!(l&mO),l&=pO,i=i+(l<{function DU(t,e,n){if(e in t)return t[e];if(arguments.length===3)return n;throw new Error('"'+e+'" is a required argument.')}wn.getArg=DU;var hO=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,FU=/^data:.+\,.+$/;function Qc(t){var e=t.match(hO);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}wn.urlParse=Qc;function kl(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}wn.urlGenerate=kl;function Ex(t){var e=t,n=Qc(t);if(n){if(!n.path)return t;e=n.path}for(var r=wn.isAbsolute(e),o=e.split(/\/+/),i,s=0,a=o.length-1;a>=0;a--)i=o[a],i==="."?o.splice(a,1):i===".."?s++:s>0&&(i===""?(o.splice(a+1,s),s=0):(o.splice(a,2),s--));return e=o.join("/"),e===""&&(e=r?"/":"."),n?(n.path=e,kl(n)):e}wn.normalize=Ex;function gO(t,e){t===""&&(t="."),e===""&&(e=".");var n=Qc(e),r=Qc(t);if(r&&(t=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),kl(n);if(n||e.match(FU))return e;if(r&&!r.host&&!r.path)return r.host=e,kl(r);var o=e.charAt(0)==="/"?e:Ex(t.replace(/\/+$/,"")+"/"+e);return r?(r.path=o,kl(r)):o}wn.join=gO;wn.isAbsolute=function(t){return t.charAt(0)==="/"||hO.test(t)};function BU(t,e){t===""&&(t="."),t=t.replace(/\/$/,"");for(var n=0;e.indexOf(t+"/")!==0;){var r=t.lastIndexOf("/");if(r<0||(t=t.slice(0,r),t.match(/^([^\/]+:\/)?\/*$/)))return e;++n}return Array(n+1).join("../")+e.substr(t.length+1)}wn.relative=BU;var yO=function(){var t=Object.create(null);return!("__proto__"in t)}();function vO(t){return t}function JU(t){return wO(t)?"$"+t:t}wn.toSetString=yO?vO:JU;function UU(t){return wO(t)?t.slice(1):t}wn.fromSetString=yO?vO:UU;function wO(t){if(!t)return!1;var e=t.length;if(e<9||t.charCodeAt(e-1)!==95||t.charCodeAt(e-2)!==95||t.charCodeAt(e-3)!==111||t.charCodeAt(e-4)!==116||t.charCodeAt(e-5)!==111||t.charCodeAt(e-6)!==114||t.charCodeAt(e-7)!==112||t.charCodeAt(e-8)!==95||t.charCodeAt(e-9)!==95)return!1;for(var n=e-10;n>=0;n--)if(t.charCodeAt(n)!==36)return!1;return!0}function _U(t,e,n){var r=bl(t.source,e.source);return r!==0||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0||n)||(r=t.generatedColumn-e.generatedColumn,r!==0)||(r=t.generatedLine-e.generatedLine,r!==0)?r:bl(t.name,e.name)}wn.compareByOriginalPositions=_U;function zU(t,e,n){var r=t.generatedLine-e.generatedLine;return r!==0||(r=t.generatedColumn-e.generatedColumn,r!==0||n)||(r=bl(t.source,e.source),r!==0)||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0)?r:bl(t.name,e.name)}wn.compareByGeneratedPositionsDeflated=zU;function bl(t,e){return t===e?0:t===null?1:e===null?-1:t>e?1:-1}function VU(t,e){var n=t.generatedLine-e.generatedLine;return n!==0||(n=t.generatedColumn-e.generatedColumn,n!==0)||(n=bl(t.source,e.source),n!==0)||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0)?n:bl(t.name,e.name)}wn.compareByGeneratedPositionsInflated=VU;function qU(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))}wn.parseSourceMapInput=qU;function jU(t,e,n){if(e=e||"",t&&(t[t.length-1]!=="/"&&e[0]!=="/"&&(t+="/"),e=t+e),n){var r=Qc(n);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var o=r.path.lastIndexOf("/");o>=0&&(r.path=r.path.substring(0,o+1))}e=gO(kl(r),e)}return Ex(e)}wn.computeSourceURL=jU});var Tx=Be(xO=>{var Rx=El(),Cx=Object.prototype.hasOwnProperty,Vs=typeof Map<"u";function Xo(){this._array=[],this._set=Vs?new Map:Object.create(null)}Xo.fromArray=function(e,n){for(var r=new Xo,o=0,i=e.length;o=0)return n}else{var r=Rx.toSetString(e);if(Cx.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')};Xo.prototype.at=function(e){if(e>=0&&e{var SO=El();function HU(t,e){var n=t.generatedLine,r=e.generatedLine,o=t.generatedColumn,i=e.generatedColumn;return r>n||r==n&&i>=o||SO.compareByGeneratedPositionsInflated(t,e)<=0}function am(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}am.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)};am.prototype.add=function(e){HU(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};am.prototype.toArray=function(){return this._sorted||(this._array.sort(SO.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};kO.MappingList=am});var Px=Be(EO=>{var Zc=bx(),Ot=El(),lm=Tx().ArraySet,$U=bO().MappingList;function Rr(t){t||(t={}),this._file=Ot.getArg(t,"file",null),this._sourceRoot=Ot.getArg(t,"sourceRoot",null),this._skipValidation=Ot.getArg(t,"skipValidation",!1),this._sources=new lm,this._names=new lm,this._mappings=new $U,this._sourcesContents=null}Rr.prototype._version=3;Rr.fromSourceMap=function(e){var n=e.sourceRoot,r=new Rr({file:e.file,sourceRoot:n});return e.eachMapping(function(o){var i={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(i.source=o.source,n!=null&&(i.source=Ot.relative(n,i.source)),i.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(i.name=o.name)),r.addMapping(i)}),e.sources.forEach(function(o){var i=o;n!==null&&(i=Ot.relative(n,o)),r._sources.has(i)||r._sources.add(i);var s=e.sourceContentFor(o);s!=null&&r.setSourceContent(o,s)}),r};Rr.prototype.addMapping=function(e){var n=Ot.getArg(e,"generated"),r=Ot.getArg(e,"original",null),o=Ot.getArg(e,"source",null),i=Ot.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,o,i),o!=null&&(o=String(o),this._sources.has(o)||this._sources.add(o)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:o,name:i})};Rr.prototype.setSourceContent=function(e,n){var r=e;this._sourceRoot!=null&&(r=Ot.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Ot.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[Ot.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};Rr.prototype.applySourceMap=function(e,n,r){var o=n;if(n==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);o=e.file}var i=this._sourceRoot;i!=null&&(o=Ot.relative(i,o));var s=new lm,a=new lm;this._mappings.unsortedForEach(function(l){if(l.source===o&&l.originalLine!=null){var u=e.originalPositionFor({line:l.originalLine,column:l.originalColumn});u.source!=null&&(l.source=u.source,r!=null&&(l.source=Ot.join(r,l.source)),i!=null&&(l.source=Ot.relative(i,l.source)),l.originalLine=u.line,l.originalColumn=u.column,u.name!=null&&(l.name=u.name))}var c=l.source;c!=null&&!s.has(c)&&s.add(c);var f=l.name;f!=null&&!a.has(f)&&a.add(f)},this),this._sources=s,this._names=a,e.sources.forEach(function(l){var u=e.sourceContentFor(l);u!=null&&(r!=null&&(l=Ot.join(r,l)),i!=null&&(l=Ot.relative(i,l)),this.setSourceContent(l,u))},this)};Rr.prototype._validateMapping=function(e,n,r,o){if(n&&typeof n.line!="number"&&typeof n.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!r&&!o)){if(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:o}))}};Rr.prototype._serializeMappings=function(){for(var e=0,n=1,r=0,o=0,i=0,s=0,a="",l,u,c,f,d=this._mappings.toArray(),p=0,m=d.length;p0){if(!Ot.compareByGeneratedPositionsInflated(u,d[p-1]))continue;l+=","}l+=Zc.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(f=this._sources.indexOf(u.source),l+=Zc.encode(f-s),s=f,l+=Zc.encode(u.originalLine-1-o),o=u.originalLine-1,l+=Zc.encode(u.originalColumn-r),r=u.originalColumn,u.name!=null&&(c=this._names.indexOf(u.name),l+=Zc.encode(c-i),i=c)),a+=l}return a};Rr.prototype._generateSourcesContent=function(e,n){return e.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=Ot.relative(n,r));var o=Ot.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};Rr.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};Rr.prototype.toString=function(){return JSON.stringify(this.toJSON())};EO.SourceMapGenerator=Rr});var RO=Be(qs=>{qs.GREATEST_LOWER_BOUND=1;qs.LEAST_UPPER_BOUND=2;function Ox(t,e,n,r,o,i){var s=Math.floor((e-t)/2)+t,a=o(n,r[s],!0);return a===0?s:a>0?e-s>1?Ox(s,e,n,r,o,i):i==qs.LEAST_UPPER_BOUND?e1?Ox(t,s,n,r,o,i):i==qs.LEAST_UPPER_BOUND?s:t<0?-1:t}qs.search=function(e,n,r,o){if(n.length===0)return-1;var i=Ox(-1,n.length,e,n,r,o||qs.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&r(n[i],n[i-1],!0)===0;)--i;return i}});var TO=Be(CO=>{function Nx(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function WU(t,e){return Math.round(t+Math.random()*(e-t))}function Mx(t,e,n,r){if(n{var se=El(),Ix=RO(),Rl=Tx().ArraySet,GU=bx(),ef=TO().quickSort;function nt(t,e){var n=t;return typeof t=="string"&&(n=se.parseSourceMapInput(t)),n.sections!=null?new Qr(n,e):new nn(n,e)}nt.fromSourceMap=function(t,e){return nn.fromSourceMap(t,e)};nt.prototype._version=3;nt.prototype.__generatedMappings=null;Object.defineProperty(nt.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});nt.prototype.__originalMappings=null;Object.defineProperty(nt.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});nt.prototype._charIsMappingSeparator=function(e,n){var r=e.charAt(n);return r===";"||r===","};nt.prototype._parseMappings=function(e,n){throw new Error("Subclasses must implement _parseMappings")};nt.GENERATED_ORDER=1;nt.ORIGINAL_ORDER=2;nt.GREATEST_LOWER_BOUND=1;nt.LEAST_UPPER_BOUND=2;nt.prototype.eachMapping=function(e,n,r){var o=n||null,i=r||nt.GENERATED_ORDER,s;switch(i){case nt.GENERATED_ORDER:s=this._generatedMappings;break;case nt.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;s.map(function(l){var u=l.source===null?null:this._sources.at(l.source);return u=se.computeSourceURL(a,u,this._sourceMapURL),{source:u,generatedLine:l.generatedLine,generatedColumn:l.generatedColumn,originalLine:l.originalLine,originalColumn:l.originalColumn,name:l.name===null?null:this._names.at(l.name)}},this).forEach(e,o)};nt.prototype.allGeneratedPositionsFor=function(e){var n=se.getArg(e,"line"),r={source:se.getArg(e,"source"),originalLine:n,originalColumn:se.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var o=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",se.compareByOriginalPositions,Ix.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(e.column===void 0)for(var a=s.originalLine;s&&s.originalLine===a;)o.push({line:se.getArg(s,"generatedLine",null),column:se.getArg(s,"generatedColumn",null),lastColumn:se.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==l;)o.push({line:se.getArg(s,"generatedLine",null),column:se.getArg(s,"generatedColumn",null),lastColumn:se.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return o};um.SourceMapConsumer=nt;function nn(t,e){var n=t;typeof t=="string"&&(n=se.parseSourceMapInput(t));var r=se.getArg(n,"version"),o=se.getArg(n,"sources"),i=se.getArg(n,"names",[]),s=se.getArg(n,"sourceRoot",null),a=se.getArg(n,"sourcesContent",null),l=se.getArg(n,"mappings"),u=se.getArg(n,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);s&&(s=se.normalize(s)),o=o.map(String).map(se.normalize).map(function(c){return s&&se.isAbsolute(s)&&se.isAbsolute(c)?se.relative(s,c):c}),this._names=Rl.fromArray(i.map(String),!0),this._sources=Rl.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(c){return se.computeSourceURL(s,c,e)}),this.sourceRoot=s,this.sourcesContent=a,this._mappings=l,this._sourceMapURL=e,this.file=u}nn.prototype=Object.create(nt.prototype);nn.prototype.consumer=nt;nn.prototype._findSourceIndex=function(t){var e=t;if(this.sourceRoot!=null&&(e=se.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var n;for(n=0;n1&&(y.source=a+g[1],a+=g[1],y.originalLine=i+g[2],i=y.originalLine,y.originalLine+=1,y.originalColumn=s+g[3],s=y.originalColumn,g.length>4&&(y.name=l+g[4],l+=g[4])),m.push(y),typeof y.originalLine=="number"&&p.push(y)}ef(m,se.compareByGeneratedPositionsDeflated),this.__generatedMappings=m,ef(p,se.compareByOriginalPositions),this.__originalMappings=p};nn.prototype._findMapping=function(e,n,r,o,i,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[o]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[o]);return Ix.search(e,n,i,s)};nn.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=se.getArg(o,"source",null);i!==null&&(i=this._sources.at(i),i=se.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=se.getArg(o,"name",null);return s!==null&&(s=this._names.at(s)),{source:i,line:se.getArg(o,"originalLine",null),column:se.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};nn.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};nn.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var o=e;this.sourceRoot!=null&&(o=se.relative(this.sourceRoot,o));var i;if(this.sourceRoot!=null&&(i=se.urlParse(this.sourceRoot))){var s=o.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!i.path||i.path=="/")&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(n)return null;throw new Error('"'+o+'" is not in the SourceMap.')};nn.prototype.generatedPositionFor=function(e){var n=se.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:se.getArg(e,"line"),originalColumn:se.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",se.compareByOriginalPositions,se.getArg(e,"bias",nt.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:se.getArg(i,"generatedLine",null),column:se.getArg(i,"generatedColumn",null),lastColumn:se.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};um.BasicSourceMapConsumer=nn;function Qr(t,e){var n=t;typeof t=="string"&&(n=se.parseSourceMapInput(t));var r=se.getArg(n,"version"),o=se.getArg(n,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new Rl,this._names=new Rl;var i={line:-1,column:0};this._sections=o.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var a=se.getArg(s,"offset"),l=se.getArg(a,"line"),u=se.getArg(a,"column");if(l{var KU=Px().SourceMapGenerator,cm=El(),YU=/(\r?\n)/,XU=10,Cl="$$$isSourceNode$$$";function ir(t,e,n,r,o){this.children=[],this.sourceContents={},this.line=t??null,this.column=e??null,this.source=n??null,this.name=o??null,this[Cl]=!0,r!=null&&this.add(r)}ir.fromStringWithSourceMap=function(e,n,r){var o=new ir,i=e.split(YU),s=0,a=function(){var d=m(),p=m()||"";return d+p;function m(){return s=0;n--)this.prepend(e[n]);else if(e[Cl]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};ir.prototype.walk=function(e){for(var n,r=0,o=this.children.length;r0){for(n=[],r=0;r{fm.SourceMapGenerator=Px().SourceMapGenerator;fm.SourceMapConsumer=OO().SourceMapConsumer;fm.SourceNode=MO().SourceNode});var zO={};Jd(zO,{basename:()=>UO,default:()=>ZU,delimiter:()=>BO,dirname:()=>JO,extname:()=>_O,isAbsolute:()=>Dx,join:()=>LO,normalize:()=>Lx,relative:()=>DO,resolve:()=>dm,sep:()=>FO});function AO(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];o==="."?t.splice(r,1):o===".."?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function dm(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var r=n>=0?arguments[n]:"/";if(typeof r!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!r)continue;t=r+"/"+t,e=r.charAt(0)==="/"}return t=AO(Fx(t.split("/"),function(o){return!!o}),!e).join("/"),(e?"/":"")+t||"."}function Lx(t){var e=Dx(t),n=e_(t,-1)==="/";return t=AO(Fx(t.split("/"),function(r){return!!r}),!e).join("/"),!t&&!e&&(t="."),t&&n&&(t+="/"),(e?"/":"")+t}function Dx(t){return t.charAt(0)==="/"}function LO(){var t=Array.prototype.slice.call(arguments,0);return Lx(Fx(t,function(e,n){if(typeof e!="string")throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function DO(t,e){t=dm(t).substr(1),e=dm(e).substr(1);function n(u){for(var c=0;c=0&&u[f]==="";f--);return c>f?[]:u.slice(c,f-c+1)}for(var r=n(t.split("/")),o=n(e.split("/")),i=Math.min(r.length,o.length),s=i,a=0;a{QU=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,Ax=function(t){return QU.exec(t).slice(1)};FO="/",BO=":";ZU={extname:_O,basename:UO,dirname:JO,sep:FO,delimiter:BO,relative:DO,join:LO,isAbsolute:Dx,normalize:Lx,resolve:dm};e_="ab".substr(-1)==="b"?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}});var qO=Be((GW,pm)=>{var js=(VO(),PR(zO));if(js&&js.default){pm.exports=js.default;for(let t in js)pm.exports[t]=js[t]}else js&&(pm.exports=js)});var jO={};Jd(jO,{default:()=>t_});var t_,HO=CR(()=>{t_={}});var $O=Be((KW,mm)=>{var Hs=(HO(),PR(jO));if(Hs&&Hs.default){mm.exports=Hs.default;for(let t in Hs)mm.exports[t]=Hs[t]}else Hs&&(mm.exports=Hs)});var GO=Be((YW,WO)=>{var n_=Object.prototype.toString,Bx=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function r_(t){return n_.call(t).slice(8,-1)==="ArrayBuffer"}function o_(t,e,n){e>>>=0;var r=t.byteLength-e;if(r<0)throw new RangeError("'offset' is out of bounds");if(n===void 0)n=r;else if(n>>>=0,n>r)throw new RangeError("'length' is out of bounds");return Bx?Buffer.from(t.slice(e,e+n)):new Buffer(new Uint8Array(t.slice(e,e+n)))}function i_(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return Bx?Buffer.from(t,e):new Buffer(t,e)}function s_(t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return r_(t)?o_(t,e,n):typeof t=="string"?i_(t,e):Bx?Buffer.from(t):new Buffer(t)}WO.exports=s_});var nN=Be((Ws,zx)=>{var a_=IO().SourceMapConsumer,Jx=qO(),yo;try{yo=$O(),(!yo.existsSync||!yo.readFileSync)&&(yo=null)}catch{}var l_=GO();function KO(t,e){return t.require(e)}var YO=!1,XO=!1,Ux=!1,tf="auto",$s={},nf={},u_=/^data:application\/json[^,]+base64,/,$i=[],Wi=[];function Vx(){return tf==="browser"?!0:tf==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function c_(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function f_(){return typeof process=="object"&&process!==null?process.version:""}function d_(){if(typeof process=="object"&&process!==null)return process.stderr}function p_(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function hm(t){return function(e){for(var n=0;n";var n=this.getLineNumber();if(n!=null){e+=":"+n;var r=this.getColumnNumber();r&&(e+=":"+r)}}var o="",i=this.getFunctionName(),s=!0,a=this.isConstructor(),l=!(this.isToplevel()||a);if(l){var u=this.getTypeName();u==="[object Object]"&&(u="null");var c=this.getMethodName();i?(u&&i.indexOf(u)!=0&&(o+=u+"."),o+=i,c&&i.indexOf("."+c)!=i.length-c.length-1&&(o+=" [as "+c+"]")):o+=u+"."+(c||"")}else a?o+="new "+(i||""):i?o+=i:(o+=e,s=!1);return s&&(o+=" ("+e+")"),o}function QO(t){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(n){e[n]=/^(?:is|get)/.test(n)?function(){return t[n].call(t)}:t[n]}),e.toString=h_,e}function eN(t,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),t.isNative())return e.curPosition=null,t;var n=t.getFileName()||t.getScriptNameOrSourceURL();if(n){var r=t.getLineNumber(),o=t.getColumnNumber()-1,i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=i.test(f_())?0:62;r===1&&o>s&&!Vx()&&!t.isEval()&&(o-=s);var a=Hx({source:n,line:r,column:o});e.curPosition=a,t=QO(t);var l=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?l():e.nextPosition.name||l()},t.getFileName=function(){return a.source},t.getLineNumber=function(){return a.line},t.getColumnNumber=function(){return a.column+1},t.getScriptNameOrSourceURL=function(){return a.source},t}var u=t.isEval()&&t.getEvalOrigin();return u&&(u=ZO(u),t=QO(t),t.getEvalOrigin=function(){return u}),t}function g_(t,e){Ux&&($s={},nf={});for(var n=t.name||"Error",r=t.message||"",o=n+": "+r,i={nextPosition:null,curPosition:null},s=[],a=e.length-1;a>=0;a--)s.push(` - at `+eN(e[a],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,o+s.reverse().join("")}function tN(t){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var n=e[1],r=+e[2],o=+e[3],i=$s[n];if(!i&&yo&&yo.existsSync(n))try{i=yo.readFileSync(n,"utf8")}catch{i=""}if(i){var s=i.split(/(?:\r\n|\r|\n)/)[r-1];if(s)return n+":"+r+` +`+i.stack}return{value:t,source:e,stack:o,digest:null}}function D0(t,e,n){return{value:t,source:null,stack:n??null,digest:e??null}}function yw(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var pU=typeof WeakMap=="function"?WeakMap:Map;function DP(t,e,n){n=$o(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Hp||(Hp=!0,Tw=r),yw(t,e)},n}function FP(t,e,n){n=$o(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return r(o)},n.callback=function(){yw(t,e)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){yw(t,e),typeof r!="function"&&(Ui===null?Ui=new Set([this]):Ui.add(this));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}function HC(t,e,n){var r=t.pingCache;if(r===null){r=t.pingCache=new pU;var o=new Set;r.set(e,o)}else o=r.get(e),o===void 0&&(o=new Set,r.set(e,o));o.has(n)||(o.add(n),t=TU.bind(null,t,e,n),e.then(t,t))}function $C(t){do{var e;if((e=t.tag===13)&&(e=t.memoizedState,e=e!==null?e.dehydrated!==null:!0),e)return t;t=t.return}while(t!==null);return null}function WC(t,e,n,r,o){return t.mode&1?(t.flags|=65536,t.lanes=o,t):(t===e?t.flags|=65536:(t.flags|=128,n.flags|=131072,n.flags&=-52805,n.tag===1&&(n.alternate===null?n.tag=17:(e=$o(-1,1),e.tag=2,Ji(n,e,1))),n.lanes|=1),t)}var mU=Xo.ReactCurrentOwner,Hn=!1;function Mn(t,e,n,r){e.child=t===null?mP(e,null,n,r):wl(e,t.child,n,r)}function GC(t,e,n,r,o){n=n.render;var i=e.ref;return ml(e,o),r=ix(t,e,n,r,i,o),n=sx(),t!==null&&!Hn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Yo(t,e,o)):(st&&n&&Ww(e),e.flags|=1,Mn(t,e,r,o),e.child)}function KC(t,e,n,r,o){if(t===null){var i=n.type;return typeof i=="function"&&!gx(i)&&i.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=i,BP(t,e,i,r,o)):(t=Ep(n.type,null,r,e,e.mode,o),t.ref=e.ref,t.return=e,e.child=t)}if(i=t.child,!(t.lanes&o)){var s=i.memoizedProps;if(n=n.compare,n=n!==null?n:_c,n(s,r)&&t.ref===e.ref)return Yo(t,e,o)}return e.flags|=1,t=zi(i,r),t.ref=e.ref,t.return=e,e.child=t}function BP(t,e,n,r,o){if(t!==null){var i=t.memoizedProps;if(_c(i,r)&&t.ref===e.ref)if(Hn=!1,e.pendingProps=r=i,(t.lanes&o)!==0)t.flags&131072&&(Hn=!0);else return e.lanes=t.lanes,Yo(t,e,o)}return vw(t,e,n,r,o)}function JP(t,e,n){var r=e.pendingProps,o=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden")if(!(e.mode&1))e.memoizedState={baseLanes:0,cachePool:null,transitions:null},Xe(ul,er),er|=n;else{if(!(n&1073741824))return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t,cachePool:null,transitions:null},e.updateQueue=null,Xe(ul,er),er|=t,null;e.memoizedState={baseLanes:0,cachePool:null,transitions:null},r=i!==null?i.baseLanes:n,Xe(ul,er),er|=r}else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Xe(ul,er),er|=r;return Mn(t,e,o,n),e.child}function UP(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=512,e.flags|=2097152)}function vw(t,e,n,r,o){var i=Wn(n)?Bs:vn.current;return i=yl(e,i),ml(e,o),n=ix(t,e,n,r,i,o),r=sx(),t!==null&&!Hn?(e.updateQueue=t.updateQueue,e.flags&=-2053,t.lanes&=~o,Yo(t,e,o)):(st&&r&&Ww(e),e.flags|=1,Mn(t,e,n,o),e.child)}function YC(t,e,n,r,o){if(Wn(n)){var i=!0;Dp(e)}else i=!1;if(ml(e,o),e.stateNode===null)Sp(t,e),dP(e,n,r),gw(e,n,r,o),r=!0;else if(t===null){var s=e.stateNode,a=e.memoizedProps;s.props=a;var l=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=Rr(u):(u=Wn(n)?Bs:vn.current,u=yl(e,u));var c=n.getDerivedStateFromProps,f=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==r||l!==u)&&zC(e,s,r,u),Oi=!1;var d=e.memoizedState;s.state=d,_p(e,r,s,o),l=e.memoizedState,a!==r||d!==l||$n.current||Oi?(typeof c=="function"&&(hw(e,n,c,r),l=e.memoizedState),(a=Oi||_C(e,n,a,r,d,l,u))?(f||typeof s.UNSAFE_componentWillMount!="function"&&typeof s.componentWillMount!="function"||(typeof s.componentWillMount=="function"&&s.componentWillMount(),typeof s.UNSAFE_componentWillMount=="function"&&s.UNSAFE_componentWillMount()),typeof s.componentDidMount=="function"&&(e.flags|=4194308)):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),e.memoizedProps=r,e.memoizedState=l),s.props=r,s.state=l,s.context=u,r=a):(typeof s.componentDidMount=="function"&&(e.flags|=4194308),r=!1)}else{s=e.stateNode,cP(t,e),a=e.memoizedProps,u=e.type===e.elementType?a:Gr(e.type,a),s.props=u,f=e.pendingProps,d=s.context,l=n.contextType,typeof l=="object"&&l!==null?l=Rr(l):(l=Wn(n)?Bs:vn.current,l=yl(e,l));var p=n.getDerivedStateFromProps;(c=typeof p=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(a!==f||d!==l)&&zC(e,s,r,l),Oi=!1,d=e.memoizedState,s.state=d,_p(e,r,s,o);var m=e.memoizedState;a!==f||d!==m||$n.current||Oi?(typeof p=="function"&&(hw(e,n,p,r),m=e.memoizedState),(u=Oi||_C(e,n,u,r,d,m,l)||!1)?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,m,l),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,m,l)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=1024)):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),e.memoizedProps=r,e.memoizedState=m),s.props=r,s.state=m,s.context=l,r=u):(typeof s.componentDidUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||a===t.memoizedProps&&d===t.memoizedState||(e.flags|=1024),r=!1)}return ww(t,e,n,r,i,o)}function ww(t,e,n,r,o,i){UP(t,e);var s=(e.flags&128)!==0;if(!r&&!s)return o&&DC(e,n,!1),Yo(t,e,i);r=e.stateNode,mU.current=e;var a=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=wl(e,t.child,null,i),e.child=wl(e,null,a,i)):Mn(t,e,a,i),e.memoizedState=r.state,o&&DC(e,n,!0),e.child}function _P(t){var e=t.stateNode;e.pendingContext?LC(t,e.pendingContext,e.pendingContext!==e.context):e.context&&LC(t,e.context,!1),tx(t,e.containerInfo)}function XC(t,e,n,r,o){return vl(),Kw(o),e.flags|=256,Mn(t,e,n,r),e.child}var xw={dehydrated:null,treeContext:null,retryLane:0};function Sw(t){return{baseLanes:t,cachePool:null,transitions:null}}function zP(t,e,n){var r=e.pendingProps,o=ft.current,i=!1,s=(e.flags&128)!==0,a;if((a=s)||(a=t!==null&&t.memoizedState===null?!1:(o&2)!==0),a?(i=!0,e.flags&=-129):(t===null||t.memoizedState!==null)&&(o|=1),Xe(ft,o&1),t===null)return pw(e),t=e.memoizedState,t!==null&&(t=t.dehydrated,t!==null)?(e.mode&1?t.data==="$!"?e.lanes=8:e.lanes=1073741824:e.lanes=1,null):(s=r.children,t=r.fallback,i?(r=e.mode,i=e.child,s={mode:"hidden",children:s},!(r&1)&&i!==null?(i.childLanes=0,i.pendingProps=s):i=im(s,r,0,null),t=Fs(t,r,n,null),i.return=e,t.return=e,i.sibling=t,e.child=i,e.child.memoizedState=Sw(n),e.memoizedState=xw,t):ux(e,s));if(o=t.memoizedState,o!==null&&(a=o.dehydrated,a!==null))return hU(t,e,s,r,a,o,n);if(i){i=r.fallback,s=e.mode,o=t.child,a=o.sibling;var l={mode:"hidden",children:r.children};return!(s&1)&&e.child!==o?(r=e.child,r.childLanes=0,r.pendingProps=l,e.deletions=null):(r=zi(o,l),r.subtreeFlags=o.subtreeFlags&14680064),a!==null?i=zi(a,i):(i=Fs(i,s,n,null),i.flags|=2),i.return=e,r.return=e,r.sibling=i,e.child=r,r=i,i=e.child,s=t.child.memoizedState,s=s===null?Sw(n):{baseLanes:s.baseLanes|n,cachePool:null,transitions:s.transitions},i.memoizedState=s,i.childLanes=t.childLanes&~n,e.memoizedState=xw,r}return i=t.child,t=i.sibling,r=zi(i,{mode:"visible",children:r.children}),!(e.mode&1)&&(r.lanes=n),r.return=e,r.sibling=null,t!==null&&(n=e.deletions,n===null?(e.deletions=[t],e.flags|=16):n.push(t)),e.child=r,e.memoizedState=null,r}function ux(t,e){return e=im({mode:"visible",children:e},t.mode,0,null),e.return=t,t.child=e}function dp(t,e,n,r){return r!==null&&Kw(r),wl(e,t.child,null,n),t=ux(e,e.pendingProps.children),t.flags|=2,e.memoizedState=null,t}function hU(t,e,n,r,o,i,s){if(n)return e.flags&256?(e.flags&=-257,r=D0(Error($(422))),dp(t,e,s,r)):e.memoizedState!==null?(e.child=t.child,e.flags|=128,null):(i=r.fallback,o=e.mode,r=im({mode:"visible",children:r.children},o,0,null),i=Fs(i,o,s,null),i.flags|=2,r.return=e,i.return=e,r.sibling=i,e.child=r,e.mode&1&&wl(e,t.child,null,s),e.child.memoizedState=Sw(s),e.memoizedState=xw,i);if(!(e.mode&1))return dp(t,e,s,null);if(o.data==="$!"){if(r=o.nextSibling&&o.nextSibling.dataset,r)var a=r.dgst;return r=a,i=Error($(419)),r=D0(i,r,void 0),dp(t,e,s,r)}if(a=(s&t.childLanes)!==0,Hn||a){if(r=Vt,r!==null){switch(s&-s){case 4:o=2;break;case 16:o=8;break;case 64: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:case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:o=32;break;case 536870912:o=268435456;break;default:o=0}o=o&(r.suspendedLanes|s)?0:o,o!==0&&o!==i.retryLane&&(i.retryLane=o,Ko(t,o),Qr(r,t,o,-1))}return hx(),r=D0(Error($(421))),dp(t,e,s,r)}return o.data==="$?"?(e.flags|=128,e.child=t.child,e=PU.bind(null,t),o._reactRetry=e,null):(t=i.treeContext,tr=Bi(o.nextSibling),nr=e,st=!0,Yr=null,t!==null&&(Sr[kr++]=jo,Sr[kr++]=Ho,Sr[kr++]=Js,jo=t.id,Ho=t.overflow,Js=e),e=ux(e,r.children),e.flags|=4096,e)}function QC(t,e,n){t.lanes|=e;var r=t.alternate;r!==null&&(r.lanes|=e),mw(t.return,e,n)}function F0(t,e,n,r,o){var i=t.memoizedState;i===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o}:(i.isBackwards=e,i.rendering=null,i.renderingStartTime=0,i.last=r,i.tail=n,i.tailMode=o)}function VP(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(Mn(t,e,r.children,n),r=ft.current,r&2)r=r&1|2,e.flags|=128;else{if(t!==null&&t.flags&128)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&QC(t,n,e);else if(t.tag===19)QC(t,n,e);else if(t.child!==null){t.child.return=t,t=t.child;continue}if(t===e)break e;for(;t.sibling===null;){if(t.return===null||t.return===e)break e;t=t.return}t.sibling.return=t.return,t=t.sibling}r&=1}if(Xe(ft,r),!(e.mode&1))e.memoizedState=null;else switch(o){case"forwards":for(n=e.child,o=null;n!==null;)t=n.alternate,t!==null&&zp(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),F0(e,!1,o,n,i);break;case"backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&zp(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}F0(e,!0,n,null,i);break;case"together":F0(e,!1,null,null,void 0);break;default:e.memoizedState=null}return e.child}function Sp(t,e){!(e.mode&1)&&t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2)}function Yo(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),_s|=e.lanes,!(n&e.childLanes))return null;if(t!==null&&e.child!==t.child)throw Error($(153));if(e.child!==null){for(t=e.child,n=zi(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=zi(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}function gU(t,e,n){switch(e.tag){case 3:_P(e),vl();break;case 5:hP(e);break;case 1:Wn(e.type)&&Dp(e);break;case 4:tx(e,e.stateNode.containerInfo);break;case 10:var r=e.type._context,o=e.memoizedProps.value;Xe(Jp,r._currentValue),r._currentValue=o;break;case 13:if(r=e.memoizedState,r!==null)return r.dehydrated!==null?(Xe(ft,ft.current&1),e.flags|=128,null):n&e.child.childLanes?zP(t,e,n):(Xe(ft,ft.current&1),t=Yo(t,e,n),t!==null?t.sibling:null);Xe(ft,ft.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&128){if(r)return VP(t,e,n);e.flags|=128}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Xe(ft,ft.current),r)break;return null;case 22:case 23:return e.lanes=0,JP(t,e,n)}return Yo(t,e,n)}var qP,kw,jP,HP;qP=function(t,e){for(var n=e.child;n!==null;){if(n.tag===5||n.tag===6)t.appendChild(n.stateNode);else if(n.tag!==4&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===e)break;for(;n.sibling===null;){if(n.return===null||n.return===e)return;n=n.return}n.sibling.return=n.return,n=n.sibling}};kw=function(){};jP=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,Ls(yo.current);var i=null;switch(n){case"input":o=j0(t,o),r=j0(t,r),i=[];break;case"select":o=pt({},o,{value:void 0}),r=pt({},r,{value:void 0}),i=[];break;case"textarea":o=W0(t,o),r=W0(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Ap)}K0(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var a=o[u];for(s in a)a.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Ac.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var l=r[u];if(a=o?.[u],r.hasOwnProperty(u)&&l!==a&&(l!=null||a!=null))if(u==="style")if(a){for(s in a)!a.hasOwnProperty(s)||l&&l.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in l)l.hasOwnProperty(s)&&a[s]!==l[s]&&(n||(n={}),n[s]=l[s])}else n||(i||(i=[]),i.push(u,n)),n=l;else u==="dangerouslySetInnerHTML"?(l=l?l.__html:void 0,a=a?a.__html:void 0,l!=null&&a!==l&&(i=i||[]).push(u,l)):u==="children"?typeof l!="string"&&typeof l!="number"||(i=i||[]).push(u,""+l):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Ac.hasOwnProperty(u)?(l!=null&&u==="onScroll"&&et("scroll",t),i||a===l||(i=[])):(i=i||[]).push(u,l))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};HP=function(t,e,n,r){n!==r&&(e.flags|=4)};function yc(t,e){if(!st)switch(t.tailMode){case"hidden":e=t.tail;for(var n=null;e!==null;)e.alternate!==null&&(n=e),e=e.sibling;n===null?t.tail=null:n.sibling=null;break;case"collapsed":n=t.tail;for(var r=null;n!==null;)n.alternate!==null&&(r=n),n=n.sibling;r===null?e||t.tail===null?t.tail=null:t.tail.sibling=null:r.sibling=null}}function gn(t){var e=t.alternate!==null&&t.alternate.child===t.child,n=0,r=0;if(e)for(var o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags&14680064,r|=o.flags&14680064,o.return=t,o=o.sibling;else for(o=t.child;o!==null;)n|=o.lanes|o.childLanes,r|=o.subtreeFlags,r|=o.flags,o.return=t,o=o.sibling;return t.subtreeFlags|=r,t.childLanes=n,e}function yU(t,e,n){var r=e.pendingProps;switch(Gw(e),e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return gn(e),null;case 1:return Wn(e.type)&&Lp(),gn(e),null;case 3:return r=e.stateNode,xl(),tt($n),tt(vn),rx(),r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(cp(e)?e.flags|=4:t===null||t.memoizedState.isDehydrated&&!(e.flags&256)||(e.flags|=1024,Yr!==null&&(Nw(Yr),Yr=null))),kw(t,e),gn(e),null;case 5:nx(e);var o=Ls(Hc.current);if(n=e.type,t!==null&&e.stateNode!=null)jP(t,e,n,r,o),t.ref!==e.ref&&(e.flags|=512,e.flags|=2097152);else{if(!r){if(e.stateNode===null)throw Error($(166));return gn(e),null}if(t=Ls(yo.current),cp(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[ho]=e,r[qc]=i,t=(e.mode&1)!==0,n){case"dialog":et("cancel",r),et("close",r);break;case"iframe":case"object":case"embed":et("load",r);break;case"video":case"audio":for(o=0;o<\/script>",t=t.removeChild(t.firstChild)):typeof r.is=="string"?t=s.createElement(n,{is:r.is}):(t=s.createElement(n),n==="select"&&(s=t,r.multiple?s.multiple=!0:r.size&&(s.size=r.size))):t=s.createElementNS(t,n),t[ho]=e,t[qc]=r,qP(t,e,!1,!1),e.stateNode=t;e:{switch(s=Y0(n,r),n){case"dialog":et("cancel",t),et("close",t),o=r;break;case"iframe":case"object":case"embed":et("load",t),o=r;break;case"video":case"audio":for(o=0;okl&&(e.flags|=128,r=!0,yc(i,!1),e.lanes=4194304)}else{if(!r)if(t=zp(s),t!==null){if(e.flags|=128,r=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),yc(i,!0),i.tail===null&&i.tailMode==="hidden"&&!s.alternate&&!st)return gn(e),null}else 2*bt()-i.renderingStartTime>kl&&n!==1073741824&&(e.flags|=128,r=!0,yc(i,!1),e.lanes=4194304);i.isBackwards?(s.sibling=e.child,e.child=s):(n=i.last,n!==null?n.sibling=s:e.child=s,i.last=s)}return i.tail!==null?(e=i.tail,i.rendering=e,i.tail=e.sibling,i.renderingStartTime=bt(),e.sibling=null,n=ft.current,Xe(ft,r?n&1|2:n&1),e):(gn(e),null);case 22:case 23:return mx(),r=e.memoizedState!==null,t!==null&&t.memoizedState!==null!==r&&(e.flags|=8192),r&&e.mode&1?er&1073741824&&(gn(e),e.subtreeFlags&6&&(e.flags|=8192)):gn(e),null;case 24:return null;case 25:return null}throw Error($(156,e.tag))}function vU(t,e){switch(Gw(e),e.tag){case 1:return Wn(e.type)&&Lp(),t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 3:return xl(),tt($n),tt(vn),rx(),t=e.flags,t&65536&&!(t&128)?(e.flags=t&-65537|128,e):null;case 5:return nx(e),null;case 13:if(tt(ft),t=e.memoizedState,t!==null&&t.dehydrated!==null){if(e.alternate===null)throw Error($(340));vl()}return t=e.flags,t&65536?(e.flags=t&-65537|128,e):null;case 19:return tt(ft),null;case 4:return xl(),null;case 10:return Qw(e.type._context),null;case 22:case 23:return mx(),null;case 24:return null;default:return null}}var pp=!1,yn=!1,wU=typeof WeakSet=="function"?WeakSet:Set,re=null;function ll(t,e){var n=t.ref;if(n!==null)if(typeof n=="function")try{n(null)}catch(r){vt(t,e,r)}else n.current=null}function bw(t,e,n){try{n()}catch(r){vt(t,e,r)}}var ZC=!1;function xU(t,e){if(sw=Np,t=KT(),$w(t)){if("selectionStart"in t)var n={start:t.selectionStart,end:t.selectionEnd};else e:{n=(n=t.ownerDocument)&&n.defaultView||window;var r=n.getSelection&&n.getSelection();if(r&&r.rangeCount!==0){n=r.anchorNode;var o=r.anchorOffset,i=r.focusNode;r=r.focusOffset;try{n.nodeType,i.nodeType}catch{n=null;break e}var s=0,a=-1,l=-1,u=0,c=0,f=t,d=null;t:for(;;){for(var p;f!==n||o!==0&&f.nodeType!==3||(a=s+o),f!==i||r!==0&&f.nodeType!==3||(l=s+r),f.nodeType===3&&(s+=f.nodeValue.length),(p=f.firstChild)!==null;)d=f,f=p;for(;;){if(f===t)break t;if(d===n&&++u===o&&(a=s),d===i&&++c===r&&(l=s),(p=f.nextSibling)!==null)break;f=d,d=f.parentNode}f=p}n=a===-1||l===-1?null:{start:a,end:l}}else n=null}n=n||{start:0,end:0}}else n=null;for(aw={focusedElem:t,selectionRange:n},Np=!1,re=e;re!==null;)if(e=re,t=e.child,(e.subtreeFlags&1028)!==0&&t!==null)t.return=e,re=t;else for(;re!==null;){e=re;try{var m=e.alternate;if(e.flags&1024)switch(e.tag){case 0:case 11:case 15:break;case 1:if(m!==null){var y=m.memoizedProps,w=m.memoizedState,g=e.stateNode,v=g.getSnapshotBeforeUpdate(e.elementType===e.type?y:Gr(e.type,y),w);g.__reactInternalSnapshotBeforeUpdate=v}break;case 3:var k=e.stateNode.containerInfo;k.nodeType===1?k.textContent="":k.nodeType===9&&k.documentElement&&k.removeChild(k.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error($(163))}}catch(S){vt(e,e.return,S)}if(t=e.sibling,t!==null){t.return=e.return,re=t;break}re=e.return}return m=ZC,ZC=!1,m}function Nc(t,e,n){var r=e.updateQueue;if(r=r!==null?r.lastEffect:null,r!==null){var o=r=r.next;do{if((o.tag&t)===t){var i=o.destroy;o.destroy=void 0,i!==void 0&&bw(e,n,i)}o=o.next}while(o!==r)}}function rm(t,e){if(e=e.updateQueue,e=e!==null?e.lastEffect:null,e!==null){var n=e=e.next;do{if((n.tag&t)===t){var r=n.create;n.destroy=r()}n=n.next}while(n!==e)}}function Ew(t){var e=t.ref;if(e!==null){var n=t.stateNode;switch(t.tag){case 5:t=n;break;default:t=n}typeof e=="function"?e(t):e.current=t}}function $P(t){var e=t.alternate;e!==null&&(t.alternate=null,$P(e)),t.child=null,t.deletions=null,t.sibling=null,t.tag===5&&(e=t.stateNode,e!==null&&(delete e[ho],delete e[qc],delete e[cw],delete e[nU],delete e[rU])),t.stateNode=null,t.return=null,t.dependencies=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.stateNode=null,t.updateQueue=null}function WP(t){return t.tag===5||t.tag===3||t.tag===4}function eT(t){e:for(;;){for(;t.sibling===null;){if(t.return===null||WP(t.return))return null;t=t.return}for(t.sibling.return=t.return,t=t.sibling;t.tag!==5&&t.tag!==6&&t.tag!==18;){if(t.flags&2||t.child===null||t.tag===4)continue e;t.child.return=t,t=t.child}if(!(t.flags&2))return t.stateNode}}function Rw(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.nodeType===8?n.parentNode.insertBefore(t,e):n.insertBefore(t,e):(n.nodeType===8?(e=n.parentNode,e.insertBefore(t,n)):(e=n,e.appendChild(t)),n=n._reactRootContainer,n!=null||e.onclick!==null||(e.onclick=Ap));else if(r!==4&&(t=t.child,t!==null))for(Rw(t,e,n),t=t.sibling;t!==null;)Rw(t,e,n),t=t.sibling}function Cw(t,e,n){var r=t.tag;if(r===5||r===6)t=t.stateNode,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(Cw(t,e,n),t=t.sibling;t!==null;)Cw(t,e,n),t=t.sibling}var en=null,Kr=!1;function Ti(t,e,n){for(n=n.child;n!==null;)GP(t,e,n),n=n.sibling}function GP(t,e,n){if(go&&typeof go.onCommitFiberUnmount=="function")try{go.onCommitFiberUnmount(Kp,n)}catch{}switch(n.tag){case 5:yn||ll(n,e);case 6:var r=en,o=Kr;en=null,Ti(t,e,n),en=r,Kr=o,en!==null&&(Kr?(t=en,n=n.stateNode,t.nodeType===8?t.parentNode.removeChild(n):t.removeChild(n)):en.removeChild(n.stateNode));break;case 18:en!==null&&(Kr?(t=en,n=n.stateNode,t.nodeType===8?O0(t.parentNode,n):t.nodeType===1&&O0(t,n),Jc(t)):O0(en,n.stateNode));break;case 4:r=en,o=Kr,en=n.stateNode.containerInfo,Kr=!0,Ti(t,e,n),en=r,Kr=o;break;case 0:case 11:case 14:case 15:if(!yn&&(r=n.updateQueue,r!==null&&(r=r.lastEffect,r!==null))){o=r=r.next;do{var i=o,s=i.destroy;i=i.tag,s!==void 0&&(i&2||i&4)&&bw(n,e,s),o=o.next}while(o!==r)}Ti(t,e,n);break;case 1:if(!yn&&(ll(n,e),r=n.stateNode,typeof r.componentWillUnmount=="function"))try{r.props=n.memoizedProps,r.state=n.memoizedState,r.componentWillUnmount()}catch(a){vt(n,e,a)}Ti(t,e,n);break;case 21:Ti(t,e,n);break;case 22:n.mode&1?(yn=(r=yn)||n.memoizedState!==null,Ti(t,e,n),yn=r):Ti(t,e,n);break;default:Ti(t,e,n)}}function tT(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new wU),e.forEach(function(r){var o=OU.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function Wr(t,e){var n=e.deletions;if(n!==null)for(var r=0;ro&&(o=s),r&=~i}if(r=o,r=bt()-r,r=(120>r?120:480>r?480:1080>r?1080:1920>r?1920:3e3>r?3e3:4320>r?4320:1960*kU(r/1960))-r,10t?16:t,Ai===null)var r=!1;else{if(t=Ai,Ai=null,$p=0,Je&6)throw Error($(331));var o=Je;for(Je|=4,re=t.current;re!==null;){var i=re,s=i.child;if(re.flags&16){var a=i.deletions;if(a!==null){for(var l=0;lbt()-dx?Ds(t,0):fx|=n),Gn(t,e)}function nO(t,e){e===0&&(t.mode&1?(e=ep,ep<<=1,!(ep&130023424)&&(ep=4194304)):e=1);var n=In();t=Ko(t,e),t!==null&&(Yc(t,e,n),Gn(t,n))}function PU(t){var e=t.memoizedState,n=0;e!==null&&(n=e.retryLane),nO(t,n)}function OU(t,e){var n=0;switch(t.tag){case 13:var r=t.stateNode,o=t.memoizedState;o!==null&&(n=o.retryLane);break;case 19:r=t.stateNode;break;default:throw Error($(314))}r!==null&&r.delete(e),nO(t,n)}var rO;rO=function(t,e,n){if(t!==null)if(t.memoizedProps!==e.pendingProps||$n.current)Hn=!0;else{if(!(t.lanes&n)&&!(e.flags&128))return Hn=!1,gU(t,e,n);Hn=!!(t.flags&131072)}else Hn=!1,st&&e.flags&1048576&&sP(e,Bp,e.index);switch(e.lanes=0,e.tag){case 2:var r=e.type;Sp(t,e),t=e.pendingProps;var o=yl(e,vn.current);ml(e,n),o=ix(null,e,r,t,o,n);var i=sx();return e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0?(e.tag=1,e.memoizedState=null,e.updateQueue=null,Wn(r)?(i=!0,Dp(e)):i=!1,e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,ex(e),o.updater=tm,e.stateNode=o,o._reactInternals=e,gw(e,r,t,n),e=ww(null,e,r,!0,i,n)):(e.tag=0,st&&i&&Ww(e),Mn(null,e,o,n),e=e.child),e;case 16:r=e.elementType;e:{switch(Sp(t,e),t=e.pendingProps,o=r._init,r=o(r._payload),e.type=r,o=e.tag=MU(r),t=Gr(r,t),o){case 0:e=vw(null,e,r,t,n);break e;case 1:e=YC(null,e,r,t,n);break e;case 11:e=GC(null,e,r,t,n);break e;case 14:e=KC(null,e,r,Gr(r.type,t),n);break e}throw Error($(306,r,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Gr(r,o),vw(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Gr(r,o),YC(t,e,r,o,n);case 3:e:{if(_P(e),t===null)throw Error($(387));r=e.pendingProps,i=e.memoizedState,o=i.element,cP(t,e),_p(e,r,null,n);var s=e.memoizedState;if(r=s.element,i.isDehydrated)if(i={element:r,isDehydrated:!1,cache:s.cache,pendingSuspenseBoundaries:s.pendingSuspenseBoundaries,transitions:s.transitions},e.updateQueue.baseState=i,e.memoizedState=i,e.flags&256){o=Sl(Error($(423)),e),e=XC(t,e,r,n,o);break e}else if(r!==o){o=Sl(Error($(424)),e),e=XC(t,e,r,n,o);break e}else for(tr=Bi(e.stateNode.containerInfo.firstChild),nr=e,st=!0,Yr=null,n=mP(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|4096,n=n.sibling;else{if(vl(),r===o){e=Yo(t,e,n);break e}Mn(t,e,r,n)}e=e.child}return e;case 5:return hP(e),t===null&&pw(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,lw(r,o)?s=null:i!==null&&lw(r,i)&&(e.flags|=32),UP(t,e),Mn(t,e,s,n),e.child;case 6:return t===null&&pw(e),null;case 13:return zP(t,e,n);case 4:return tx(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=wl(e,null,r,n):Mn(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Gr(r,o),GC(t,e,r,o,n);case 7:return Mn(t,e,e.pendingProps,n),e.child;case 8:return Mn(t,e,e.pendingProps.children,n),e.child;case 12:return Mn(t,e,e.pendingProps.children,n),e.child;case 10:e:{if(r=e.type._context,o=e.pendingProps,i=e.memoizedProps,s=o.value,Xe(Jp,r._currentValue),r._currentValue=s,i!==null)if(Zr(i.value,s)){if(i.children===o.children&&!$n.current){e=Yo(t,e,n);break e}}else for(i=e.child,i!==null&&(i.return=e);i!==null;){var a=i.dependencies;if(a!==null){s=i.child;for(var l=a.firstContext;l!==null;){if(l.context===r){if(i.tag===1){l=$o(-1,n&-n),l.tag=2;var u=i.updateQueue;if(u!==null){u=u.shared;var c=u.pending;c===null?l.next=l:(l.next=c.next,c.next=l),u.pending=l}}i.lanes|=n,l=i.alternate,l!==null&&(l.lanes|=n),mw(i.return,n,e),a.lanes|=n;break}l=l.next}}else if(i.tag===10)s=i.type===e.type?null:i.child;else if(i.tag===18){if(s=i.return,s===null)throw Error($(341));s.lanes|=n,a=s.alternate,a!==null&&(a.lanes|=n),mw(s,n,e),s=i.sibling}else s=i.child;if(s!==null)s.return=i;else for(s=i;s!==null;){if(s===e){s=null;break}if(i=s.sibling,i!==null){i.return=s.return,s=i;break}s=s.return}i=s}Mn(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,r=e.pendingProps.children,ml(e,n),o=Rr(o),r=r(o),e.flags|=1,Mn(t,e,r,n),e.child;case 14:return r=e.type,o=Gr(r,e.pendingProps),o=Gr(r.type,o),KC(t,e,r,o,n);case 15:return BP(t,e,e.type,e.pendingProps,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Gr(r,o),Sp(t,e),e.tag=1,Wn(r)?(t=!0,Dp(e)):t=!1,ml(e,n),dP(e,r,o),gw(e,r,o,n),ww(null,e,r,!0,t,n);case 19:return VP(t,e,n);case 22:return JP(t,e,n)}throw Error($(156,e.tag))};function oO(t,e){return NT(t,e)}function NU(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.ref=null,this.pendingProps=e,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function br(t,e,n,r){return new NU(t,e,n,r)}function gx(t){return t=t.prototype,!(!t||!t.isReactComponent)}function MU(t){if(typeof t=="function")return gx(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Dw)return 11;if(t===Fw)return 14}return 2}function zi(t,e){var n=t.alternate;return n===null?(n=br(t.tag,e,t.key,t.mode),n.elementType=t.elementType,n.type=t.type,n.stateNode=t.stateNode,n.alternate=t,t.alternate=n):(n.pendingProps=e,n.type=t.type,n.flags=0,n.subtreeFlags=0,n.deletions=null),n.flags=t.flags&14680064,n.childLanes=t.childLanes,n.lanes=t.lanes,n.child=t.child,n.memoizedProps=t.memoizedProps,n.memoizedState=t.memoizedState,n.updateQueue=t.updateQueue,e=t.dependencies,n.dependencies=e===null?null:{lanes:e.lanes,firstContext:e.firstContext},n.sibling=t.sibling,n.index=t.index,n.ref=t.ref,n}function Ep(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")gx(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Za:return Fs(n.children,o,i,e);case Lw:s=8,o|=8;break;case _0:return t=br(12,n,e,o|2),t.elementType=_0,t.lanes=i,t;case z0:return t=br(13,n,e,o),t.elementType=z0,t.lanes=i,t;case V0:return t=br(19,n,e,o),t.elementType=V0,t.lanes=i,t;case pT:return im(n,o,i,e);default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case fT:s=10;break e;case dT:s=9;break e;case Dw:s=11;break e;case Fw:s=14;break e;case Pi:s=16,r=null;break e}throw Error($(130,t==null?t:typeof t,""))}return e=br(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function Fs(t,e,n,r){return t=br(7,t,r,e),t.lanes=n,t}function im(t,e,n,r){return t=br(22,t,r,e),t.elementType=pT,t.lanes=n,t.stateNode={isHidden:!1},t}function B0(t,e,n){return t=br(6,t,null,e),t.lanes=n,t}function J0(t,e,n){return e=br(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function IU(t,e,n,r,o){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.callbackNode=this.pendingContext=this.context=null,this.callbackPriority=0,this.eventTimes=S0(0),this.expirationTimes=S0(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=S0(0),this.identifierPrefix=r,this.onRecoverableError=o,this.mutableSourceEagerHydrationData=null}function yx(t,e,n,r,o,i,s,a,l){return t=new IU(t,e,n,a,l),e===1?(e=1,i===!0&&(e|=8)):e=0,i=br(3,null,null,e),t.current=i,i.stateNode=t,i.memoizedState={element:r,isDehydrated:n,cache:null,transitions:null,pendingSuspenseBoundaries:null},ex(i),t}function AU(t,e,n){var r=3{"use strict";function uO(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(uO)}catch(t){console.error(t)}}uO(),cO.exports=lO()});var dO=Be(kx=>{"use strict";var fO=Sx();kx.createRoot=fO.createRoot,kx.hydrateRoot=fO.hydrateRoot;var zW});var mO=Be(bx=>{var pO="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split("");bx.encode=function(t){if(0<=t&&t{var hO=mO(),Ex=5,gO=1<>1;return e?-n:n}Rx.encode=function(e){var n="",r,o=JU(e);do r=o&yO,o>>>=Ex,o>0&&(r|=vO),n+=hO.encode(r);while(o>0);return n};Rx.decode=function(e,n,r){var o=e.length,i=0,s=0,a,l;do{if(n>=o)throw new Error("Expected more digits in base 64 VLQ value.");if(l=hO.decode(e.charCodeAt(n++)),l===-1)throw new Error("Invalid base64 digit: "+e.charAt(n-1));a=!!(l&vO),l&=yO,i=i+(l<{function _U(t,e,n){if(e in t)return t[e];if(arguments.length===3)return n;throw new Error('"'+e+'" is a required argument.')}wn.getArg=_U;var wO=/^(?:([\w+\-.]+):)?\/\/(?:(\w+:\w+)@)?([\w.-]*)(?::(\d+))?(.*)$/,zU=/^data:.+\,.+$/;function ef(t){var e=t.match(wO);return e?{scheme:e[1],auth:e[2],host:e[3],port:e[4],path:e[5]}:null}wn.urlParse=ef;function Rl(t){var e="";return t.scheme&&(e+=t.scheme+":"),e+="//",t.auth&&(e+=t.auth+"@"),t.host&&(e+=t.host),t.port&&(e+=":"+t.port),t.path&&(e+=t.path),e}wn.urlGenerate=Rl;function Tx(t){var e=t,n=ef(t);if(n){if(!n.path)return t;e=n.path}for(var r=wn.isAbsolute(e),o=e.split(/\/+/),i,s=0,a=o.length-1;a>=0;a--)i=o[a],i==="."?o.splice(a,1):i===".."?s++:s>0&&(i===""?(o.splice(a+1,s),s=0):(o.splice(a,2),s--));return e=o.join("/"),e===""&&(e=r?"/":"."),n?(n.path=e,Rl(n)):e}wn.normalize=Tx;function xO(t,e){t===""&&(t="."),e===""&&(e=".");var n=ef(e),r=ef(t);if(r&&(t=r.path||"/"),n&&!n.scheme)return r&&(n.scheme=r.scheme),Rl(n);if(n||e.match(zU))return e;if(r&&!r.host&&!r.path)return r.host=e,Rl(r);var o=e.charAt(0)==="/"?e:Tx(t.replace(/\/+$/,"")+"/"+e);return r?(r.path=o,Rl(r)):o}wn.join=xO;wn.isAbsolute=function(t){return t.charAt(0)==="/"||wO.test(t)};function VU(t,e){t===""&&(t="."),t=t.replace(/\/$/,"");for(var n=0;e.indexOf(t+"/")!==0;){var r=t.lastIndexOf("/");if(r<0||(t=t.slice(0,r),t.match(/^([^\/]+:\/)?\/*$/)))return e;++n}return Array(n+1).join("../")+e.substr(t.length+1)}wn.relative=VU;var SO=function(){var t=Object.create(null);return!("__proto__"in t)}();function kO(t){return t}function qU(t){return bO(t)?"$"+t:t}wn.toSetString=SO?kO:qU;function jU(t){return bO(t)?t.slice(1):t}wn.fromSetString=SO?kO:jU;function bO(t){if(!t)return!1;var e=t.length;if(e<9||t.charCodeAt(e-1)!==95||t.charCodeAt(e-2)!==95||t.charCodeAt(e-3)!==111||t.charCodeAt(e-4)!==116||t.charCodeAt(e-5)!==111||t.charCodeAt(e-6)!==114||t.charCodeAt(e-7)!==112||t.charCodeAt(e-8)!==95||t.charCodeAt(e-9)!==95)return!1;for(var n=e-10;n>=0;n--)if(t.charCodeAt(n)!==36)return!1;return!0}function HU(t,e,n){var r=Cl(t.source,e.source);return r!==0||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0||n)||(r=t.generatedColumn-e.generatedColumn,r!==0)||(r=t.generatedLine-e.generatedLine,r!==0)?r:Cl(t.name,e.name)}wn.compareByOriginalPositions=HU;function $U(t,e,n){var r=t.generatedLine-e.generatedLine;return r!==0||(r=t.generatedColumn-e.generatedColumn,r!==0||n)||(r=Cl(t.source,e.source),r!==0)||(r=t.originalLine-e.originalLine,r!==0)||(r=t.originalColumn-e.originalColumn,r!==0)?r:Cl(t.name,e.name)}wn.compareByGeneratedPositionsDeflated=$U;function Cl(t,e){return t===e?0:t===null?1:e===null?-1:t>e?1:-1}function WU(t,e){var n=t.generatedLine-e.generatedLine;return n!==0||(n=t.generatedColumn-e.generatedColumn,n!==0)||(n=Cl(t.source,e.source),n!==0)||(n=t.originalLine-e.originalLine,n!==0)||(n=t.originalColumn-e.originalColumn,n!==0)?n:Cl(t.name,e.name)}wn.compareByGeneratedPositionsInflated=WU;function GU(t){return JSON.parse(t.replace(/^\)]}'[^\n]*\n/,""))}wn.parseSourceMapInput=GU;function KU(t,e,n){if(e=e||"",t&&(t[t.length-1]!=="/"&&e[0]!=="/"&&(t+="/"),e=t+e),n){var r=ef(n);if(!r)throw new Error("sourceMapURL could not be parsed");if(r.path){var o=r.path.lastIndexOf("/");o>=0&&(r.path=r.path.substring(0,o+1))}e=xO(Rl(r),e)}return Tx(e)}wn.computeSourceURL=KU});var Nx=Be(EO=>{var Px=Tl(),Ox=Object.prototype.hasOwnProperty,js=typeof Map<"u";function Qo(){this._array=[],this._set=js?new Map:Object.create(null)}Qo.fromArray=function(e,n){for(var r=new Qo,o=0,i=e.length;o=0)return n}else{var r=Px.toSetString(e);if(Ox.call(this._set,r))return this._set[r]}throw new Error('"'+e+'" is not in the set.')};Qo.prototype.at=function(e){if(e>=0&&e{var RO=Tl();function YU(t,e){var n=t.generatedLine,r=e.generatedLine,o=t.generatedColumn,i=e.generatedColumn;return r>n||r==n&&i>=o||RO.compareByGeneratedPositionsInflated(t,e)<=0}function cm(){this._array=[],this._sorted=!0,this._last={generatedLine:-1,generatedColumn:0}}cm.prototype.unsortedForEach=function(e,n){this._array.forEach(e,n)};cm.prototype.add=function(e){YU(this._last,e)?(this._last=e,this._array.push(e)):(this._sorted=!1,this._array.push(e))};cm.prototype.toArray=function(){return this._sorted||(this._array.sort(RO.compareByGeneratedPositionsInflated),this._sorted=!0),this._array};CO.MappingList=cm});var Mx=Be(PO=>{var tf=Cx(),Nt=Tl(),fm=Nx().ArraySet,XU=TO().MappingList;function Tr(t){t||(t={}),this._file=Nt.getArg(t,"file",null),this._sourceRoot=Nt.getArg(t,"sourceRoot",null),this._skipValidation=Nt.getArg(t,"skipValidation",!1),this._sources=new fm,this._names=new fm,this._mappings=new XU,this._sourcesContents=null}Tr.prototype._version=3;Tr.fromSourceMap=function(e){var n=e.sourceRoot,r=new Tr({file:e.file,sourceRoot:n});return e.eachMapping(function(o){var i={generated:{line:o.generatedLine,column:o.generatedColumn}};o.source!=null&&(i.source=o.source,n!=null&&(i.source=Nt.relative(n,i.source)),i.original={line:o.originalLine,column:o.originalColumn},o.name!=null&&(i.name=o.name)),r.addMapping(i)}),e.sources.forEach(function(o){var i=o;n!==null&&(i=Nt.relative(n,o)),r._sources.has(i)||r._sources.add(i);var s=e.sourceContentFor(o);s!=null&&r.setSourceContent(o,s)}),r};Tr.prototype.addMapping=function(e){var n=Nt.getArg(e,"generated"),r=Nt.getArg(e,"original",null),o=Nt.getArg(e,"source",null),i=Nt.getArg(e,"name",null);this._skipValidation||this._validateMapping(n,r,o,i),o!=null&&(o=String(o),this._sources.has(o)||this._sources.add(o)),i!=null&&(i=String(i),this._names.has(i)||this._names.add(i)),this._mappings.add({generatedLine:n.line,generatedColumn:n.column,originalLine:r!=null&&r.line,originalColumn:r!=null&&r.column,source:o,name:i})};Tr.prototype.setSourceContent=function(e,n){var r=e;this._sourceRoot!=null&&(r=Nt.relative(this._sourceRoot,r)),n!=null?(this._sourcesContents||(this._sourcesContents=Object.create(null)),this._sourcesContents[Nt.toSetString(r)]=n):this._sourcesContents&&(delete this._sourcesContents[Nt.toSetString(r)],Object.keys(this._sourcesContents).length===0&&(this._sourcesContents=null))};Tr.prototype.applySourceMap=function(e,n,r){var o=n;if(n==null){if(e.file==null)throw new Error(`SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, or the source map's "file" property. Both were omitted.`);o=e.file}var i=this._sourceRoot;i!=null&&(o=Nt.relative(i,o));var s=new fm,a=new fm;this._mappings.unsortedForEach(function(l){if(l.source===o&&l.originalLine!=null){var u=e.originalPositionFor({line:l.originalLine,column:l.originalColumn});u.source!=null&&(l.source=u.source,r!=null&&(l.source=Nt.join(r,l.source)),i!=null&&(l.source=Nt.relative(i,l.source)),l.originalLine=u.line,l.originalColumn=u.column,u.name!=null&&(l.name=u.name))}var c=l.source;c!=null&&!s.has(c)&&s.add(c);var f=l.name;f!=null&&!a.has(f)&&a.add(f)},this),this._sources=s,this._names=a,e.sources.forEach(function(l){var u=e.sourceContentFor(l);u!=null&&(r!=null&&(l=Nt.join(r,l)),i!=null&&(l=Nt.relative(i,l)),this.setSourceContent(l,u))},this)};Tr.prototype._validateMapping=function(e,n,r,o){if(n&&typeof n.line!="number"&&typeof n.column!="number")throw new Error("original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.");if(!(e&&"line"in e&&"column"in e&&e.line>0&&e.column>=0&&!n&&!r&&!o)){if(e&&"line"in e&&"column"in e&&n&&"line"in n&&"column"in n&&e.line>0&&e.column>=0&&n.line>0&&n.column>=0&&r)return;throw new Error("Invalid mapping: "+JSON.stringify({generated:e,source:r,original:n,name:o}))}};Tr.prototype._serializeMappings=function(){for(var e=0,n=1,r=0,o=0,i=0,s=0,a="",l,u,c,f,d=this._mappings.toArray(),p=0,m=d.length;p0){if(!Nt.compareByGeneratedPositionsInflated(u,d[p-1]))continue;l+=","}l+=tf.encode(u.generatedColumn-e),e=u.generatedColumn,u.source!=null&&(f=this._sources.indexOf(u.source),l+=tf.encode(f-s),s=f,l+=tf.encode(u.originalLine-1-o),o=u.originalLine-1,l+=tf.encode(u.originalColumn-r),r=u.originalColumn,u.name!=null&&(c=this._names.indexOf(u.name),l+=tf.encode(c-i),i=c)),a+=l}return a};Tr.prototype._generateSourcesContent=function(e,n){return e.map(function(r){if(!this._sourcesContents)return null;n!=null&&(r=Nt.relative(n,r));var o=Nt.toSetString(r);return Object.prototype.hasOwnProperty.call(this._sourcesContents,o)?this._sourcesContents[o]:null},this)};Tr.prototype.toJSON=function(){var e={version:this._version,sources:this._sources.toArray(),names:this._names.toArray(),mappings:this._serializeMappings()};return this._file!=null&&(e.file=this._file),this._sourceRoot!=null&&(e.sourceRoot=this._sourceRoot),this._sourcesContents&&(e.sourcesContent=this._generateSourcesContent(e.sources,e.sourceRoot)),e};Tr.prototype.toString=function(){return JSON.stringify(this.toJSON())};PO.SourceMapGenerator=Tr});var OO=Be(Hs=>{Hs.GREATEST_LOWER_BOUND=1;Hs.LEAST_UPPER_BOUND=2;function Ix(t,e,n,r,o,i){var s=Math.floor((e-t)/2)+t,a=o(n,r[s],!0);return a===0?s:a>0?e-s>1?Ix(s,e,n,r,o,i):i==Hs.LEAST_UPPER_BOUND?e1?Ix(t,s,n,r,o,i):i==Hs.LEAST_UPPER_BOUND?s:t<0?-1:t}Hs.search=function(e,n,r,o){if(n.length===0)return-1;var i=Ix(-1,n.length,e,n,r,o||Hs.GREATEST_LOWER_BOUND);if(i<0)return-1;for(;i-1>=0&&r(n[i],n[i-1],!0)===0;)--i;return i}});var MO=Be(NO=>{function Ax(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function QU(t,e){return Math.round(t+Math.random()*(e-t))}function Lx(t,e,n,r){if(n{var se=Tl(),Dx=OO(),Pl=Nx().ArraySet,ZU=Cx(),nf=MO().quickSort;function nt(t,e){var n=t;return typeof t=="string"&&(n=se.parseSourceMapInput(t)),n.sections!=null?new eo(n,e):new rn(n,e)}nt.fromSourceMap=function(t,e){return rn.fromSourceMap(t,e)};nt.prototype._version=3;nt.prototype.__generatedMappings=null;Object.defineProperty(nt.prototype,"_generatedMappings",{configurable:!0,enumerable:!0,get:function(){return this.__generatedMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__generatedMappings}});nt.prototype.__originalMappings=null;Object.defineProperty(nt.prototype,"_originalMappings",{configurable:!0,enumerable:!0,get:function(){return this.__originalMappings||this._parseMappings(this._mappings,this.sourceRoot),this.__originalMappings}});nt.prototype._charIsMappingSeparator=function(e,n){var r=e.charAt(n);return r===";"||r===","};nt.prototype._parseMappings=function(e,n){throw new Error("Subclasses must implement _parseMappings")};nt.GENERATED_ORDER=1;nt.ORIGINAL_ORDER=2;nt.GREATEST_LOWER_BOUND=1;nt.LEAST_UPPER_BOUND=2;nt.prototype.eachMapping=function(e,n,r){var o=n||null,i=r||nt.GENERATED_ORDER,s;switch(i){case nt.GENERATED_ORDER:s=this._generatedMappings;break;case nt.ORIGINAL_ORDER:s=this._originalMappings;break;default:throw new Error("Unknown order of iteration.")}var a=this.sourceRoot;s.map(function(l){var u=l.source===null?null:this._sources.at(l.source);return u=se.computeSourceURL(a,u,this._sourceMapURL),{source:u,generatedLine:l.generatedLine,generatedColumn:l.generatedColumn,originalLine:l.originalLine,originalColumn:l.originalColumn,name:l.name===null?null:this._names.at(l.name)}},this).forEach(e,o)};nt.prototype.allGeneratedPositionsFor=function(e){var n=se.getArg(e,"line"),r={source:se.getArg(e,"source"),originalLine:n,originalColumn:se.getArg(e,"column",0)};if(r.source=this._findSourceIndex(r.source),r.source<0)return[];var o=[],i=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",se.compareByOriginalPositions,Dx.LEAST_UPPER_BOUND);if(i>=0){var s=this._originalMappings[i];if(e.column===void 0)for(var a=s.originalLine;s&&s.originalLine===a;)o.push({line:se.getArg(s,"generatedLine",null),column:se.getArg(s,"generatedColumn",null),lastColumn:se.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i];else for(var l=s.originalColumn;s&&s.originalLine===n&&s.originalColumn==l;)o.push({line:se.getArg(s,"generatedLine",null),column:se.getArg(s,"generatedColumn",null),lastColumn:se.getArg(s,"lastGeneratedColumn",null)}),s=this._originalMappings[++i]}return o};dm.SourceMapConsumer=nt;function rn(t,e){var n=t;typeof t=="string"&&(n=se.parseSourceMapInput(t));var r=se.getArg(n,"version"),o=se.getArg(n,"sources"),i=se.getArg(n,"names",[]),s=se.getArg(n,"sourceRoot",null),a=se.getArg(n,"sourcesContent",null),l=se.getArg(n,"mappings"),u=se.getArg(n,"file",null);if(r!=this._version)throw new Error("Unsupported version: "+r);s&&(s=se.normalize(s)),o=o.map(String).map(se.normalize).map(function(c){return s&&se.isAbsolute(s)&&se.isAbsolute(c)?se.relative(s,c):c}),this._names=Pl.fromArray(i.map(String),!0),this._sources=Pl.fromArray(o,!0),this._absoluteSources=this._sources.toArray().map(function(c){return se.computeSourceURL(s,c,e)}),this.sourceRoot=s,this.sourcesContent=a,this._mappings=l,this._sourceMapURL=e,this.file=u}rn.prototype=Object.create(nt.prototype);rn.prototype.consumer=nt;rn.prototype._findSourceIndex=function(t){var e=t;if(this.sourceRoot!=null&&(e=se.relative(this.sourceRoot,e)),this._sources.has(e))return this._sources.indexOf(e);var n;for(n=0;n1&&(y.source=a+g[1],a+=g[1],y.originalLine=i+g[2],i=y.originalLine,y.originalLine+=1,y.originalColumn=s+g[3],s=y.originalColumn,g.length>4&&(y.name=l+g[4],l+=g[4])),m.push(y),typeof y.originalLine=="number"&&p.push(y)}nf(m,se.compareByGeneratedPositionsDeflated),this.__generatedMappings=m,nf(p,se.compareByOriginalPositions),this.__originalMappings=p};rn.prototype._findMapping=function(e,n,r,o,i,s){if(e[r]<=0)throw new TypeError("Line must be greater than or equal to 1, got "+e[r]);if(e[o]<0)throw new TypeError("Column must be greater than or equal to 0, got "+e[o]);return Dx.search(e,n,i,s)};rn.prototype.computeColumnSpans=function(){for(var e=0;e=0){var o=this._generatedMappings[r];if(o.generatedLine===n.generatedLine){var i=se.getArg(o,"source",null);i!==null&&(i=this._sources.at(i),i=se.computeSourceURL(this.sourceRoot,i,this._sourceMapURL));var s=se.getArg(o,"name",null);return s!==null&&(s=this._names.at(s)),{source:i,line:se.getArg(o,"originalLine",null),column:se.getArg(o,"originalColumn",null),name:s}}}return{source:null,line:null,column:null,name:null}};rn.prototype.hasContentsOfAllSources=function(){return this.sourcesContent?this.sourcesContent.length>=this._sources.size()&&!this.sourcesContent.some(function(e){return e==null}):!1};rn.prototype.sourceContentFor=function(e,n){if(!this.sourcesContent)return null;var r=this._findSourceIndex(e);if(r>=0)return this.sourcesContent[r];var o=e;this.sourceRoot!=null&&(o=se.relative(this.sourceRoot,o));var i;if(this.sourceRoot!=null&&(i=se.urlParse(this.sourceRoot))){var s=o.replace(/^file:\/\//,"");if(i.scheme=="file"&&this._sources.has(s))return this.sourcesContent[this._sources.indexOf(s)];if((!i.path||i.path=="/")&&this._sources.has("/"+o))return this.sourcesContent[this._sources.indexOf("/"+o)]}if(n)return null;throw new Error('"'+o+'" is not in the SourceMap.')};rn.prototype.generatedPositionFor=function(e){var n=se.getArg(e,"source");if(n=this._findSourceIndex(n),n<0)return{line:null,column:null,lastColumn:null};var r={source:n,originalLine:se.getArg(e,"line"),originalColumn:se.getArg(e,"column")},o=this._findMapping(r,this._originalMappings,"originalLine","originalColumn",se.compareByOriginalPositions,se.getArg(e,"bias",nt.GREATEST_LOWER_BOUND));if(o>=0){var i=this._originalMappings[o];if(i.source===r.source)return{line:se.getArg(i,"generatedLine",null),column:se.getArg(i,"generatedColumn",null),lastColumn:se.getArg(i,"lastGeneratedColumn",null)}}return{line:null,column:null,lastColumn:null}};dm.BasicSourceMapConsumer=rn;function eo(t,e){var n=t;typeof t=="string"&&(n=se.parseSourceMapInput(t));var r=se.getArg(n,"version"),o=se.getArg(n,"sections");if(r!=this._version)throw new Error("Unsupported version: "+r);this._sources=new Pl,this._names=new Pl;var i={line:-1,column:0};this._sections=o.map(function(s){if(s.url)throw new Error("Support for url field in sections not implemented.");var a=se.getArg(s,"offset"),l=se.getArg(a,"line"),u=se.getArg(a,"column");if(l{var e_=Mx().SourceMapGenerator,pm=Tl(),t_=/(\r?\n)/,n_=10,Ol="$$$isSourceNode$$$";function sr(t,e,n,r,o){this.children=[],this.sourceContents={},this.line=t??null,this.column=e??null,this.source=n??null,this.name=o??null,this[Ol]=!0,r!=null&&this.add(r)}sr.fromStringWithSourceMap=function(e,n,r){var o=new sr,i=e.split(t_),s=0,a=function(){var d=m(),p=m()||"";return d+p;function m(){return s=0;n--)this.prepend(e[n]);else if(e[Ol]||typeof e=="string")this.children.unshift(e);else throw new TypeError("Expected a SourceNode, string, or an array of SourceNodes and strings. Got "+e);return this};sr.prototype.walk=function(e){for(var n,r=0,o=this.children.length;r0){for(n=[],r=0;r{mm.SourceMapGenerator=Mx().SourceMapGenerator;mm.SourceMapConsumer=AO().SourceMapConsumer;mm.SourceNode=DO().SourceNode});var HO={};zd(HO,{basename:()=>qO,default:()=>o_,delimiter:()=>zO,dirname:()=>VO,extname:()=>jO,isAbsolute:()=>Jx,join:()=>JO,normalize:()=>Bx,relative:()=>UO,resolve:()=>hm,sep:()=>_O});function BO(t,e){for(var n=0,r=t.length-1;r>=0;r--){var o=t[r];o==="."?t.splice(r,1):o===".."?(t.splice(r,1),n++):n&&(t.splice(r,1),n--)}if(e)for(;n--;n)t.unshift("..");return t}function hm(){for(var t="",e=!1,n=arguments.length-1;n>=-1&&!e;n--){var r=n>=0?arguments[n]:"/";if(typeof r!="string")throw new TypeError("Arguments to path.resolve must be strings");if(!r)continue;t=r+"/"+t,e=r.charAt(0)==="/"}return t=BO(Ux(t.split("/"),function(o){return!!o}),!e).join("/"),(e?"/":"")+t||"."}function Bx(t){var e=Jx(t),n=i_(t,-1)==="/";return t=BO(Ux(t.split("/"),function(r){return!!r}),!e).join("/"),!t&&!e&&(t="."),t&&n&&(t+="/"),(e?"/":"")+t}function Jx(t){return t.charAt(0)==="/"}function JO(){var t=Array.prototype.slice.call(arguments,0);return Bx(Ux(t,function(e,n){if(typeof e!="string")throw new TypeError("Arguments to path.join must be strings");return e}).join("/"))}function UO(t,e){t=hm(t).substr(1),e=hm(e).substr(1);function n(u){for(var c=0;c=0&&u[f]==="";f--);return c>f?[]:u.slice(c,f-c+1)}for(var r=n(t.split("/")),o=n(e.split("/")),i=Math.min(r.length,o.length),s=i,a=0;a{r_=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/,Fx=function(t){return r_.exec(t).slice(1)};_O="/",zO=":";o_={extname:jO,basename:qO,dirname:VO,sep:_O,delimiter:zO,relative:UO,join:JO,isAbsolute:Jx,normalize:Bx,resolve:hm};i_="ab".substr(-1)==="b"?function(t,e,n){return t.substr(e,n)}:function(t,e,n){return e<0&&(e=t.length+e),t.substr(e,n)}});var WO=Be((eG,gm)=>{var $s=($O(),IR(HO));if($s&&$s.default){gm.exports=$s.default;for(let t in $s)gm.exports[t]=$s[t]}else $s&&(gm.exports=$s)});var GO={};zd(GO,{default:()=>s_});var s_,KO=NR(()=>{s_={}});var YO=Be((tG,ym)=>{var Ws=(KO(),IR(GO));if(Ws&&Ws.default){ym.exports=Ws.default;for(let t in Ws)ym.exports[t]=Ws[t]}else Ws&&(ym.exports=Ws)});var QO=Be((nG,XO)=>{var a_=Object.prototype.toString,_x=typeof Buffer<"u"&&typeof Buffer.alloc=="function"&&typeof Buffer.allocUnsafe=="function"&&typeof Buffer.from=="function";function l_(t){return a_.call(t).slice(8,-1)==="ArrayBuffer"}function u_(t,e,n){e>>>=0;var r=t.byteLength-e;if(r<0)throw new RangeError("'offset' is out of bounds");if(n===void 0)n=r;else if(n>>>=0,n>r)throw new RangeError("'length' is out of bounds");return _x?Buffer.from(t.slice(e,e+n)):new Buffer(new Uint8Array(t.slice(e,e+n)))}function c_(t,e){if((typeof e!="string"||e==="")&&(e="utf8"),!Buffer.isEncoding(e))throw new TypeError('"encoding" must be a valid string encoding');return _x?Buffer.from(t,e):new Buffer(t,e)}function f_(t,e,n){if(typeof t=="number")throw new TypeError('"value" argument must not be a number');return l_(t)?u_(t,e,n):typeof t=="string"?c_(t,e):_x?Buffer.from(t):new Buffer(t)}XO.exports=f_});var sN=Be((Ks,jx)=>{var d_=FO().SourceMapConsumer,zx=WO(),vo;try{vo=YO(),(!vo.existsSync||!vo.readFileSync)&&(vo=null)}catch{}var p_=QO();function ZO(t,e){return t.require(e)}var eN=!1,tN=!1,Vx=!1,rf="auto",Gs={},of={},m_=/^data:application\/json[^,]+base64,/,Wi=[],Gi=[];function Hx(){return rf==="browser"?!0:rf==="node"?!1:typeof window<"u"&&typeof XMLHttpRequest=="function"&&!(window.require&&window.module&&window.process&&window.process.type==="renderer")}function h_(){return typeof process=="object"&&process!==null&&typeof process.on=="function"}function g_(){return typeof process=="object"&&process!==null?process.version:""}function y_(){if(typeof process=="object"&&process!==null)return process.stderr}function v_(t){if(typeof process=="object"&&process!==null&&typeof process.exit=="function")return process.exit(t)}function vm(t){return function(e){for(var n=0;n";var n=this.getLineNumber();if(n!=null){e+=":"+n;var r=this.getColumnNumber();r&&(e+=":"+r)}}var o="",i=this.getFunctionName(),s=!0,a=this.isConstructor(),l=!(this.isToplevel()||a);if(l){var u=this.getTypeName();u==="[object Object]"&&(u="null");var c=this.getMethodName();i?(u&&i.indexOf(u)!=0&&(o+=u+"."),o+=i,c&&i.indexOf("."+c)!=i.length-c.length-1&&(o+=" [as "+c+"]")):o+=u+"."+(c||"")}else a?o+="new "+(i||""):i?o+=i:(o+=e,s=!1);return s&&(o+=" ("+e+")"),o}function nN(t){var e={};return Object.getOwnPropertyNames(Object.getPrototypeOf(t)).forEach(function(n){e[n]=/^(?:is|get)/.test(n)?function(){return t[n].call(t)}:t[n]}),e.toString=x_,e}function oN(t,e){if(e===void 0&&(e={nextPosition:null,curPosition:null}),t.isNative())return e.curPosition=null,t;var n=t.getFileName()||t.getScriptNameOrSourceURL();if(n){var r=t.getLineNumber(),o=t.getColumnNumber()-1,i=/^v(10\.1[6-9]|10\.[2-9][0-9]|10\.[0-9]{3,}|1[2-9]\d*|[2-9]\d|\d{3,}|11\.11)/,s=i.test(g_())?0:62;r===1&&o>s&&!Hx()&&!t.isEval()&&(o-=s);var a=Gx({source:n,line:r,column:o});e.curPosition=a,t=nN(t);var l=t.getFunctionName;return t.getFunctionName=function(){return e.nextPosition==null?l():e.nextPosition.name||l()},t.getFileName=function(){return a.source},t.getLineNumber=function(){return a.line},t.getColumnNumber=function(){return a.column+1},t.getScriptNameOrSourceURL=function(){return a.source},t}var u=t.isEval()&&t.getEvalOrigin();return u&&(u=rN(u),t=nN(t),t.getEvalOrigin=function(){return u}),t}function S_(t,e){Vx&&(Gs={},of={});for(var n=t.name||"Error",r=t.message||"",o=n+": "+r,i={nextPosition:null,curPosition:null},s=[],a=e.length-1;a>=0;a--)s.push(` + at `+oN(e[a],i)),i.nextPosition=i.curPosition;return i.curPosition=i.nextPosition=null,o+s.reverse().join("")}function iN(t){var e=/\n at [^(]+ \((.*):(\d+):(\d+)\)/.exec(t.stack);if(e){var n=e[1],r=+e[2],o=+e[3],i=Gs[n];if(!i&&vo&&vo.existsSync(n))try{i=vo.readFileSync(n,"utf8")}catch{i=""}if(i){var s=i.split(/(?:\r\n|\r|\n)/)[r-1];if(s)return n+":"+r+` `+s+` -`+new Array(o).join(" ")+"^"}}return null}function y_(t){var e=tN(t),n=d_();n&&n._handle&&n._handle.setBlocking&&n._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),p_(1)}function v_(){var t=process.emit;process.emit=function(e){if(e==="uncaughtException"){var n=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(n&&!r)return y_(arguments[1])}return t.apply(this,arguments)}}var w_=$i.slice(0),x_=Wi.slice(0);Ws.wrapCallSite=eN;Ws.getErrorSource=tN;Ws.mapSourcePosition=Hx;Ws.retrieveSourceMap=jx;Ws.install=function(t){if(t=t||{},t.environment&&(tf=t.environment,["node","browser","auto"].indexOf(tf)===-1))throw new Error("environment "+tf+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&($i.length=0),$i.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(Wi.length=0),Wi.unshift(t.retrieveSourceMap)),t.hookRequire&&!Vx()){var e=KO(zx,"module"),n=e.prototype._compile;n.__sourceMapSupport||(e.prototype._compile=function(i,s){return $s[s]=i,nf[s]=void 0,n.call(this,i,s)},e.prototype._compile.__sourceMapSupport=!0)}if(Ux||(Ux="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),YO||(YO=!0,Error.prepareStackTrace=g_),!XO){var r="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var o=KO(zx,"worker_threads");o.isMainThread===!1&&(r=!1)}catch{}r&&c_()&&(XO=!0,v_())}};Ws.resetRetrieveHandlers=function(){$i.length=0,Wi.length=0,$i=w_.slice(0),Wi=x_.slice(0),jx=hm(Wi),qx=hm($i)}});var RN=Be(Pm=>{"use strict";var G4=ge(),K4=Symbol.for("react.element"),Y4=Symbol.for("react.fragment"),X4=Object.prototype.hasOwnProperty,Q4=G4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Z4={key:!0,ref:!0,__self:!0,__source:!0};function EN(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)X4.call(e,r)&&!Z4.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:K4,type:t,key:i,ref:s,props:o,_owner:Q4.current}}Pm.Fragment=Y4;Pm.jsx=EN;Pm.jsxs=EN});var ye=Be((t7,CN)=>{"use strict";CN.exports=RN()});var eE=Be((Oie,$D)=>{$D.exports=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}});var aF=Be((Xie,sF)=>{"use strict";var Zy=Object.prototype.hasOwnProperty,iF=Object.prototype.toString,ZD=Object.defineProperty,eF=Object.getOwnPropertyDescriptor,tF=function(e){return typeof Array.isArray=="function"?Array.isArray(e):iF.call(e)==="[object Array]"},nF=function(e){if(!e||iF.call(e)!=="[object Object]")return!1;var n=Zy.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&Zy.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var o;for(o in e);return typeof o>"u"||Zy.call(e,o)},rF=function(e,n){ZD&&n.name==="__proto__"?ZD(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},oF=function(e,n){if(n==="__proto__")if(Zy.call(e,n)){if(eF)return eF(e,n).value}else return;return e[n]};sF.exports=function t(){var e,n,r,o,i,s,a=arguments[0],l=1,u=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l{"use strict";var n$="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";C2.exports=n$});var M2=Be((gfe,N2)=>{"use strict";var r$=T2();function P2(){}function O2(){}O2.resetWarningCache=P2;N2.exports=function(){function t(r,o,i,s,a,l){if(l!==r$){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:O2,resetWarningCache:P2};return n.PropTypes=n,n}});var A2=Be((wfe,I2)=>{I2.exports=M2()();var yfe,vfe});var z2=Be(je=>{"use strict";var qE=Symbol.for("react.element"),jE=Symbol.for("react.portal"),kv=Symbol.for("react.fragment"),bv=Symbol.for("react.strict_mode"),Ev=Symbol.for("react.profiler"),Rv=Symbol.for("react.provider"),Cv=Symbol.for("react.context"),c$=Symbol.for("react.server_context"),Tv=Symbol.for("react.forward_ref"),Pv=Symbol.for("react.suspense"),Ov=Symbol.for("react.suspense_list"),Nv=Symbol.for("react.memo"),Mv=Symbol.for("react.lazy"),f$=Symbol.for("react.offscreen"),_2;_2=Symbol.for("react.module.reference");function _r(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case qE:switch(t=t.type,t){case kv:case Ev:case bv:case Pv:case Ov:return t;default:switch(t=t&&t.$$typeof,t){case c$:case Cv:case Tv:case Mv:case Nv:case Rv:return t;default:return e}}case jE:return e}}}je.ContextConsumer=Cv;je.ContextProvider=Rv;je.Element=qE;je.ForwardRef=Tv;je.Fragment=kv;je.Lazy=Mv;je.Memo=Nv;je.Portal=jE;je.Profiler=Ev;je.StrictMode=bv;je.Suspense=Pv;je.SuspenseList=Ov;je.isAsyncMode=function(){return!1};je.isConcurrentMode=function(){return!1};je.isContextConsumer=function(t){return _r(t)===Cv};je.isContextProvider=function(t){return _r(t)===Rv};je.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===qE};je.isForwardRef=function(t){return _r(t)===Tv};je.isFragment=function(t){return _r(t)===kv};je.isLazy=function(t){return _r(t)===Mv};je.isMemo=function(t){return _r(t)===Nv};je.isPortal=function(t){return _r(t)===jE};je.isProfiler=function(t){return _r(t)===Ev};je.isStrictMode=function(t){return _r(t)===bv};je.isSuspense=function(t){return _r(t)===Pv};je.isSuspenseList=function(t){return _r(t)===Ov};je.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===kv||t===Ev||t===bv||t===Pv||t===Ov||t===f$||typeof t=="object"&&t!==null&&(t.$$typeof===Mv||t.$$typeof===Nv||t.$$typeof===Rv||t.$$typeof===Cv||t.$$typeof===Tv||t.$$typeof===_2||t.getModuleId!==void 0)};je.typeOf=_r});var q2=Be((gde,V2)=>{"use strict";V2.exports=z2()});var Q2=Be((xde,X2)=>{var W2=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,d$=/\n/g,p$=/^\s*/,m$=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,h$=/^:\s*/,g$=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,y$=/^[;\s]*/,v$=/^\s+|\s+$/g,w$=` -`,G2="/",K2="*",Ja="",x$="comment",S$="declaration";X2.exports=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function o(y){var w=y.match(d$);w&&(n+=w.length);var g=y.lastIndexOf(w$);r=~g?y.length-g:r+y.length}function i(){var y={line:n,column:r};return function(w){return w.position=new s(y),c(),w}}function s(y){this.start=y,this.end={line:n,column:r},this.source=e.source}s.prototype.content=t;var a=[];function l(y){var w=new Error(e.source+":"+n+":"+r+": "+y);if(w.reason=y,w.filename=e.source,w.line=n,w.column=r,w.source=t,e.silent)a.push(w);else throw w}function u(y){var w=y.exec(t);if(w){var g=w[0];return o(g),t=t.slice(g.length),w}}function c(){u(p$)}function f(y){var w;for(y=y||[];w=d();)w!==!1&&y.push(w);return y}function d(){var y=i();if(!(G2!=t.charAt(0)||K2!=t.charAt(1))){for(var w=2;Ja!=t.charAt(w)&&(K2!=t.charAt(w)||G2!=t.charAt(w+1));)++w;if(w+=2,Ja===t.charAt(w-1))return l("End of comment missing");var g=t.slice(2,w-2);return r+=2,o(g),t=t.slice(w),r+=2,y({type:x$,comment:g})}}function p(){var y=i(),w=u(m$);if(w){if(d(),!u(h$))return l("property missing ':'");var g=u(g$),v=y({type:S$,property:Y2(w[0].replace(W2,Ja)),value:g?Y2(g[0].replace(W2,Ja)):Ja});return u(y$),v}}function m(){var y=[];f(y);for(var w;w=p();)w!==!1&&(y.push(w),f(y));return y}return c(),m()};function Y2(t){return t?t.replace(v$,Ja):Ja}});var eB=Be((Sde,HE)=>{var k$=Q2();function Z2(t,e){var n=null;if(!t||typeof t!="string")return n;for(var r,o=k$(t),i=typeof e=="function",s,a,l=0,u=o.length;ltypeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||S_;var b_=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,E_=/\/\*[^]*?\*\/| +/g,rN=/\n+/g,Gi=(t,e)=>{let n="",r="",o="";for(let i in t){let s=t[i];i[0]=="@"?i[1]=="i"?n=i+" "+s+";":r+=i[1]=="f"?Gi(s,i):i+"{"+Gi(s,i[1]=="k"?"":e)+"}":typeof s=="object"?r+=Gi(s,e?e.replace(/([^,])+/g,a=>i.replace(/(^:.*)|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):i):s!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=Gi.p?Gi.p(i,s):i+":"+s+";")}return n+(e&&o?e+"{"+o+"}":o)+r},Qo={},oN=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+oN(t[n]);return e}return t},R_=(t,e,n,r,o)=>{let i=oN(t),s=Qo[i]||(Qo[i]=(l=>{let u=0,c=11;for(;u>>0;return"go"+c})(i));if(!Qo[s]){let l=i!==t?t:(u=>{let c,f,d=[{}];for(;c=b_.exec(u.replace(E_,""));)c[4]?d.shift():c[3]?(f=c[3].replace(rN," ").trim(),d.unshift(d[0][f]=d[0][f]||{})):d[0][c[1]]=c[2].replace(rN," ").trim();return d[0]})(t);Qo[s]=Gi(o?{["@keyframes "+s]:l}:l,n?"":"."+s)}let a=n&&Qo.g?Qo.g:null;return n&&(Qo.g=Qo[s]),((l,u,c,f)=>{f?u.data=u.data.replace(f,l):u.data.indexOf(l)===-1&&(u.data=c?l+u.data:u.data+l)})(Qo[s],e,r,a),s},C_=(t,e,n)=>t.reduce((r,o,i)=>{let s=e[i];if(s&&s.call){let a=s(n),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;s=l?"."+l:a&&typeof a=="object"?a.props?"":Gi(a,""):a===!1?"":a}return r+o+(s??"")},"");function rf(t){let e=this||{},n=t.call?t(e.p):t;return R_(n.unshift?n.raw?C_(n,[].slice.call(arguments,1),e.p):n.reduce((r,o)=>Object.assign(r,o&&o.call?o(e.p):o),{}):n,k_(e.target),e.g,e.o,e.k)}var iN,$x,Wx,XW=rf.bind({g:1}),Gn=rf.bind({k:1});function sN(t,e,n,r){Gi.p=e,iN=t,$x=n,Wx=r}function sr(t,e){let n=this||{};return function(){let r=arguments;function o(i,s){let a=Object.assign({},i),l=a.className||o.className;n.p=Object.assign({theme:$x&&$x()},a),n.o=/ *go\d+/.test(l),a.className=rf.apply(n,r)+(l?" "+l:""),e&&(a.ref=s);let u=t;return t[0]&&(u=a.as||t,delete a.as),Wx&&u[0]&&Wx(a),iN(u,a)}return e?e(o):o}}var Gs=q(ge(),1);var Ki=q(ge(),1),T_=t=>typeof t=="function",xm=(t,e)=>T_(t)?t(e):t,P_=(()=>{let t=0;return()=>(++t).toString()})(),lN=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),O_=20,ym=new Map,N_=1e3,aN=t=>{if(ym.has(t))return;let e=setTimeout(()=>{ym.delete(t),Ks({type:4,toastId:t})},N_);ym.set(t,e)},M_=t=>{let e=ym.get(t);e&&clearTimeout(e)},Gx=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,O_)};case 1:return e.toast.id&&M_(e.toast.id),{...t,toasts:t.toasts.map(i=>i.id===e.toast.id?{...i,...e.toast}:i)};case 2:let{toast:n}=e;return t.toasts.find(i=>i.id===n.id)?Gx(t,{type:1,toast:n}):Gx(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?aN(r):t.toasts.forEach(i=>{aN(i.id)}),{...t,toasts:t.toasts.map(i=>i.id===r||r===void 0?{...i,visible:!1}:i)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(i=>i.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let o=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+o}))}}},vm=[],wm={toasts:[],pausedAt:void 0},Ks=t=>{wm=Gx(wm,t),vm.forEach(e=>{e(wm)})},I_={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},A_=(t={})=>{let[e,n]=(0,Sm.useState)(wm);(0,Sm.useEffect)(()=>(vm.push(n),()=>{let o=vm.indexOf(n);o>-1&&vm.splice(o,1)}),[e]);let r=e.toasts.map(o=>{var i,s;return{...t,...t[o.type],...o,duration:o.duration||((i=t[o.type])==null?void 0:i.duration)||t?.duration||I_[o.type],style:{...t.style,...(s=t[o.type])==null?void 0:s.style,...o.style}}});return{...e,toasts:r}},L_=(t,e="blank",n)=>({createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...n,id:n?.id||P_()}),sf=t=>(e,n)=>{let r=L_(e,t,n);return Ks({type:2,toast:r}),r.id},ar=(t,e)=>sf("blank")(t,e);ar.error=sf("error");ar.success=sf("success");ar.loading=sf("loading");ar.custom=sf("custom");ar.dismiss=t=>{Ks({type:3,toastId:t})};ar.remove=t=>Ks({type:4,toastId:t});ar.promise=(t,e,n)=>{let r=ar.loading(e.loading,{...n,...n?.loading});return t.then(o=>(ar.success(xm(e.success,o),{id:r,...n,...n?.success}),o)).catch(o=>{ar.error(xm(e.error,o),{id:r,...n,...n?.error})}),t};var D_=(t,e)=>{Ks({type:1,toast:{id:t,height:e}})},F_=()=>{Ks({type:5,time:Date.now()})},B_=t=>{let{toasts:e,pausedAt:n}=A_(t);(0,of.useEffect)(()=>{if(n)return;let i=Date.now(),s=e.map(a=>{if(a.duration===1/0)return;let l=(a.duration||0)+a.pauseDuration-(i-a.createdAt);if(l<0){a.visible&&ar.dismiss(a.id);return}return setTimeout(()=>ar.dismiss(a.id),l)});return()=>{s.forEach(a=>a&&clearTimeout(a))}},[e,n]);let r=(0,of.useCallback)(()=>{n&&Ks({type:6,time:Date.now()})},[n]),o=(0,of.useCallback)((i,s)=>{let{reverseOrder:a=!1,gutter:l=8,defaultPosition:u}=s||{},c=e.filter(p=>(p.position||u)===(i.position||u)&&p.height),f=c.findIndex(p=>p.id===i.id),d=c.filter((p,m)=>mp.visible).slice(...a?[d+1]:[0,d]).reduce((p,m)=>p+(m.height||0)+l,0)},[e]);return{toasts:e,handlers:{updateHeight:D_,startPause:F_,endPause:r,calculateOffset:o}}},J_=Gn` +`+new Array(o).join(" ")+"^"}}return null}function k_(t){var e=iN(t),n=y_();n&&n._handle&&n._handle.setBlocking&&n._handle.setBlocking(!0),e&&(console.error(),console.error(e)),console.error(t.stack),v_(1)}function b_(){var t=process.emit;process.emit=function(e){if(e==="uncaughtException"){var n=arguments[1]&&arguments[1].stack,r=this.listeners(e).length>0;if(n&&!r)return k_(arguments[1])}return t.apply(this,arguments)}}var E_=Wi.slice(0),R_=Gi.slice(0);Ks.wrapCallSite=oN;Ks.getErrorSource=iN;Ks.mapSourcePosition=Gx;Ks.retrieveSourceMap=Wx;Ks.install=function(t){if(t=t||{},t.environment&&(rf=t.environment,["node","browser","auto"].indexOf(rf)===-1))throw new Error("environment "+rf+" was unknown. Available options are {auto, browser, node}");if(t.retrieveFile&&(t.overrideRetrieveFile&&(Wi.length=0),Wi.unshift(t.retrieveFile)),t.retrieveSourceMap&&(t.overrideRetrieveSourceMap&&(Gi.length=0),Gi.unshift(t.retrieveSourceMap)),t.hookRequire&&!Hx()){var e=ZO(jx,"module"),n=e.prototype._compile;n.__sourceMapSupport||(e.prototype._compile=function(i,s){return Gs[s]=i,of[s]=void 0,n.call(this,i,s)},e.prototype._compile.__sourceMapSupport=!0)}if(Vx||(Vx="emptyCacheBetweenOperations"in t?t.emptyCacheBetweenOperations:!1),eN||(eN=!0,Error.prepareStackTrace=S_),!tN){var r="handleUncaughtExceptions"in t?t.handleUncaughtExceptions:!0;try{var o=ZO(jx,"worker_threads");o.isMainThread===!1&&(r=!1)}catch{}r&&h_()&&(tN=!0,b_())}};Ks.resetRetrieveHandlers=function(){Wi.length=0,Gi.length=0,Wi=E_.slice(0),Gi=R_.slice(0),Wx=vm(Gi),$x=vm(Wi)}});var ON=Be(Mm=>{"use strict";var Z4=he(),ez=Symbol.for("react.element"),tz=Symbol.for("react.fragment"),nz=Object.prototype.hasOwnProperty,rz=Z4.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,oz={key:!0,ref:!0,__self:!0,__source:!0};function PN(t,e,n){var r,o={},i=null,s=null;n!==void 0&&(i=""+n),e.key!==void 0&&(i=""+e.key),e.ref!==void 0&&(s=e.ref);for(r in e)nz.call(e,r)&&!oz.hasOwnProperty(r)&&(o[r]=e[r]);if(t&&t.defaultProps)for(r in e=t.defaultProps,e)o[r]===void 0&&(o[r]=e[r]);return{$$typeof:ez,type:t,key:i,ref:s,props:o,_owner:rz.current}}Mm.Fragment=tz;Mm.jsx=PN;Mm.jsxs=PN});var me=Be((a7,NN)=>{"use strict";NN.exports=ON()});var rE=Be((Bie,XD)=>{XD.exports=function(e){return e!=null&&e.constructor!=null&&typeof e.constructor.isBuffer=="function"&&e.constructor.isBuffer(e)}});var dF=Be((ise,fF)=>{"use strict";var nv=Object.prototype.hasOwnProperty,cF=Object.prototype.toString,oF=Object.defineProperty,iF=Object.getOwnPropertyDescriptor,sF=function(e){return typeof Array.isArray=="function"?Array.isArray(e):cF.call(e)==="[object Array]"},aF=function(e){if(!e||cF.call(e)!=="[object Object]")return!1;var n=nv.call(e,"constructor"),r=e.constructor&&e.constructor.prototype&&nv.call(e.constructor.prototype,"isPrototypeOf");if(e.constructor&&!n&&!r)return!1;var o;for(o in e);return typeof o>"u"||nv.call(e,o)},lF=function(e,n){oF&&n.name==="__proto__"?oF(e,n.name,{enumerable:!0,configurable:!0,value:n.newValue,writable:!0}):e[n.name]=n.newValue},uF=function(e,n){if(n==="__proto__")if(nv.call(e,n)){if(iF)return iF(e,n).value}else return;return e[n]};fF.exports=function t(){var e,n,r,o,i,s,a=arguments[0],l=1,u=arguments.length,c=!1;for(typeof a=="boolean"&&(c=a,a=arguments[1]||{},l=2),(a==null||typeof a!="object"&&typeof a!="function")&&(a={});l{"use strict";var u$="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";M2.exports=u$});var F2=Be((Efe,D2)=>{"use strict";var c$=I2();function A2(){}function L2(){}L2.resetWarningCache=A2;D2.exports=function(){function t(r,o,i,s,a,l){if(l!==c$){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}t.isRequired=t;function e(){return t}var n={array:t,bigint:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:e,element:t,elementType:t,instanceOf:e,node:t,objectOf:e,oneOf:e,oneOfType:e,shape:e,exact:e,checkPropTypes:L2,resetWarningCache:A2};return n.PropTypes=n,n}});var J2=Be((Tfe,B2)=>{B2.exports=F2()();var Rfe,Cfe});var $2=Be(He=>{"use strict";var $E=Symbol.for("react.element"),WE=Symbol.for("react.portal"),Rv=Symbol.for("react.fragment"),Cv=Symbol.for("react.strict_mode"),Tv=Symbol.for("react.profiler"),Pv=Symbol.for("react.provider"),Ov=Symbol.for("react.context"),y$=Symbol.for("react.server_context"),Nv=Symbol.for("react.forward_ref"),Mv=Symbol.for("react.suspense"),Iv=Symbol.for("react.suspense_list"),Av=Symbol.for("react.memo"),Lv=Symbol.for("react.lazy"),v$=Symbol.for("react.offscreen"),H2;H2=Symbol.for("react.module.reference");function Vr(t){if(typeof t=="object"&&t!==null){var e=t.$$typeof;switch(e){case $E:switch(t=t.type,t){case Rv:case Tv:case Cv:case Mv:case Iv:return t;default:switch(t=t&&t.$$typeof,t){case y$:case Ov:case Nv:case Lv:case Av:case Pv:return t;default:return e}}case WE:return e}}}He.ContextConsumer=Ov;He.ContextProvider=Pv;He.Element=$E;He.ForwardRef=Nv;He.Fragment=Rv;He.Lazy=Lv;He.Memo=Av;He.Portal=WE;He.Profiler=Tv;He.StrictMode=Cv;He.Suspense=Mv;He.SuspenseList=Iv;He.isAsyncMode=function(){return!1};He.isConcurrentMode=function(){return!1};He.isContextConsumer=function(t){return Vr(t)===Ov};He.isContextProvider=function(t){return Vr(t)===Pv};He.isElement=function(t){return typeof t=="object"&&t!==null&&t.$$typeof===$E};He.isForwardRef=function(t){return Vr(t)===Nv};He.isFragment=function(t){return Vr(t)===Rv};He.isLazy=function(t){return Vr(t)===Lv};He.isMemo=function(t){return Vr(t)===Av};He.isPortal=function(t){return Vr(t)===WE};He.isProfiler=function(t){return Vr(t)===Tv};He.isStrictMode=function(t){return Vr(t)===Cv};He.isSuspense=function(t){return Vr(t)===Mv};He.isSuspenseList=function(t){return Vr(t)===Iv};He.isValidElementType=function(t){return typeof t=="string"||typeof t=="function"||t===Rv||t===Tv||t===Cv||t===Mv||t===Iv||t===v$||typeof t=="object"&&t!==null&&(t.$$typeof===Lv||t.$$typeof===Av||t.$$typeof===Pv||t.$$typeof===Ov||t.$$typeof===Nv||t.$$typeof===H2||t.getModuleId!==void 0)};He.typeOf=Vr});var G2=Be((Ede,W2)=>{"use strict";W2.exports=$2()});var rB=Be((Pde,nB)=>{var Q2=/\/\*[^*]*\*+([^/*][^*]*\*+)*\//g,w$=/\n/g,x$=/^\s*/,S$=/^(\*?[-#/*\\\w]+(\[[0-9a-z_-]+\])?)\s*/,k$=/^:\s*/,b$=/^((?:'(?:\\'|.)*?'|"(?:\\"|.)*?"|\([^)]*?\)|[^};])+)/,E$=/^[;\s]*/,R$=/^\s+|\s+$/g,C$=` +`,Z2="/",eB="*",za="",T$="comment",P$="declaration";nB.exports=function(t,e){if(typeof t!="string")throw new TypeError("First argument must be a string");if(!t)return[];e=e||{};var n=1,r=1;function o(y){var w=y.match(w$);w&&(n+=w.length);var g=y.lastIndexOf(C$);r=~g?y.length-g:r+y.length}function i(){var y={line:n,column:r};return function(w){return w.position=new s(y),c(),w}}function s(y){this.start=y,this.end={line:n,column:r},this.source=e.source}s.prototype.content=t;var a=[];function l(y){var w=new Error(e.source+":"+n+":"+r+": "+y);if(w.reason=y,w.filename=e.source,w.line=n,w.column=r,w.source=t,e.silent)a.push(w);else throw w}function u(y){var w=y.exec(t);if(w){var g=w[0];return o(g),t=t.slice(g.length),w}}function c(){u(x$)}function f(y){var w;for(y=y||[];w=d();)w!==!1&&y.push(w);return y}function d(){var y=i();if(!(Z2!=t.charAt(0)||eB!=t.charAt(1))){for(var w=2;za!=t.charAt(w)&&(eB!=t.charAt(w)||Z2!=t.charAt(w+1));)++w;if(w+=2,za===t.charAt(w-1))return l("End of comment missing");var g=t.slice(2,w-2);return r+=2,o(g),t=t.slice(w),r+=2,y({type:T$,comment:g})}}function p(){var y=i(),w=u(S$);if(w){if(d(),!u(k$))return l("property missing ':'");var g=u(b$),v=y({type:P$,property:tB(w[0].replace(Q2,za)),value:g?tB(g[0].replace(Q2,za)):za});return u(E$),v}}function m(){var y=[];f(y);for(var w;w=p();)w!==!1&&(y.push(w),f(y));return y}return c(),m()};function tB(t){return t?t.replace(R$,za):za}});var iB=Be((Ode,GE)=>{var O$=rB();function oB(t,e){var n=null;if(!t||typeof t!="string")return n;for(var r,o=O$(t),i=typeof e=="function",s,a,l=0,u=o.length;ltypeof window=="object"?((t?t.querySelector("#_goober"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement("style")),{innerHTML:" ",id:"_goober"})).firstChild:t||C_;var P_=/(?:([\u0080-\uFFFF\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\s*)/g,O_=/\/\*[^]*?\*\/| +/g,aN=/\n+/g,Ki=(t,e)=>{let n="",r="",o="";for(let i in t){let s=t[i];i[0]=="@"?i[1]=="i"?n=i+" "+s+";":r+=i[1]=="f"?Ki(s,i):i+"{"+Ki(s,i[1]=="k"?"":e)+"}":typeof s=="object"?r+=Ki(s,e?e.replace(/([^,])+/g,a=>i.replace(/(^:.*)|([^,])+/g,l=>/&/.test(l)?l.replace(/&/g,a):a?a+" "+l:l)):i):s!=null&&(i=/^--/.test(i)?i:i.replace(/[A-Z]/g,"-$&").toLowerCase(),o+=Ki.p?Ki.p(i,s):i+":"+s+";")}return n+(e&&o?e+"{"+o+"}":o)+r},Zo={},lN=t=>{if(typeof t=="object"){let e="";for(let n in t)e+=n+lN(t[n]);return e}return t},N_=(t,e,n,r,o)=>{let i=lN(t),s=Zo[i]||(Zo[i]=(l=>{let u=0,c=11;for(;u>>0;return"go"+c})(i));if(!Zo[s]){let l=i!==t?t:(u=>{let c,f,d=[{}];for(;c=P_.exec(u.replace(O_,""));)c[4]?d.shift():c[3]?(f=c[3].replace(aN," ").trim(),d.unshift(d[0][f]=d[0][f]||{})):d[0][c[1]]=c[2].replace(aN," ").trim();return d[0]})(t);Zo[s]=Ki(o?{["@keyframes "+s]:l}:l,n?"":"."+s)}let a=n&&Zo.g?Zo.g:null;return n&&(Zo.g=Zo[s]),((l,u,c,f)=>{f?u.data=u.data.replace(f,l):u.data.indexOf(l)===-1&&(u.data=c?l+u.data:u.data+l)})(Zo[s],e,r,a),s},M_=(t,e,n)=>t.reduce((r,o,i)=>{let s=e[i];if(s&&s.call){let a=s(n),l=a&&a.props&&a.props.className||/^go/.test(a)&&a;s=l?"."+l:a&&typeof a=="object"?a.props?"":Ki(a,""):a===!1?"":a}return r+o+(s??"")},"");function sf(t){let e=this||{},n=t.call?t(e.p):t;return N_(n.unshift?n.raw?M_(n,[].slice.call(arguments,1),e.p):n.reduce((r,o)=>Object.assign(r,o&&o.call?o(e.p):o),{}):n,T_(e.target),e.g,e.o,e.k)}var uN,Kx,Yx,rG=sf.bind({g:1}),Kn=sf.bind({k:1});function cN(t,e,n,r){Ki.p=e,uN=t,Kx=n,Yx=r}function ar(t,e){let n=this||{};return function(){let r=arguments;function o(i,s){let a=Object.assign({},i),l=a.className||o.className;n.p=Object.assign({theme:Kx&&Kx()},a),n.o=/ *go\d+/.test(l),a.className=sf.apply(n,r)+(l?" "+l:""),e&&(a.ref=s);let u=t;return t[0]&&(u=a.as||t,delete a.as),Yx&&u[0]&&Yx(a),uN(u,a)}return e?e(o):o}}var Ys=q(he(),1);var Yi=q(he(),1),I_=t=>typeof t=="function",bm=(t,e)=>I_(t)?t(e):t,A_=(()=>{let t=0;return()=>(++t).toString()})(),dN=(()=>{let t;return()=>{if(t===void 0&&typeof window<"u"){let e=matchMedia("(prefers-reduced-motion: reduce)");t=!e||e.matches}return t}})(),L_=20,xm=new Map,D_=1e3,fN=t=>{if(xm.has(t))return;let e=setTimeout(()=>{xm.delete(t),Xs({type:4,toastId:t})},D_);xm.set(t,e)},F_=t=>{let e=xm.get(t);e&&clearTimeout(e)},Xx=(t,e)=>{switch(e.type){case 0:return{...t,toasts:[e.toast,...t.toasts].slice(0,L_)};case 1:return e.toast.id&&F_(e.toast.id),{...t,toasts:t.toasts.map(i=>i.id===e.toast.id?{...i,...e.toast}:i)};case 2:let{toast:n}=e;return t.toasts.find(i=>i.id===n.id)?Xx(t,{type:1,toast:n}):Xx(t,{type:0,toast:n});case 3:let{toastId:r}=e;return r?fN(r):t.toasts.forEach(i=>{fN(i.id)}),{...t,toasts:t.toasts.map(i=>i.id===r||r===void 0?{...i,visible:!1}:i)};case 4:return e.toastId===void 0?{...t,toasts:[]}:{...t,toasts:t.toasts.filter(i=>i.id!==e.toastId)};case 5:return{...t,pausedAt:e.time};case 6:let o=e.time-(t.pausedAt||0);return{...t,pausedAt:void 0,toasts:t.toasts.map(i=>({...i,pauseDuration:i.pauseDuration+o}))}}},Sm=[],km={toasts:[],pausedAt:void 0},Xs=t=>{km=Xx(km,t),Sm.forEach(e=>{e(km)})},B_={blank:4e3,error:4e3,success:2e3,loading:1/0,custom:4e3},J_=(t={})=>{let[e,n]=(0,Em.useState)(km);(0,Em.useEffect)(()=>(Sm.push(n),()=>{let o=Sm.indexOf(n);o>-1&&Sm.splice(o,1)}),[e]);let r=e.toasts.map(o=>{var i,s;return{...t,...t[o.type],...o,duration:o.duration||((i=t[o.type])==null?void 0:i.duration)||t?.duration||B_[o.type],style:{...t.style,...(s=t[o.type])==null?void 0:s.style,...o.style}}});return{...e,toasts:r}},U_=(t,e="blank",n)=>({createdAt:Date.now(),visible:!0,type:e,ariaProps:{role:"status","aria-live":"polite"},message:t,pauseDuration:0,...n,id:n?.id||A_()}),lf=t=>(e,n)=>{let r=U_(e,t,n);return Xs({type:2,toast:r}),r.id},lr=(t,e)=>lf("blank")(t,e);lr.error=lf("error");lr.success=lf("success");lr.loading=lf("loading");lr.custom=lf("custom");lr.dismiss=t=>{Xs({type:3,toastId:t})};lr.remove=t=>Xs({type:4,toastId:t});lr.promise=(t,e,n)=>{let r=lr.loading(e.loading,{...n,...n?.loading});return t.then(o=>(lr.success(bm(e.success,o),{id:r,...n,...n?.success}),o)).catch(o=>{lr.error(bm(e.error,o),{id:r,...n,...n?.error})}),t};var __=(t,e)=>{Xs({type:1,toast:{id:t,height:e}})},z_=()=>{Xs({type:5,time:Date.now()})},V_=t=>{let{toasts:e,pausedAt:n}=J_(t);(0,af.useEffect)(()=>{if(n)return;let i=Date.now(),s=e.map(a=>{if(a.duration===1/0)return;let l=(a.duration||0)+a.pauseDuration-(i-a.createdAt);if(l<0){a.visible&&lr.dismiss(a.id);return}return setTimeout(()=>lr.dismiss(a.id),l)});return()=>{s.forEach(a=>a&&clearTimeout(a))}},[e,n]);let r=(0,af.useCallback)(()=>{n&&Xs({type:6,time:Date.now()})},[n]),o=(0,af.useCallback)((i,s)=>{let{reverseOrder:a=!1,gutter:l=8,defaultPosition:u}=s||{},c=e.filter(p=>(p.position||u)===(i.position||u)&&p.height),f=c.findIndex(p=>p.id===i.id),d=c.filter((p,m)=>mp.visible).slice(...a?[d+1]:[0,d]).reduce((p,m)=>p+(m.height||0)+l,0)},[e]);return{toasts:e,handlers:{updateHeight:__,startPause:z_,endPause:r,calculateOffset:o}}},q_=Kn` from { transform: scale(0) rotate(45deg); opacity: 0; @@ -17,7 +17,7 @@ from { to { transform: scale(1) rotate(45deg); opacity: 1; -}`,U_=Gn` +}`,j_=Kn` from { transform: scale(0); opacity: 0; @@ -25,7 +25,7 @@ from { to { transform: scale(1); opacity: 1; -}`,__=Gn` +}`,H_=Kn` from { transform: scale(0) rotate(90deg); opacity: 0; @@ -33,7 +33,7 @@ from { to { transform: scale(1) rotate(90deg); opacity: 1; -}`,z_=sr("div")` +}`,$_=ar("div")` width: 20px; opacity: 0; height: 20px; @@ -42,14 +42,14 @@ to { position: relative; transform: rotate(45deg); - animation: ${J_} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + animation: ${q_} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after, &:before { content: ''; - animation: ${U_} 0.15s ease-out forwards; + animation: ${j_} 0.15s ease-out forwards; animation-delay: 150ms; position: absolute; border-radius: 3px; @@ -62,18 +62,18 @@ to { } &:before { - animation: ${__} 0.15s ease-out forwards; + animation: ${H_} 0.15s ease-out forwards; animation-delay: 180ms; transform: rotate(90deg); } -`,V_=Gn` +`,W_=Kn` from { transform: rotate(0deg); } to { transform: rotate(360deg); } -`,q_=sr("div")` +`,G_=ar("div")` width: 12px; height: 12px; box-sizing: border-box; @@ -81,8 +81,8 @@ to { border-radius: 100%; border-color: ${t=>t.secondary||"#e0e0e0"}; border-right-color: ${t=>t.primary||"#616161"}; - animation: ${V_} 1s linear infinite; -`,j_=Gn` + animation: ${W_} 1s linear infinite; +`,K_=Kn` from { transform: scale(0) rotate(45deg); opacity: 0; @@ -90,7 +90,7 @@ from { to { transform: scale(1) rotate(45deg); opacity: 1; -}`,H_=Gn` +}`,Y_=Kn` 0% { height: 0; width: 0; @@ -104,7 +104,7 @@ to { 100% { opacity: 1; height: 10px; -}`,$_=sr("div")` +}`,X_=ar("div")` width: 20px; opacity: 0; height: 20px; @@ -113,13 +113,13 @@ to { position: relative; transform: rotate(45deg); - animation: ${j_} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) + animation: ${K_} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; animation-delay: 100ms; &:after { content: ''; box-sizing: border-box; - animation: ${H_} 0.2s ease-out forwards; + animation: ${Y_} 0.2s ease-out forwards; opacity: 0; animation-delay: 200ms; position: absolute; @@ -131,16 +131,16 @@ to { height: 10px; width: 6px; } -`,W_=sr("div")` +`,Q_=ar("div")` position: absolute; -`,G_=sr("div")` +`,Z_=ar("div")` position: relative; display: flex; justify-content: center; align-items: center; min-width: 20px; min-height: 20px; -`,K_=Gn` +`,e4=Kn` from { transform: scale(0.6); opacity: 0.4; @@ -148,20 +148,20 @@ from { to { transform: scale(1); opacity: 1; -}`,Y_=sr("div")` +}`,t4=ar("div")` position: relative; transform: scale(0.6); opacity: 0.4; min-width: 20px; - animation: ${K_} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) + animation: ${e4} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards; -`,X_=({toast:t})=>{let{icon:e,type:n,iconTheme:r}=t;return e!==void 0?typeof e=="string"?Gs.createElement(Y_,null,e):e:n==="blank"?null:Gs.createElement(G_,null,Gs.createElement(q_,{...r}),n!=="loading"&&Gs.createElement(W_,null,n==="error"?Gs.createElement(z_,{...r}):Gs.createElement($_,{...r})))},Q_=t=>` +`,n4=({toast:t})=>{let{icon:e,type:n,iconTheme:r}=t;return e!==void 0?typeof e=="string"?Ys.createElement(t4,null,e):e:n==="blank"?null:Ys.createElement(Z_,null,Ys.createElement(G_,{...r}),n!=="loading"&&Ys.createElement(Q_,null,n==="error"?Ys.createElement($_,{...r}):Ys.createElement(X_,{...r})))},r4=t=>` 0% {transform: translate3d(0,${t*-200}%,0) scale(.6); opacity:.5;} 100% {transform: translate3d(0,0,0) scale(1); opacity:1;} -`,Z_=t=>` +`,o4=t=>` 0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;} 100% {transform: translate3d(0,${t*-150}%,-1px) scale(.6); opacity:0;} -`,e4="0%{opacity:0;} 100%{opacity:1;}",t4="0%{opacity:1;} 100%{opacity:0;}",n4=sr("div")` +`,i4="0%{opacity:0;} 100%{opacity:1;}",s4="0%{opacity:1;} 100%{opacity:0;}",a4=ar("div")` display: flex; align-items: center; background: #fff; @@ -173,31 +173,31 @@ to { pointer-events: auto; padding: 8px 10px; border-radius: 8px; -`,r4=sr("div")` +`,l4=ar("div")` display: flex; justify-content: center; margin: 4px 10px; color: inherit; flex: 1 1 auto; white-space: pre-line; -`,o4=(t,e)=>{let n=t.includes("top")?1:-1,[r,o]=lN()?[e4,t4]:[Q_(n),Z_(n)];return{animation:e?`${Gn(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${Gn(o)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},i4=Zo.memo(({toast:t,position:e,style:n,children:r})=>{let o=t.height?o4(t.position||e||"top-center",t.visible):{opacity:0},i=Zo.createElement(X_,{toast:t}),s=Zo.createElement(r4,{...t.ariaProps},xm(t.message,t));return Zo.createElement(n4,{className:t.className,style:{...o,...n,...t.style}},typeof r=="function"?r({icon:i,message:s}):Zo.createElement(Zo.Fragment,null,i,s))});sN(Ki.createElement);var s4=({id:t,className:e,style:n,onHeightUpdate:r,children:o})=>{let i=Ki.useCallback(s=>{if(s){let a=()=>{let l=s.getBoundingClientRect().height;r(t,l)};a(),new MutationObserver(a).observe(s,{subtree:!0,childList:!0,characterData:!0})}},[t,r]);return Ki.createElement("div",{ref:i,className:e,style:n},o)},a4=(t,e)=>{let n=t.includes("top"),r=n?{top:0}:{bottom:0},o=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:lN()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...r,...o}},l4=rf` +`,u4=(t,e)=>{let n=t.includes("top")?1:-1,[r,o]=dN()?[i4,s4]:[r4(n),o4(n)];return{animation:e?`${Kn(r)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`:`${Kn(o)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`}},c4=ei.memo(({toast:t,position:e,style:n,children:r})=>{let o=t.height?u4(t.position||e||"top-center",t.visible):{opacity:0},i=ei.createElement(n4,{toast:t}),s=ei.createElement(l4,{...t.ariaProps},bm(t.message,t));return ei.createElement(a4,{className:t.className,style:{...o,...n,...t.style}},typeof r=="function"?r({icon:i,message:s}):ei.createElement(ei.Fragment,null,i,s))});cN(Yi.createElement);var f4=({id:t,className:e,style:n,onHeightUpdate:r,children:o})=>{let i=Yi.useCallback(s=>{if(s){let a=()=>{let l=s.getBoundingClientRect().height;r(t,l)};a(),new MutationObserver(a).observe(s,{subtree:!0,childList:!0,characterData:!0})}},[t,r]);return Yi.createElement("div",{ref:i,className:e,style:n},o)},d4=(t,e)=>{let n=t.includes("top"),r=n?{top:0}:{bottom:0},o=t.includes("center")?{justifyContent:"center"}:t.includes("right")?{justifyContent:"flex-end"}:{};return{left:0,right:0,display:"flex",position:"absolute",transition:dN()?void 0:"all 230ms cubic-bezier(.21,1.02,.73,1)",transform:`translateY(${e*(n?1:-1)}px)`,...r,...o}},p4=sf` z-index: 9999; > * { pointer-events: auto; } -`,gm=16,uN=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:r,children:o,containerStyle:i,containerClassName:s})=>{let{toasts:a,handlers:l}=B_(n);return Ki.createElement("div",{style:{position:"fixed",zIndex:9999,top:gm,left:gm,right:gm,bottom:gm,pointerEvents:"none",...i},className:s,onMouseEnter:l.startPause,onMouseLeave:l.endPause},a.map(u=>{let c=u.position||e,f=l.calculateOffset(u,{reverseOrder:t,gutter:r,defaultPosition:e}),d=a4(c,f);return Ki.createElement(s4,{id:u.id,key:u.id,onHeightUpdate:l.updateHeight,className:u.visible?l4:"",style:d},u.type==="custom"?xm(u.message,u):o?o(u):Ki.createElement(i4,{toast:u,position:c}))}))},He=ar;var An=q(ge());var ve=q(ge());function km(){return km=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Yx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function u4(){return Math.random().toString(36).substr(2,8)}function fN(t,e){return{usr:t.state,key:t.key,idx:e}}function Kx(t,e,n,r){return n===void 0&&(n=null),km({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Tl(e):e,{state:n,key:e&&e.key||r||u4()})}function bm(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Tl(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function c4(t,e,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,a=vo.Pop,l=null,u=c();u==null&&(u=0,s.replaceState(km({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function f(){a=vo.Pop;let w=c(),g=w==null?null:w-u;u=w,l&&l({action:a,location:y.location,delta:g})}function d(w,g){a=vo.Push;let v=Kx(y.location,w,g);n&&n(v,w),u=c()+1;let k=fN(v,u),S=y.createHref(v);try{s.pushState(k,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;o.location.assign(S)}i&&l&&l({action:a,location:y.location,delta:1})}function p(w,g){a=vo.Replace;let v=Kx(y.location,w,g);n&&n(v,w),u=c();let k=fN(v,u),S=y.createHref(v);s.replaceState(k,"",S),i&&l&&l({action:a,location:y.location,delta:0})}function m(w){let g=o.location.origin!=="null"?o.location.origin:o.location.href,v=typeof w=="string"?w:bm(w);return lr(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let y={get action(){return a},get location(){return t(o,s)},listen(w){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(cN,f),l=w,()=>{o.removeEventListener(cN,f),l=null}},createHref(w){return e(o,w)},createURL:m,encodeLocation(w){let g=m(w);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:d,replace:p,go(w){return s.go(w)}};return y}var dN;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(dN||(dN={}));function Xx(t,e,n){n===void 0&&(n="/");let r=typeof e=="string"?Tl(e):e,o=Em(r.pathname||"/",n);if(o==null)return null;let i=hN(t);f4(i);let s=null;for(let a=0;s==null&&a{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(lr(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Yi([r,l.relativePath]),c=n.concat(l);i.children&&i.children.length>0&&(lr(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),hN(i.children,e,c,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:v4(u,i.index),routesMeta:c})};return t.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let l of gN(i.path))o(i,s,l)}),e}function gN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=gN(r.join("/")),a=[];return a.push(...s.map(l=>l===""?i:[i,l].join("/"))),o&&a.push(...s),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function f4(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:w4(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var d4=/^:\w+$/,p4=3,m4=2,h4=1,g4=10,y4=-2,pN=t=>t==="*";function v4(t,e){let n=t.split("/"),r=n.length;return n.some(pN)&&(r+=y4),e&&(r+=m4),n.filter(o=>!pN(o)).reduce((o,i)=>o+(d4.test(i)?p4:i===""?h4:g4),r)}function w4(t,e){return t.length===e.length&&t.slice(0,-1).every((r,o)=>r===e[o])?t[t.length-1]-e[e.length-1]:0}function x4(t,e){let{routesMeta:n}=t,r={},o="/",i=[];for(let s=0;s{if(c==="*"){let d=a[f]||"";s=i.slice(0,i.length-d.length).replace(/(.)\/+$/,"$1")}return u[c]=b4(a[f]||"",c),u},{}),pathname:i,pathnameBase:s,pattern:t}}function S4(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Yx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(s,a)=>(r.push(a),"/([^\\/]+)"));return t.endsWith("*")?(r.push("*"),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,e?void 0:"i"),r]}function k4(t){try{return decodeURI(t)}catch(e){return Yx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function b4(t,e){try{return decodeURIComponent(t)}catch(n){return Yx(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+n+").")),t}}function Em(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var Yi=t=>t.join("/").replace(/\/\/+/g,"/"),E4=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/");function Zx(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var yN=["post","put","patch","delete"],sG=new Set(yN),R4=["get",...yN],aG=new Set(R4);var lG=Symbol("deferred");function eS(){return eS=Object.assign?Object.assign.bind():function(t){for(var e=1;eObject.assign({},g,{params:Object.assign({},s,g.params),pathname:Yi([l,r.encodeLocation?r.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:Yi([l,r.encodeLocation?r.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),o,n);return e&&w?ve.createElement(af.Provider,{value:{location:eS({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:vo.Pop}},w):w}function O4(){let t=wN(),e=Zx(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r};return ve.createElement(ve.Fragment,null,ve.createElement("h2",null,"Unexpected Application Error!"),ve.createElement("h3",{style:{fontStyle:"italic"}},e),n?ve.createElement("pre",{style:o},n):null,null)}var N4=ve.createElement(O4,null),tS=class extends ve.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error?ve.createElement(Ys.Provider,{value:this.props.routeContext},ve.createElement(vN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function M4(t){let{routeContext:e,match:n,children:r}=t,o=ve.useContext(rS);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),ve.createElement(Ys.Provider,{value:e},r)}function I4(t,e,n){var r;if(e===void 0&&(e=[]),n===void 0&&(n=null),t==null){var o;if((o=n)!=null&&o.errors)t=n.matches;else return null}let i=t,s=(r=n)==null?void 0:r.errors;if(s!=null){let a=i.findIndex(l=>l.route.id&&s?.[l.route.id]);a>=0||lr(!1),i=i.slice(0,Math.min(i.length,a+1))}return i.reduceRight((a,l,u)=>{let c=l.route.id?s?.[l.route.id]:null,f=null;n&&(f=l.route.errorElement||N4);let d=e.concat(i.slice(0,u+1)),p=()=>{let m;return c?m=f:l.route.Component?m=ve.createElement(l.route.Component,null):l.route.element?m=l.route.element:m=a,ve.createElement(M4,{match:l,routeContext:{outlet:a,matches:d,isDataRoute:n!=null},children:m})};return n&&(l.route.ErrorBoundary||l.route.errorElement||u===0)?ve.createElement(tS,{location:n.location,revalidation:n.revalidation,component:f,error:c,children:p(),routeContext:{outlet:null,matches:d,isDataRoute:!0}}):p()},null)}var nS=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(nS||{});function A4(t){let e=ve.useContext(oS);return e||lr(!1),e}function L4(t){let e=ve.useContext(Ys);return e||lr(!1),e}function D4(t){let e=L4(t),n=e.matches[e.matches.length-1];return n.route.id||lr(!1),n.route.id}function wN(){var t;let e=ve.useContext(vN),n=A4(nS.UseRouteError),r=D4(nS.UseRouteError);return e||((t=n.errors)==null?void 0:t[r])}var F4="startTransition",gG=ve[F4];function aS(t){let{basename:e="/",children:n=null,location:r,navigationType:o=vo.Pop,navigator:i,static:s=!1}=t;Cm()&&lr(!1);let a=e.replace(/^\/*/,"/"),l=ve.useMemo(()=>({basename:a,navigator:i,static:s}),[a,i,s]);typeof r=="string"&&(r=Tl(r));let{pathname:u="/",search:c="",hash:f="",state:d=null,key:p="default"}=r,m=ve.useMemo(()=>{let y=Em(u,a);return y==null?null:{location:{pathname:y,search:c,hash:f,state:d,key:p},navigationType:o}},[a,u,c,f,d,p,o]);return m==null?null:ve.createElement(Rm.Provider,{value:l},ve.createElement(af.Provider,{children:n,value:m}))}var yG=new Promise(()=>{});var H4="startTransition",xN=An[H4];function bN(t){let{basename:e,children:n,future:r,window:o}=t,i=An.useRef();i.current==null&&(i.current=mN({window:o,v5Compat:!0}));let s=i.current,[a,l]=An.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},c=An.useCallback(f=>{u&&xN?xN(()=>l(f)):l(f)},[l,u]);return An.useLayoutEffect(()=>s.listen(c),[s,c]),An.createElement(aS,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:s})}var YG=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var SN;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher"})(SN||(SN={}));var kN;(function(t){t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(kN||(kN={}));var ur=q(ge()),$4=(0,ur.createContext)(null),lS={didCatch:!1,error:null},Tm=class extends ur.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=lS}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,r)=>!Object.is(n,e[r]))}var TN=q(ge(),1),ei=q(ye(),1),PN=({error:t,resetErrorBoundary:e})=>{let n=(0,TN.useRef)(null),r=()=>{e()};return(0,ei.jsxs)("dialog",{ref:n,className:"p-4 rounded-md shadow-lg bg-white",children:[(0,ei.jsx)("div",{className:"text-lg font-semibold",children:"Unhandled Error"}),(0,ei.jsxs)("div",{className:"p-4",children:[(0,ei.jsx)("h4",{className:"text-md font-medium",children:t.message}),(0,ei.jsx)("pre",{className:"whitespace-pre-wrap text-sm",children:t.stack})]}),(0,ei.jsx)("div",{className:"flex justify-end mt-4",children:(0,ei.jsx)("button",{className:"btn btn-secondary",onClick:r,children:"Close"})})]})};var Ld=q(ge(),1);var mg=q(ge(),1);var Te={},ez=0;function rn(t,e){let n=`atom${++ez}`,r={toString:()=>n};return typeof t=="function"?r.read=t:(r.init=t,r.read=function(o){return o(this)},r.write=function(o,i,s){return i(this,typeof s=="function"?s(o(this)):s)}),e&&(r.write=e),r}var uS=t=>"init"in t,cS=t=>!!t.write,Nm=new WeakMap,tz=(t,e)=>{Nm.set(t,e),t.catch(()=>{}).finally(()=>Nm.delete(t))},ON=(t,e)=>{let n=Nm.get(t);n&&(Nm.delete(t),n(e))},NN=(t,e)=>{t.status="fulfilled",t.value=e},MN=(t,e)=>{t.status="rejected",t.reason=e},nz=t=>typeof t?.then=="function",lf=(t,e)=>!!t&&"v"in t&&"v"in e&&Object.is(t.v,e.v),IN=(t,e)=>!!t&&"e"in t&&"e"in e&&Object.is(t.e,e.e),Pl=t=>!!t&&"v"in t&&t.v instanceof Promise,rz=(t,e)=>"v"in t&&"v"in e&&t.v.orig&&t.v.orig===e.v.orig,Om=t=>{if("e"in t)throw t.e;return t.v},dS=()=>{let t=new WeakMap,e=new WeakMap,n=new Map,r,o;(Te.env?Te.env.MODE:void 0)!=="production"&&(r=new Set,o=new Set);let i=E=>t.get(E),s=(E,O)=>{(Te.env?Te.env.MODE:void 0)!=="production"&&Object.freeze(O);let A=t.get(E);if(t.set(E,O),n.has(E)||n.set(E,A),Pl(A)){let B="v"in O?O.v instanceof Promise?O.v:Promise.resolve(O.v):Promise.reject(O.e);A.v!==B&&ON(A.v,B)}},a=(E,O,A)=>{let B=new Map,L=!1;A.forEach((I,U)=>{!I&&U===E&&(I=O),I?(B.set(U,I),O.d.get(U)!==I&&(L=!0)):(Te.env?Te.env.MODE:void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(L||O.d.size!==B.size)&&(O.d=B)},l=(E,O,A)=>{let B=i(E),L={d:B?.d||new Map,v:O};if(A&&a(E,L,A),lf(B,L)&&B.d===L.d)return B;if(Pl(B)&&Pl(L)&&rz(B,L)){if(B.d===L.d)return B;L.v=B.v}return s(E,L),L},u=(E,O,A,B)=>{if(nz(O)){let L,I=()=>{let V=i(E);if(!Pl(V)||V.v!==U)return;let Q=l(E,U,A);e.has(E)&&V.d!==Q.d&&b(E,Q,V.d)},U=new Promise((V,Q)=>{let G=!1;O.then(te=>{G||(G=!0,NN(U,te),V(te),I())},te=>{G||(G=!0,MN(U,te),Q(te),I())}),L=te=>{G||(G=!0,te.then(we=>NN(U,we),we=>MN(U,we)),V(te))}});return U.orig=O,U.status="pending",tz(U,V=>{V&&L(V),B?.()}),l(E,U,A)}return l(E,O,A)},c=(E,O,A)=>{let B=i(E),L={d:B?.d||new Map,e:O};return A&&a(E,L,A),IN(B,L)&&B.d===L.d?B:(s(E,L),L)},f=(E,O)=>{let A=i(E);if(!O&&A&&(e.has(E)||Array.from(A.d).every(([G,te])=>{if(G===E)return!0;let we=f(G);return we===te||lf(we,te)})))return A;let B=new Map,L=!0,I=G=>{if(G===E){let we=i(G);if(we)return B.set(G,we),Om(we);if(uS(G))return B.set(G,void 0),G.init;throw new Error("no atom init")}let te=f(G);return B.set(G,te),Om(te)},U,V,Q={get signal(){return U||(U=new AbortController),U.signal},get setSelf(){return(Te.env?Te.env.MODE:void 0)!=="production"&&!cS(E)&&console.warn("setSelf function cannot be used with read-only atom"),!V&&cS(E)&&(V=(...G)=>{if((Te.env?Te.env.MODE:void 0)!=="production"&&L&&console.warn("setSelf function cannot be called in sync"),!L)return v(E,...G)}),V}};try{let G=E.read(I,Q);return u(E,G,B,()=>U?.abort())}catch(G){return c(E,G,B)}finally{L=!1}},d=E=>Om(f(E)),p=E=>{let O=e.get(E);return O||(O=k(E)),O},m=(E,O)=>!O.l.size&&(!O.t.size||O.t.size===1&&O.t.has(E)),y=E=>{let O=e.get(E);O&&m(E,O)&&S(E)},w=E=>{let O=new Map,A=new WeakMap,B=U=>{var V;let Q=new Set((V=e.get(U))==null?void 0:V.t);return n.forEach((G,te)=>{var we;(we=i(te))!=null&&we.d.has(U)&&Q.add(te)}),Q},L=U=>{B(U).forEach(V=>{V!==U&&(O.set(V,(O.get(V)||new Set).add(U)),A.set(V,(A.get(V)||0)+1),L(V))})};L(E);let I=U=>{B(U).forEach(V=>{var Q;if(V!==U){let G=A.get(V);if(G&&A.set(V,--G),!G){let te=!!((Q=O.get(V))!=null&&Q.size);if(te){let we=i(V),R=f(V,!0);te=!lf(we,R)}te||O.forEach(we=>we.delete(V))}I(V)}})};I(E)},g=(E,...O)=>{let A=!0,B=U=>Om(f(U)),L=(U,...V)=>{let Q;if(U===E){if(!uS(U))throw new Error("atom not writable");let G=i(U),te=u(U,V[0]);lf(G,te)||w(U)}else Q=g(U,...V);if(!A){let G=x();(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(te=>te({type:"async-write",flushed:G}))}return Q},I=E.write(B,L,...O);return A=!1,I},v=(E,...O)=>{let A=g(E,...O),B=x();return(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(L=>L({type:"write",flushed:B})),A},k=(E,O,A)=>{var B;let L=A||[];(B=i(E))==null||B.d.forEach((U,V)=>{let Q=e.get(V);Q?Q.t.add(E):V!==E&&k(V,E,L)}),f(E);let I={t:new Set(O&&[O]),l:new Set};if(e.set(E,I),(Te.env?Te.env.MODE:void 0)!=="production"&&o.add(E),cS(E)&&E.onMount){let{onMount:U}=E;L.push(()=>{let V=U((...Q)=>v(E,...Q));V&&(I.u=V)})}return A||L.forEach(U=>U()),I},S=E=>{var O;let A=(O=e.get(E))==null?void 0:O.u;A&&A(),e.delete(E),(Te.env?Te.env.MODE:void 0)!=="production"&&o.delete(E);let B=i(E);B?(Pl(B)&&ON(B.v),B.d.forEach((L,I)=>{if(I!==E){let U=e.get(I);U&&(U.t.delete(E),m(I,U)&&S(I))}})):(Te.env?Te.env.MODE:void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",E)},b=(E,O,A)=>{let B=new Set(O.d.keys());A?.forEach((L,I)=>{if(B.has(I)){B.delete(I);return}let U=e.get(I);U&&(U.t.delete(E),m(I,U)&&S(I))}),B.forEach(L=>{let I=e.get(L);I?I.t.add(E):e.has(E)&&k(L,E)})},x=()=>{let E;for((Te.env?Te.env.MODE:void 0)!=="production"&&(E=new Set);n.size;){let O=Array.from(n);n.clear(),O.forEach(([A,B])=>{let L=i(A);if(L){let I=e.get(A);I&&L.d!==B?.d&&b(A,L,B?.d),I&&!(!Pl(B)&&(lf(B,L)||IN(B,L)))&&(I.l.forEach(U=>U()),(Te.env?Te.env.MODE:void 0)!=="production"&&E.add(A))}else(Te.env?Te.env.MODE:void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((Te.env?Te.env.MODE:void 0)!=="production")return E},T=(E,O)=>{let A=p(E),B=x(),L=A.l;return L.add(O),(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(I=>I({type:"sub",flushed:B})),()=>{L.delete(O),y(E),(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(I=>I({type:"unsub"}))}};return(Te.env?Te.env.MODE:void 0)!=="production"?{get:d,set:v,sub:T,dev_subscribe_store:(E,O)=>{if(O!==2)throw new Error("The current StoreListener revision is 2.");return r.add(E),()=>{r.delete(E)}},dev_get_mounted_atoms:()=>o.values(),dev_get_atom_state:E=>t.get(E),dev_get_mounted:E=>e.get(E),dev_restore_atoms:E=>{for(let[A,B]of E)uS(A)&&(u(A,B),w(A));let O=x();r.forEach(A=>A({type:"restore",flushed:O}))}}:{get:d,set:v,sub:T}},fS;(Te.env?Te.env.MODE:void 0)!=="production"&&(typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__=="number"?++globalThis.__NUMBER_OF_JOTAI_INSTANCES__:globalThis.__NUMBER_OF_JOTAI_INSTANCES__=1);var AN=()=>(fS||((Te.env?Te.env.MODE:void 0)!=="production"&&globalThis.__NUMBER_OF_JOTAI_INSTANCES__!==1&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"),fS=dS()),fS);var qt=q(ge(),1);var LN={},DN=(0,qt.createContext)(void 0),FN=t=>{let e=(0,qt.useContext)(DN);return t?.store||e||AN()},Mm=({children:t,store:e})=>{let n=(0,qt.useRef)();return!e&&!n.current&&(n.current=dS()),(0,qt.createElement)(DN.Provider,{value:e||n.current},t)},oz=t=>typeof t?.then=="function",iz=qt.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t)});function sz(t,e){let n=FN(e),[[r,o,i],s]=(0,qt.useReducer)(u=>{let c=n.get(t);return Object.is(u[0],c)&&u[1]===n&&u[2]===t?u:[c,n,t]},void 0,()=>[n.get(t),n,t]),a=r;(o!==n||i!==t)&&(s(),a=n.get(t));let l=e?.delay;return(0,qt.useEffect)(()=>{let u=n.sub(t,()=>{if(typeof l=="number"){setTimeout(s,l);return}s()});return s(),u},[n,t,l]),(0,qt.useDebugValue)(a),oz(a)?iz(a):a}function az(t,e){let n=FN(e);return(0,qt.useCallback)((...o)=>{if((LN.env?LN.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}function Nt(t,e){return[sz(t,e),az(t,e)]}function at(t,e){if(!t)throw new Error(e)}var lz=34028234663852886e22,uz=-34028234663852886e22,cz=4294967295,fz=2147483647,dz=-2147483648;function Ol(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>fz||tcz||t<0)throw new Error("invalid uint 32: "+t)}function Im(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>lz||t({no:o.no,name:o.name,localName:t[o.no]})),r)}function mS(t,e,n){let r=Object.create(null),o=Object.create(null),i=[];for(let s of e){let a=_N(s);i.push(a),r[s.name]=a,o[s.no]=a}return{typeName:t,values:i,findName(s){return r[s]},findNumber(s){return o[s]}}}function UN(t,e,n){let r={};for(let o of e){let i=_N(o);r[i.localName]=i.no,r[i.no]=i.localName}return pS(r,t,e,n),r}function _N(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}var N=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){let r=this.getType(),o=r.runtime.bin,i=o.makeReadOptions(n);return o.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,n){let r=this.getType(),o=r.runtime.json,i=o.makeReadOptions(n);return o.readMessage(r,e,i,this),this}fromJsonString(e,n){let r;try{r=JSON.parse(e)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(r,n)}toBinary(e){let n=this.getType(),r=n.runtime.bin,o=r.makeWriteOptions(e),i=o.writerFactory();return r.writeMessage(this,i,o),i.finish()}toJson(e){let n=this.getType(),r=n.runtime.json,o=r.makeWriteOptions(e);return r.writeMessage(this,o)}toJsonString(e){var n;let r=this.toJson(e);return JSON.stringify(r,null,(n=e?.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function zN(t,e,n,r){var o;let i=(o=r?.localName)!==null&&o!==void 0?o:e.substring(e.lastIndexOf(".")+1),s={[i]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[i];return Object.setPrototypeOf(s.prototype,new N),Object.assign(s,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(a,l){return new s().fromBinary(a,l)},fromJson(a,l){return new s().fromJson(a,l)},fromJsonString(a,l){return new s().fromJsonString(a,l)},equals(a,l){return t.util.equals(s,a,l)}}),s}function Am(t,e,n,r){return{syntax:t,json:e,bin:n,util:r,makeMessageType(o,i,s){return zN(this,o,i,s)},makeEnum:UN,makeEnumType:mS,getEnumType:JN}}var z;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(z||(z={}));var Cr;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(Cr||(Cr={}));function qN(){let t=0,e=0;for(let r=0;r<28;r+=7){let o=this.buf[this.pos++];if(t|=(o&127)<>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let o=this.buf[this.pos++];if(e|=(o&127)<>>i,a=!(!(s>>>7)&&e==0),l=(a?s|128:s)&255;if(n.push(l),!a)return}let r=t>>>28&15|(e&7)<<4,o=!!(e>>3);if(n.push((o?r|128:r)&255),!!o){for(let i=3;i<31;i=i+7){let s=e>>>i,a=!!(s>>>7),l=(a?s|128:s)&255;if(n.push(l),!a)return}n.push(e>>>31&1)}}var Lm=4294967296;function hS(t){let e=t[0]==="-";e&&(t=t.slice(1));let n=1e6,r=0,o=0;function i(s,a){let l=Number(t.slice(s,a));o*=n,r=r*n+l,r>=Lm&&(o=o+(r/Lm|0),r=r%Lm)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?HN(r,o):yS(r,o)}function jN(t,e){let n=yS(t,e),r=n.hi&2147483648;r&&(n=HN(n.lo,n.hi));let o=gS(n.lo,n.hi);return r?"-"+o:o}function gS(t,e){if({lo:t,hi:e}=pz(t,e),e<=2097151)return String(Lm*e+t);let n=t&16777215,r=(t>>>24|e<<8)&16777215,o=e>>16&65535,i=n+r*6777216+o*6710656,s=r+o*8147497,a=o*2,l=1e7;return i>=l&&(s+=Math.floor(i/l),i%=l),s>=l&&(a+=Math.floor(s/l),s%=l),a.toString()+VN(s)+VN(i)}function pz(t,e){return{lo:t>>>0,hi:e>>>0}}function yS(t,e){return{lo:t|0,hi:e|0}}function HN(t,e){return e=~e,t?t=~t+1:e+=1,yS(t,e)}var VN=t=>{let e=String(t);return"0000000".slice(e.length)+e};function vS(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function $N(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function mz(){let t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let o=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){let u=typeof l=="bigint"?l:BigInt(l);if(u>i||ua||uat(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),r=o=>at(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse(o){return typeof o!="string"&&(o=o.toString()),n(o),o},uParse(o){return typeof o!="string"&&(o=o.toString()),r(o),o},enc(o){return typeof o!="string"&&(o=o.toString()),n(o),hS(o)},uEnc(o){return typeof o!="string"&&(o=o.toString()),r(o),hS(o)},dec(o,i){return jN(o,i)},uDec(o,i){return gS(o,i)}}}var Ne=mz();var $e;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})($e||($e={}));var Fm=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let o=0;o>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(uf(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Ol(e),vS(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){Im(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){uf(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Ol(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Ol(e),e=(e<<1^e>>31)>>>0,vS(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),o=Ne.enc(e);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),o=Ne.uEnc(e);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(n)}int64(e){let n=Ne.enc(e);return Dm(n.lo,n.hi,this.buf),this}sint64(e){let n=Ne.enc(e),r=n.hi>>31,o=n.lo<<1^r,i=(n.hi<<1|n.lo>>>31)^r;return Dm(o,i,this.buf),this}uint64(e){let n=Ne.uEnc(e);return Dm(n.lo,n.hi,this.buf),this}},Bm=class{constructor(e,n){this.varint64=qN,this.uint32=$N,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e){let n=this.pos;switch(e){case $e.Varint:for(;this.buf[this.pos++]&128;);break;case $e.Bit64:this.pos+=4;case $e.Bit32:this.pos+=4;break;case $e.LengthDelimited:let r=this.uint32();this.pos+=r;break;case $e.StartGroup:let o;for(;(o=this.tag()[1])!==$e.EndGroup;)this.skip(o);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Ne.dec(...this.varint64())}uint64(){return Ne.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,Ne.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ne.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ne.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}};function Qs(t,e){return e instanceof N||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}var O7={"google.protobuf.DoubleValue":z.DOUBLE,"google.protobuf.FloatValue":z.FLOAT,"google.protobuf.Int64Value":z.INT64,"google.protobuf.UInt64Value":z.UINT64,"google.protobuf.Int32Value":z.INT32,"google.protobuf.UInt32Value":z.UINT32,"google.protobuf.BoolValue":z.BOOL,"google.protobuf.StringValue":z.STRING,"google.protobuf.BytesValue":z.BYTES};function ti(t,e,n){if(e===n)return!0;if(t==z.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;rnew Bm(t)},GN={writeUnknownFields:!0,writerFactory:()=>new Fm};function hz(t){return t?Object.assign(Object.assign({},WN),t):WN}function gz(t){return t?Object.assign(Object.assign({},GN),t):GN}function _m(){return{makeReadOptions:hz,makeWriteOptions:gz,listUnknownFields(t){var e;return(e=t[Nl])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Nl]},writeUnknownFields(t,e){let r=t[Nl];if(r)for(let o of r)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,r){let o=t;Array.isArray(o[Nl])||(o[Nl]=[]),o[Nl].push({no:e,wireType:n,data:r})},readMessage(t,e,n,r,o){let i=t.getType(),s=o?e.len:e.pos+n,a,l;for(;e.pos0&&(m=vz),f){let v=c[d];if(l==$e.LengthDelimited&&p!=z.STRING&&p!=z.BYTES){let k=e.uint32()+e.pos;for(;e.pos>4,s=i,o=2;break;case 2:n[r++]=(s&15)<<4|(i&60)>>2,s=i,o=3;break;case 3:n[r++]=(s&3)<<6|i,o=0;break}}if(o==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(t){let e="",n=0,r,o=0;for(let i=0;i>2],o=(r&3)<<4,n=1;break;case 1:e+=ri[o|r>>4],o=(r&15)<<2,n=2;break;case 2:e+=ri[o|r>>6],e+=ri[r&63],n=0;break}return n&&(e+=ri[o],e+="=",n==1&&(e+="=")),e}};var YN={ignoreUnknownFields:!1},XN={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function wz(t){return t?Object.assign(Object.assign({},YN),t):YN}function xz(t){return t?Object.assign(Object.assign({},XN),t):XN}function jm(t){let e=t(Sz,QN);return{makeReadOptions:wz,makeWriteOptions:xz,readMessage(n,r,o,i){if(r==null||Array.isArray(r)||typeof r!="object")throw new Error(`cannot decode message ${n.typeName} from JSON: ${this.debug(r)}`);i=i??new n;let s={};for(let[a,l]of Object.entries(r)){let u=n.fields.findJsonName(a);if(!u){if(!o.ignoreUnknownFields)throw new Error(`cannot decode message ${n.typeName} from JSON: key "${a}" is unknown`);continue}let c=u.localName,f=i;if(u.oneof){if(l===null&&u.kind=="scalar")continue;let d=s[u.oneof.localName];if(d)throw new Error(`cannot decode message ${n.typeName} from JSON: multiple keys for oneof "${u.oneof.name}" present: "${d}", "${a}"`);s[u.oneof.localName]=a,f=f[u.oneof.localName]={case:c},c="value"}if(u.repeated){if(l===null)continue;if(!Array.isArray(l))throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`);let d=f[c];for(let p of l){if(p===null)throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(p)}`);let m;switch(u.kind){case"message":m=u.T.fromJson(p,o);break;case"enum":if(m=xS(u.T,p,o.ignoreUnknownFields),m===void 0)continue;break;case"scalar":try{m=ff(u.T,p,u.L)}catch(y){let w=`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(p)}`;throw y instanceof Error&&y.message.length>0&&(w+=`: ${y.message}`),new Error(w)}break}d.push(m)}}else if(u.kind=="map"){if(l===null)continue;if(Array.isArray(l)||typeof l!="object")throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`);let d=f[c];for(let[p,m]of Object.entries(l)){if(m===null)throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: map value null`);let y;switch(u.V.kind){case"message":y=u.V.T.fromJson(m,o);break;case"enum":if(y=xS(u.V.T,m,o.ignoreUnknownFields),y===void 0)continue;break;case"scalar":try{y=ff(u.V.T,m,Cr.BIGINT)}catch(w){let g=`cannot decode map value for field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`;throw w instanceof Error&&w.message.length>0&&(g+=`: ${w.message}`),new Error(g)}break}try{d[ff(u.K,u.K==z.BOOL?p=="true"?!0:p=="false"?!1:p:p,Cr.BIGINT).toString()]=y}catch(w){let g=`cannot decode map key for field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`;throw w instanceof Error&&w.message.length>0&&(g+=`: ${w.message}`),new Error(g)}}}else switch(u.kind){case"message":let d=u.T;if(l===null&&d.typeName!="google.protobuf.Value"){if(u.oneof)throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: null is invalid for oneof field "${a}"`);continue}f[c]instanceof N?f[c].fromJson(l,o):(f[c]=d.fromJson(l,o),d.fieldWrapper&&!u.oneof&&(f[c]=d.fieldWrapper.unwrapField(f[c])));break;case"enum":let p=xS(u.T,l,o.ignoreUnknownFields);p!==void 0&&(f[c]=p);break;case"scalar":try{f[c]=ff(u.T,l,u.L)}catch(m){let y=`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`;throw m instanceof Error&&m.message.length>0&&(y+=`: ${m.message}`),new Error(y)}break}}return i},writeMessage(n,r){let o=n.getType(),i={},s;try{for(let a of o.fields.byMember()){let l;if(a.kind=="oneof"){let u=n[a.localName];if(u.value===void 0)continue;if(s=a.findField(u.case),!s)throw"oneof case not found: "+u.case;l=e(s,u.value,r)}else s=a,l=e(s,n[s.localName],r);l!==void 0&&(i[r.useProtoFieldName?s.name:s.jsonName]=l)}}catch(a){let l=s?`cannot encode field ${o.typeName}.${s.name} to JSON`:`cannot encode message ${o.typeName} to JSON`,u=a instanceof Error?a.message:String(a);throw new Error(l+(u.length>0?`: ${u}`:""))}return i},readScalar:ff,writeScalar:QN,debug:ZN}}function ZN(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function ff(t,e,n){switch(t){case z.DOUBLE:case z.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;let r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==z.FLOAT&&Im(r),r;case z.INT32:case z.FIXED32:case z.SFIXED32:case z.SINT32:case z.UINT32:if(e===null)return 0;let o;if(typeof e=="number"?o=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(o=Number(e)),o===void 0)break;return t==z.UINT32?uf(o):Ol(o),o;case z.INT64:case z.SFIXED64:case z.SINT64:if(e===null)return Ne.zero;if(typeof e!="number"&&typeof e!="string")break;let i=Ne.parse(e);return n?i.toString():i;case z.FIXED64:case z.UINT64:if(e===null)return Ne.zero;if(typeof e!="number"&&typeof e!="string")break;let s=Ne.uParse(e);return n?s.toString():s;case z.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case z.STRING:if(e===null)return"";if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case z.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Xi.dec(e)}throw new Error}function xS(t,e,n){if(e===null)return 0;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":let r=t.findName(e);if(r||n)return r?.no;break}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${ZN(e)}`)}function Sz(t,e,n,r){var o;if(e===void 0)return e;if(e===0&&!n)return;if(r)return e;if(t.typeName=="google.protobuf.NullValue")return null;let i=t.findNumber(e);return(o=i?.name)!==null&&o!==void 0?o:e}function QN(t,e,n){if(e!==void 0)switch(t){case z.INT32:case z.SFIXED32:case z.SINT32:case z.FIXED32:case z.UINT32:return at(typeof e=="number"),e!=0||n?e:void 0;case z.FLOAT:case z.DOUBLE:return at(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e!==0||n?e:void 0;case z.STRING:return at(typeof e=="string"),e.length>0||n?e:void 0;case z.BOOL:return at(typeof e=="boolean"),e||n?e:void 0;case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return at(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),n||e!=0?e.toString(10):void 0;case z.BYTES:return at(e instanceof Uint8Array),n||e.byteLength>0?Xi.enc(e):void 0}}function eM(){return jm((t,e)=>function(r,o,i){if(r.kind=="map"){let s={};switch(r.V.kind){case"scalar":for(let[l,u]of Object.entries(o)){let c=e(r.V.T,u,!0);at(c!==void 0),s[l.toString()]=c}break;case"message":for(let[l,u]of Object.entries(o))s[l.toString()]=u.toJson(i);break;case"enum":let a=r.V.T;for(let[l,u]of Object.entries(o)){at(u===void 0||typeof u=="number");let c=t(a,u,!0,i.enumAsInteger);at(c!==void 0),s[l.toString()]=c}break}return i.emitDefaultValues||Object.keys(s).length>0?s:void 0}else if(r.repeated){let s=[];switch(r.kind){case"scalar":for(let a=0;a0?s:void 0}else switch(r.kind){case"scalar":return e(r.T,o,!!r.oneof||r.opt||i.emitDefaultValues);case"enum":return t(r.T,o,!!r.oneof||r.opt||i.emitDefaultValues,i.enumAsInteger);case"message":return o!==void 0?Qs(r.T,o).toJson(i):void 0}})}function $m(){return{setEnumType:pS,initPartial(t,e){if(t===void 0)return;let n=e.getType();for(let r of n.fields.byMember()){let o=r.localName,i=e,s=t;if(s[o]!==void 0)switch(r.kind){case"oneof":let a=s[o].case;if(a===void 0)continue;let l=r.findField(a),u=s[o].value;l&&l.kind=="message"&&!(u instanceof l.T)?u=new l.T(u):l&&l.kind==="scalar"&&l.T===z.BYTES&&(u=df(u)),i[o]={case:a,value:u};break;case"scalar":case"enum":let c=s[o];r.T===z.BYTES&&(c=r.repeated?c.map(df):df(c)),i[o]=c;break;case"map":switch(r.V.kind){case"scalar":case"enum":if(r.V.T===z.BYTES)for(let[p,m]of Object.entries(s[o]))i[o][p]=df(m);else Object.assign(i[o],s[o]);break;case"message":let d=r.V.T;for(let p of Object.keys(s[o])){let m=s[o][p];d.fieldWrapper||(m=new d(m)),i[o][p]=m}break}break;case"message":let f=r.T;if(r.repeated)i[o]=s[o].map(d=>d instanceof f?d:new f(d));else if(s[o]!==void 0){let d=s[o];f.fieldWrapper?f.typeName==="google.protobuf.BytesValue"?i[o]=df(d):i[o]=d:i[o]=d instanceof f?d:new f(d)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(r=>{let o=e[r.localName],i=n[r.localName];if(r.repeated){if(o.length!==i.length)return!1;switch(r.kind){case"message":return o.every((s,a)=>r.T.equals(s,i[a]));case"scalar":return o.every((s,a)=>ti(r.T,s,i[a]));case"enum":return o.every((s,a)=>ti(z.INT32,s,i[a]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(o,i);case"enum":return ti(z.INT32,o,i);case"scalar":return ti(r.T,o,i);case"oneof":if(o.case!==i.case)return!1;let s=r.findField(o.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(o.value,i.value);case"enum":return ti(z.INT32,o.value,i.value);case"scalar":return ti(s.T,o.value,i.value)}throw new Error(`oneof cannot contain ${s.kind}`);case"map":let a=Object.keys(o).concat(Object.keys(i));switch(r.V.kind){case"message":let l=r.V.T;return a.every(c=>l.equals(o[c],i[c]));case"enum":return a.every(c=>ti(z.INT32,o[c],i[c]));case"scalar":let u=r.V.T;return a.every(c=>ti(u,o[c],i[c]))}break}})},clone(t){let e=t.getType(),n=new e,r=n;for(let o of e.fields.byMember()){let i=t[o.localName],s;if(o.repeated)s=i.map(Hm);else if(o.kind=="map"){s=r[o.localName];for(let[a,l]of Object.entries(i))s[a]=Hm(l)}else o.kind=="oneof"?s=o.findField(i.case)?{case:i.case,value:Hm(i.value)}:{case:void 0}:s=Hm(i);r[o.localName]=s}return n}}}function Hm(t){if(t===void 0)return t;if(t instanceof N)return t.clone();if(t instanceof Uint8Array){let e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function df(t){return t instanceof Uint8Array?t:new Uint8Array(t)}var Il=class{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){let n={};for(let r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){let n={};for(let r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,n;for(let r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,e.push(n)):e.push(r)}return this.members}};function pf(t,e){let n=nM(t);return e?n:Rz(Ez(n))}function tM(t){return pf(t,!1)}var Wm=nM;function nM(t){let e=!1,n=[];for(let r=0;r`${t}$`,Ez=t=>bz.has(t)?rM(t):t,Rz=t=>kz.has(t)?rM(t):t;var Al=class{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=tM(e)}addField(e){at(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n0?`: ${a}`:""))}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e}})}function iM(){return jm((t,e)=>function(r,o,i){if(r.kind=="map"){let s={};switch(r.V.kind){case"scalar":for(let[l,u]of Object.entries(o)){let c=e(r.V.T,u,!0);at(c!==void 0),s[l.toString()]=c}break;case"message":for(let[l,u]of Object.entries(o))s[l.toString()]=u.toJson(i);break;case"enum":let a=r.V.T;for(let[l,u]of Object.entries(o)){at(u===void 0||typeof u=="number");let c=t(a,u,!0,i.enumAsInteger);at(c!==void 0),s[l.toString()]=c}break}return i.emitDefaultValues||Object.keys(s).length>0?s:void 0}else if(r.repeated){let s=[];switch(r.kind){case"scalar":for(let a=0;a0?s:void 0}else{if(o===void 0){if(!r.oneof&&!r.opt)throw"required field not set";return}switch(r.kind){case"scalar":return e(r.T,o,!0);case"enum":return t(r.T,o,!0,i.enumAsInteger);case"message":return Qs(r.T,o).toJson(i)}}})}var M=Am("proto2",iM(),oM(),Object.assign(Object.assign({},$m()),{newFieldList(t){return new Il(t,Tz)},initFields(t){for(let e of t.getType().fields.byMember()){let n=e.localName,r=t;if(e.repeated){r[n]=[];continue}switch(e.kind){case"oneof":r[n]={case:void 0};break;case"map":r[n]={};break;case"scalar":case"enum":case"message":break}}}}));function Tz(t){var e,n,r,o,i;let s=[],a;for(let l of typeof t=="function"?t():t){let u=l;if(u.localName=pf(l.name,l.oneof!==void 0),u.jsonName=(e=l.jsonName)!==null&&e!==void 0?e:Wm(l.name),u.repeated=(n=l.repeated)!==null&&n!==void 0?n:!1,l.kind=="scalar"&&(u.L=(r=l.L)!==null&&r!==void 0?r:Cr.BIGINT),l.oneof!==void 0){let c=typeof l.oneof=="string"?l.oneof:l.oneof.name;(!a||a.name!=c)&&(a=new Al(c)),u.oneof=a,a.addField(u)}l.kind=="message"&&(u.delimited=(o=l.delimited)!==null&&o!==void 0?o:!1),u.packed=(i=l.packed)!==null&&i!==void 0?i:!1,s.push(u)}return s}var le;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(le||(le={}));var mf;(function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"})(mf||(mf={}));var Qi;(function(t){t[t.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",t[t.EDITION_PROTO2=998]="EDITION_PROTO2",t[t.EDITION_PROTO3=999]="EDITION_PROTO3",t[t.EDITION_2023=1e3]="EDITION_2023",t[t.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",t[t.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",t[t.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",t[t.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",t[t.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY"})(Qi||(Qi={}));M.util.setEnumType(Qi,"google.protobuf.Edition",[{no:0,name:"EDITION_UNKNOWN"},{no:998,name:"EDITION_PROTO2"},{no:999,name:"EDITION_PROTO3"},{no:1e3,name:"EDITION_2023"},{no:1,name:"EDITION_1_TEST_ONLY"},{no:2,name:"EDITION_2_TEST_ONLY"},{no:99997,name:"EDITION_99997_TEST_ONLY"},{no:99998,name:"EDITION_99998_TEST_ONLY"},{no:99999,name:"EDITION_99999_TEST_ONLY"}]);var hf=class t extends N{constructor(e){super(),this.file=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};hf.runtime=M;hf.typeName="google.protobuf.FileDescriptorSet";hf.fields=M.util.newFieldList(()=>[{no:1,name:"file",kind:"message",T:Ll,repeated:!0}]);var Ll=class t extends N{constructor(e){super(),this.dependency=[],this.publicDependency=[],this.weakDependency=[],this.messageType=[],this.enumType=[],this.service=[],this.extension=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Ll.runtime=M;Ll.typeName="google.protobuf.FileDescriptorProto";Ll.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"package",kind:"scalar",T:9,opt:!0},{no:3,name:"dependency",kind:"scalar",T:9,repeated:!0},{no:10,name:"public_dependency",kind:"scalar",T:5,repeated:!0},{no:11,name:"weak_dependency",kind:"scalar",T:5,repeated:!0},{no:4,name:"message_type",kind:"message",T:wo,repeated:!0},{no:5,name:"enum_type",kind:"message",T:oi,repeated:!0},{no:6,name:"service",kind:"message",T:ql,repeated:!0},{no:7,name:"extension",kind:"message",T:Zi,repeated:!0},{no:8,name:"options",kind:"message",T:Hl,opt:!0},{no:9,name:"source_code_info",kind:"message",T:nu,opt:!0},{no:12,name:"syntax",kind:"scalar",T:9,opt:!0},{no:14,name:"edition",kind:"enum",T:M.getEnumType(Qi),opt:!0}]);var wo=class t extends N{constructor(e){super(),this.field=[],this.extension=[],this.nestedType=[],this.enumType=[],this.extensionRange=[],this.oneofDecl=[],this.reservedRange=[],this.reservedName=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};wo.runtime=M;wo.typeName="google.protobuf.DescriptorProto";wo.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"field",kind:"message",T:Zi,repeated:!0},{no:6,name:"extension",kind:"message",T:Zi,repeated:!0},{no:3,name:"nested_type",kind:"message",T:wo,repeated:!0},{no:4,name:"enum_type",kind:"message",T:oi,repeated:!0},{no:5,name:"extension_range",kind:"message",T:Dl,repeated:!0},{no:8,name:"oneof_decl",kind:"message",T:_l,repeated:!0},{no:7,name:"options",kind:"message",T:$l,opt:!0},{no:9,name:"reserved_range",kind:"message",T:Fl,repeated:!0},{no:10,name:"reserved_name",kind:"scalar",T:9,repeated:!0}]);var Dl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Dl.runtime=M;Dl.typeName="google.protobuf.DescriptorProto.ExtensionRange";Dl.fields=M.util.newFieldList(()=>[{no:1,name:"start",kind:"scalar",T:5,opt:!0},{no:2,name:"end",kind:"scalar",T:5,opt:!0},{no:3,name:"options",kind:"message",T:Bl,opt:!0}]);var Fl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Fl.runtime=M;Fl.typeName="google.protobuf.DescriptorProto.ReservedRange";Fl.fields=M.util.newFieldList(()=>[{no:1,name:"start",kind:"scalar",T:5,opt:!0},{no:2,name:"end",kind:"scalar",T:5,opt:!0}]);var Bl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],this.declaration=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Bl.runtime=M;Bl.typeName="google.protobuf.ExtensionRangeOptions";Bl.fields=M.util.newFieldList(()=>[{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0},{no:2,name:"declaration",kind:"message",T:Jl,repeated:!0},{no:50,name:"features",kind:"message",T:Ln,opt:!0},{no:3,name:"verification",kind:"enum",T:M.getEnumType(gf),opt:!0,default:gf.UNVERIFIED}]);var gf;(function(t){t[t.DECLARATION=0]="DECLARATION",t[t.UNVERIFIED=1]="UNVERIFIED"})(gf||(gf={}));M.util.setEnumType(gf,"google.protobuf.ExtensionRangeOptions.VerificationState",[{no:0,name:"DECLARATION"},{no:1,name:"UNVERIFIED"}]);var Jl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Jl.runtime=M;Jl.typeName="google.protobuf.ExtensionRangeOptions.Declaration";Jl.fields=M.util.newFieldList(()=>[{no:1,name:"number",kind:"scalar",T:5,opt:!0},{no:2,name:"full_name",kind:"scalar",T:9,opt:!0},{no:3,name:"type",kind:"scalar",T:9,opt:!0},{no:5,name:"reserved",kind:"scalar",T:8,opt:!0},{no:6,name:"repeated",kind:"scalar",T:8,opt:!0}]);var Zi=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Zi.runtime=M;Zi.typeName="google.protobuf.FieldDescriptorProto";Zi.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:3,name:"number",kind:"scalar",T:5,opt:!0},{no:4,name:"label",kind:"enum",T:M.getEnumType(Ul),opt:!0},{no:5,name:"type",kind:"enum",T:M.getEnumType(lt),opt:!0},{no:6,name:"type_name",kind:"scalar",T:9,opt:!0},{no:2,name:"extendee",kind:"scalar",T:9,opt:!0},{no:7,name:"default_value",kind:"scalar",T:9,opt:!0},{no:9,name:"oneof_index",kind:"scalar",T:5,opt:!0},{no:10,name:"json_name",kind:"scalar",T:9,opt:!0},{no:8,name:"options",kind:"message",T:Wl,opt:!0},{no:17,name:"proto3_optional",kind:"scalar",T:8,opt:!0}]);var lt;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.GROUP=10]="GROUP",t[t.MESSAGE=11]="MESSAGE",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.ENUM=14]="ENUM",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(lt||(lt={}));M.util.setEnumType(lt,"google.protobuf.FieldDescriptorProto.Type",[{no:1,name:"TYPE_DOUBLE"},{no:2,name:"TYPE_FLOAT"},{no:3,name:"TYPE_INT64"},{no:4,name:"TYPE_UINT64"},{no:5,name:"TYPE_INT32"},{no:6,name:"TYPE_FIXED64"},{no:7,name:"TYPE_FIXED32"},{no:8,name:"TYPE_BOOL"},{no:9,name:"TYPE_STRING"},{no:10,name:"TYPE_GROUP"},{no:11,name:"TYPE_MESSAGE"},{no:12,name:"TYPE_BYTES"},{no:13,name:"TYPE_UINT32"},{no:14,name:"TYPE_ENUM"},{no:15,name:"TYPE_SFIXED32"},{no:16,name:"TYPE_SFIXED64"},{no:17,name:"TYPE_SINT32"},{no:18,name:"TYPE_SINT64"}]);var Ul;(function(t){t[t.OPTIONAL=1]="OPTIONAL",t[t.REPEATED=3]="REPEATED",t[t.REQUIRED=2]="REQUIRED"})(Ul||(Ul={}));M.util.setEnumType(Ul,"google.protobuf.FieldDescriptorProto.Label",[{no:1,name:"LABEL_OPTIONAL"},{no:3,name:"LABEL_REPEATED"},{no:2,name:"LABEL_REQUIRED"}]);var _l=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};_l.runtime=M;_l.typeName="google.protobuf.OneofDescriptorProto";_l.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"options",kind:"message",T:Kl,opt:!0}]);var oi=class t extends N{constructor(e){super(),this.value=[],this.reservedRange=[],this.reservedName=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};oi.runtime=M;oi.typeName="google.protobuf.EnumDescriptorProto";oi.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"value",kind:"message",T:Vl,repeated:!0},{no:3,name:"options",kind:"message",T:Yl,opt:!0},{no:4,name:"reserved_range",kind:"message",T:zl,repeated:!0},{no:5,name:"reserved_name",kind:"scalar",T:9,repeated:!0}]);var zl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};zl.runtime=M;zl.typeName="google.protobuf.EnumDescriptorProto.EnumReservedRange";zl.fields=M.util.newFieldList(()=>[{no:1,name:"start",kind:"scalar",T:5,opt:!0},{no:2,name:"end",kind:"scalar",T:5,opt:!0}]);var Vl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Vl.runtime=M;Vl.typeName="google.protobuf.EnumValueDescriptorProto";Vl.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"number",kind:"scalar",T:5,opt:!0},{no:3,name:"options",kind:"message",T:Xl,opt:!0}]);var ql=class t extends N{constructor(e){super(),this.method=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ql.runtime=M;ql.typeName="google.protobuf.ServiceDescriptorProto";ql.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"method",kind:"message",T:jl,repeated:!0},{no:3,name:"options",kind:"message",T:Ql,opt:!0}]);var jl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};jl.runtime=M;jl.typeName="google.protobuf.MethodDescriptorProto";jl.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"input_type",kind:"scalar",T:9,opt:!0},{no:3,name:"output_type",kind:"scalar",T:9,opt:!0},{no:4,name:"options",kind:"message",T:Zl,opt:!0},{no:5,name:"client_streaming",kind:"scalar",T:8,opt:!0,default:!1},{no:6,name:"server_streaming",kind:"scalar",T:8,opt:!0,default:!1}]);var Hl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Hl.runtime=M;Hl.typeName="google.protobuf.FileOptions";Hl.fields=M.util.newFieldList(()=>[{no:1,name:"java_package",kind:"scalar",T:9,opt:!0},{no:8,name:"java_outer_classname",kind:"scalar",T:9,opt:!0},{no:10,name:"java_multiple_files",kind:"scalar",T:8,opt:!0,default:!1},{no:20,name:"java_generate_equals_and_hash",kind:"scalar",T:8,opt:!0},{no:27,name:"java_string_check_utf8",kind:"scalar",T:8,opt:!0,default:!1},{no:9,name:"optimize_for",kind:"enum",T:M.getEnumType(yf),opt:!0,default:yf.SPEED},{no:11,name:"go_package",kind:"scalar",T:9,opt:!0},{no:16,name:"cc_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:17,name:"java_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:18,name:"py_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:42,name:"php_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:23,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:31,name:"cc_enable_arenas",kind:"scalar",T:8,opt:!0,default:!0},{no:36,name:"objc_class_prefix",kind:"scalar",T:9,opt:!0},{no:37,name:"csharp_namespace",kind:"scalar",T:9,opt:!0},{no:39,name:"swift_prefix",kind:"scalar",T:9,opt:!0},{no:40,name:"php_class_prefix",kind:"scalar",T:9,opt:!0},{no:41,name:"php_namespace",kind:"scalar",T:9,opt:!0},{no:44,name:"php_metadata_namespace",kind:"scalar",T:9,opt:!0},{no:45,name:"ruby_package",kind:"scalar",T:9,opt:!0},{no:50,name:"features",kind:"message",T:Ln,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var yf;(function(t){t[t.SPEED=1]="SPEED",t[t.CODE_SIZE=2]="CODE_SIZE",t[t.LITE_RUNTIME=3]="LITE_RUNTIME"})(yf||(yf={}));M.util.setEnumType(yf,"google.protobuf.FileOptions.OptimizeMode",[{no:1,name:"SPEED"},{no:2,name:"CODE_SIZE"},{no:3,name:"LITE_RUNTIME"}]);var $l=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};$l.runtime=M;$l.typeName="google.protobuf.MessageOptions";$l.fields=M.util.newFieldList(()=>[{no:1,name:"message_set_wire_format",kind:"scalar",T:8,opt:!0,default:!1},{no:2,name:"no_standard_descriptor_accessor",kind:"scalar",T:8,opt:!0,default:!1},{no:3,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:7,name:"map_entry",kind:"scalar",T:8,opt:!0},{no:11,name:"deprecated_legacy_json_field_conflicts",kind:"scalar",T:8,opt:!0},{no:12,name:"features",kind:"message",T:Ln,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var Wl=class t extends N{constructor(e){super(),this.targets=[],this.editionDefaults=[],this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Wl.runtime=M;Wl.typeName="google.protobuf.FieldOptions";Wl.fields=M.util.newFieldList(()=>[{no:1,name:"ctype",kind:"enum",T:M.getEnumType(vf),opt:!0,default:vf.STRING},{no:2,name:"packed",kind:"scalar",T:8,opt:!0},{no:6,name:"jstype",kind:"enum",T:M.getEnumType(wf),opt:!0,default:wf.JS_NORMAL},{no:5,name:"lazy",kind:"scalar",T:8,opt:!0,default:!1},{no:15,name:"unverified_lazy",kind:"scalar",T:8,opt:!0,default:!1},{no:3,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:10,name:"weak",kind:"scalar",T:8,opt:!0,default:!1},{no:16,name:"debug_redact",kind:"scalar",T:8,opt:!0,default:!1},{no:17,name:"retention",kind:"enum",T:M.getEnumType(Gm),opt:!0},{no:19,name:"targets",kind:"enum",T:M.getEnumType(Km),repeated:!0},{no:20,name:"edition_defaults",kind:"message",T:Gl,repeated:!0},{no:21,name:"features",kind:"message",T:Ln,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var vf;(function(t){t[t.STRING=0]="STRING",t[t.CORD=1]="CORD",t[t.STRING_PIECE=2]="STRING_PIECE"})(vf||(vf={}));M.util.setEnumType(vf,"google.protobuf.FieldOptions.CType",[{no:0,name:"STRING"},{no:1,name:"CORD"},{no:2,name:"STRING_PIECE"}]);var wf;(function(t){t[t.JS_NORMAL=0]="JS_NORMAL",t[t.JS_STRING=1]="JS_STRING",t[t.JS_NUMBER=2]="JS_NUMBER"})(wf||(wf={}));M.util.setEnumType(wf,"google.protobuf.FieldOptions.JSType",[{no:0,name:"JS_NORMAL"},{no:1,name:"JS_STRING"},{no:2,name:"JS_NUMBER"}]);var Gm;(function(t){t[t.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",t[t.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",t[t.RETENTION_SOURCE=2]="RETENTION_SOURCE"})(Gm||(Gm={}));M.util.setEnumType(Gm,"google.protobuf.FieldOptions.OptionRetention",[{no:0,name:"RETENTION_UNKNOWN"},{no:1,name:"RETENTION_RUNTIME"},{no:2,name:"RETENTION_SOURCE"}]);var Km;(function(t){t[t.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",t[t.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",t[t.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",t[t.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",t[t.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",t[t.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",t[t.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",t[t.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",t[t.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",t[t.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD"})(Km||(Km={}));M.util.setEnumType(Km,"google.protobuf.FieldOptions.OptionTargetType",[{no:0,name:"TARGET_TYPE_UNKNOWN"},{no:1,name:"TARGET_TYPE_FILE"},{no:2,name:"TARGET_TYPE_EXTENSION_RANGE"},{no:3,name:"TARGET_TYPE_MESSAGE"},{no:4,name:"TARGET_TYPE_FIELD"},{no:5,name:"TARGET_TYPE_ONEOF"},{no:6,name:"TARGET_TYPE_ENUM"},{no:7,name:"TARGET_TYPE_ENUM_ENTRY"},{no:8,name:"TARGET_TYPE_SERVICE"},{no:9,name:"TARGET_TYPE_METHOD"}]);var Gl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Gl.runtime=M;Gl.typeName="google.protobuf.FieldOptions.EditionDefault";Gl.fields=M.util.newFieldList(()=>[{no:3,name:"edition",kind:"enum",T:M.getEnumType(Qi),opt:!0},{no:2,name:"value",kind:"scalar",T:9,opt:!0}]);var Kl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Kl.runtime=M;Kl.typeName="google.protobuf.OneofOptions";Kl.fields=M.util.newFieldList(()=>[{no:1,name:"features",kind:"message",T:Ln,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var Yl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Yl.runtime=M;Yl.typeName="google.protobuf.EnumOptions";Yl.fields=M.util.newFieldList(()=>[{no:2,name:"allow_alias",kind:"scalar",T:8,opt:!0},{no:3,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:6,name:"deprecated_legacy_json_field_conflicts",kind:"scalar",T:8,opt:!0},{no:7,name:"features",kind:"message",T:Ln,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var Xl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Xl.runtime=M;Xl.typeName="google.protobuf.EnumValueOptions";Xl.fields=M.util.newFieldList(()=>[{no:1,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:2,name:"features",kind:"message",T:Ln,opt:!0},{no:3,name:"debug_redact",kind:"scalar",T:8,opt:!0,default:!1},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var Ql=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Ql.runtime=M;Ql.typeName="google.protobuf.ServiceOptions";Ql.fields=M.util.newFieldList(()=>[{no:34,name:"features",kind:"message",T:Ln,opt:!0},{no:33,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var Zl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Zl.runtime=M;Zl.typeName="google.protobuf.MethodOptions";Zl.fields=M.util.newFieldList(()=>[{no:33,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:34,name:"idempotency_level",kind:"enum",T:M.getEnumType(xf),opt:!0,default:xf.IDEMPOTENCY_UNKNOWN},{no:35,name:"features",kind:"message",T:Ln,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Kn,repeated:!0}]);var xf;(function(t){t[t.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",t[t.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",t[t.IDEMPOTENT=2]="IDEMPOTENT"})(xf||(xf={}));M.util.setEnumType(xf,"google.protobuf.MethodOptions.IdempotencyLevel",[{no:0,name:"IDEMPOTENCY_UNKNOWN"},{no:1,name:"NO_SIDE_EFFECTS"},{no:2,name:"IDEMPOTENT"}]);var Kn=class t extends N{constructor(e){super(),this.name=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Kn.runtime=M;Kn.typeName="google.protobuf.UninterpretedOption";Kn.fields=M.util.newFieldList(()=>[{no:2,name:"name",kind:"message",T:eu,repeated:!0},{no:3,name:"identifier_value",kind:"scalar",T:9,opt:!0},{no:4,name:"positive_int_value",kind:"scalar",T:4,opt:!0},{no:5,name:"negative_int_value",kind:"scalar",T:3,opt:!0},{no:6,name:"double_value",kind:"scalar",T:1,opt:!0},{no:7,name:"string_value",kind:"scalar",T:12,opt:!0},{no:8,name:"aggregate_value",kind:"scalar",T:9,opt:!0}]);var eu=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};eu.runtime=M;eu.typeName="google.protobuf.UninterpretedOption.NamePart";eu.fields=M.util.newFieldList(()=>[{no:1,name:"name_part",kind:"scalar",T:9},{no:2,name:"is_extension",kind:"scalar",T:8}]);var Ln=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Ln.runtime=M;Ln.typeName="google.protobuf.FeatureSet";Ln.fields=M.util.newFieldList(()=>[{no:1,name:"field_presence",kind:"enum",T:M.getEnumType(Ym),opt:!0},{no:2,name:"enum_type",kind:"enum",T:M.getEnumType(Xm),opt:!0},{no:3,name:"repeated_field_encoding",kind:"enum",T:M.getEnumType(Qm),opt:!0},{no:4,name:"utf8_validation",kind:"enum",T:M.getEnumType(Zm),opt:!0},{no:5,name:"message_encoding",kind:"enum",T:M.getEnumType(eh),opt:!0},{no:6,name:"json_format",kind:"enum",T:M.getEnumType(th),opt:!0}]);var Ym;(function(t){t[t.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",t[t.EXPLICIT=1]="EXPLICIT",t[t.IMPLICIT=2]="IMPLICIT",t[t.LEGACY_REQUIRED=3]="LEGACY_REQUIRED"})(Ym||(Ym={}));M.util.setEnumType(Ym,"google.protobuf.FeatureSet.FieldPresence",[{no:0,name:"FIELD_PRESENCE_UNKNOWN"},{no:1,name:"EXPLICIT"},{no:2,name:"IMPLICIT"},{no:3,name:"LEGACY_REQUIRED"}]);var Xm;(function(t){t[t.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",t[t.OPEN=1]="OPEN",t[t.CLOSED=2]="CLOSED"})(Xm||(Xm={}));M.util.setEnumType(Xm,"google.protobuf.FeatureSet.EnumType",[{no:0,name:"ENUM_TYPE_UNKNOWN"},{no:1,name:"OPEN"},{no:2,name:"CLOSED"}]);var Qm;(function(t){t[t.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",t[t.PACKED=1]="PACKED",t[t.EXPANDED=2]="EXPANDED"})(Qm||(Qm={}));M.util.setEnumType(Qm,"google.protobuf.FeatureSet.RepeatedFieldEncoding",[{no:0,name:"REPEATED_FIELD_ENCODING_UNKNOWN"},{no:1,name:"PACKED"},{no:2,name:"EXPANDED"}]);var Zm;(function(t){t[t.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",t[t.NONE=1]="NONE",t[t.VERIFY=2]="VERIFY"})(Zm||(Zm={}));M.util.setEnumType(Zm,"google.protobuf.FeatureSet.Utf8Validation",[{no:0,name:"UTF8_VALIDATION_UNKNOWN"},{no:1,name:"NONE"},{no:2,name:"VERIFY"}]);var eh;(function(t){t[t.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",t[t.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",t[t.DELIMITED=2]="DELIMITED"})(eh||(eh={}));M.util.setEnumType(eh,"google.protobuf.FeatureSet.MessageEncoding",[{no:0,name:"MESSAGE_ENCODING_UNKNOWN"},{no:1,name:"LENGTH_PREFIXED"},{no:2,name:"DELIMITED"}]);var th;(function(t){t[t.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",t[t.ALLOW=1]="ALLOW",t[t.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT"})(th||(th={}));M.util.setEnumType(th,"google.protobuf.FeatureSet.JsonFormat",[{no:0,name:"JSON_FORMAT_UNKNOWN"},{no:1,name:"ALLOW"},{no:2,name:"LEGACY_BEST_EFFORT"}]);var Sf=class t extends N{constructor(e){super(),this.defaults=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Sf.runtime=M;Sf.typeName="google.protobuf.FeatureSetDefaults";Sf.fields=M.util.newFieldList(()=>[{no:1,name:"defaults",kind:"message",T:tu,repeated:!0},{no:4,name:"minimum_edition",kind:"enum",T:M.getEnumType(Qi),opt:!0},{no:5,name:"maximum_edition",kind:"enum",T:M.getEnumType(Qi),opt:!0}]);var tu=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};tu.runtime=M;tu.typeName="google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault";tu.fields=M.util.newFieldList(()=>[{no:3,name:"edition",kind:"enum",T:M.getEnumType(Qi),opt:!0},{no:2,name:"features",kind:"message",T:Ln,opt:!0}]);var nu=class t extends N{constructor(e){super(),this.location=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};nu.runtime=M;nu.typeName="google.protobuf.SourceCodeInfo";nu.fields=M.util.newFieldList(()=>[{no:1,name:"location",kind:"message",T:ru,repeated:!0}]);var ru=class t extends N{constructor(e){super(),this.path=[],this.span=[],this.leadingDetachedComments=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ru.runtime=M;ru.typeName="google.protobuf.SourceCodeInfo.Location";ru.fields=M.util.newFieldList(()=>[{no:1,name:"path",kind:"scalar",T:5,repeated:!0,packed:!0},{no:2,name:"span",kind:"scalar",T:5,repeated:!0,packed:!0},{no:3,name:"leading_comments",kind:"scalar",T:9,opt:!0},{no:4,name:"trailing_comments",kind:"scalar",T:9,opt:!0},{no:6,name:"leading_detached_comments",kind:"scalar",T:9,repeated:!0}]);var kf=class t extends N{constructor(e){super(),this.annotation=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};kf.runtime=M;kf.typeName="google.protobuf.GeneratedCodeInfo";kf.fields=M.util.newFieldList(()=>[{no:1,name:"annotation",kind:"message",T:ou,repeated:!0}]);var ou=class t extends N{constructor(e){super(),this.path=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ou.runtime=M;ou.typeName="google.protobuf.GeneratedCodeInfo.Annotation";ou.fields=M.util.newFieldList(()=>[{no:1,name:"path",kind:"scalar",T:5,repeated:!0,packed:!0},{no:2,name:"source_file",kind:"scalar",T:9,opt:!0},{no:3,name:"begin",kind:"scalar",T:5,opt:!0},{no:4,name:"end",kind:"scalar",T:5,opt:!0},{no:5,name:"semantic",kind:"enum",T:M.getEnumType(nh),opt:!0}]);var nh;(function(t){t[t.NONE=0]="NONE",t[t.SET=1]="SET",t[t.ALIAS=2]="ALIAS"})(nh||(nh={}));M.util.setEnumType(nh,"google.protobuf.GeneratedCodeInfo.Annotation.Semantic",[{no:0,name:"NONE"},{no:1,name:"SET"},{no:2,name:"ALIAS"}]);var Mt=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};Mt.runtime=h;Mt.typeName="google.protobuf.Empty";Mt.fields=h.util.newFieldList(()=>[]);var rh=class t extends N{secret="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.VerifyUserRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"secret",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},oh=class t extends N{secret="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.GroupInfoRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"secret",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ih=class t extends N{groupId="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.GroupID";static fields=h.util.newFieldList(()=>[{no:1,name:"group_id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},sh=class t extends N{contentId="";groupId="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.ShareRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content_id",kind:"scalar",T:9},{no:2,name:"group_id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},bf=class t extends N{secret="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.GroupInvite";static fields=h.util.newFieldList(()=>[{no:1,name:"secret",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ah=class t extends N{groups=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.Groups";static fields=h.util.newFieldList(()=>[{no:1,name:"groups",kind:"message",T:ii,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},sM=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.AnalyzeConversationRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},xo=class t extends N{email="";password="";username="";config;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.User";static fields=h.util.newFieldList(()=>[{no:1,name:"email",kind:"scalar",T:9},{no:2,name:"password",kind:"scalar",T:9},{no:3,name:"username",kind:"scalar",T:9},{no:4,name:"config",kind:"message",T:Ef}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ii=class t extends N{id="";name="";users=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.Group";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"users",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ef=class t extends N{domainWhitelist=[];offlineVoice=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.Config";static fields=h.util.newFieldList(()=>[{no:1,name:"domain_whitelist",kind:"scalar",T:9,repeated:!0},{no:2,name:"offline_voice",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},lh=class t extends N{user;success=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.LoginResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"user",kind:"message",T:xo},{no:2,name:"success",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var uh=class t extends N{title="";createTime=0;updateTime=0;mapping={};conversationId="";conversationTemplateId="";currentNode="";gizmoId="";isArchived=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Conversation";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"create_time",kind:"scalar",T:1},{no:3,name:"update_time",kind:"scalar",T:1},{no:4,name:"mapping",kind:"map",K:9,V:{kind:"message",T:SS}},{no:5,name:"conversation_id",kind:"scalar",T:9},{no:6,name:"conversation_template_id",kind:"scalar",T:9},{no:7,name:"current_node",kind:"scalar",T:9},{no:8,name:"gizmo_id",kind:"scalar",T:9},{no:9,name:"is_archived",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},SS=class t extends N{id="";message;parent="";children=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Node";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"message",kind:"message",T:kS},{no:3,name:"parent",kind:"scalar",T:9},{no:4,name:"children",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},kS=class t extends N{id="";author;createTime=0;content;status="";endTurn=!1;weight=0;metadata;recipient="";updateTime=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Message";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"author",kind:"message",T:ES},{no:3,name:"create_time",kind:"scalar",T:1},{no:4,name:"content",kind:"message",T:RS},{no:5,name:"status",kind:"scalar",T:9},{no:6,name:"end_turn",kind:"scalar",T:8},{no:7,name:"weight",kind:"scalar",T:5},{no:8,name:"metadata",kind:"message",T:bS},{no:9,name:"recipient",kind:"scalar",T:9},{no:10,name:"update_time",kind:"scalar",T:1}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},bS=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.MessageMetadata";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ES=class t extends N{role="";metadata;name="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Author";static fields=h.util.newFieldList(()=>[{no:1,name:"role",kind:"scalar",T:9},{no:2,name:"metadata",kind:"message",T:OS},{no:3,name:"name",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},RS=class t extends N{contentType="";textParts=[];imageParts=[];text="";parts=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Content";static fields=h.util.newFieldList(()=>[{no:1,name:"content_type",kind:"scalar",T:9},{no:2,name:"text_parts",kind:"scalar",T:9,repeated:!0},{no:3,name:"image_parts",kind:"message",T:CS,repeated:!0},{no:4,name:"text",kind:"scalar",T:9},{no:5,name:"parts",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},CS=class t extends N{contentType="";assetPointer="";sizeBytes=Ne.zero;width=0;height=0;fovea=0;metadata;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.ImageAsset";static fields=h.util.newFieldList(()=>[{no:1,name:"content_type",kind:"scalar",T:9},{no:2,name:"asset_pointer",kind:"scalar",T:9},{no:3,name:"size_bytes",kind:"scalar",T:3},{no:4,name:"width",kind:"scalar",T:5},{no:5,name:"height",kind:"scalar",T:5},{no:6,name:"fovea",kind:"scalar",T:5},{no:7,name:"metadata",kind:"message",T:TS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},TS=class t extends N{dalle;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Metadata";static fields=h.util.newFieldList(()=>[{no:1,name:"dalle",kind:"message",T:PS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},PS=class t extends N{genId="";prompt="";seed=0;serializationTitle="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.DalleMetadata";static fields=h.util.newFieldList(()=>[{no:1,name:"gen_id",kind:"scalar",T:9},{no:2,name:"prompt",kind:"scalar",T:9},{no:3,name:"seed",kind:"scalar",T:13},{no:4,name:"serialization_title",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},OS=class t extends N{attachments=[];timestamp="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.AuthorMetadata";static fields=h.util.newFieldList(()=>[{no:1,name:"attachments",kind:"message",T:NS,repeated:!0},{no:2,name:"timestamp_",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},NS=class t extends N{id="";name="";mimeType="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Attachment";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"mimeType",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var ch=class t extends N{nodes=[];edges=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="browser.History";static fields=h.util.newFieldList(()=>[{no:1,name:"nodes",kind:"message",T:MS,repeated:!0},{no:2,name:"edges",kind:"message",T:IS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},MS=class t extends N{id="";url="";title="";open=0;close=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="browser.Node";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"title",kind:"scalar",T:9},{no:4,name:"open",kind:"scalar",T:1},{no:5,name:"close",kind:"scalar",T:1}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},IS=class t extends N{from="";to="";tab="";visitTime=0;visitDuration=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="browser.Edge";static fields=h.util.newFieldList(()=>[{no:1,name:"from",kind:"scalar",T:9},{no:2,name:"to",kind:"scalar",T:9},{no:3,name:"tab",kind:"scalar",T:9},{no:4,name:"visit_time",kind:"scalar",T:1},{no:5,name:"visit_duration",kind:"scalar",T:1}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var fh=class t extends N{publishDir="";baseUrl="";title="";paginate=0;theme=[];enableInlineShortcodes=!1;enableRobotsTxt=!1;buildDrafts=!1;buildFuture=!1;buildExpired=!1;enableEmoji=!1;pygmentsUseClasses=!1;mainSections=[];minify;languages={};outputs={};params;markup;services;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HugoConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"publish_dir",kind:"scalar",T:9},{no:2,name:"base_url",kind:"scalar",T:9},{no:3,name:"title",kind:"scalar",T:9},{no:4,name:"paginate",kind:"scalar",T:5},{no:5,name:"theme",kind:"scalar",T:9,repeated:!0},{no:6,name:"enable_inline_shortcodes",kind:"scalar",T:8},{no:7,name:"enable_robots_txt",kind:"scalar",T:8},{no:8,name:"build_drafts",kind:"scalar",T:8},{no:9,name:"build_future",kind:"scalar",T:8},{no:10,name:"build_expired",kind:"scalar",T:8},{no:11,name:"enable_emoji",kind:"scalar",T:8},{no:12,name:"pygments_use_classes",kind:"scalar",T:8},{no:13,name:"main_sections",kind:"scalar",T:9,repeated:!0},{no:14,name:"minify",kind:"message",T:AS},{no:15,name:"languages",kind:"map",K:9,V:{kind:"message",T:LS}},{no:16,name:"outputs",kind:"map",K:9,V:{kind:"message",T:VS}},{no:17,name:"params",kind:"message",T:jS},{no:18,name:"markup",kind:"message",T:BS},{no:19,name:"services",kind:"message",T:zS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},AS=class t extends N{disableXml=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.MinifyConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"disable_xml",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},LS=class t extends N{languageName="";weight=0;title="";taxonomies={};menu={};params={};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.LanguageConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"language_name",kind:"scalar",T:9},{no:2,name:"weight",kind:"scalar",T:5},{no:3,name:"title",kind:"scalar",T:9},{no:4,name:"taxonomies",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"menu",kind:"map",K:9,V:{kind:"message",T:qS}},{no:6,name:"params",kind:"map",K:9,V:{kind:"scalar",T:9}}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Zs=class t extends N{name="";url="";weight=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.MenuItem";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"weight",kind:"scalar",T:5}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},DS=class t extends N{url="";text="";appendFilePath=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.EditPostConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"append_file_path",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},FS=class t extends N{disableHljs=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.AssetsConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"disable_hljs",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},BS=class t extends N{goldmark;highlight;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.MarkupConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"goldmark",kind:"message",T:JS},{no:2,name:"highlight",kind:"message",T:_S}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},JS=class t extends N{renderer;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GoldmarkConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"renderer",kind:"message",T:US}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},US=class t extends N{unsafe=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RendererConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"unsafe",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},_S=class t extends N{noClasses=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HighlightConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"no_classes",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},zS=class t extends N{instagram;twitter;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ServicesConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"instagram",kind:"message",T:dh},{no:2,name:"twitter",kind:"message",T:dh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},dh=class t extends N{disableInlineCss=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ServiceConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"disable_inline_css",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},VS=class t extends N{values=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RepeatedString";static fields=h.util.newFieldList(()=>[{no:1,name:"values",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},qS=class t extends N{items=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RepeatedMenuItem";static fields=h.util.newFieldList(()=>[{no:1,name:"items",kind:"message",T:Zs,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},jS=class t extends N{env="";description="";author="";defaultTheme="";showShareButtons=!1;showReadingTime=!1;displayFullLangName=!1;showPostNavLinks=!1;showBreadCrumbs=!1;showCodeCopyButtons=!1;showRssButtonInSectionTermList=!1;showAllPagesInArchive=!1;showPageNums=!1;showToc=!1;images=[];profileMode;homeInfoParams;socialIcons=[];editPost;assets;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ParamsConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"env",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9},{no:3,name:"author",kind:"scalar",T:9},{no:4,name:"default_theme",kind:"scalar",T:9},{no:5,name:"show_share_buttons",kind:"scalar",T:8},{no:6,name:"show_reading_time",kind:"scalar",T:8},{no:7,name:"display_full_lang_name",kind:"scalar",T:8},{no:8,name:"show_post_nav_links",kind:"scalar",T:8},{no:9,name:"show_bread_crumbs",kind:"scalar",T:8},{no:10,name:"show_code_copy_buttons",kind:"scalar",T:8},{no:11,name:"show_rss_button_in_section_term_list",kind:"scalar",T:8},{no:12,name:"show_all_pages_in_archive",kind:"scalar",T:8},{no:13,name:"show_page_nums",kind:"scalar",T:8},{no:14,name:"show_toc",kind:"scalar",T:8},{no:15,name:"images",kind:"scalar",T:9,repeated:!0},{no:16,name:"profile_mode",kind:"message",T:HS},{no:17,name:"home_info_params",kind:"message",T:WS},{no:18,name:"social_icons",kind:"message",T:GS,repeated:!0},{no:19,name:"edit_post",kind:"message",T:DS},{no:20,name:"assets",kind:"message",T:FS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},HS=class t extends N{enabled=!1;title="";imageUrl="";imageTitle="";buttons=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ProfileModeConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"title",kind:"scalar",T:9},{no:3,name:"image_url",kind:"scalar",T:9},{no:4,name:"image_title",kind:"scalar",T:9},{no:5,name:"buttons",kind:"message",T:$S,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},$S=class t extends N{name="";url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ButtonConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},WS=class t extends N{title="";content="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HomeInfoParamsConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"content",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},GS=class t extends N{name="";title="";url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.SocialIconConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"title",kind:"scalar",T:9},{no:3,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var ph=class t extends N{prompt="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.InferRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"prompt",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},mh=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.InferResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},hh=class t extends N{content;site;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.TypesResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Th},{no:2,name:"site",kind:"message",T:Th}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},gh=class t extends N{contentTypes=[];tags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GetSourcesRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content_types",kind:"scalar",T:9,repeated:!0},{no:2,name:"tags",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},yh=class t extends N{captureDevice=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.VoiceInputRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"capture_device",kind:"scalar",T:5}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},vh=class t extends N{segment;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.VoiceInputResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"segment",kind:"message",T:iu}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},wh=class t extends N{parent="";children=[];connect=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RelateRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"parent",kind:"scalar",T:9},{no:2,name:"children",kind:"scalar",T:9,repeated:!0},{no:3,name:"connect",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},xh=class t extends N{sources=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Sources";static fields=h.util.newFieldList(()=>[{no:1,name:"sources",kind:"message",T:KS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},KS=class t extends N{source;displayContent=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.EnumeratedSource";static fields=h.util.newFieldList(()=>[{no:1,name:"source",kind:"message",T:XS},{no:2,name:"display_content",kind:"message",T:YS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},YS=class t extends N{title="";description="";type="";content;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.DisplayContent";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9},{no:3,name:"type",kind:"scalar",T:9},{no:4,name:"content",kind:"message",T:Ge}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},XS=class t extends N{name="";type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Source";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"server",kind:"message",T:QS,oneof:"type"},{no:3,name:"folder",kind:"message",T:ZS,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},QS=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Server";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ZS=class t extends N{path="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Folder";static fields=h.util.newFieldList(()=>[{no:2,name:"path",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Sh=class t extends N{contentId="";tags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.SetTagsRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content_id",kind:"scalar",T:9},{no:2,name:"tags",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},kh=class t extends N{groupId="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.TagRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"group_id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},bh=class t extends N{tags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Tags";static fields=h.util.newFieldList(()=>[{no:1,name:"tags",kind:"message",T:Eh,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Eh=class t extends N{name="";subTags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Tag";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"sub_tags",kind:"message",T:t,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},es=class t extends N{contentIds=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ContentIDs";static fields=h.util.newFieldList(()=>[{no:1,name:"content_ids",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Rf=class t extends N{content;tags=[];related=[];parents=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Contents";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Ge},{no:2,name:"tags",kind:"scalar",T:9,repeated:!0},{no:3,name:"related",kind:"message",T:Ge,repeated:!0},{no:4,name:"parents",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Rh=class t extends N{query="";page=0;contentID="";groupID="";tags=[];contentTypes=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Query";static fields=h.util.newFieldList(()=>[{no:1,name:"query",kind:"scalar",T:9},{no:2,name:"page",kind:"scalar",T:13},{no:3,name:"contentID",kind:"scalar",T:9},{no:4,name:"groupID",kind:"scalar",T:9},{no:5,name:"tags",kind:"scalar",T:9,repeated:!0},{no:6,name:"content_types",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ch=class t extends N{storedContent=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Results";static fields=h.util.newFieldList(()=>[{no:1,name:"storedContent",kind:"message",T:ek,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ek=class t extends N{content;id="";related=[];title="";description="";image="";url="";user;tags=[];preview="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.StoredContent";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Ge},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"related",kind:"message",T:Ge,repeated:!0},{no:4,name:"title",kind:"scalar",T:9},{no:5,name:"description",kind:"scalar",T:9},{no:6,name:"image",kind:"scalar",T:9},{no:7,name:"url",kind:"scalar",T:9},{no:9,name:"user",kind:"message",T:xo},{no:10,name:"tags",kind:"message",T:Eh,repeated:!0},{no:11,name:"preview",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},aM=class t extends N{from="";to="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Edge";static fields=h.util.newFieldList(()=>[{no:1,name:"from",kind:"scalar",T:9},{no:2,name:"to",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ge=class t extends N{tags=[];createdAt="";uri="";id="";type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Content";static fields=h.util.newFieldList(()=>[{no:1,name:"tags",kind:"scalar",T:9,repeated:!0},{no:2,name:"created_at",kind:"scalar",T:9},{no:3,name:"uri",kind:"scalar",T:9},{no:4,name:"id",kind:"scalar",T:9},{no:6,name:"data",kind:"message",T:ea,oneof:"type"},{no:7,name:"normalized",kind:"message",T:tk,oneof:"type"},{no:8,name:"transformed",kind:"message",T:nk,oneof:"type"},{no:9,name:"post",kind:"message",T:Cf,oneof:"type"},{no:10,name:"site",kind:"message",T:ts,oneof:"type"},{no:11,name:"chatgpt_conversation",kind:"message",T:uh,oneof:"type"},{no:12,name:"browser_history",kind:"message",T:ch,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Cf=class t extends N{title="";summary="";content="";authors=[];draft=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Post";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"summary",kind:"scalar",T:9},{no:3,name:"content",kind:"scalar",T:9},{no:4,name:"authors",kind:"scalar",T:9,repeated:!0},{no:6,name:"draft",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},lM=class t extends N{url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GitRepo";static fields=h.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ea=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Data";static fields=h.util.newFieldList(()=>[{no:4,name:"text",kind:"message",T:lk,oneof:"type"},{no:5,name:"file",kind:"message",T:Tf,oneof:"type"},{no:6,name:"url",kind:"message",T:uk,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},tk=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Normalized";static fields=h.util.newFieldList(()=>[{no:3,name:"article",kind:"message",T:rk,oneof:"type"},{no:4,name:"html",kind:"message",T:ok,oneof:"type"},{no:6,name:"transcript",kind:"message",T:fk,oneof:"type"},{no:7,name:"readme",kind:"message",T:ik,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},nk=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Transformed";static fields=h.util.newFieldList(()=>[{no:1,name:"summary",kind:"message",T:sk,oneof:"type"},{no:2,name:"categories",kind:"message",T:ak,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},rk=class t extends N{title="";author="";length=0;excerpt="";siteName="";image="";favicon="";text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Article";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"author",kind:"scalar",T:9},{no:3,name:"length",kind:"scalar",T:5},{no:4,name:"excerpt",kind:"scalar",T:9},{no:5,name:"site_name",kind:"scalar",T:9},{no:6,name:"image",kind:"scalar",T:9},{no:7,name:"favicon",kind:"scalar",T:9},{no:8,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ok=class t extends N{html="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HTML";static fields=h.util.newFieldList(()=>[{no:1,name:"html",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ik=class t extends N{data="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ReadMe";static fields=h.util.newFieldList(()=>[{no:1,name:"data",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},sk=class t extends N{summary="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Summary";static fields=h.util.newFieldList(()=>[{no:1,name:"summary",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ak=class t extends N{categories=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Categories";static fields=h.util.newFieldList(()=>[{no:1,name:"categories",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Tf=class t extends N{file="";data=new Uint8Array(0);url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.File";static fields=h.util.newFieldList(()=>[{no:1,name:"file",kind:"scalar",T:9},{no:2,name:"data",kind:"scalar",T:12},{no:3,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},lk=class t extends N{data="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Text";static fields=h.util.newFieldList(()=>[{no:1,name:"data",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},uk=class t extends N{url="";crawl=!1;title="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.URL";static fields=h.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"crawl",kind:"scalar",T:8},{no:3,name:"title",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ck=class t extends N{id=0;startTime=Ne.zero;endTime=Ne.zero;text="";p="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Token";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"start_time",kind:"scalar",T:4},{no:3,name:"end_time",kind:"scalar",T:4},{no:4,name:"text",kind:"scalar",T:9},{no:5,name:"p",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},iu=class t extends N{num=0;tokens=[];text="";startTime=Ne.zero;endTime=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Segment";static fields=h.util.newFieldList(()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"tokens",kind:"message",T:ck,repeated:!0},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"start_time",kind:"scalar",T:4},{no:5,name:"end_time",kind:"scalar",T:4}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},fk=class t extends N{id="";name="";segments=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Transcript";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"segments",kind:"message",T:iu,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Th=class t extends N{msg;descLookup={};enumLookup={};packageName="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GRPCTypeInfo";static fields=h.util.newFieldList(()=>[{no:1,name:"msg",kind:"message",T:wo},{no:3,name:"desc_lookup",kind:"map",K:9,V:{kind:"message",T:wo}},{no:4,name:"enum_lookup",kind:"map",K:9,V:{kind:"message",T:oi}},{no:6,name:"package_name",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ts=class t extends N{sections=[];hugoConfig;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Site";static fields=h.util.newFieldList(()=>[{no:1,name:"sections",kind:"message",T:si,repeated:!0},{no:2,name:"hugo_config",kind:"message",T:fh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},si=class t extends N{tags=[];menu;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Section";static fields=h.util.newFieldList(()=>[{no:1,name:"tags",kind:"scalar",T:9,repeated:!0},{no:2,name:"menu",kind:"message",T:Zs}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var Ph=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.AnalyzeConversationRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Oh=class t extends N{prompt="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GenerateImagesRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"prompt",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Nh=class t extends N{images=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GenerateImagesResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"images",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Mh=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.DeleteSessionRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},su=class t extends N{id="";text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Prompt";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ih=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetPromptsRequest";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ah=class t extends N{prompts=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetPromptsResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"prompts",kind:"message",T:su,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Lh=class t extends N{prompt="";text=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.InferRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"prompt",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Dh=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.InferResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Fh=class t extends N{content;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.UploadContentRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Ge}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},uM=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.UploadContentResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Bh=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Jh=class t extends N{session;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"session",kind:"message",T:zh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Uh=class t extends N{page=Ne.zero;limit=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionsRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"page",kind:"scalar",T:4},{no:2,name:"limit",kind:"scalar",T:4}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},_h=class t extends N{sessions=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionsResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"sessions",kind:"message",T:zh,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},dk=class t extends N{id=0;startTime=Ne.zero;endTime=Ne.zero;text="";p="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Token";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"start_time",kind:"scalar",T:4},{no:3,name:"end_time",kind:"scalar",T:4},{no:4,name:"text",kind:"scalar",T:9},{no:5,name:"p",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Pf=class t extends N{num=0;tokens=[];text="";startTime=Ne.zero;endTime=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Segment";static fields=h.util.newFieldList(()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"tokens",kind:"message",T:dk,repeated:!0},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"start_time",kind:"scalar",T:4},{no:5,name:"end_time",kind:"scalar",T:4}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},zh=class t extends N{id="";name="";segments=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Session";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"segments",kind:"message",T:Pf,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},cM=class t extends N{filePath="";model="";language="";translate=!1;offset=Ne.zero;duration=Ne.zero;threads=0;speedup=!1;maxLen=0;maxTokens=0;wordThreshold=0;tokens=!1;colorize=!1;out="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.TranscriptionRequest";static fields=h.util.newFieldList(()=>[{no:14,name:"file_path",kind:"scalar",T:9},{no:1,name:"model",kind:"scalar",T:9},{no:2,name:"language",kind:"scalar",T:9},{no:3,name:"translate",kind:"scalar",T:8},{no:4,name:"offset",kind:"scalar",T:3},{no:5,name:"duration",kind:"scalar",T:3},{no:6,name:"threads",kind:"scalar",T:13},{no:7,name:"speedup",kind:"scalar",T:8},{no:8,name:"max_len",kind:"scalar",T:13},{no:9,name:"max_tokens",kind:"scalar",T:13},{no:10,name:"word_threshold",kind:"scalar",T:1},{no:11,name:"tokens",kind:"scalar",T:8},{no:12,name:"colorize",kind:"scalar",T:8},{no:13,name:"out",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},fM=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.RegisterFlags";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},dM=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.OCRText";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},pM=class t extends N{image=new Uint8Array(0);constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Image";static fields=h.util.newFieldList(()=>[{no:1,name:"image",kind:"scalar",T:12}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Vh=class t extends N{from="";to="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.ConvertFileRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"from",kind:"scalar",T:9},{no:2,name:"to",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},qh=class t extends N{captureDevice=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.ChatRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"capture_device",kind:"scalar",T:5}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Of=class t extends N{segment;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.ChatResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"segment",kind:"message",T:Pf}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},jh=class t extends N{id="";file="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.YouTubeVideo";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"file",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Nf=class t extends N{file="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.FilePath";static fields=h.util.newFieldList(()=>[{no:1,name:"file",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Hh=class t extends N{title="";filePath;transcript=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.YouTubeVideoResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"file_path",kind:"message",T:Nf},{no:3,name:"transcript",kind:"message",T:iu,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var $h=class t extends N{phoneNumbers=[];summary="";questions=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="ai.AnalyzeConversationResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"phone_numbers",kind:"scalar",T:9,repeated:!0},{no:2,name:"summary",kind:"scalar",T:9},{no:3,name:"questions",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},mM=class t extends N{categories=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="ai.AnalyzeContent";static fields=h.util.newFieldList(()=>[{no:1,name:"categories",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var hM={typeName:"protoflow.ProtoflowService",methods:{downloadYouTubeVideo:{name:"DownloadYouTubeVideo",I:jh,O:Hh,kind:le.Unary},getSessions:{name:"GetSessions",I:Uh,O:_h,kind:le.Unary},getSession:{name:"GetSession",I:Bh,O:Jh,kind:le.Unary},deleteSession:{name:"DeleteSession",I:Mh,O:Mt,kind:le.Unary},getPrompts:{name:"GetPrompts",I:Ih,O:Ah,kind:le.Unary},newPrompt:{name:"NewPrompt",I:su,O:su,kind:le.Unary},uploadContent:{name:"UploadContent",I:Fh,O:Of,kind:le.ServerStreaming},infer:{name:"Infer",I:Lh,O:Dh,kind:le.ServerStreaming},chat:{name:"Chat",I:qh,O:Of,kind:le.ServerStreaming},convertFile:{name:"ConvertFile",I:Vh,O:Nf,kind:le.Unary},generateImages:{name:"GenerateImages",I:Oh,O:Nh,kind:le.Unary},analyzeConversation:{name:"AnalyzeConversation",I:Ph,O:$h,kind:le.Unary}}};var gM={typeName:"content.ContentService",methods:{save:{name:"Save",I:Rf,O:es,kind:le.Unary},search:{name:"Search",I:Rh,O:Ch,kind:le.Unary},relate:{name:"Relate",I:wh,O:Mt,kind:le.Unary},analyze:{name:"Analyze",I:Ge,O:Rf,kind:le.Unary},delete:{name:"Delete",I:es,O:es,kind:le.Unary},getTags:{name:"GetTags",I:kh,O:bh,kind:le.Unary},setTags:{name:"SetTags",I:Sh,O:Mt,kind:le.Unary},publish:{name:"Publish",I:es,O:es,kind:le.Unary},getSources:{name:"GetSources",I:gh,O:xh,kind:le.Unary},infer:{name:"Infer",I:ph,O:mh,kind:le.ServerStreaming},types:{name:"Types",I:Mt,O:hh,kind:le.Unary},voiceInput:{name:"VoiceInput",I:yh,O:vh,kind:le.ServerStreaming}}};var yM={typeName:"user.UserService",methods:{register:{name:"Register",I:xo,O:xo,kind:le.Unary},login:{name:"Login",I:xo,O:lh,kind:le.Unary},logout:{name:"Logout",I:Mt,O:Mt,kind:le.Unary},resetPassword:{name:"ResetPassword",I:xo,O:Mt,kind:le.Unary},verifyUser:{name:"VerifyUser",I:rh,O:Mt,kind:le.Unary},updateConfig:{name:"UpdateConfig",I:Ef,O:Mt,kind:le.Unary},createGroupInvite:{name:"CreateGroupInvite",I:ih,O:bf,kind:le.Unary},joinGroup:{name:"JoinGroup",I:bf,O:ii,kind:le.Unary},groupInfo:{name:"GroupInfo",I:oh,O:ii,kind:le.Unary},createGroup:{name:"CreateGroup",I:ii,O:ii,kind:le.Unary},getGroups:{name:"GetGroups",I:Mt,O:ah,kind:le.Unary},deleteGroup:{name:"DeleteGroup",I:ii,O:Mt,kind:le.Unary},share:{name:"Share",I:sh,O:Mt,kind:le.Unary}}};var Wh=class t extends N{user="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.BanUserRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"user",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Gh=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.BanUserResponse";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Kh=class t extends N{message="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.SendMessageRequest";static fields=h.util.newFieldList(()=>[{no:2,name:"message",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Yh=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.SendMessageResponse";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Xh=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.ReceiveMessagesRequest";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Qh=class t extends N{user="";text="";timestamp=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.Message";static fields=h.util.newFieldList(()=>[{no:1,name:"user",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"timestamp",kind:"scalar",T:3}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var vM={typeName:"chat.ChatService",methods:{sendMessage:{name:"SendMessage",I:Kh,O:Yh,kind:le.Unary},receiveMessages:{name:"ReceiveMessages",I:Xh,O:Qh,kind:le.ServerStreaming},banUser:{name:"BanUser",I:Wh,O:Gh,kind:le.Unary}}};var Zh=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.Metric";static fields=h.util.newFieldList(()=>[{no:1,name:"http",kind:"message",T:pk,oneof:"type"},{no:2,name:"rrweb",kind:"message",T:mk,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},pk=class t extends N{method="";path="";query="";headers={};host="";remoteAddr="";userAgent="";referer="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.HTTPRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"method",kind:"scalar",T:9},{no:2,name:"path",kind:"scalar",T:9},{no:3,name:"query",kind:"scalar",T:9},{no:4,name:"headers",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"host",kind:"scalar",T:9},{no:6,name:"remoteAddr",kind:"scalar",T:9},{no:7,name:"userAgent",kind:"scalar",T:9},{no:8,name:"referer",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},mk=class t extends N{events="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.RRWeb";static fields=h.util.newFieldList(()=>[{no:1,name:"events",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},eg=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.SendResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var wM={typeName:"event.EventService",methods:{send:{name:"Send",I:Zh,O:eg,kind:le.Unary}}};var Pe;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(Pe||(Pe={}));function Mf(t){let e=Pe[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}var tg;function xM(t){if(!tg){tg={};for(let e of Object.values(Pe))typeof e!="string"&&(tg[Mf(e)]=e)}return tg[t]}var Et=class t extends Error{constructor(e,n=Pe.Unknown,r,o,i){super(Pz(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(r??{}),this.details=o??[],this.cause=i}static from(e,n=Pe.Unknown){return e instanceof t?e:e instanceof Error?e.name=="AbortError"?new t(e.message,Pe.Canceled):new t(e.message,n,void 0,void 0,e):new t(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error?Object.getPrototypeOf(e)===t.prototype?!0:e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e:!1}findDetails(e){let n="typeName"in e?{findMessage:o=>o===e.typeName?e:void 0}:e,r=[];for(let o of this.details){if(o instanceof N){n.findMessage(o.getType().typeName)&&r.push(o);continue}let i=n.findMessage(o.type);if(i)try{r.push(i.fromBinary(o.value))}catch{}}return r}};function Pz(t,e){return t.length?`[${Mf(e)}] ${t}`:`[${Mf(e)}]`}function hk(...t){let e=new Headers;for(let n of t)n.forEach((r,o)=>{e.append(o,r)});return e}function SM(t,e){let n={};for(let[r,o]of Object.entries(t.methods)){let i=e(Object.assign(Object.assign({},o),{localName:r,service:t}));i!=null&&(n[r]=i)}return n}function gk(t){let e,n=new Uint8Array(0);function r(o){let i=new Uint8Array(n.length+o.length);i.set(n),i.set(o,n.length),n=i}return new ReadableStream({start(){e=t.getReader()},async pull(o){let i;for(;;){if(i===void 0&&n.byteLength>=5){let l=0;for(let u=1;u<5;u++)l=(l<<8)+n[u];i={flags:n[0],length:l}}if(i!==void 0&&n.byteLength>=i.length+5)break;let a=await e.read();if(a.done)break;r(a.value)}if(i===void 0){if(n.byteLength==0){o.close();return}o.error(new Et("premature end of stream",Pe.DataLoss));return}let s=n.subarray(5,5+i.length);n=n.subarray(5+i.length),o.enqueue({flags:i.flags,data:s})}})}function yk(t,e){let n=new Uint8Array(e.length+5);n.set(e,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,t),r.setUint32(1,e.length),n}var Oz=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,l){s=t[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(u){i({value:u,done:a})},s)}},If=function(t){return this instanceof If?(this.v=t,this):new If(t)},Nz=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(p){return function(m){return Promise.resolve(m).then(p,f)}}function a(p,m){r[p]&&(o[p]=function(y){return new Promise(function(w,g){i.push([p,y,w,g])>1||l(p,y)})},m&&(o[p]=m(o[p])))}function l(p,m){try{u(r[p](m))}catch(y){d(i[0][3],y)}}function u(p){p.value instanceof If?Promise.resolve(p.value.v).then(c,f):d(i[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function d(p,m){p(m),i.shift(),i.length&&l(i[0][0],i[0][1])}},Mz=function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,i){e[o]=t[o]?function(s){return(n=!n)?{value:If(t[o](s)),done:!1}:i?i(s):s}:i}};function kM(t){return Nz(this,arguments,function*(){yield If(yield*Mz(Oz(t)))})}var bM=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,l){s=t[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(u){i({value:u,done:a})},s)}},au=function(t){return this instanceof au?(this.v=t,this):new au(t)},Iz=function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,i){e[o]=t[o]?function(s){return(n=!n)?{value:au(t[o](s)),done:!1}:i?i(s):s}:i}},Az=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(p){return function(m){return Promise.resolve(m).then(p,f)}}function a(p,m){r[p]&&(o[p]=function(y){return new Promise(function(w,g){i.push([p,y,w,g])>1||l(p,y)})},m&&(o[p]=m(o[p])))}function l(p,m){try{u(r[p](m))}catch(y){d(i[0][3],y)}}function u(p){p.value instanceof au?Promise.resolve(p.value.v).then(c,f):d(i[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function d(p,m){p(m),i.shift(),i.length&&l(i[0][0],i[0][1])}};function ta(t,e){return SM(t,n=>{switch(n.kind){case le.Unary:return Lz(e,t,n);case le.ServerStreaming:return Dz(e,t,n);case le.ClientStreaming:return Fz(e,t,n);case le.BiDiStreaming:return Bz(e,t,n);default:return null}})}function Lz(t,e,n){return async function(r,o){var i,s;let a=await t.unary(e,n,o?.signal,o?.timeoutMs,o?.headers,r,o?.contextValues);return(i=o?.onHeader)===null||i===void 0||i.call(o,a.header),(s=o?.onTrailer)===null||s===void 0||s.call(o,a.trailer),a.message}}function Dz(t,e,n){return function(r,o){return EM(t.stream(e,n,o?.signal,o?.timeoutMs,o?.headers,kM([r]),o?.contextValues),o)}}function Fz(t,e,n){return async function(r,o){var i,s,a,l,u,c;let f=await t.stream(e,n,o?.signal,o?.timeoutMs,o?.headers,r,o?.contextValues);(u=o?.onHeader)===null||u===void 0||u.call(o,f.header);let d;try{for(var p=!0,m=bM(f.message),y;y=await m.next(),i=y.done,!i;p=!0)l=y.value,p=!1,d=l}catch(w){s={error:w}}finally{try{!p&&!i&&(a=m.return)&&await a.call(m)}finally{if(s)throw s.error}}if(!d)throw new Et("protocol error: missing response message",Pe.Internal);return(c=o?.onTrailer)===null||c===void 0||c.call(o,f.trailer),d}}function Bz(t,e,n){return function(r,o){return EM(t.stream(e,n,o?.signal,o?.timeoutMs,o?.headers,r,o?.contextValues),o)}}function EM(t,e){let n=function(){var r,o;return Az(this,arguments,function*(){let i=yield au(t);(r=e?.onHeader)===null||r===void 0||r.call(e,i.header),yield au(yield*Iz(bM(i.message))),(o=e?.onTrailer)===null||o===void 0||o.call(e,i.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function RM(...t){let e=new AbortController,n=t.filter(o=>o!==void 0).concat(e.signal);for(let o of n){if(o.aborted){r.apply(o);break}o.addEventListener("abort",r)}function r(){e.signal.aborted||e.abort(vk(this));for(let o of n)o.removeEventListener("abort",r)}return e}function CM(t){let e=new AbortController,n=()=>{e.abort(new Et("the operation timed out",Pe.DeadlineExceeded))},r;return t!==void 0&&(t<=0?n():r=setTimeout(n,t)),{signal:e.signal,cleanup:()=>clearTimeout(r)}}function vk(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;let e=new Error("This operation was aborted");return e.name="AbortError",e}function ng(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function rg(t,e,n){let r=typeof e=="string"?e:e.typeName,o=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${r}/${o}`)}function wk(t,e){return e instanceof t?e:new t(e)}function TM(t,e){function n(r){return r.done===!0?r:{done:r.done,value:wk(t,r.value)}}return{[Symbol.asyncIterator](){let r=e[Symbol.asyncIterator](),o={next:()=>r.next().then(n)};return r.throw!==void 0&&(o.throw=i=>r.throw(i).then(n)),r.return!==void 0&&(o.return=i=>r.return(i).then(n)),o}}}function og(t){var e;let n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function ig(t,e,n,r){let o=e?PM(t.I,r):OM(t.I,n);return{parse:(e?PM(t.O,r):OM(t.O,n)).parse,serialize:o.serialize}}function PM(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Et(`parse binary: ${o}`,Pe.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Et(`serialize binary: ${o}`,Pe.Internal)}}}}function OM(t,e){var n,r;let o=(n=e?.textEncoder)!==null&&n!==void 0?n:new TextEncoder,i=(r=e?.textDecoder)!==null&&r!==void 0?r:new TextDecoder,s=og(e);return{parse(a){try{let l=i.decode(a);return t.fromJsonString(l,s)}catch(l){throw Et.from(l,Pe.InvalidArgument)}},serialize(a){try{let l=a.toJsonString(s);return o.encode(l)}catch(l){throw Et.from(l,Pe.Internal)}}}}var Jz=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;var NM="application/proto",MM="application/json",IM="application/connect+proto",AM="application/connect+json";function LM(t){let e=t?.match(Jz);if(!e)return;let n=!!e[1],r=!!e[3];return{stream:n,binary:r}}function Af(t,e,n){if(e&&new Headers(e).forEach((s,a)=>n.metadata.append(a,s)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;let r=xM(t.code);if(r===void 0)throw n;let o=t.message;if(o!=null&&typeof o!="string")throw n;let i=new Et(o??"",r,e);if("details"in t&&Array.isArray(t.details))for(let s of t.details){if(s===null||typeof s!="object"||Array.isArray(s)||typeof s.type!="string"||typeof s.value!="string"||"debug"in s&&typeof s.debug!="object")throw n;try{i.details.push({type:s.type,value:Xi.dec(s.value),debug:s.debug})}catch{throw n}}return i}var sg=2;function xk(t){let e=new Et("invalid end stream",Pe.InvalidArgument),n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;let r=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(let[i,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(a=>typeof a!="string"))throw e;for(let a of s)r.append(i,a)}}let o="error"in n?Af(n.error,r,e):void 0;return{metadata:r,error:o}}var Lf="Content-Type",DM="Content-Length",ag="Content-Encoding";var Sk="Accept-Encoding";var FM="Connect-Timeout-Ms",lg="Connect-Protocol-Version",BM="User-Agent";function JM(t){switch(t){case 400:return Pe.InvalidArgument;case 401:return Pe.Unauthenticated;case 403:return Pe.PermissionDenied;case 404:return Pe.Unimplemented;case 408:return Pe.DeadlineExceeded;case 409:return Pe.Aborted;case 412:return Pe.FailedPrecondition;case 413:return Pe.ResourceExhausted;case 415:return Pe.Internal;case 429:return Pe.Unavailable;case 431:return Pe.ResourceExhausted;case 502:return Pe.Unavailable;case 503:return Pe.Unavailable;case 504:return Pe.Unavailable;default:return Pe.Unknown}}function ug(t){let e=new Headers,n=new Headers;return t.forEach((r,o)=>{o.toLowerCase().startsWith("trailer-")?n.set(o.substring(8),r):e.set(o,r)}),[e,n]}var cg="1";function fg(t,e,n,r,o){let i=new Headers(r??{});return n!==void 0&&i.set(FM,`${n}`),i.set(Lf,t==le.Unary?e?NM:MM:e?IM:AM),i.set(lg,cg),o&&i.set(BM,"connect-es/1.3.0"),i}function dg(t,e,n){let r=n.get("Content-Type"),o=LM(r);if(e!==200){let i=new Et(`HTTP ${e}`,JM(e),n);if(t==le.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:i};throw i}return{isUnaryError:!1}}var UM="application/";function _z(t,e){return e?Xi.enc(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(t))}function kk(t,e,n){let r=`?connect=v${cg}`,o=t.header.get(Lf);o?.indexOf(UM)===0&&(r+="&encoding="+encodeURIComponent(o.slice(UM.length)));let i=t.header.get(ag);i!==null&&i!=="identity"&&(r+="&compression="+encodeURIComponent(i),n=!0),n&&(r+="&base64=1"),r+="&message="+_z(e,n);let s=t.url+r,a=new Headers(t.header);return[lg,Lf,DM,ag,Sk].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:s,header:a})}function bk(t){let e=zM(t.next,t.interceptors),[n,r,o]=_M(t),i=Object.assign(Object.assign({},t.req),{message:wk(t.req.method.I,t.req.message),signal:n});return e(i).then(s=>(o(),s),r)}function Ek(t){let e=zM(t.next,t.interceptors),[n,r,o]=_M(t),i=Object.assign(Object.assign({},t.req),{message:TM(t.req.method.I,t.req.message),signal:n}),s=!1;return n.addEventListener("abort",function(){var a,l;let u=t.req.message[Symbol.asyncIterator]();s||(a=u.throw)===null||a===void 0||a.call(u,this.reason).catch(()=>{}),(l=u.return)===null||l===void 0||l.call(u).catch(()=>{})}),e(i).then(a=>Object.assign(Object.assign({},a),{message:{[Symbol.asyncIterator](){let l=a.message[Symbol.asyncIterator]();return{next(){return l.next().then(u=>(u.done==!0&&(s=!0,o()),u),r)}}}}}),r)}function _M(t){let{signal:e,cleanup:n}=CM(t.timeoutMs),r=RM(t.signal,e);return[r.signal,function(i){let s=Et.from(e.aborted?vk(e):i);return r.abort(s),n(),Promise.reject(s)},function(){n(),r.abort()}]}function zM(t,e){var n;return(n=e?.concat().reverse().reduce((r,o)=>o(r),t))!==null&&n!==void 0?n:t}function VM(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}}var Df=function(t){return this instanceof Df?(this.v=t,this):new Df(t)},zz=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(p){return function(m){return Promise.resolve(m).then(p,f)}}function a(p,m){r[p]&&(o[p]=function(y){return new Promise(function(w,g){i.push([p,y,w,g])>1||l(p,y)})},m&&(o[p]=m(o[p])))}function l(p,m){try{u(r[p](m))}catch(y){d(i[0][3],y)}}function u(p){p.value instanceof Df?Promise.resolve(p.value.v).then(c,f):d(i[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function d(p,m){p(m),i.shift(),i.length&&l(i[0][0],i[0][1])}};function Rk(t){var e;VM();let n=(e=t.useBinaryFormat)!==null&&e!==void 0?e:!1;return{async unary(r,o,i,s,a,l,u){var c;let{serialize:f,parse:d}=ig(o,n,t.jsonOptions,t.binaryOptions);return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await bk({interceptors:t.interceptors,signal:i,timeoutMs:s,req:{stream:!1,service:r,method:o,url:rg(t.baseUrl,r,o),init:{method:"POST",credentials:(c=t.credentials)!==null&&c!==void 0?c:"same-origin",redirect:"error",mode:"cors"},header:fg(o.kind,n,s,a,!1),contextValues:u??ng(),message:l},next:async p=>{var m;let y=t.useHttpGet===!0&&o.idempotency===mf.NoSideEffects,w=null;y?p=kk(p,f(p.message),n):w=f(p.message);let v=await((m=t.fetch)!==null&&m!==void 0?m:globalThis.fetch)(p.url,Object.assign(Object.assign({},p.init),{headers:p.header,signal:p.signal,body:w})),{isUnaryError:k,unaryError:S}=dg(o.kind,v.status,v.headers);if(k)throw Af(await v.json(),hk(...ug(v.headers)),S);let[b,x]=ug(v.headers);return{stream:!1,service:r,method:o,header:b,message:n?d(new Uint8Array(await v.arrayBuffer())):o.O.fromJson(await v.json(),og(t.jsonOptions)),trailer:x}}})},async stream(r,o,i,s,a,l,u){var c;let{serialize:f,parse:d}=ig(o,n,t.jsonOptions,t.binaryOptions);function p(y,w,g){return zz(this,arguments,function*(){let k=gk(y).getReader(),S=!1;for(;;){let b=yield Df(k.read());if(b.done)break;let{flags:x,data:T}=b.value;if((x&sg)===sg){S=!0;let E=xk(T);if(E.error){let O=E.error;throw g.forEach((A,B)=>{O.metadata.append(B,A)}),O}E.metadata.forEach((O,A)=>w.set(A,O));continue}yield yield Df(d(T))}if(!S)throw"missing EndStreamResponse"})}async function m(y){if(o.kind!=le.ServerStreaming)throw"The fetch API does not support streaming request bodies";let w=await y[Symbol.asyncIterator]().next();if(w.done==!0)throw"missing request message";return yk(0,f(w.value))}return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await Ek({interceptors:t.interceptors,timeoutMs:s,signal:i,req:{stream:!0,service:r,method:o,url:rg(t.baseUrl,r,o),init:{method:"POST",credentials:(c=t.credentials)!==null&&c!==void 0?c:"same-origin",redirect:"error",mode:"cors"},header:fg(o.kind,n,s,a,!1),contextValues:u??ng(),message:l},next:async y=>{var w;let v=await((w=t.fetch)!==null&&w!==void 0?w:globalThis.fetch)(y.url,Object.assign(Object.assign({},y.init),{headers:y.header,signal:y.signal,body:await m(y.message)}));if(dg(o.kind,v.status,v.headers),v.body===null)throw"missing response body";let k=new Headers;return Object.assign(Object.assign({},y),{header:v.headers,trailer:k,message:p(v.body,k,v.headers)})}})}}}var Vz="https://demo.lunabrain.com",Ff=Rk({baseUrl:`${Vz}/api`||"error"}),qz=ta(hM,Ff),vt=ta(gM,Ff),So=ta(yM,Ff),pg=ta(vM,Ff),eZ=ta(wM,Ff);var qM=rn(void 0);qM.debugLabel="userAtom";var ko=()=>{let[t,e]=Nt(qM);return{user:t,register:async(s,a)=>{try{let l=await So.register({email:s,password:a});e(l),He.success("Successfully registered!")}catch(l){console.error(l),He.error("Failed to register: "+l.message)}},tryLogin:async()=>{try{let s=await So.login({});s.success&&e(s.user)}catch(s){console.error(s),He.error("Failed to login: "+s.message)}},login:async(s,a)=>{try{let l=await So.login({email:s,password:a});e(l.user),He.success("Logged in")}catch(l){He.error("Failed to login"),console.error("failed to login",l)}},logout:async()=>{try{let s=await So.logout({});e(void 0),console.log(s),He.success("Logged out")}catch(s){He.error("Failed to logout"),console.error("failed to logout",s)}}}};var on=q(ye(),1),ns=({next:t,allowRegister:e})=>{let[n,r]=(0,mg.useState)(""),[o,i]=(0,mg.useState)(""),{login:s,register:a}=ko(),[l,u]=(0,mg.useState)("login");return(0,on.jsx)(on.Fragment,{children:(0,on.jsx)("div",{className:"mt-4",children:(0,on.jsx)("div",{className:"items-center px-5 py-12 lg:px-20",children:(0,on.jsxs)("div",{className:"flex flex-col w-full max-w-md p-10 mx-auto",children:[(0,on.jsx)("a",{className:"btn",href:`/auth/google${t?"?next="+t:""}`,children:"login with google"}),(0,on.jsx)("div",{className:"divider",children:"or"}),(0,on.jsxs)("div",{className:"tabs tabs-lifted",children:[(0,on.jsx)("a",{className:`tab ${l==="login"?"tab-active":""}`,onClick:()=>u("login"),children:"login"}),e&&(0,on.jsx)("a",{className:`tab ${l==="register"?"tab-active":""}`,onClick:()=>u("register"),children:"register"})]}),(0,on.jsxs)("div",{className:"space-y-2 w-full mx-auto my-6",children:[(0,on.jsx)("input",{className:"input input-bordered w-full",type:"email",placeholder:"email",value:n,onChange:c=>r(c.target.value)}),(0,on.jsx)("input",{className:"input input-bordered w-full",type:"password",placeholder:"password",value:o,onChange:c=>i(c.target.value)})]}),(0,on.jsx)("button",{className:"btn btn-primary",onClick:()=>{l==="login"?s(n,o):a(n,o)},children:l==="login"?"login":"register"})]})})})})};var na=q(ge(),1);var Hz=q(ye(),1),jz=(0,na.createContext)({}),jM=()=>(0,na.useContext)(jz);var SR=q(ge(),1);var HM=q(ge(),1),$M=rn(void 0);$M.debugLabel="sourcesAtom";var WM=rn(void 0);WM.debugLabel="selectedSourceAtom";var GM=rn([]);GM.debugLabel="typesAtom";var KM=rn([]);KM.debugLabel="tagsAtom";var lu=()=>{let[t,e]=Nt($M),[n,r]=Nt(WM),[o,i]=Nt(GM),[s,a]=Nt(KM);return{sources:t,selected:n,setSelected:r,getSources:async()=>{let u=await vt.getSources({contentTypes:o,tags:s});e(u.sources),u.sources.length>0&&r(u.sources[0])},types:o,setTypes:i,tags:s,setTags:a}},YM=rn(void 0);YM.debugLabel="editedContentAtom";var XM=rn(void 0);XM.debugLabel="selectedContentAtom";var uu=()=>{let[t,e]=Nt(YM),[n,r]=Nt(XM);return{editedContent:t,editContent:s=>{s===void 0?(window.history.pushState({},"","/app"),e(void 0)):(s.id!==void 0&&s.id!==""&&window.history.pushState({},"",`/app/content/${s.id}`),e(s))},selectedContent:n,selectContent:s=>{s===void 0?(window.history.pushState({},"","/app"),r(void 0)):(s.id!==void 0&&s.id!==""&&window.history.pushState({},"",`/app/content/${s.id}`),r(s))}}},$z=rn(!1);$z.debugLabel="recordingAtom";var QM=q(ye(),1);var cu=q(ge(),1);function Wz({title:t,titleId:e,...n},r){return cu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?cu.createElement("title",{id:e},t):null,cu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}var Gz=cu.forwardRef(Wz),Ck=Gz;var fu=q(ge(),1);function Kz({title:t,titleId:e,...n},r){return fu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?fu.createElement("title",{id:e},t):null,fu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"}))}var Yz=fu.forwardRef(Kz),Bf=Yz;var du=q(ge(),1);function Xz({title:t,titleId:e,...n},r){return du.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?du.createElement("title",{id:e},t):null,du.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"}))}var Qz=du.forwardRef(Xz),Tk=Qz;var pu=q(ge(),1);function Zz({title:t,titleId:e,...n},r){return pu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?pu.createElement("title",{id:e},t):null,pu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}var eV=pu.forwardRef(Zz),Pk=eV;var mu=q(ge(),1);function tV({title:t,titleId:e,...n},r){return mu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?mu.createElement("title",{id:e},t):null,mu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}var nV=mu.forwardRef(tV),Ok=nV;var hu=q(ge(),1);function rV({title:t,titleId:e,...n},r){return hu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?hu.createElement("title",{id:e},t):null,hu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5"}))}var oV=hu.forwardRef(rV),Nk=oV;var gu=q(ge(),1);function iV({title:t,titleId:e,...n},r){return gu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?gu.createElement("title",{id:e},t):null,gu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}var sV=gu.forwardRef(iV),Mk=sV;var yu=q(ge(),1);function aV({title:t,titleId:e,...n},r){return yu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?yu.createElement("title",{id:e},t):null,yu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))}var lV=yu.forwardRef(aV),Ik=lV;var vu=q(ge(),1);function uV({title:t,titleId:e,...n},r){return vu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?vu.createElement("title",{id:e},t):null,vu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}var cV=vu.forwardRef(uV),Jf=cV;function ra(t){return t!=null}var qa=q(ge(),1);function xn(t){this.content=t}xn.prototype={constructor:xn,find:function(t){for(var e=0;e>1}};xn.from=function(t){if(t instanceof xn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new xn(e)};var Ak=xn;function iI(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=iI(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function sI(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;ue&&r(l,o+a,i||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,o+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,s=0;se&&((sn)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||n>0?hg(r+1,s):hg(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new t(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;othis.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-o.type.rank),n}};Ue.none=[];var sa=class extends Error{},ee=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=lI(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(aI(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(K.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};ee.empty=new ee(K.empty,0,0);function aI(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(aI(i.content,e-o-1,n-o-1)))}function lI(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=lI(s.content,e-i-1,n);return a&&t.replaceChild(o,s.copy(a))}function fV(t,e,n){if(n.openStart>t.depth)throw new sa("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new sa("Inconsistent open depths");return uI(t,e,n,0)}function uI(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Uf(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(oa(t.nodeAfter,r),i++));for(let a=i;ao&&Jk(t,e,o+1),s=r.depth>o&&Jk(n,r,o+1),a=[];return Uf(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(cI(i,s),oa(ia(i,fI(t,e,n,r,o+1)),a)):(i&&oa(ia(i,yg(t,e,o+1)),a),Uf(e,n,o,a),s&&oa(ia(s,yg(n,r,o+1)),a)),Uf(r,null,o,a),new K(a)}function yg(t,e,n){let r=[];if(Uf(null,t,n,r),t.depth>n){let o=Jk(t,e,n+1);oa(ia(o,yg(t,e,n+1)),r)}return Uf(e,null,n,r),new K(r)}function dV(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(K.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var vg=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new aa(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),u=i-l;if(r.push(s,a,o+l),!u||(s=s.child(a),s.isText))break;i=u-1,o+=l+1}return new t(n,r,i)}static resolveCached(e,n){for(let o=0;oe&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),dI(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=K.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=K.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};Zr.prototype.text=void 0;var Uk=class t extends Zr{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):dI(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function dI(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var la=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new _k(e,n);if(r.next==null)return t.empty;let o=pI(r);r.next&&r.err("Unexpected trailing text");let i=SV(xV(o));return kV(i,r),i}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return i}).join(` -`)}};la.empty=new la(!0);var _k=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function pI(t){let e=[];do e.push(hV(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function hV(t){let e=[];do e.push(gV(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function gV(t){let e=wV(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=yV(t,e);else break;return e}function ZM(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function yV(t,e){let n=ZM(t),r=n;return t.eat(",")&&(t.next!="}"?r=ZM(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function vV(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function wV(t){if(t.eat("(")){let e=pI(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=vV(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function xV(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(i(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=i(s.exprs[l],a);if(l==s.exprs.length-1)return u;o(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c{u||o.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=e[r.join(",")]=new la(r.indexOf(t.length-1)>-1);for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new t(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}},zk=class{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}},zf=class t{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=yI(o.attrs),this.excluded=null;let i=hI(this.attrs);this.instance=i?new Ue(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ue(this,gI(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new t(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n-1}},xg=class{constructor(e){this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Ak.from(e.nodes),n.marks=Ak.from(e.marks||{}),this.nodes=wg.compile(this.spec.nodes,this),this.marks=zf.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=r[s]||(r[s]=la.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?tI(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:tI(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof wg){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new Uk(r,r.defaultAttrs,e,Ue.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return Zr.fromJSON(this,e)}markFromJSON(e){return Ue.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function tI(t,e){let n=[];for(let r=0;r-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}var ua=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new bg(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new bg(this,n,!0);return r.addAll(e,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;oe.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s{r(s=rI(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=rI(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},vI={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},bV={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},wI={ol:!0,ul:!0},Sg=1,kg=2,_f=4;function nI(t,e,n){return e!=null?(e?Sg:0)|(e==="full"?kg:0):t&&t.whitespace=="pre"?Sg|kg:n&~_f}var wu=class{constructor(e,n,r,o,i,s,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=a,this.content=[],this.activeMarks=Ue.none,this.stashMarks=[],this.match=s||(a&_f?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Sg)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=K.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;nthis.addAll(e)),s&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` -`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=Ue.none,r=Ue.none;for(let o=0;o{s.clearMark(a)&&(r=a.addToSet(r))}):n=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(n),s.consuming===!1)i=s;else break}return[n,r]}addElementByRule(e,n,r){let o,i,s;n.node?(i=this.parser.schema.nodes[n.node],i.isLeaf?this.insertNode(i.create(n.attrs))||this.leafFallback(e):o=this.enter(i,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}o&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}addAll(e,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let n,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=i,!s.length)||i.solid)break}if(!n)return!1;this.sync(r);for(let o=0;othis.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=PV(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let s=o.popFromStashMark(e);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==n)break}}};function EV(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&wI.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function RV(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function CV(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function rI(t){let e={};for(let n in t)e[n]=t[n];return e}function TV(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l{if(i.length||s.marks.length){let a=0,l=0;for(;a=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&t.renderSpec(Bk(r),o(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let o=n[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));let s,a=r?e.createElementNS(r,o):e.createElement(o),l=n[1],u=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let c in l)if(l[c]!=null){let f=c.indexOf(" ");f>0?a.setAttributeNS(c.slice(0,f),c.slice(f+1),l[c]):a.setAttribute(c,l[c])}}for(let c=u;cu)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:d,contentDOM:p}=t.renderSpec(e,f,r);if(a.appendChild(d),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:a,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=oI(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return oI(e.marks)}};function oI(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Bk(t){return t.document||window.document}var kI=65535,bI=Math.pow(2,16);function OV(t,e){return t+e*bI}function xI(t){return t&kI}function NV(t){return(t-(t&kI))/bI}var EI=1,RI=2,Eg=4,CI=8,jf=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&CI)>0}get deletedBefore(){return(this.delInfo&(EI|Eg))>0}get deletedAfter(){return(this.delInfo&(RI|Eg))>0}get deletedAcross(){return(this.delInfo&Eg)>0}},li=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=xI(e);if(!this.inverted)for(let o=0;oe)break;let u=this.ranges[a+i],c=this.ranges[a+s],f=l+u;if(e<=f){let d=u?e==l?-1:e==f?1:n:n,p=l+o+(d<0?0:c);if(r)return p;let m=e==(n<0?l:f)?null:OV(a/3,e-l),y=e==l?RI:e==f?EI:Eg;return(n<0?e!=l:e!=f)&&(y|=CI),new jf(p,y,m)}o+=c-u}return r?e+o:new jf(e+o,0,null)}touches(e,n){let r=0,o=xI(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;ae)break;let u=this.ranges[a+i],c=l+u;if(e<=c&&a==o*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o=0;n--){let o=e.getMirror(n);this.appendMap(e.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&l!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return sn.fromReplace(e,this.from,this.to,i)}invert(){return new ca(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};jt.jsonID("addMark",$f);var ca=class t extends jt{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(Wk(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return sn.fromReplace(e,this.from,this.to,r)}invert(){return new $f(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};jt.jsonID("removeMark",ca);var Wf=class t extends jt{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return sn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return sn.fromReplace(e,this.pos,this.pos+1,new ee(K.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;or.pos?null:new t(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}};jt.jsonID("replaceAround",It);function Hk(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function MV(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,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,e),p=Math.min(u+l.nodeSize,n),m=r.addToSet(f);for(let y=0;yt.step(l)),i.forEach(l=>t.step(l))}function IV(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof zf){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;ct.step(new ca(s.from,s.to,s.style)))}function AV(t,e,n,r=n.contentMatch){let o=t.doc.nodeAt(e),i=[],s=e+1;for(let a=0;a=0;a--)t.step(i[a])}function LV(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ui(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(rn;m--)y||r.index(m)>0?(y=!0,c=K.from(r.node(m).copy(c)),f++):l--;let d=K.empty,p=0;for(let m=i,y=!1;m>n;m--)y||o.after(m+1)=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=K.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new It(o,i,o,i,new ee(r,0,0),n.length,!0))}function UV(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&_V(t.doc,t.mapping.slice(i).map(a),r)){t.clearIncompatible(t.mapping.slice(i).map(a,1),r);let l=t.mapping.slice(i),u=l.map(a,1),c=l.map(a+s.nodeSize,1);return t.step(new It(u,c,u+1,c-1,new ee(K.from(r.create(o,null,s.marks)),0,0),1,!0)),!1}})}function _V(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function zV(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new It(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ee(K.from(s),0,0),1,!0))}function Tr(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let u=o.depth-1,c=n-2;u>i;u--,c--){let f=o.node(u),d=o.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),m=r&&r[c+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!y.type.validContent(p))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function VV(t,e,n=1,r){let o=t.doc.resolve(e),i=K.empty,s=K.empty;for(let a=o.depth,l=o.depth-n,u=n-1;a>l;a--,u--){i=K.from(o.node(a).copy(i));let c=r&&r[u];s=K.from(c?c.type.create(c.attrs,s):o.node(a).copy(s))}t.step(new Dn(e,e,new ee(i.append(s),n,n),!0))}function eo(t,e){let n=t.resolve(e),r=n.index();return TI(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function TI(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function bu(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&TI(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function qV(t,e,n){let r=new Dn(e-n,e+n,ee.empty,!0);t.step(r)}function jV(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),u=r.node(s),c=!1;if(i==1)c=u.canReplace(l,l,o);else{let f=u.contentMatchAt(l).findWrapping(o.firstChild.type);c=f&&u.canReplaceWith(l,l,f[0])}if(c)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Tg(t,e,n=e,r=ee.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return OI(o,i,r)?new Dn(e,n,r):new $k(o,i,r).fit()}function OI(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var $k=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=K.from(e.node(o).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 e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ee(i,s,a);return e>-1?new It(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Dn(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=qk(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,f=null;if(n==1&&(s?u.matchType(s.type)||(f=u.fillBefore(K.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:c};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=qk(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ee(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=qk(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ee(Vf(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ee(Vf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let y=0;y1||l==0||y.content.size)&&(f=w,c.push(NI(y.mark(d.allowedMarks(y.marks)),u==1?l:0,u==a.childCount?p:-1)))}let m=u==a.childCount;m||(p=-1),this.placed=qf(this.placed,n,K.from(c)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,w=a;y1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n=0;a--){let{match:l,type:u}=this.frontier[a],c=jk(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=qf(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=qf(this.placed,this.depth,K.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=qf(this.placed,this.frontier.length,n))}};function Vf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Vf(t.firstChild.content,e-1,n)))}function qf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(qf(t.lastChild.content,e-1,n)))}function qk(t,e){for(let n=0;n1&&(r=r.replaceChild(0,NI(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),t.copy(r)}function jk(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!HV(n,i.content,s)?a:null}function HV(t,e,n){for(let r=n;r0;d--,p--){let m=o.node(d).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(d)>-1?a=d:o.before(d)==p&&s.splice(1,0,-d)}let l=s.indexOf(a),u=[],c=r.openStart;for(let d=r.content,p=0;;p++){let m=d.firstChild;if(u.push(m),p==r.openStart)break;d=m.content}for(let d=c-1;d>=0;d--){let p=u[d],m=$V(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(a)-1)))c=d;else if(m||!p.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+c+1)%(r.openStart+1),m=u[p];if(m)for(let y=0;y=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let p=s[d];p<0||(e=o.before(p),n=i.after(p))}}function MI(t,e,n,r,o){if(er){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(K.empty,!0))}return t}function GV(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=jV(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ee(K.from(r),0,0))}function KV(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=II(r,o);for(let s=0;s0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function II(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(ie.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}var Rg=class t extends jt{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return sn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return sn.fromReplace(e,this.pos,this.pos+1,new ee(K.from(o),0,n.isLeaf?0:1))}getMap(){return li.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}};jt.jsonID("attr",Rg);var Cg=class t extends jt{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return sn.ok(r)}getMap(){return li.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}};jt.jsonID("docAttr",Cg);var xu=class extends Error{};xu=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};xu.prototype=Object.create(Error.prototype);xu.prototype.constructor=xu;xu.prototype.name="TransformError";var Su=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new xu(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ee.empty){let o=Tg(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ee(K.from(r),0,0))}delete(e,n){return this.replace(e,n,ee.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return WV(this,e,n,r),this}replaceRangeWith(e,n,r){return GV(this,e,n,r),this}deleteRange(e,n){return KV(this,e,n),this}lift(e,n){return DV(this,e,n),this}join(e,n=1){return qV(this,e,n),this}wrap(e,n){return JV(this,e,n),this}setBlockType(e,n=e,r,o=null){return UV(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return zV(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Rg(e,n,r)),this}setDocAttribute(e,n){return this.step(new Cg(e,n)),this}addNodeMark(e,n){return this.step(new Wf(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ue)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Gf(e,n)),this}split(e,n=1,r){return VV(this,e,n,r),this}addMark(e,n,r){return MV(this,e,n,r),this}removeMark(e,n,r){return IV(this,e,n,r),this}clearIncompatible(e,n,r){return AV(this,e,n,r),this}};var Gk=Object.create(null),Ee=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new Yk(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;i--){let s=n<0?Eu(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):Eu(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new cr(e.node(0))}static atStart(e){return Eu(e,e,0,0,1)||new cr(e)}static atEnd(e){return Eu(e,e,e.content.size,e.childCount,-1)||new cr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=Gk[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in Gk)throw new RangeError("Duplicate use of selection JSON ID "+e);return Gk[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Me.between(this.$anchor,this.$head).getBookmark()}};Ee.prototype.visible=!0;var Yk=class{constructor(e,n){this.$from=e,this.$to=n}},AI=!1;function LI(t){!AI&&!t.parent.inlineContent&&(AI=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var Me=class t extends Ee{constructor(e,n=e){LI(e),LI(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ee.near(r);let o=e.resolve(n.map(this.anchor));return new t(o.parent.inlineContent?o:r,r)}replace(e,n=ee.empty){if(super.replace(e,n),n==ee.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Og(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Ee.findFrom(n,r,!0)||Ee.findFrom(n,-r,!0);if(i)n=i.$head;else return Ee.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Ee.findFrom(e,-r,!0)||Ee.findFrom(e,r,!0)).$anchor,e.pos0?0:1);o>0?s=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&he.isSelectable(a))return he.create(t,n-(o<0?a.nodeSize:0))}else{let l=Eu(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function DI(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=c)}),t.setSelection(Ee.near(t.doc.resolve(s),n))}var FI=1,Pg=2,BI=4,Qk=class extends Su{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Pg,this}ensureMarks(e){return Ue.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Pg)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Pg,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ue.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(Ee.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=BI,this}get scrolledIntoView(){return(this.updated&BI)>0}};function JI(t,e){return!e||!t?t:t.bind(e)}var fa=class{constructor(e,n,r){this.name=e,this.init=JI(n.init,r),this.apply=JI(n.apply,r)}},XV=[new fa("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new fa("selection",{init(t,e){return t.selection||Ee.atStart(e.doc)},apply(t){return t.selection}}),new fa("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new fa("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],Kf=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=XV.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 fa(r.key,r.spec.state,r))})}},Ng=class t{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Kf(e.schema,e.plugins),i=new t(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=Zr.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Ee.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=u.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function UI(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=UI(o,e,{})),n[r]=o}return n}var At=class{constructor(e){this.spec=e,this.props={},e.props&&UI(e.props,this,this.props),this.key=e.key?e.key.key:_I("plugin")}getState(e){return e[this.key]}},Kk=Object.create(null);function _I(t){return t in Kk?t+"$"+ ++Kk[t]:(Kk[t]=0,t+"$")}var an=class{constructor(e="key"){this.key=_I(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Fn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Zf=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},zI=null,fi=function(t,e,n){let r=zI||(zI=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},va=function(t,e,n,r){return n&&(VI(t,e,n,r,-1)||VI(t,e,n,r,1))},QV=/^(img|br|input|textarea|hr)$/i;function VI(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:bo(t))){let i=t.parentNode;if(!i||i.nodeType!=1||Sb(t)||QV.test(t.nodeName)||t.contentEditable=="false")return!1;e=Fn(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?bo(t):0}else return!1}}function bo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function ZV(t,e,n){for(let r=e==0,o=e==bo(t);r||o;){if(t==n)return!0;let i=Fn(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==bo(t)}}function Sb(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var zg=function(t){return t.focusNode&&va(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function da(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function eq(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function tq(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}var Eo=typeof navigator<"u"?navigator:null,qI=typeof document<"u"?document:null,cs=Eo&&Eo.userAgent||"",rb=/Edge\/(\d+)/.exec(cs),xA=/MSIE \d/.exec(cs),ob=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(cs),Yn=!!(xA||ob||rb),as=xA?document.documentMode:ob?+ob[1]:rb?+rb[1]:0,no=!Yn&&/gecko\/(\d+)/i.test(cs);no&&+(/Firefox\/(\d+)/.exec(cs)||[0,0])[1];var ib=!Yn&&/Chrome\/(\d+)/.exec(cs),kn=!!ib,nq=ib?+ib[1]:0,Bn=!Yn&&!!Eo&&/Apple Computer/.test(Eo.vendor),Ou=Bn&&(/Mobile\/\w+/.test(cs)||!!Eo&&Eo.maxTouchPoints>2),Pr=Ou||(Eo?/Mac/.test(Eo.platform):!1),rq=Eo?/Win/.test(Eo.platform):!1,to=/Android \d/.test(cs),rd=!!qI&&"webkitFontSmoothing"in qI.documentElement.style,oq=rd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function iq(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function ci(t,e){return typeof t=="number"?t:t[e]}function sq(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function jI(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Zf(s)){if(s.nodeType!=1)continue;let a=s,l=a==i.body,u=l?iq(i):sq(a),c=0,f=0;if(e.topu.bottom-ci(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+ci(o,"top")-u.top:e.bottom-u.bottom+ci(o,"bottom")),e.leftu.right-ci(r,"right")&&(c=e.right-u.right+ci(o,"right")),c||f)if(l)i.defaultView.scrollBy(c,f);else{let d=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),c&&(a.scrollLeft+=c);let m=a.scrollLeft-d,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function aq(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:SA(t.dom)}}function SA(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Zf(r));return e}function lq({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;kA(n,r==0?0:r-e)}function kA(t,e){for(let n=0;n=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=c,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&l&&(n=l,o=u,r=0),n&&n.nodeType==3?cq(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:bA(n,o)}function cq(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function kb(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function fq(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function pq(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!s||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!s&&(s=!0,l.left>r.left||l.top>r.top?o=a.posBefore:(l.right-1?o:t.docView.posFromDOM(e,n,-1)}function EA(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&o++}let u;rd&&o&&r.nodeType==1&&(u=r.childNodes[o-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=pq(t,r,o,e))}a==null&&(a=dq(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function HI(t){return t.top=0&&o==r.nodeValue.length?(l--,c=1):n<0?l--:u++,Yf(rs(fi(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==bo(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Zk(l.getBoundingClientRect(),!1)}if(i==null&&o=0)}if(i==null&&o&&(n<0||o==bo(r))){let l=r.childNodes[o-1],u=l.nodeType==3?fi(l,bo(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Yf(rs(u,1),!1)}if(i==null&&o=0)}function Yf(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Zk(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function CA(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function gq(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return CA(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=RA(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=fi(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}var yq=/[\u0590-\u08ac]/;function vq(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return!yq.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:CA(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),d=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:y}=t.domSelectionRange(),w=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==y;try{a.collapse(c,f),l&&(l!=c||u!=f)&&a.extend&&a.extend(l,u)}catch{}return d!=null&&(a.caretBidiLevel=d),w})}var $I=null,WI=null,GI=!1;function wq(t,e,n){return $I==e&&WI==n?GI:($I=e,WI=n,GI=n=="up"||n=="down"?gq(t,e,n):vq(t,e,n))}var Or=0,KI=1,pa=2,Ro=3,wa=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Or,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nFn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof Ag){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Mg&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Fn(i.dom)+1:0}}else{let i,s=!0;for(;i=r=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let f=a;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){o=Fn(d.dom)+1;break}e-=d.size}o==-1&&(o=0)}if(o>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;cp&&sn){let p=a;a=l,l=p}let d=document.createRange();d.setEnd(l.node,l.offset),d.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o=r:er){let a=r+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?pa:KI,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Ro:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?pa:Ro}r=s}this.dirty=pa}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?pa:KI;n.dirty{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Or&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},sb=class extends wa{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},Nu=class t extends wa{constructor(e,n,r,o){super(e,[],r,o),this.mark=n}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=ai.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Ro||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Ro&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Or){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=fb(i,0,e,r));for(let a=0;a{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),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}=ai.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=OA(c,r,n),u?l=new ab(e,n,r,o,c,f||null,d,u,i,s+1):n.isText?new Ig(e,n,r,o,c,d,i):new t(e,n,r,o,c,f||null,d,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>K.empty)}return e}matchesNode(e,n,r){return this.dirty==Or&&e.eq(this.node)&&ub(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new cb(this,s&&s.node,e);bq(this.node,this.innerDeco,(u,c,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?Ue.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,o)},(u,c,f,d)=>{l.syncToMarks(u.marks,r,e);let p;l.findNodeMatch(u,c,f,d)||a&&e.state.selection.from>o&&e.state.selection.to-1&&l.updateNodeAt(u,c,f,p,e)||l.updateNextNode(u,c,f,e,d,o)||l.addNode(u,c,f,e,o),o+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==pa)&&(s&&this.protectLocalComposition(e,s),TA(this.contentDOM,this.children,e),Ou&&Eq(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Me)||rn+this.node.content.size)return null;let i=e.domSelectionRange(),s=Rq(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=Cq(this.node.content,a,r-n,o-n);return l<0?null:{node:s,pos:l,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new sb(this,i,n,o);e.input.compositionNodes.push(s),this.children=fb(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Ro||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Or}updateOuterDeco(e){if(ub(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=PA(this.dom,this.nodeDOM,lb(this.outerDeco,this.node,n),lb(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}};function YI(t,e,n,r,o){OA(r,e,t);let i=new ls(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var Ig=class t extends ls{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Ro||this.dirty!=Or&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Or||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Or,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new t(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Ro)}get domAtom(){return!1}},Ag=class extends wa{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Or&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},ab=class extends ls{constructor(e,n,r,o,i,s,a,l,u,c){super(e,n,r,o,i,s,a,u,c),this.spec=l}update(e,n,r,o){if(this.dirty==Ro)return!1;if(this.spec.update){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function TA(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i>1,s=Math.min(i,e.length);for(;o-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Nu.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof Nu)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function kq(t,e){return t.type.side-e.type.side}function bq(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let u=0;ui;)a.push(o[s++]);let m=i+d.nodeSize;if(d.isText){let w=m;s!w.inline):a.slice();r(d,y,e.forChild(i,d),p),i=m}}function Eq(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function Rq(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=bo(t)}else if(t.nodeType==1&&e=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function fb(t,e,n,r,o){let i=[];for(let s=0,a=0;s=n||c<=e?i.push(l):(un&&i.push(l.slice(n-u,l.size,r)))}return i}function bb(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,u;if(zg(n)){for(l=a;o&&!o.node;)o=o.parent;let c=o.node;if(o&&c.isAtom&&he.isSelectable(c)&&o.parent&&!(c.isInline&&ZV(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;u=new he(s==f?a:r.resolve(f))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;l=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!NA(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function Pq(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setEnd(r.parentNode,Fn(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Yn&&as<=11&&(r.disabled=!0,r.disabled=!1)}function MA(t,e){if(e instanceof he){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(tA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else tA(t)}function tA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function Eb(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Me.between(e,n,r)}function nA(t){return t.editable&&!t.hasFocus()?!1:IA(t)}function IA(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Oq(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return va(e.node,e.offset,n.anchorNode,n.anchorOffset)}function db(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Ee.findFrom(i,e)}function is(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function rA(t,e,n){let r=t.state.selection;if(r instanceof Me)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return is(t,new Me(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=db(t.state,e);return o&&o instanceof he?is(t,o):!1}else if(!(Pr&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?he.isSelectable(i)?is(t,new he(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):rd?is(t,new Me(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof he&&r.node.isInline)return is(t,new Me(e>0?r.$to:r.$from));{let o=db(t.state,e);return o?is(t,o):!1}}}function Lg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function Cu(t,e){return e<0?Nq(t):Mq(t)}function Nq(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(no&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Qf(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(AA(n))break;{let a=n.previousSibling;for(;a&&Qf(a,-1);)o=n.parentNode,i=Fn(a),a=a.previousSibling;if(a)n=a,r=Lg(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?pb(t,n,r):o&&pb(t,o,i)}function Mq(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Lg(n),i,s;for(;;)if(r{t.state==o&&di(t)},50)}function oA(t,e){let n=t.state.doc.resolve(e);if(!(kn||rq)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s1)return i.lefto.top&&s1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function iA(t,e,n){let r=t.state.selection;if(r instanceof Me&&!r.empty||n.indexOf("s")>-1||Pr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=db(t.state,e);if(s&&s instanceof he)return is(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof cr?Ee.near(s,e):Ee.findFrom(s,e);return a?is(t,a):!1}return!1}function sA(t,e){if(!(t.state.selection instanceof Me))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function aA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Lq(t){if(!Bn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;aA(t,r,"true"),setTimeout(()=>aA(t,r,"false"),20)}return!1}function Dq(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function Fq(t,e){let n=e.keyCode,r=Dq(e);if(n==8||Pr&&n==72&&r=="c")return sA(t,-1)||Cu(t,-1);if(n==46&&!e.shiftKey||Pr&&n==68&&r=="c")return sA(t,1)||Cu(t,1);if(n==13||n==27)return!0;if(n==37||Pr&&n==66&&r=="c"){let o=n==37?oA(t,t.state.selection.from)=="ltr"?-1:1:-1;return rA(t,o,r)||Cu(t,o)}else if(n==39||Pr&&n==70&&r=="c"){let o=n==39?oA(t,t.state.selection.from)=="ltr"?1:-1:1;return rA(t,o,r)||Cu(t,o)}else{if(n==38||Pr&&n==80&&r=="c")return iA(t,-1,r)||Cu(t,-1);if(n==40||Pr&&n==78&&r=="c")return Lq(t)||iA(t,1,r)||Cu(t,1);if(r==(Pr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function LA(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||ai.fromSchema(t.state.schema),a=_A(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,f=0;for(;u&&u.nodeType==1&&(c=UA[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let m=a.createElement(c[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${o} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,` +`,wm=16,pN=({reverseOrder:t,position:e="top-center",toastOptions:n,gutter:r,children:o,containerStyle:i,containerClassName:s})=>{let{toasts:a,handlers:l}=V_(n);return Yi.createElement("div",{style:{position:"fixed",zIndex:9999,top:wm,left:wm,right:wm,bottom:wm,pointerEvents:"none",...i},className:s,onMouseEnter:l.startPause,onMouseLeave:l.endPause},a.map(u=>{let c=u.position||e,f=l.calculateOffset(u,{reverseOrder:t,gutter:r,defaultPosition:e}),d=d4(c,f);return Yi.createElement(f4,{id:u.id,key:u.id,onHeightUpdate:l.updateHeight,className:u.visible?p4:"",style:d},u.type==="custom"?bm(u.message,u):o?o(u):Yi.createElement(c4,{toast:u,position:c}))}))},je=lr;var Ln=q(he());var ye=q(he());function Rm(){return Rm=Object.assign?Object.assign.bind():function(t){for(var e=1;e"u")throw new Error(e)}function Zx(t,e){if(!t){typeof console<"u"&&console.warn(e);try{throw new Error(e)}catch{}}}function m4(){return Math.random().toString(36).substr(2,8)}function hN(t,e){return{usr:t.state,key:t.key,idx:e}}function Qx(t,e,n,r){return n===void 0&&(n=null),Rm({pathname:typeof t=="string"?t:t.pathname,search:"",hash:""},typeof e=="string"?Nl(e):e,{state:n,key:e&&e.key||r||m4()})}function Cm(t){let{pathname:e="/",search:n="",hash:r=""}=t;return n&&n!=="?"&&(e+=n.charAt(0)==="?"?n:"?"+n),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function Nl(t){let e={};if(t){let n=t.indexOf("#");n>=0&&(e.hash=t.substr(n),t=t.substr(0,n));let r=t.indexOf("?");r>=0&&(e.search=t.substr(r),t=t.substr(0,r)),t&&(e.pathname=t)}return e}function h4(t,e,n,r){r===void 0&&(r={});let{window:o=document.defaultView,v5Compat:i=!1}=r,s=o.history,a=wo.Pop,l=null,u=c();u==null&&(u=0,s.replaceState(Rm({},s.state,{idx:u}),""));function c(){return(s.state||{idx:null}).idx}function f(){a=wo.Pop;let w=c(),g=w==null?null:w-u;u=w,l&&l({action:a,location:y.location,delta:g})}function d(w,g){a=wo.Push;let v=Qx(y.location,w,g);n&&n(v,w),u=c()+1;let k=hN(v,u),S=y.createHref(v);try{s.pushState(k,"",S)}catch(b){if(b instanceof DOMException&&b.name==="DataCloneError")throw b;o.location.assign(S)}i&&l&&l({action:a,location:y.location,delta:1})}function p(w,g){a=wo.Replace;let v=Qx(y.location,w,g);n&&n(v,w),u=c();let k=hN(v,u),S=y.createHref(v);s.replaceState(k,"",S),i&&l&&l({action:a,location:y.location,delta:0})}function m(w){let g=o.location.origin!=="null"?o.location.origin:o.location.href,v=typeof w=="string"?w:Cm(w);return ur(g,"No window.location.(origin|href) available to create URL for href: "+v),new URL(v,g)}let y={get action(){return a},get location(){return t(o,s)},listen(w){if(l)throw new Error("A history only accepts one active listener");return o.addEventListener(mN,f),l=w,()=>{o.removeEventListener(mN,f),l=null}},createHref(w){return e(o,w)},createURL:m,encodeLocation(w){let g=m(w);return{pathname:g.pathname,search:g.search,hash:g.hash}},push:d,replace:p,go(w){return s.go(w)}};return y}var gN;(function(t){t.data="data",t.deferred="deferred",t.redirect="redirect",t.error="error"})(gN||(gN={}));function eS(t,e,n){n===void 0&&(n="/");let r=typeof e=="string"?Nl(e):e,o=Tm(r.pathname||"/",n);if(o==null)return null;let i=wN(t);g4(i);let s=null;for(let a=0;s==null&&a{let l={relativePath:a===void 0?i.path||"":a,caseSensitive:i.caseSensitive===!0,childrenIndex:s,route:i};l.relativePath.startsWith("/")&&(ur(l.relativePath.startsWith(r),'Absolute route path "'+l.relativePath+'" nested under path '+('"'+r+'" is not valid. An absolute child route path ')+"must start with the combined path of all its parent routes."),l.relativePath=l.relativePath.slice(r.length));let u=Xi([r,l.relativePath]),c=n.concat(l);i.children&&i.children.length>0&&(ur(i.index!==!0,"Index routes must not have child routes. Please remove "+('all child routes from route path "'+u+'".')),wN(i.children,e,c,u)),!(i.path==null&&!i.index)&&e.push({path:u,score:b4(u,i.index),routesMeta:c})};return t.forEach((i,s)=>{var a;if(i.path===""||!((a=i.path)!=null&&a.includes("?")))o(i,s);else for(let l of xN(i.path))o(i,s,l)}),e}function xN(t){let e=t.split("/");if(e.length===0)return[];let[n,...r]=e,o=n.endsWith("?"),i=n.replace(/\?$/,"");if(r.length===0)return o?[i,""]:[i];let s=xN(r.join("/")),a=[];return a.push(...s.map(l=>l===""?i:[i,l].join("/"))),o&&a.push(...s),a.map(l=>t.startsWith("/")&&l===""?"/":l)}function g4(t){t.sort((e,n)=>e.score!==n.score?n.score-e.score:E4(e.routesMeta.map(r=>r.childrenIndex),n.routesMeta.map(r=>r.childrenIndex)))}var y4=/^:\w+$/,v4=3,w4=2,x4=1,S4=10,k4=-2,yN=t=>t==="*";function b4(t,e){let n=t.split("/"),r=n.length;return n.some(yN)&&(r+=k4),e&&(r+=w4),n.filter(o=>!yN(o)).reduce((o,i)=>o+(y4.test(i)?v4:i===""?x4:S4),r)}function E4(t,e){return t.length===e.length&&t.slice(0,-1).every((r,o)=>r===e[o])?t[t.length-1]-e[e.length-1]:0}function R4(t,e){let{routesMeta:n}=t,r={},o="/",i=[];for(let s=0;s{if(c==="*"){let d=a[f]||"";s=i.slice(0,i.length-d.length).replace(/(.)\/+$/,"$1")}return u[c]=P4(a[f]||"",c),u},{}),pathname:i,pathnameBase:s,pattern:t}}function C4(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!0),Zx(t==="*"||!t.endsWith("*")||t.endsWith("/*"),'Route path "'+t+'" will be treated as if it were '+('"'+t.replace(/\*$/,"/*")+'" because the `*` character must ')+"always follow a `/` in the pattern. To get rid of this warning, "+('please change the route path to "'+t.replace(/\*$/,"/*")+'".'));let r=[],o="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^$?{}|()[\]]/g,"\\$&").replace(/\/:(\w+)/g,(s,a)=>(r.push(a),"/([^\\/]+)"));return t.endsWith("*")?(r.push("*"),o+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):n?o+="\\/*$":t!==""&&t!=="/"&&(o+="(?:(?=\\/|$))"),[new RegExp(o,e?void 0:"i"),r]}function T4(t){try{return decodeURI(t)}catch(e){return Zx(!1,'The URL path "'+t+'" could not be decoded because it is is a malformed URL segment. This is probably due to a bad percent '+("encoding ("+e+").")),t}}function P4(t,e){try{return decodeURIComponent(t)}catch(n){return Zx(!1,'The value for the URL param "'+e+'" will not be decoded because'+(' the string "'+t+'" is a malformed URL segment. This is probably')+(" due to a bad percent encoding ("+n+").")),t}}function Tm(t,e){if(e==="/")return t;if(!t.toLowerCase().startsWith(e.toLowerCase()))return null;let n=e.endsWith("/")?e.length-1:e.length,r=t.charAt(n);return r&&r!=="/"?null:t.slice(n)||"/"}var Xi=t=>t.join("/").replace(/\/\/+/g,"/"),O4=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/");function nS(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var SN=["post","put","patch","delete"],dG=new Set(SN),N4=["get",...SN],pG=new Set(N4);var mG=Symbol("deferred");function rS(){return rS=Object.assign?Object.assign.bind():function(t){for(var e=1;eObject.assign({},g,{params:Object.assign({},s,g.params),pathname:Xi([l,r.encodeLocation?r.encodeLocation(g.pathname).pathname:g.pathname]),pathnameBase:g.pathnameBase==="/"?l:Xi([l,r.encodeLocation?r.encodeLocation(g.pathnameBase).pathname:g.pathnameBase])})),o,n);return e&&w?ye.createElement(uf.Provider,{value:{location:rS({pathname:"/",search:"",hash:"",state:null,key:"default"},f),navigationType:wo.Pop}},w):w}function L4(){let t=bN(),e=nS(t)?t.status+" "+t.statusText:t instanceof Error?t.message:JSON.stringify(t),n=t instanceof Error?t.stack:null,r="rgba(200,200,200, 0.5)",o={padding:"0.5rem",backgroundColor:r},i={padding:"2px 4px",backgroundColor:r};return ye.createElement(ye.Fragment,null,ye.createElement("h2",null,"Unexpected Application Error!"),ye.createElement("h3",{style:{fontStyle:"italic"}},e),n?ye.createElement("pre",{style:o},n):null,null)}var D4=ye.createElement(L4,null),oS=class extends ye.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,n){return n.location!==e.location||n.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error||n.error,location:n.location,revalidation:e.revalidation||n.revalidation}}componentDidCatch(e,n){console.error("React Router caught the following error during render",e,n)}render(){return this.state.error?ye.createElement(Qs.Provider,{value:this.props.routeContext},ye.createElement(kN.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function F4(t){let{routeContext:e,match:n,children:r}=t,o=ye.useContext(sS);return o&&o.static&&o.staticContext&&(n.route.errorElement||n.route.ErrorBoundary)&&(o.staticContext._deepestRenderedBoundaryId=n.route.id),ye.createElement(Qs.Provider,{value:e},r)}function B4(t,e,n){var r;if(e===void 0&&(e=[]),n===void 0&&(n=null),t==null){var o;if((o=n)!=null&&o.errors)t=n.matches;else return null}let i=t,s=(r=n)==null?void 0:r.errors;if(s!=null){let a=i.findIndex(l=>l.route.id&&s?.[l.route.id]);a>=0||ur(!1),i=i.slice(0,Math.min(i.length,a+1))}return i.reduceRight((a,l,u)=>{let c=l.route.id?s?.[l.route.id]:null,f=null;n&&(f=l.route.errorElement||D4);let d=e.concat(i.slice(0,u+1)),p=()=>{let m;return c?m=f:l.route.Component?m=ye.createElement(l.route.Component,null):l.route.element?m=l.route.element:m=a,ye.createElement(F4,{match:l,routeContext:{outlet:a,matches:d,isDataRoute:n!=null},children:m})};return n&&(l.route.ErrorBoundary||l.route.errorElement||u===0)?ye.createElement(oS,{location:n.location,revalidation:n.revalidation,component:f,error:c,children:p(),routeContext:{outlet:null,matches:d,isDataRoute:!0}}):p()},null)}var iS=function(t){return t.UseBlocker="useBlocker",t.UseLoaderData="useLoaderData",t.UseActionData="useActionData",t.UseRouteError="useRouteError",t.UseNavigation="useNavigation",t.UseRouteLoaderData="useRouteLoaderData",t.UseMatches="useMatches",t.UseRevalidator="useRevalidator",t.UseNavigateStable="useNavigate",t.UseRouteId="useRouteId",t}(iS||{});function J4(t){let e=ye.useContext(aS);return e||ur(!1),e}function U4(t){let e=ye.useContext(Qs);return e||ur(!1),e}function _4(t){let e=U4(t),n=e.matches[e.matches.length-1];return n.route.id||ur(!1),n.route.id}function bN(){var t;let e=ye.useContext(kN),n=J4(iS.UseRouteError),r=_4(iS.UseRouteError);return e||((t=n.errors)==null?void 0:t[r])}var z4="startTransition",kG=ye[z4];function cS(t){let{basename:e="/",children:n=null,location:r,navigationType:o=wo.Pop,navigator:i,static:s=!1}=t;Om()&&ur(!1);let a=e.replace(/^\/*/,"/"),l=ye.useMemo(()=>({basename:a,navigator:i,static:s}),[a,i,s]);typeof r=="string"&&(r=Nl(r));let{pathname:u="/",search:c="",hash:f="",state:d=null,key:p="default"}=r,m=ye.useMemo(()=>{let y=Tm(u,a);return y==null?null:{location:{pathname:y,search:c,hash:f,state:d,key:p},navigationType:o}},[a,u,c,f,d,p,o]);return m==null?null:ye.createElement(Pm.Provider,{value:l},ye.createElement(uf.Provider,{children:n,value:m}))}var bG=new Promise(()=>{});var Y4="startTransition",EN=Ln[Y4];function TN(t){let{basename:e,children:n,future:r,window:o}=t,i=Ln.useRef();i.current==null&&(i.current=vN({window:o,v5Compat:!0}));let s=i.current,[a,l]=Ln.useState({action:s.action,location:s.location}),{v7_startTransition:u}=r||{},c=Ln.useCallback(f=>{u&&EN?EN(()=>l(f)):l(f)},[l,u]);return Ln.useLayoutEffect(()=>s.listen(c),[s,c]),Ln.createElement(cS,{basename:e,children:n,location:a.location,navigationType:a.action,navigator:s})}var n7=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var RN;(function(t){t.UseScrollRestoration="useScrollRestoration",t.UseSubmit="useSubmit",t.UseSubmitFetcher="useSubmitFetcher",t.UseFetcher="useFetcher"})(RN||(RN={}));var CN;(function(t){t.UseFetchers="useFetchers",t.UseScrollRestoration="useScrollRestoration"})(CN||(CN={}));var cr=q(he()),X4=(0,cr.createContext)(null),fS={didCatch:!1,error:null},Nm=class extends cr.Component{constructor(e){super(e),this.resetErrorBoundary=this.resetErrorBoundary.bind(this),this.state=fS}static getDerivedStateFromError(e){return{didCatch:!0,error:e}}resetErrorBoundary(){let{error:e}=this.state;if(e!==null){for(var n,r,o=arguments.length,i=new Array(o),s=0;s0&&arguments[0]!==void 0?arguments[0]:[],e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];return t.length!==e.length||t.some((n,r)=>!Object.is(n,e[r]))}var MN=q(he(),1),ti=q(me(),1),IN=({error:t,resetErrorBoundary:e})=>{let n=(0,MN.useRef)(null),r=()=>{e()};return(0,ti.jsxs)("dialog",{ref:n,className:"p-4 rounded-md shadow-lg bg-white",children:[(0,ti.jsx)("div",{className:"text-lg font-semibold",children:"Unhandled Error"}),(0,ti.jsxs)("div",{className:"p-4",children:[(0,ti.jsx)("h4",{className:"text-md font-medium",children:t.message}),(0,ti.jsx)("pre",{className:"whitespace-pre-wrap text-sm",children:t.stack})]}),(0,ti.jsx)("div",{className:"flex justify-end mt-4",children:(0,ti.jsx)("button",{className:"btn btn-secondary",onClick:r,children:"Close"})})]})};var Bd=q(he(),1);var yg=q(he(),1);var Te={},iz=0;function qt(t,e){let n=`atom${++iz}`,r={toString:()=>n};return typeof t=="function"?r.read=t:(r.init=t,r.read=function(o){return o(this)},r.write=function(o,i,s){return i(this,typeof s=="function"?s(o(this)):s)}),e&&(r.write=e),r}var dS=t=>"init"in t,pS=t=>!!t.write,Am=new WeakMap,sz=(t,e)=>{Am.set(t,e),t.catch(()=>{}).finally(()=>Am.delete(t))},AN=(t,e)=>{let n=Am.get(t);n&&(Am.delete(t),n(e))},LN=(t,e)=>{t.status="fulfilled",t.value=e},DN=(t,e)=>{t.status="rejected",t.reason=e},az=t=>typeof t?.then=="function",cf=(t,e)=>!!t&&"v"in t&&"v"in e&&Object.is(t.v,e.v),FN=(t,e)=>!!t&&"e"in t&&"e"in e&&Object.is(t.e,e.e),Ml=t=>!!t&&"v"in t&&t.v instanceof Promise,lz=(t,e)=>"v"in t&&"v"in e&&t.v.orig&&t.v.orig===e.v.orig,Im=t=>{if("e"in t)throw t.e;return t.v},hS=()=>{let t=new WeakMap,e=new WeakMap,n=new Map,r,o;(Te.env?Te.env.MODE:void 0)!=="production"&&(r=new Set,o=new Set);let i=E=>t.get(E),s=(E,O)=>{(Te.env?Te.env.MODE:void 0)!=="production"&&Object.freeze(O);let I=t.get(E);if(t.set(E,O),n.has(E)||n.set(E,I),Ml(I)){let B="v"in O?O.v instanceof Promise?O.v:Promise.resolve(O.v):Promise.reject(O.e);I.v!==B&&AN(I.v,B)}},a=(E,O,I)=>{let B=new Map,L=!1;I.forEach((A,U)=>{!A&&U===E&&(A=O),A?(B.set(U,A),O.d.get(U)!==A&&(L=!0)):(Te.env?Te.env.MODE:void 0)!=="production"&&console.warn("[Bug] atom state not found")}),(L||O.d.size!==B.size)&&(O.d=B)},l=(E,O,I)=>{let B=i(E),L={d:B?.d||new Map,v:O};if(I&&a(E,L,I),cf(B,L)&&B.d===L.d)return B;if(Ml(B)&&Ml(L)&&lz(B,L)){if(B.d===L.d)return B;L.v=B.v}return s(E,L),L},u=(E,O,I,B)=>{if(az(O)){let L,A=()=>{let V=i(E);if(!Ml(V)||V.v!==U)return;let Q=l(E,U,I);e.has(E)&&V.d!==Q.d&&b(E,Q,V.d)},U=new Promise((V,Q)=>{let G=!1;O.then(te=>{G||(G=!0,LN(U,te),V(te),A())},te=>{G||(G=!0,DN(U,te),Q(te),A())}),L=te=>{G||(G=!0,te.then(ve=>LN(U,ve),ve=>DN(U,ve)),V(te))}});return U.orig=O,U.status="pending",sz(U,V=>{V&&L(V),B?.()}),l(E,U,I)}return l(E,O,I)},c=(E,O,I)=>{let B=i(E),L={d:B?.d||new Map,e:O};return I&&a(E,L,I),FN(B,L)&&B.d===L.d?B:(s(E,L),L)},f=(E,O)=>{let I=i(E);if(!O&&I&&(e.has(E)||Array.from(I.d).every(([G,te])=>{if(G===E)return!0;let ve=f(G);return ve===te||cf(ve,te)})))return I;let B=new Map,L=!0,A=G=>{if(G===E){let ve=i(G);if(ve)return B.set(G,ve),Im(ve);if(dS(G))return B.set(G,void 0),G.init;throw new Error("no atom init")}let te=f(G);return B.set(G,te),Im(te)},U,V,Q={get signal(){return U||(U=new AbortController),U.signal},get setSelf(){return(Te.env?Te.env.MODE:void 0)!=="production"&&!pS(E)&&console.warn("setSelf function cannot be used with read-only atom"),!V&&pS(E)&&(V=(...G)=>{if((Te.env?Te.env.MODE:void 0)!=="production"&&L&&console.warn("setSelf function cannot be called in sync"),!L)return v(E,...G)}),V}};try{let G=E.read(A,Q);return u(E,G,B,()=>U?.abort())}catch(G){return c(E,G,B)}finally{L=!1}},d=E=>Im(f(E)),p=E=>{let O=e.get(E);return O||(O=k(E)),O},m=(E,O)=>!O.l.size&&(!O.t.size||O.t.size===1&&O.t.has(E)),y=E=>{let O=e.get(E);O&&m(E,O)&&S(E)},w=E=>{let O=new Map,I=new WeakMap,B=U=>{var V;let Q=new Set((V=e.get(U))==null?void 0:V.t);return n.forEach((G,te)=>{var ve;(ve=i(te))!=null&&ve.d.has(U)&&Q.add(te)}),Q},L=U=>{B(U).forEach(V=>{V!==U&&(O.set(V,(O.get(V)||new Set).add(U)),I.set(V,(I.get(V)||0)+1),L(V))})};L(E);let A=U=>{B(U).forEach(V=>{var Q;if(V!==U){let G=I.get(V);if(G&&I.set(V,--G),!G){let te=!!((Q=O.get(V))!=null&&Q.size);if(te){let ve=i(V),C=f(V,!0);te=!cf(ve,C)}te||O.forEach(ve=>ve.delete(V))}A(V)}})};A(E)},g=(E,...O)=>{let I=!0,B=U=>Im(f(U)),L=(U,...V)=>{let Q;if(U===E){if(!dS(U))throw new Error("atom not writable");let G=i(U),te=u(U,V[0]);cf(G,te)||w(U)}else Q=g(U,...V);if(!I){let G=x();(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(te=>te({type:"async-write",flushed:G}))}return Q},A=E.write(B,L,...O);return I=!1,A},v=(E,...O)=>{let I=g(E,...O),B=x();return(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(L=>L({type:"write",flushed:B})),I},k=(E,O,I)=>{var B;let L=I||[];(B=i(E))==null||B.d.forEach((U,V)=>{let Q=e.get(V);Q?Q.t.add(E):V!==E&&k(V,E,L)}),f(E);let A={t:new Set(O&&[O]),l:new Set};if(e.set(E,A),(Te.env?Te.env.MODE:void 0)!=="production"&&o.add(E),pS(E)&&E.onMount){let{onMount:U}=E;L.push(()=>{let V=U((...Q)=>v(E,...Q));V&&(A.u=V)})}return I||L.forEach(U=>U()),A},S=E=>{var O;let I=(O=e.get(E))==null?void 0:O.u;I&&I(),e.delete(E),(Te.env?Te.env.MODE:void 0)!=="production"&&o.delete(E);let B=i(E);B?(Ml(B)&&AN(B.v),B.d.forEach((L,A)=>{if(A!==E){let U=e.get(A);U&&(U.t.delete(E),m(A,U)&&S(A))}})):(Te.env?Te.env.MODE:void 0)!=="production"&&console.warn("[Bug] could not find atom state to unmount",E)},b=(E,O,I)=>{let B=new Set(O.d.keys());I?.forEach((L,A)=>{if(B.has(A)){B.delete(A);return}let U=e.get(A);U&&(U.t.delete(E),m(A,U)&&S(A))}),B.forEach(L=>{let A=e.get(L);A?A.t.add(E):e.has(E)&&k(L,E)})},x=()=>{let E;for((Te.env?Te.env.MODE:void 0)!=="production"&&(E=new Set);n.size;){let O=Array.from(n);n.clear(),O.forEach(([I,B])=>{let L=i(I);if(L){let A=e.get(I);A&&L.d!==B?.d&&b(I,L,B?.d),A&&!(!Ml(B)&&(cf(B,L)||FN(B,L)))&&(A.l.forEach(U=>U()),(Te.env?Te.env.MODE:void 0)!=="production"&&E.add(I))}else(Te.env?Te.env.MODE:void 0)!=="production"&&console.warn("[Bug] no atom state to flush")})}if((Te.env?Te.env.MODE:void 0)!=="production")return E},R=(E,O)=>{let I=p(E),B=x(),L=I.l;return L.add(O),(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(A=>A({type:"sub",flushed:B})),()=>{L.delete(O),y(E),(Te.env?Te.env.MODE:void 0)!=="production"&&r.forEach(A=>A({type:"unsub"}))}};return(Te.env?Te.env.MODE:void 0)!=="production"?{get:d,set:v,sub:R,dev_subscribe_store:(E,O)=>{if(O!==2)throw new Error("The current StoreListener revision is 2.");return r.add(E),()=>{r.delete(E)}},dev_get_mounted_atoms:()=>o.values(),dev_get_atom_state:E=>t.get(E),dev_get_mounted:E=>e.get(E),dev_restore_atoms:E=>{for(let[I,B]of E)dS(I)&&(u(I,B),w(I));let O=x();r.forEach(I=>I({type:"restore",flushed:O}))}}:{get:d,set:v,sub:R}},mS;(Te.env?Te.env.MODE:void 0)!=="production"&&(typeof globalThis.__NUMBER_OF_JOTAI_INSTANCES__=="number"?++globalThis.__NUMBER_OF_JOTAI_INSTANCES__:globalThis.__NUMBER_OF_JOTAI_INSTANCES__=1);var BN=()=>(mS||((Te.env?Te.env.MODE:void 0)!=="production"&&globalThis.__NUMBER_OF_JOTAI_INSTANCES__!==1&&console.warn("Detected multiple Jotai instances. It may cause unexpected behavior with the default store. https://github.com/pmndrs/jotai/discussions/2044"),mS=hS()),mS);var jt=q(he(),1);var JN={},UN=(0,jt.createContext)(void 0),_N=t=>{let e=(0,jt.useContext)(UN);return t?.store||e||BN()},Lm=({children:t,store:e})=>{let n=(0,jt.useRef)();return!e&&!n.current&&(n.current=hS()),(0,jt.createElement)(UN.Provider,{value:e||n.current},t)},uz=t=>typeof t?.then=="function",cz=jt.default.use||(t=>{if(t.status==="pending")throw t;if(t.status==="fulfilled")return t.value;throw t.status==="rejected"?t.reason:(t.status="pending",t.then(e=>{t.status="fulfilled",t.value=e},e=>{t.status="rejected",t.reason=e}),t)});function fz(t,e){let n=_N(e),[[r,o,i],s]=(0,jt.useReducer)(u=>{let c=n.get(t);return Object.is(u[0],c)&&u[1]===n&&u[2]===t?u:[c,n,t]},void 0,()=>[n.get(t),n,t]),a=r;(o!==n||i!==t)&&(s(),a=n.get(t));let l=e?.delay;return(0,jt.useEffect)(()=>{let u=n.sub(t,()=>{if(typeof l=="number"){setTimeout(s,l);return}s()});return s(),u},[n,t,l]),(0,jt.useDebugValue)(a),uz(a)?cz(a):a}function dz(t,e){let n=_N(e);return(0,jt.useCallback)((...o)=>{if((JN.env?JN.env.MODE:void 0)!=="production"&&!("write"in t))throw new Error("not writable atom");return n.set(t,...o)},[n,t])}function Et(t,e){return[fz(t,e),dz(t,e)]}function at(t,e){if(!t)throw new Error(e)}var pz=34028234663852886e22,mz=-34028234663852886e22,hz=4294967295,gz=2147483647,yz=-2147483648;function Il(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>gz||thz||t<0)throw new Error("invalid uint 32: "+t)}function Dm(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>pz||t({no:o.no,name:o.name,localName:t[o.no]})),r)}function yS(t,e,n){let r=Object.create(null),o=Object.create(null),i=[];for(let s of e){let a=jN(s);i.push(a),r[s.name]=a,o[s.no]=a}return{typeName:t,values:i,findName(s){return r[s]},findNumber(s){return o[s]}}}function qN(t,e,n){let r={};for(let o of e){let i=jN(o);r[i.localName]=i.no,r[i.no]=i.localName}return gS(r,t,e,n),r}function jN(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}var N=class{equals(e){return this.getType().runtime.util.equals(this.getType(),this,e)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(e,n){let r=this.getType(),o=r.runtime.bin,i=o.makeReadOptions(n);return o.readMessage(this,i.readerFactory(e),e.byteLength,i),this}fromJson(e,n){let r=this.getType(),o=r.runtime.json,i=o.makeReadOptions(n);return o.readMessage(r,e,i,this),this}fromJsonString(e,n){let r;try{r=JSON.parse(e)}catch(o){throw new Error(`cannot decode ${this.getType().typeName} from JSON: ${o instanceof Error?o.message:String(o)}`)}return this.fromJson(r,n)}toBinary(e){let n=this.getType(),r=n.runtime.bin,o=r.makeWriteOptions(e),i=o.writerFactory();return r.writeMessage(this,i,o),i.finish()}toJson(e){let n=this.getType(),r=n.runtime.json,o=r.makeWriteOptions(e);return r.writeMessage(this,o)}toJsonString(e){var n;let r=this.toJson(e);return JSON.stringify(r,null,(n=e?.prettySpaces)!==null&&n!==void 0?n:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}};function HN(t,e,n,r){var o;let i=(o=r?.localName)!==null&&o!==void 0?o:e.substring(e.lastIndexOf(".")+1),s={[i]:function(a){t.util.initFields(this),t.util.initPartial(a,this)}}[i];return Object.setPrototypeOf(s.prototype,new N),Object.assign(s,{runtime:t,typeName:e,fields:t.util.newFieldList(n),fromBinary(a,l){return new s().fromBinary(a,l)},fromJson(a,l){return new s().fromJson(a,l)},fromJsonString(a,l){return new s().fromJsonString(a,l)},equals(a,l){return t.util.equals(s,a,l)}}),s}function Fm(t,e,n,r){return{syntax:t,json:e,bin:n,util:r,makeMessageType(o,i,s){return HN(this,o,i,s)},makeEnum:qN,makeEnumType:yS,getEnumType:VN}}var z;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(z||(z={}));var Pr;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(Pr||(Pr={}));function WN(){let t=0,e=0;for(let r=0;r<28;r+=7){let o=this.buf[this.pos++];if(t|=(o&127)<>4,!(n&128))return this.assertBounds(),[t,e];for(let r=3;r<=31;r+=7){let o=this.buf[this.pos++];if(e|=(o&127)<>>i,a=!(!(s>>>7)&&e==0),l=(a?s|128:s)&255;if(n.push(l),!a)return}let r=t>>>28&15|(e&7)<<4,o=!!(e>>3);if(n.push((o?r|128:r)&255),!!o){for(let i=3;i<31;i=i+7){let s=e>>>i,a=!!(s>>>7),l=(a?s|128:s)&255;if(n.push(l),!a)return}n.push(e>>>31&1)}}var Bm=4294967296;function vS(t){let e=t[0]==="-";e&&(t=t.slice(1));let n=1e6,r=0,o=0;function i(s,a){let l=Number(t.slice(s,a));o*=n,r=r*n+l,r>=Bm&&(o=o+(r/Bm|0),r=r%Bm)}return i(-24,-18),i(-18,-12),i(-12,-6),i(-6),e?KN(r,o):xS(r,o)}function GN(t,e){let n=xS(t,e),r=n.hi&2147483648;r&&(n=KN(n.lo,n.hi));let o=wS(n.lo,n.hi);return r?"-"+o:o}function wS(t,e){if({lo:t,hi:e}=vz(t,e),e<=2097151)return String(Bm*e+t);let n=t&16777215,r=(t>>>24|e<<8)&16777215,o=e>>16&65535,i=n+r*6777216+o*6710656,s=r+o*8147497,a=o*2,l=1e7;return i>=l&&(s+=Math.floor(i/l),i%=l),s>=l&&(a+=Math.floor(s/l),s%=l),a.toString()+$N(s)+$N(i)}function vz(t,e){return{lo:t>>>0,hi:e>>>0}}function xS(t,e){return{lo:t|0,hi:e|0}}function KN(t,e){return e=~e,t?t=~t+1:e+=1,xS(t,e)}var $N=t=>{let e=String(t);return"0000000".slice(e.length)+e};function SS(t,e){if(t>=0){for(;t>127;)e.push(t&127|128),t=t>>>7;e.push(t)}else{for(let n=0;n<9;n++)e.push(t&127|128),t=t>>7;e.push(1)}}function YN(){let t=this.buf[this.pos++],e=t&127;if(!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<7,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<14,!(t&128))return this.assertBounds(),e;if(t=this.buf[this.pos++],e|=(t&127)<<21,!(t&128))return this.assertBounds(),e;t=this.buf[this.pos++],e|=(t&15)<<28;for(let n=5;t&128&&n<10;n++)t=this.buf[this.pos++];if(t&128)throw new Error("invalid varint");return this.assertBounds(),e>>>0}function wz(){let t=new DataView(new ArrayBuffer(8));if(typeof BigInt=="function"&&typeof t.getBigInt64=="function"&&typeof t.getBigUint64=="function"&&typeof t.setBigInt64=="function"&&typeof t.setBigUint64=="function"&&(typeof process!="object"||typeof process.env!="object"||process.env.BUF_BIGINT_DISABLE!=="1")){let o=BigInt("-9223372036854775808"),i=BigInt("9223372036854775807"),s=BigInt("0"),a=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(l){let u=typeof l=="bigint"?l:BigInt(l);if(u>i||ua||uat(/^-?[0-9]+$/.test(o),`int64 invalid: ${o}`),r=o=>at(/^[0-9]+$/.test(o),`uint64 invalid: ${o}`);return{zero:"0",supported:!1,parse(o){return typeof o!="string"&&(o=o.toString()),n(o),o},uParse(o){return typeof o!="string"&&(o=o.toString()),r(o),o},enc(o){return typeof o!="string"&&(o=o.toString()),n(o),vS(o)},uEnc(o){return typeof o!="string"&&(o=o.toString()),r(o),vS(o)},dec(o,i){return GN(o,i)},uDec(o,i){return wS(o,i)}}}var Ne=wz();var $e;(function(t){t[t.Varint=0]="Varint",t[t.Bit64=1]="Bit64",t[t.LengthDelimited=2]="LengthDelimited",t[t.StartGroup=3]="StartGroup",t[t.EndGroup=4]="EndGroup",t[t.Bit32=5]="Bit32"})($e||($e={}));var Um=class{constructor(e){this.stack=[],this.textEncoder=e??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let e=0;for(let o=0;o>>0)}raw(e){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(e),this}uint32(e){for(ff(e);e>127;)this.buf.push(e&127|128),e=e>>>7;return this.buf.push(e),this}int32(e){return Il(e),SS(e,this.buf),this}bool(e){return this.buf.push(e?1:0),this}bytes(e){return this.uint32(e.byteLength),this.raw(e)}string(e){let n=this.textEncoder.encode(e);return this.uint32(n.byteLength),this.raw(n)}float(e){Dm(e);let n=new Uint8Array(4);return new DataView(n.buffer).setFloat32(0,e,!0),this.raw(n)}double(e){let n=new Uint8Array(8);return new DataView(n.buffer).setFloat64(0,e,!0),this.raw(n)}fixed32(e){ff(e);let n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,e,!0),this.raw(n)}sfixed32(e){Il(e);let n=new Uint8Array(4);return new DataView(n.buffer).setInt32(0,e,!0),this.raw(n)}sint32(e){return Il(e),e=(e<<1^e>>31)>>>0,SS(e,this.buf),this}sfixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),o=Ne.enc(e);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(n)}fixed64(e){let n=new Uint8Array(8),r=new DataView(n.buffer),o=Ne.uEnc(e);return r.setInt32(0,o.lo,!0),r.setInt32(4,o.hi,!0),this.raw(n)}int64(e){let n=Ne.enc(e);return Jm(n.lo,n.hi,this.buf),this}sint64(e){let n=Ne.enc(e),r=n.hi>>31,o=n.lo<<1^r,i=(n.hi<<1|n.lo>>>31)^r;return Jm(o,i,this.buf),this}uint64(e){let n=Ne.uEnc(e);return Jm(n.lo,n.hi,this.buf),this}},_m=class{constructor(e,n){this.varint64=WN,this.uint32=YN,this.buf=e,this.len=e.length,this.pos=0,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.textDecoder=n??new TextDecoder}tag(){let e=this.uint32(),n=e>>>3,r=e&7;if(n<=0||r<0||r>5)throw new Error("illegal tag: field no "+n+" wire type "+r);return[n,r]}skip(e){let n=this.pos;switch(e){case $e.Varint:for(;this.buf[this.pos++]&128;);break;case $e.Bit64:this.pos+=4;case $e.Bit32:this.pos+=4;break;case $e.LengthDelimited:let r=this.uint32();this.pos+=r;break;case $e.StartGroup:let o;for(;(o=this.tag()[1])!==$e.EndGroup;)this.skip(o);break;default:throw new Error("cant skip wire type "+e)}return this.assertBounds(),this.buf.subarray(n,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let e=this.uint32();return e>>>1^-(e&1)}int64(){return Ne.dec(...this.varint64())}uint64(){return Ne.uDec(...this.varint64())}sint64(){let[e,n]=this.varint64(),r=-(e&1);return e=(e>>>1|(n&1)<<31)^r,n=n>>>1^r,Ne.dec(e,n)}bool(){let[e,n]=this.varint64();return e!==0||n!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return Ne.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return Ne.dec(this.sfixed32(),this.sfixed32())}float(){return this.view.getFloat32((this.pos+=4)-4,!0)}double(){return this.view.getFloat64((this.pos+=8)-8,!0)}bytes(){let e=this.uint32(),n=this.pos;return this.pos+=e,this.assertBounds(),this.buf.subarray(n,n+e)}string(){return this.textDecoder.decode(this.bytes())}};function ea(t,e){return e instanceof N||!t.fieldWrapper?e:t.fieldWrapper.wrapField(e)}var D7={"google.protobuf.DoubleValue":z.DOUBLE,"google.protobuf.FloatValue":z.FLOAT,"google.protobuf.Int64Value":z.INT64,"google.protobuf.UInt64Value":z.UINT64,"google.protobuf.Int32Value":z.INT32,"google.protobuf.UInt32Value":z.UINT32,"google.protobuf.BoolValue":z.BOOL,"google.protobuf.StringValue":z.STRING,"google.protobuf.BytesValue":z.BYTES};function ni(t,e,n){if(e===n)return!0;if(t==z.BYTES){if(!(e instanceof Uint8Array)||!(n instanceof Uint8Array)||e.length!==n.length)return!1;for(let r=0;rnew _m(t)},QN={writeUnknownFields:!0,writerFactory:()=>new Um};function xz(t){return t?Object.assign(Object.assign({},XN),t):XN}function Sz(t){return t?Object.assign(Object.assign({},QN),t):QN}function qm(){return{makeReadOptions:xz,makeWriteOptions:Sz,listUnknownFields(t){var e;return(e=t[Al])!==null&&e!==void 0?e:[]},discardUnknownFields(t){delete t[Al]},writeUnknownFields(t,e){let r=t[Al];if(r)for(let o of r)e.tag(o.no,o.wireType).raw(o.data)},onUnknownField(t,e,n,r){let o=t;Array.isArray(o[Al])||(o[Al]=[]),o[Al].push({no:e,wireType:n,data:r})},readMessage(t,e,n,r,o){let i=t.getType(),s=o?e.len:e.pos+n,a,l;for(;e.pos0&&(m=bz),f){let v=c[d];if(l==$e.LengthDelimited&&p!=z.STRING&&p!=z.BYTES){let k=e.uint32()+e.pos;for(;e.pos>4,s=i,o=2;break;case 2:n[r++]=(s&15)<<4|(i&60)>>2,s=i,o=3;break;case 3:n[r++]=(s&3)<<6|i,o=0;break}}if(o==1)throw Error("invalid base64 string.");return n.subarray(0,r)},enc(t){let e="",n=0,r,o=0;for(let i=0;i>2],o=(r&3)<<4,n=1;break;case 1:e+=oi[o|r>>4],o=(r&15)<<2,n=2;break;case 2:e+=oi[o|r>>6],e+=oi[r&63],n=0;break}return n&&(e+=oi[o],e+="=",n==1&&(e+="=")),e}};var eM={ignoreUnknownFields:!1},tM={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function Ez(t){return t?Object.assign(Object.assign({},eM),t):eM}function Rz(t){return t?Object.assign(Object.assign({},tM),t):tM}function Wm(t){let e=t(Cz,nM);return{makeReadOptions:Ez,makeWriteOptions:Rz,readMessage(n,r,o,i){if(r==null||Array.isArray(r)||typeof r!="object")throw new Error(`cannot decode message ${n.typeName} from JSON: ${this.debug(r)}`);i=i??new n;let s={};for(let[a,l]of Object.entries(r)){let u=n.fields.findJsonName(a);if(!u){if(!o.ignoreUnknownFields)throw new Error(`cannot decode message ${n.typeName} from JSON: key "${a}" is unknown`);continue}let c=u.localName,f=i;if(u.oneof){if(l===null&&u.kind=="scalar")continue;let d=s[u.oneof.localName];if(d)throw new Error(`cannot decode message ${n.typeName} from JSON: multiple keys for oneof "${u.oneof.name}" present: "${d}", "${a}"`);s[u.oneof.localName]=a,f=f[u.oneof.localName]={case:c},c="value"}if(u.repeated){if(l===null)continue;if(!Array.isArray(l))throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`);let d=f[c];for(let p of l){if(p===null)throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(p)}`);let m;switch(u.kind){case"message":m=u.T.fromJson(p,o);break;case"enum":if(m=bS(u.T,p,o.ignoreUnknownFields),m===void 0)continue;break;case"scalar":try{m=pf(u.T,p,u.L)}catch(y){let w=`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(p)}`;throw y instanceof Error&&y.message.length>0&&(w+=`: ${y.message}`),new Error(w)}break}d.push(m)}}else if(u.kind=="map"){if(l===null)continue;if(Array.isArray(l)||typeof l!="object")throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`);let d=f[c];for(let[p,m]of Object.entries(l)){if(m===null)throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: map value null`);let y;switch(u.V.kind){case"message":y=u.V.T.fromJson(m,o);break;case"enum":if(y=bS(u.V.T,m,o.ignoreUnknownFields),y===void 0)continue;break;case"scalar":try{y=pf(u.V.T,m,Pr.BIGINT)}catch(w){let g=`cannot decode map value for field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`;throw w instanceof Error&&w.message.length>0&&(g+=`: ${w.message}`),new Error(g)}break}try{d[pf(u.K,u.K==z.BOOL?p=="true"?!0:p=="false"?!1:p:p,Pr.BIGINT).toString()]=y}catch(w){let g=`cannot decode map key for field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`;throw w instanceof Error&&w.message.length>0&&(g+=`: ${w.message}`),new Error(g)}}}else switch(u.kind){case"message":let d=u.T;if(l===null&&d.typeName!="google.protobuf.Value"){if(u.oneof)throw new Error(`cannot decode field ${n.typeName}.${u.name} from JSON: null is invalid for oneof field "${a}"`);continue}f[c]instanceof N?f[c].fromJson(l,o):(f[c]=d.fromJson(l,o),d.fieldWrapper&&!u.oneof&&(f[c]=d.fieldWrapper.unwrapField(f[c])));break;case"enum":let p=bS(u.T,l,o.ignoreUnknownFields);p!==void 0&&(f[c]=p);break;case"scalar":try{f[c]=pf(u.T,l,u.L)}catch(m){let y=`cannot decode field ${n.typeName}.${u.name} from JSON: ${this.debug(l)}`;throw m instanceof Error&&m.message.length>0&&(y+=`: ${m.message}`),new Error(y)}break}}return i},writeMessage(n,r){let o=n.getType(),i={},s;try{for(let a of o.fields.byMember()){let l;if(a.kind=="oneof"){let u=n[a.localName];if(u.value===void 0)continue;if(s=a.findField(u.case),!s)throw"oneof case not found: "+u.case;l=e(s,u.value,r)}else s=a,l=e(s,n[s.localName],r);l!==void 0&&(i[r.useProtoFieldName?s.name:s.jsonName]=l)}}catch(a){let l=s?`cannot encode field ${o.typeName}.${s.name} to JSON`:`cannot encode message ${o.typeName} to JSON`,u=a instanceof Error?a.message:String(a);throw new Error(l+(u.length>0?`: ${u}`:""))}return i},readScalar:pf,writeScalar:nM,debug:rM}}function rM(t){if(t===null)return"null";switch(typeof t){case"object":return Array.isArray(t)?"array":"object";case"string":return t.length>100?"string":`"${t.split('"').join('\\"')}"`;default:return String(t)}}function pf(t,e,n){switch(t){case z.DOUBLE:case z.FLOAT:if(e===null)return 0;if(e==="NaN")return Number.NaN;if(e==="Infinity")return Number.POSITIVE_INFINITY;if(e==="-Infinity")return Number.NEGATIVE_INFINITY;if(e===""||typeof e=="string"&&e.trim().length!==e.length||typeof e!="string"&&typeof e!="number")break;let r=Number(e);if(Number.isNaN(r)||!Number.isFinite(r))break;return t==z.FLOAT&&Dm(r),r;case z.INT32:case z.FIXED32:case z.SFIXED32:case z.SINT32:case z.UINT32:if(e===null)return 0;let o;if(typeof e=="number"?o=e:typeof e=="string"&&e.length>0&&e.trim().length===e.length&&(o=Number(e)),o===void 0)break;return t==z.UINT32?ff(o):Il(o),o;case z.INT64:case z.SFIXED64:case z.SINT64:if(e===null)return Ne.zero;if(typeof e!="number"&&typeof e!="string")break;let i=Ne.parse(e);return n?i.toString():i;case z.FIXED64:case z.UINT64:if(e===null)return Ne.zero;if(typeof e!="number"&&typeof e!="string")break;let s=Ne.uParse(e);return n?s.toString():s;case z.BOOL:if(e===null)return!1;if(typeof e!="boolean")break;return e;case z.STRING:if(e===null)return"";if(typeof e!="string")break;try{encodeURIComponent(e)}catch{throw new Error("invalid UTF8")}return e;case z.BYTES:if(e===null||e==="")return new Uint8Array(0);if(typeof e!="string")break;return Qi.dec(e)}throw new Error}function bS(t,e,n){if(e===null)return 0;switch(typeof e){case"number":if(Number.isInteger(e))return e;break;case"string":let r=t.findName(e);if(r||n)return r?.no;break}throw new Error(`cannot decode enum ${t.typeName} from JSON: ${rM(e)}`)}function Cz(t,e,n,r){var o;if(e===void 0)return e;if(e===0&&!n)return;if(r)return e;if(t.typeName=="google.protobuf.NullValue")return null;let i=t.findNumber(e);return(o=i?.name)!==null&&o!==void 0?o:e}function nM(t,e,n){if(e!==void 0)switch(t){case z.INT32:case z.SFIXED32:case z.SINT32:case z.FIXED32:case z.UINT32:return at(typeof e=="number"),e!=0||n?e:void 0;case z.FLOAT:case z.DOUBLE:return at(typeof e=="number"),Number.isNaN(e)?"NaN":e===Number.POSITIVE_INFINITY?"Infinity":e===Number.NEGATIVE_INFINITY?"-Infinity":e!==0||n?e:void 0;case z.STRING:return at(typeof e=="string"),e.length>0||n?e:void 0;case z.BOOL:return at(typeof e=="boolean"),e||n?e:void 0;case z.UINT64:case z.FIXED64:case z.INT64:case z.SFIXED64:case z.SINT64:return at(typeof e=="bigint"||typeof e=="string"||typeof e=="number"),n||e!=0?e.toString(10):void 0;case z.BYTES:return at(e instanceof Uint8Array),n||e.byteLength>0?Qi.enc(e):void 0}}function oM(){return Wm((t,e)=>function(r,o,i){if(r.kind=="map"){let s={};switch(r.V.kind){case"scalar":for(let[l,u]of Object.entries(o)){let c=e(r.V.T,u,!0);at(c!==void 0),s[l.toString()]=c}break;case"message":for(let[l,u]of Object.entries(o))s[l.toString()]=u.toJson(i);break;case"enum":let a=r.V.T;for(let[l,u]of Object.entries(o)){at(u===void 0||typeof u=="number");let c=t(a,u,!0,i.enumAsInteger);at(c!==void 0),s[l.toString()]=c}break}return i.emitDefaultValues||Object.keys(s).length>0?s:void 0}else if(r.repeated){let s=[];switch(r.kind){case"scalar":for(let a=0;a0?s:void 0}else switch(r.kind){case"scalar":return e(r.T,o,!!r.oneof||r.opt||i.emitDefaultValues);case"enum":return t(r.T,o,!!r.oneof||r.opt||i.emitDefaultValues,i.enumAsInteger);case"message":return o!==void 0?ea(r.T,o).toJson(i):void 0}})}function Km(){return{setEnumType:gS,initPartial(t,e){if(t===void 0)return;let n=e.getType();for(let r of n.fields.byMember()){let o=r.localName,i=e,s=t;if(s[o]!==void 0)switch(r.kind){case"oneof":let a=s[o].case;if(a===void 0)continue;let l=r.findField(a),u=s[o].value;l&&l.kind=="message"&&!(u instanceof l.T)?u=new l.T(u):l&&l.kind==="scalar"&&l.T===z.BYTES&&(u=mf(u)),i[o]={case:a,value:u};break;case"scalar":case"enum":let c=s[o];r.T===z.BYTES&&(c=r.repeated?c.map(mf):mf(c)),i[o]=c;break;case"map":switch(r.V.kind){case"scalar":case"enum":if(r.V.T===z.BYTES)for(let[p,m]of Object.entries(s[o]))i[o][p]=mf(m);else Object.assign(i[o],s[o]);break;case"message":let d=r.V.T;for(let p of Object.keys(s[o])){let m=s[o][p];d.fieldWrapper||(m=new d(m)),i[o][p]=m}break}break;case"message":let f=r.T;if(r.repeated)i[o]=s[o].map(d=>d instanceof f?d:new f(d));else if(s[o]!==void 0){let d=s[o];f.fieldWrapper?f.typeName==="google.protobuf.BytesValue"?i[o]=mf(d):i[o]=d:i[o]=d instanceof f?d:new f(d)}break}}},equals(t,e,n){return e===n?!0:!e||!n?!1:t.fields.byMember().every(r=>{let o=e[r.localName],i=n[r.localName];if(r.repeated){if(o.length!==i.length)return!1;switch(r.kind){case"message":return o.every((s,a)=>r.T.equals(s,i[a]));case"scalar":return o.every((s,a)=>ni(r.T,s,i[a]));case"enum":return o.every((s,a)=>ni(z.INT32,s,i[a]))}throw new Error(`repeated cannot contain ${r.kind}`)}switch(r.kind){case"message":return r.T.equals(o,i);case"enum":return ni(z.INT32,o,i);case"scalar":return ni(r.T,o,i);case"oneof":if(o.case!==i.case)return!1;let s=r.findField(o.case);if(s===void 0)return!0;switch(s.kind){case"message":return s.T.equals(o.value,i.value);case"enum":return ni(z.INT32,o.value,i.value);case"scalar":return ni(s.T,o.value,i.value)}throw new Error(`oneof cannot contain ${s.kind}`);case"map":let a=Object.keys(o).concat(Object.keys(i));switch(r.V.kind){case"message":let l=r.V.T;return a.every(c=>l.equals(o[c],i[c]));case"enum":return a.every(c=>ni(z.INT32,o[c],i[c]));case"scalar":let u=r.V.T;return a.every(c=>ni(u,o[c],i[c]))}break}})},clone(t){let e=t.getType(),n=new e,r=n;for(let o of e.fields.byMember()){let i=t[o.localName],s;if(o.repeated)s=i.map(Gm);else if(o.kind=="map"){s=r[o.localName];for(let[a,l]of Object.entries(i))s[a]=Gm(l)}else o.kind=="oneof"?s=o.findField(i.case)?{case:i.case,value:Gm(i.value)}:{case:void 0}:s=Gm(i);r[o.localName]=s}return n}}}function Gm(t){if(t===void 0)return t;if(t instanceof N)return t.clone();if(t instanceof Uint8Array){let e=new Uint8Array(t.byteLength);return e.set(t),e}return t}function mf(t){return t instanceof Uint8Array?t:new Uint8Array(t)}var Dl=class{constructor(e,n){this._fields=e,this._normalizer=n}findJsonName(e){if(!this.jsonNames){let n={};for(let r of this.list())n[r.jsonName]=n[r.name]=r;this.jsonNames=n}return this.jsonNames[e]}find(e){if(!this.numbers){let n={};for(let r of this.list())n[r.no]=r;this.numbers=n}return this.numbers[e]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((e,n)=>e.no-n.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];let e=this.members,n;for(let r of this.list())r.oneof?r.oneof!==n&&(n=r.oneof,e.push(n)):e.push(r)}return this.members}};function hf(t,e){let n=sM(t);return e?n:Nz(Oz(n))}function iM(t){return hf(t,!1)}var Ym=sM;function sM(t){let e=!1,n=[];for(let r=0;r`${t}$`,Oz=t=>Pz.has(t)?aM(t):t,Nz=t=>Tz.has(t)?aM(t):t;var Fl=class{constructor(e){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.default=void 0,this.fields=[],this.name=e,this.localName=iM(e)}addField(e){at(e.oneof===this,`field ${e.name} not one of ${this.name}`),this.fields.push(e)}findField(e){if(!this._lookup){this._lookup=Object.create(null);for(let n=0;n0?`: ${a}`:""))}return n.writeUnknownFields&&this.writeUnknownFields(t,e),e}})}function uM(){return Wm((t,e)=>function(r,o,i){if(r.kind=="map"){let s={};switch(r.V.kind){case"scalar":for(let[l,u]of Object.entries(o)){let c=e(r.V.T,u,!0);at(c!==void 0),s[l.toString()]=c}break;case"message":for(let[l,u]of Object.entries(o))s[l.toString()]=u.toJson(i);break;case"enum":let a=r.V.T;for(let[l,u]of Object.entries(o)){at(u===void 0||typeof u=="number");let c=t(a,u,!0,i.enumAsInteger);at(c!==void 0),s[l.toString()]=c}break}return i.emitDefaultValues||Object.keys(s).length>0?s:void 0}else if(r.repeated){let s=[];switch(r.kind){case"scalar":for(let a=0;a0?s:void 0}else{if(o===void 0){if(!r.oneof&&!r.opt)throw"required field not set";return}switch(r.kind){case"scalar":return e(r.T,o,!0);case"enum":return t(r.T,o,!0,i.enumAsInteger);case"message":return ea(r.T,o).toJson(i)}}})}var M=Fm("proto2",uM(),lM(),Object.assign(Object.assign({},Km()),{newFieldList(t){return new Dl(t,Iz)},initFields(t){for(let e of t.getType().fields.byMember()){let n=e.localName,r=t;if(e.repeated){r[n]=[];continue}switch(e.kind){case"oneof":r[n]={case:void 0};break;case"map":r[n]={};break;case"scalar":case"enum":case"message":break}}}}));function Iz(t){var e,n,r,o,i;let s=[],a;for(let l of typeof t=="function"?t():t){let u=l;if(u.localName=hf(l.name,l.oneof!==void 0),u.jsonName=(e=l.jsonName)!==null&&e!==void 0?e:Ym(l.name),u.repeated=(n=l.repeated)!==null&&n!==void 0?n:!1,l.kind=="scalar"&&(u.L=(r=l.L)!==null&&r!==void 0?r:Pr.BIGINT),l.oneof!==void 0){let c=typeof l.oneof=="string"?l.oneof:l.oneof.name;(!a||a.name!=c)&&(a=new Fl(c)),u.oneof=a,a.addField(u)}l.kind=="message"&&(u.delimited=(o=l.delimited)!==null&&o!==void 0?o:!1),u.packed=(i=l.packed)!==null&&i!==void 0?i:!1,s.push(u)}return s}var le;(function(t){t[t.Unary=0]="Unary",t[t.ServerStreaming=1]="ServerStreaming",t[t.ClientStreaming=2]="ClientStreaming",t[t.BiDiStreaming=3]="BiDiStreaming"})(le||(le={}));var gf;(function(t){t[t.NoSideEffects=1]="NoSideEffects",t[t.Idempotent=2]="Idempotent"})(gf||(gf={}));var Zi;(function(t){t[t.EDITION_UNKNOWN=0]="EDITION_UNKNOWN",t[t.EDITION_PROTO2=998]="EDITION_PROTO2",t[t.EDITION_PROTO3=999]="EDITION_PROTO3",t[t.EDITION_2023=1e3]="EDITION_2023",t[t.EDITION_1_TEST_ONLY=1]="EDITION_1_TEST_ONLY",t[t.EDITION_2_TEST_ONLY=2]="EDITION_2_TEST_ONLY",t[t.EDITION_99997_TEST_ONLY=99997]="EDITION_99997_TEST_ONLY",t[t.EDITION_99998_TEST_ONLY=99998]="EDITION_99998_TEST_ONLY",t[t.EDITION_99999_TEST_ONLY=99999]="EDITION_99999_TEST_ONLY"})(Zi||(Zi={}));M.util.setEnumType(Zi,"google.protobuf.Edition",[{no:0,name:"EDITION_UNKNOWN"},{no:998,name:"EDITION_PROTO2"},{no:999,name:"EDITION_PROTO3"},{no:1e3,name:"EDITION_2023"},{no:1,name:"EDITION_1_TEST_ONLY"},{no:2,name:"EDITION_2_TEST_ONLY"},{no:99997,name:"EDITION_99997_TEST_ONLY"},{no:99998,name:"EDITION_99998_TEST_ONLY"},{no:99999,name:"EDITION_99999_TEST_ONLY"}]);var yf=class t extends N{constructor(e){super(),this.file=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};yf.runtime=M;yf.typeName="google.protobuf.FileDescriptorSet";yf.fields=M.util.newFieldList(()=>[{no:1,name:"file",kind:"message",T:Bl,repeated:!0}]);var Bl=class t extends N{constructor(e){super(),this.dependency=[],this.publicDependency=[],this.weakDependency=[],this.messageType=[],this.enumType=[],this.service=[],this.extension=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Bl.runtime=M;Bl.typeName="google.protobuf.FileDescriptorProto";Bl.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"package",kind:"scalar",T:9,opt:!0},{no:3,name:"dependency",kind:"scalar",T:9,repeated:!0},{no:10,name:"public_dependency",kind:"scalar",T:5,repeated:!0},{no:11,name:"weak_dependency",kind:"scalar",T:5,repeated:!0},{no:4,name:"message_type",kind:"message",T:xo,repeated:!0},{no:5,name:"enum_type",kind:"message",T:ii,repeated:!0},{no:6,name:"service",kind:"message",T:$l,repeated:!0},{no:7,name:"extension",kind:"message",T:es,repeated:!0},{no:8,name:"options",kind:"message",T:Gl,opt:!0},{no:9,name:"source_code_info",kind:"message",T:iu,opt:!0},{no:12,name:"syntax",kind:"scalar",T:9,opt:!0},{no:14,name:"edition",kind:"enum",T:M.getEnumType(Zi),opt:!0}]);var xo=class t extends N{constructor(e){super(),this.field=[],this.extension=[],this.nestedType=[],this.enumType=[],this.extensionRange=[],this.oneofDecl=[],this.reservedRange=[],this.reservedName=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};xo.runtime=M;xo.typeName="google.protobuf.DescriptorProto";xo.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"field",kind:"message",T:es,repeated:!0},{no:6,name:"extension",kind:"message",T:es,repeated:!0},{no:3,name:"nested_type",kind:"message",T:xo,repeated:!0},{no:4,name:"enum_type",kind:"message",T:ii,repeated:!0},{no:5,name:"extension_range",kind:"message",T:Jl,repeated:!0},{no:8,name:"oneof_decl",kind:"message",T:ql,repeated:!0},{no:7,name:"options",kind:"message",T:Kl,opt:!0},{no:9,name:"reserved_range",kind:"message",T:Ul,repeated:!0},{no:10,name:"reserved_name",kind:"scalar",T:9,repeated:!0}]);var Jl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Jl.runtime=M;Jl.typeName="google.protobuf.DescriptorProto.ExtensionRange";Jl.fields=M.util.newFieldList(()=>[{no:1,name:"start",kind:"scalar",T:5,opt:!0},{no:2,name:"end",kind:"scalar",T:5,opt:!0},{no:3,name:"options",kind:"message",T:_l,opt:!0}]);var Ul=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Ul.runtime=M;Ul.typeName="google.protobuf.DescriptorProto.ReservedRange";Ul.fields=M.util.newFieldList(()=>[{no:1,name:"start",kind:"scalar",T:5,opt:!0},{no:2,name:"end",kind:"scalar",T:5,opt:!0}]);var _l=class t extends N{constructor(e){super(),this.uninterpretedOption=[],this.declaration=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};_l.runtime=M;_l.typeName="google.protobuf.ExtensionRangeOptions";_l.fields=M.util.newFieldList(()=>[{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0},{no:2,name:"declaration",kind:"message",T:zl,repeated:!0},{no:50,name:"features",kind:"message",T:Dn,opt:!0},{no:3,name:"verification",kind:"enum",T:M.getEnumType(vf),opt:!0,default:vf.UNVERIFIED}]);var vf;(function(t){t[t.DECLARATION=0]="DECLARATION",t[t.UNVERIFIED=1]="UNVERIFIED"})(vf||(vf={}));M.util.setEnumType(vf,"google.protobuf.ExtensionRangeOptions.VerificationState",[{no:0,name:"DECLARATION"},{no:1,name:"UNVERIFIED"}]);var zl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};zl.runtime=M;zl.typeName="google.protobuf.ExtensionRangeOptions.Declaration";zl.fields=M.util.newFieldList(()=>[{no:1,name:"number",kind:"scalar",T:5,opt:!0},{no:2,name:"full_name",kind:"scalar",T:9,opt:!0},{no:3,name:"type",kind:"scalar",T:9,opt:!0},{no:5,name:"reserved",kind:"scalar",T:8,opt:!0},{no:6,name:"repeated",kind:"scalar",T:8,opt:!0}]);var es=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};es.runtime=M;es.typeName="google.protobuf.FieldDescriptorProto";es.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:3,name:"number",kind:"scalar",T:5,opt:!0},{no:4,name:"label",kind:"enum",T:M.getEnumType(Vl),opt:!0},{no:5,name:"type",kind:"enum",T:M.getEnumType(lt),opt:!0},{no:6,name:"type_name",kind:"scalar",T:9,opt:!0},{no:2,name:"extendee",kind:"scalar",T:9,opt:!0},{no:7,name:"default_value",kind:"scalar",T:9,opt:!0},{no:9,name:"oneof_index",kind:"scalar",T:5,opt:!0},{no:10,name:"json_name",kind:"scalar",T:9,opt:!0},{no:8,name:"options",kind:"message",T:Yl,opt:!0},{no:17,name:"proto3_optional",kind:"scalar",T:8,opt:!0}]);var lt;(function(t){t[t.DOUBLE=1]="DOUBLE",t[t.FLOAT=2]="FLOAT",t[t.INT64=3]="INT64",t[t.UINT64=4]="UINT64",t[t.INT32=5]="INT32",t[t.FIXED64=6]="FIXED64",t[t.FIXED32=7]="FIXED32",t[t.BOOL=8]="BOOL",t[t.STRING=9]="STRING",t[t.GROUP=10]="GROUP",t[t.MESSAGE=11]="MESSAGE",t[t.BYTES=12]="BYTES",t[t.UINT32=13]="UINT32",t[t.ENUM=14]="ENUM",t[t.SFIXED32=15]="SFIXED32",t[t.SFIXED64=16]="SFIXED64",t[t.SINT32=17]="SINT32",t[t.SINT64=18]="SINT64"})(lt||(lt={}));M.util.setEnumType(lt,"google.protobuf.FieldDescriptorProto.Type",[{no:1,name:"TYPE_DOUBLE"},{no:2,name:"TYPE_FLOAT"},{no:3,name:"TYPE_INT64"},{no:4,name:"TYPE_UINT64"},{no:5,name:"TYPE_INT32"},{no:6,name:"TYPE_FIXED64"},{no:7,name:"TYPE_FIXED32"},{no:8,name:"TYPE_BOOL"},{no:9,name:"TYPE_STRING"},{no:10,name:"TYPE_GROUP"},{no:11,name:"TYPE_MESSAGE"},{no:12,name:"TYPE_BYTES"},{no:13,name:"TYPE_UINT32"},{no:14,name:"TYPE_ENUM"},{no:15,name:"TYPE_SFIXED32"},{no:16,name:"TYPE_SFIXED64"},{no:17,name:"TYPE_SINT32"},{no:18,name:"TYPE_SINT64"}]);var Vl;(function(t){t[t.OPTIONAL=1]="OPTIONAL",t[t.REPEATED=3]="REPEATED",t[t.REQUIRED=2]="REQUIRED"})(Vl||(Vl={}));M.util.setEnumType(Vl,"google.protobuf.FieldDescriptorProto.Label",[{no:1,name:"LABEL_OPTIONAL"},{no:3,name:"LABEL_REPEATED"},{no:2,name:"LABEL_REQUIRED"}]);var ql=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ql.runtime=M;ql.typeName="google.protobuf.OneofDescriptorProto";ql.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"options",kind:"message",T:Ql,opt:!0}]);var ii=class t extends N{constructor(e){super(),this.value=[],this.reservedRange=[],this.reservedName=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ii.runtime=M;ii.typeName="google.protobuf.EnumDescriptorProto";ii.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"value",kind:"message",T:Hl,repeated:!0},{no:3,name:"options",kind:"message",T:Zl,opt:!0},{no:4,name:"reserved_range",kind:"message",T:jl,repeated:!0},{no:5,name:"reserved_name",kind:"scalar",T:9,repeated:!0}]);var jl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};jl.runtime=M;jl.typeName="google.protobuf.EnumDescriptorProto.EnumReservedRange";jl.fields=M.util.newFieldList(()=>[{no:1,name:"start",kind:"scalar",T:5,opt:!0},{no:2,name:"end",kind:"scalar",T:5,opt:!0}]);var Hl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Hl.runtime=M;Hl.typeName="google.protobuf.EnumValueDescriptorProto";Hl.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"number",kind:"scalar",T:5,opt:!0},{no:3,name:"options",kind:"message",T:eu,opt:!0}]);var $l=class t extends N{constructor(e){super(),this.method=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};$l.runtime=M;$l.typeName="google.protobuf.ServiceDescriptorProto";$l.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"method",kind:"message",T:Wl,repeated:!0},{no:3,name:"options",kind:"message",T:tu,opt:!0}]);var Wl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Wl.runtime=M;Wl.typeName="google.protobuf.MethodDescriptorProto";Wl.fields=M.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9,opt:!0},{no:2,name:"input_type",kind:"scalar",T:9,opt:!0},{no:3,name:"output_type",kind:"scalar",T:9,opt:!0},{no:4,name:"options",kind:"message",T:nu,opt:!0},{no:5,name:"client_streaming",kind:"scalar",T:8,opt:!0,default:!1},{no:6,name:"server_streaming",kind:"scalar",T:8,opt:!0,default:!1}]);var Gl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Gl.runtime=M;Gl.typeName="google.protobuf.FileOptions";Gl.fields=M.util.newFieldList(()=>[{no:1,name:"java_package",kind:"scalar",T:9,opt:!0},{no:8,name:"java_outer_classname",kind:"scalar",T:9,opt:!0},{no:10,name:"java_multiple_files",kind:"scalar",T:8,opt:!0,default:!1},{no:20,name:"java_generate_equals_and_hash",kind:"scalar",T:8,opt:!0},{no:27,name:"java_string_check_utf8",kind:"scalar",T:8,opt:!0,default:!1},{no:9,name:"optimize_for",kind:"enum",T:M.getEnumType(wf),opt:!0,default:wf.SPEED},{no:11,name:"go_package",kind:"scalar",T:9,opt:!0},{no:16,name:"cc_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:17,name:"java_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:18,name:"py_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:42,name:"php_generic_services",kind:"scalar",T:8,opt:!0,default:!1},{no:23,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:31,name:"cc_enable_arenas",kind:"scalar",T:8,opt:!0,default:!0},{no:36,name:"objc_class_prefix",kind:"scalar",T:9,opt:!0},{no:37,name:"csharp_namespace",kind:"scalar",T:9,opt:!0},{no:39,name:"swift_prefix",kind:"scalar",T:9,opt:!0},{no:40,name:"php_class_prefix",kind:"scalar",T:9,opt:!0},{no:41,name:"php_namespace",kind:"scalar",T:9,opt:!0},{no:44,name:"php_metadata_namespace",kind:"scalar",T:9,opt:!0},{no:45,name:"ruby_package",kind:"scalar",T:9,opt:!0},{no:50,name:"features",kind:"message",T:Dn,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var wf;(function(t){t[t.SPEED=1]="SPEED",t[t.CODE_SIZE=2]="CODE_SIZE",t[t.LITE_RUNTIME=3]="LITE_RUNTIME"})(wf||(wf={}));M.util.setEnumType(wf,"google.protobuf.FileOptions.OptimizeMode",[{no:1,name:"SPEED"},{no:2,name:"CODE_SIZE"},{no:3,name:"LITE_RUNTIME"}]);var Kl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Kl.runtime=M;Kl.typeName="google.protobuf.MessageOptions";Kl.fields=M.util.newFieldList(()=>[{no:1,name:"message_set_wire_format",kind:"scalar",T:8,opt:!0,default:!1},{no:2,name:"no_standard_descriptor_accessor",kind:"scalar",T:8,opt:!0,default:!1},{no:3,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:7,name:"map_entry",kind:"scalar",T:8,opt:!0},{no:11,name:"deprecated_legacy_json_field_conflicts",kind:"scalar",T:8,opt:!0},{no:12,name:"features",kind:"message",T:Dn,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var Yl=class t extends N{constructor(e){super(),this.targets=[],this.editionDefaults=[],this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Yl.runtime=M;Yl.typeName="google.protobuf.FieldOptions";Yl.fields=M.util.newFieldList(()=>[{no:1,name:"ctype",kind:"enum",T:M.getEnumType(xf),opt:!0,default:xf.STRING},{no:2,name:"packed",kind:"scalar",T:8,opt:!0},{no:6,name:"jstype",kind:"enum",T:M.getEnumType(Sf),opt:!0,default:Sf.JS_NORMAL},{no:5,name:"lazy",kind:"scalar",T:8,opt:!0,default:!1},{no:15,name:"unverified_lazy",kind:"scalar",T:8,opt:!0,default:!1},{no:3,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:10,name:"weak",kind:"scalar",T:8,opt:!0,default:!1},{no:16,name:"debug_redact",kind:"scalar",T:8,opt:!0,default:!1},{no:17,name:"retention",kind:"enum",T:M.getEnumType(Xm),opt:!0},{no:19,name:"targets",kind:"enum",T:M.getEnumType(Qm),repeated:!0},{no:20,name:"edition_defaults",kind:"message",T:Xl,repeated:!0},{no:21,name:"features",kind:"message",T:Dn,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var xf;(function(t){t[t.STRING=0]="STRING",t[t.CORD=1]="CORD",t[t.STRING_PIECE=2]="STRING_PIECE"})(xf||(xf={}));M.util.setEnumType(xf,"google.protobuf.FieldOptions.CType",[{no:0,name:"STRING"},{no:1,name:"CORD"},{no:2,name:"STRING_PIECE"}]);var Sf;(function(t){t[t.JS_NORMAL=0]="JS_NORMAL",t[t.JS_STRING=1]="JS_STRING",t[t.JS_NUMBER=2]="JS_NUMBER"})(Sf||(Sf={}));M.util.setEnumType(Sf,"google.protobuf.FieldOptions.JSType",[{no:0,name:"JS_NORMAL"},{no:1,name:"JS_STRING"},{no:2,name:"JS_NUMBER"}]);var Xm;(function(t){t[t.RETENTION_UNKNOWN=0]="RETENTION_UNKNOWN",t[t.RETENTION_RUNTIME=1]="RETENTION_RUNTIME",t[t.RETENTION_SOURCE=2]="RETENTION_SOURCE"})(Xm||(Xm={}));M.util.setEnumType(Xm,"google.protobuf.FieldOptions.OptionRetention",[{no:0,name:"RETENTION_UNKNOWN"},{no:1,name:"RETENTION_RUNTIME"},{no:2,name:"RETENTION_SOURCE"}]);var Qm;(function(t){t[t.TARGET_TYPE_UNKNOWN=0]="TARGET_TYPE_UNKNOWN",t[t.TARGET_TYPE_FILE=1]="TARGET_TYPE_FILE",t[t.TARGET_TYPE_EXTENSION_RANGE=2]="TARGET_TYPE_EXTENSION_RANGE",t[t.TARGET_TYPE_MESSAGE=3]="TARGET_TYPE_MESSAGE",t[t.TARGET_TYPE_FIELD=4]="TARGET_TYPE_FIELD",t[t.TARGET_TYPE_ONEOF=5]="TARGET_TYPE_ONEOF",t[t.TARGET_TYPE_ENUM=6]="TARGET_TYPE_ENUM",t[t.TARGET_TYPE_ENUM_ENTRY=7]="TARGET_TYPE_ENUM_ENTRY",t[t.TARGET_TYPE_SERVICE=8]="TARGET_TYPE_SERVICE",t[t.TARGET_TYPE_METHOD=9]="TARGET_TYPE_METHOD"})(Qm||(Qm={}));M.util.setEnumType(Qm,"google.protobuf.FieldOptions.OptionTargetType",[{no:0,name:"TARGET_TYPE_UNKNOWN"},{no:1,name:"TARGET_TYPE_FILE"},{no:2,name:"TARGET_TYPE_EXTENSION_RANGE"},{no:3,name:"TARGET_TYPE_MESSAGE"},{no:4,name:"TARGET_TYPE_FIELD"},{no:5,name:"TARGET_TYPE_ONEOF"},{no:6,name:"TARGET_TYPE_ENUM"},{no:7,name:"TARGET_TYPE_ENUM_ENTRY"},{no:8,name:"TARGET_TYPE_SERVICE"},{no:9,name:"TARGET_TYPE_METHOD"}]);var Xl=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Xl.runtime=M;Xl.typeName="google.protobuf.FieldOptions.EditionDefault";Xl.fields=M.util.newFieldList(()=>[{no:3,name:"edition",kind:"enum",T:M.getEnumType(Zi),opt:!0},{no:2,name:"value",kind:"scalar",T:9,opt:!0}]);var Ql=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Ql.runtime=M;Ql.typeName="google.protobuf.OneofOptions";Ql.fields=M.util.newFieldList(()=>[{no:1,name:"features",kind:"message",T:Dn,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var Zl=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Zl.runtime=M;Zl.typeName="google.protobuf.EnumOptions";Zl.fields=M.util.newFieldList(()=>[{no:2,name:"allow_alias",kind:"scalar",T:8,opt:!0},{no:3,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:6,name:"deprecated_legacy_json_field_conflicts",kind:"scalar",T:8,opt:!0},{no:7,name:"features",kind:"message",T:Dn,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var eu=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};eu.runtime=M;eu.typeName="google.protobuf.EnumValueOptions";eu.fields=M.util.newFieldList(()=>[{no:1,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:2,name:"features",kind:"message",T:Dn,opt:!0},{no:3,name:"debug_redact",kind:"scalar",T:8,opt:!0,default:!1},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var tu=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};tu.runtime=M;tu.typeName="google.protobuf.ServiceOptions";tu.fields=M.util.newFieldList(()=>[{no:34,name:"features",kind:"message",T:Dn,opt:!0},{no:33,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var nu=class t extends N{constructor(e){super(),this.uninterpretedOption=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};nu.runtime=M;nu.typeName="google.protobuf.MethodOptions";nu.fields=M.util.newFieldList(()=>[{no:33,name:"deprecated",kind:"scalar",T:8,opt:!0,default:!1},{no:34,name:"idempotency_level",kind:"enum",T:M.getEnumType(kf),opt:!0,default:kf.IDEMPOTENCY_UNKNOWN},{no:35,name:"features",kind:"message",T:Dn,opt:!0},{no:999,name:"uninterpreted_option",kind:"message",T:Yn,repeated:!0}]);var kf;(function(t){t[t.IDEMPOTENCY_UNKNOWN=0]="IDEMPOTENCY_UNKNOWN",t[t.NO_SIDE_EFFECTS=1]="NO_SIDE_EFFECTS",t[t.IDEMPOTENT=2]="IDEMPOTENT"})(kf||(kf={}));M.util.setEnumType(kf,"google.protobuf.MethodOptions.IdempotencyLevel",[{no:0,name:"IDEMPOTENCY_UNKNOWN"},{no:1,name:"NO_SIDE_EFFECTS"},{no:2,name:"IDEMPOTENT"}]);var Yn=class t extends N{constructor(e){super(),this.name=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Yn.runtime=M;Yn.typeName="google.protobuf.UninterpretedOption";Yn.fields=M.util.newFieldList(()=>[{no:2,name:"name",kind:"message",T:ru,repeated:!0},{no:3,name:"identifier_value",kind:"scalar",T:9,opt:!0},{no:4,name:"positive_int_value",kind:"scalar",T:4,opt:!0},{no:5,name:"negative_int_value",kind:"scalar",T:3,opt:!0},{no:6,name:"double_value",kind:"scalar",T:1,opt:!0},{no:7,name:"string_value",kind:"scalar",T:12,opt:!0},{no:8,name:"aggregate_value",kind:"scalar",T:9,opt:!0}]);var ru=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ru.runtime=M;ru.typeName="google.protobuf.UninterpretedOption.NamePart";ru.fields=M.util.newFieldList(()=>[{no:1,name:"name_part",kind:"scalar",T:9},{no:2,name:"is_extension",kind:"scalar",T:8}]);var Dn=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Dn.runtime=M;Dn.typeName="google.protobuf.FeatureSet";Dn.fields=M.util.newFieldList(()=>[{no:1,name:"field_presence",kind:"enum",T:M.getEnumType(Zm),opt:!0},{no:2,name:"enum_type",kind:"enum",T:M.getEnumType(eh),opt:!0},{no:3,name:"repeated_field_encoding",kind:"enum",T:M.getEnumType(th),opt:!0},{no:4,name:"utf8_validation",kind:"enum",T:M.getEnumType(nh),opt:!0},{no:5,name:"message_encoding",kind:"enum",T:M.getEnumType(rh),opt:!0},{no:6,name:"json_format",kind:"enum",T:M.getEnumType(oh),opt:!0}]);var Zm;(function(t){t[t.FIELD_PRESENCE_UNKNOWN=0]="FIELD_PRESENCE_UNKNOWN",t[t.EXPLICIT=1]="EXPLICIT",t[t.IMPLICIT=2]="IMPLICIT",t[t.LEGACY_REQUIRED=3]="LEGACY_REQUIRED"})(Zm||(Zm={}));M.util.setEnumType(Zm,"google.protobuf.FeatureSet.FieldPresence",[{no:0,name:"FIELD_PRESENCE_UNKNOWN"},{no:1,name:"EXPLICIT"},{no:2,name:"IMPLICIT"},{no:3,name:"LEGACY_REQUIRED"}]);var eh;(function(t){t[t.ENUM_TYPE_UNKNOWN=0]="ENUM_TYPE_UNKNOWN",t[t.OPEN=1]="OPEN",t[t.CLOSED=2]="CLOSED"})(eh||(eh={}));M.util.setEnumType(eh,"google.protobuf.FeatureSet.EnumType",[{no:0,name:"ENUM_TYPE_UNKNOWN"},{no:1,name:"OPEN"},{no:2,name:"CLOSED"}]);var th;(function(t){t[t.REPEATED_FIELD_ENCODING_UNKNOWN=0]="REPEATED_FIELD_ENCODING_UNKNOWN",t[t.PACKED=1]="PACKED",t[t.EXPANDED=2]="EXPANDED"})(th||(th={}));M.util.setEnumType(th,"google.protobuf.FeatureSet.RepeatedFieldEncoding",[{no:0,name:"REPEATED_FIELD_ENCODING_UNKNOWN"},{no:1,name:"PACKED"},{no:2,name:"EXPANDED"}]);var nh;(function(t){t[t.UTF8_VALIDATION_UNKNOWN=0]="UTF8_VALIDATION_UNKNOWN",t[t.NONE=1]="NONE",t[t.VERIFY=2]="VERIFY"})(nh||(nh={}));M.util.setEnumType(nh,"google.protobuf.FeatureSet.Utf8Validation",[{no:0,name:"UTF8_VALIDATION_UNKNOWN"},{no:1,name:"NONE"},{no:2,name:"VERIFY"}]);var rh;(function(t){t[t.MESSAGE_ENCODING_UNKNOWN=0]="MESSAGE_ENCODING_UNKNOWN",t[t.LENGTH_PREFIXED=1]="LENGTH_PREFIXED",t[t.DELIMITED=2]="DELIMITED"})(rh||(rh={}));M.util.setEnumType(rh,"google.protobuf.FeatureSet.MessageEncoding",[{no:0,name:"MESSAGE_ENCODING_UNKNOWN"},{no:1,name:"LENGTH_PREFIXED"},{no:2,name:"DELIMITED"}]);var oh;(function(t){t[t.JSON_FORMAT_UNKNOWN=0]="JSON_FORMAT_UNKNOWN",t[t.ALLOW=1]="ALLOW",t[t.LEGACY_BEST_EFFORT=2]="LEGACY_BEST_EFFORT"})(oh||(oh={}));M.util.setEnumType(oh,"google.protobuf.FeatureSet.JsonFormat",[{no:0,name:"JSON_FORMAT_UNKNOWN"},{no:1,name:"ALLOW"},{no:2,name:"LEGACY_BEST_EFFORT"}]);var bf=class t extends N{constructor(e){super(),this.defaults=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};bf.runtime=M;bf.typeName="google.protobuf.FeatureSetDefaults";bf.fields=M.util.newFieldList(()=>[{no:1,name:"defaults",kind:"message",T:ou,repeated:!0},{no:4,name:"minimum_edition",kind:"enum",T:M.getEnumType(Zi),opt:!0},{no:5,name:"maximum_edition",kind:"enum",T:M.getEnumType(Zi),opt:!0}]);var ou=class t extends N{constructor(e){super(),M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};ou.runtime=M;ou.typeName="google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault";ou.fields=M.util.newFieldList(()=>[{no:3,name:"edition",kind:"enum",T:M.getEnumType(Zi),opt:!0},{no:2,name:"features",kind:"message",T:Dn,opt:!0}]);var iu=class t extends N{constructor(e){super(),this.location=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};iu.runtime=M;iu.typeName="google.protobuf.SourceCodeInfo";iu.fields=M.util.newFieldList(()=>[{no:1,name:"location",kind:"message",T:su,repeated:!0}]);var su=class t extends N{constructor(e){super(),this.path=[],this.span=[],this.leadingDetachedComments=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};su.runtime=M;su.typeName="google.protobuf.SourceCodeInfo.Location";su.fields=M.util.newFieldList(()=>[{no:1,name:"path",kind:"scalar",T:5,repeated:!0,packed:!0},{no:2,name:"span",kind:"scalar",T:5,repeated:!0,packed:!0},{no:3,name:"leading_comments",kind:"scalar",T:9,opt:!0},{no:4,name:"trailing_comments",kind:"scalar",T:9,opt:!0},{no:6,name:"leading_detached_comments",kind:"scalar",T:9,repeated:!0}]);var Ef=class t extends N{constructor(e){super(),this.annotation=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};Ef.runtime=M;Ef.typeName="google.protobuf.GeneratedCodeInfo";Ef.fields=M.util.newFieldList(()=>[{no:1,name:"annotation",kind:"message",T:au,repeated:!0}]);var au=class t extends N{constructor(e){super(),this.path=[],M.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return M.util.equals(t,e,n)}};au.runtime=M;au.typeName="google.protobuf.GeneratedCodeInfo.Annotation";au.fields=M.util.newFieldList(()=>[{no:1,name:"path",kind:"scalar",T:5,repeated:!0,packed:!0},{no:2,name:"source_file",kind:"scalar",T:9,opt:!0},{no:3,name:"begin",kind:"scalar",T:5,opt:!0},{no:4,name:"end",kind:"scalar",T:5,opt:!0},{no:5,name:"semantic",kind:"enum",T:M.getEnumType(ih),opt:!0}]);var ih;(function(t){t[t.NONE=0]="NONE",t[t.SET=1]="SET",t[t.ALIAS=2]="ALIAS"})(ih||(ih={}));M.util.setEnumType(ih,"google.protobuf.GeneratedCodeInfo.Annotation.Semantic",[{no:0,name:"NONE"},{no:1,name:"SET"},{no:2,name:"ALIAS"}]);var Mt=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};Mt.runtime=h;Mt.typeName="google.protobuf.Empty";Mt.fields=h.util.newFieldList(()=>[]);var sh=class t extends N{secret="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.VerifyUserRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"secret",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ah=class t extends N{secret="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.GroupInfoRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"secret",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},lh=class t extends N{groupId="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.GroupID";static fields=h.util.newFieldList(()=>[{no:1,name:"group_id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},uh=class t extends N{contentId="";groupId="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.ShareRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content_id",kind:"scalar",T:9},{no:2,name:"group_id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Rf=class t extends N{secret="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.GroupInvite";static fields=h.util.newFieldList(()=>[{no:1,name:"secret",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ch=class t extends N{groups=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.Groups";static fields=h.util.newFieldList(()=>[{no:1,name:"groups",kind:"message",T:si,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},cM=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.AnalyzeConversationRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},So=class t extends N{email="";password="";username="";config;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.User";static fields=h.util.newFieldList(()=>[{no:1,name:"email",kind:"scalar",T:9},{no:2,name:"password",kind:"scalar",T:9},{no:3,name:"username",kind:"scalar",T:9},{no:4,name:"config",kind:"message",T:Cf}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},si=class t extends N{id="";name="";users=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.Group";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"users",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Cf=class t extends N{domainWhitelist=[];offlineVoice=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.Config";static fields=h.util.newFieldList(()=>[{no:1,name:"domain_whitelist",kind:"scalar",T:9,repeated:!0},{no:2,name:"offline_voice",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},fh=class t extends N{user;success=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="user.LoginResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"user",kind:"message",T:So},{no:2,name:"success",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var dh=class t extends N{title="";createTime=0;updateTime=0;mapping={};conversationId="";conversationTemplateId="";currentNode="";gizmoId="";isArchived=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Conversation";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"create_time",kind:"scalar",T:1},{no:3,name:"update_time",kind:"scalar",T:1},{no:4,name:"mapping",kind:"map",K:9,V:{kind:"message",T:ES}},{no:5,name:"conversation_id",kind:"scalar",T:9},{no:6,name:"conversation_template_id",kind:"scalar",T:9},{no:7,name:"current_node",kind:"scalar",T:9},{no:8,name:"gizmo_id",kind:"scalar",T:9},{no:9,name:"is_archived",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ES=class t extends N{id="";message;parent="";children=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Node";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"message",kind:"message",T:RS},{no:3,name:"parent",kind:"scalar",T:9},{no:4,name:"children",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},RS=class t extends N{id="";author;createTime=0;content;status="";endTurn=!1;weight=0;metadata;recipient="";updateTime=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Message";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"author",kind:"message",T:TS},{no:3,name:"create_time",kind:"scalar",T:1},{no:4,name:"content",kind:"message",T:PS},{no:5,name:"status",kind:"scalar",T:9},{no:6,name:"end_turn",kind:"scalar",T:8},{no:7,name:"weight",kind:"scalar",T:5},{no:8,name:"metadata",kind:"message",T:CS},{no:9,name:"recipient",kind:"scalar",T:9},{no:10,name:"update_time",kind:"scalar",T:1}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},CS=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.MessageMetadata";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},TS=class t extends N{role="";metadata;name="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Author";static fields=h.util.newFieldList(()=>[{no:1,name:"role",kind:"scalar",T:9},{no:2,name:"metadata",kind:"message",T:IS},{no:3,name:"name",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},PS=class t extends N{contentType="";textParts=[];imageParts=[];text="";parts=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Content";static fields=h.util.newFieldList(()=>[{no:1,name:"content_type",kind:"scalar",T:9},{no:2,name:"text_parts",kind:"scalar",T:9,repeated:!0},{no:3,name:"image_parts",kind:"message",T:OS,repeated:!0},{no:4,name:"text",kind:"scalar",T:9},{no:5,name:"parts",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},OS=class t extends N{contentType="";assetPointer="";sizeBytes=Ne.zero;width=0;height=0;fovea=0;metadata;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.ImageAsset";static fields=h.util.newFieldList(()=>[{no:1,name:"content_type",kind:"scalar",T:9},{no:2,name:"asset_pointer",kind:"scalar",T:9},{no:3,name:"size_bytes",kind:"scalar",T:3},{no:4,name:"width",kind:"scalar",T:5},{no:5,name:"height",kind:"scalar",T:5},{no:6,name:"fovea",kind:"scalar",T:5},{no:7,name:"metadata",kind:"message",T:NS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},NS=class t extends N{dalle;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Metadata";static fields=h.util.newFieldList(()=>[{no:1,name:"dalle",kind:"message",T:MS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},MS=class t extends N{genId="";prompt="";seed=0;serializationTitle="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.DalleMetadata";static fields=h.util.newFieldList(()=>[{no:1,name:"gen_id",kind:"scalar",T:9},{no:2,name:"prompt",kind:"scalar",T:9},{no:3,name:"seed",kind:"scalar",T:13},{no:4,name:"serialization_title",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},IS=class t extends N{attachments=[];timestamp="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.AuthorMetadata";static fields=h.util.newFieldList(()=>[{no:1,name:"attachments",kind:"message",T:AS,repeated:!0},{no:2,name:"timestamp_",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},AS=class t extends N{id="";name="";mimeType="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chatgpt.Attachment";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"mimeType",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var ph=class t extends N{nodes=[];edges=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="browser.History";static fields=h.util.newFieldList(()=>[{no:1,name:"nodes",kind:"message",T:LS,repeated:!0},{no:2,name:"edges",kind:"message",T:DS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},LS=class t extends N{id="";url="";title="";open=0;close=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="browser.Node";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"title",kind:"scalar",T:9},{no:4,name:"open",kind:"scalar",T:1},{no:5,name:"close",kind:"scalar",T:1}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},DS=class t extends N{from="";to="";tab="";visitTime=0;visitDuration=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="browser.Edge";static fields=h.util.newFieldList(()=>[{no:1,name:"from",kind:"scalar",T:9},{no:2,name:"to",kind:"scalar",T:9},{no:3,name:"tab",kind:"scalar",T:9},{no:4,name:"visit_time",kind:"scalar",T:1},{no:5,name:"visit_duration",kind:"scalar",T:1}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var mh=class t extends N{publishDir="";baseUrl="";title="";paginate=0;theme=[];enableInlineShortcodes=!1;enableRobotsTxt=!1;buildDrafts=!1;buildFuture=!1;buildExpired=!1;enableEmoji=!1;pygmentsUseClasses=!1;mainSections=[];minify;languages={};outputs={};params;markup;services;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HugoConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"publish_dir",kind:"scalar",T:9},{no:2,name:"base_url",kind:"scalar",T:9},{no:3,name:"title",kind:"scalar",T:9},{no:4,name:"paginate",kind:"scalar",T:5},{no:5,name:"theme",kind:"scalar",T:9,repeated:!0},{no:6,name:"enable_inline_shortcodes",kind:"scalar",T:8},{no:7,name:"enable_robots_txt",kind:"scalar",T:8},{no:8,name:"build_drafts",kind:"scalar",T:8},{no:9,name:"build_future",kind:"scalar",T:8},{no:10,name:"build_expired",kind:"scalar",T:8},{no:11,name:"enable_emoji",kind:"scalar",T:8},{no:12,name:"pygments_use_classes",kind:"scalar",T:8},{no:13,name:"main_sections",kind:"scalar",T:9,repeated:!0},{no:14,name:"minify",kind:"message",T:FS},{no:15,name:"languages",kind:"map",K:9,V:{kind:"message",T:BS}},{no:16,name:"outputs",kind:"map",K:9,V:{kind:"message",T:HS}},{no:17,name:"params",kind:"message",T:WS},{no:18,name:"markup",kind:"message",T:_S},{no:19,name:"services",kind:"message",T:jS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},FS=class t extends N{disableXml=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.MinifyConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"disable_xml",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},BS=class t extends N{languageName="";weight=0;title="";taxonomies={};menu={};params={};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.LanguageConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"language_name",kind:"scalar",T:9},{no:2,name:"weight",kind:"scalar",T:5},{no:3,name:"title",kind:"scalar",T:9},{no:4,name:"taxonomies",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"menu",kind:"map",K:9,V:{kind:"message",T:$S}},{no:6,name:"params",kind:"map",K:9,V:{kind:"scalar",T:9}}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ta=class t extends N{name="";url="";weight=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.MenuItem";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9},{no:3,name:"weight",kind:"scalar",T:5}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},JS=class t extends N{url="";text="";appendFilePath=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.EditPostConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"append_file_path",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},US=class t extends N{disableHljs=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.AssetsConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"disable_hljs",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},_S=class t extends N{goldmark;highlight;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.MarkupConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"goldmark",kind:"message",T:zS},{no:2,name:"highlight",kind:"message",T:qS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},zS=class t extends N{renderer;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GoldmarkConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"renderer",kind:"message",T:VS}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},VS=class t extends N{unsafe=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RendererConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"unsafe",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},qS=class t extends N{noClasses=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HighlightConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"no_classes",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},jS=class t extends N{instagram;twitter;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ServicesConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"instagram",kind:"message",T:hh},{no:2,name:"twitter",kind:"message",T:hh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},hh=class t extends N{disableInlineCss=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ServiceConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"disable_inline_css",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},HS=class t extends N{values=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RepeatedString";static fields=h.util.newFieldList(()=>[{no:1,name:"values",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},$S=class t extends N{items=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RepeatedMenuItem";static fields=h.util.newFieldList(()=>[{no:1,name:"items",kind:"message",T:ta,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},WS=class t extends N{env="";description="";author="";defaultTheme="";showShareButtons=!1;showReadingTime=!1;displayFullLangName=!1;showPostNavLinks=!1;showBreadCrumbs=!1;showCodeCopyButtons=!1;showRssButtonInSectionTermList=!1;showAllPagesInArchive=!1;showPageNums=!1;showToc=!1;images=[];profileMode;homeInfoParams;socialIcons=[];editPost;assets;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ParamsConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"env",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9},{no:3,name:"author",kind:"scalar",T:9},{no:4,name:"default_theme",kind:"scalar",T:9},{no:5,name:"show_share_buttons",kind:"scalar",T:8},{no:6,name:"show_reading_time",kind:"scalar",T:8},{no:7,name:"display_full_lang_name",kind:"scalar",T:8},{no:8,name:"show_post_nav_links",kind:"scalar",T:8},{no:9,name:"show_bread_crumbs",kind:"scalar",T:8},{no:10,name:"show_code_copy_buttons",kind:"scalar",T:8},{no:11,name:"show_rss_button_in_section_term_list",kind:"scalar",T:8},{no:12,name:"show_all_pages_in_archive",kind:"scalar",T:8},{no:13,name:"show_page_nums",kind:"scalar",T:8},{no:14,name:"show_toc",kind:"scalar",T:8},{no:15,name:"images",kind:"scalar",T:9,repeated:!0},{no:16,name:"profile_mode",kind:"message",T:GS},{no:17,name:"home_info_params",kind:"message",T:YS},{no:18,name:"social_icons",kind:"message",T:XS,repeated:!0},{no:19,name:"edit_post",kind:"message",T:JS},{no:20,name:"assets",kind:"message",T:US}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},GS=class t extends N{enabled=!1;title="";imageUrl="";imageTitle="";buttons=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ProfileModeConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"enabled",kind:"scalar",T:8},{no:2,name:"title",kind:"scalar",T:9},{no:3,name:"image_url",kind:"scalar",T:9},{no:4,name:"image_title",kind:"scalar",T:9},{no:5,name:"buttons",kind:"message",T:KS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},KS=class t extends N{name="";url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ButtonConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},YS=class t extends N{title="";content="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HomeInfoParamsConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"content",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},XS=class t extends N{name="";title="";url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.SocialIconConfig";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"title",kind:"scalar",T:9},{no:3,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var gh=class t extends N{prompt="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.InferRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"prompt",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},yh=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.InferResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},vh=class t extends N{content;site;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.TypesResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Nh},{no:2,name:"site",kind:"message",T:Nh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},wh=class t extends N{contentTypes=[];tags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GetSourcesRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content_types",kind:"scalar",T:9,repeated:!0},{no:2,name:"tags",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},xh=class t extends N{captureDevice=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.VoiceInputRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"capture_device",kind:"scalar",T:5}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Sh=class t extends N{segment;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.VoiceInputResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"segment",kind:"message",T:lu}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},kh=class t extends N{parent="";children=[];connect=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.RelateRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"parent",kind:"scalar",T:9},{no:2,name:"children",kind:"scalar",T:9,repeated:!0},{no:3,name:"connect",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},bh=class t extends N{sources=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Sources";static fields=h.util.newFieldList(()=>[{no:1,name:"sources",kind:"message",T:QS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},QS=class t extends N{source;displayContent=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.EnumeratedSource";static fields=h.util.newFieldList(()=>[{no:1,name:"source",kind:"message",T:ek},{no:2,name:"display_content",kind:"message",T:ZS,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ZS=class t extends N{title="";description="";type="";content;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.DisplayContent";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"description",kind:"scalar",T:9},{no:3,name:"type",kind:"scalar",T:9},{no:4,name:"content",kind:"message",T:Ge}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ek=class t extends N{name="";type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Source";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"server",kind:"message",T:tk,oneof:"type"},{no:3,name:"folder",kind:"message",T:nk,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},tk=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Server";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},nk=class t extends N{path="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Folder";static fields=h.util.newFieldList(()=>[{no:2,name:"path",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Eh=class t extends N{contentId="";tags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.SetTagsRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content_id",kind:"scalar",T:9},{no:2,name:"tags",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Rh=class t extends N{groupId="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.TagRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"group_id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ch=class t extends N{tags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Tags";static fields=h.util.newFieldList(()=>[{no:1,name:"tags",kind:"message",T:Th,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Th=class t extends N{name="";subTags=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Tag";static fields=h.util.newFieldList(()=>[{no:1,name:"name",kind:"scalar",T:9},{no:2,name:"sub_tags",kind:"message",T:t,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ts=class t extends N{contentIds=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ContentIDs";static fields=h.util.newFieldList(()=>[{no:1,name:"content_ids",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Tf=class t extends N{content;tags=[];related=[];parents=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Contents";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Ge},{no:2,name:"tags",kind:"scalar",T:9,repeated:!0},{no:3,name:"related",kind:"message",T:Ge,repeated:!0},{no:4,name:"parents",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ph=class t extends N{query="";page=0;contentID="";groupID="";tags=[];contentTypes=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Query";static fields=h.util.newFieldList(()=>[{no:1,name:"query",kind:"scalar",T:9},{no:2,name:"page",kind:"scalar",T:13},{no:3,name:"contentID",kind:"scalar",T:9},{no:4,name:"groupID",kind:"scalar",T:9},{no:5,name:"tags",kind:"scalar",T:9,repeated:!0},{no:6,name:"content_types",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Oh=class t extends N{storedContent=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Results";static fields=h.util.newFieldList(()=>[{no:1,name:"storedContent",kind:"message",T:rk,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},rk=class t extends N{content;id="";related=[];title="";description="";image="";url="";user;tags=[];preview="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.StoredContent";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Ge},{no:2,name:"id",kind:"scalar",T:9},{no:3,name:"related",kind:"message",T:Ge,repeated:!0},{no:4,name:"title",kind:"scalar",T:9},{no:5,name:"description",kind:"scalar",T:9},{no:6,name:"image",kind:"scalar",T:9},{no:7,name:"url",kind:"scalar",T:9},{no:9,name:"user",kind:"message",T:So},{no:10,name:"tags",kind:"message",T:Th,repeated:!0},{no:11,name:"preview",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},fM=class t extends N{from="";to="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Edge";static fields=h.util.newFieldList(()=>[{no:1,name:"from",kind:"scalar",T:9},{no:2,name:"to",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ge=class t extends N{tags=[];createdAt="";uri="";id="";type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Content";static fields=h.util.newFieldList(()=>[{no:1,name:"tags",kind:"scalar",T:9,repeated:!0},{no:2,name:"created_at",kind:"scalar",T:9},{no:3,name:"uri",kind:"scalar",T:9},{no:4,name:"id",kind:"scalar",T:9},{no:6,name:"data",kind:"message",T:na,oneof:"type"},{no:7,name:"normalized",kind:"message",T:ok,oneof:"type"},{no:8,name:"transformed",kind:"message",T:ik,oneof:"type"},{no:9,name:"post",kind:"message",T:Pf,oneof:"type"},{no:10,name:"site",kind:"message",T:ns,oneof:"type"},{no:11,name:"chatgpt_conversation",kind:"message",T:dh,oneof:"type"},{no:12,name:"browser_history",kind:"message",T:ph,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Pf=class t extends N{title="";summary="";content="";authors=[];draft=!1;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Post";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"summary",kind:"scalar",T:9},{no:3,name:"content",kind:"scalar",T:9},{no:4,name:"authors",kind:"scalar",T:9,repeated:!0},{no:6,name:"draft",kind:"scalar",T:8}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},dM=class t extends N{url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GitRepo";static fields=h.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},na=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Data";static fields=h.util.newFieldList(()=>[{no:4,name:"text",kind:"message",T:fk,oneof:"type"},{no:5,name:"file",kind:"message",T:Of,oneof:"type"},{no:6,name:"url",kind:"message",T:dk,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ok=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Normalized";static fields=h.util.newFieldList(()=>[{no:3,name:"article",kind:"message",T:sk,oneof:"type"},{no:4,name:"html",kind:"message",T:ak,oneof:"type"},{no:6,name:"transcript",kind:"message",T:mk,oneof:"type"},{no:7,name:"readme",kind:"message",T:lk,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ik=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Transformed";static fields=h.util.newFieldList(()=>[{no:1,name:"summary",kind:"message",T:uk,oneof:"type"},{no:2,name:"categories",kind:"message",T:ck,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},sk=class t extends N{title="";author="";length=0;excerpt="";siteName="";image="";favicon="";text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Article";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"author",kind:"scalar",T:9},{no:3,name:"length",kind:"scalar",T:5},{no:4,name:"excerpt",kind:"scalar",T:9},{no:5,name:"site_name",kind:"scalar",T:9},{no:6,name:"image",kind:"scalar",T:9},{no:7,name:"favicon",kind:"scalar",T:9},{no:8,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ak=class t extends N{html="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.HTML";static fields=h.util.newFieldList(()=>[{no:1,name:"html",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},lk=class t extends N{data="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.ReadMe";static fields=h.util.newFieldList(()=>[{no:1,name:"data",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},uk=class t extends N{summary="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Summary";static fields=h.util.newFieldList(()=>[{no:1,name:"summary",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ck=class t extends N{categories=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Categories";static fields=h.util.newFieldList(()=>[{no:1,name:"categories",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Of=class t extends N{file="";data=new Uint8Array(0);url="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.File";static fields=h.util.newFieldList(()=>[{no:1,name:"file",kind:"scalar",T:9},{no:2,name:"data",kind:"scalar",T:12},{no:3,name:"url",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},fk=class t extends N{data="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Text";static fields=h.util.newFieldList(()=>[{no:1,name:"data",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},dk=class t extends N{url="";crawl=!1;title="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.URL";static fields=h.util.newFieldList(()=>[{no:1,name:"url",kind:"scalar",T:9},{no:2,name:"crawl",kind:"scalar",T:8},{no:3,name:"title",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},pk=class t extends N{id=0;startTime=Ne.zero;endTime=Ne.zero;text="";p="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Token";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"start_time",kind:"scalar",T:4},{no:3,name:"end_time",kind:"scalar",T:4},{no:4,name:"text",kind:"scalar",T:9},{no:5,name:"p",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},lu=class t extends N{num=0;tokens=[];text="";startTime=Ne.zero;endTime=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Segment";static fields=h.util.newFieldList(()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"tokens",kind:"message",T:pk,repeated:!0},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"start_time",kind:"scalar",T:4},{no:5,name:"end_time",kind:"scalar",T:4}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},mk=class t extends N{id="";name="";segments=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Transcript";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"segments",kind:"message",T:lu,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Nh=class t extends N{msg;descLookup={};enumLookup={};packageName="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.GRPCTypeInfo";static fields=h.util.newFieldList(()=>[{no:1,name:"msg",kind:"message",T:xo},{no:3,name:"desc_lookup",kind:"map",K:9,V:{kind:"message",T:xo}},{no:4,name:"enum_lookup",kind:"map",K:9,V:{kind:"message",T:ii}},{no:6,name:"package_name",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ns=class t extends N{sections=[];hugoConfig;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Site";static fields=h.util.newFieldList(()=>[{no:1,name:"sections",kind:"message",T:ai,repeated:!0},{no:2,name:"hugo_config",kind:"message",T:mh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},ai=class t extends N{tags=[];menu;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="content.Section";static fields=h.util.newFieldList(()=>[{no:1,name:"tags",kind:"scalar",T:9,repeated:!0},{no:2,name:"menu",kind:"message",T:ta}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var Mh=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.AnalyzeConversationRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ih=class t extends N{prompt="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GenerateImagesRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"prompt",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Ah=class t extends N{images=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GenerateImagesResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"images",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Lh=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.DeleteSessionRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},uu=class t extends N{id="";text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Prompt";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Dh=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetPromptsRequest";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Fh=class t extends N{prompts=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetPromptsResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"prompts",kind:"message",T:uu,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Bh=class t extends N{prompt="";text=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.InferRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"prompt",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Jh=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.InferResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Uh=class t extends N{content;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.UploadContentRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"content",kind:"message",T:Ge}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},pM=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.UploadContentResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},_h=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},zh=class t extends N{session;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"session",kind:"message",T:jh}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Vh=class t extends N{page=Ne.zero;limit=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionsRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"page",kind:"scalar",T:4},{no:2,name:"limit",kind:"scalar",T:4}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},qh=class t extends N{sessions=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.GetSessionsResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"sessions",kind:"message",T:jh,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},hk=class t extends N{id=0;startTime=Ne.zero;endTime=Ne.zero;text="";p="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Token";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:13},{no:2,name:"start_time",kind:"scalar",T:4},{no:3,name:"end_time",kind:"scalar",T:4},{no:4,name:"text",kind:"scalar",T:9},{no:5,name:"p",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Nf=class t extends N{num=0;tokens=[];text="";startTime=Ne.zero;endTime=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Segment";static fields=h.util.newFieldList(()=>[{no:1,name:"num",kind:"scalar",T:13},{no:2,name:"tokens",kind:"message",T:hk,repeated:!0},{no:3,name:"text",kind:"scalar",T:9},{no:4,name:"start_time",kind:"scalar",T:4},{no:5,name:"end_time",kind:"scalar",T:4}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},jh=class t extends N{id="";name="";segments=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Session";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"name",kind:"scalar",T:9},{no:3,name:"segments",kind:"message",T:Nf,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},mM=class t extends N{filePath="";model="";language="";translate=!1;offset=Ne.zero;duration=Ne.zero;threads=0;speedup=!1;maxLen=0;maxTokens=0;wordThreshold=0;tokens=!1;colorize=!1;out="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.TranscriptionRequest";static fields=h.util.newFieldList(()=>[{no:14,name:"file_path",kind:"scalar",T:9},{no:1,name:"model",kind:"scalar",T:9},{no:2,name:"language",kind:"scalar",T:9},{no:3,name:"translate",kind:"scalar",T:8},{no:4,name:"offset",kind:"scalar",T:3},{no:5,name:"duration",kind:"scalar",T:3},{no:6,name:"threads",kind:"scalar",T:13},{no:7,name:"speedup",kind:"scalar",T:8},{no:8,name:"max_len",kind:"scalar",T:13},{no:9,name:"max_tokens",kind:"scalar",T:13},{no:10,name:"word_threshold",kind:"scalar",T:1},{no:11,name:"tokens",kind:"scalar",T:8},{no:12,name:"colorize",kind:"scalar",T:8},{no:13,name:"out",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},hM=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.RegisterFlags";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},gM=class t extends N{text="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.OCRText";static fields=h.util.newFieldList(()=>[{no:1,name:"text",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},yM=class t extends N{image=new Uint8Array(0);constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.Image";static fields=h.util.newFieldList(()=>[{no:1,name:"image",kind:"scalar",T:12}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Hh=class t extends N{from="";to="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.ConvertFileRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"from",kind:"scalar",T:9},{no:2,name:"to",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},$h=class t extends N{captureDevice=0;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.ChatRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"capture_device",kind:"scalar",T:5}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Mf=class t extends N{segment;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.ChatResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"segment",kind:"message",T:Nf}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Wh=class t extends N{id="";file="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.YouTubeVideo";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9},{no:2,name:"file",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},If=class t extends N{file="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.FilePath";static fields=h.util.newFieldList(()=>[{no:1,name:"file",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Gh=class t extends N{title="";filePath;transcript=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="protoflow.YouTubeVideoResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"title",kind:"scalar",T:9},{no:2,name:"file_path",kind:"message",T:If},{no:3,name:"transcript",kind:"message",T:lu,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var Kh=class t extends N{phoneNumbers=[];summary="";questions=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="ai.AnalyzeConversationResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"phone_numbers",kind:"scalar",T:9,repeated:!0},{no:2,name:"summary",kind:"scalar",T:9},{no:3,name:"questions",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},vM=class t extends N{categories=[];constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="ai.AnalyzeContent";static fields=h.util.newFieldList(()=>[{no:1,name:"categories",kind:"scalar",T:9,repeated:!0}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var wM={typeName:"protoflow.ProtoflowService",methods:{downloadYouTubeVideo:{name:"DownloadYouTubeVideo",I:Wh,O:Gh,kind:le.Unary},getSessions:{name:"GetSessions",I:Vh,O:qh,kind:le.Unary},getSession:{name:"GetSession",I:_h,O:zh,kind:le.Unary},deleteSession:{name:"DeleteSession",I:Lh,O:Mt,kind:le.Unary},getPrompts:{name:"GetPrompts",I:Dh,O:Fh,kind:le.Unary},newPrompt:{name:"NewPrompt",I:uu,O:uu,kind:le.Unary},uploadContent:{name:"UploadContent",I:Uh,O:Mf,kind:le.ServerStreaming},infer:{name:"Infer",I:Bh,O:Jh,kind:le.ServerStreaming},chat:{name:"Chat",I:$h,O:Mf,kind:le.ServerStreaming},convertFile:{name:"ConvertFile",I:Hh,O:If,kind:le.Unary},generateImages:{name:"GenerateImages",I:Ih,O:Ah,kind:le.Unary},analyzeConversation:{name:"AnalyzeConversation",I:Mh,O:Kh,kind:le.Unary}}};var xM={typeName:"content.ContentService",methods:{save:{name:"Save",I:Tf,O:ts,kind:le.Unary},search:{name:"Search",I:Ph,O:Oh,kind:le.Unary},relate:{name:"Relate",I:kh,O:Mt,kind:le.Unary},analyze:{name:"Analyze",I:Ge,O:Tf,kind:le.Unary},delete:{name:"Delete",I:ts,O:ts,kind:le.Unary},getTags:{name:"GetTags",I:Rh,O:Ch,kind:le.Unary},setTags:{name:"SetTags",I:Eh,O:Mt,kind:le.Unary},publish:{name:"Publish",I:ts,O:ts,kind:le.Unary},getSources:{name:"GetSources",I:wh,O:bh,kind:le.Unary},infer:{name:"Infer",I:gh,O:yh,kind:le.ServerStreaming},types:{name:"Types",I:Mt,O:vh,kind:le.Unary},voiceInput:{name:"VoiceInput",I:xh,O:Sh,kind:le.ServerStreaming}}};var SM={typeName:"user.UserService",methods:{register:{name:"Register",I:So,O:So,kind:le.Unary},login:{name:"Login",I:So,O:fh,kind:le.Unary},logout:{name:"Logout",I:Mt,O:Mt,kind:le.Unary},resetPassword:{name:"ResetPassword",I:So,O:Mt,kind:le.Unary},verifyUser:{name:"VerifyUser",I:sh,O:Mt,kind:le.Unary},updateConfig:{name:"UpdateConfig",I:Cf,O:Mt,kind:le.Unary},createGroupInvite:{name:"CreateGroupInvite",I:lh,O:Rf,kind:le.Unary},joinGroup:{name:"JoinGroup",I:Rf,O:si,kind:le.Unary},groupInfo:{name:"GroupInfo",I:ah,O:si,kind:le.Unary},createGroup:{name:"CreateGroup",I:si,O:si,kind:le.Unary},getGroups:{name:"GetGroups",I:Mt,O:ch,kind:le.Unary},deleteGroup:{name:"DeleteGroup",I:si,O:Mt,kind:le.Unary},share:{name:"Share",I:uh,O:Mt,kind:le.Unary}}};var Yh=class t extends N{user="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.BanUserRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"user",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Xh=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.BanUserResponse";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Qh=class t extends N{message="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.SendMessageRequest";static fields=h.util.newFieldList(()=>[{no:2,name:"message",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},Zh=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.SendMessageResponse";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},eg=class t extends N{constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.ReceiveMessagesRequest";static fields=h.util.newFieldList(()=>[]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},tg=class t extends N{user="";text="";timestamp=Ne.zero;constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="chat.Message";static fields=h.util.newFieldList(()=>[{no:1,name:"user",kind:"scalar",T:9},{no:2,name:"text",kind:"scalar",T:9},{no:3,name:"timestamp",kind:"scalar",T:3}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var kM={typeName:"chat.ChatService",methods:{sendMessage:{name:"SendMessage",I:Qh,O:Zh,kind:le.Unary},receiveMessages:{name:"ReceiveMessages",I:eg,O:tg,kind:le.ServerStreaming},banUser:{name:"BanUser",I:Yh,O:Xh,kind:le.Unary}}};var ng=class t extends N{type={case:void 0};constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.Metric";static fields=h.util.newFieldList(()=>[{no:1,name:"http",kind:"message",T:gk,oneof:"type"},{no:2,name:"rrweb",kind:"message",T:yk,oneof:"type"}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},gk=class t extends N{method="";path="";query="";headers={};host="";remoteAddr="";userAgent="";referer="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.HTTPRequest";static fields=h.util.newFieldList(()=>[{no:1,name:"method",kind:"scalar",T:9},{no:2,name:"path",kind:"scalar",T:9},{no:3,name:"query",kind:"scalar",T:9},{no:4,name:"headers",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:5,name:"host",kind:"scalar",T:9},{no:6,name:"remoteAddr",kind:"scalar",T:9},{no:7,name:"userAgent",kind:"scalar",T:9},{no:8,name:"referer",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},yk=class t extends N{events="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.RRWeb";static fields=h.util.newFieldList(()=>[{no:1,name:"events",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}},rg=class t extends N{id="";constructor(e){super(),h.util.initPartial(e,this)}static runtime=h;static typeName="event.SendResponse";static fields=h.util.newFieldList(()=>[{no:1,name:"id",kind:"scalar",T:9}]);static fromBinary(e,n){return new t().fromBinary(e,n)}static fromJson(e,n){return new t().fromJson(e,n)}static fromJsonString(e,n){return new t().fromJsonString(e,n)}static equals(e,n){return h.util.equals(t,e,n)}};var bM={typeName:"event.EventService",methods:{send:{name:"Send",I:ng,O:rg,kind:le.Unary}}};var Pe;(function(t){t[t.Canceled=1]="Canceled",t[t.Unknown=2]="Unknown",t[t.InvalidArgument=3]="InvalidArgument",t[t.DeadlineExceeded=4]="DeadlineExceeded",t[t.NotFound=5]="NotFound",t[t.AlreadyExists=6]="AlreadyExists",t[t.PermissionDenied=7]="PermissionDenied",t[t.ResourceExhausted=8]="ResourceExhausted",t[t.FailedPrecondition=9]="FailedPrecondition",t[t.Aborted=10]="Aborted",t[t.OutOfRange=11]="OutOfRange",t[t.Unimplemented=12]="Unimplemented",t[t.Internal=13]="Internal",t[t.Unavailable=14]="Unavailable",t[t.DataLoss=15]="DataLoss",t[t.Unauthenticated=16]="Unauthenticated"})(Pe||(Pe={}));function Af(t){let e=Pe[t];return typeof e!="string"?t.toString():e[0].toLowerCase()+e.substring(1).replace(/[A-Z]/g,n=>"_"+n.toLowerCase())}var og;function EM(t){if(!og){og={};for(let e of Object.values(Pe))typeof e!="string"&&(og[Af(e)]=e)}return og[t]}var Rt=class t extends Error{constructor(e,n=Pe.Unknown,r,o,i){super(Az(e,n)),this.name="ConnectError",Object.setPrototypeOf(this,new.target.prototype),this.rawMessage=e,this.code=n,this.metadata=new Headers(r??{}),this.details=o??[],this.cause=i}static from(e,n=Pe.Unknown){return e instanceof t?e:e instanceof Error?e.name=="AbortError"?new t(e.message,Pe.Canceled):new t(e.message,n,void 0,void 0,e):new t(String(e),n,void 0,void 0,e)}static[Symbol.hasInstance](e){return e instanceof Error?Object.getPrototypeOf(e)===t.prototype?!0:e.name==="ConnectError"&&"code"in e&&typeof e.code=="number"&&"metadata"in e&&"details"in e&&Array.isArray(e.details)&&"rawMessage"in e&&typeof e.rawMessage=="string"&&"cause"in e:!1}findDetails(e){let n="typeName"in e?{findMessage:o=>o===e.typeName?e:void 0}:e,r=[];for(let o of this.details){if(o instanceof N){n.findMessage(o.getType().typeName)&&r.push(o);continue}let i=n.findMessage(o.type);if(i)try{r.push(i.fromBinary(o.value))}catch{}}return r}};function Az(t,e){return t.length?`[${Af(e)}] ${t}`:`[${Af(e)}]`}function vk(...t){let e=new Headers;for(let n of t)n.forEach((r,o)=>{e.append(o,r)});return e}function RM(t,e){let n={};for(let[r,o]of Object.entries(t.methods)){let i=e(Object.assign(Object.assign({},o),{localName:r,service:t}));i!=null&&(n[r]=i)}return n}function wk(t){let e,n=new Uint8Array(0);function r(o){let i=new Uint8Array(n.length+o.length);i.set(n),i.set(o,n.length),n=i}return new ReadableStream({start(){e=t.getReader()},async pull(o){let i;for(;;){if(i===void 0&&n.byteLength>=5){let l=0;for(let u=1;u<5;u++)l=(l<<8)+n[u];i={flags:n[0],length:l}}if(i!==void 0&&n.byteLength>=i.length+5)break;let a=await e.read();if(a.done)break;r(a.value)}if(i===void 0){if(n.byteLength==0){o.close();return}o.error(new Rt("premature end of stream",Pe.DataLoss));return}let s=n.subarray(5,5+i.length);n=n.subarray(5+i.length),o.enqueue({flags:i.flags,data:s})}})}function xk(t,e){let n=new Uint8Array(e.length+5);n.set(e,5);let r=new DataView(n.buffer,n.byteOffset,n.byteLength);return r.setUint8(0,t),r.setUint32(1,e.length),n}var Lz=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,l){s=t[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(u){i({value:u,done:a})},s)}},Lf=function(t){return this instanceof Lf?(this.v=t,this):new Lf(t)},Dz=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(p){return function(m){return Promise.resolve(m).then(p,f)}}function a(p,m){r[p]&&(o[p]=function(y){return new Promise(function(w,g){i.push([p,y,w,g])>1||l(p,y)})},m&&(o[p]=m(o[p])))}function l(p,m){try{u(r[p](m))}catch(y){d(i[0][3],y)}}function u(p){p.value instanceof Lf?Promise.resolve(p.value.v).then(c,f):d(i[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function d(p,m){p(m),i.shift(),i.length&&l(i[0][0],i[0][1])}},Fz=function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,i){e[o]=t[o]?function(s){return(n=!n)?{value:Lf(t[o](s)),done:!1}:i?i(s):s}:i}};function CM(t){return Dz(this,arguments,function*(){yield Lf(yield*Fz(Lz(t)))})}var TM=function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],n;return e?e.call(t):(t=typeof __values=="function"?__values(t):t[Symbol.iterator](),n={},r("next"),r("throw"),r("return"),n[Symbol.asyncIterator]=function(){return this},n);function r(i){n[i]=t[i]&&function(s){return new Promise(function(a,l){s=t[i](s),o(a,l,s.done,s.value)})}}function o(i,s,a,l){Promise.resolve(l).then(function(u){i({value:u,done:a})},s)}},cu=function(t){return this instanceof cu?(this.v=t,this):new cu(t)},Bz=function(t){var e,n;return e={},r("next"),r("throw",function(o){throw o}),r("return"),e[Symbol.iterator]=function(){return this},e;function r(o,i){e[o]=t[o]?function(s){return(n=!n)?{value:cu(t[o](s)),done:!1}:i?i(s):s}:i}},Jz=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(p){return function(m){return Promise.resolve(m).then(p,f)}}function a(p,m){r[p]&&(o[p]=function(y){return new Promise(function(w,g){i.push([p,y,w,g])>1||l(p,y)})},m&&(o[p]=m(o[p])))}function l(p,m){try{u(r[p](m))}catch(y){d(i[0][3],y)}}function u(p){p.value instanceof cu?Promise.resolve(p.value.v).then(c,f):d(i[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function d(p,m){p(m),i.shift(),i.length&&l(i[0][0],i[0][1])}};function ra(t,e){return RM(t,n=>{switch(n.kind){case le.Unary:return Uz(e,t,n);case le.ServerStreaming:return _z(e,t,n);case le.ClientStreaming:return zz(e,t,n);case le.BiDiStreaming:return Vz(e,t,n);default:return null}})}function Uz(t,e,n){return async function(r,o){var i,s;let a=await t.unary(e,n,o?.signal,o?.timeoutMs,o?.headers,r,o?.contextValues);return(i=o?.onHeader)===null||i===void 0||i.call(o,a.header),(s=o?.onTrailer)===null||s===void 0||s.call(o,a.trailer),a.message}}function _z(t,e,n){return function(r,o){return PM(t.stream(e,n,o?.signal,o?.timeoutMs,o?.headers,CM([r]),o?.contextValues),o)}}function zz(t,e,n){return async function(r,o){var i,s,a,l,u,c;let f=await t.stream(e,n,o?.signal,o?.timeoutMs,o?.headers,r,o?.contextValues);(u=o?.onHeader)===null||u===void 0||u.call(o,f.header);let d;try{for(var p=!0,m=TM(f.message),y;y=await m.next(),i=y.done,!i;p=!0)l=y.value,p=!1,d=l}catch(w){s={error:w}}finally{try{!p&&!i&&(a=m.return)&&await a.call(m)}finally{if(s)throw s.error}}if(!d)throw new Rt("protocol error: missing response message",Pe.Internal);return(c=o?.onTrailer)===null||c===void 0||c.call(o,f.trailer),d}}function Vz(t,e,n){return function(r,o){return PM(t.stream(e,n,o?.signal,o?.timeoutMs,o?.headers,r,o?.contextValues),o)}}function PM(t,e){let n=function(){var r,o;return Jz(this,arguments,function*(){let i=yield cu(t);(r=e?.onHeader)===null||r===void 0||r.call(e,i.header),yield cu(yield*Bz(TM(i.message))),(o=e?.onTrailer)===null||o===void 0||o.call(e,i.trailer)})}()[Symbol.asyncIterator]();return{[Symbol.asyncIterator]:()=>({next:()=>n.next()})}}function OM(...t){let e=new AbortController,n=t.filter(o=>o!==void 0).concat(e.signal);for(let o of n){if(o.aborted){r.apply(o);break}o.addEventListener("abort",r)}function r(){e.signal.aborted||e.abort(Sk(this));for(let o of n)o.removeEventListener("abort",r)}return e}function NM(t){let e=new AbortController,n=()=>{e.abort(new Rt("the operation timed out",Pe.DeadlineExceeded))},r;return t!==void 0&&(t<=0?n():r=setTimeout(n,t)),{signal:e.signal,cleanup:()=>clearTimeout(r)}}function Sk(t){if(!t.aborted)return;if(t.reason!==void 0)return t.reason;let e=new Error("This operation was aborted");return e.name="AbortError",e}function ig(){return{get(t){return t.id in this?this[t.id]:t.defaultValue},set(t,e){return this[t.id]=e,this},delete(t){return delete this[t.id],this}}}function sg(t,e,n){let r=typeof e=="string"?e:e.typeName,o=typeof n=="string"?n:n.name;return t.toString().replace(/\/?$/,`/${r}/${o}`)}function kk(t,e){return e instanceof t?e:new t(e)}function MM(t,e){function n(r){return r.done===!0?r:{done:r.done,value:kk(t,r.value)}}return{[Symbol.asyncIterator](){let r=e[Symbol.asyncIterator](),o={next:()=>r.next().then(n)};return r.throw!==void 0&&(o.throw=i=>r.throw(i).then(n)),r.return!==void 0&&(o.return=i=>r.return(i).then(n)),o}}}function ag(t){var e;let n=Object.assign({},t);return(e=n.ignoreUnknownFields)!==null&&e!==void 0||(n.ignoreUnknownFields=!0),n}function lg(t,e,n,r){let o=e?IM(t.I,r):AM(t.I,n);return{parse:(e?IM(t.O,r):AM(t.O,n)).parse,serialize:o.serialize}}function IM(t,e){return{parse(n){try{return t.fromBinary(n,e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Rt(`parse binary: ${o}`,Pe.InvalidArgument)}},serialize(n){try{return n.toBinary(e)}catch(r){let o=r instanceof Error?r.message:String(r);throw new Rt(`serialize binary: ${o}`,Pe.Internal)}}}}function AM(t,e){var n,r;let o=(n=e?.textEncoder)!==null&&n!==void 0?n:new TextEncoder,i=(r=e?.textDecoder)!==null&&r!==void 0?r:new TextDecoder,s=ag(e);return{parse(a){try{let l=i.decode(a);return t.fromJsonString(l,s)}catch(l){throw Rt.from(l,Pe.InvalidArgument)}},serialize(a){try{let l=a.toJsonString(s);return o.encode(l)}catch(l){throw Rt.from(l,Pe.Internal)}}}}var qz=/^application\/(connect\+)?(?:(json)(?:; ?charset=utf-?8)?|(proto))$/i;var LM="application/proto",DM="application/json",FM="application/connect+proto",BM="application/connect+json";function JM(t){let e=t?.match(qz);if(!e)return;let n=!!e[1],r=!!e[3];return{stream:n,binary:r}}function Df(t,e,n){if(e&&new Headers(e).forEach((s,a)=>n.metadata.append(a,s)),typeof t!="object"||t==null||Array.isArray(t)||!("code"in t)||typeof t.code!="string")throw n;let r=EM(t.code);if(r===void 0)throw n;let o=t.message;if(o!=null&&typeof o!="string")throw n;let i=new Rt(o??"",r,e);if("details"in t&&Array.isArray(t.details))for(let s of t.details){if(s===null||typeof s!="object"||Array.isArray(s)||typeof s.type!="string"||typeof s.value!="string"||"debug"in s&&typeof s.debug!="object")throw n;try{i.details.push({type:s.type,value:Qi.dec(s.value),debug:s.debug})}catch{throw n}}return i}var ug=2;function bk(t){let e=new Rt("invalid end stream",Pe.InvalidArgument),n;try{n=JSON.parse(typeof t=="string"?t:new TextDecoder().decode(t))}catch{throw e}if(typeof n!="object"||n==null||Array.isArray(n))throw e;let r=new Headers;if("metadata"in n){if(typeof n.metadata!="object"||n.metadata==null||Array.isArray(n.metadata))throw e;for(let[i,s]of Object.entries(n.metadata)){if(!Array.isArray(s)||s.some(a=>typeof a!="string"))throw e;for(let a of s)r.append(i,a)}}let o="error"in n?Df(n.error,r,e):void 0;return{metadata:r,error:o}}var Ff="Content-Type",UM="Content-Length",cg="Content-Encoding";var Ek="Accept-Encoding";var _M="Connect-Timeout-Ms",fg="Connect-Protocol-Version",zM="User-Agent";function VM(t){switch(t){case 400:return Pe.InvalidArgument;case 401:return Pe.Unauthenticated;case 403:return Pe.PermissionDenied;case 404:return Pe.Unimplemented;case 408:return Pe.DeadlineExceeded;case 409:return Pe.Aborted;case 412:return Pe.FailedPrecondition;case 413:return Pe.ResourceExhausted;case 415:return Pe.Internal;case 429:return Pe.Unavailable;case 431:return Pe.ResourceExhausted;case 502:return Pe.Unavailable;case 503:return Pe.Unavailable;case 504:return Pe.Unavailable;default:return Pe.Unknown}}function dg(t){let e=new Headers,n=new Headers;return t.forEach((r,o)=>{o.toLowerCase().startsWith("trailer-")?n.set(o.substring(8),r):e.set(o,r)}),[e,n]}var pg="1";function mg(t,e,n,r,o){let i=new Headers(r??{});return n!==void 0&&i.set(_M,`${n}`),i.set(Ff,t==le.Unary?e?LM:DM:e?FM:BM),i.set(fg,pg),o&&i.set(zM,"connect-es/1.3.0"),i}function hg(t,e,n){let r=n.get("Content-Type"),o=JM(r);if(e!==200){let i=new Rt(`HTTP ${e}`,VM(e),n);if(t==le.Unary&&o&&!o.binary)return{isUnaryError:!0,unaryError:i};throw i}return{isUnaryError:!1}}var qM="application/";function Hz(t,e){return e?Qi.enc(t).replace(/\+/g,"-").replace(/\//g,"_").replace(/=+$/,""):encodeURIComponent(new TextDecoder().decode(t))}function Rk(t,e,n){let r=`?connect=v${pg}`,o=t.header.get(Ff);o?.indexOf(qM)===0&&(r+="&encoding="+encodeURIComponent(o.slice(qM.length)));let i=t.header.get(cg);i!==null&&i!=="identity"&&(r+="&compression="+encodeURIComponent(i),n=!0),n&&(r+="&base64=1"),r+="&message="+Hz(e,n);let s=t.url+r,a=new Headers(t.header);return[fg,Ff,UM,cg,Ek].forEach(l=>a.delete(l)),Object.assign(Object.assign({},t),{init:Object.assign(Object.assign({},t.init),{method:"GET"}),url:s,header:a})}function Ck(t){let e=HM(t.next,t.interceptors),[n,r,o]=jM(t),i=Object.assign(Object.assign({},t.req),{message:kk(t.req.method.I,t.req.message),signal:n});return e(i).then(s=>(o(),s),r)}function Tk(t){let e=HM(t.next,t.interceptors),[n,r,o]=jM(t),i=Object.assign(Object.assign({},t.req),{message:MM(t.req.method.I,t.req.message),signal:n}),s=!1;return n.addEventListener("abort",function(){var a,l;let u=t.req.message[Symbol.asyncIterator]();s||(a=u.throw)===null||a===void 0||a.call(u,this.reason).catch(()=>{}),(l=u.return)===null||l===void 0||l.call(u).catch(()=>{})}),e(i).then(a=>Object.assign(Object.assign({},a),{message:{[Symbol.asyncIterator](){let l=a.message[Symbol.asyncIterator]();return{next(){return l.next().then(u=>(u.done==!0&&(s=!0,o()),u),r)}}}}}),r)}function jM(t){let{signal:e,cleanup:n}=NM(t.timeoutMs),r=OM(t.signal,e);return[r.signal,function(i){let s=Rt.from(e.aborted?Sk(e):i);return r.abort(s),n(),Promise.reject(s)},function(){n(),r.abort()}]}function HM(t,e){var n;return(n=e?.concat().reverse().reduce((r,o)=>o(r),t))!==null&&n!==void 0?n:t}function $M(){try{new Headers}catch{throw new Error("connect-web requires the fetch API. Are you running on an old version of Node.js? Node.js is not supported in Connect for Web - please stay tuned for Connect for Node.")}}var Bf=function(t){return this instanceof Bf?(this.v=t,this):new Bf(t)},$z=function(t,e,n){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var r=n.apply(t,e||[]),o,i=[];return o={},a("next"),a("throw"),a("return",s),o[Symbol.asyncIterator]=function(){return this},o;function s(p){return function(m){return Promise.resolve(m).then(p,f)}}function a(p,m){r[p]&&(o[p]=function(y){return new Promise(function(w,g){i.push([p,y,w,g])>1||l(p,y)})},m&&(o[p]=m(o[p])))}function l(p,m){try{u(r[p](m))}catch(y){d(i[0][3],y)}}function u(p){p.value instanceof Bf?Promise.resolve(p.value.v).then(c,f):d(i[0][2],p)}function c(p){l("next",p)}function f(p){l("throw",p)}function d(p,m){p(m),i.shift(),i.length&&l(i[0][0],i[0][1])}};function Pk(t){var e;$M();let n=(e=t.useBinaryFormat)!==null&&e!==void 0?e:!1;return{async unary(r,o,i,s,a,l,u){var c;let{serialize:f,parse:d}=lg(o,n,t.jsonOptions,t.binaryOptions);return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await Ck({interceptors:t.interceptors,signal:i,timeoutMs:s,req:{stream:!1,service:r,method:o,url:sg(t.baseUrl,r,o),init:{method:"POST",credentials:(c=t.credentials)!==null&&c!==void 0?c:"same-origin",redirect:"error",mode:"cors"},header:mg(o.kind,n,s,a,!1),contextValues:u??ig(),message:l},next:async p=>{var m;let y=t.useHttpGet===!0&&o.idempotency===gf.NoSideEffects,w=null;y?p=Rk(p,f(p.message),n):w=f(p.message);let v=await((m=t.fetch)!==null&&m!==void 0?m:globalThis.fetch)(p.url,Object.assign(Object.assign({},p.init),{headers:p.header,signal:p.signal,body:w})),{isUnaryError:k,unaryError:S}=hg(o.kind,v.status,v.headers);if(k)throw Df(await v.json(),vk(...dg(v.headers)),S);let[b,x]=dg(v.headers);return{stream:!1,service:r,method:o,header:b,message:n?d(new Uint8Array(await v.arrayBuffer())):o.O.fromJson(await v.json(),ag(t.jsonOptions)),trailer:x}}})},async stream(r,o,i,s,a,l,u){var c;let{serialize:f,parse:d}=lg(o,n,t.jsonOptions,t.binaryOptions);function p(y,w,g){return $z(this,arguments,function*(){let k=wk(y).getReader(),S=!1;for(;;){let b=yield Bf(k.read());if(b.done)break;let{flags:x,data:R}=b.value;if((x&ug)===ug){S=!0;let E=bk(R);if(E.error){let O=E.error;throw g.forEach((I,B)=>{O.metadata.append(B,I)}),O}E.metadata.forEach((O,I)=>w.set(I,O));continue}yield yield Bf(d(R))}if(!S)throw"missing EndStreamResponse"})}async function m(y){if(o.kind!=le.ServerStreaming)throw"The fetch API does not support streaming request bodies";let w=await y[Symbol.asyncIterator]().next();if(w.done==!0)throw"missing request message";return xk(0,f(w.value))}return s=s===void 0?t.defaultTimeoutMs:s<=0?void 0:s,await Tk({interceptors:t.interceptors,timeoutMs:s,signal:i,req:{stream:!0,service:r,method:o,url:sg(t.baseUrl,r,o),init:{method:"POST",credentials:(c=t.credentials)!==null&&c!==void 0?c:"same-origin",redirect:"error",mode:"cors"},header:mg(o.kind,n,s,a,!1),contextValues:u??ig(),message:l},next:async y=>{var w;let v=await((w=t.fetch)!==null&&w!==void 0?w:globalThis.fetch)(y.url,Object.assign(Object.assign({},y.init),{headers:y.header,signal:y.signal,body:await m(y.message)}));if(hg(o.kind,v.status,v.headers),v.body===null)throw"missing response body";let k=new Headers;return Object.assign(Object.assign({},y),{header:v.headers,trailer:k,message:p(v.body,k,v.headers)})}})}}}var Wz="https://demo.lunabrain.com",Jf=Pk({baseUrl:`${Wz}/api`||"error"}),Gz=ra(wM,Jf),mt=ra(xM,Jf),ko=ra(SM,Jf),gg=ra(kM,Jf),sZ=ra(bM,Jf);var WM=qt(void 0);WM.debugLabel="userAtom";var bo=()=>{let[t,e]=Et(WM);return{user:t,register:async(s,a)=>{try{let l=await ko.register({email:s,password:a});e(l),je.success("Successfully registered!")}catch(l){console.error(l),je.error("Failed to register: "+l.message)}},tryLogin:async()=>{try{let s=await ko.login({});s.success&&e(s.user)}catch(s){console.error(s),je.error("Failed to login: "+s.message)}},login:async(s,a)=>{try{let l=await ko.login({email:s,password:a});e(l.user),je.success("Logged in")}catch(l){je.error("Failed to login"),console.error("failed to login",l)}},logout:async()=>{try{let s=await ko.logout({});e(void 0),console.log(s),je.success("Logged out")}catch(s){je.error("Failed to logout"),console.error("failed to logout",s)}}}};var on=q(me(),1),rs=({next:t,allowRegister:e})=>{let[n,r]=(0,yg.useState)(""),[o,i]=(0,yg.useState)(""),{login:s,register:a}=bo(),[l,u]=(0,yg.useState)("login");return(0,on.jsx)(on.Fragment,{children:(0,on.jsx)("div",{className:"mt-4",children:(0,on.jsx)("div",{className:"items-center px-5 py-12 lg:px-20",children:(0,on.jsxs)("div",{className:"flex flex-col w-full max-w-md p-10 mx-auto",children:[(0,on.jsx)("a",{className:"btn",href:`/auth/google${t?"?next="+t:""}`,children:"login with google"}),(0,on.jsx)("div",{className:"divider",children:"or"}),(0,on.jsxs)("div",{className:"tabs tabs-lifted",children:[(0,on.jsx)("a",{className:`tab ${l==="login"?"tab-active":""}`,onClick:()=>u("login"),children:"login"}),e&&(0,on.jsx)("a",{className:`tab ${l==="register"?"tab-active":""}`,onClick:()=>u("register"),children:"register"})]}),(0,on.jsxs)("div",{className:"space-y-2 w-full mx-auto my-6",children:[(0,on.jsx)("input",{className:"input input-bordered w-full",type:"email",placeholder:"email",value:n,onChange:c=>r(c.target.value)}),(0,on.jsx)("input",{className:"input input-bordered w-full",type:"password",placeholder:"password",value:o,onChange:c=>i(c.target.value)})]}),(0,on.jsx)("button",{className:"btn btn-primary",onClick:()=>{l==="login"?s(n,o):a(n,o)},children:l==="login"?"login":"register"})]})})})})};var oa=q(he(),1);var Yz=q(me(),1),Kz=(0,oa.createContext)({}),GM=()=>(0,oa.useContext)(Kz);var RR=q(he(),1);var KM=q(he(),1),YM=qt(void 0);YM.debugLabel="sourcesAtom";var XM=qt(void 0);XM.debugLabel="selectedSourceAtom";var QM=qt([]);QM.debugLabel="typesAtom";var ZM=qt([]);ZM.debugLabel="tagsAtom";var ia=()=>{let[t,e]=Et(YM),[n,r]=Et(XM),[o,i]=Et(QM),[s,a]=Et(ZM);return{sources:t,selected:n,setSelected:r,getSources:async()=>{let u=await mt.getSources({contentTypes:o,tags:s});e(u.sources),u.sources.length>0&&r(u.sources[0])},types:o,setTypes:i,tags:s,setTags:a}},eI=qt(void 0);eI.debugLabel="editedContentAtom";var tI=qt(void 0);tI.debugLabel="selectedContentAtom";var nI=qt(!1);nI.debugLabel="newContent";var sa=()=>{let[t,e]=Et(eI),[n,r]=Et(tI),[o,i]=Et(nI);return{editedContent:t,editContent:u=>{u===void 0?(window.history.pushState({},"","/app"),e(void 0)):(u.id!==void 0&&u.id!==""&&window.history.pushState({},"",`/app/content/${u.id}`),e(u))},selectedContent:n,selectContent:u=>{u===void 0?(window.history.pushState({},"","/app"),r(void 0)):(u.id!==void 0&&u.id!==""&&window.history.pushState({},"",`/app/content/${u.id}`),r(u))},changeContent:u=>{window.history.pushState({},"","/app"),e(u),i(!0)},newContent:o,setNewContent:i}},Xz=qt(!1);Xz.debugLabel="recordingAtom";var rI=q(me(),1);var Ts=q(he(),1);function xn(t){this.content=t}xn.prototype={constructor:xn,find:function(t){for(var e=0;e>1}};xn.from=function(t){if(t instanceof xn)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new xn(e)};var Ok=xn;function cI(t,e,n){for(let r=0;;r++){if(r==t.childCount||r==e.childCount)return t.childCount==e.childCount?null:n;let o=t.child(r),i=e.child(r);if(o==i){n+=o.nodeSize;continue}if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(let s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){let s=cI(o.content,i.content,n+1);if(s!=null)return s}n+=o.nodeSize}}function fI(t,e,n,r){for(let o=t.childCount,i=e.childCount;;){if(o==0||i==0)return o==i?null:{a:n,b:r};let s=t.child(--o),a=e.child(--i),l=s.nodeSize;if(s==a){n-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){let u=0,c=Math.min(s.text.length,a.text.length);for(;ue&&r(l,o+a,i||null,s)!==!1&&l.content.size){let c=a+1;l.nodesBetween(Math.max(0,e-c),Math.min(l.content.size,n-c),r,o+c)}a=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,n,r,o){let i="",s=!0;return this.nodesBetween(e,n,(a,l)=>{let u=a.isText?a.text.slice(Math.max(e,l)-l,n-l):a.isLeaf?o?typeof o=="function"?o(a):o:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&u||a.isTextblock)&&r&&(s?s=!1:i+=r),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let n=this.lastChild,r=e.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);ie)for(let i=0,s=0;se&&((sn)&&(a.isText?a=a.cut(Math.max(0,e-s),Math.min(a.text.length,n-s)):a=a.cut(Math.max(0,e-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new t(r,o)}cutByIndex(e,n){return e==n?t.empty:e==0&&n==this.content.length?this:new t(this.content.slice(e,n))}replaceChild(e,n){let r=this.content[e];if(r==n)return this;let o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[e]=n,new t(o,i)}addToStart(e){return new t([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new t(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let n=0;nthis.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let r=0,o=0;;r++){let i=this.child(r),s=o+i.nodeSize;if(s>=e)return s==e||n>0?vg(r+1,s):vg(r,o);o=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,n){if(!n)return t.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new t(n.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return t.empty;let n,r=0;for(let o=0;othis.type.rank&&(n||(n=e.slice(0,o)),n.push(this),r=!0),n&&n.push(i)}}return n||(n=e.slice()),r||n.push(this),n}removeFromSet(e){for(let n=0;nr.type.rank-o.type.rank),n}};Ue.none=[];var ua=class extends Error{},ee=class t{constructor(e,n,r){this.content=e,this.openStart=n,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,n){let r=pI(this.content,e+this.openStart,n);return r&&new t(r,this.openStart,this.openEnd)}removeBetween(e,n){return new t(dI(this.content,e+this.openStart,n+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,n){if(!n)return t.empty;let r=n.openStart||0,o=n.openEnd||0;if(typeof r!="number"||typeof o!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new t(K.fromJSON(e,n.content),r,o)}static maxOpen(e,n=!0){let r=0,o=0;for(let i=e.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(let i=e.lastChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.lastChild)o++;return new t(e,r,o)}};ee.empty=new ee(K.empty,0,0);function dI(t,e,n){let{index:r,offset:o}=t.findIndex(e),i=t.maybeChild(r),{index:s,offset:a}=t.findIndex(n);if(o==e||i.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(r,i.copy(dI(i.content,e-o-1,n-o-1)))}function pI(t,e,n,r){let{index:o,offset:i}=t.findIndex(e),s=t.maybeChild(o);if(i==e||s.isText)return r&&!r.canReplace(o,o,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=pI(s.content,e-i-1,n);return a&&t.replaceChild(o,s.copy(a))}function Qz(t,e,n){if(n.openStart>t.depth)throw new ua("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new ua("Inconsistent open depths");return mI(t,e,n,0)}function mI(t,e,n,r){let o=t.index(r),i=t.node(r);if(o==e.index(r)&&r=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function Uf(t,e,n,r){let o=(e||t).node(n),i=0,s=e?e.index(n):o.childCount;t&&(i=t.index(n),t.depth>n?i++:t.textOffset&&(aa(t.nodeAfter,r),i++));for(let a=i;ao&&Lk(t,e,o+1),s=r.depth>o&&Lk(n,r,o+1),a=[];return Uf(null,t,o,a),i&&s&&e.index(o)==n.index(o)?(hI(i,s),aa(la(i,gI(t,e,n,r,o+1)),a)):(i&&aa(la(i,xg(t,e,o+1)),a),Uf(e,n,o,a),s&&aa(la(s,xg(n,r,o+1)),a)),Uf(r,null,o,a),new K(a)}function xg(t,e,n){let r=[];if(Uf(null,t,n,r),t.depth>n){let o=Lk(t,e,n+1);aa(la(o,xg(t,e,n+1)),r)}return Uf(e,null,n,r),new K(r)}function Zz(t,e){let n=e.depth-t.openStart,o=e.node(n).copy(t.content);for(let i=n-1;i>=0;i--)o=e.node(i).copy(K.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}var Sg=class t{constructor(e,n,r){this.pos=e,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,n=this.index(this.depth);if(n==e.childCount)return null;let r=this.pos-this.path[this.path.length-1],o=e.child(n);return r?e.child(n).cut(r):o}get nodeBefore(){let e=this.index(this.depth),n=this.pos-this.path[this.path.length-1];return n?this.parent.child(e).cut(0,n):e==0?null:this.parent.child(e-1)}posAtIndex(e,n){n=this.resolveDepth(n);let r=this.path[n*3],o=n==0?0:this.path[n*3-1]+1;for(let i=0;i0;n--)if(this.start(n)<=e&&this.end(n)>=e)return n;return 0}blockRange(e=this,n){if(e.pos=0;r--)if(e.pos<=this.end(r)&&(!n||n(this.node(r))))return new ca(this,e,r);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos=0&&n<=e.content.size))throw new RangeError("Position "+n+" out of range");let r=[],o=0,i=n;for(let s=e;;){let{index:a,offset:l}=s.content.findIndex(i),u=i-l;if(r.push(s,a,o+l),!u||(s=s.child(a),s.isText))break;i=u-1,o+=l+1}return new t(n,r,i)}static resolveCached(e,n){for(let o=0;oe&&this.nodesBetween(e,n,i=>(r.isInSet(i.marks)&&(o=!0),!o)),o}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),yI(this.marks,e)}contentMatchAt(e){let n=this.type.contentMatch.matchFragment(this.content,0,e);if(!n)throw new Error("Called contentMatchAt on a node with invalid content");return n}canReplace(e,n,r=K.empty,o=0,i=r.childCount){let s=this.contentMatchAt(e).matchFragment(r,o,i),a=s&&s.matchFragment(this.content,n);if(!a||!a.validEnd)return!1;for(let l=o;ln.type.name)}`);this.content.forEach(n=>n.check())}toJSON(){let e={type:this.type.name};for(let n in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(n=>n.toJSON())),e}static fromJSON(e,n){if(!n)throw new RangeError("Invalid input for Node.fromJSON");let r=null;if(n.marks){if(!Array.isArray(n.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=n.marks.map(e.markFromJSON)}if(n.type=="text"){if(typeof n.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(n.text,r)}let o=K.fromJSON(e,n.content);return e.nodeType(n.type).create(n.attrs,o,r)}};to.prototype.text=void 0;var Dk=class t extends to{constructor(e,n,r,o){if(super(e,n,null,o),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):yI(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,n){return this.text.slice(e,n)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new t(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new t(this.type,this.attrs,e,this.marks)}cut(e=0,n=this.text.length){return e==0&&n==this.text.length?this:this.withText(this.text.slice(e,n))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function yI(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}var fa=class t{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,n){let r=new Fk(e,n);if(r.next==null)return t.empty;let o=vI(r);r.next&&r.err("Unexpected trailing text");let i=lV(aV(o));return uV(i,r),i}matchType(e){for(let n=0;nu.createAndFill()));for(let u=0;u=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function n(r){e.push(r);for(let o=0;o{let i=o+(r.validEnd?"*":" ")+" ";for(let s=0;s"+e.indexOf(r.next[s].next);return i}).join(` +`)}};fa.empty=new fa(!0);var Fk=class{constructor(e,n){this.string=e,this.nodeTypes=n,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function vI(t){let e=[];do e.push(nV(t));while(t.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function nV(t){let e=[];do e.push(rV(t));while(t.next&&t.next!=")"&&t.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function rV(t){let e=sV(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else if(t.eat("{"))e=oV(t,e);else break;return e}function oI(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function oV(t,e){let n=oI(t),r=n;return t.eat(",")&&(t.next!="}"?r=oI(t):r=-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:e}}function iV(t,e){let n=t.nodeTypes,r=n[e];if(r)return[r];let o=[];for(let i in n){let s=n[i];s.groups.indexOf(e)>-1&&o.push(s)}return o.length==0&&t.err("No node type or group '"+e+"' found"),o}function sV(t){if(t.eat("(")){let e=vI(t);return t.eat(")")||t.err("Missing closing paren"),e}else if(/\W/.test(t.next))t.err("Unexpected token '"+t.next+"'");else{let e=iV(t,t.next).map(n=>(t.inline==null?t.inline=n.isInline:t.inline!=n.isInline&&t.err("Mixing inline and block content"),{type:"name",value:n}));return t.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function aV(t){let e=[[]];return o(i(t,0),n()),e;function n(){return e.push([])-1}function r(s,a,l){let u={term:l,to:a};return e[s].push(u),u}function o(s,a){s.forEach(l=>l.to=a)}function i(s,a){if(s.type=="choice")return s.exprs.reduce((l,u)=>l.concat(i(u,a)),[]);if(s.type=="seq")for(let l=0;;l++){let u=i(s.exprs[l],a);if(l==s.exprs.length-1)return u;o(u,a=n())}else if(s.type=="star"){let l=n();return r(a,l),o(i(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=n();return o(i(s.expr,a),l),o(i(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(i(s.expr,a));if(s.type=="range"){let l=a;for(let u=0;u{t[s].forEach(({term:a,to:l})=>{if(!a)return;let u;for(let c=0;c{u||o.push([a,u=[]]),u.indexOf(c)==-1&&u.push(c)})})});let i=e[r.join(",")]=new fa(r.indexOf(t.length-1)>-1);for(let s=0;s-1}allowsMarks(e){if(this.markSet==null)return!0;for(let n=0;nr[i]=new t(i,n,s));let o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}},Bk=class{constructor(e){this.hasDefault=Object.prototype.hasOwnProperty.call(e,"default"),this.default=e.default}get isRequired(){return!this.hasDefault}},zf=class t{constructor(e,n,r,o){this.name=e,this.rank=n,this.schema=r,this.spec=o,this.attrs=kI(o.attrs),this.excluded=null;let i=xI(this.attrs);this.instance=i?new Ue(this,i):null}create(e=null){return!e&&this.instance?this.instance:new Ue(this,SI(this.attrs,e))}static compile(e,n){let r=Object.create(null),o=0;return e.forEach((i,s)=>r[i]=new t(i,o++,n,s)),r}removeFromSet(e){for(var n=0;n-1}},bg=class{constructor(e){this.cached=Object.create(null);let n=this.spec={};for(let o in e)n[o]=e[o];n.nodes=Ok.from(e.nodes),n.marks=Ok.from(e.marks||{}),this.nodes=kg.compile(this.spec.nodes,this),this.marks=zf.compile(this.spec.marks,this);let r=Object.create(null);for(let o in this.nodes){if(o in this.marks)throw new RangeError(o+" can not be both a node and a mark");let i=this.nodes[o],s=i.spec.content||"",a=i.spec.marks;i.contentMatch=r[s]||(r[s]=fa.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.markSet=a=="_"?null:a?sI(this,a.split(" ")):a==""||!i.inlineContent?[]:null}for(let o in this.marks){let i=this.marks[o],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:sI(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,n=null,r,o){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof kg){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(n,r,o)}text(e,n){let r=this.nodes.text;return new Dk(r,r.defaultAttrs,e,Ue.setFrom(n))}mark(e,n){return typeof e=="string"&&(e=this.marks[e]),e.create(n)}nodeFromJSON(e){return to.fromJSON(this,e)}markFromJSON(e){return Ue.fromJSON(this,e)}nodeType(e){let n=this.nodes[e];if(!n)throw new RangeError("Unknown node type: "+e);return n}};function sI(t,e){let n=[];for(let r=0;r-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[r]+"'")}return n}var da=class t{constructor(e,n){this.schema=e,this.rules=n,this.tags=[],this.styles=[],n.forEach(r=>{r.tag?this.tags.push(r):r.style&&this.styles.push(r)}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let o=e.nodes[r.node];return o.contentMatch.matchType(o)})}parse(e,n={}){let r=new Cg(this,n,!1);return r.addAll(e,n.from,n.to),r.finish()}parseSlice(e,n={}){let r=new Cg(this,n,!0);return r.addAll(e,n.from,n.to),ee.maxOpen(r.finish())}matchTag(e,n,r){for(let o=r?this.tags.indexOf(r)+1:0;oe.length&&(a.charCodeAt(e.length)!=61||a.slice(e.length+1)!=n))){if(s.getAttrs){let l=s.getAttrs(n);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(e){let n=[];function r(o){let i=o.priority==null?50:o.priority,s=0;for(;s{r(s=lI(s)),s.mark||s.ignore||s.clearMark||(s.mark=o)})}for(let o in e.nodes){let i=e.nodes[o].spec.parseDOM;i&&i.forEach(s=>{r(s=lI(s)),s.node||s.ignore||s.mark||(s.node=o)})}return n}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new t(e,t.schemaRules(e)))}},bI={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},cV={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},EI={ol:!0,ul:!0},Eg=1,Rg=2,_f=4;function aI(t,e,n){return e!=null?(e?Eg:0)|(e==="full"?Rg:0):t&&t.whitespace=="pre"?Eg|Rg:n&~_f}var fu=class{constructor(e,n,r,o,i,s,a){this.type=e,this.attrs=n,this.marks=r,this.pendingMarks=o,this.solid=i,this.options=a,this.content=[],this.activeMarks=Ue.none,this.stashMarks=[],this.match=s||(a&_f?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let n=this.type.contentMatch.fillBefore(K.from(e));if(n)this.match=this.type.contentMatch.matchFragment(n);else{let r=this.type.contentMatch,o;return(o=r.findWrapping(e.type))?(this.match=r,o):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Eg)){let r=this.content[this.content.length-1],o;if(r&&r.isText&&(o=/[ \t\r\n\u000c]+$/.exec(r.text))){let i=r;r.text.length==o[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-o[0].length))}}let n=K.from(this.content);return!e&&this.match&&(n=n.append(this.match.fillBefore(K.empty,!0))),this.type?this.type.create(this.attrs,n,this.marks):n}popFromStashMark(e){for(let n=this.stashMarks.length-1;n>=0;n--)if(e.eq(this.stashMarks[n]))return this.stashMarks.splice(n,1)[0]}applyPending(e){for(let n=0,r=this.pendingMarks;nthis.addAll(e)),s&&this.sync(a),this.needsBlock=l}else this.withStyleRules(e,()=>{this.addElementByRule(e,i,i.consuming===!1?o:void 0)})}leafFallback(e){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(` +`))}ignoreFallback(e){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"))}readStyles(e){let n=Ue.none,r=Ue.none;for(let o=0;o{s.clearMark(a)&&(r=a.addToSet(r))}):n=this.parser.schema.marks[s.mark].create(s.attrs).addToSet(n),s.consuming===!1)i=s;else break}return[n,r]}addElementByRule(e,n,r){let o,i,s;n.node?(i=this.parser.schema.nodes[n.node],i.isLeaf?this.insertNode(i.create(n.attrs))||this.leafFallback(e):o=this.enter(i,n.attrs||null,n.preserveWhitespace)):(s=this.parser.schema.marks[n.mark].create(n.attrs),this.addPendingMark(s));let a=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,r);else if(n.getContent)this.findInside(e),n.getContent(e,this.parser.schema).forEach(l=>this.insertNode(l));else{let l=e;typeof n.contentElement=="string"?l=e.querySelector(n.contentElement):typeof n.contentElement=="function"?l=n.contentElement(e):n.contentElement&&(l=n.contentElement),this.findAround(e,l,!0),this.addAll(l)}o&&this.sync(a)&&this.open--,s&&this.removePendingMark(s,a)}addAll(e,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=r==null?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i);this.findAtPoint(e,o)}findPlace(e){let n,r;for(let o=this.open;o>=0;o--){let i=this.nodes[o],s=i.findWrapping(e);if(s&&(!n||n.length>s.length)&&(n=s,r=i,!s.length)||i.solid)break}if(!n)return!1;this.sync(r);for(let o=0;othis.open){for(;n>this.open;n--)this.nodes[n-1].content.push(this.nodes[n].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(e){for(let n=this.open;n>=0;n--)if(this.nodes[n]==e)return this.open=n,!0;return!1}get currentPos(){this.closeExtra();let e=0;for(let n=this.open;n>=0;n--){let r=this.nodes[n].content;for(let o=r.length-1;o>=0;o--)e+=r[o].nodeSize;n&&e++}return e}findAtPoint(e,n){if(this.find)for(let r=0;r-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let n=e.split("/"),r=this.options.context,o=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1),s=(a,l)=>{for(;a>=0;a--){let u=n[a];if(u==""){if(a==n.length-1||a==0)continue;for(;l>=i;l--)if(s(a-1,l))return!0;return!1}else{let c=l>0||l==0&&o?this.nodes[l].type:r&&l>=i?r.node(l-i).type:null;if(!c||c.name!=u&&c.groups.indexOf(u)==-1)return!1;l--}}return!0};return s(n.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let n=e.depth;n>=0;n--){let r=e.node(n).contentMatchAt(e.indexAfter(n)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let n in this.parser.schema.nodes){let r=this.parser.schema.nodes[n];if(r.isTextblock&&r.defaultAttrs)return r}}addPendingMark(e){let n=hV(e,this.top.pendingMarks);n&&this.top.stashMarks.push(n),this.top.pendingMarks=e.addToSet(this.top.pendingMarks)}removePendingMark(e,n){for(let r=this.open;r>=0;r--){let o=this.nodes[r];if(o.pendingMarks.lastIndexOf(e)>-1)o.pendingMarks=e.removeFromSet(o.pendingMarks);else{o.activeMarks=e.removeFromSet(o.activeMarks);let s=o.popFromStashMark(e);s&&o.type&&o.type.allowsMarkType(s.type)&&(o.activeMarks=s.addToSet(o.activeMarks))}if(o==n)break}}};function fV(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let r=e.nodeType==1?e.nodeName.toLowerCase():null;r&&EI.hasOwnProperty(r)&&n?(n.appendChild(e),e=n):r=="li"?n=e:r&&(n=null)}}function dV(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function pV(t){let e=/\s*([\w-]+)\s*:\s*([^;]+)/g,n,r=[];for(;n=e.exec(t);)r.push(n[1],n[2].trim());return r}function lI(t){let e={};for(let n in t)e[n]=t[n];return e}function mV(t,e){let n=e.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(t))continue;let i=[],s=a=>{i.push(a);for(let l=0;l{if(i.length||s.marks.length){let a=0,l=0;for(;a=0;o--){let i=this.serializeMark(e.marks[o],e.isInline,n);i&&((i.contentDOM||i.dom).appendChild(r),r=i.dom)}return r}serializeMark(e,n,r={}){let o=this.marks[e.type.name];return o&&t.renderSpec(Ak(r),o(e,n))}static renderSpec(e,n,r=null){if(typeof n=="string")return{dom:e.createTextNode(n)};if(n.nodeType!=null)return{dom:n};if(n.dom&&n.dom.nodeType!=null)return n;let o=n[0],i=o.indexOf(" ");i>0&&(r=o.slice(0,i),o=o.slice(i+1));let s,a=r?e.createElementNS(r,o):e.createElement(o),l=n[1],u=1;if(l&&typeof l=="object"&&l.nodeType==null&&!Array.isArray(l)){u=2;for(let c in l)if(l[c]!=null){let f=c.indexOf(" ");f>0?a.setAttributeNS(c.slice(0,f),c.slice(f+1),l[c]):a.setAttribute(c,l[c])}}for(let c=u;cu)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:d,contentDOM:p}=t.renderSpec(e,f,r);if(a.appendChild(d),p){if(s)throw new RangeError("Multiple content holes");s=p}}}return{dom:a,contentDOM:s}}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new t(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let n=uI(e.nodes);return n.text||(n.text=r=>r.text),n}static marksFromSchema(e){return uI(e.marks)}};function uI(t){let e={};for(let n in t){let r=t[n].spec.toDOM;r&&(e[n]=r)}return e}function Ak(t){return t.document||window.document}var TI=65535,PI=Math.pow(2,16);function gV(t,e){return t+e*PI}function RI(t){return t&TI}function yV(t){return(t-(t&TI))/PI}var OI=1,NI=2,Tg=4,MI=8,jf=class{constructor(e,n,r){this.pos=e,this.delInfo=n,this.recover=r}get deleted(){return(this.delInfo&MI)>0}get deletedBefore(){return(this.delInfo&(OI|Tg))>0}get deletedAfter(){return(this.delInfo&(NI|Tg))>0}get deletedAcross(){return(this.delInfo&Tg)>0}},ui=class t{constructor(e,n=!1){if(this.ranges=e,this.inverted=n,!e.length&&t.empty)return t.empty}recover(e){let n=0,r=RI(e);if(!this.inverted)for(let o=0;oe)break;let u=this.ranges[a+i],c=this.ranges[a+s],f=l+u;if(e<=f){let d=u?e==l?-1:e==f?1:n:n,p=l+o+(d<0?0:c);if(r)return p;let m=e==(n<0?l:f)?null:gV(a/3,e-l),y=e==l?NI:e==f?OI:Tg;return(n<0?e!=l:e!=f)&&(y|=MI),new jf(p,y,m)}o+=c-u}return r?e+o:new jf(e+o,0,null)}touches(e,n){let r=0,o=RI(n),i=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;ae)break;let u=this.ranges[a+i],c=l+u;if(e<=c&&a==o*3)return!0;r+=this.ranges[a+s]-u}return!1}forEach(e){let n=this.inverted?2:1,r=this.inverted?1:2;for(let o=0,i=0;o=0;n--){let o=e.getMirror(n);this.appendMap(e.maps[n].invert(),o!=null&&o>n?r-o-1:void 0)}}invert(){let e=new t;return e.appendMappingInverted(this),e}map(e,n=1){if(this.mirror)return this._map(e,n,!0);for(let r=this.from;ri&&l!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),o),n.openStart,n.openEnd);return sn.fromReplace(e,this.from,this.to,i)}invert(){return new pa(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};Ht.jsonID("addMark",$f);var pa=class t extends Ht{constructor(e,n,r){super(),this.from=e,this.to=n,this.mark=r}apply(e){let n=e.slice(this.from,this.to),r=new ee(qk(n.content,o=>o.mark(this.mark.removeFromSet(o.marks)),e),n.openStart,n.openEnd);return sn.fromReplace(e,this.from,this.to,r)}invert(){return new $f(this.from,this.to,this.mark)}map(e){let n=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return n.deleted&&r.deleted||n.pos>=r.pos?null:new t(n.pos,r.pos,this.mark)}merge(e){return e instanceof t&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new t(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new t(n.from,n.to,e.markFromJSON(n.mark))}};Ht.jsonID("removeMark",pa);var Wf=class t extends Ht{constructor(e,n){super(),this.pos=e,this.mark=n}apply(e){let n=e.nodeAt(this.pos);if(!n)return sn.fail("No node at mark step's position");let r=n.type.create(n.attrs,null,this.mark.addToSet(n.marks));return sn.fromReplace(e,this.pos,this.pos+1,new ee(K.from(r),0,n.isLeaf?0:1))}invert(e){let n=e.nodeAt(this.pos);if(n){let r=this.mark.addToSet(n.marks);if(r.length==n.marks.length){for(let o=0;or.pos?null:new t(n.pos,r.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,n){if(typeof n.from!="number"||typeof n.to!="number"||typeof n.gapFrom!="number"||typeof n.gapTo!="number"||typeof n.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new t(n.from,n.to,n.gapFrom,n.gapTo,ee.fromJSON(e,n.slice),n.insert,!!n.structure)}};Ht.jsonID("replaceAround",It);function zk(t,e,n){let r=t.resolve(e),o=n-e,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let s=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}}return!1}function vV(t,e,n,r){let o=[],i=[],s,a;t.doc.nodesBetween(e,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,e),p=Math.min(u+l.nodeSize,n),m=r.addToSet(f);for(let y=0;yt.step(l)),i.forEach(l=>t.step(l))}function wV(t,e,n,r){let o=[],i=0;t.doc.nodesBetween(e,n,(s,a)=>{if(!s.isInline)return;i++;let l=null;if(r instanceof zf){let u=s.marks,c;for(;c=r.isInSet(u);)(l||(l=[])).push(c),u=c.removeFromSet(u)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let u=Math.min(a+s.nodeSize,n);for(let c=0;ct.step(new pa(s.from,s.to,s.style)))}function xV(t,e,n,r=n.contentMatch){let o=t.doc.nodeAt(e),i=[],s=e+1;for(let a=0;a=0;a--)t.step(i[a])}function SV(t,e,n){return(e==0||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function ci(t){let n=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let r=t.depth;;--r){let o=t.$from.node(r),i=t.$from.index(r),s=t.$to.indexAfter(r);if(rn;m--)y||r.index(m)>0?(y=!0,c=K.from(r.node(m).copy(c)),f++):l--;let d=K.empty,p=0;for(let m=i,y=!1;m>n;m--)y||o.after(m+1)=0;s--){if(r.size){let a=n[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=K.from(n[s].type.create(n[s].attrs,r))}let o=e.start,i=e.end;t.step(new It(o,i,o,i,new ee(r,0,0),n.length,!0))}function CV(t,e,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=t.steps.length;t.doc.nodesBetween(e,n,(s,a)=>{if(s.isTextblock&&!s.hasMarkup(r,o)&&TV(t.doc,t.mapping.slice(i).map(a),r)){t.clearIncompatible(t.mapping.slice(i).map(a,1),r);let l=t.mapping.slice(i),u=l.map(a,1),c=l.map(a+s.nodeSize,1);return t.step(new It(u,c,u+1,c-1,new ee(K.from(r.create(o,null,s.marks)),0,0),1,!0)),!1}})}function TV(t,e,n){let r=t.resolve(e),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}function PV(t,e,n,r,o){let i=t.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return t.replaceWith(e,e+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new It(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new ee(K.from(s),0,0),1,!0))}function Or(t,e,n=1,r){let o=t.resolve(e),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let u=o.depth-1,c=n-2;u>i;u--,c--){let f=o.node(u),d=o.index(u);if(f.type.spec.isolating)return!1;let p=f.content.cutByIndex(d,f.childCount),m=r&&r[c+1];m&&(p=p.replaceChild(0,m.type.create(m.attrs)));let y=r&&r[c]||f;if(!f.canReplace(d+1,f.childCount)||!y.type.validContent(p))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function OV(t,e,n=1,r){let o=t.doc.resolve(e),i=K.empty,s=K.empty;for(let a=o.depth,l=o.depth-n,u=n-1;a>l;a--,u--){i=K.from(o.node(a).copy(i));let c=r&&r[u];s=K.from(c?c.type.create(c.attrs,s):o.node(a).copy(s))}t.step(new Fn(e,e,new ee(i.append(s),n,n),!0))}function no(t,e){let n=t.resolve(e),r=n.index();return II(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function II(t,e){return!!(t&&e&&!t.isLeaf&&t.canAppend(e))}function hu(t,e,n=-1){let r=t.resolve(e);for(let o=r.depth;;o--){let i,s,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&II(i,s)&&r.node(o).canReplace(a,a+1))return e;if(o==0)break;e=n<0?r.before(o):r.after(o)}}function NV(t,e,n){let r=new Fn(e-n,e+n,ee.empty,!0);t.step(r)}function MV(t,e,n){let r=t.resolve(e);if(r.parent.canReplaceWith(r.index(),r.index(),n))return e;if(r.parentOffset==0)for(let o=r.depth-1;o>=0;o--){let i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(let o=r.depth-1;o>=0;o--){let i=r.indexAfter(o);if(r.node(o).canReplaceWith(i,i,n))return r.after(o+1);if(i=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),u=r.node(s),c=!1;if(i==1)c=u.canReplace(l,l,o);else{let f=u.contentMatchAt(l).findWrapping(o.firstChild.type);c=f&&u.canReplaceWith(l,l,f[0])}if(c)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Ng(t,e,n=e,r=ee.empty){if(e==n&&!r.size)return null;let o=t.resolve(e),i=t.resolve(n);return LI(o,i,r)?new Fn(e,n,r):new Vk(o,i,r).fit()}function LI(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}var Vk=class{constructor(e,n,r){this.$from=e,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=K.empty;for(let o=0;o<=e.depth;o++){let i=e.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(o))})}for(let o=e.depth;o>0;o--)this.placed=K.from(e.node(o).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 e=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(e<0?this.$to:r.doc.resolve(e));if(!o)return null;let i=this.placed,s=r.depth,a=o.depth;for(;s&&a&&i.childCount==1;)i=i.firstChild.content,s--,a--;let l=new ee(i,s,a);return e>-1?new It(r.pos,e,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new Fn(r.pos,o.pos,l):null}findFittable(){let e=this.unplaced.openStart;for(let n=this.unplaced.content,r=0,o=this.unplaced.openEnd;r1&&(o=0),i.type.spec.isolating&&o<=r){e=r;break}n=i.content}for(let n=1;n<=2;n++)for(let r=n==1?e:this.unplaced.openStart;r>=0;r--){let o,i=null;r?(i=Uk(this.unplaced.content,r-1).firstChild,o=i.content):o=this.unplaced.content;let s=o.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:u}=this.frontier[a],c,f=null;if(n==1&&(s?u.matchType(s.type)||(f=u.fillBefore(K.from(s),!1)):i&&l.compatibleContent(i.type)))return{sliceDepth:r,frontierDepth:a,parent:i,inject:f};if(n==2&&s&&(c=u.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:i,wrap:c};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Uk(e,n);return!o.childCount||o.firstChild.isLeaf?!1:(this.unplaced=new ee(e,n+1,Math.max(r,o.size+n>=e.size-r?n+1:0)),!0)}dropNode(){let{content:e,openStart:n,openEnd:r}=this.unplaced,o=Uk(e,n);if(o.childCount<=1&&n>0){let i=e.size-n<=n+o.size;this.unplaced=new ee(Vf(e,n-1,1),n-1,i?n-1:r)}else this.unplaced=new ee(Vf(e,n,1),n,r)}placeNodes({sliceDepth:e,frontierDepth:n,parent:r,inject:o,wrap:i}){for(;this.depth>n;)this.closeFrontierNode();if(i)for(let y=0;y1||l==0||y.content.size)&&(f=w,c.push(DI(y.mark(d.allowedMarks(y.marks)),u==1?l:0,u==a.childCount?p:-1)))}let m=u==a.childCount;m||(p=-1),this.placed=qf(this.placed,n,K.from(c)),this.frontier[n].match=f,m&&p<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let y=0,w=a;y1&&o==this.$to.end(--r);)++o;return o}findCloseLevel(e){e:for(let n=Math.min(this.depth,e.depth);n>=0;n--){let{match:r,type:o}=this.frontier[n],i=n=0;a--){let{match:l,type:u}=this.frontier[a],c=_k(e,a,u,l,!0);if(!c||c.childCount)continue e}return{depth:n,fit:s,move:i?e.doc.resolve(e.after(n+1)):e}}}}close(e){let n=this.findCloseLevel(e);if(!n)return null;for(;this.depth>n.depth;)this.closeFrontierNode();n.fit.childCount&&(this.placed=qf(this.placed,n.depth,n.fit)),e=n.move;for(let r=n.depth+1;r<=e.depth;r++){let o=e.node(r),i=o.type.contentMatch.fillBefore(o.content,!0,e.index(r));this.openFrontierNode(o.type,o.attrs,i)}return e}openFrontierNode(e,n=null,r){let o=this.frontier[this.depth];o.match=o.match.matchType(e),this.placed=qf(this.placed,this.depth,K.from(e.create(n,r))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let n=this.frontier.pop().match.fillBefore(K.empty,!0);n.childCount&&(this.placed=qf(this.placed,this.frontier.length,n))}};function Vf(t,e,n){return e==0?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(Vf(t.firstChild.content,e-1,n)))}function qf(t,e,n){return e==0?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy(qf(t.lastChild.content,e-1,n)))}function Uk(t,e){for(let n=0;n1&&(r=r.replaceChild(0,DI(r.firstChild,e-1,r.childCount==1?n-1:0))),e>0&&(r=t.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(t.type.contentMatch.matchFragment(r).fillBefore(K.empty,!0)))),t.copy(r)}function _k(t,e,n,r,o){let i=t.node(e),s=o?t.indexAfter(e):t.index(e);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!IV(n,i.content,s)?a:null}function IV(t,e,n){for(let r=n;r0;d--,p--){let m=o.node(d).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(d)>-1?a=d:o.before(d)==p&&s.splice(1,0,-d)}let l=s.indexOf(a),u=[],c=r.openStart;for(let d=r.content,p=0;;p++){let m=d.firstChild;if(u.push(m),p==r.openStart)break;d=m.content}for(let d=c-1;d>=0;d--){let p=u[d],m=AV(p.type);if(m&&!p.sameMarkup(o.node(Math.abs(a)-1)))c=d;else if(m||!p.type.isTextblock)break}for(let d=r.openStart;d>=0;d--){let p=(d+c+1)%(r.openStart+1),m=u[p];if(m)for(let y=0;y=0&&(t.replace(e,n,r),!(t.steps.length>f));d--){let p=s[d];p<0||(e=o.before(p),n=i.after(p))}}function FI(t,e,n,r,o){if(er){let i=o.contentMatchAt(0),s=i.fillBefore(t).append(t);t=s.append(i.matchFragment(s).fillBefore(K.empty,!0))}return t}function DV(t,e,n,r){if(!r.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=MV(t.doc,e,r.type);o!=null&&(e=n=o)}t.replaceRange(e,n,new ee(K.from(r),0,0))}function FV(t,e,n){let r=t.doc.resolve(e),o=t.doc.resolve(n),i=BI(r,o);for(let s=0;s0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return t.delete(r.before(a),o.after(a))}for(let s=1;s<=r.depth&&s<=o.depth;s++)if(e-r.start(s)==r.depth-s&&n>r.end(s)&&o.end(s)-n!=o.depth-s)return t.delete(r.before(s),n);t.delete(e,n)}function BI(t,e){let n=[],r=Math.min(t.depth,e.depth);for(let o=r;o>=0;o--){let i=t.start(o);if(ie.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}var Pg=class t extends Ht{constructor(e,n,r){super(),this.pos=e,this.attr=n,this.value=r}apply(e){let n=e.nodeAt(this.pos);if(!n)return sn.fail("No node at attribute step's position");let r=Object.create(null);for(let i in n.attrs)r[i]=n.attrs[i];r[this.attr]=this.value;let o=n.type.create(r,null,n.marks);return sn.fromReplace(e,this.pos,this.pos+1,new ee(K.from(o),0,n.isLeaf?0:1))}getMap(){return ui.empty}invert(e){return new t(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let n=e.mapResult(this.pos,1);return n.deletedAfter?null:new t(n.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.pos!="number"||typeof n.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new t(n.pos,n.attr,n.value)}};Ht.jsonID("attr",Pg);var Og=class t extends Ht{constructor(e,n){super(),this.attr=e,this.value=n}apply(e){let n=Object.create(null);for(let o in e.attrs)n[o]=e.attrs[o];n[this.attr]=this.value;let r=e.type.create(n,e.content,e.marks);return sn.ok(r)}getMap(){return ui.empty}invert(e){return new t(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,n){if(typeof n.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new t(n.attr,n.value)}};Ht.jsonID("docAttr",Og);var du=class extends Error{};du=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n};du.prototype=Object.create(Error.prototype);du.prototype.constructor=du;du.prototype.name="TransformError";var pu=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Hf}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let n=this.maybeStep(e);if(n.failed)throw new du(n.failed);return this}maybeStep(e){let n=e.apply(this.doc);return n.failed||this.addStep(e,n.doc),n}get docChanged(){return this.steps.length>0}addStep(e,n){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=n}replace(e,n=e,r=ee.empty){let o=Ng(this.doc,e,n,r);return o&&this.step(o),this}replaceWith(e,n,r){return this.replace(e,n,new ee(K.from(r),0,0))}delete(e,n){return this.replace(e,n,ee.empty)}insert(e,n){return this.replaceWith(e,e,n)}replaceRange(e,n,r){return LV(this,e,n,r),this}replaceRangeWith(e,n,r){return DV(this,e,n,r),this}deleteRange(e,n){return FV(this,e,n),this}lift(e,n){return kV(this,e,n),this}join(e,n=1){return NV(this,e,n),this}wrap(e,n){return RV(this,e,n),this}setBlockType(e,n=e,r,o=null){return CV(this,e,n,r,o),this}setNodeMarkup(e,n,r=null,o){return PV(this,e,n,r,o),this}setNodeAttribute(e,n,r){return this.step(new Pg(e,n,r)),this}setDocAttribute(e,n){return this.step(new Og(e,n)),this}addNodeMark(e,n){return this.step(new Wf(e,n)),this}removeNodeMark(e,n){if(!(n instanceof Ue)){let r=this.doc.nodeAt(e);if(!r)throw new RangeError("No node at position "+e);if(n=n.isInSet(r.marks),!n)return this}return this.step(new Gf(e,n)),this}split(e,n=1,r){return OV(this,e,n,r),this}addMark(e,n,r){return vV(this,e,n,r),this}removeMark(e,n,r){return wV(this,e,n,r),this}clearIncompatible(e,n,r){return xV(this,e,n,r),this}};var jk=Object.create(null),Ee=class{constructor(e,n,r){this.$anchor=e,this.$head=n,this.ranges=r||[new $k(e.min(n),e.max(n))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let n=0;n=0;i--){let s=n<0?gu(e.node(0),e.node(i),e.before(i+1),e.index(i),n,r):gu(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,n,r);if(s)return s}return null}static near(e,n=1){return this.findFrom(e,n)||this.findFrom(e,-n)||new fr(e.node(0))}static atStart(e){return gu(e,e,0,0,1)||new fr(e)}static atEnd(e){return gu(e,e,e.content.size,e.childCount,-1)||new fr(e)}static fromJSON(e,n){if(!n||!n.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=jk[n.type];if(!r)throw new RangeError(`No selection type ${n.type} defined`);return r.fromJSON(e,n)}static jsonID(e,n){if(e in jk)throw new RangeError("Duplicate use of selection JSON ID "+e);return jk[e]=n,n.prototype.jsonID=e,n}getBookmark(){return Me.between(this.$anchor,this.$head).getBookmark()}};Ee.prototype.visible=!0;var $k=class{constructor(e,n){this.$from=e,this.$to=n}},JI=!1;function UI(t){!JI&&!t.parent.inlineContent&&(JI=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}var Me=class t extends Ee{constructor(e,n=e){UI(e),UI(n),super(e,n)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,n){let r=e.resolve(n.map(this.head));if(!r.parent.inlineContent)return Ee.near(r);let o=e.resolve(n.map(this.anchor));return new t(o.parent.inlineContent?o:r,r)}replace(e,n=ee.empty){if(super.replace(e,n),n==ee.empty){let r=this.$from.marksAcross(this.$to);r&&e.ensureMarks(r)}}eq(e){return e instanceof t&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Ig(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,n){if(typeof n.anchor!="number"||typeof n.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new t(e.resolve(n.anchor),e.resolve(n.head))}static create(e,n,r=n){let o=e.resolve(n);return new this(o,r==n?o:e.resolve(r))}static between(e,n,r){let o=e.pos-n.pos;if((!r||o)&&(r=o>=0?1:-1),!n.parent.inlineContent){let i=Ee.findFrom(n,r,!0)||Ee.findFrom(n,-r,!0);if(i)n=i.$head;else return Ee.near(n,r)}return e.parent.inlineContent||(o==0?e=n:(e=(Ee.findFrom(e,-r,!0)||Ee.findFrom(e,r,!0)).$anchor,e.pos0?0:1);o>0?s=0;s+=o){let a=e.child(s);if(a.isAtom){if(!i&&ge.isSelectable(a))return ge.create(t,n-(o<0?a.nodeSize:0))}else{let l=gu(t,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function _I(t,e,n){let r=t.steps.length-1;if(r{s==null&&(s=c)}),t.setSelection(Ee.near(t.doc.resolve(s),n))}var zI=1,Mg=2,VI=4,Gk=class extends pu{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Mg,this}ensureMarks(e){return Ue.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Mg)>0}addStep(e,n){super.addStep(e,n),this.updated=this.updated&~Mg,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,n=!0){let r=this.selection;return n&&(e=e.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||Ue.none))),r.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,n,r){let o=this.doc.type.schema;if(n==null)return e?this.replaceSelectionWith(o.text(e),!0):this.deleteSelection();{if(r==null&&(r=n),r=r??n,!e)return this.deleteRange(n,r);let i=this.storedMarks;if(!i){let s=this.doc.resolve(n);i=r==n?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(n,r,o.text(e,i)),this.selection.empty||this.setSelection(Ee.near(this.selection.$to)),this}}setMeta(e,n){return this.meta[typeof e=="string"?e:e.key]=n,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=VI,this}get scrolledIntoView(){return(this.updated&VI)>0}};function qI(t,e){return!e||!t?t:t.bind(e)}var ma=class{constructor(e,n,r){this.name=e,this.init=qI(n.init,r),this.apply=qI(n.apply,r)}},JV=[new ma("doc",{init(t){return t.doc||t.schema.topNodeType.createAndFill()},apply(t){return t.doc}}),new ma("selection",{init(t,e){return t.selection||Ee.atStart(e.doc)},apply(t){return t.selection}}),new ma("storedMarks",{init(t){return t.storedMarks||null},apply(t,e,n,r){return r.selection.$cursor?t.storedMarks:null}}),new ma("scrollToSelection",{init(){return 0},apply(t,e){return t.scrolledIntoView?e+1:e}})],Kf=class{constructor(e,n){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=JV.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 ma(r.key,r.spec.state,r))})}},Ag=class t{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,n=-1){for(let r=0;rr.toJSON())),e&&typeof e=="object")for(let r in e){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=e[r],i=o.spec.state;i&&i.toJSON&&(n[r]=i.toJSON.call(o,this[o.key]))}return n}static fromJSON(e,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let o=new Kf(e.schema,e.plugins),i=new t(o);return o.fields.forEach(s=>{if(s.name=="doc")i.doc=to.fromJSON(e.schema,n.doc);else if(s.name=="selection")i.selection=Ee.fromJSON(i.doc,n.selection);else if(s.name=="storedMarks")n.storedMarks&&(i.storedMarks=n.storedMarks.map(e.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],u=l.spec.state;if(l.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(n,a)){i[s.name]=u.fromJSON.call(l,e,n[a],i);return}}i[s.name]=s.init(e,i)}}),i}};function jI(t,e,n){for(let r in t){let o=t[r];o instanceof Function?o=o.bind(e):r=="handleDOMEvents"&&(o=jI(o,e,{})),n[r]=o}return n}var At=class{constructor(e){this.spec=e,this.props={},e.props&&jI(e.props,this,this.props),this.key=e.key?e.key.key:HI("plugin")}getState(e){return e[this.key]}},Hk=Object.create(null);function HI(t){return t in Hk?t+"$"+ ++Hk[t]:(Hk[t]=0,t+"$")}var an=class{constructor(e="key"){this.key=HI(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}};var Bn=function(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e},Zf=function(t){let e=t.assignedSlot||t.parentNode;return e&&e.nodeType==11?e.host:e},$I=null,di=function(t,e,n){let r=$I||($I=document.createRange());return r.setEnd(t,n??t.nodeValue.length),r.setStart(t,e||0),r},Sa=function(t,e,n,r){return n&&(WI(t,e,n,r,-1)||WI(t,e,n,r,1))},UV=/^(img|br|input|textarea|hr)$/i;function WI(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Eo(t))){let i=t.parentNode;if(!i||i.nodeType!=1||yb(t)||UV.test(t.nodeName)||t.contentEditable=="false")return!1;e=Bn(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.contentEditable=="false")return!1;e=o<0?Eo(t):0}else return!1}}function Eo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function _V(t,e,n){for(let r=e==0,o=e==Eo(t);r||o;){if(t==n)return!0;let i=Bn(t);if(t=t.parentNode,!t)return!1;r=r&&i==0,o=o&&i==Eo(t)}}function yb(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}var jg=function(t){return t.focusNode&&Sa(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function ha(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}function zV(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function VV(t,e,n){if(t.caretPositionFromPoint)try{let r=t.caretPositionFromPoint(e,n);if(r)return{node:r.offsetNode,offset:r.offset}}catch{}if(t.caretRangeFromPoint){let r=t.caretRangeFromPoint(e,n);if(r)return{node:r.startContainer,offset:r.startOffset}}}var Ro=typeof navigator<"u"?navigator:null,GI=typeof document<"u"?document:null,fs=Ro&&Ro.userAgent||"",Zk=/Edge\/(\d+)/.exec(fs),RA=/MSIE \d/.exec(fs),eb=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(fs),Xn=!!(RA||eb||Zk),ls=RA?document.documentMode:eb?+eb[1]:Zk?+Zk[1]:0,oo=!Xn&&/gecko\/(\d+)/i.test(fs);oo&&+(/Firefox\/(\d+)/.exec(fs)||[0,0])[1];var tb=!Xn&&/Chrome\/(\d+)/.exec(fs),kn=!!tb,qV=tb?+tb[1]:0,Jn=!Xn&&!!Ro&&/Apple Computer/.test(Ro.vendor),Su=Jn&&(/Mobile\/\w+/.test(fs)||!!Ro&&Ro.maxTouchPoints>2),Nr=Su||(Ro?/Mac/.test(Ro.platform):!1),jV=Ro?/Win/.test(Ro.platform):!1,ro=/Android \d/.test(fs),rd=!!GI&&"webkitFontSmoothing"in GI.documentElement.style,HV=rd?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function $V(t){return{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function fi(t,e){return typeof t=="number"?t:t[e]}function WV(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,r=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*r}}function KI(t,e,n){let r=t.someProp("scrollThreshold")||0,o=t.someProp("scrollMargin")||5,i=t.dom.ownerDocument;for(let s=n||t.dom;s;s=Zf(s)){if(s.nodeType!=1)continue;let a=s,l=a==i.body,u=l?$V(i):WV(a),c=0,f=0;if(e.topu.bottom-fi(r,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+fi(o,"top")-u.top:e.bottom-u.bottom+fi(o,"bottom")),e.leftu.right-fi(r,"right")&&(c=e.right-u.right+fi(o,"right")),c||f)if(l)i.defaultView.scrollBy(c,f);else{let d=a.scrollLeft,p=a.scrollTop;f&&(a.scrollTop+=f),c&&(a.scrollLeft+=c);let m=a.scrollLeft-d,y=a.scrollTop-p;e={left:e.left-m,top:e.top-y,right:e.right-m,bottom:e.bottom-y}}if(l||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function GV(t){let e=t.dom.getBoundingClientRect(),n=Math.max(0,e.top),r,o;for(let i=(e.left+e.right)/2,s=n+1;s=n-20){r=a,o=l.top;break}}return{refDOM:r,refTop:o,stack:CA(t.dom)}}function CA(t){let e=[],n=t.ownerDocument;for(let r=t;r&&(e.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),t!=n);r=Zf(r));return e}function KV({refDOM:t,refTop:e,stack:n}){let r=t?t.getBoundingClientRect().top:0;TA(n,r==0?0:r-e)}function TA(t,e){for(let n=0;n=a){s=Math.max(m.bottom,s),a=Math.min(m.top,a);let y=m.left>e.left?m.left-e.left:m.right=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!l&&m.left<=e.left&&m.right>=e.left&&(l=c,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!n&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!n&&l&&(n=l,o=u,r=0),n&&n.nodeType==3?XV(n,o):!n||r&&n.nodeType==1?{node:t,offset:i}:PA(n,o)}function XV(t,e){let n=t.nodeValue.length,r=document.createRange();for(let o=0;o=(i.left+i.right)/2?1:0)}}return{node:t,offset:0}}function vb(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function QV(t,e){let n=t.parentNode;return n&&/^li$/i.test(n.nodeName)&&e.left(s.left+s.right)/2?1:-1}return t.docView.posFromDOM(r,o,i)}function eq(t,e,n,r){let o=-1;for(let i=e,s=!1;i!=t.dom;){let a=t.docView.nearestDesc(i,!0);if(!a)return null;if(a.dom.nodeType==1&&(a.node.isBlock&&a.parent&&!s||!a.contentDOM)){let l=a.dom.getBoundingClientRect();if(a.node.isBlock&&a.parent&&!s&&(s=!0,l.left>r.left||l.top>r.top?o=a.posBefore:(l.right-1?o:t.docView.posFromDOM(e,n,-1)}function OA(t,e,n){let r=t.childNodes.length;if(r&&n.tope.top&&o++}let u;rd&&o&&r.nodeType==1&&(u=r.childNodes[o-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&o--,r==t.dom&&o==r.childNodes.length-1&&r.lastChild.nodeType==1&&e.top>r.lastChild.getBoundingClientRect().bottom?a=t.state.doc.content.size:(o==0||r.nodeType!=1||r.childNodes[o-1].nodeName!="BR")&&(a=eq(t,r,o,e))}a==null&&(a=ZV(t,s,e));let l=t.docView.nearestDesc(s,!0);return{pos:a,inside:l?l.posAtStart-l.border:-1}}function YI(t){return t.top=0&&o==r.nodeValue.length?(l--,c=1):n<0?l--:u++,Yf(is(di(r,l,u),c),c<0)}if(!t.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&o&&(n<0||o==Eo(r))){let l=r.childNodes[o-1];if(l.nodeType==1)return Kk(l.getBoundingClientRect(),!1)}if(i==null&&o=0)}if(i==null&&o&&(n<0||o==Eo(r))){let l=r.childNodes[o-1],u=l.nodeType==3?di(l,Eo(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(u)return Yf(is(u,1),!1)}if(i==null&&o=0)}function Yf(t,e){if(t.width==0)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Kk(t,e){if(t.height==0)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function MA(t,e,n){let r=t.state,o=t.root.activeElement;r!=e&&t.updateState(e),o!=t.dom&&t.focus();try{return n()}finally{r!=e&&t.updateState(r),o!=t.dom&&o&&o.focus()}}function rq(t,e,n){let r=e.selection,o=n=="up"?r.$from:r.$to;return MA(t,e,()=>{let{node:i}=t.docView.domFromPos(o.pos,n=="up"?-1:1);for(;;){let a=t.docView.nearestDesc(i,!0);if(!a)break;if(a.node.isBlock){i=a.contentDOM||a.dom;break}i=a.dom.parentNode}let s=NA(t,o.pos,1);for(let a=i.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=di(a,0,a.nodeValue.length).getClientRects();else continue;for(let u=0;uc.top+1&&(n=="up"?s.top-c.top>(c.bottom-s.top)*2:c.bottom-s.bottom>(s.bottom-c.top)*2))return!1}}return!0})}var oq=/[\u0590-\u08ac]/;function iq(t,e,n){let{$head:r}=e.selection;if(!r.parent.isTextblock)return!1;let o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=t.domSelection();return!oq.test(r.parent.textContent)||!a.modify?n=="left"||n=="backward"?i:s:MA(t,e,()=>{let{focusNode:l,focusOffset:u,anchorNode:c,anchorOffset:f}=t.domSelectionRange(),d=a.caretBidiLevel;a.modify("move",n,"character");let p=r.depth?t.docView.domAfterPos(r.before()):t.dom,{focusNode:m,focusOffset:y}=t.domSelectionRange(),w=m&&!p.contains(m.nodeType==1?m:m.parentNode)||l==m&&u==y;try{a.collapse(c,f),l&&(l!=c||u!=f)&&a.extend&&a.extend(l,u)}catch{}return d!=null&&(a.caretBidiLevel=d),w})}var XI=null,QI=null,ZI=!1;function sq(t,e,n){return XI==e&&QI==n?ZI:(XI=e,QI=n,ZI=n=="up"||n=="down"?rq(t,e,n):iq(t,e,n))}var Mr=0,eA=1,ga=2,Co=3,ka=class{constructor(e,n,r,o){this.parent=e,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=Mr,r.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,n,r){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let n=0;nBn(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(n==0)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!1;break}if(i.previousSibling)break}if(o==null&&n==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){o=!0;break}if(i.nextSibling)break}}return o??r>0?this.posAtEnd:this.posAtStart}nearestDesc(e,n=!1){for(let r=!0,o=e;o;o=o.parentNode){let i=this.getDesc(o),s;if(i&&(!n||i.node))if(r&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))r=!1;else return i}}getDesc(e){let n=e.pmViewDesc;for(let r=n;r;r=r.parent)if(r==this)return n}posFromDOM(e,n,r){for(let o=e;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(e,n,r)}return-1}descAt(e){for(let n=0,r=0;ne||s instanceof Fg){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,n);for(let i;r&&!(i=this.children[r-1]).size&&i instanceof Lg&&i.side>=0;r--);if(n<=0){let i,s=!0;for(;i=r?this.children[r-1]:null,!(!i||i.dom.parentNode==this.contentDOM);r--,s=!1);return i&&n&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,n):{node:this.contentDOM,offset:i?Bn(i.dom)+1:0}}else{let i,s=!0;for(;i=r=c&&n<=u-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(e,n,c);e=s;for(let f=a;f>0;f--){let d=this.children[f-1];if(d.size&&d.dom.parentNode==this.contentDOM&&!d.emptyChildAt(1)){o=Bn(d.dom)+1;break}e-=d.size}o==-1&&(o=0)}if(o>-1&&(u>n||a==this.children.length-1)){n=u;for(let c=a+1;cp&&sn){let p=a;a=l,l=p}let d=document.createRange();d.setEnd(l.node,l.offset),d.setStart(a.node,a.offset),u.removeAllRanges(),u.addRange(d)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,n){for(let r=0,o=0;o=r:er){let a=r+i.border,l=s-i.border;if(e>=a&&n<=l){this.dirty=e==r||n==s?ga:eA,e==a&&n==l&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Co:i.markDirty(e-a,n-a);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?ga:Co}r=s}this.dirty=ga}markParentsDirty(){let e=1;for(let n=this.parent;n;n=n.parent,e++){let r=e==1?ga:eA;n.dirty{if(!i)return o;if(i.parent)return i.parent.posBeforeChild(i)})),!n.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=n,this.widget=n,i=this}matchesWidget(e){return this.dirty==Mr&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let n=this.widget.spec.stopEvent;return n?n(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},nb=class extends ka{constructor(e,n,r,o){super(e,[],n,null),this.textDOM=r,this.text=o}get size(){return this.text.length}localPosFromDOM(e,n){return e!=this.textDOM?this.posAtStart+(n?this.size:0):this.posAtStart+n}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}},ku=class t extends ka{constructor(e,n,r,o){super(e,[],r,o),this.mark=n}static create(e,n,r,o){let i=o.nodeViews[n.type.name],s=i&&i(n,o,r);return(!s||!s.dom)&&(s=li.renderSpec(document,n.type.spec.toDOM(n,r))),new t(e,n,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&Co||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Co&&this.mark.eq(e)}markDirty(e,n){if(super.markDirty(e,n),this.dirty!=Mr){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty0&&(i=ab(i,0,e,r));for(let a=0;a{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,o),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}=li.renderSpec(document,n.type.spec.toDOM(n)));!f&&!n.isText&&c.nodeName!="BR"&&(c.hasAttribute("contenteditable")||(c.contentEditable="false"),n.type.spec.draggable&&(c.draggable=!0));let d=c;return c=LA(c,r,n),u?l=new rb(e,n,r,o,c,f||null,d,u,i,s+1):n.isText?new Dg(e,n,r,o,c,d,i):new t(e,n,r,o,c,f||null,d,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let n=this.children.length-1;n>=0;n--){let r=this.children[n];if(this.dom.contains(r.dom.parentNode)){e.contentElement=r.dom.parentNode;break}}e.contentElement||(e.getContent=()=>K.empty)}return e}matchesNode(e,n,r){return this.dirty==Mr&&e.eq(this.node)&&ib(n,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,n){let r=this.node.inlineContent,o=n,i=e.composing?this.localCompositionInfo(e,n):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new sb(this,s&&s.node,e);cq(this.node,this.innerDeco,(u,c,f)=>{u.spec.marks?l.syncToMarks(u.spec.marks,r,e):u.type.side>=0&&!f&&l.syncToMarks(c==this.node.childCount?Ue.none:this.node.child(c).marks,r,e),l.placeWidget(u,e,o)},(u,c,f,d)=>{l.syncToMarks(u.marks,r,e);let p;l.findNodeMatch(u,c,f,d)||a&&e.state.selection.from>o&&e.state.selection.to-1&&l.updateNodeAt(u,c,f,p,e)||l.updateNextNode(u,c,f,e,d,o)||l.addNode(u,c,f,e,o),o+=u.nodeSize}),l.syncToMarks([],r,e),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==ga)&&(s&&this.protectLocalComposition(e,s),IA(this.contentDOM,this.children,e),Su&&fq(this.dom))}localCompositionInfo(e,n){let{from:r,to:o}=e.state.selection;if(!(e.state.selection instanceof Me)||rn+this.node.content.size)return null;let i=e.domSelectionRange(),s=dq(i.focusNode,i.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=pq(this.node.content,a,r-n,o-n);return l<0?null:{node:s,pos:l,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(e,{node:n,pos:r,text:o}){if(this.getDesc(n))return;let i=n;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new nb(this,i,n,o);e.input.compositionNodes.push(s),this.children=ab(this.children,r,r+o.length,e,s)}update(e,n,r,o){return this.dirty==Co||!e.sameMarkup(this.node)?!1:(this.updateInner(e,n,r,o),!0)}updateInner(e,n,r,o){this.updateOuterDeco(n),this.node=e,this.innerDeco=r,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=Mr}updateOuterDeco(e){if(ib(e,this.outerDeco))return;let n=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=AA(this.dom,this.nodeDOM,ob(this.outerDeco,this.node,n),ob(e,this.node,n)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}};function tA(t,e,n,r,o){LA(r,e,t);let i=new us(void 0,t,e,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var Dg=class t extends us{constructor(e,n,r,o,i,s,a){super(e,n,r,o,i,null,s,a,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,n,r,o){return this.dirty==Co||this.dirty!=Mr&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(n),(this.dirty!=Mr||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=e,this.dirty=Mr,!0)}inParent(){let e=this.parent.contentDOM;for(let n=this.nodeDOM;n;n=n.parentNode)if(n==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,n,r){return e==this.nodeDOM?this.posAtStart+Math.min(n,this.node.text.length):super.localPosFromDOM(e,n,r)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,n,r){let o=this.node.cut(e,n),i=document.createTextNode(o.text);return new t(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}markDirty(e,n){super.markDirty(e,n),this.dom!=this.nodeDOM&&(e==0||n==this.nodeDOM.nodeValue.length)&&(this.dirty=Co)}get domAtom(){return!1}},Fg=class extends ka{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==Mr&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},rb=class extends us{constructor(e,n,r,o,i,s,a,l,u,c){super(e,n,r,o,i,s,a,u,c),this.spec=l}update(e,n,r,o){if(this.dirty==Co)return!1;if(this.spec.update){let i=this.spec.update(e,n,r);return i&&this.updateInner(e,n,r,o),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,n,r,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,n,r,o){this.spec.setSelection?this.spec.setSelection(e,n,r):super.setSelection(e,n,r,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}};function IA(t,e,n){let r=t.firstChild,o=!1;for(let i=0;i>1,s=Math.min(i,e.length);for(;o-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=ku.create(this.top,e[i],n,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,i++}}findNodeMatch(e,n,r,o){let i=-1,s;if(o>=this.preMatch.index&&(s=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&s.matchesNode(e,n,r))i=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a0;){let a;for(;;)if(r){let u=n.children[r-1];if(u instanceof ku)n=u,r=u.children.length;else{a=u,r--;break}}else{if(n==e)break e;r=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}function uq(t,e){return t.type.side-e.type.side}function cq(t,e,n,r){let o=e.locals(t),i=0;if(o.length==0){for(let u=0;ui;)a.push(o[s++]);let m=i+d.nodeSize;if(d.isText){let w=m;s!w.inline):a.slice();r(d,y,e.forChild(i,d),p),i=m}}function fq(t){if(t.nodeName=="UL"||t.nodeName=="OL"){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}function dq(t,e){for(;;){if(t.nodeType==3)return t;if(t.nodeType==1&&e>0){if(t.childNodes.length>e&&t.childNodes[e].nodeType==3)return t.childNodes[e];t=t.childNodes[e-1],e=Eo(t)}else if(t.nodeType==1&&e=n){if(i>=r&&l.slice(r-e.length-a,r-a)==e)return r-e.length;let u=a=0&&u+e.length+a>=n)return a+u;if(n==r&&l.length>=r+e.length-a&&l.slice(r-a,r-a+e.length)==e)return r}}return-1}function ab(t,e,n,r,o){let i=[];for(let s=0,a=0;s=n||c<=e?i.push(l):(un&&i.push(l.slice(n-u,l.size,r)))}return i}function wb(t,e=null){let n=t.domSelectionRange(),r=t.state.doc;if(!n.focusNode)return null;let o=t.docView.nearestDesc(n.focusNode),i=o&&o.size==0,s=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,u;if(jg(n)){for(l=a;o&&!o.node;)o=o.parent;let c=o.node;if(o&&c.isAtom&&ge.isSelectable(c)&&o.parent&&!(c.isInline&&_V(n.focusNode,n.focusOffset,o.dom))){let f=o.posBefore;u=new ge(s==f?a:r.resolve(f))}}else{let c=t.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(c<0)return null;l=r.resolve(c)}if(!u){let c=e=="pointer"||t.state.selection.head{(n.anchorNode!=r||n.anchorOffset!=o)&&(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout(()=>{(!DA(t)||t.state.selection.visible)&&t.dom.classList.remove("ProseMirror-hideselection")},20))})}function hq(t){let e=t.domSelection(),n=document.createRange(),r=t.cursorWrapper.dom,o=r.nodeName=="IMG";o?n.setEnd(r.parentNode,Bn(r)+1):n.setEnd(r,0),n.collapse(!1),e.removeAllRanges(),e.addRange(n),!o&&!t.state.selection.visible&&Xn&&ls<=11&&(r.disabled=!0,r.disabled=!1)}function FA(t,e){if(e instanceof ge){let n=t.docView.descAt(e.from);n!=t.lastSelectedViewDesc&&(sA(t),n&&n.selectNode(),t.lastSelectedViewDesc=n)}else sA(t)}function sA(t){t.lastSelectedViewDesc&&(t.lastSelectedViewDesc.parent&&t.lastSelectedViewDesc.deselectNode(),t.lastSelectedViewDesc=void 0)}function xb(t,e,n,r){return t.someProp("createSelectionBetween",o=>o(t,e,n))||Me.between(e,n,r)}function aA(t){return t.editable&&!t.hasFocus()?!1:BA(t)}function BA(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function gq(t){let e=t.docView.domFromPos(t.state.selection.anchor,0),n=t.domSelectionRange();return Sa(e.node,e.offset,n.anchorNode,n.anchorOffset)}function lb(t,e){let{$anchor:n,$head:r}=t.selection,o=e>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?t.doc.resolve(e>0?o.after():o.before()):null:o;return i&&Ee.findFrom(i,e)}function ss(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function lA(t,e,n){let r=t.state.selection;if(r instanceof Me)if(n.indexOf("s")>-1){let{$head:o}=r,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=t.state.doc.resolve(o.pos+i.nodeSize*(e<0?-1:1));return ss(t,new Me(r.$anchor,s))}else if(r.empty){if(t.endOfTextblock(e>0?"forward":"backward")){let o=lb(t.state,e);return o&&o instanceof ge?ss(t,o):!1}else if(!(Nr&&n.indexOf("m")>-1)){let o=r.$head,i=o.textOffset?null:e<0?o.nodeBefore:o.nodeAfter,s;if(!i||i.isText)return!1;let a=e<0?o.pos-i.nodeSize:o.pos;return i.isAtom||(s=t.docView.descAt(a))&&!s.contentDOM?ge.isSelectable(i)?ss(t,new ge(e<0?t.state.doc.resolve(o.pos-i.nodeSize):o)):rd?ss(t,new Me(t.state.doc.resolve(e<0?a:a+i.nodeSize))):!1:!1}}else return!1;else{if(r instanceof ge&&r.node.isInline)return ss(t,new Me(e>0?r.$to:r.$from));{let o=lb(t.state,e);return o?ss(t,o):!1}}}function Bg(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qf(t,e){let n=t.pmViewDesc;return n&&n.size==0&&(e<0||t.nextSibling||t.nodeName!="BR")}function vu(t,e){return e<0?yq(t):vq(t)}function yq(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o,i,s=!1;for(oo&&n.nodeType==1&&r0){if(n.nodeType!=1)break;{let a=n.childNodes[r-1];if(Qf(a,-1))o=n,i=--r;else if(a.nodeType==3)n=a,r=n.nodeValue.length;else break}}else{if(JA(n))break;{let a=n.previousSibling;for(;a&&Qf(a,-1);)o=n.parentNode,i=Bn(a),a=a.previousSibling;if(a)n=a,r=Bg(n);else{if(n=n.parentNode,n==t.dom)break;r=0}}}s?ub(t,n,r):o&&ub(t,o,i)}function vq(t){let e=t.domSelectionRange(),n=e.focusNode,r=e.focusOffset;if(!n)return;let o=Bg(n),i,s;for(;;)if(r{t.state==o&&pi(t)},50)}function uA(t,e){let n=t.state.doc.resolve(e);if(!(kn||jV)&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let i=t.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>o.top&&s1)return i.lefto.top&&s1)return i.left>o.left?"ltr":"rtl"}}return getComputedStyle(t.dom).direction=="rtl"?"rtl":"ltr"}function cA(t,e,n){let r=t.state.selection;if(r instanceof Me&&!r.empty||n.indexOf("s")>-1||Nr&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let s=lb(t.state,e);if(s&&s instanceof ge)return ss(t,s)}if(!o.parent.inlineContent){let s=e<0?o:i,a=r instanceof fr?Ee.near(s,e):Ee.findFrom(s,e);return a?ss(t,a):!1}return!1}function fA(t,e){if(!(t.state.selection instanceof Me))return!0;let{$head:n,$anchor:r,empty:o}=t.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let s=t.state.tr;return e<0?s.delete(n.pos-i.nodeSize,n.pos):s.delete(n.pos,n.pos+i.nodeSize),t.dispatch(s),!0}return!1}function dA(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Sq(t){if(!Jn||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&e.nodeType==1&&n==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let r=e.firstChild;dA(t,r,"true"),setTimeout(()=>dA(t,r,"false"),20)}return!1}function kq(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}function bq(t,e){let n=e.keyCode,r=kq(e);if(n==8||Nr&&n==72&&r=="c")return fA(t,-1)||vu(t,-1);if(n==46&&!e.shiftKey||Nr&&n==68&&r=="c")return fA(t,1)||vu(t,1);if(n==13||n==27)return!0;if(n==37||Nr&&n==66&&r=="c"){let o=n==37?uA(t,t.state.selection.from)=="ltr"?-1:1:-1;return lA(t,o,r)||vu(t,o)}else if(n==39||Nr&&n==70&&r=="c"){let o=n==39?uA(t,t.state.selection.from)=="ltr"?1:-1:1;return lA(t,o,r)||vu(t,o)}else{if(n==38||Nr&&n==80&&r=="c")return cA(t,-1,r)||vu(t,-1);if(n==40||Nr&&n==78&&r=="c")return Sq(t)||cA(t,1,r)||vu(t,1);if(r==(Nr?"m":"c")&&(n==66||n==73||n==89||n==90))return!0}return!1}function UA(t,e){t.someProp("transformCopied",p=>{e=p(e,t)});let n=[],{content:r,openStart:o,openEnd:i}=e;for(;o>1&&i>1&&r.childCount==1&&r.firstChild.childCount==1;){o--,i--;let p=r.firstChild;n.push(p.type.name,p.attrs!=p.type.defaultAttrs?p.attrs:null),r=p.content}let s=t.someProp("clipboardSerializer")||li.fromSchema(t.state.schema),a=HA(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let u=l.firstChild,c,f=0;for(;u&&u.nodeType==1&&(c=jA[u.nodeName.toLowerCase()]);){for(let p=c.length-1;p>=0;p--){let m=a.createElement(c[p]);for(;l.firstChild;)m.appendChild(l.firstChild);l.appendChild(m),f++}u=l.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${o} ${i}${f?` -${f}`:""} ${JSON.stringify(n)}`);let d=t.someProp("clipboardTextSerializer",p=>p(e,t))||e.content.textBetween(0,e.content.size,` -`);return{dom:l,text:d}}function DA(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",d=>{e=d(e,i||r,t)}),i)return e?new ee(K.from(t.state.schema.text(e.replace(/\r\n?/g,` -`))),0,0):ee.empty;let f=t.someProp("clipboardTextParser",d=>d(e,o,r,t));if(f)a=f;else{let d=o.marks(),{schema:p}=t.state,m=ai.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let w=s.appendChild(document.createElement("p"));y&&w.appendChild(m.serializeNode(p.text(y,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=Uq(n),rd&&_q(s);let u=s&&s.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=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||ua.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!Bq.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=zq(lA(a,+c[1],+c[2]),c[4]);else if(a=ee.maxOpen(Jq(a.content,o),!0),a.openStart||a.openEnd){let f=0,d=0;for(let p=a.content.firstChild;f{a=f(a,t)}),a}var Bq=/^(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 Jq(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),u;if(!l)return s=null;if(u=s.length&&i.length&&BA(l,i,a,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=JA(s[s.length-1],i.length));let c=FA(a,l);s.push(c),o=o.matchType(c.type),i=l}}),s)return K.from(s)}return t}function FA(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,K.from(t));return t}function BA(t,e,n,r,o){if(o1&&(i=0),o=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(K.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function lA(t,e,n){return e]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=_A().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&UA[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"").reverse().join("")),n.innerHTML=t,o)for(let i=0;i=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=K.from(l.create(r[a+1],o)),i++,s++}return new ee(o,i,s)}var Jn={},Un={},Vq={touchstart:!0,touchmove:!0},hb=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function qq(t){for(let e in Jn){let n=Jn[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Hq(t,r)&&!Rb(t,r)&&(t.editable||!(r.type in Un))&&n(t,r)},Vq[e]?{passive:!0}:void 0)}Bn&&t.dom.addEventListener("input",()=>null),gb(t)}function ss(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function jq(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function gb(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Rb(t,r))})}function Rb(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Hq(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function $q(t,e){!Rb(t,e)&&Jn[e.type]&&(t.editable||!(e.type in Un))&&Jn[e.type](t,e)}Un.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!VA(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(to&&kn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Ou&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,da(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||Fq(t,n)?n.preventDefault():ss(t,"key")};Un.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};Un.keypress=(t,e)=>{let n=e;if(VA(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Pr&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Me)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function Vg(t){return{left:t.clientX,top:t.clientY}}function Wq(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function Cb(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function Pu(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function Gq(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&he.isSelectable(r)?(Pu(t,new he(n),"pointer"),!0):!1}function Kq(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof he&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(he.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(Pu(t,he.create(t.state.doc,o),"pointer"),!0):!1}function Yq(t,e,n,r,o){return Cb(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?Kq(t,n):Gq(t,n))}function Xq(t,e,n,r){return Cb(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Qq(t,e,n,r){return Cb(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||Zq(t,n,r)}function Zq(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(Pu(t,Me.create(r,0,r.content.size),"pointer"),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Pu(t,Me.create(r,a+1,a+1+s.content.size),"pointer");else if(he.isSelectable(s))Pu(t,he.create(r,a),"pointer");else continue;return!0}}function Tb(t){return Dg(t)}var zA=Pr?"metaKey":"ctrlKey";Jn.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=Tb(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Wq(n,t.input.lastClick)&&!n[zA]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(Vg(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new yb(t,s,n,!!r)):(i=="doubleClick"?Xq:Qq)(t,s.pos,s.inside,n)?n.preventDefault():ss(t,"pointer"))};var yb=class{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[zA],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}let a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:u}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof he&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&no&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),ss(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>di(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Vg(e))),this.updateAllowDefault(e),this.allowDefault||!n?ss(this.view,"pointer"):Yq(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Bn&&this.mightDrag&&!this.mightDrag.node.isAtom||kn&&!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)?(Pu(this.view,Ee.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):ss(this.view,"pointer")}move(e){this.updateAllowDefault(e),ss(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Jn.touchstart=t=>{t.input.lastTouch=Date.now(),Tb(t),ss(t,"pointer")};Jn.touchmove=t=>{t.input.lastTouch=Date.now(),ss(t,"pointer")};Jn.contextmenu=t=>Tb(t);function VA(t,e){return t.composing?!0:Bn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var e5=to?5e3:-1;Un.compositionstart=Un.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Dg(t,!0),t.markCursor=null;else if(Dg(t),no&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){t.domSelection().collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}qA(t,e5)};Un.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,qA(t,20))};function qA(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Dg(t),e))}function jA(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=t5());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function t5(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Dg(t,e=!1){if(!(to&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),jA(t),e||t.docView&&t.docView.dirty){let n=bb(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function n5(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var ed=Yn&&as<15||Ou&&oq<604;Jn.copy=Un.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=ed?null:n.clipboardData,s=r.content(),{dom:a,text:l}=LA(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):n5(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function r5(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function o5(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?td(t,r.value,null,o,e):td(t,r.textContent,r.innerHTML,o,e)},50)}function td(t,e,n,r,o){let i=DA(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||ee.empty)))return!0;if(!i)return!1;let s=r5(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function HA(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}Un.paste=(t,e)=>{let n=e;if(t.composing&&!to)return;let r=ed?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&td(t,HA(r),r.getData("text/html"),o,n)?n.preventDefault():o5(t,n)};var Fg=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},$A=Pr?"altKey":"ctrlKey";Jn.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Vg(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof he?o.to-1:o.to))){if(r&&r.mightDrag)s=he.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let c=t.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=t.docView&&(s=he.create(t.state.doc,c.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u}=LA(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(ed?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ed||n.dataTransfer.setData("text/plain",u),t.dragging=new Fg(a,!n[$A],s)};Jn.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};Un.dragover=Un.dragenter=(t,e)=>e.preventDefault();Un.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Vg(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",m=>{s=m(s,t)}):s=DA(t,HA(n.dataTransfer),ed?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[$A]);if(t.someProp("handleDrop",m=>m(t,n,s||ee.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?PI(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let u=t.state.tr;if(a){let{node:m}=r;m?m.replace(u):u.deleteSelection()}let c=u.mapping.map(l),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=u.doc;if(f?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(d))return;let p=u.doc.resolve(c);if(f&&he.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new he(p));else{let m=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((y,w,g,v)=>m=v),u.setSelection(Eb(t,p,u.doc.resolve(m)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};Jn.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&di(t)},20))};Jn.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Jn.beforeinput=(t,e)=>{if(kn&&to&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,da(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in Un)Jn[t]=Un[t];function nd(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}var Bg=class t{constructor(e,n){this.toDOM=e,this.spec=n||ga,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new us(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&nd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},ha=class t{constructor(e,n){this.attrs=e,this.spec=n||ga}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new us(i,s,this)}valid(e,n){return n.from=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;se){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Sn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||ga)}mapInner(e,n,r,o,i){let s;for(let a=0;a{let u=l+r,c;if(c=GA(n,a,u)){for(o||(o=this.children.slice());ia&&f.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;ai&&l.type instanceof ha){let u=Math.max(i,l.from)-i,c=Math.min(s,l.to)-i;uo.map(e,n,ga));return t.from(r)}forChild(e,n){if(n.isLeaf)return Nr.empty;let r=[];for(let o=0;on instanceof Nr)?e:e.reduce((n,r)=>n.concat(r instanceof Nr?r:r.members),[]))}}};function i5(t,e,n,r,o,i,s){let a=t.slice();for(let u=0,c=i;u{let w=y-m-(p-d);for(let g=0;gv+c-f)continue;let k=a[g]+c-f;p>=k?a[g+1]=d<=k?-2:-1:d>=c&&w&&(a[g]+=w,a[g+1]+=w)}f+=w}),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(t[u+1]+i,-1),p=d-o,{index:m,offset:y}=r.content.findIndex(f),w=r.maybeChild(m);if(w&&y==f&&y+w.nodeSize==p){let g=a[u+2].mapInner(n,w,c+1,t[u]+i+1,s);g!=Sn?(a[u]=f,a[u+1]=p,a[u+2]=g):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=s5(a,t,e,n,o,i,s),c=Ug(u,r,0,s);e=c.local;for(let f=0;fn&&s.to{let u=GA(t,a,l+n);if(u){i=!0;let c=Ug(u,a,n+l+1,r);c!=Sn&&o.push(l,l+a.nodeSize,c)}});let s=WA(i?KA(t):t,-n).sort(ya);for(let a=0;a0;)e++;t.splice(e,0,n)}function tb(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Sn&&e.push(r)}),t.cursorWrapper&&e.push(Nr.create(t.state.doc,[t.cursorWrapper.deco])),Jg.from(e)}var a5={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},l5=Yn&&as<=11,wb=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},xb=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new wb,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;oo.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),l5&&(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,a5)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;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(nA(this.view)){if(this.suppressingSelectionUpdates)return di(this.view);if(Yn&&as<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&va(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Zf(i))n.add(i);for(let i=e.anchorNode;i;i=Zf(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&nA(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c1){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let f=c[0],d=c[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let u=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(i>-1&&(e.docView.markDirty(i,s),u5(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||di(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;co;w--){let g=r.childNodes[w-1],v=g.pmViewDesc;if(g.nodeName=="BR"&&!v){i=w;break}if(!v||v.size)break}let f=t.state.doc,d=t.someProp("domParser")||ua.fromSchema(t.state.schema),p=f.resolve(s),m=null,y=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:d5,context:p});if(u&&u[0].pos!=null){let w=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=w),m={anchor:w+s,head:g+s}}return{doc:y,sel:m,from:s,to:a}}function d5(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Bn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Bn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}var p5=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function m5(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let O=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,A=bb(t,O);if(A&&!t.state.selection.eq(A)){if(kn&&to&&t.input.lastKeyCode===13&&Date.now()-100L(t,da(13,"Enter"))))return;let B=t.state.tr.setSelection(A);O=="pointer"?B.setMeta("pointer",!0):O=="key"&&B.scrollIntoView(),i&&B.setMeta("composition",i),t.dispatch(B)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=f5(t,e,n),c=t.state.doc,f=c.slice(u.from,u.to),d,p;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||to)&&o.some(O=>O.nodeType==1&&!p5.test(O.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",O=>O(t,da(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Me&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let O=pA(t,t.state.doc,u.sel);if(O&&!O.eq(t.state.selection)){let A=t.state.tr.setSelection(O);i&&A.setMeta("composition",i),t.dispatch(A)}}return}if(kn&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from&&u.sel.head==u.sel.anchor){let O=m.endB-m.start;u.sel={anchor:u.sel.anchor+O,head:u.sel.anchor+O}}t.input.domChangeCount++,t.state.selection.fromt.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Yn&&as<=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 y=u.doc.resolveNoCache(m.start-u.from),w=u.doc.resolveNoCache(m.endB-u.from),g=c.resolve(m.start),v=y.sameParent(w)&&y.parent.inlineContent&&g.end()>=m.endA,k;if((Ou&&t.input.lastIOSEnter>Date.now()-225&&(!v||o.some(O=>O.nodeName=="DIV"||O.nodeName=="P"))||!v&&y.posO(t,da(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&g5(c,m.start,m.endA,y,w)&&t.someProp("handleKeyDown",O=>O(t,da(8,"Backspace")))){to&&kn&&t.domObserver.suppressSelectionUpdates();return}kn&&to&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),to&&!v&&y.start()!=w.start()&&w.parentOffset==0&&y.depth==w.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,w=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(O){return O(t,da(13,"Enter"))})},20));let S=m.start,b=m.endA,x,T,E;if(v){if(y.pos==w.pos)Yn&&as<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>di(t),20)),x=t.state.tr.delete(S,b),T=c.resolve(m.start).marksAcross(c.resolve(m.endA));else if(m.endA==m.endB&&(E=h5(y.parent.content.cut(y.parentOffset,w.parentOffset),g.parent.content.cut(g.parentOffset,m.endA-g.start()))))x=t.state.tr,E.type=="add"?x.addMark(S,b,E.mark):x.removeMark(S,b,E.mark);else if(y.parent.child(y.index()).isText&&y.index()==w.index()-(w.textOffset?0:1)){let O=y.parent.textBetween(y.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",A=>A(t,S,b,O)))return;x=t.state.tr.insertText(O,S,b)}}if(x||(x=t.state.tr.replace(S,b,u.doc.slice(m.start-u.from,m.endB-u.from))),u.sel){let O=pA(t,x.doc,u.sel);O&&!(kn&&to&&t.composing&&O.empty&&(m.start!=m.endB||t.input.lastAndroidDeletee.content.size?null:Eb(t,e.resolve(n.anchor),e.resolve(n.head))}function h5(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,l;for(let c=0;cc.mark(a.addToSet(c.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||nb(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function y5(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s=s?i-r:0;i-=l,i&&i=a?i-r:0;i-=l,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}var _g=class{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new hb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(wA),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=yA(this),gA(this),this.nodeViews=vA(this),this.docView=YI(this.state.doc,hA(this),tb(this),this.dom,this),this.domObserver=new xb(this,(r,o,i,s)=>m5(this,r,o,i,s)),this.domObserver.start(),qq(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&gb(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(wA),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(jA(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=vA(this);w5(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&gb(this),this.editable=yA(this),gA(this);let l=tb(this),u=hA(this),c=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,l);(f||!e.selection.eq(o.selection))&&(s=!0);let d=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&aq(this);if(s){this.domObserver.stop();let p=f&&(Yn||kn)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&v5(o.selection,e.selection);if(f){let m=kn?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=YI(e.doc,u,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Oq(this))?di(this,p):(MA(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&lq(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof he){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&jI(this,n.getBoundingClientRect(),e)}else jI(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Fg(e.slice,e.move,o<0?void 0:he.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return mq(this,e)}coordsAtPos(e,n=1){return RA(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return wq(this,n||this.state,e)}pasteHTML(e,n){return td(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return td(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(jq(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],tb(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return $q(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Bn&&this.root.nodeType===11&&eq(this.dom.ownerDocument)==this.dom?c5(this):this.domSelection()}domSelection(){return this.root.getSelection()}};function hA(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[us.node(0,t.state.doc.content.size,e)]}function gA(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:us.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function yA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function v5(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function vA(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function w5(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function wA(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var pi={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:"'"},jg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},x5=typeof navigator<"u"&&/Mac/.test(navigator.platform),S5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Lt=0;Lt<10;Lt++)pi[48+Lt]=pi[96+Lt]=String(Lt);var Lt;for(Lt=1;Lt<=24;Lt++)pi[Lt+111]="F"+Lt;var Lt;for(Lt=65;Lt<=90;Lt++)pi[Lt]=String.fromCharCode(Lt+32),jg[Lt]=String.fromCharCode(Lt);var Lt;for(qg in pi)jg.hasOwnProperty(qg)||(jg[qg]=pi[qg]);var qg;function YA(t){var e=x5&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||S5&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?jg:pi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}var k5=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function b5(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a127)&&(i=pi[r.keyCode])&&i!=o){let a=e[Ob(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var Hg=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function C5(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Mb=(t,e,n)=>{let r=C5(t,n);if(!r)return!1;let o=ZA(r);if(!o){let s=r.blockRange(),a=s&&ui(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&iL(t,o,e))return!0;if(r.parent.content.size==0&&(Mu(i,"end")||he.isSelectable(i))){let s=Tg(t.doc,r.before(),r.after(),ee.empty);if(s&&s.slice.size{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=ZA(r)}let s=i&&i.nodeBefore;return!s||!he.isSelectable(s)?!1:(e&&e(t.tr.setSelection(he.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function ZA(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function T5(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=T5(t,n);if(!r)return!1;let o=eL(r);if(!o)return!1;let i=o.nodeAfter;if(iL(t,o,e))return!0;if(r.parent.content.size==0&&(Mu(i,"start")||he.isSelectable(i))){let s=Tg(t.doc,r.before(),r.after(),ee.empty);if(s&&s.slice.size{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof he,o;if(r){if(n.node.isTextblock||!eo(t.doc,n.from))return!1;o=n.from}else if(o=bu(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(he.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},nL=(t,e)=>{let n=t.selection,r;if(n instanceof he){if(n.node.isTextblock||!eo(t.doc,n.to))return!1;r=n.to}else if(r=bu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},rL=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&ui(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},Db=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` -`).scrollIntoView()),!0)};function Fb(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Fb(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ee.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Jb=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof cr||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Fb(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Tr(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&ui(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function P5(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof he&&e.selection.node.isBlock)return!r.parentOffset||!Tr(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let i=o.parentOffset==o.parent.content.size,s=e.tr;(e.selection instanceof Me||e.selection instanceof cr)&&s.deleteSelection();let a=r.depth==0?null:Fb(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=t&&t(o.parent,i),u=l?[l]:i&&a?[{type:a}]:void 0,c=Tr(s.doc,s.mapping.map(r.pos),1,u);if(!u&&!c&&Tr(s.doc,s.mapping.map(r.pos),1,a?[{type:a}]:void 0)&&(a&&(u=[{type:a}]),c=!0),c&&(s.split(s.mapping.map(r.pos),1,u),!i&&!r.parentOffset&&r.parent.type!=a)){let f=s.mapping.map(r.before()),d=s.doc.resolve(f);a&&r.node(-1).canReplaceWith(d.index(),d.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}n(s.scrollIntoView())}return!0}}var O5=P5();var oL=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(he.create(t.doc,o))),!0)},N5=(t,e)=>(e&&e(t.tr.setSelection(new cr(t.doc))),!0);function M5(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||eo(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function iL(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(M5(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(n){let f=e.pos+o.nodeSize,d=K.empty;for(let y=i.length-1;y>=0;y--)d=K.from(i[y].create(null,d));d=K.from(r.copy(d));let p=t.tr.step(new It(e.pos-1,f,e.pos,f,new ee(d,1,0),i.length,!0)),m=f+2*i.length;eo(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let l=Ee.findFrom(e,1),u=l&&l.$from.blockRange(l.$to),c=u&&ui(u);if(c!=null&&c>=e.depth)return n&&n(t.tr.lift(u,c).scrollIntoView()),!0;if(a&&Mu(o,"start",!0)&&Mu(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let p=o,m=1;for(;!p.isTextblock;p=p.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let y=K.empty;for(let g=d.length-1;g>=0;g--)y=K.from(d[g].copy(y));let w=t.tr.step(new It(e.pos-d.length,e.pos+o.nodeSize,e.pos+m,e.pos+o.nodeSize-m,new ee(y,d.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function sL(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(Me.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}var _b=sL(-1),zb=sL(1);function aL(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&ku(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Vb(t,e=null){return function(n,r){let o=!1;for(let i=0;i{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let c=n.doc.resolve(u),f=c.index();o=c.parent.canReplaceWith(f,f+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let c=n.doc.resolve(s.start-2);l=new aa(c,c,s.depth),s.endIndex=0;c--)i=K.from(n[c].type.create(n[c].attrs,i));t.step(new It(e.start-(r?2:0),e.end,e.start,e.end,new ee(i,0,0),n.length,!0));let s=0;for(let c=0;cs.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?L5(e,n,t,i):D5(e,n,i):!0:!1}}function L5(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);iy;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(a?0:1),c+1,s.content.append(l?K.empty:K.from(o))))return!1;let f=i.pos,d=f+s.nodeSize;return r.step(new It(f-(a?1:0),d+(l?1:0),f+1,d-1,new ee((a?K.empty:K.from(o.copy(K.empty))).append(l?K.empty:K.from(o.copy(K.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function cL(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=K.from(u?t.create():null),f=new ee(K.from(t.create(null,K.from(a.type.create(null,c)))),u?3:1,0),d=i.start,p=i.end;n(e.tr.step(new It(d-(u?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function Yg(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Iu=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:n,state:r}=this,{view:o}=n,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{let f=l(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a=[],l=!!e,u=e||i.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),a.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,p])=>[d,(...y)=>{let w=this.buildProps(u,n),g=p(...y)(w);return a.push(g),f}])),run:c};return f}createCan(e){let{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...c)=>u(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a={tr:e,editor:o,view:s,state:Yg({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}},Kb=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){let r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,n)),this}off(e,n){let r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ae(t,e,n){return t.config[e]===void 0&&t.parent?ae(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ae(t.parent,e,n):null}):t.config[e]}function Xg(t){let e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function vL(t){let e=[],{nodeExtensions:n,markExtensions:r}=Xg(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=ae(s,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(f=>{Object.entries(c.attributes).forEach(([d,p])=>{e.push({type:f,name:d,attribute:{...i,...p}})})})})}),o.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=ae(s,"addAttributes",a);if(!l)return;let u=l();Object.entries(u).forEach(([c,f])=>{let d={...i,...f};typeof d?.default=="function"&&(d.default=d.default()),d?.isRequired&&d?.default===void 0&&delete d.default,e.push({type:s.name,name:c,attribute:d})})}),e}function Ht(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function $t(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){let a=i?i.split(" "):[],l=r[o]?r[o].split(" "):[],u=a.filter(c=>!l.includes(c));r[o]=[...l,...u].join(" ")}else o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function Yb(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>$t(n,r),{})}function wL(t){return typeof t=="function"}function Ie(t,e=void 0,...n){return wL(t)?e?t.bind(e)(...n):t(...n):t}function F5(t={}){return Object.keys(t).length===0&&t.constructor===Object}function B5(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function fL(t,e){return t.style?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let o=e.reduce((i,s)=>{let a=s.attribute.parseHTML?s.attribute.parseHTML(n):B5(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function dL(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&F5(n)?!1:n!=null))}function J5(t,e){var n;let r=vL(t),{nodeExtensions:o,markExtensions:i}=Xg(t),s=(n=o.find(u=>ae(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(o.map(u=>{let c=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((g,v)=>{let k=ae(v,"extendNodeSchema",f);return{...g,...k?k(u):{}}},{}),p=dL({...d,content:Ie(ae(u,"content",f)),marks:Ie(ae(u,"marks",f)),group:Ie(ae(u,"group",f)),inline:Ie(ae(u,"inline",f)),atom:Ie(ae(u,"atom",f)),selectable:Ie(ae(u,"selectable",f)),draggable:Ie(ae(u,"draggable",f)),code:Ie(ae(u,"code",f)),defining:Ie(ae(u,"defining",f)),isolating:Ie(ae(u,"isolating",f)),attrs:Object.fromEntries(c.map(g=>{var v;return[g.name,{default:(v=g?.attribute)===null||v===void 0?void 0:v.default}]}))}),m=Ie(ae(u,"parseHTML",f));m&&(p.parseDOM=m.map(g=>fL(g,c)));let y=ae(u,"renderHTML",f);y&&(p.toDOM=g=>y({node:g,HTMLAttributes:Yb(g,c)}));let w=ae(u,"renderText",f);return w&&(p.toText=w),[u.name,p]})),l=Object.fromEntries(i.map(u=>{let c=r.filter(w=>w.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((w,g)=>{let v=ae(g,"extendMarkSchema",f);return{...w,...v?v(u):{}}},{}),p=dL({...d,inclusive:Ie(ae(u,"inclusive",f)),excludes:Ie(ae(u,"excludes",f)),group:Ie(ae(u,"group",f)),spanning:Ie(ae(u,"spanning",f)),code:Ie(ae(u,"code",f)),attrs:Object.fromEntries(c.map(w=>{var g;return[w.name,{default:(g=w?.attribute)===null||g===void 0?void 0:g.default}]}))}),m=Ie(ae(u,"parseHTML",f));m&&(p.parseDOM=m.map(w=>fL(w,c)));let y=ae(u,"renderHTML",f);return y&&(p.toDOM=w=>y({mark:w,HTMLAttributes:Yb(w,c)})),[u.name,p]}));return new xg({topNode:s,nodes:a,marks:l})}function jb(t,e){return e.nodes[t]||e.marks[t]||null}function pL(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}var U5=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var l,u;let c=((u=(l=o.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=c.slice(0,Math.max(0,r-i))}),n};function e1(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var Au=class{constructor(e){this.find=e.find,this.handler=e.handler}},_5=(t,e)=>{if(e1(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Hb(t){var e;let{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;let u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let c=!1,f=U5(u)+i;return s.forEach(d=>{if(c)return;let p=_5(f,d.find);if(!p)return;let m=l.state.tr,y=Yg({state:l.state,transaction:m}),w={from:r-(p[0].length-i.length),to:o},{commands:g,chain:v,can:k}=new Iu({editor:n,state:y});d.handler({state:y,range:w,match:p,commands:g,chain:v,can:k})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:o,text:i}),l.dispatch(m),c=!0)}),c}function z5(t){let{editor:e,rules:n}=t,r=new At({state:{init(){return null},apply(o,i){let s=o.getMeta(r);return s||(o.selectionSet||o.docChanged?null:i)}},props:{handleTextInput(o,i,s,a){return Hb({editor:e,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&Hb({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?Hb({editor:e,from:s.pos,to:s.pos,text:` -`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function V5(t){return typeof t=="number"}var od=class{constructor(e){this.find=e.find,this.handler=e.handler}},q5=(t,e)=>{if(e1(e))return[...t.matchAll(e)];let n=e(t);return n?n.map(r=>{let o=[r.text];return o.index=r.index,o.input=t,o.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(r.replaceWith)),o}):[]};function j5(t){let{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Iu({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,o,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;let y=Math.max(r,m),w=Math.min(o,m+p.content.size),g=p.textBetween(y-m,w-m,void 0,"\uFFFC");q5(g,i.find).forEach(k=>{if(k.index===void 0)return;let S=y+k.index+1,b=S+k[0].length,x={from:n.tr.mapping.map(S),to:n.tr.mapping.map(b)},T=i.handler({state:n,range:x,match:k,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});f.push(T)})}),f.every(p=>p!==null)}function H5(t){let{editor:e,rules:n}=t,r=null,o=!1,i=!1,s=new ClipboardEvent("paste"),a=new DragEvent("drop");return n.map(u=>new At({view(c){let f=d=>{var p;r=!((p=c.dom.parentElement)===null||p===void 0)&&p.contains(d.target)?c.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(c,f)=>(i=r===c.dom.parentElement,a=f,!1),paste:(c,f)=>{var d;let p=(d=f.clipboardData)===null||d===void 0?void 0:d.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(c,f,d)=>{let p=c[0],m=p.getMeta("uiEvent")==="paste"&&!o,y=p.getMeta("uiEvent")==="drop"&&!i;if(!m&&!y)return;let w=f.doc.content.findDiffStart(d.doc.content),g=f.doc.content.findDiffEnd(d.doc.content);if(!V5(w)||!g||w===g.b)return;let v=d.tr,k=Yg({state:d,transaction:v});if(!(!j5({editor:e,state:k,from:Math.max(w-1,0),to:g.b-1,rule:u,pasteEvent:s,dropEvent:a})||!v.steps.length))return a=new DragEvent("drop"),s=new ClipboardEvent("paste"),v}}))}function $5(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}var Xb=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=J5(this.extensions,n),this.extensions.forEach(r=>{var o;this.editor.extensionStorage[r.name]=r.storage;let i={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:jb(r.name,this.schema)};r.type==="mark"&&(!((o=Ie(ae(r,"keepOnSplit",i)))!==null&&o!==void 0)||o)&&this.splittableMarks.push(r.name);let s=ae(r,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);let a=ae(r,"onCreate",i);a&&this.editor.on("create",a);let l=ae(r,"onUpdate",i);l&&this.editor.on("update",l);let u=ae(r,"onSelectionUpdate",i);u&&this.editor.on("selectionUpdate",u);let c=ae(r,"onTransaction",i);c&&this.editor.on("transaction",c);let f=ae(r,"onFocus",i);f&&this.editor.on("focus",f);let d=ae(r,"onBlur",i);d&&this.editor.on("blur",d);let p=ae(r,"onDestroy",i);p&&this.editor.on("destroy",p)})}static resolve(e){let n=t.sort(t.flatten(e)),r=$5(n.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{let r={name:n.name,options:n.options,storage:n.storage},o=ae(n,"addExtensions",r);return o?[n,...this.flatten(o())]:n}).flat(10)}static sort(e){return e.sort((r,o)=>{let i=ae(r,"priority")||100,s=ae(o,"priority")||100;return i>s?-1:i{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:jb(n.name,this.schema)},o=ae(n,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){let{editor:e}=this,n=t.sort([...this.extensions].reverse()),r=[],o=[],i=n.map(s=>{let a={name:s.name,options:s.options,storage:s.storage,editor:e,type:jb(s.name,this.schema)},l=[],u=ae(s,"addKeyboardShortcuts",a),c={};if(s.type==="mark"&&s.config.exitable&&(c.ArrowRight=()=>fr.handleExit({editor:e,mark:s})),u){let y=Object.fromEntries(Object.entries(u()).map(([w,g])=>[w,()=>g({editor:e})]));c={...c,...y}}let f=XA(c);l.push(f);let d=ae(s,"addInputRules",a);pL(s,e.options.enableInputRules)&&d&&r.push(...d());let p=ae(s,"addPasteRules",a);pL(s,e.options.enablePasteRules)&&p&&o.push(...p());let m=ae(s,"addProseMirrorPlugins",a);if(m){let y=m();l.push(...y)}return l}).flat();return[z5({editor:e,rules:r}),...H5({editor:e,rules:o}),...i]}get attributes(){return vL(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=Xg(this.extensions);return Object.fromEntries(n.filter(r=>!!ae(r,"addNodeView")).map(r=>{let o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:Ht(r.name,this.schema)},s=ae(r,"addNodeView",i);if(!s)return[];let a=(l,u,c,f)=>{let d=Yb(l,o);return s()({editor:e,node:l,getPos:c,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,a]}))}};function W5(t){return Object.prototype.toString.call(t).slice(8,-1)}function $b(t){return W5(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function Qg(t,e){let n={...t};return $b(t)&&$b(e)&&Object.keys(e).forEach(r=>{$b(e[r])?r in t?n[r]=Qg(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}var Mr=class t{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(ae(this,"addOptions",{name:this.name}))),this.storage=Ie(ae(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=Qg(this.options,e),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ie(ae(n,"addOptions",{name:n.name})),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}};function xL(t,e,n){let{from:r,to:o}=e,{blockSeparator:i=` +`);return{dom:l,text:d}}function _A(t,e,n,r,o){let i=o.parent.type.spec.code,s,a;if(!n&&!e)return null;let l=e&&(r||i||!n);if(l){if(t.someProp("transformPastedText",d=>{e=d(e,i||r,t)}),i)return e?new ee(K.from(t.state.schema.text(e.replace(/\r\n?/g,` +`))),0,0):ee.empty;let f=t.someProp("clipboardTextParser",d=>d(e,o,r,t));if(f)a=f;else{let d=o.marks(),{schema:p}=t.state,m=li.fromSchema(p);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(y=>{let w=s.appendChild(document.createElement("p"));y&&w.appendChild(m.serializeNode(p.text(y,d)))})}}else t.someProp("transformPastedHTML",f=>{n=f(n,t)}),s=Cq(n),rd&&Tq(s);let u=s&&s.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=s.firstChild;for(;d&&d.nodeType!=1;)d=d.nextSibling;if(!d)break;s=d}if(a||(a=(t.someProp("clipboardParser")||t.someProp("domParser")||da.fromSchema(t.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||c),context:o,ruleFromNode(d){return d.nodeName=="BR"&&!d.nextSibling&&d.parentNode&&!Eq.test(d.parentNode.nodeName)?{ignore:!0}:null}})),c)a=Pq(pA(a,+c[1],+c[2]),c[4]);else if(a=ee.maxOpen(Rq(a.content,o),!0),a.openStart||a.openEnd){let f=0,d=0;for(let p=a.content.firstChild;f{a=f(a,t)}),a}var Eq=/^(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 Rq(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o=e.node(n).contentMatchAt(e.index(n)),i,s=[];if(t.forEach(a=>{if(!s)return;let l=o.findWrapping(a.type),u;if(!l)return s=null;if(u=s.length&&i.length&&VA(l,i,a,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=qA(s[s.length-1],i.length));let c=zA(a,l);s.push(c),o=o.matchType(c.type),i=l}}),s)return K.from(s)}return t}function zA(t,e,n=0){for(let r=e.length-1;r>=n;r--)t=e[r].create(null,K.from(t));return t}function VA(t,e,n,r,o){if(o1&&(i=0),o=n&&(a=e<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(K.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,s.copy(a))}function pA(t,e,n){return e]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n=HA().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(t),o;if((o=r&&jA[r[1].toLowerCase()])&&(t=o.map(i=>"<"+i+">").join("")+t+o.map(i=>"").reverse().join("")),n.innerHTML=t,o)for(let i=0;i=0;a-=2){let l=n.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;o=K.from(l.create(r[a+1],o)),i++,s++}return new ee(o,i,s)}var Un={},_n={},Oq={touchstart:!0,touchmove:!0},fb=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Nq(t){for(let e in Un){let n=Un[e];t.dom.addEventListener(e,t.input.eventHandlers[e]=r=>{Iq(t,r)&&!Sb(t,r)&&(t.editable||!(r.type in _n))&&n(t,r)},Oq[e]?{passive:!0}:void 0)}Jn&&t.dom.addEventListener("input",()=>null),db(t)}function as(t,e){t.input.lastSelectionOrigin=e,t.input.lastSelectionTime=Date.now()}function Mq(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}function db(t){t.someProp("handleDOMEvents",e=>{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=r=>Sb(t,r))})}function Sb(t,e){return t.someProp("handleDOMEvents",n=>{let r=n[e.type];return r?r(t,e)||e.defaultPrevented:!1})}function Iq(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||n.nodeType==11||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function Aq(t,e){!Sb(t,e)&&Un[e.type]&&(t.editable||!(e.type in _n))&&Un[e.type](t,e)}_n.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=n.keyCode==16||n.shiftKey,!WA(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!(ro&&kn&&n.keyCode==13)))if(n.keyCode!=229&&t.domObserver.forceFlush(),Su&&n.keyCode==13&&!n.ctrlKey&&!n.altKey&&!n.metaKey){let r=Date.now();t.input.lastIOSEnter=r,t.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{t.input.lastIOSEnter==r&&(t.someProp("handleKeyDown",o=>o(t,ha(13,"Enter"))),t.input.lastIOSEnter=0)},200)}else t.someProp("handleKeyDown",r=>r(t,n))||bq(t,n)?n.preventDefault():as(t,"key")};_n.keyup=(t,e)=>{e.keyCode==16&&(t.input.shiftKey=!1)};_n.keypress=(t,e)=>{let n=e;if(WA(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||Nr&&n.metaKey)return;if(t.someProp("handleKeyPress",o=>o(t,n))){n.preventDefault();return}let r=t.state.selection;if(!(r instanceof Me)||!r.$from.sameParent(r.$to)){let o=String.fromCharCode(n.charCode);!/[\r\n]/.test(o)&&!t.someProp("handleTextInput",i=>i(t,r.$from.pos,r.$to.pos,o))&&t.dispatch(t.state.tr.insertText(o).scrollIntoView()),n.preventDefault()}};function Hg(t){return{left:t.clientX,top:t.clientY}}function Lq(t,e){let n=e.x-t.clientX,r=e.y-t.clientY;return n*n+r*r<100}function kb(t,e,n,r,o){if(r==-1)return!1;let i=t.state.doc.resolve(r);for(let s=i.depth+1;s>0;s--)if(t.someProp(e,a=>s>i.depth?a(t,n,i.nodeAfter,i.before(s),o,!0):a(t,n,i.node(s),i.before(s),o,!1)))return!0;return!1}function xu(t,e,n){t.focused||t.focus();let r=t.state.tr.setSelection(e);n=="pointer"&&r.setMeta("pointer",!0),t.dispatch(r)}function Dq(t,e){if(e==-1)return!1;let n=t.state.doc.resolve(e),r=n.nodeAfter;return r&&r.isAtom&&ge.isSelectable(r)?(xu(t,new ge(n),"pointer"),!0):!1}function Fq(t,e){if(e==-1)return!1;let n=t.state.selection,r,o;n instanceof ge&&(r=n.node);let i=t.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let a=s>i.depth?i.nodeAfter:i.node(s);if(ge.isSelectable(a)){r&&n.$from.depth>0&&s>=n.$from.depth&&i.before(n.$from.depth+1)==n.$from.pos?o=i.before(n.$from.depth):o=i.before(s);break}}return o!=null?(xu(t,ge.create(t.state.doc,o),"pointer"),!0):!1}function Bq(t,e,n,r,o){return kb(t,"handleClickOn",e,n,r)||t.someProp("handleClick",i=>i(t,e,r))||(o?Fq(t,n):Dq(t,n))}function Jq(t,e,n,r){return kb(t,"handleDoubleClickOn",e,n,r)||t.someProp("handleDoubleClick",o=>o(t,e,r))}function Uq(t,e,n,r){return kb(t,"handleTripleClickOn",e,n,r)||t.someProp("handleTripleClick",o=>o(t,e,r))||_q(t,n,r)}function _q(t,e,n){if(n.button!=0)return!1;let r=t.state.doc;if(e==-1)return r.inlineContent?(xu(t,Me.create(r,0,r.content.size),"pointer"),!0):!1;let o=r.resolve(e);for(let i=o.depth+1;i>0;i--){let s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)xu(t,Me.create(r,a+1,a+1+s.content.size),"pointer");else if(ge.isSelectable(s))xu(t,ge.create(r,a),"pointer");else continue;return!0}}function bb(t){return Jg(t)}var $A=Nr?"metaKey":"ctrlKey";Un.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let r=bb(t),o=Date.now(),i="singleClick";o-t.input.lastClick.time<500&&Lq(n,t.input.lastClick)&&!n[$A]&&(t.input.lastClick.type=="singleClick"?i="doubleClick":t.input.lastClick.type=="doubleClick"&&(i="tripleClick")),t.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i};let s=t.posAtCoords(Hg(n));s&&(i=="singleClick"?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new pb(t,s,n,!!r)):(i=="doubleClick"?Jq:Uq)(t,s.pos,s.inside,n)?n.preventDefault():as(t,"pointer"))};var pb=class{constructor(e,n,r,o){this.view=e,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!r[$A],this.allowDefault=r.shiftKey;let i,s;if(n.inside>-1)i=e.state.doc.nodeAt(n.inside),s=n.inside;else{let c=e.state.doc.resolve(n.pos);i=c.parent,s=c.depth?c.before():0}let a=o?null:r.target,l=a?e.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:u}=e.state;(r.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof ge&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&oo&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),as(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>pi(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let n=this.pos;this.view.state.doc!=this.startDoc&&(n=this.view.posAtCoords(Hg(e))),this.updateAllowDefault(e),this.allowDefault||!n?as(this.view,"pointer"):Bq(this.view,n.pos,n.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||Jn&&this.mightDrag&&!this.mightDrag.node.isAtom||kn&&!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)?(xu(this.view,Ee.near(this.view.state.doc.resolve(n.pos)),"pointer"),e.preventDefault()):as(this.view,"pointer")}move(e){this.updateAllowDefault(e),as(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}};Un.touchstart=t=>{t.input.lastTouch=Date.now(),bb(t),as(t,"pointer")};Un.touchmove=t=>{t.input.lastTouch=Date.now(),as(t,"pointer")};Un.contextmenu=t=>bb(t);function WA(t,e){return t.composing?!0:Jn&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500?(t.input.compositionEndedAt=-2e8,!0):!1}var zq=ro?5e3:-1;_n.compositionstart=_n.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$from;if(e.selection.empty&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))t.markCursor=t.state.storedMarks||n.marks(),Jg(t,!0),t.markCursor=null;else if(Jg(t),oo&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let r=t.domSelectionRange();for(let o=r.focusNode,i=r.focusOffset;o&&o.nodeType==1&&i!=0;){let s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(s.nodeType==3){t.domSelection().collapse(s,s.nodeValue.length);break}else o=s,i=-1}}t.input.composing=!0}GA(t,zq)};_n.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionPendingChanges&&Promise.resolve().then(()=>t.domObserver.flush()),t.input.compositionID++,GA(t,20))};function GA(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout(()=>Jg(t),e))}function KA(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=Vq());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Vq(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}function Jg(t,e=!1){if(!(ro&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),KA(t),e||t.docView&&t.docView.dirty){let n=wb(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):t.updateState(t.state),!0}return!1}}function qq(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(e),t.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()},50)}var ed=Xn&&ls<15||Su&&HV<604;Un.copy=_n.cut=(t,e)=>{let n=e,r=t.state.selection,o=n.type=="cut";if(r.empty)return;let i=ed?null:n.clipboardData,s=r.content(),{dom:a,text:l}=UA(t,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):qq(t,a),o&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function jq(t){return t.openStart==0&&t.openEnd==0&&t.content.childCount==1?t.content.firstChild:null}function Hq(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,r=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=t.input.shiftKey&&t.input.lastKeyCode!=45;setTimeout(()=>{t.focus(),r.parentNode&&r.parentNode.removeChild(r),n?td(t,r.value,null,o,e):td(t,r.textContent,r.innerHTML,o,e)},50)}function td(t,e,n,r,o){let i=_A(t,e,n,r,t.state.selection.$from);if(t.someProp("handlePaste",l=>l(t,o,i||ee.empty)))return!0;if(!i)return!1;let s=jq(i),a=s?t.state.tr.replaceSelectionWith(s,r):t.state.tr.replaceSelection(i);return t.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function YA(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}_n.paste=(t,e)=>{let n=e;if(t.composing&&!ro)return;let r=ed?null:n.clipboardData,o=t.input.shiftKey&&t.input.lastKeyCode!=45;r&&td(t,YA(r),r.getData("text/html"),o,n)?n.preventDefault():Hq(t,n)};var Ug=class{constructor(e,n,r){this.slice=e,this.move=n,this.node=r}},XA=Nr?"altKey":"ctrlKey";Un.dragstart=(t,e)=>{let n=e,r=t.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o=t.state.selection,i=o.empty?null:t.posAtCoords(Hg(n)),s;if(!(i&&i.pos>=o.from&&i.pos<=(o instanceof ge?o.to-1:o.to))){if(r&&r.mightDrag)s=ge.create(t.state.doc,r.mightDrag.pos);else if(n.target&&n.target.nodeType==1){let c=t.docView.nearestDesc(n.target,!0);c&&c.node.type.spec.draggable&&c!=t.docView&&(s=ge.create(t.state.doc,c.posBefore))}}let a=(s||t.state.selection).content(),{dom:l,text:u}=UA(t,a);n.dataTransfer.clearData(),n.dataTransfer.setData(ed?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",ed||n.dataTransfer.setData("text/plain",u),t.dragging=new Ug(a,!n[XA],s)};Un.dragend=t=>{let e=t.dragging;window.setTimeout(()=>{t.dragging==e&&(t.dragging=null)},50)};_n.dragover=_n.dragenter=(t,e)=>e.preventDefault();_n.drop=(t,e)=>{let n=e,r=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let o=t.posAtCoords(Hg(n));if(!o)return;let i=t.state.doc.resolve(o.pos),s=r&&r.slice;s?t.someProp("transformPasted",m=>{s=m(s,t)}):s=_A(t,YA(n.dataTransfer),ed?null:n.dataTransfer.getData("text/html"),!1,i);let a=!!(r&&!n[XA]);if(t.someProp("handleDrop",m=>m(t,n,s||ee.empty,a))){n.preventDefault();return}if(!s)return;n.preventDefault();let l=s?AI(t.state.doc,i.pos,s):i.pos;l==null&&(l=i.pos);let u=t.state.tr;if(a){let{node:m}=r;m?m.replace(u):u.deleteSelection()}let c=u.mapping.map(l),f=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,d=u.doc;if(f?u.replaceRangeWith(c,c,s.content.firstChild):u.replaceRange(c,c,s),u.doc.eq(d))return;let p=u.doc.resolve(c);if(f&&ge.isSelectable(s.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(s.content.firstChild))u.setSelection(new ge(p));else{let m=u.mapping.map(l);u.mapping.maps[u.mapping.maps.length-1].forEach((y,w,g,v)=>m=v),u.setSelection(xb(t,p,u.doc.resolve(m)))}t.focus(),t.dispatch(u.setMeta("uiEvent","drop"))};Un.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout(()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&pi(t)},20))};Un.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)};Un.beforeinput=(t,e)=>{if(kn&&ro&&e.inputType=="deleteContentBackward"){t.domObserver.flushSoon();let{domChangeCount:r}=t.input;setTimeout(()=>{if(t.input.domChangeCount!=r||(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",i=>i(t,ha(8,"Backspace")))))return;let{$cursor:o}=t.state.selection;o&&o.pos>0&&t.dispatch(t.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let t in _n)Un[t]=_n[t];function nd(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}var _g=class t{constructor(e,n){this.toDOM=e,this.spec=n||wa,this.side=this.spec.side||0}map(e,n,r,o){let{pos:i,deleted:s}=e.mapResult(n.from+o,this.side<0?-1:1);return s?null:new cs(i-r,i-r,this)}valid(){return!0}eq(e){return this==e||e instanceof t&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&nd(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}},va=class t{constructor(e,n){this.attrs=e,this.spec=n||wa}map(e,n,r,o){let i=e.map(n.from+o,this.spec.inclusiveStart?-1:1)-r,s=e.map(n.to+o,this.spec.inclusiveEnd?1:-1)-r;return i>=s?null:new cs(i,s,this)}valid(e,n){return n.from=e&&(!i||i(a.spec))&&r.push(a.copy(a.from+o,a.to+o))}for(let s=0;se){let a=this.children[s]+1;this.children[s+2].findInner(e-a,n-a,r,o+a,i)}}map(e,n,r){return this==Sn||e.maps.length==0?this:this.mapInner(e,n,0,0,r||wa)}mapInner(e,n,r,o,i){let s;for(let a=0;a{let u=l+r,c;if(c=ZA(n,a,u)){for(o||(o=this.children.slice());ia&&f.to=e){this.children[a]==e&&(r=this.children[a+2]);break}let i=e+1,s=i+n.content.size;for(let a=0;ai&&l.type instanceof va){let u=Math.max(i,l.from)-i,c=Math.min(s,l.to)-i;uo.map(e,n,wa));return t.from(r)}forChild(e,n){if(n.isLeaf)return Ir.empty;let r=[];for(let o=0;on instanceof Ir)?e:e.reduce((n,r)=>n.concat(r instanceof Ir?r:r.members),[]))}}};function $q(t,e,n,r,o,i,s){let a=t.slice();for(let u=0,c=i;u{let w=y-m-(p-d);for(let g=0;gv+c-f)continue;let k=a[g]+c-f;p>=k?a[g+1]=d<=k?-2:-1:d>=c&&w&&(a[g]+=w,a[g+1]+=w)}f+=w}),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(t[u+1]+i,-1),p=d-o,{index:m,offset:y}=r.content.findIndex(f),w=r.maybeChild(m);if(w&&y==f&&y+w.nodeSize==p){let g=a[u+2].mapInner(n,w,c+1,t[u]+i+1,s);g!=Sn?(a[u]=f,a[u+1]=p,a[u+2]=g):(a[u+1]=-2,l=!0)}else l=!0}if(l){let u=Wq(a,t,e,n,o,i,s),c=Vg(u,r,0,s);e=c.local;for(let f=0;fn&&s.to{let u=ZA(t,a,l+n);if(u){i=!0;let c=Vg(u,a,n+l+1,r);c!=Sn&&o.push(l,l+a.nodeSize,c)}});let s=QA(i?eL(t):t,-n).sort(xa);for(let a=0;a0;)e++;t.splice(e,0,n)}function Xk(t){let e=[];return t.someProp("decorations",n=>{let r=n(t.state);r&&r!=Sn&&e.push(r)}),t.cursorWrapper&&e.push(Ir.create(t.state.doc,[t.cursorWrapper.deco])),zg.from(e)}var Gq={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},Kq=Xn&&ls<=11,hb=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}},gb=class{constructor(e,n){this.view=e,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new hb,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let o=0;oo.type=="childList"&&o.removedNodes.length||o.type=="characterData"&&o.oldValue.length>o.target.nodeValue.length)?this.flushSoon():this.flush()}),Kq&&(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,Gq)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let n=0;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(aA(this.view)){if(this.suppressingSelectionUpdates)return pi(this.view);if(Xn&&ls<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&Sa(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let n=new Set,r;for(let i=e.focusNode;i;i=Zf(i))n.add(i);for(let i=e.anchorNode;i;i=Zf(i))if(n.has(i)){r=i;break}let o=r&&this.view.docView.nearestDesc(r);if(o&&o.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let n=this.pendingRecords();n.length&&(this.queue=[]);let r=e.domSelectionRange(),o=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&aA(e)&&!this.ignoreSelectionChange(r),i=-1,s=-1,a=!1,l=[];if(e.editable)for(let c=0;c1){let c=l.filter(f=>f.nodeName=="BR");if(c.length==2){let f=c[0],d=c[1];f.parentNode&&f.parentNode.parentNode==d.parentNode?d.remove():f.remove()}}let u=null;i<0&&o&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)-1||o)&&(i>-1&&(e.docView.markDirty(i,s),Yq(e)),this.handleDOMChange(i,s,a,l),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(r)||pi(e),this.currentSelection.set(r))}registerMutation(e,n){if(n.indexOf(e.target)>-1)return null;let r=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(r==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!r||r.ignoreMutation(e))return null;if(e.type=="childList"){for(let c=0;co;w--){let g=r.childNodes[w-1],v=g.pmViewDesc;if(g.nodeName=="BR"&&!v){i=w;break}if(!v||v.size)break}let f=t.state.doc,d=t.someProp("domParser")||da.fromSchema(t.state.schema),p=f.resolve(s),m=null,y=d.parse(r,{topNode:p.parent,topMatch:p.parent.contentMatchAt(p.index()),topOpen:!0,from:o,to:i,preserveWhitespace:p.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:Zq,context:p});if(u&&u[0].pos!=null){let w=u[0].pos,g=u[1]&&u[1].pos;g==null&&(g=w),m={anchor:w+s,head:g+s}}return{doc:y,sel:m,from:s,to:a}}function Zq(t){let e=t.pmViewDesc;if(e)return e.parseRule();if(t.nodeName=="BR"&&t.parentNode){if(Jn&&/^(ul|ol)$/i.test(t.parentNode.nodeName)){let n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}else if(t.parentNode.lastChild==t||Jn&&/^(tr|table)$/i.test(t.parentNode.nodeName))return{ignore:!0}}else if(t.nodeName=="IMG"&&t.getAttribute("mark-placeholder"))return{ignore:!0};return null}var e5=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function t5(t,e,n,r,o){let i=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let O=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,I=wb(t,O);if(I&&!t.state.selection.eq(I)){if(kn&&ro&&t.input.lastKeyCode===13&&Date.now()-100L(t,ha(13,"Enter"))))return;let B=t.state.tr.setSelection(I);O=="pointer"?B.setMeta("pointer",!0):O=="key"&&B.scrollIntoView(),i&&B.setMeta("composition",i),t.dispatch(B)}return}let s=t.state.doc.resolve(e),a=s.sharedDepth(n);e=s.before(a+1),n=t.state.doc.resolve(n).after(a+1);let l=t.state.selection,u=Qq(t,e,n),c=t.state.doc,f=c.slice(u.from,u.to),d,p;t.input.lastKeyCode===8&&Date.now()-100Date.now()-225||ro)&&o.some(O=>O.nodeType==1&&!e5.test(O.nodeName))&&(!m||m.endA>=m.endB)&&t.someProp("handleKeyDown",O=>O(t,ha(13,"Enter")))){t.input.lastIOSEnter=0;return}if(!m)if(r&&l instanceof Me&&!l.empty&&l.$head.sameParent(l.$anchor)&&!t.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:l.from,endA:l.to,endB:l.to};else{if(u.sel){let O=vA(t,t.state.doc,u.sel);if(O&&!O.eq(t.state.selection)){let I=t.state.tr.setSelection(O);i&&I.setMeta("composition",i),t.dispatch(I)}}return}if(kn&&t.cursorWrapper&&u.sel&&u.sel.anchor==t.cursorWrapper.deco.from&&u.sel.head==u.sel.anchor){let O=m.endB-m.start;u.sel={anchor:u.sel.anchor+O,head:u.sel.anchor+O}}t.input.domChangeCount++,t.state.selection.fromt.state.selection.from&&m.start<=t.state.selection.from+2&&t.state.selection.from>=u.from?m.start=t.state.selection.from:m.endA=t.state.selection.to-2&&t.state.selection.to<=u.to&&(m.endB+=t.state.selection.to-m.endA,m.endA=t.state.selection.to)),Xn&&ls<=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 y=u.doc.resolveNoCache(m.start-u.from),w=u.doc.resolveNoCache(m.endB-u.from),g=c.resolve(m.start),v=y.sameParent(w)&&y.parent.inlineContent&&g.end()>=m.endA,k;if((Su&&t.input.lastIOSEnter>Date.now()-225&&(!v||o.some(O=>O.nodeName=="DIV"||O.nodeName=="P"))||!v&&y.posO(t,ha(13,"Enter")))){t.input.lastIOSEnter=0;return}if(t.state.selection.anchor>m.start&&r5(c,m.start,m.endA,y,w)&&t.someProp("handleKeyDown",O=>O(t,ha(8,"Backspace")))){ro&&kn&&t.domObserver.suppressSelectionUpdates();return}kn&&ro&&m.endB==m.start&&(t.input.lastAndroidDelete=Date.now()),ro&&!v&&y.start()!=w.start()&&w.parentOffset==0&&y.depth==w.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,w=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{t.someProp("handleKeyDown",function(O){return O(t,ha(13,"Enter"))})},20));let S=m.start,b=m.endA,x,R,E;if(v){if(y.pos==w.pos)Xn&&ls<=11&&y.parentOffset==0&&(t.domObserver.suppressSelectionUpdates(),setTimeout(()=>pi(t),20)),x=t.state.tr.delete(S,b),R=c.resolve(m.start).marksAcross(c.resolve(m.endA));else if(m.endA==m.endB&&(E=n5(y.parent.content.cut(y.parentOffset,w.parentOffset),g.parent.content.cut(g.parentOffset,m.endA-g.start()))))x=t.state.tr,E.type=="add"?x.addMark(S,b,E.mark):x.removeMark(S,b,E.mark);else if(y.parent.child(y.index()).isText&&y.index()==w.index()-(w.textOffset?0:1)){let O=y.parent.textBetween(y.parentOffset,w.parentOffset);if(t.someProp("handleTextInput",I=>I(t,S,b,O)))return;x=t.state.tr.insertText(O,S,b)}}if(x||(x=t.state.tr.replace(S,b,u.doc.slice(m.start-u.from,m.endB-u.from))),u.sel){let O=vA(t,x.doc,u.sel);O&&!(kn&&ro&&t.composing&&O.empty&&(m.start!=m.endB||t.input.lastAndroidDeletee.content.size?null:xb(t,e.resolve(n.anchor),e.resolve(n.head))}function n5(t,e){let n=t.firstChild.marks,r=e.firstChild.marks,o=n,i=r,s,a,l;for(let c=0;cc.mark(a.addToSet(c.marks));else if(o.length==0&&i.length==1)a=i[0],s="remove",l=c=>c.mark(a.removeFromSet(c.marks));else return null;let u=[];for(let c=0;cn||Qk(s,!0,!1)0&&(e||t.indexAfter(r)==t.node(r).childCount);)r--,o++,e=!1;if(n){let i=t.node(r).maybeChild(t.indexAfter(r));for(;i&&!i.isLeaf;)i=i.firstChild,o++}return o}function o5(t,e,n,r,o){let i=t.findDiffStart(e,n);if(i==null)return null;let{a:s,b:a}=t.findDiffEnd(e,n+t.size,n+e.size);if(o=="end"){let l=Math.max(0,i-Math.min(s,a));r-=s+l-i}if(s=s?i-r:0;i-=l,i&&i=a?i-r:0;i-=l,i&&i=56320&&e<=57343&&n>=55296&&n<=56319}var qg=class{constructor(e,n){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new fb,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(EA),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=kA(this),SA(this),this.nodeViews=bA(this),this.docView=tA(this.state.doc,xA(this),Xk(this),this.dom,this),this.domObserver=new gb(this,(r,o,i,s)=>t5(this,r,o,i,s)),this.domObserver.start(),Nq(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let n in e)this._props[n]=e[n];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&db(this);let n=this._props;this._props=e,e.plugins&&(e.plugins.forEach(EA),this.directPlugins=e.plugins),this.updateStateInner(e.state,n)}setProps(e){let n={};for(let r in this._props)n[r]=this._props[r];n.state=this.state;for(let r in e)n[r]=e[r];this.update(n)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,n){var r;let o=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(KA(this),s=!0),this.state=e;let a=o.plugins!=e.plugins||this._props.plugins!=n.plugins;if(a||this._props.plugins!=n.plugins||this._props.nodeViews!=n.nodeViews){let p=bA(this);s5(p,this.nodeViews)&&(this.nodeViews=p,i=!0)}(a||n.handleDOMEvents!=this._props.handleDOMEvents)&&db(this),this.editable=kA(this),SA(this);let l=Xk(this),u=xA(this),c=o.plugins!=e.plugins&&!o.doc.eq(e.doc)?"reset":e.scrollToSelection>o.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,l);(f||!e.selection.eq(o.selection))&&(s=!0);let d=c=="preserve"&&s&&this.dom.style.overflowAnchor==null&&GV(this);if(s){this.domObserver.stop();let p=f&&(Xn||kn)&&!this.composing&&!o.selection.empty&&!e.selection.empty&&i5(o.selection,e.selection);if(f){let m=kn?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(e.doc,u,l,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=tA(e.doc,u,l,this.dom,this)),m&&!this.trackWrites&&(p=!0)}p||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&gq(this))?pi(this,p):(FA(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(o),!((r=this.dragging)===null||r===void 0)&&r.node&&!o.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,o),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():d&&KV(d)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",n=>n(this)))if(this.state.selection instanceof ge){let n=this.docView.domAfterPos(this.state.selection.from);n.nodeType==1&&KI(this,n.getBoundingClientRect(),e)}else KI(this,this.coordsAtPos(this.state.selection.head,1),e)}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let n=0;n0&&this.state.doc.nodeAt(i))==r.node&&(o=i)}this.dragging=new Ug(e.slice,e.move,o<0?void 0:ge.create(this.state.doc,o))}someProp(e,n){let r=this._props&&this._props[e],o;if(r!=null&&(o=n?n(r):r))return o;for(let s=0;sn.ownerDocument.getSelection()),this._root=n}return e||document}updateRoot(){this._root=null}posAtCoords(e){return tq(this,e)}coordsAtPos(e,n=1){return NA(this,e,n)}domAtPos(e,n=0){return this.docView.domFromPos(e,n)}nodeDOM(e){let n=this.docView.descAt(e);return n?n.nodeDOM:null}posAtDOM(e,n,r=-1){let o=this.docView.posFromDOM(e,n,r);if(o==null)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(e,n){return sq(this,n||this.state,e)}pasteHTML(e,n){return td(this,"",e,!1,n||new ClipboardEvent("paste"))}pasteText(e,n){return td(this,e,null,!0,n||new ClipboardEvent("paste"))}destroy(){this.docView&&(Mq(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Xk(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(e){return Aq(this,e)}dispatch(e){let n=this._props.dispatchTransaction;n?n.call(this,e):this.updateState(this.state.apply(e))}domSelectionRange(){return Jn&&this.root.nodeType===11&&zV(this.dom.ownerDocument)==this.dom?Xq(this):this.domSelection()}domSelection(){return this.root.getSelection()}};function xA(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",n=>{if(typeof n=="function"&&(n=n(t.state)),n)for(let r in n)r=="class"?e.class+=" "+n[r]:r=="style"?e.style=(e.style?e.style+";":"")+n[r]:!e[r]&&r!="contenteditable"&&r!="nodeName"&&(e[r]=String(n[r]))}),e.translate||(e.translate="no"),[cs.node(0,t.state.doc.content.size,e)]}function SA(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:cs.widget(t.state.selection.head,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function kA(t){return!t.someProp("editable",e=>e(t.state)===!1)}function i5(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}function bA(t){let e=Object.create(null);function n(r){for(let o in r)Object.prototype.hasOwnProperty.call(e,o)||(e[o]=r[o])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function s5(t,e){let n=0,r=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let o in e)r++;return n!=r}function EA(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var mi={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:"'"},Wg={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},a5=typeof navigator<"u"&&/Mac/.test(navigator.platform),l5=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Lt=0;Lt<10;Lt++)mi[48+Lt]=mi[96+Lt]=String(Lt);var Lt;for(Lt=1;Lt<=24;Lt++)mi[Lt+111]="F"+Lt;var Lt;for(Lt=65;Lt<=90;Lt++)mi[Lt]=String.fromCharCode(Lt+32),Wg[Lt]=String.fromCharCode(Lt);var Lt;for($g in mi)Wg.hasOwnProperty($g)||(Wg[$g]=mi[$g]);var $g;function tL(t){var e=a5&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||l5&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Wg:mi)[t.keyCode]||t.key||"Unidentified";return n=="Esc"&&(n="Escape"),n=="Del"&&(n="Delete"),n=="Left"&&(n="ArrowLeft"),n=="Up"&&(n="ArrowUp"),n=="Right"&&(n="ArrowRight"),n=="Down"&&(n="ArrowDown"),n}var u5=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function c5(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n=="Space"&&(n=" ");let r,o,i,s;for(let a=0;a127)&&(i=mi[r.keyCode])&&i!=o){let a=e[Rb(i,r)];if(a&&a(n.state,n.dispatch,n))return!0}}return!1}}var Gg=(t,e)=>t.selection.empty?!1:(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function p5(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}var Tb=(t,e,n)=>{let r=p5(t,n);if(!r)return!1;let o=oL(r);if(!o){let s=r.blockRange(),a=s&&ci(s);return a==null?!1:(e&&e(t.tr.lift(s,a).scrollIntoView()),!0)}let i=o.nodeBefore;if(!i.type.spec.isolating&&cL(t,o,e))return!0;if(r.parent.content.size==0&&(bu(i,"end")||ge.isSelectable(i))){let s=Ng(t.doc,r.before(),r.after(),ee.empty);if(s&&s.slice.size{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):r.parentOffset>0)return!1;i=oL(r)}let s=i&&i.nodeBefore;return!s||!ge.isSelectable(s)?!1:(e&&e(t.tr.setSelection(ge.create(t.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function oL(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function m5(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let r=m5(t,n);if(!r)return!1;let o=iL(r);if(!o)return!1;let i=o.nodeAfter;if(cL(t,o,e))return!0;if(r.parent.content.size==0&&(bu(i,"start")||ge.isSelectable(i))){let s=Ng(t.doc,r.before(),r.after(),ee.empty);if(s&&s.slice.size{let{$head:r,empty:o}=t.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):r.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let n=t.selection,r=n instanceof ge,o;if(r){if(n.node.isTextblock||!no(t.doc,n.from))return!1;o=n.from}else if(o=hu(t.doc,n.from,-1),o==null)return!1;if(e){let i=t.tr.join(o);r&&i.setSelection(ge.create(i.doc,o-t.doc.resolve(o).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},aL=(t,e)=>{let n=t.selection,r;if(n instanceof ge){if(n.node.isTextblock||!no(t.doc,n.to))return!1;r=n.to}else if(r=hu(t.doc,n.to,1),r==null)return!1;return e&&e(t.tr.join(r).scrollIntoView()),!0},lL=(t,e)=>{let{$from:n,$to:r}=t.selection,o=n.blockRange(r),i=o&&ci(o);return i==null?!1:(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)},Mb=(t,e)=>{let{$head:n,$anchor:r}=t.selection;return!n.parent.type.spec.code||!n.sameParent(r)?!1:(e&&e(t.tr.insertText(` +`).scrollIntoView()),!0)};function Ib(t){for(let e=0;e{let{$head:n,$anchor:r}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=Ib(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(e){let a=n.after(),l=t.tr.replaceWith(a,a,s.createAndFill());l.setSelection(Ee.near(l.doc.resolve(a),1)),e(l.scrollIntoView())}return!0},Lb=(t,e)=>{let n=t.selection,{$from:r,$to:o}=n;if(n instanceof fr||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=Ib(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!r.parentOffset&&o.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let i=n.before();if(Or(t.doc,i))return e&&e(t.tr.split(i).scrollIntoView()),!0}let r=n.blockRange(),o=r&&ci(r);return o==null?!1:(e&&e(t.tr.lift(r,o).scrollIntoView()),!0)};function h5(t){return(e,n)=>{let{$from:r,$to:o}=e.selection;if(e.selection instanceof ge&&e.selection.node.isBlock)return!r.parentOffset||!Or(e.doc,r.pos)?!1:(n&&n(e.tr.split(r.pos).scrollIntoView()),!0);if(!r.parent.isBlock)return!1;if(n){let i=o.parentOffset==o.parent.content.size,s=e.tr;(e.selection instanceof Me||e.selection instanceof fr)&&s.deleteSelection();let a=r.depth==0?null:Ib(r.node(-1).contentMatchAt(r.indexAfter(-1))),l=t&&t(o.parent,i),u=l?[l]:i&&a?[{type:a}]:void 0,c=Or(s.doc,s.mapping.map(r.pos),1,u);if(!u&&!c&&Or(s.doc,s.mapping.map(r.pos),1,a?[{type:a}]:void 0)&&(a&&(u=[{type:a}]),c=!0),c&&(s.split(s.mapping.map(r.pos),1,u),!i&&!r.parentOffset&&r.parent.type!=a)){let f=s.mapping.map(r.before()),d=s.doc.resolve(f);a&&r.node(-1).canReplaceWith(d.index(),d.index()+1,a)&&s.setNodeMarkup(s.mapping.map(r.before()),a)}n(s.scrollIntoView())}return!0}}var g5=h5();var uL=(t,e)=>{let{$from:n,to:r}=t.selection,o,i=n.sharedDepth(r);return i==0?!1:(o=n.before(i),e&&e(t.tr.setSelection(ge.create(t.doc,o))),!0)},y5=(t,e)=>(e&&e(t.tr.setSelection(new fr(t.doc))),!0);function v5(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i=e.index();return!r||!o||!r.type.compatibleContent(o.type)?!1:!r.content.size&&e.parent.canReplace(i-1,i)?(n&&n(t.tr.delete(e.pos-r.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(o.isTextblock||no(t.doc,e.pos))?!1:(n&&n(t.tr.clearIncompatible(e.pos,r.type,r.contentMatchAt(r.childCount)).join(e.pos).scrollIntoView()),!0)}function cL(t,e,n){let r=e.nodeBefore,o=e.nodeAfter,i,s;if(r.type.spec.isolating||o.type.spec.isolating)return!1;if(v5(t,e,n))return!0;let a=e.parent.canReplace(e.index(),e.index()+1);if(a&&(i=(s=r.contentMatchAt(r.childCount)).findWrapping(o.type))&&s.matchType(i[0]||o.type).validEnd){if(n){let f=e.pos+o.nodeSize,d=K.empty;for(let y=i.length-1;y>=0;y--)d=K.from(i[y].create(null,d));d=K.from(r.copy(d));let p=t.tr.step(new It(e.pos-1,f,e.pos,f,new ee(d,1,0),i.length,!0)),m=f+2*i.length;no(p.doc,m)&&p.join(m),n(p.scrollIntoView())}return!0}let l=Ee.findFrom(e,1),u=l&&l.$from.blockRange(l.$to),c=u&&ci(u);if(c!=null&&c>=e.depth)return n&&n(t.tr.lift(u,c).scrollIntoView()),!0;if(a&&bu(o,"start",!0)&&bu(r,"end")){let f=r,d=[];for(;d.push(f),!f.isTextblock;)f=f.lastChild;let p=o,m=1;for(;!p.isTextblock;p=p.firstChild)m++;if(f.canReplace(f.childCount,f.childCount,p.content)){if(n){let y=K.empty;for(let g=d.length-1;g>=0;g--)y=K.from(d[g].copy(y));let w=t.tr.step(new It(e.pos-d.length,e.pos+o.nodeSize,e.pos+m,e.pos+o.nodeSize-m,new ee(y,d.length,0),0,!0));n(w.scrollIntoView())}return!0}}return!1}function fL(t){return function(e,n){let r=e.selection,o=t<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return o.node(i).isTextblock?(n&&n(e.tr.setSelection(Me.create(e.doc,t<0?o.start(i):o.end(i)))),!0):!1}}var Fb=fL(-1),Bb=fL(1);function dL(t,e=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&mu(s,t,e);return a?(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0):!1}}function Jb(t,e=null){return function(n,r){let o=!1;for(let i=0;i{if(o)return!1;if(!(!l.isTextblock||l.hasMarkup(t,e)))if(l.type==t)o=!0;else{let c=n.doc.resolve(u),f=c.index();o=c.parent.canReplaceWith(f,f+1,t)}})}if(!o)return!1;if(r){let i=n.tr;for(let s=0;s=2&&o.node(s.depth-1).type.compatibleContent(t)&&s.startIndex==0){if(o.index(s.depth-1)==0)return!1;let c=n.doc.resolve(s.start-2);l=new ca(c,c,s.depth),s.endIndex=0;c--)i=K.from(n[c].type.create(n[c].attrs,i));t.step(new It(e.start-(r?2:0),e.end,e.start,e.end,new ee(i,0,0),n.length,!0));let s=0;for(let c=0;cs.childCount>0&&s.firstChild.type==t);return i?n?r.node(i.depth-1).type==t?S5(e,n,t,i):k5(e,n,i):!0:!1}}function S5(t,e,n,r){let o=t.tr,i=r.end,s=r.$to.end(r.depth);iy;m--)p-=o.child(m).nodeSize,r.delete(p-1,p+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let a=n.startIndex==0,l=n.endIndex==o.childCount,u=i.node(-1),c=i.index(-1);if(!u.canReplace(c+(a?0:1),c+1,s.content.append(l?K.empty:K.from(o))))return!1;let f=i.pos,d=f+s.nodeSize;return r.step(new It(f-(a?1:0),d+(l?1:0),f+1,d-1,new ee((a?K.empty:K.from(o.copy(K.empty))).append(l?K.empty:K.from(o.copy(K.empty))),a?0:1,l?0:1),a?0:1)),e(r.scrollIntoView()),!0}function hL(t){return function(e,n){let{$from:r,$to:o}=e.selection,i=r.blockRange(o,u=>u.childCount>0&&u.firstChild.type==t);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let a=i.parent,l=a.child(s-1);if(l.type!=t)return!1;if(n){let u=l.lastChild&&l.lastChild.type==a.type,c=K.from(u?t.create():null),f=new ee(K.from(t.create(null,K.from(a.type.create(null,c)))),u?3:1,0),d=i.start,p=i.end;n(e.tr.step(new It(d-(u?3:1),p,d,p,f,1,!0)).scrollIntoView())}return!0}}function Zg(t){let{state:e,transaction:n}=t,{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),filterTransaction:e.filterTransaction,plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var Eu=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:n,state:r}=this,{view:o}=n,{tr:i}=r,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([a,l])=>[a,(...c)=>{let f=l(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a=[],l=!!e,u=e||i.tr,c=()=>(!l&&n&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),a.every(d=>d===!0)),f={...Object.fromEntries(Object.entries(r).map(([d,p])=>[d,(...y)=>{let w=this.buildProps(u,n),g=p(...y)(w);return a.push(g),f}])),run:c};return f}createCan(e){let{rawCommands:n,state:r}=this,o=!1,i=e||r.tr,s=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(n).map(([l,u])=>[l,(...c)=>u(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,o)}}buildProps(e,n=!0){let{rawCommands:r,editor:o,state:i}=this,{view:s}=o,a={tr:e,editor:o,view:s,state:Zg({state:i,transaction:e}),dispatch:n?()=>{}:void 0,chain:()=>this.createChain(e,n),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(r).map(([l,u])=>[l,(...c)=>u(...c)(a)]))}};return a}},Hb=class{constructor(){this.callbacks={}}on(e,n){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(n),this}emit(e,...n){let r=this.callbacks[e];return r&&r.forEach(o=>o.apply(this,n)),this}off(e,n){let r=this.callbacks[e];return r&&(n?this.callbacks[e]=r.filter(o=>o!==n):delete this.callbacks[e]),this}removeAllListeners(){this.callbacks={}}};function ae(t,e,n){return t.config[e]===void 0&&t.parent?ae(t.parent,e,n):typeof t.config[e]=="function"?t.config[e].bind({...n,parent:t.parent?ae(t.parent,e,n):null}):t.config[e]}function ey(t){let e=t.filter(o=>o.type==="extension"),n=t.filter(o=>o.type==="node"),r=t.filter(o=>o.type==="mark");return{baseExtensions:e,nodeExtensions:n,markExtensions:r}}function bL(t){let e=[],{nodeExtensions:n,markExtensions:r}=ey(t),o=[...n,...r],i={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=ae(s,"addGlobalAttributes",a);if(!l)return;l().forEach(c=>{c.types.forEach(f=>{Object.entries(c.attributes).forEach(([d,p])=>{e.push({type:f,name:d,attribute:{...i,...p}})})})})}),o.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=ae(s,"addAttributes",a);if(!l)return;let u=l();Object.entries(u).forEach(([c,f])=>{let d={...i,...f};typeof d?.default=="function"&&(d.default=d.default()),d?.isRequired&&d?.default===void 0&&delete d.default,e.push({type:s.name,name:c,attribute:d})})}),e}function $t(t,e){if(typeof t=="string"){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function Wt(...t){return t.filter(e=>!!e).reduce((e,n)=>{let r={...e};return Object.entries(n).forEach(([o,i])=>{if(!r[o]){r[o]=i;return}if(o==="class"){let a=i?i.split(" "):[],l=r[o]?r[o].split(" "):[],u=a.filter(c=>!l.includes(c));r[o]=[...l,...u].join(" ")}else o==="style"?r[o]=[r[o],i].join("; "):r[o]=i}),r},{})}function $b(t,e){return e.filter(n=>n.attribute.rendered).map(n=>n.attribute.renderHTML?n.attribute.renderHTML(t.attrs)||{}:{[n.name]:t.attrs[n.name]}).reduce((n,r)=>Wt(n,r),{})}function EL(t){return typeof t=="function"}function Ie(t,e=void 0,...n){return EL(t)?e?t.bind(e)(...n):t(...n):t}function b5(t={}){return Object.keys(t).length===0&&t.constructor===Object}function E5(t){return typeof t!="string"?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):t==="true"?!0:t==="false"?!1:t}function gL(t,e){return t.style?t:{...t,getAttrs:n=>{let r=t.getAttrs?t.getAttrs(n):t.attrs;if(r===!1)return!1;let o=e.reduce((i,s)=>{let a=s.attribute.parseHTML?s.attribute.parseHTML(n):E5(n.getAttribute(s.name));return a==null?i:{...i,[s.name]:a}},{});return{...r,...o}}}}function yL(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>e==="attrs"&&b5(n)?!1:n!=null))}function R5(t,e){var n;let r=bL(t),{nodeExtensions:o,markExtensions:i}=ey(t),s=(n=o.find(u=>ae(u,"topNode")))===null||n===void 0?void 0:n.name,a=Object.fromEntries(o.map(u=>{let c=r.filter(g=>g.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((g,v)=>{let k=ae(v,"extendNodeSchema",f);return{...g,...k?k(u):{}}},{}),p=yL({...d,content:Ie(ae(u,"content",f)),marks:Ie(ae(u,"marks",f)),group:Ie(ae(u,"group",f)),inline:Ie(ae(u,"inline",f)),atom:Ie(ae(u,"atom",f)),selectable:Ie(ae(u,"selectable",f)),draggable:Ie(ae(u,"draggable",f)),code:Ie(ae(u,"code",f)),defining:Ie(ae(u,"defining",f)),isolating:Ie(ae(u,"isolating",f)),attrs:Object.fromEntries(c.map(g=>{var v;return[g.name,{default:(v=g?.attribute)===null||v===void 0?void 0:v.default}]}))}),m=Ie(ae(u,"parseHTML",f));m&&(p.parseDOM=m.map(g=>gL(g,c)));let y=ae(u,"renderHTML",f);y&&(p.toDOM=g=>y({node:g,HTMLAttributes:$b(g,c)}));let w=ae(u,"renderText",f);return w&&(p.toText=w),[u.name,p]})),l=Object.fromEntries(i.map(u=>{let c=r.filter(w=>w.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},d=t.reduce((w,g)=>{let v=ae(g,"extendMarkSchema",f);return{...w,...v?v(u):{}}},{}),p=yL({...d,inclusive:Ie(ae(u,"inclusive",f)),excludes:Ie(ae(u,"excludes",f)),group:Ie(ae(u,"group",f)),spanning:Ie(ae(u,"spanning",f)),code:Ie(ae(u,"code",f)),attrs:Object.fromEntries(c.map(w=>{var g;return[w.name,{default:(g=w?.attribute)===null||g===void 0?void 0:g.default}]}))}),m=Ie(ae(u,"parseHTML",f));m&&(p.parseDOM=m.map(w=>gL(w,c)));let y=ae(u,"renderHTML",f);return y&&(p.toDOM=w=>y({mark:w,HTMLAttributes:$b(w,c)})),[u.name,p]}));return new bg({topNode:s,nodes:a,marks:l})}function _b(t,e){return e.nodes[t]||e.marks[t]||null}function vL(t,e){return Array.isArray(e)?e.some(n=>(typeof n=="string"?n:n.name)===t.name):e}var C5=(t,e=500)=>{let n="",r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(o,i,s,a)=>{var l,u;let c=((u=(l=o.type.spec).toText)===null||u===void 0?void 0:u.call(l,{node:o,pos:i,parent:s,index:a}))||o.textContent||"%leaf%";n+=c.slice(0,Math.max(0,r-i))}),n};function Yb(t){return Object.prototype.toString.call(t)==="[object RegExp]"}var Ru=class{constructor(e){this.find=e.find,this.handler=e.handler}},T5=(t,e)=>{if(Yb(e))return e.exec(t);let n=e(t);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=t,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function zb(t){var e;let{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;let u=l.state.doc.resolve(r);if(u.parent.type.spec.code||!((e=u.nodeBefore||u.nodeAfter)===null||e===void 0)&&e.marks.find(d=>d.type.spec.code))return!1;let c=!1,f=C5(u)+i;return s.forEach(d=>{if(c)return;let p=T5(f,d.find);if(!p)return;let m=l.state.tr,y=Zg({state:l.state,transaction:m}),w={from:r-(p[0].length-i.length),to:o},{commands:g,chain:v,can:k}=new Eu({editor:n,state:y});d.handler({state:y,range:w,match:p,commands:g,chain:v,can:k})===null||!m.steps.length||(m.setMeta(a,{transform:m,from:r,to:o,text:i}),l.dispatch(m),c=!0)}),c}function P5(t){let{editor:e,rules:n}=t,r=new At({state:{init(){return null},apply(o,i){let s=o.getMeta(r);return s||(o.selectionSet||o.docChanged?null:i)}},props:{handleTextInput(o,i,s,a){return zb({editor:e,from:i,to:s,text:a,rules:n,plugin:r})},handleDOMEvents:{compositionend:o=>(setTimeout(()=>{let{$cursor:i}=o.state.selection;i&&zb({editor:e,from:i.pos,to:i.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(o,i){if(i.key!=="Enter")return!1;let{$cursor:s}=o.state.selection;return s?zb({editor:e,from:s.pos,to:s.pos,text:` +`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}function O5(t){return typeof t=="number"}var od=class{constructor(e){this.find=e.find,this.handler=e.handler}},N5=(t,e)=>{if(Yb(e))return[...t.matchAll(e)];let n=e(t);return n?n.map(r=>{let o=[r.text];return o.index=r.index,o.input=t,o.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(r.replaceWith)),o}):[]};function M5(t){let{editor:e,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:u,can:c}=new Eu({editor:e,state:n}),f=[];return n.doc.nodesBetween(r,o,(p,m)=>{if(!p.isTextblock||p.type.spec.code)return;let y=Math.max(r,m),w=Math.min(o,m+p.content.size),g=p.textBetween(y-m,w-m,void 0,"\uFFFC");N5(g,i.find).forEach(k=>{if(k.index===void 0)return;let S=y+k.index+1,b=S+k[0].length,x={from:n.tr.mapping.map(S),to:n.tr.mapping.map(b)},R=i.handler({state:n,range:x,match:k,commands:l,chain:u,can:c,pasteEvent:s,dropEvent:a});f.push(R)})}),f.every(p=>p!==null)}function I5(t){let{editor:e,rules:n}=t,r=null,o=!1,i=!1,s=new ClipboardEvent("paste"),a=new DragEvent("drop");return n.map(u=>new At({view(c){let f=d=>{var p;r=!((p=c.dom.parentElement)===null||p===void 0)&&p.contains(d.target)?c.dom.parentElement:null};return window.addEventListener("dragstart",f),{destroy(){window.removeEventListener("dragstart",f)}}},props:{handleDOMEvents:{drop:(c,f)=>(i=r===c.dom.parentElement,a=f,!1),paste:(c,f)=>{var d;let p=(d=f.clipboardData)===null||d===void 0?void 0:d.getData("text/html");return s=f,o=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(c,f,d)=>{let p=c[0],m=p.getMeta("uiEvent")==="paste"&&!o,y=p.getMeta("uiEvent")==="drop"&&!i;if(!m&&!y)return;let w=f.doc.content.findDiffStart(d.doc.content),g=f.doc.content.findDiffEnd(d.doc.content);if(!O5(w)||!g||w===g.b)return;let v=d.tr,k=Zg({state:d,transaction:v});if(!(!M5({editor:e,state:k,from:Math.max(w-1,0),to:g.b-1,rule:u,pasteEvent:s,dropEvent:a})||!v.steps.length))return a=new DragEvent("drop"),s=new ClipboardEvent("paste"),v}}))}function A5(t){let e=t.filter((n,r)=>t.indexOf(n)!==r);return[...new Set(e)]}var Wb=class t{constructor(e,n){this.splittableMarks=[],this.editor=n,this.extensions=t.resolve(e),this.schema=R5(this.extensions,n),this.extensions.forEach(r=>{var o;this.editor.extensionStorage[r.name]=r.storage;let i={name:r.name,options:r.options,storage:r.storage,editor:this.editor,type:_b(r.name,this.schema)};r.type==="mark"&&(!((o=Ie(ae(r,"keepOnSplit",i)))!==null&&o!==void 0)||o)&&this.splittableMarks.push(r.name);let s=ae(r,"onBeforeCreate",i);s&&this.editor.on("beforeCreate",s);let a=ae(r,"onCreate",i);a&&this.editor.on("create",a);let l=ae(r,"onUpdate",i);l&&this.editor.on("update",l);let u=ae(r,"onSelectionUpdate",i);u&&this.editor.on("selectionUpdate",u);let c=ae(r,"onTransaction",i);c&&this.editor.on("transaction",c);let f=ae(r,"onFocus",i);f&&this.editor.on("focus",f);let d=ae(r,"onBlur",i);d&&this.editor.on("blur",d);let p=ae(r,"onDestroy",i);p&&this.editor.on("destroy",p)})}static resolve(e){let n=t.sort(t.flatten(e)),r=A5(n.map(o=>o.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),n}static flatten(e){return e.map(n=>{let r={name:n.name,options:n.options,storage:n.storage},o=ae(n,"addExtensions",r);return o?[n,...this.flatten(o())]:n}).flat(10)}static sort(e){return e.sort((r,o)=>{let i=ae(r,"priority")||100,s=ae(o,"priority")||100;return i>s?-1:i{let r={name:n.name,options:n.options,storage:n.storage,editor:this.editor,type:_b(n.name,this.schema)},o=ae(n,"addCommands",r);return o?{...e,...o()}:e},{})}get plugins(){let{editor:e}=this,n=t.sort([...this.extensions].reverse()),r=[],o=[],i=n.map(s=>{let a={name:s.name,options:s.options,storage:s.storage,editor:e,type:_b(s.name,this.schema)},l=[],u=ae(s,"addKeyboardShortcuts",a),c={};if(s.type==="mark"&&s.config.exitable&&(c.ArrowRight=()=>dr.handleExit({editor:e,mark:s})),u){let y=Object.fromEntries(Object.entries(u()).map(([w,g])=>[w,()=>g({editor:e})]));c={...c,...y}}let f=nL(c);l.push(f);let d=ae(s,"addInputRules",a);vL(s,e.options.enableInputRules)&&d&&r.push(...d());let p=ae(s,"addPasteRules",a);vL(s,e.options.enablePasteRules)&&p&&o.push(...p());let m=ae(s,"addProseMirrorPlugins",a);if(m){let y=m();l.push(...y)}return l}).flat();return[P5({editor:e,rules:r}),...I5({editor:e,rules:o}),...i]}get attributes(){return bL(this.extensions)}get nodeViews(){let{editor:e}=this,{nodeExtensions:n}=ey(this.extensions);return Object.fromEntries(n.filter(r=>!!ae(r,"addNodeView")).map(r=>{let o=this.attributes.filter(l=>l.type===r.name),i={name:r.name,options:r.options,storage:r.storage,editor:e,type:$t(r.name,this.schema)},s=ae(r,"addNodeView",i);if(!s)return[];let a=(l,u,c,f)=>{let d=$b(l,o);return s()({editor:e,node:l,getPos:c,decorations:f,HTMLAttributes:d,extension:r})};return[r.name,a]}))}};function L5(t){return Object.prototype.toString.call(t).slice(8,-1)}function Vb(t){return L5(t)!=="Object"?!1:t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function ty(t,e){let n={...t};return Vb(t)&&Vb(e)&&Object.keys(e).forEach(r=>{Vb(e[r])?r in t?n[r]=ty(t[r],e[r]):Object.assign(n,{[r]:e[r]}):Object.assign(n,{[r]:e[r]})}),n}var Ar=class t{constructor(e={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(ae(this,"addOptions",{name:this.name}))),this.storage=Ie(ae(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=ty(this.options,e),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ie(ae(n,"addOptions",{name:n.name})),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}};function RL(t,e,n){let{from:r,to:o}=e,{blockSeparator:i=` -`,textSerializers:s={}}=n||{},a="",l=!0;return t.nodesBetween(r,o,(u,c,f,d)=>{var p;let m=s?.[u.type.name];m?(u.isBlock&&!l&&(a+=i,l=!0),f&&(a+=m({node:u,pos:c,parent:f,index:d,range:e}))):u.isText?(a+=(p=u?.text)===null||p===void 0?void 0:p.slice(Math.max(r,c)-c,o-c),l=!1):u.isBlock&&!l&&(a+=i,l=!0)}),a}function SL(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var G5=Mr.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new At({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(c=>c.$from.pos)),a=Math.max(...i.map(c=>c.$to.pos)),l=SL(n);return xL(r,{from:s,to:a},{textSerializers:l})}}})]}}),K5=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),Y5=(t=!1)=>({commands:e})=>e.setContent("",t),X5=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;let{doc:u,mapping:c}=e,f=u.resolve(c.map(l)),d=u.resolve(c.map(l+a.nodeSize)),p=f.blockRange(d);if(!p)return;let m=ui(p);if(a.type.isTextblock){let{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,y)}(m||m===0)&&e.lift(p,m)})}),!0},Q5=t=>e=>t(e),Z5=()=>({state:t,dispatch:e})=>Jb(t,e),ej=(t,e)=>({editor:n,tr:r})=>{let{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new Me(r.doc.resolve(s-1))),!0},tj=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let a=o.before(i),l=o.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1},nj=t=>({tr:e,state:n,dispatch:r})=>{let o=Ht(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let l=i.before(s),u=i.after(s);e.delete(l,u).scrollIntoView()}return!0}return!1},rj=t=>({tr:e,dispatch:n})=>{let{from:r,to:o}=t;return n&&e.delete(r,o),!0},oj=()=>({state:t,dispatch:e})=>Hg(t,e),ij=()=>({commands:t})=>t.keyboardShortcut("Enter"),sj=()=>({state:t,dispatch:e})=>Bb(t,e);function Wg(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:e1(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Qb(t,e,n={}){return t.find(r=>r.type===e&&Wg(r.attrs,n))}function aj(t,e,n={}){return!!Qb(t,e,n)}function t1(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;let o=Qb([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(Qb([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a({tr:n,state:r,dispatch:o})=>{let i=ds(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(o){let f=t1(l,i,e);if(f&&f.from<=u&&f.to>=c){let d=Me.create(s,f.from,f.to);n.setSelection(d)}}return!0},uj=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};let s=()=>{n1()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!Zg(n.state.selection))return s(),!0;let a=kL(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},fj=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),dj=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e);function mL(t){let e=`${t}`;return new window.DOMParser().parseFromString(e,"text/html").body}function Gg(t,e,n){if(n={slice:!0,parseOptions:{},...n},typeof t=="object"&&t!==null)try{return Array.isArray(t)&&t.length>0?K.fromArray(t.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),Gg("",e,n)}if(typeof t=="string"){let r=ua.fromSchema(e);return n.slice?r.parseSlice(mL(t),n.parseOptions).content:r.parse(mL(t),n.parseOptions)}return Gg("",e,n)}function pj(t,e,n){let r=t.steps.length-1;if(r{s===0&&(s=c)}),t.setSelection(Ee.near(t.doc.resolve(s),n))}var mj=t=>t.toString().startsWith("<"),hj=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,...n};let s=Gg(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},u=!0,c=!0;if((mj(s)?s:[s]).forEach(d=>{d.check(),u=u?d.isText&&d.marks.length===0:!1,c=c?d.isBlock:!1}),a===l&&c){let{parent:d}=r.doc.resolve(a);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(a-=1,l+=1)}u?Array.isArray(e)?r.insertText(e.map(d=>d.text||"").join(""),a,l):typeof e=="object"&&e&&e.text?r.insertText(e.text,a,l):r.insertText(e,a,l):r.replaceWith(a,l,s),n.updateSelection&&pj(r,r.steps.length-1,-1)}return!0},gj=()=>({state:t,dispatch:e})=>tL(t,e),yj=()=>({state:t,dispatch:e})=>nL(t,e),vj=()=>({state:t,dispatch:e})=>Mb(t,e),wj=()=>({state:t,dispatch:e})=>Ab(t,e),xj=()=>({tr:t,state:e,dispatch:n})=>{try{let r=bu(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},Sj=()=>({state:t,dispatch:e,tr:n})=>{try{let r=bu(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}};function ey(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function kj(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a({editor:e,view:n,tr:r,dispatch:o})=>{let i=kj(t).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l?.steps.forEach(u=>{let c=u.map(r.mapping);c&&o&&r.maybeStep(c)}),!0};function id(t,e,n={}){let{from:r,to:o,empty:i}=t.selection,s=e?Ht(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(f,d)=>{if(f.isText)return;let p=Math.max(r,d),m=Math.min(o,d+f.nodeSize);a.push({node:f,from:p,to:m})});let l=o-r,u=a.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Wg(f.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((f,d)=>f+d.to-d.from,0)>=l}var Ej=(t,e={})=>({state:n,dispatch:r})=>{let o=Ht(t,n.schema);return id(n,o,e)?rL(n,r):!1},Rj=()=>({state:t,dispatch:e})=>Ub(t,e),Cj=t=>({state:e,dispatch:n})=>{let r=Ht(t,e.schema);return uL(r)(e,n)},Tj=()=>({state:t,dispatch:e})=>Db(t,e);function ty(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function hL(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var Pj=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,a=ty(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=Ht(t,r.schema)),a==="mark"&&(s=ds(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{i&&i===u.type&&n.setNodeMarkup(c,void 0,hL(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&n.addMark(c,c+u.nodeSize,s.create(hL(f.attrs,e)))})})}),!0):!1},Oj=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),Nj=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),Mj=()=>({state:t,dispatch:e})=>Ib(t,e),Ij=()=>({state:t,dispatch:e})=>Lb(t,e),Aj=()=>({state:t,dispatch:e})=>oL(t,e),Lj=()=>({state:t,dispatch:e})=>zb(t,e),Dj=()=>({state:t,dispatch:e})=>_b(t,e);function bL(t,e,n={}){return Gg(t,e,{slice:!1,parseOptions:n})}var Fj=(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{let{doc:s}=r,a=bL(t,o.schema,n);return i&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!e),!0};function ny(t,e){let n=ds(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,l=>{s.push(...l.marks)});let a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function EL(t,e){let n=new Su(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Bj(t){for(let e=0;e{n(o)&&r.push({node:o,pos:i})}),r}function Jj(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function r1(t){return e=>Jj(e.$from,t)}function Uj(t,e){let n=ai.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function _j(t,e){let n={from:0,to:t.content.size};return xL(t,n,e)}function zj(t,e){let n=Ht(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,a=>{i.push(a)});let s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function o1(t,e){let n=ty(typeof e=="string"?e:e.name,t.schema);return n==="node"?zj(t,e):n==="mark"?ny(t,e):{}}function Vj(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function qj(t){let e=Vj(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function CL(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((a,l)=>{s.push({from:a,to:l})});else{let{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{let u=e.slice(i).map(a,-1),c=e.slice(i).map(l),f=e.invert().map(u,-1),d=e.invert().map(c);r.push({oldRange:{from:f,to:d},newRange:{from:u,to:c}})})}),qj(r)}function ry(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=n.resolve(t-1),s=t1(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function $g(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function Zb(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?ds(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Wg(f.attrs,n,{strict:!1}));let s=0,a=[];if(o.forEach(({$from:f,$to:d})=>{let p=f.pos,m=d.pos;t.doc.nodesBetween(p,m,(y,w)=>{if(!y.isText&&!y.marks.length)return;let g=Math.max(p,w),v=Math.min(m,w+y.nodeSize),k=v-g;s+=k,a.push(...y.marks.map(S=>({mark:S,from:g,to:v})))})}),s===0)return!1;let l=a.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Wg(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),u=a.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,d)=>f+d.to-d.from,0);return(l>0?l+u:l)>=s}function jj(t,e,n={}){if(!e)return id(t,null,n)||Zb(t,null,n);let r=ty(e,t.schema);return r==="node"?id(t,e,n):r==="mark"?Zb(t,e,n):!1}function gL(t,e){let{nodeExtensions:n}=Xg(e),r=n.find(s=>s.name===t);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},i=Ie(ae(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Hj(t){var e;let n=(e=t.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function TL(t){return t instanceof he}function PL(t,e,n){let o=t.state.doc.content.size,i=mi(e,0,o),s=mi(n,0,o),a=t.coordsAtPos(i),l=t.coordsAtPos(s,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),f=Math.min(a.left,l.left),d=Math.max(a.right,l.right),p=d-f,m=c-u,g={top:u,bottom:c,left:f,right:d,width:p,height:m,x:f,y:u};return{...g,toJSON:()=>g}}function $j(t,e,n){var r;let{selection:o}=e,i=null;if(Zg(o)&&(i=o.$cursor),i){let a=(r=t.storedMarks)!==null&&r!==void 0?r:i.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}let{ranges:s}=o;return s.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,f,d)=>{if(u)return!1;if(c.isInline){let p=!d||d.type.allowsMarkType(n),m=!!n.isInSet(c.marks)||!c.marks.some(y=>y.type.excludes(n));u=p&&m}return!u}),u})}var Wj=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:s,ranges:a}=i,l=ds(t,r.schema);if(o)if(s){let u=ny(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{let c=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(c,f,(d,p)=>{let m=Math.max(p,c),y=Math.min(p+d.nodeSize,f);d.marks.find(g=>g.type===l)?d.marks.forEach(g=>{l===g.type&&n.addMark(m,y,l.create({...g.attrs,...e}))}):n.addMark(m,y,l.create(e))})});return $j(r,n,l)},Gj=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Kj=(t,e={})=>({state:n,dispatch:r,chain:o})=>{let i=Ht(t,n.schema);return i.isTextblock?o().command(({commands:s})=>Vb(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>Vb(i,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Yj=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,o=mi(t,0,r.content.size),i=he.create(r,o);e.setSelection(i)}return!0},Xj=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Me.atStart(r).from,a=Me.atEnd(r).to,l=mi(o,s,a),u=mi(i,s,a),c=Me.create(r,l,u);e.setSelection(c)}return!0},Qj=t=>({state:e,dispatch:n})=>{let r=Ht(t,e.schema);return cL(r)(e,n)};function yL(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var Zj=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:a,$to:l}=i,u=o.extensionManager.attributes,c=$g(u,a.node().type.name,a.node().attrs);if(i instanceof he&&i.node.isBlock)return!a.parentOffset||!Tr(s,a.pos)?!1:(r&&(t&&yL(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){let f=l.parentOffset===l.parent.content.size;i instanceof Me&&e.deleteSelection();let d=a.depth===0?void 0:Bj(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=f&&d?[{type:d,attrs:c}]:void 0,m=Tr(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Tr(e.doc,e.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(m=!0,p=d?[{type:d,attrs:c}]:void 0),m&&(e.split(e.mapping.map(a.pos),1,p),d&&!f&&!a.parentOffset&&a.parent.type!==d)){let y=e.mapping.map(a.before()),w=e.doc.resolve(y);a.node(-1).canReplaceWith(w.index(),w.index()+1,d)&&e.setNodeMarkup(e.mapping.map(a.before()),d)}t&&yL(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},e6=t=>({tr:e,state:n,dispatch:r,editor:o})=>{var i;let s=Ht(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;let c=a.node(-1);if(c.type!==s)return!1;let f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let w=K.empty,g=a.index(-1)?1:a.index(-2)?2:3;for(let T=a.depth-g;T>=a.depth-3;T-=1)w=K.from(a.node(T).copy(w));let v=a.indexAfter(-1){if(x>-1)return!1;T.isTextblock&&T.content.size===0&&(x=E+1)}),x>-1&&e.setSelection(Me.near(e.doc.resolve(x))),e.scrollIntoView()}return!0}let d=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,p=$g(f,c.type.name,c.attrs),m=$g(f,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);let y=d?[{type:s,attrs:p},{type:d,attrs:m}]:[{type:s,attrs:p}];if(!Tr(e.doc,a.pos,2))return!1;if(r){let{selection:w,storedMarks:g}=n,{splittableMarks:v}=o.extensionManager,k=g||w.$to.parentOffset&&w.$from.marks();if(e.split(a.pos,2,y).scrollIntoView(),!k||!r)return!0;let S=k.filter(b=>v.includes(b.type.name));e.ensureMarks(S)}return!0},Wb=(t,e)=>{let n=r1(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return n.node.type===o?.type&&eo(t.doc,n.pos)&&t.join(n.pos),!0},Gb=(t,e)=>{let n=r1(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return n.node.type===o?.type&&eo(t.doc,r)&&t.join(r),!0},t6=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:u,can:c})=>{let{extensions:f,splittableMarks:d}=o.extensionManager,p=Ht(t,s.schema),m=Ht(e,s.schema),{selection:y,storedMarks:w}=s,{$from:g,$to:v}=y,k=g.blockRange(v),S=w||y.$to.parentOffset&&y.$from.marks();if(!k)return!1;let b=r1(x=>gL(x.type.name,f))(y);if(k.depth>=1&&b&&k.depth-b.depth<=1){if(b.node.type===p)return u.liftListItem(m);if(gL(b.node.type.name,f)&&p.validContent(b.node.content)&&a)return l().command(()=>(i.setNodeMarkup(b.pos,p),!0)).command(()=>Wb(i,p)).command(()=>Gb(i,p)).run()}return!n||!S||!a?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>Wb(i,p)).command(()=>Gb(i,p)).run():l().command(()=>{let x=c().wrapInList(p,r),T=S.filter(E=>d.includes(E.type.name));return i.ensureMarks(T),x?!0:u.clearNodes()}).wrapInList(p,r).command(()=>Wb(i,p)).command(()=>Gb(i,p)).run()},n6=(t,e={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,s=ds(t,r.schema);return Zb(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},r6=(t,e,n={})=>({state:r,commands:o})=>{let i=Ht(t,r.schema),s=Ht(e,r.schema);return id(r,i,n)?o.setNode(s):o.setNode(i,n)},o6=(t,e={})=>({state:n,commands:r})=>{let o=Ht(t,n.schema);return id(n,o,e)?r.lift(o):r.wrapIn(o,e)},i6=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1},s6=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},a6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=ds(t,r.schema),{$from:u,empty:c,ranges:f}=a;if(!o)return!0;if(c&&s){let{from:d,to:p}=a,m=(i=u.marks().find(w=>w.type===l))===null||i===void 0?void 0:i.attrs,y=t1(u,l,m);y&&(d=y.from,p=y.to),n.removeMark(d,p,l)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,l)});return n.removeStoredMark(l),!0},l6=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,a=ty(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=Ht(t,r.schema)),a==="mark"&&(s=ds(t,r.schema)),o&&n.selection.ranges.forEach(l=>{let u=l.$from.pos,c=l.$to.pos;r.doc.nodesBetween(u,c,(f,d)=>{i&&i===f.type&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(p=>{if(s===p.type){let m=Math.max(d,u),y=Math.min(d+f.nodeSize,c);n.addMark(m,y,s.create({...p.attrs,...e}))}})})}),!0):!1},u6=(t,e={})=>({state:n,dispatch:r})=>{let o=Ht(t,n.schema);return aL(o,e)(n,r)},c6=(t,e={})=>({state:n,dispatch:r})=>{let o=Ht(t,n.schema);return lL(o,e)(n,r)},f6=Object.freeze({__proto__:null,blur:K5,clearContent:Y5,clearNodes:X5,command:Q5,createParagraphNear:Z5,cut:ej,deleteCurrentNode:tj,deleteNode:nj,deleteRange:rj,deleteSelection:oj,enter:ij,exitCode:sj,extendMarkRange:lj,first:uj,focus:cj,forEach:fj,insertContent:dj,insertContentAt:hj,joinUp:gj,joinDown:yj,joinBackward:vj,joinForward:wj,joinItemBackward:xj,joinItemForward:Sj,keyboardShortcut:bj,lift:Ej,liftEmptyBlock:Rj,liftListItem:Cj,newlineInCode:Tj,resetAttributes:Pj,scrollIntoView:Oj,selectAll:Nj,selectNodeBackward:Mj,selectNodeForward:Ij,selectParentNode:Aj,selectTextblockEnd:Lj,selectTextblockStart:Dj,setContent:Fj,setMark:Wj,setMeta:Gj,setNode:Kj,setNodeSelection:Yj,setTextSelection:Xj,sinkListItem:Qj,splitBlock:Zj,splitListItem:e6,toggleList:t6,toggleMark:n6,toggleNode:r6,toggleWrap:o6,undoInputRule:i6,unsetAllMarks:s6,unsetMark:a6,updateAttributes:l6,wrapIn:u6,wrapInList:c6}),d6=Mr.create({name:"commands",addCommands(){return{...f6}}}),p6=Mr.create({name:"editable",addProseMirrorPlugins(){return[new At({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),m6=Mr.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new At({key:new an("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),h6=Mr.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{let{selection:l,doc:u}=a,{empty:c,$anchor:f}=l,{pos:d,parent:p}=f,m=f.parent.isTextblock?a.doc.resolve(d-1):f,y=m.parent.type.spec.isolating,w=f.pos-f.parentOffset,g=y&&m.parent.childCount===1?w===f.pos:Ee.atStart(u).from===d;return!c||!g||!p.type.isTextblock||p.textContent.length?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return n1()||ey()?i:o},addProseMirrorPlugins(){return[new At({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(m=>m.docChanged)&&!e.doc.eq(n.doc)))return;let{empty:o,from:i,to:s}=e.selection,a=Ee.atStart(e.doc).from,l=Ee.atEnd(e.doc).to;if(o||!(i===a&&s===l)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;let f=n.tr,d=Yg({state:n,transaction:f}),{commands:p}=new Iu({editor:this.editor,state:d});if(p.clearNodes(),!!f.steps.length)return f}})]}}),g6=Mr.create({name:"tabindex",addProseMirrorPlugins(){return[new At({key:new an("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}}),y6=Object.freeze({__proto__:null,ClipboardTextSerializer:G5,Commands:d6,Editable:p6,FocusEvents:m6,Keymap:h6,Tabindex:g6}),v6=`.ProseMirror { +`,textSerializers:s={}}=n||{},a="",l=!0;return t.nodesBetween(r,o,(u,c,f,d)=>{var p;let m=s?.[u.type.name];m?(u.isBlock&&!l&&(a+=i,l=!0),f&&(a+=m({node:u,pos:c,parent:f,index:d,range:e}))):u.isText?(a+=(p=u?.text)===null||p===void 0?void 0:p.slice(Math.max(r,c)-c,o-c),l=!1):u.isBlock&&!l&&(a+=i,l=!0)}),a}function CL(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,e])=>e.spec.toText).map(([e,n])=>[e,n.spec.toText]))}var D5=Ar.create({name:"clipboardTextSerializer",addProseMirrorPlugins(){return[new At({key:new an("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:i}=o,s=Math.min(...i.map(c=>c.$from.pos)),a=Math.max(...i.map(c=>c.$to.pos)),l=CL(n);return RL(r,{from:s,to:a},{textSerializers:l})}}})]}}),F5=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),(n=window?.getSelection())===null||n===void 0||n.removeAllRanges())}),!0),B5=(t=!1)=>({commands:e})=>e.setContent("",t),J5=()=>({state:t,tr:e,dispatch:n})=>{let{selection:r}=e,{ranges:o}=r;return n&&o.forEach(({$from:i,$to:s})=>{t.doc.nodesBetween(i.pos,s.pos,(a,l)=>{if(a.type.isText)return;let{doc:u,mapping:c}=e,f=u.resolve(c.map(l)),d=u.resolve(c.map(l+a.nodeSize)),p=f.blockRange(d);if(!p)return;let m=ci(p);if(a.type.isTextblock){let{defaultType:y}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(p.start,y)}(m||m===0)&&e.lift(p,m)})}),!0},U5=t=>e=>t(e),_5=()=>({state:t,dispatch:e})=>Lb(t,e),z5=(t,e)=>({editor:n,tr:r})=>{let{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);let s=r.mapping.map(e);return r.insert(s,i.content),r.setSelection(new Me(r.doc.resolve(s-1))),!0},V5=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;let o=t.selection.$anchor;for(let i=o.depth;i>0;i-=1)if(o.node(i).type===r.type){if(e){let a=o.before(i),l=o.after(i);t.delete(a,l).scrollIntoView()}return!0}return!1},q5=t=>({tr:e,state:n,dispatch:r})=>{let o=$t(t,n.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===o){if(r){let l=i.before(s),u=i.after(s);e.delete(l,u).scrollIntoView()}return!0}return!1},j5=t=>({tr:e,dispatch:n})=>{let{from:r,to:o}=t;return n&&e.delete(r,o),!0},H5=()=>({state:t,dispatch:e})=>Gg(t,e),$5=()=>({commands:t})=>t.keyboardShortcut("Enter"),W5=()=>({state:t,dispatch:e})=>Ab(t,e);function Yg(t,e,n={strict:!0}){let r=Object.keys(e);return r.length?r.every(o=>n.strict?e[o]===t[o]:Yb(e[o])?e[o].test(t[o]):e[o]===t[o]):!0}function Gb(t,e,n={}){return t.find(r=>r.type===e&&Yg(r.attrs,n))}function G5(t,e,n={}){return!!Gb(t,e,n)}function Xb(t,e,n={}){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(t.parentOffset===r.offset&&r.offset!==0&&(r=t.parent.childBefore(t.parentOffset)),!r.node)return;let o=Gb([...r.node.marks],e,n);if(!o)return;let i=r.index,s=t.start()+r.offset,a=i+1,l=s+r.node.nodeSize;for(Gb([...r.node.marks],e,n);i>0&&o.isInSet(t.parent.child(i-1).marks);)i-=1,s-=t.parent.child(i).nodeSize;for(;a({tr:n,state:r,dispatch:o})=>{let i=ps(t,r.schema),{doc:s,selection:a}=n,{$from:l,from:u,to:c}=a;if(o){let f=Xb(l,i,e);if(f&&f.from<=u&&f.to>=c){let d=Me.create(s,f.from,f.to);n.setSelection(d)}}return!0},Y5=t=>e=>{let n=typeof t=="function"?t(e):t;for(let r=0;r({editor:n,view:r,tr:o,dispatch:i})=>{e={scrollIntoView:!0,...e};let s=()=>{Qb()&&r.dom.focus(),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),e?.scrollIntoView&&n.commands.scrollIntoView())})};if(r.hasFocus()&&t===null||t===!1)return!0;if(i&&t===null&&!ny(n.state.selection))return s(),!0;let a=TL(o.doc,t)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},Q5=(t,e)=>n=>t.every((r,o)=>e(r,{...n,index:o})),Z5=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e);function wL(t){let e=`${t}`;return new window.DOMParser().parseFromString(e,"text/html").body}function Xg(t,e,n){if(n={slice:!0,parseOptions:{},...n},typeof t=="object"&&t!==null)try{return Array.isArray(t)&&t.length>0?K.fromArray(t.map(r=>e.nodeFromJSON(r))):e.nodeFromJSON(t)}catch(r){return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",r),Xg("",e,n)}if(typeof t=="string"){let r=da.fromSchema(e);return n.slice?r.parseSlice(wL(t),n.parseOptions).content:r.parse(wL(t),n.parseOptions)}return Xg("",e,n)}function ej(t,e,n){let r=t.steps.length-1;if(r{s===0&&(s=c)}),t.setSelection(Ee.near(t.doc.resolve(s),n))}var tj=t=>t.toString().startsWith("<"),nj=(t,e,n)=>({tr:r,dispatch:o,editor:i})=>{if(o){n={parseOptions:{},updateSelection:!0,...n};let s=Xg(e,i.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions}});if(s.toString()==="<>")return!0;let{from:a,to:l}=typeof t=="number"?{from:t,to:t}:{from:t.from,to:t.to},u=!0,c=!0;if((tj(s)?s:[s]).forEach(d=>{d.check(),u=u?d.isText&&d.marks.length===0:!1,c=c?d.isBlock:!1}),a===l&&c){let{parent:d}=r.doc.resolve(a);d.isTextblock&&!d.type.spec.code&&!d.childCount&&(a-=1,l+=1)}u?Array.isArray(e)?r.insertText(e.map(d=>d.text||"").join(""),a,l):typeof e=="object"&&e&&e.text?r.insertText(e.text,a,l):r.insertText(e,a,l):r.replaceWith(a,l,s),n.updateSelection&&ej(r,r.steps.length-1,-1)}return!0},rj=()=>({state:t,dispatch:e})=>sL(t,e),oj=()=>({state:t,dispatch:e})=>aL(t,e),ij=()=>({state:t,dispatch:e})=>Tb(t,e),sj=()=>({state:t,dispatch:e})=>Ob(t,e),aj=()=>({tr:t,state:e,dispatch:n})=>{try{let r=hu(e.doc,e.selection.$from.pos,-1);return r==null?!1:(t.join(r,2),n&&n(t),!0)}catch{return!1}},lj=()=>({state:t,dispatch:e,tr:n})=>{try{let r=hu(t.doc,t.selection.$from.pos,1);return r==null?!1:(n.join(r,2),e&&e(n),!0)}catch{return!1}};function ry(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function uj(t){let e=t.split(/-(?!$)/),n=e[e.length-1];n==="Space"&&(n=" ");let r,o,i,s;for(let a=0;a({editor:e,view:n,tr:r,dispatch:o})=>{let i=uj(t).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction(()=>{n.someProp("handleKeyDown",u=>u(n,a))});return l?.steps.forEach(u=>{let c=u.map(r.mapping);c&&o&&r.maybeStep(c)}),!0};function id(t,e,n={}){let{from:r,to:o,empty:i}=t.selection,s=e?$t(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(f,d)=>{if(f.isText)return;let p=Math.max(r,d),m=Math.min(o,d+f.nodeSize);a.push({node:f,from:p,to:m})});let l=o-r,u=a.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Yg(f.node.attrs,n,{strict:!1}));return i?!!u.length:u.reduce((f,d)=>f+d.to-d.from,0)>=l}var fj=(t,e={})=>({state:n,dispatch:r})=>{let o=$t(t,n.schema);return id(n,o,e)?lL(n,r):!1},dj=()=>({state:t,dispatch:e})=>Db(t,e),pj=t=>({state:e,dispatch:n})=>{let r=$t(t,e.schema);return mL(r)(e,n)},mj=()=>({state:t,dispatch:e})=>Mb(t,e);function oy(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function xL(t,e){let n=typeof e=="string"?[e]:e;return Object.keys(t).reduce((r,o)=>(n.includes(o)||(r[o]=t[o]),r),{})}var hj=(t,e)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,a=oy(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=$t(t,r.schema)),a==="mark"&&(s=ps(t,r.schema)),o&&n.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(u,c)=>{i&&i===u.type&&n.setNodeMarkup(c,void 0,xL(u.attrs,e)),s&&u.marks.length&&u.marks.forEach(f=>{s===f.type&&n.addMark(c,c+u.nodeSize,s.create(xL(f.attrs,e)))})})}),!0):!1},gj=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),yj=()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),vj=()=>({state:t,dispatch:e})=>Pb(t,e),wj=()=>({state:t,dispatch:e})=>Nb(t,e),xj=()=>({state:t,dispatch:e})=>uL(t,e),Sj=()=>({state:t,dispatch:e})=>Bb(t,e),kj=()=>({state:t,dispatch:e})=>Fb(t,e);function PL(t,e,n={}){return Xg(t,e,{slice:!1,parseOptions:n})}var bj=(t,e=!1,n={})=>({tr:r,editor:o,dispatch:i})=>{let{doc:s}=r,a=PL(t,o.schema,n);return i&&r.replaceWith(0,s.content.size,a).setMeta("preventUpdate",!e),!0};function iy(t,e){let n=ps(e,t.schema),{from:r,to:o,empty:i}=t.selection,s=[];i?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,l=>{s.push(...l.marks)});let a=s.find(l=>l.type.name===n.name);return a?{...a.attrs}:{}}function OL(t,e){let n=new pu(t);return e.forEach(r=>{r.steps.forEach(o=>{n.step(o)})}),n}function Ej(t){for(let e=0;e{n(o)&&r.push({node:o,pos:i})}),r}function Rj(t,e){for(let n=t.depth;n>0;n-=1){let r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function Zb(t){return e=>Rj(e.$from,t)}function Cj(t,e){let n=li.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Tj(t,e){let n={from:0,to:t.content.size};return RL(t,n,e)}function Pj(t,e){let n=$t(e,t.schema),{from:r,to:o}=t.selection,i=[];t.doc.nodesBetween(r,o,a=>{i.push(a)});let s=i.reverse().find(a=>a.type.name===n.name);return s?{...s.attrs}:{}}function e1(t,e){let n=oy(typeof e=="string"?e:e.name,t.schema);return n==="node"?Pj(t,e):n==="mark"?iy(t,e):{}}function Oj(t,e=JSON.stringify){let n={};return t.filter(r=>{let o=e(r);return Object.prototype.hasOwnProperty.call(n,o)?!1:n[o]=!0})}function Nj(t){let e=Oj(t);return e.length===1?e:e.filter((n,r)=>!e.filter((i,s)=>s!==r).some(i=>n.oldRange.from>=i.oldRange.from&&n.oldRange.to<=i.oldRange.to&&n.newRange.from>=i.newRange.from&&n.newRange.to<=i.newRange.to))}function ML(t){let{mapping:e,steps:n}=t,r=[];return e.maps.forEach((o,i)=>{let s=[];if(o.ranges.length)o.forEach((a,l)=>{s.push({from:a,to:l})});else{let{from:a,to:l}=n[i];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{let u=e.slice(i).map(a,-1),c=e.slice(i).map(l),f=e.invert().map(u,-1),d=e.invert().map(c);r.push({oldRange:{from:f,to:d},newRange:{from:u,to:c}})})}),Nj(r)}function sy(t,e,n){let r=[];return t===e?n.resolve(t).marks().forEach(o=>{let i=n.resolve(t-1),s=Xb(i,o.type);s&&r.push({mark:o,...s})}):n.nodesBetween(t,e,(o,i)=>{r.push(...o.marks.map(s=>({from:i,to:i+o.nodeSize,mark:s})))}),r}function Kg(t,e,n){return Object.fromEntries(Object.entries(n).filter(([r])=>{let o=t.find(i=>i.type===e&&i.name===r);return o?o.attribute.keepOnSplit:!1}))}function Kb(t,e,n={}){let{empty:r,ranges:o}=t.selection,i=e?ps(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Yg(f.attrs,n,{strict:!1}));let s=0,a=[];if(o.forEach(({$from:f,$to:d})=>{let p=f.pos,m=d.pos;t.doc.nodesBetween(p,m,(y,w)=>{if(!y.isText&&!y.marks.length)return;let g=Math.max(p,w),v=Math.min(m,w+y.nodeSize),k=v-g;s+=k,a.push(...y.marks.map(S=>({mark:S,from:g,to:v})))})}),s===0)return!1;let l=a.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Yg(f.mark.attrs,n,{strict:!1})).reduce((f,d)=>f+d.to-d.from,0),u=a.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,d)=>f+d.to-d.from,0);return(l>0?l+u:l)>=s}function Mj(t,e,n={}){if(!e)return id(t,null,n)||Kb(t,null,n);let r=oy(e,t.schema);return r==="node"?id(t,e,n):r==="mark"?Kb(t,e,n):!1}function SL(t,e){let{nodeExtensions:n}=ey(e),r=n.find(s=>s.name===t);if(!r)return!1;let o={name:r.name,options:r.options,storage:r.storage},i=Ie(ae(r,"group",o));return typeof i!="string"?!1:i.split(" ").includes("list")}function Ij(t){var e;let n=(e=t.type.createAndFill())===null||e===void 0?void 0:e.toJSON(),r=t.toJSON();return JSON.stringify(n)===JSON.stringify(r)}function IL(t){return t instanceof ge}function AL(t,e,n){let o=t.state.doc.content.size,i=hi(e,0,o),s=hi(n,0,o),a=t.coordsAtPos(i),l=t.coordsAtPos(s,-1),u=Math.min(a.top,l.top),c=Math.max(a.bottom,l.bottom),f=Math.min(a.left,l.left),d=Math.max(a.right,l.right),p=d-f,m=c-u,g={top:u,bottom:c,left:f,right:d,width:p,height:m,x:f,y:u};return{...g,toJSON:()=>g}}function Aj(t,e,n){var r;let{selection:o}=e,i=null;if(ny(o)&&(i=o.$cursor),i){let a=(r=t.storedMarks)!==null&&r!==void 0?r:i.marks();return!!n.isInSet(a)||!a.some(l=>l.type.excludes(n))}let{ranges:s}=o;return s.some(({$from:a,$to:l})=>{let u=a.depth===0?t.doc.inlineContent&&t.doc.type.allowsMarkType(n):!1;return t.doc.nodesBetween(a.pos,l.pos,(c,f,d)=>{if(u)return!1;if(c.isInline){let p=!d||d.type.allowsMarkType(n),m=!!n.isInSet(c.marks)||!c.marks.some(y=>y.type.excludes(n));u=p&&m}return!u}),u})}var Lj=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let{selection:i}=n,{empty:s,ranges:a}=i,l=ps(t,r.schema);if(o)if(s){let u=iy(r,l);n.addStoredMark(l.create({...u,...e}))}else a.forEach(u=>{let c=u.$from.pos,f=u.$to.pos;r.doc.nodesBetween(c,f,(d,p)=>{let m=Math.max(p,c),y=Math.min(p+d.nodeSize,f);d.marks.find(g=>g.type===l)?d.marks.forEach(g=>{l===g.type&&n.addMark(m,y,l.create({...g.attrs,...e}))}):n.addMark(m,y,l.create(e))})});return Aj(r,n,l)},Dj=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),Fj=(t,e={})=>({state:n,dispatch:r,chain:o})=>{let i=$t(t,n.schema);return i.isTextblock?o().command(({commands:s})=>Jb(i,e)(n)?!0:s.clearNodes()).command(({state:s})=>Jb(i,e)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Bj=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,o=hi(t,0,r.content.size),i=ge.create(r,o);e.setSelection(i)}return!0},Jj=t=>({tr:e,dispatch:n})=>{if(n){let{doc:r}=e,{from:o,to:i}=typeof t=="number"?{from:t,to:t}:t,s=Me.atStart(r).from,a=Me.atEnd(r).to,l=hi(o,s,a),u=hi(i,s,a),c=Me.create(r,l,u);e.setSelection(c)}return!0},Uj=t=>({state:e,dispatch:n})=>{let r=$t(t,e.schema);return hL(r)(e,n)};function kL(t,e){let n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){let r=n.filter(o=>e?.includes(o.type.name));t.tr.ensureMarks(r)}}var _j=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:r,editor:o})=>{let{selection:i,doc:s}=e,{$from:a,$to:l}=i,u=o.extensionManager.attributes,c=Kg(u,a.node().type.name,a.node().attrs);if(i instanceof ge&&i.node.isBlock)return!a.parentOffset||!Or(s,a.pos)?!1:(r&&(t&&kL(n,o.extensionManager.splittableMarks),e.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;if(r){let f=l.parentOffset===l.parent.content.size;i instanceof Me&&e.deleteSelection();let d=a.depth===0?void 0:Ej(a.node(-1).contentMatchAt(a.indexAfter(-1))),p=f&&d?[{type:d,attrs:c}]:void 0,m=Or(e.doc,e.mapping.map(a.pos),1,p);if(!p&&!m&&Or(e.doc,e.mapping.map(a.pos),1,d?[{type:d}]:void 0)&&(m=!0,p=d?[{type:d,attrs:c}]:void 0),m&&(e.split(e.mapping.map(a.pos),1,p),d&&!f&&!a.parentOffset&&a.parent.type!==d)){let y=e.mapping.map(a.before()),w=e.doc.resolve(y);a.node(-1).canReplaceWith(w.index(),w.index()+1,d)&&e.setNodeMarkup(e.mapping.map(a.before()),d)}t&&kL(n,o.extensionManager.splittableMarks),e.scrollIntoView()}return!0},zj=t=>({tr:e,state:n,dispatch:r,editor:o})=>{var i;let s=$t(t,n.schema),{$from:a,$to:l}=n.selection,u=n.selection.node;if(u&&u.isBlock||a.depth<2||!a.sameParent(l))return!1;let c=a.node(-1);if(c.type!==s)return!1;let f=o.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==s||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let w=K.empty,g=a.index(-1)?1:a.index(-2)?2:3;for(let R=a.depth-g;R>=a.depth-3;R-=1)w=K.from(a.node(R).copy(w));let v=a.indexAfter(-1){if(x>-1)return!1;R.isTextblock&&R.content.size===0&&(x=E+1)}),x>-1&&e.setSelection(Me.near(e.doc.resolve(x))),e.scrollIntoView()}return!0}let d=l.pos===a.end()?c.contentMatchAt(0).defaultType:null,p=Kg(f,c.type.name,c.attrs),m=Kg(f,a.node().type.name,a.node().attrs);e.delete(a.pos,l.pos);let y=d?[{type:s,attrs:p},{type:d,attrs:m}]:[{type:s,attrs:p}];if(!Or(e.doc,a.pos,2))return!1;if(r){let{selection:w,storedMarks:g}=n,{splittableMarks:v}=o.extensionManager,k=g||w.$to.parentOffset&&w.$from.marks();if(e.split(a.pos,2,y).scrollIntoView(),!k||!r)return!0;let S=k.filter(b=>v.includes(b.type.name));e.ensureMarks(S)}return!0},qb=(t,e)=>{let n=Zb(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return n.node.type===o?.type&&no(t.doc,n.pos)&&t.join(n.pos),!0},jb=(t,e)=>{let n=Zb(s=>s.type===e)(t.selection);if(!n)return!0;let r=t.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let o=t.doc.nodeAt(r);return n.node.type===o?.type&&no(t.doc,r)&&t.join(r),!0},Vj=(t,e,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:u,can:c})=>{let{extensions:f,splittableMarks:d}=o.extensionManager,p=$t(t,s.schema),m=$t(e,s.schema),{selection:y,storedMarks:w}=s,{$from:g,$to:v}=y,k=g.blockRange(v),S=w||y.$to.parentOffset&&y.$from.marks();if(!k)return!1;let b=Zb(x=>SL(x.type.name,f))(y);if(k.depth>=1&&b&&k.depth-b.depth<=1){if(b.node.type===p)return u.liftListItem(m);if(SL(b.node.type.name,f)&&p.validContent(b.node.content)&&a)return l().command(()=>(i.setNodeMarkup(b.pos,p),!0)).command(()=>qb(i,p)).command(()=>jb(i,p)).run()}return!n||!S||!a?l().command(()=>c().wrapInList(p,r)?!0:u.clearNodes()).wrapInList(p,r).command(()=>qb(i,p)).command(()=>jb(i,p)).run():l().command(()=>{let x=c().wrapInList(p,r),R=S.filter(E=>d.includes(E.type.name));return i.ensureMarks(R),x?!0:u.clearNodes()}).wrapInList(p,r).command(()=>qb(i,p)).command(()=>jb(i,p)).run()},qj=(t,e={},n={})=>({state:r,commands:o})=>{let{extendEmptyMarkRange:i=!1}=n,s=ps(t,r.schema);return Kb(r,s,e)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,e)},jj=(t,e,n={})=>({state:r,commands:o})=>{let i=$t(t,r.schema),s=$t(e,r.schema);return id(r,i,n)?o.setNode(s):o.setNode(i,n)},Hj=(t,e={})=>({state:n,commands:r})=>{let o=$t(t,n.schema);return id(n,o,e)?r.lift(o):r.wrapIn(o,e)},$j=()=>({state:t,dispatch:e})=>{let n=t.plugins;for(let r=0;r=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(i.text){let l=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,t.schema.text(i.text,l))}else s.delete(i.from,i.to)}return!0}}return!1},Wj=()=>({tr:t,dispatch:e})=>{let{selection:n}=t,{empty:r,ranges:o}=n;return r||e&&o.forEach(i=>{t.removeMark(i.$from.pos,i.$to.pos)}),!0},Gj=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var i;let{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=ps(t,r.schema),{$from:u,empty:c,ranges:f}=a;if(!o)return!0;if(c&&s){let{from:d,to:p}=a,m=(i=u.marks().find(w=>w.type===l))===null||i===void 0?void 0:i.attrs,y=Xb(u,l,m);y&&(d=y.from,p=y.to),n.removeMark(d,p,l)}else f.forEach(d=>{n.removeMark(d.$from.pos,d.$to.pos,l)});return n.removeStoredMark(l),!0},Kj=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null,a=oy(typeof t=="string"?t:t.name,r.schema);return a?(a==="node"&&(i=$t(t,r.schema)),a==="mark"&&(s=ps(t,r.schema)),o&&n.selection.ranges.forEach(l=>{let u=l.$from.pos,c=l.$to.pos;r.doc.nodesBetween(u,c,(f,d)=>{i&&i===f.type&&n.setNodeMarkup(d,void 0,{...f.attrs,...e}),s&&f.marks.length&&f.marks.forEach(p=>{if(s===p.type){let m=Math.max(d,u),y=Math.min(d+f.nodeSize,c);n.addMark(m,y,s.create({...p.attrs,...e}))}})})}),!0):!1},Yj=(t,e={})=>({state:n,dispatch:r})=>{let o=$t(t,n.schema);return dL(o,e)(n,r)},Xj=(t,e={})=>({state:n,dispatch:r})=>{let o=$t(t,n.schema);return pL(o,e)(n,r)},Qj=Object.freeze({__proto__:null,blur:F5,clearContent:B5,clearNodes:J5,command:U5,createParagraphNear:_5,cut:z5,deleteCurrentNode:V5,deleteNode:q5,deleteRange:j5,deleteSelection:H5,enter:$5,exitCode:W5,extendMarkRange:K5,first:Y5,focus:X5,forEach:Q5,insertContent:Z5,insertContentAt:nj,joinUp:rj,joinDown:oj,joinBackward:ij,joinForward:sj,joinItemBackward:aj,joinItemForward:lj,keyboardShortcut:cj,lift:fj,liftEmptyBlock:dj,liftListItem:pj,newlineInCode:mj,resetAttributes:hj,scrollIntoView:gj,selectAll:yj,selectNodeBackward:vj,selectNodeForward:wj,selectParentNode:xj,selectTextblockEnd:Sj,selectTextblockStart:kj,setContent:bj,setMark:Lj,setMeta:Dj,setNode:Fj,setNodeSelection:Bj,setTextSelection:Jj,sinkListItem:Uj,splitBlock:_j,splitListItem:zj,toggleList:Vj,toggleMark:qj,toggleNode:jj,toggleWrap:Hj,undoInputRule:$j,unsetAllMarks:Wj,unsetMark:Gj,updateAttributes:Kj,wrapIn:Yj,wrapInList:Xj}),Zj=Ar.create({name:"commands",addCommands(){return{...Qj}}}),e6=Ar.create({name:"editable",addProseMirrorPlugins(){return[new At({key:new an("editable"),props:{editable:()=>this.editor.options.editable}})]}}),t6=Ar.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:t}=this;return[new At({key:new an("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;let r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;let r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),n6=Ar.create({name:"keymap",addKeyboardShortcuts(){let t=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{let{selection:l,doc:u}=a,{empty:c,$anchor:f}=l,{pos:d,parent:p}=f,m=f.parent.isTextblock?a.doc.resolve(d-1):f,y=m.parent.type.spec.isolating,w=f.pos-f.parentOffset,g=y&&m.parent.childCount===1?w===f.pos:Ee.atStart(u).from===d;return!c||!g||!p.type.isTextblock||p.textContent.length?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...r},i={...r,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Qb()||ry()?i:o},addProseMirrorPlugins(){return[new At({key:new an("clearDocument"),appendTransaction:(t,e,n)=>{if(!(t.some(m=>m.docChanged)&&!e.doc.eq(n.doc)))return;let{empty:o,from:i,to:s}=e.selection,a=Ee.atStart(e.doc).from,l=Ee.atEnd(e.doc).to;if(o||!(i===a&&s===l)||!(n.doc.textBetween(0,n.doc.content.size," "," ").length===0))return;let f=n.tr,d=Zg({state:n,transaction:f}),{commands:p}=new Eu({editor:this.editor,state:d});if(p.clearNodes(),!!f.steps.length)return f}})]}}),r6=Ar.create({name:"tabindex",addProseMirrorPlugins(){return[new At({key:new an("tabindex"),props:{attributes:this.editor.isEditable?{tabindex:"0"}:{}}})]}}),o6=Object.freeze({__proto__:null,ClipboardTextSerializer:D5,Commands:Zj,Editable:e6,FocusEvents:t6,Keymap:n6,Tabindex:r6}),i6=`.ProseMirror { position: relative; } @@ -271,25 +271,25 @@ img.ProseMirror-separator { .tippy-box[data-animation=fade][data-state=hidden] { opacity: 0 -}`;function w6(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var Kg=class extends Kb{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}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&&document&&(this.css=w6(v6,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){let r=wL(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;let n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){let n=[...this.options.enableCoreExtensions?Object.values(y6):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Xb(n,this)}createCommandManager(){this.commandManager=new Iu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e=bL(this.options.content,this.schema,this.options.parseOptions),n=kL(e,this.options.autofocus);this.view=new _g(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Ng.create({doc:e,selection:n||void 0})});let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();let o=this.view.dom;o.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}let n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return o1(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return jj(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Uj(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` +}`;function s6(t,e,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(r!==null)return r;let o=document.createElement("style");return e&&o.setAttribute("nonce",e),o.setAttribute(`data-tiptap-style${n?`-${n}`:""}`,""),o.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(o),o}var Qg=class extends Hb{constructor(e={}){super(),this.isFocused=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.createView(),this.injectCSS(),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),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}))},0)}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&&document&&(this.css=s6(i6,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,n=!0){this.setOptions({editable:e}),n&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(e,n){let r=EL(n)?n(e,[...this.state.plugins]):[...this.state.plugins,e],o=this.state.reconfigure({plugins:r});this.view.updateState(o)}unregisterPlugin(e){if(this.isDestroyed)return;let n=typeof e=="string"?`${e}$`:e.key,r=this.state.reconfigure({plugins:this.state.plugins.filter(o=>!o.key.startsWith(n))});this.view.updateState(r)}createExtensionManager(){let n=[...this.options.enableCoreExtensions?Object.values(o6):[],...this.options.extensions].filter(r=>["extension","node","mark"].includes(r?.type));this.extensionManager=new Wb(n,this)}createCommandManager(){this.commandManager=new Eu({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let e=PL(this.options.content,this.schema,this.options.parseOptions),n=TL(e,this.options.autofocus);this.view=new qg(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Ag.create({doc:e,selection:n||void 0})});let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();let o=this.view.dom;o.editor=this}createNodeViews(){this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let n=this.capturedTransaction;return this.capturedTransaction=null,n}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}let n=this.state.apply(e),r=!this.state.selection.eq(n.selection);this.view.updateState(n),this.emit("transaction",{editor:this,transaction:e}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});let o=e.getMeta("focus"),i=e.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:e}),i&&this.emit("blur",{editor:this,event:i.event,transaction:e}),!(!e.docChanged||e.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:e})}getAttributes(e){return e1(this.state,e)}isActive(e,n){let r=typeof e=="string"?e:null,o=typeof e=="string"?n:e;return Mj(this.state,r,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Cj(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:n=` -`,textSerializers:r={}}=e||{};return _j(this.state.doc,{blockSeparator:n,textSerializers:{...SL(this.schema),...r}})}get isEmpty(){return Hj(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}};function Co(t){return new Au({find:t.find,handler:({state:e,range:n,match:r})=>{let o=Ie(t.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],a=r[0];if(s){let l=a.search(/\S/),u=n.from+a.indexOf(s),c=u+s.length;if(ry(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;cn.from&&i.delete(n.from+l,u);let d=n.from+l+s.length;i.addMark(n.from+l,d,t.type.create(o||{})),i.removeStoredMark(t.type)}}})}function i1(t){return new Au({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{let i=Ie(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),u=l&&ku(l,t.type,i);if(!u)return null;if(s.wrap(l,u),t.keepMarks&&t.editor){let{selection:f,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionManager,m=d||f.$to.parentOffset&&f.$from.marks();if(m){let y=m.filter(w=>p.includes(w.type.name));s.ensureMarks(y)}}if(t.keepAttributes){let f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(f,i).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&eo(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}var fr=class t{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(ae(this,"addOptions",{name:this.name}))),this.storage=Ie(ae(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=Qg(this.options,e),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ie(ae(n,"addOptions",{name:n.name})),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let s=o.marks();if(!!!s.find(u=>u?.type.name===n.name))return!1;let l=s.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}},dr=class t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(ae(this,"addOptions",{name:this.name}))),this.storage=Ie(ae(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=Qg(this.options,e),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ie(ae(n,"addOptions",{name:n.name})),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}};function Ir(t){return new od({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{let i=Ie(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,a=r[r.length-1],l=r[0],u=n.to;if(a){let c=l.search(/\S/),f=n.from+l.indexOf(a),d=f+a.length;if(ry(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(w=>w===t.type&&w!==m.mark.type)).filter(m=>m.to>f).length)return null;dn.from&&s.delete(n.from+c,f),u=n.from+c+a.length,s.addMark(n.from+c,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}var wt="top",Jt="bottom",Dt="right",Rt="left",oy="auto",ps=[wt,Jt,Dt,Rt],hi="start",xa="end",OL="clippingParents",iy="viewport",Lu="popper",NL="reference",s1=ps.reduce(function(t,e){return t.concat([e+"-"+hi,e+"-"+xa])},[]),sy=[].concat(ps,[oy]).reduce(function(t,e){return t.concat([e,e+"-"+hi,e+"-"+xa])},[]),x6="beforeRead",S6="read",k6="afterRead",b6="beforeMain",E6="main",R6="afterMain",C6="beforeWrite",T6="write",P6="afterWrite",ML=[x6,S6,k6,b6,E6,R6,C6,T6,P6];function Wt(t){return t?(t.nodeName||"").toLowerCase():null}function ut(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Ar(t){var e=ut(t).Element;return t instanceof e||t instanceof Element}function Ut(t){var e=ut(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Du(t){if(typeof ShadowRoot>"u")return!1;var e=ut(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function O6(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!Ut(i)||!Wt(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var a=o[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function N6(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,u){return l[u]="",l},{});!Ut(o)||!Wt(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(l){o.removeAttribute(l)}))})}}var sd={name:"applyStyles",enabled:!0,phase:"write",fn:O6,effect:N6,requires:["computeStyles"]};function Gt(t){return t.split("-")[0]}var ro=Math.max,Sa=Math.min,gi=Math.round;function Fu(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ad(){return!/^((?!chrome|android).)*safari/i.test(Fu())}function Lr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,i=1;e&&Ut(t)&&(o=t.offsetWidth>0&&gi(r.width)/t.offsetWidth||1,i=t.offsetHeight>0&&gi(r.height)/t.offsetHeight||1);var s=Ar(t)?ut(t):window,a=s.visualViewport,l=!ad()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/o,c=(r.top+(l&&a?a.offsetTop:0))/i,f=r.width/o,d=r.height/i;return{width:f,height:d,top:c,right:u+f,bottom:c+d,left:u,x:u,y:c}}function ka(t){var e=Lr(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ld(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Du(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function _n(t){return ut(t).getComputedStyle(t)}function a1(t){return["table","td","th"].indexOf(Wt(t))>=0}function ln(t){return((Ar(t)?t.ownerDocument:t.document)||window.document).documentElement}function yi(t){return Wt(t)==="html"?t:t.assignedSlot||t.parentNode||(Du(t)?t.host:null)||ln(t)}function IL(t){return!Ut(t)||_n(t).position==="fixed"?null:t.offsetParent}function M6(t){var e=/firefox/i.test(Fu()),n=/Trident/i.test(Fu());if(n&&Ut(t)){var r=_n(t);if(r.position==="fixed")return null}var o=yi(t);for(Du(o)&&(o=o.host);Ut(o)&&["html","body"].indexOf(Wt(o))<0;){var i=_n(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function oo(t){for(var e=ut(t),n=IL(t);n&&a1(n)&&_n(n).position==="static";)n=IL(n);return n&&(Wt(n)==="html"||Wt(n)==="body"&&_n(n).position==="static")?e:n||M6(t)||e}function ba(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ea(t,e,n){return ro(t,Sa(e,n))}function AL(t,e,n){var r=Ea(t,e,n);return r>n?n:r}function ud(){return{top:0,right:0,bottom:0,left:0}}function cd(t){return Object.assign({},ud(),t)}function fd(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var I6=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,cd(typeof e!="number"?e:fd(e,ps))};function A6(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=Gt(n.placement),l=ba(a),u=[Rt,Dt].indexOf(a)>=0,c=u?"height":"width";if(!(!i||!s)){var f=I6(o.padding,n),d=ka(i),p=l==="y"?wt:Rt,m=l==="y"?Jt:Dt,y=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],w=s[l]-n.rects.reference[l],g=oo(i),v=g?l==="y"?g.clientHeight||0:g.clientWidth||0:0,k=y/2-w/2,S=f[p],b=v-d[c]-f[m],x=v/2-d[c]/2+k,T=Ea(S,x,b),E=l;n.modifiersData[r]=(e={},e[E]=T,e.centerOffset=T-x,e)}}function L6(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||ld(e.elements.popper,o)&&(e.elements.arrow=o))}var LL={name:"arrow",enabled:!0,phase:"main",fn:A6,effect:L6,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Dr(t){return t.split("-")[1]}var D6={top:"auto",right:"auto",bottom:"auto",left:"auto"};function F6(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:gi(n*o)/o||0,y:gi(r*o)/o||0}}function DL(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,f=t.isFixed,d=s.x,p=d===void 0?0:d,m=s.y,y=m===void 0?0:m,w=typeof c=="function"?c({x:p,y}):{x:p,y};p=w.x,y=w.y;var g=s.hasOwnProperty("x"),v=s.hasOwnProperty("y"),k=Rt,S=wt,b=window;if(u){var x=oo(n),T="clientHeight",E="clientWidth";if(x===ut(n)&&(x=ln(n),_n(x).position!=="static"&&a==="absolute"&&(T="scrollHeight",E="scrollWidth")),x=x,o===wt||(o===Rt||o===Dt)&&i===xa){S=Jt;var O=f&&x===b&&b.visualViewport?b.visualViewport.height:x[T];y-=O-r.height,y*=l?1:-1}if(o===Rt||(o===wt||o===Jt)&&i===xa){k=Dt;var A=f&&x===b&&b.visualViewport?b.visualViewport.width:x[E];p-=A-r.width,p*=l?1:-1}}var B=Object.assign({position:a},u&&D6),L=c===!0?F6({x:p,y},ut(n)):{x:p,y};if(p=L.x,y=L.y,l){var I;return Object.assign({},B,(I={},I[S]=v?"0":"",I[k]=g?"0":"",I.transform=(b.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",I))}return Object.assign({},B,(e={},e[S]=v?y+"px":"",e[k]=g?p+"px":"",e.transform="",e))}function B6(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,s=i===void 0?!0:i,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Gt(e.placement),variation:Dr(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,DL(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,DL(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var FL={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:B6,data:{}};var ay={passive:!0};function J6(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,a=s===void 0?!0:s,l=ut(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(c){c.addEventListener("scroll",n.update,ay)}),a&&l.addEventListener("resize",n.update,ay),function(){i&&u.forEach(function(c){c.removeEventListener("scroll",n.update,ay)}),a&&l.removeEventListener("resize",n.update,ay)}}var BL={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:J6,data:{}};var U6={left:"right",right:"left",bottom:"top",top:"bottom"};function Bu(t){return t.replace(/left|right|bottom|top/g,function(e){return U6[e]})}var _6={start:"end",end:"start"};function ly(t){return t.replace(/start|end/g,function(e){return _6[e]})}function Ra(t){var e=ut(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Ca(t){return Lr(ln(t)).left+Ra(t).scrollLeft}function l1(t,e){var n=ut(t),r=ln(t),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;var u=ad();(u||!u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a+Ca(t),y:l}}function u1(t){var e,n=ln(t),r=Ra(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=ro(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=ro(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+Ca(t),l=-r.scrollTop;return _n(o||n).direction==="rtl"&&(a+=ro(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}function Ta(t){var e=_n(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function uy(t){return["html","body","#document"].indexOf(Wt(t))>=0?t.ownerDocument.body:Ut(t)&&Ta(t)?t:uy(yi(t))}function ms(t,e){var n;e===void 0&&(e=[]);var r=uy(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=ut(r),s=o?[i].concat(i.visualViewport||[],Ta(r)?r:[]):r,a=e.concat(s);return o?a:a.concat(ms(yi(s)))}function Ju(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function z6(t,e){var n=Lr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function JL(t,e,n){return e===iy?Ju(l1(t,n)):Ar(e)?z6(e,n):Ju(u1(ln(t)))}function V6(t){var e=ms(yi(t)),n=["absolute","fixed"].indexOf(_n(t).position)>=0,r=n&&Ut(t)?oo(t):t;return Ar(r)?e.filter(function(o){return Ar(o)&&ld(o,r)&&Wt(o)!=="body"}):[]}function c1(t,e,n,r){var o=e==="clippingParents"?V6(t):[].concat(e),i=[].concat(o,[n]),s=i[0],a=i.reduce(function(l,u){var c=JL(t,u,r);return l.top=ro(c.top,l.top),l.right=Sa(c.right,l.right),l.bottom=Sa(c.bottom,l.bottom),l.left=ro(c.left,l.left),l},JL(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function dd(t){var e=t.reference,n=t.element,r=t.placement,o=r?Gt(r):null,i=r?Dr(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(o){case wt:l={x:s,y:e.y-n.height};break;case Jt:l={x:s,y:e.y+e.height};break;case Dt:l={x:e.x+e.width,y:a};break;case Rt:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=o?ba(o):null;if(u!=null){var c=u==="y"?"height":"width";switch(i){case hi:l[u]=l[u]-(e[c]/2-n[c]/2);break;case xa:l[u]=l[u]+(e[c]/2-n[c]/2);break;default:}}return l}function io(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.strategy,s=i===void 0?t.strategy:i,a=n.boundary,l=a===void 0?OL:a,u=n.rootBoundary,c=u===void 0?iy:u,f=n.elementContext,d=f===void 0?Lu:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,w=y===void 0?0:y,g=cd(typeof w!="number"?w:fd(w,ps)),v=d===Lu?NL:Lu,k=t.rects.popper,S=t.elements[m?v:d],b=c1(Ar(S)?S:S.contextElement||ln(t.elements.popper),l,c,s),x=Lr(t.elements.reference),T=dd({reference:x,element:k,strategy:"absolute",placement:o}),E=Ju(Object.assign({},k,T)),O=d===Lu?E:x,A={top:b.top-O.top+g.top,bottom:O.bottom-b.bottom+g.bottom,left:b.left-O.left+g.left,right:O.right-b.right+g.right},B=t.modifiersData.offset;if(d===Lu&&B){var L=B[o];Object.keys(A).forEach(function(I){var U=[Dt,Jt].indexOf(I)>=0?1:-1,V=[wt,Jt].indexOf(I)>=0?"y":"x";A[I]+=L[V]*U})}return A}function f1(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?sy:l,c=Dr(r),f=c?a?s1:s1.filter(function(m){return Dr(m)===c}):ps,d=f.filter(function(m){return u.indexOf(m)>=0});d.length===0&&(d=f);var p=d.reduce(function(m,y){return m[y]=io(t,{placement:y,boundary:o,rootBoundary:i,padding:s})[Gt(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function q6(t){if(Gt(t)===oy)return[];var e=Bu(t);return[ly(t),e,ly(e)]}function j6(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,f=n.rootBoundary,d=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,y=n.allowedAutoPlacements,w=e.options.placement,g=Gt(w),v=g===w,k=l||(v||!m?[Bu(w)]:q6(w)),S=[w].concat(k).reduce(function(Qe,St){return Qe.concat(Gt(St)===oy?f1(e,{placement:St,boundary:c,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:y}):St)},[]),b=e.rects.reference,x=e.rects.popper,T=new Map,E=!0,O=S[0],A=0;A=0,V=U?"width":"height",Q=io(e,{placement:B,boundary:c,rootBoundary:f,altBoundary:d,padding:u}),G=U?I?Dt:Rt:I?Jt:wt;b[V]>x[V]&&(G=Bu(G));var te=Bu(G),we=[];if(i&&we.push(Q[L]<=0),a&&we.push(Q[G]<=0,Q[te]<=0),we.every(function(Qe){return Qe})){O=B,E=!1;break}T.set(B,we)}if(E)for(var R=m?3:1,it=function(St){var Cn=S.find(function(dn){var Ve=T.get(dn);if(Ve)return Ve.slice(0,St).every(function(pn){return pn})});if(Cn)return O=Cn,"break"},ct=R;ct>0;ct--){var C=it(ct);if(C==="break")break}e.placement!==O&&(e.modifiersData[r]._skip=!0,e.placement=O,e.reset=!0)}}var UL={name:"flip",enabled:!0,phase:"main",fn:j6,requiresIfExists:["offset"],data:{_skip:!1}};function _L(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function zL(t){return[wt,Dt,Jt,Rt].some(function(e){return t[e]>=0})}function H6(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=io(e,{elementContext:"reference"}),a=io(e,{altBoundary:!0}),l=_L(s,r),u=_L(a,o,i),c=zL(l),f=zL(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":f})}var VL={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:H6};function $6(t,e,n){var r=Gt(t),o=[Rt,wt].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Rt,Dt].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function W6(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,s=sy.reduce(function(c,f){return c[f]=$6(f,e.rects,i),c},{}),a=s[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=s}var qL={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:W6};function G6(t){var e=t.state,n=t.name;e.modifiersData[n]=dd({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var jL={name:"popperOffsets",enabled:!0,phase:"read",fn:G6,data:{}};function d1(t){return t==="x"?"y":"x"}function K6(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,f=n.padding,d=n.tether,p=d===void 0?!0:d,m=n.tetherOffset,y=m===void 0?0:m,w=io(e,{boundary:l,rootBoundary:u,padding:f,altBoundary:c}),g=Gt(e.placement),v=Dr(e.placement),k=!v,S=ba(g),b=d1(S),x=e.modifiersData.popperOffsets,T=e.rects.reference,E=e.rects.popper,O=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,A=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),B=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(x){if(i){var I,U=S==="y"?wt:Rt,V=S==="y"?Jt:Dt,Q=S==="y"?"height":"width",G=x[S],te=G+w[U],we=G-w[V],R=p?-E[Q]/2:0,it=v===hi?T[Q]:E[Q],ct=v===hi?-E[Q]:-T[Q],C=e.elements.arrow,Qe=p&&C?ka(C):{width:0,height:0},St=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ud(),Cn=St[U],dn=St[V],Ve=Ea(0,T[Q],Qe[Q]),pn=k?T[Q]/2-R-Ve-Cn-A.mainAxis:it-Ve-Cn-A.mainAxis,kt=k?-T[Q]/2+R+Ve+dn+A.mainAxis:ct+Ve+dn+A.mainAxis,Tn=e.elements.arrow&&oo(e.elements.arrow),Pn=Tn?S==="y"?Tn.clientTop||0:Tn.clientLeft||0:0,qr=(I=B?.[S])!=null?I:0,Bo=G+pn-qr-Pn,Jo=G+kt-qr,Uo=Ea(p?Sa(te,Bo):te,G,p?ro(we,Jo):we);x[S]=Uo,L[S]=Uo-G}if(a){var _o,Ei=S==="x"?wt:Rt,P=S==="x"?Jt:Dt,D=x[b],_=b==="y"?"height":"width",Z=D+w[Ei],Y=D-w[P],W=[wt,Rt].indexOf(g)!==-1,ce=(_o=B?.[b])!=null?_o:0,De=W?Z:D-T[_]-E[_]-ce+A.altAxis,F=W?D+T[_]+E[_]-ce-A.altAxis:Y,j=p&&W?AL(De,D,F):Ea(p?De:Z,D,p?F:Y);x[b]=j,L[b]=j-D}e.modifiersData[r]=L}}var HL={name:"preventOverflow",enabled:!0,phase:"main",fn:K6,requiresIfExists:["offset"]};function p1(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function m1(t){return t===ut(t)||!Ut(t)?Ra(t):p1(t)}function Y6(t){var e=t.getBoundingClientRect(),n=gi(e.width)/t.offsetWidth||1,r=gi(e.height)/t.offsetHeight||1;return n!==1||r!==1}function h1(t,e,n){n===void 0&&(n=!1);var r=Ut(e),o=Ut(e)&&Y6(e),i=ln(e),s=Lr(t,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Wt(e)!=="body"||Ta(i))&&(a=m1(e)),Ut(e)?(l=Lr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):i&&(l.x=Ca(i))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function X6(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i)});function o(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&o(l)}}),r.push(i)}return t.forEach(function(i){n.has(i.name)||o(i)}),r}function g1(t){var e=X6(t);return ML.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function y1(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function v1(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var $L={placement:"bottom",modifiers:[],strategy:"absolute"};function WL(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function lD(t,e){return typeof t=="function"?t.apply(void 0,e):t}function KL(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function t9(t){return t.split(/\s+/).filter(Boolean)}function Uu(t){return[].concat(t)}function YL(t,e){t.indexOf(e)===-1&&t.push(e)}function n9(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function r9(t){return t.split("-")[0]}function fy(t){return[].slice.call(t)}function XL(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function pd(){return document.createElement("div")}function dy(t){return["Element","Fragment"].some(function(e){return C1(t,e)})}function o9(t){return C1(t,"NodeList")}function i9(t){return C1(t,"MouseEvent")}function s9(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function a9(t){return dy(t)?[t]:o9(t)?fy(t):Array.isArray(t)?t:fy(document.querySelectorAll(t))}function S1(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function QL(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function l9(t){var e,n=Uu(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function u9(t,e){var n=e.clientX,r=e.clientY;return t.every(function(o){var i=o.popperRect,s=o.popperState,a=o.props,l=a.interactiveBorder,u=r9(s.placement),c=s.modifiersData.offset;if(!c)return!0;var f=u==="bottom"?c.top.y:0,d=u==="top"?c.bottom.y:0,p=u==="right"?c.left.x:0,m=u==="left"?c.right.x:0,y=i.top-r+f>l,w=r-i.bottom-d>l,g=i.left-n+p>l,v=n-i.right-m>l;return y||w||g||v})}function k1(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){t[r](o,n)})}function ZL(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var To={isTouch:!1},eD=0;function c9(){To.isTouch||(To.isTouch=!0,window.performance&&document.addEventListener("mousemove",uD))}function uD(){var t=performance.now();t-eD<20&&(To.isTouch=!1,document.removeEventListener("mousemove",uD)),eD=t}function f9(){var t=document.activeElement;if(s9(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function d9(){document.addEventListener("touchstart",c9,Pa),window.addEventListener("blur",f9)}var p9=typeof window<"u"&&typeof document<"u",m9=p9?!!window.msCrypto:!1;var h9={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},g9={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},so=Object.assign({appendTo:aD,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},h9,g9),y9=Object.keys(so),v9=function(e){var n=Object.keys(e);n.forEach(function(r){so[r]=e[r]})};function cD(t){var e=t.plugins||[],n=e.reduce(function(r,o){var i=o.name,s=o.defaultValue;if(i){var a;r[i]=t[i]!==void 0?t[i]:(a=so[i])!=null?a:s}return r},{});return Object.assign({},t,n)}function w9(t,e){var n=e?Object.keys(cD(Object.assign({},so,{plugins:e}))):y9,r=n.reduce(function(o,i){var s=(t.getAttribute("data-tippy-"+i)||"").trim();if(!s)return o;if(i==="content")o[i]=s;else try{o[i]=JSON.parse(s)}catch{o[i]=s}return o},{});return r}function tD(t,e){var n=Object.assign({},e,{content:lD(e.content,[t])},e.ignoreAttributes?{}:w9(t,e.plugins));return n.aria=Object.assign({},so.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var x9=function(){return"innerHTML"};function E1(t,e){t[x9()]=e}function nD(t){var e=pd();return t===!0?e.className=iD:(e.className=sD,dy(t)?e.appendChild(t):E1(e,t)),e}function rD(t,e){dy(e.content)?(E1(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?E1(t,e.content):t.textContent=e.content)}function R1(t){var e=t.firstElementChild,n=fy(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(oD)}),arrow:n.find(function(r){return r.classList.contains(iD)||r.classList.contains(sD)}),backdrop:n.find(function(r){return r.classList.contains(e9)})}}function fD(t){var e=pd(),n=pd();n.className=Z6,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=pd();r.className=oD,r.setAttribute("data-state","hidden"),rD(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props);function o(i,s){var a=R1(e),l=a.box,u=a.content,c=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&rD(u,t.props),s.arrow?c?i.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(nD(s.arrow))):l.appendChild(nD(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:o}}fD.$$tippy=!0;var S9=1,cy=[],b1=[];function k9(t,e){var n=tD(t,Object.assign({},so,cD(XL(e)))),r,o,i,s=!1,a=!1,l=!1,u=!1,c,f,d,p=[],m=KL(Bo,n.interactiveDebounce),y,w=S9++,g=null,v=n9(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},S={id:w,reference:t,popper:pd(),popperInstance:g,props:n,state:k,plugins:v,clearDelayTimeouts:De,setProps:F,setContent:j,show:fe,hide:ze,hideWithInteractivity:Fe,enable:W,disable:ce,unmount:Qt,destroy:gr};if(!n.render)return S;var b=n.render(S),x=b.popper,T=b.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+S.id,S.popper=x,t._tippy=S,x._tippy=S;var E=v.map(function(J){return J.fn(S)}),O=t.hasAttribute("aria-expanded");return Tn(),R(),G(),te("onCreate",[S]),n.showOnCreate&&Z(),x.addEventListener("mouseenter",function(){S.props.interactive&&S.state.isVisible&&S.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){S.props.interactive&&S.props.trigger.indexOf("mouseenter")>=0&&U().addEventListener("mousemove",m)}),S;function A(){var J=S.props.touch;return Array.isArray(J)?J:[J,0]}function B(){return A()[0]==="hold"}function L(){var J;return!!((J=S.props.render)!=null&&J.$$tippy)}function I(){return y||t}function U(){var J=I().parentNode;return J?l9(J):document}function V(){return R1(x)}function Q(J){return S.state.isMounted&&!S.state.isVisible||To.isTouch||c&&c.type==="focus"?0:x1(S.props.delay,J?0:1,so.delay)}function G(J){J===void 0&&(J=!1),x.style.pointerEvents=S.props.interactive&&!J?"":"none",x.style.zIndex=""+S.props.zIndex}function te(J,ne,de){if(de===void 0&&(de=!0),E.forEach(function(Oe){Oe[J]&&Oe[J].apply(Oe,ne)}),de){var me;(me=S.props)[J].apply(me,ne)}}function we(){var J=S.props.aria;if(J.content){var ne="aria-"+J.content,de=x.id,me=Uu(S.props.triggerTarget||t);me.forEach(function(Oe){var Ze=Oe.getAttribute(ne);if(S.state.isVisible)Oe.setAttribute(ne,Ze?Ze+" "+de:de);else{var yr=Ze&&Ze.replace(de,"").trim();yr?Oe.setAttribute(ne,yr):Oe.removeAttribute(ne)}})}}function R(){if(!(O||!S.props.aria.expanded)){var J=Uu(S.props.triggerTarget||t);J.forEach(function(ne){S.props.interactive?ne.setAttribute("aria-expanded",S.state.isVisible&&ne===I()?"true":"false"):ne.removeAttribute("aria-expanded")})}}function it(){U().removeEventListener("mousemove",m),cy=cy.filter(function(J){return J!==m})}function ct(J){if(!(To.isTouch&&(l||J.type==="mousedown"))){var ne=J.composedPath&&J.composedPath()[0]||J.target;if(!(S.props.interactive&&ZL(x,ne))){if(Uu(S.props.triggerTarget||t).some(function(de){return ZL(de,ne)})){if(To.isTouch||S.state.isVisible&&S.props.trigger.indexOf("click")>=0)return}else te("onClickOutside",[S,J]);S.props.hideOnClick===!0&&(S.clearDelayTimeouts(),S.hide(),a=!0,setTimeout(function(){a=!1}),S.state.isMounted||Cn())}}}function C(){l=!0}function Qe(){l=!1}function St(){var J=U();J.addEventListener("mousedown",ct,!0),J.addEventListener("touchend",ct,Pa),J.addEventListener("touchstart",Qe,Pa),J.addEventListener("touchmove",C,Pa)}function Cn(){var J=U();J.removeEventListener("mousedown",ct,!0),J.removeEventListener("touchend",ct,Pa),J.removeEventListener("touchstart",Qe,Pa),J.removeEventListener("touchmove",C,Pa)}function dn(J,ne){pn(J,function(){!S.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&ne()})}function Ve(J,ne){pn(J,ne)}function pn(J,ne){var de=V().box;function me(Oe){Oe.target===de&&(k1(de,"remove",me),ne())}if(J===0)return ne();k1(de,"remove",f),k1(de,"add",me),f=me}function kt(J,ne,de){de===void 0&&(de=!1);var me=Uu(S.props.triggerTarget||t);me.forEach(function(Oe){Oe.addEventListener(J,ne,de),p.push({node:Oe,eventType:J,handler:ne,options:de})})}function Tn(){B()&&(kt("touchstart",qr,{passive:!0}),kt("touchend",Jo,{passive:!0})),t9(S.props.trigger).forEach(function(J){if(J!=="manual")switch(kt(J,qr),J){case"mouseenter":kt("mouseleave",Jo);break;case"focus":kt(m9?"focusout":"blur",Uo);break;case"focusin":kt("focusout",Uo);break}})}function Pn(){p.forEach(function(J){var ne=J.node,de=J.eventType,me=J.handler,Oe=J.options;ne.removeEventListener(de,me,Oe)}),p=[]}function qr(J){var ne,de=!1;if(!(!S.state.isEnabled||_o(J)||a)){var me=((ne=c)==null?void 0:ne.type)==="focus";c=J,y=J.currentTarget,R(),!S.state.isVisible&&i9(J)&&cy.forEach(function(Oe){return Oe(J)}),J.type==="click"&&(S.props.trigger.indexOf("mouseenter")<0||s)&&S.props.hideOnClick!==!1&&S.state.isVisible?de=!0:Z(J),J.type==="click"&&(s=!de),de&&!me&&Y(J)}}function Bo(J){var ne=J.target,de=I().contains(ne)||x.contains(ne);if(!(J.type==="mousemove"&&de)){var me=_().concat(x).map(function(Oe){var Ze,yr=Oe._tippy,ja=(Ze=yr.popperInstance)==null?void 0:Ze.state;return ja?{popperRect:Oe.getBoundingClientRect(),popperState:ja,props:n}:null}).filter(Boolean);u9(me,J)&&(it(),Y(J))}}function Jo(J){var ne=_o(J)||S.props.trigger.indexOf("click")>=0&&s;if(!ne){if(S.props.interactive){S.hideWithInteractivity(J);return}Y(J)}}function Uo(J){S.props.trigger.indexOf("focusin")<0&&J.target!==I()||S.props.interactive&&J.relatedTarget&&x.contains(J.relatedTarget)||Y(J)}function _o(J){return To.isTouch?B()!==J.type.indexOf("touch")>=0:!1}function Ei(){P();var J=S.props,ne=J.popperOptions,de=J.placement,me=J.offset,Oe=J.getReferenceClientRect,Ze=J.moveTransition,yr=L()?R1(x).arrow:null,ja=Oe?{getBoundingClientRect:Oe,contextElement:Oe.contextElement||I()}:t,RR={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Dd){var Ha=Dd.state;if(L()){var f3=V(),Zv=f3.box;["placement","reference-hidden","escaped"].forEach(function(Fd){Fd==="placement"?Zv.setAttribute("data-placement",Ha.placement):Ha.attributes.popper["data-popper-"+Fd]?Zv.setAttribute("data-"+Fd,""):Zv.removeAttribute("data-"+Fd)}),Ha.attributes.popper={}}}},Cs=[{name:"offset",options:{offset:me}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ze}},RR];L()&&yr&&Cs.push({name:"arrow",options:{element:yr,padding:3}}),Cs.push.apply(Cs,ne?.modifiers||[]),S.popperInstance=w1(ja,x,Object.assign({},ne,{placement:de,onFirstUpdate:d,modifiers:Cs}))}function P(){S.popperInstance&&(S.popperInstance.destroy(),S.popperInstance=null)}function D(){var J=S.props.appendTo,ne,de=I();S.props.interactive&&J===aD||J==="parent"?ne=de.parentNode:ne=lD(J,[de]),ne.contains(x)||ne.appendChild(x),S.state.isMounted=!0,Ei()}function _(){return fy(x.querySelectorAll("[data-tippy-root]"))}function Z(J){S.clearDelayTimeouts(),J&&te("onTrigger",[S,J]),St();var ne=Q(!0),de=A(),me=de[0],Oe=de[1];To.isTouch&&me==="hold"&&Oe&&(ne=Oe),ne?r=setTimeout(function(){S.show()},ne):S.show()}function Y(J){if(S.clearDelayTimeouts(),te("onUntrigger",[S,J]),!S.state.isVisible){Cn();return}if(!(S.props.trigger.indexOf("mouseenter")>=0&&S.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(J.type)>=0&&s)){var ne=Q(!1);ne?o=setTimeout(function(){S.state.isVisible&&S.hide()},ne):i=requestAnimationFrame(function(){S.hide()})}}function W(){S.state.isEnabled=!0}function ce(){S.hide(),S.state.isEnabled=!1}function De(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)}function F(J){if(!S.state.isDestroyed){te("onBeforeUpdate",[S,J]),Pn();var ne=S.props,de=tD(t,Object.assign({},ne,XL(J),{ignoreAttributes:!0}));S.props=de,Tn(),ne.interactiveDebounce!==de.interactiveDebounce&&(it(),m=KL(Bo,de.interactiveDebounce)),ne.triggerTarget&&!de.triggerTarget?Uu(ne.triggerTarget).forEach(function(me){me.removeAttribute("aria-expanded")}):de.triggerTarget&&t.removeAttribute("aria-expanded"),R(),G(),T&&T(ne,de),S.popperInstance&&(Ei(),_().forEach(function(me){requestAnimationFrame(me._tippy.popperInstance.forceUpdate)})),te("onAfterUpdate",[S,J])}}function j(J){S.setProps({content:J})}function fe(){var J=S.state.isVisible,ne=S.state.isDestroyed,de=!S.state.isEnabled,me=To.isTouch&&!S.props.touch,Oe=x1(S.props.duration,0,so.duration);if(!(J||ne||de||me)&&!I().hasAttribute("disabled")&&(te("onShow",[S],!1),S.props.onShow(S)!==!1)){if(S.state.isVisible=!0,L()&&(x.style.visibility="visible"),G(),St(),S.state.isMounted||(x.style.transition="none"),L()){var Ze=V(),yr=Ze.box,ja=Ze.content;S1([yr,ja],0)}d=function(){var Cs;if(!(!S.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=S.props.moveTransition,L()&&S.props.animation){var Qv=V(),Dd=Qv.box,Ha=Qv.content;S1([Dd,Ha],Oe),QL([Dd,Ha],"visible")}we(),R(),YL(b1,S),(Cs=S.popperInstance)==null||Cs.forceUpdate(),te("onMount",[S]),S.props.animation&&L()&&Ve(Oe,function(){S.state.isShown=!0,te("onShown",[S])})}},D()}}function ze(){var J=!S.state.isVisible,ne=S.state.isDestroyed,de=!S.state.isEnabled,me=x1(S.props.duration,1,so.duration);if(!(J||ne||de)&&(te("onHide",[S],!1),S.props.onHide(S)!==!1)){if(S.state.isVisible=!1,S.state.isShown=!1,u=!1,s=!1,L()&&(x.style.visibility="hidden"),it(),Cn(),G(!0),L()){var Oe=V(),Ze=Oe.box,yr=Oe.content;S.props.animation&&(S1([Ze,yr],me),QL([Ze,yr],"hidden"))}we(),R(),S.props.animation?L()&&dn(me,S.unmount):S.unmount()}}function Fe(J){U().addEventListener("mousemove",m),YL(cy,m),m(J)}function Qt(){S.state.isVisible&&S.hide(),S.state.isMounted&&(P(),_().forEach(function(J){J._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),b1=b1.filter(function(J){return J!==S}),S.state.isMounted=!1,te("onHidden",[S]))}function gr(){S.state.isDestroyed||(S.clearDelayTimeouts(),S.unmount(),Pn(),delete t._tippy,S.state.isDestroyed=!0,te("onDestroy",[S]))}}function md(t,e){e===void 0&&(e={});var n=so.plugins.concat(e.plugins||[]);d9();var r=Object.assign({},e,{plugins:n}),o=a9(t);if(!1)var i,s;var a=o.reduce(function(l,u){var c=u&&k9(u,r);return c&&l.push(c),l},[]);return dy(t)?a[0]:a}md.defaultProps=so;md.setDefaultProps=v9;md.currentInput=To;var Ioe=Object.assign({},sd,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});md.setDefaultProps({render:fD});var dD=md;var T1=class{constructor({editor:e,element:n,view:r,tippyOptions:o={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:u,to:c})=>{let{doc:f,selection:d}=l,{empty:p}=d,m=!f.textBetween(u,c).length&&Zg(l.selection),y=this.element.contains(document.activeElement);return!(!(a.hasFocus()||y)||p||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a?.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{let u=!l?.selection.eq(a.state.selection),c=!l?.doc.eq(a.state.doc);!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{var f,d,p;let{state:m,composing:y}=a,{selection:w}=m;if(y||!l&&!u)return;this.createTooltip();let{ranges:v}=w,k=Math.min(...v.map(x=>x.$from.pos)),S=Math.max(...v.map(x=>x.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:a,state:m,oldState:c,from:k,to:S}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(TL(m.selection)){let x=a.nodeDOM(k),T=x.dataset.nodeViewWrapper?x:x.querySelector("[data-node-view-wrapper]");if(T&&(x=T.firstChild),x)return x.getBoundingClientRect()}return PL(a,k,S)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=i,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=dD(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){let{state:r}=e,o=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,n);return}let i=!n?.selection.eq(e.state.selection),s=!n?.doc.eq(e.state.doc);this.updateHandler(e,i,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},P1=t=>new At({key:typeof t.pluginKey=="string"?new an(t.pluginKey):t.pluginKey,view:e=>new T1({view:e,...t})}),Boe=Mr.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[P1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var Ce=q(ge(),1),py=q(vx(),1);var b9=({renderers:t})=>Ce.default.createElement(Ce.default.Fragment,null,Object.entries(t).map(([e,n])=>py.default.createPortal(n.reactElement,n.element,e))),O1=class extends Ce.default.Component{constructor(e){super(e),this.editorContentRef=Ce.default.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;let n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?(0,py.flushSync)(e):e()}setRenderer(e,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:n}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{let r={...n};return delete r[e],{renderers:r}})})}componentWillUnmount(){let{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;let n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){let{editor:e,...n}=this.props;return Ce.default.createElement(Ce.default.Fragment,null,Ce.default.createElement("div",{ref:this.editorContentRef,...n}),Ce.default.createElement(b9,{renderers:this.state.renderers}))}},E9=t=>{let e=Ce.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ce.default.createElement(O1,{key:e,...t})},M1=Ce.default.memo(E9),N1=class extends Kg{constructor(){super(...arguments),this.contentComponent=null}};function R9(){let[,t]=(0,Ce.useState)(0);return()=>t(e=>e+1)}var pD=(t={},e=[])=>{let[n,r]=(0,Ce.useState)(null),o=R9(),{onBeforeCreate:i,onBlur:s,onCreate:a,onDestroy:l,onFocus:u,onSelectionUpdate:c,onTransaction:f,onUpdate:d}=t,p=(0,Ce.useRef)(i),m=(0,Ce.useRef)(s),y=(0,Ce.useRef)(a),w=(0,Ce.useRef)(l),g=(0,Ce.useRef)(u),v=(0,Ce.useRef)(c),k=(0,Ce.useRef)(f),S=(0,Ce.useRef)(d);return(0,Ce.useEffect)(()=>{n&&(i&&(n.off("beforeCreate",p.current),n.on("beforeCreate",i),p.current=i),s&&(n.off("blur",m.current),n.on("blur",s),m.current=s),a&&(n.off("create",y.current),n.on("create",a),y.current=a),l&&(n.off("destroy",w.current),n.on("destroy",l),w.current=l),u&&(n.off("focus",g.current),n.on("focus",u),g.current=u),c&&(n.off("selectionUpdate",v.current),n.on("selectionUpdate",c),v.current=c),f&&(n.off("transaction",k.current),n.on("transaction",f),k.current=f),d&&(n.off("update",S.current),n.on("update",d),S.current=d))},[i,s,a,l,u,c,f,d,n]),(0,Ce.useEffect)(()=>{let b=!0,x=new N1(t);return r(x),x.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{b&&o()})})}),()=>{b=!1}},e),(0,Ce.useEffect)(()=>()=>{n?.destroy()},[n]),n},mD=(0,Ce.createContext)({editor:null}),Voe=mD.Consumer,C9=()=>(0,Ce.useContext)(mD);var hD=t=>{let[e,n]=(0,Ce.useState)(null),{editor:r}=C9();return(0,Ce.useEffect)(()=>{var o;if(!e||!((o=t.editor)===null||o===void 0)&&o.isDestroyed||r?.isDestroyed)return;let{pluginKey:i="bubbleMenu",editor:s,tippyOptions:a={},updateDelay:l,shouldShow:u=null}=t,c=s||r;if(!c){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}let f=P1({updateDelay:l,editor:c,element:e,pluginKey:i,shouldShow:u,tippyOptions:a});return c.registerPlugin(f),()=>c.unregisterPlugin(i)},[t.editor,r,e]),Ce.default.createElement("div",{ref:n,className:t.className,style:{visibility:"hidden"}},t.children)};var T9=(0,Ce.createContext)({onDragStart:void 0}),P9=()=>(0,Ce.useContext)(T9);var qoe=Ce.default.forwardRef((t,e)=>{let{onDragStart:n}=P9(),r=t.as||"div";return Ce.default.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});var O9=dr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",$t(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),gD=fr.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{let n=ny(t,this.type);return Object.entries(n).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}}),yD=/^\s*([-+*])\s$/,vD=dr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(O9.name,this.editor.getAttributes(gD.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=i1({find:yD,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=i1({find:yD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(gD.name),editor:this.editor})),[t]}});var wD=dr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",$t(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var xD=dr.create({name:"text",group:"inline"});var SD=dr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var kD=dr.create({name:"doc",topNode:!0,content:"block+"});var N9="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",M9="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Vu=(t,e)=>{for(let n in e)t[n]=e[n];return t},F1="numeric",B1="ascii",J1="alpha",vy="asciinumeric",my="alphanumeric",U1="domain",MD="emoji",I9="scheme",A9="slashscheme",bD="whitespace";function L9(t,e){return t in e||(e[t]=[]),e[t]}function Oa(t,e,n){e[F1]&&(e[vy]=!0,e[my]=!0),e[B1]&&(e[vy]=!0,e[J1]=!0),e[vy]&&(e[my]=!0),e[J1]&&(e[my]=!0),e[my]&&(e[U1]=!0),e[MD]&&(e[U1]=!0);for(let r in e){let o=L9(r,n);o.indexOf(t)<0&&o.push(t)}}function D9(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Xn(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Xn.groups={};Xn.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,o),Fr=(t,e,n,r,o)=>t.tr(e,n,r,o),ED=(t,e,n,r,o)=>t.ts(e,n,r,o),X=(t,e,n,r,o)=>t.tt(e,n,r,o),vi="WORD",_1="UWORD",vd="LOCALHOST",z1="TLD",V1="UTLD",wy="SCHEME",zu="SLASH_SCHEME",q1="NUM",ID="WS",j1="NL",hd="OPENBRACE",gd="CLOSEBRACE",xy="OPENBRACKET",Sy="CLOSEBRACKET",ky="OPENPAREN",by="CLOSEPAREN",Ey="OPENANGLEBRACKET",Ry="CLOSEANGLEBRACKET",Cy="FULLWIDTHLEFTPAREN",Ty="FULLWIDTHRIGHTPAREN",Py="LEFTCORNERBRACKET",Oy="RIGHTCORNERBRACKET",Ny="LEFTWHITECORNERBRACKET",My="RIGHTWHITECORNERBRACKET",Iy="FULLWIDTHLESSTHAN",Ay="FULLWIDTHGREATERTHAN",Ly="AMPERSAND",Dy="APOSTROPHE",Fy="ASTERISK",gs="AT",By="BACKSLASH",Jy="BACKTICK",Uy="CARET",ys="COLON",H1="COMMA",_y="DOLLAR",Po="DOT",zy="EQUALS",$1="EXCLAMATION",Oo="HYPHEN",Vy="PERCENT",qy="PIPE",jy="PLUS",Hy="POUND",$y="QUERY",W1="QUOTE",G1="SEMI",No="SLASH",yd="TILDE",Wy="UNDERSCORE",AD="EMOJI",Gy="SYM",LD=Object.freeze({__proto__:null,WORD:vi,UWORD:_1,LOCALHOST:vd,TLD:z1,UTLD:V1,SCHEME:wy,SLASH_SCHEME:zu,NUM:q1,WS:ID,NL:j1,OPENBRACE:hd,CLOSEBRACE:gd,OPENBRACKET:xy,CLOSEBRACKET:Sy,OPENPAREN:ky,CLOSEPAREN:by,OPENANGLEBRACKET:Ey,CLOSEANGLEBRACKET:Ry,FULLWIDTHLEFTPAREN:Cy,FULLWIDTHRIGHTPAREN:Ty,LEFTCORNERBRACKET:Py,RIGHTCORNERBRACKET:Oy,LEFTWHITECORNERBRACKET:Ny,RIGHTWHITECORNERBRACKET:My,FULLWIDTHLESSTHAN:Iy,FULLWIDTHGREATERTHAN:Ay,AMPERSAND:Ly,APOSTROPHE:Dy,ASTERISK:Fy,AT:gs,BACKSLASH:By,BACKTICK:Jy,CARET:Uy,COLON:ys,COMMA:H1,DOLLAR:_y,DOT:Po,EQUALS:zy,EXCLAMATION:$1,HYPHEN:Oo,PERCENT:Vy,PIPE:qy,PLUS:jy,POUND:Hy,QUERY:$y,QUOTE:W1,SEMI:G1,SLASH:No,TILDE:yd,UNDERSCORE:Wy,EMOJI:AD,SYM:Gy}),_u=/[a-z]/,I1=/\p{L}/u,A1=/\p{Emoji}/u;var L1=/\d/,RD=/\s/;var CD=` -`,F9="\uFE0F",B9="\u200D",hy=null,gy=null;function J9(t){t===void 0&&(t=[]);let e={};Xn.groups=e;let n=new Xn;hy==null&&(hy=TD(N9)),gy==null&&(gy=TD(M9)),X(n,"'",Dy),X(n,"{",hd),X(n,"}",gd),X(n,"[",xy),X(n,"]",Sy),X(n,"(",ky),X(n,")",by),X(n,"<",Ey),X(n,">",Ry),X(n,"\uFF08",Cy),X(n,"\uFF09",Ty),X(n,"\u300C",Py),X(n,"\u300D",Oy),X(n,"\u300E",Ny),X(n,"\u300F",My),X(n,"\uFF1C",Iy),X(n,"\uFF1E",Ay),X(n,"&",Ly),X(n,"*",Fy),X(n,"@",gs),X(n,"`",Jy),X(n,"^",Uy),X(n,":",ys),X(n,",",H1),X(n,"$",_y),X(n,".",Po),X(n,"=",zy),X(n,"!",$1),X(n,"-",Oo),X(n,"%",Vy),X(n,"|",qy),X(n,"+",jy),X(n,"#",Hy),X(n,"?",$y),X(n,'"',W1),X(n,"/",No),X(n,";",G1),X(n,"~",yd),X(n,"_",Wy),X(n,"\\",By);let r=Fr(n,L1,q1,{[F1]:!0});Fr(r,L1,r);let o=Fr(n,_u,vi,{[B1]:!0});Fr(o,_u,o);let i=Fr(n,I1,_1,{[J1]:!0});Fr(i,_u),Fr(i,I1,i);let s=Fr(n,RD,ID,{[bD]:!0});X(n,CD,j1,{[bD]:!0}),X(s,CD),Fr(s,RD,s);let a=Fr(n,A1,AD,{[MD]:!0});Fr(a,A1,a),X(a,F9,a);let l=X(a,B9);Fr(l,A1,a);let u=[[_u,o]],c=[[_u,null],[I1,i]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?m[U1]=!0:_u.test(d)?L1.test(d)?m[vy]=!0:m[B1]=!0:m[F1]=!0,ED(n,d,d,m)}return ED(n,"localhost",vd,{ascii:!0}),n.jd=new Xn(Gy),{start:n,tokens:Vu({groups:e},LD)}}function U9(t,e){let n=_9(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[],i=0,s=0;for(;s=0&&(f+=n[s].length,d++),u+=n[s].length,i+=n[s].length,s++;i-=f,s-=d,u-=f,o.push({t:c.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function _9(t){let e=[],n=t.length,r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function hs(t,e,n,r,o){let i,s=e.length;for(let a=0;a=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}var wd={defaultProtocol:"http",events:null,format:PD,formatHref:PD,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function K1(t,e){e===void 0&&(e=null);let n=Vu({},wd);t&&(n=Vu(n,t instanceof K1?t.o:t));let r=n.ignoreTags,o=[];for(let i=0;in?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=wd.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),c&&Vu(s,c),{tagName:o,attributes:s,content:i,eventListeners:f}}};function Ky(t,e){class n extends DD{constructor(o,i){super(o,i),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var OD=Ky("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),ND=Ky("text"),z9=Ky("nl"),yy=Ky("url",{isLink:!0,toHref(t){return t===void 0&&(t=wd.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==vd&&t[1].t===ys}});var Br=t=>new Xn(t);function V9(t){let{groups:e}=t,n=e.domain.concat([Ly,Fy,gs,By,Jy,Uy,_y,zy,Oo,q1,Vy,qy,jy,Hy,No,Gy,yd,Wy]),r=[Dy,ys,H1,Po,$1,$y,W1,G1,Ey,Ry,hd,gd,Sy,xy,ky,by,Cy,Ty,Py,Oy,Ny,My,Iy,Ay],o=[Ly,Dy,Fy,By,Jy,Uy,_y,zy,Oo,hd,gd,Vy,qy,jy,Hy,$y,No,Gy,yd,Wy],i=Br(),s=X(i,yd);Re(s,o,s),Re(s,e.domain,s);let a=Br(),l=Br(),u=Br();Re(i,e.domain,a),Re(i,e.scheme,l),Re(i,e.slashscheme,u),Re(a,o,s),Re(a,e.domain,a);let c=X(a,gs);X(s,gs,c),X(l,gs,c),X(u,gs,c);let f=X(s,Po);Re(f,o,s),Re(f,e.domain,s);let d=Br();Re(c,e.domain,d),Re(d,e.domain,d);let p=X(d,Po);Re(p,e.domain,d);let m=Br(OD);Re(p,e.tld,m),Re(p,e.utld,m),X(c,vd,m);let y=X(d,Oo);Re(y,e.domain,d),Re(m,e.domain,d),X(m,Po,p),X(m,Oo,y);let w=X(m,ys);Re(w,e.numeric,OD);let g=X(a,Oo),v=X(a,Po);Re(g,e.domain,a),Re(v,o,s),Re(v,e.domain,a);let k=Br(yy);Re(v,e.tld,k),Re(v,e.utld,k),Re(k,e.domain,a),Re(k,o,s),X(k,Po,v),X(k,Oo,g),X(k,gs,c);let S=X(k,ys),b=Br(yy);Re(S,e.numeric,b);let x=Br(yy),T=Br();Re(x,n,x),Re(x,r,T),Re(T,n,x),Re(T,r,T),X(k,No,x),X(b,No,x);let E=X(l,ys),O=X(u,ys),A=X(O,No),B=X(A,No);Re(l,e.domain,a),X(l,Po,v),X(l,Oo,g),Re(u,e.domain,a),X(u,Po,v),X(u,Oo,g),Re(E,e.domain,x),X(E,No,x),Re(B,e.domain,x),Re(B,n,x),X(B,No,x);let L=[[hd,gd],[xy,Sy],[ky,by],[Ey,Ry],[Cy,Ty],[Py,Oy],[Ny,My],[Iy,Ay]];for(let I=0;I=0&&d++,o++,c++;if(d<0)o-=c,o0&&(i.push(D1(ND,e,s)),s=[]),o-=d,c-=d;let p=f.t,m=n.slice(o-c,o);i.push(D1(p,e,m))}}return s.length>0&&i.push(D1(ND,e,s)),i}function D1(t,e,n){let r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}var j9=typeof console<"u"&&console&&console.warn||(()=>{}),H9="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",mt={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function FD(){Xn.groups={},mt.scanner=null,mt.parser=null,mt.tokenQueue=[],mt.pluginQueue=[],mt.customSchemes=[],mt.initialized=!1}function Y1(t,e){if(e===void 0&&(e=!1),mt.initialized&&j9(`linkifyjs: already initialized - will not register custom scheme "${t}" ${H9}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. +`,textSerializers:r={}}=e||{};return Tj(this.state.doc,{blockSeparator:n,textSerializers:{...CL(this.schema),...r}})}get isEmpty(){return Ij(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){this.emit("destroy"),this.view&&this.view.destroy(),this.removeAllListeners()}get isDestroyed(){var e;return!(!((e=this.view)===null||e===void 0)&&e.docView)}};function To(t){return new Ru({find:t.find,handler:({state:e,range:n,match:r})=>{let o=Ie(t.getAttributes,void 0,r);if(o===!1||o===null)return null;let{tr:i}=e,s=r[r.length-1],a=r[0];if(s){let l=a.search(/\S/),u=n.from+a.indexOf(s),c=u+s.length;if(sy(n.from,n.to,e.doc).filter(p=>p.mark.type.excluded.find(y=>y===t.type&&y!==p.mark.type)).filter(p=>p.to>u).length)return null;cn.from&&i.delete(n.from+l,u);let d=n.from+l+s.length;i.addMark(n.from+l,d,t.type.create(o||{})),i.removeStoredMark(t.type)}}})}function t1(t){return new Ru({find:t.find,handler:({state:e,range:n,match:r,chain:o})=>{let i=Ie(t.getAttributes,void 0,r)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),u=l&&mu(l,t.type,i);if(!u)return null;if(s.wrap(l,u),t.keepMarks&&t.editor){let{selection:f,storedMarks:d}=e,{splittableMarks:p}=t.editor.extensionManager,m=d||f.$to.parentOffset&&f.$from.marks();if(m){let y=m.filter(w=>p.includes(w.type.name));s.ensureMarks(y)}}if(t.keepAttributes){let f=t.type.name==="bulletList"||t.type.name==="orderedList"?"listItem":"taskList";o().updateAttributes(f,i).run()}let c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===t.type&&no(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(r,c))&&s.join(n.from-1)}})}var dr=class t{constructor(e={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(ae(this,"addOptions",{name:this.name}))),this.storage=Ie(ae(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=ty(this.options,e),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ie(ae(n,"addOptions",{name:n.name})),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}static handleExit({editor:e,mark:n}){let{tr:r}=e.state,o=e.state.selection.$from;if(o.pos===o.end()){let s=o.marks();if(!!!s.find(u=>u?.type.name===n.name))return!1;let l=s.find(u=>u?.type.name===n.name);return l&&r.removeStoredMark(l),r.insertText(" ",o.pos),e.view.dispatch(r),!0}return!1}},pr=class t{constructor(e={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...e},this.name=this.config.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=Ie(ae(this,"addOptions",{name:this.name}))),this.storage=Ie(ae(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(e={}){return new t(e)}configure(e={}){let n=this.extend();return n.options=ty(this.options,e),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}extend(e={}){let n=new t(e);return n.parent=this,this.child=n,n.name=e.name?e.name:n.parent.name,e.defaultOptions&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${n.name}".`),n.options=Ie(ae(n,"addOptions",{name:n.name})),n.storage=Ie(ae(n,"addStorage",{name:n.name,options:n.options})),n}};function Lr(t){return new od({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{let i=Ie(t.getAttributes,void 0,r,o);if(i===!1||i===null)return null;let{tr:s}=e,a=r[r.length-1],l=r[0],u=n.to;if(a){let c=l.search(/\S/),f=n.from+l.indexOf(a),d=f+a.length;if(sy(n.from,n.to,e.doc).filter(m=>m.mark.type.excluded.find(w=>w===t.type&&w!==m.mark.type)).filter(m=>m.to>f).length)return null;dn.from&&s.delete(n.from+c,f),u=n.from+c+a.length,s.addMark(n.from+c,u,t.type.create(i||{})),s.removeStoredMark(t.type)}}})}var wt="top",Jt="bottom",Dt="right",Ct="left",ay="auto",ms=[wt,Jt,Dt,Ct],gi="start",ba="end",LL="clippingParents",ly="viewport",Cu="popper",DL="reference",n1=ms.reduce(function(t,e){return t.concat([e+"-"+gi,e+"-"+ba])},[]),uy=[].concat(ms,[ay]).reduce(function(t,e){return t.concat([e,e+"-"+gi,e+"-"+ba])},[]),a6="beforeRead",l6="read",u6="afterRead",c6="beforeMain",f6="main",d6="afterMain",p6="beforeWrite",m6="write",h6="afterWrite",FL=[a6,l6,u6,c6,f6,d6,p6,m6,h6];function Gt(t){return t?(t.nodeName||"").toLowerCase():null}function ut(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var e=t.ownerDocument;return e&&e.defaultView||window}return t}function Dr(t){var e=ut(t).Element;return t instanceof e||t instanceof Element}function Ut(t){var e=ut(t).HTMLElement;return t instanceof e||t instanceof HTMLElement}function Tu(t){if(typeof ShadowRoot>"u")return!1;var e=ut(t).ShadowRoot;return t instanceof e||t instanceof ShadowRoot}function g6(t){var e=t.state;Object.keys(e.elements).forEach(function(n){var r=e.styles[n]||{},o=e.attributes[n]||{},i=e.elements[n];!Ut(i)||!Gt(i)||(Object.assign(i.style,r),Object.keys(o).forEach(function(s){var a=o[s];a===!1?i.removeAttribute(s):i.setAttribute(s,a===!0?"":a)}))})}function y6(t){var e=t.state,n={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,n.popper),e.styles=n,e.elements.arrow&&Object.assign(e.elements.arrow.style,n.arrow),function(){Object.keys(e.elements).forEach(function(r){var o=e.elements[r],i=e.attributes[r]||{},s=Object.keys(e.styles.hasOwnProperty(r)?e.styles[r]:n[r]),a=s.reduce(function(l,u){return l[u]="",l},{});!Ut(o)||!Gt(o)||(Object.assign(o.style,a),Object.keys(i).forEach(function(l){o.removeAttribute(l)}))})}}var sd={name:"applyStyles",enabled:!0,phase:"write",fn:g6,effect:y6,requires:["computeStyles"]};function Kt(t){return t.split("-")[0]}var io=Math.max,Ea=Math.min,yi=Math.round;function Pu(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function ad(){return!/^((?!chrome|android).)*safari/i.test(Pu())}function Fr(t,e,n){e===void 0&&(e=!1),n===void 0&&(n=!1);var r=t.getBoundingClientRect(),o=1,i=1;e&&Ut(t)&&(o=t.offsetWidth>0&&yi(r.width)/t.offsetWidth||1,i=t.offsetHeight>0&&yi(r.height)/t.offsetHeight||1);var s=Dr(t)?ut(t):window,a=s.visualViewport,l=!ad()&&n,u=(r.left+(l&&a?a.offsetLeft:0))/o,c=(r.top+(l&&a?a.offsetTop:0))/i,f=r.width/o,d=r.height/i;return{width:f,height:d,top:c,right:u+f,bottom:c+d,left:u,x:u,y:c}}function Ra(t){var e=Fr(t),n=t.offsetWidth,r=t.offsetHeight;return Math.abs(e.width-n)<=1&&(n=e.width),Math.abs(e.height-r)<=1&&(r=e.height),{x:t.offsetLeft,y:t.offsetTop,width:n,height:r}}function ld(t,e){var n=e.getRootNode&&e.getRootNode();if(t.contains(e))return!0;if(n&&Tu(n)){var r=e;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function zn(t){return ut(t).getComputedStyle(t)}function r1(t){return["table","td","th"].indexOf(Gt(t))>=0}function ln(t){return((Dr(t)?t.ownerDocument:t.document)||window.document).documentElement}function vi(t){return Gt(t)==="html"?t:t.assignedSlot||t.parentNode||(Tu(t)?t.host:null)||ln(t)}function BL(t){return!Ut(t)||zn(t).position==="fixed"?null:t.offsetParent}function v6(t){var e=/firefox/i.test(Pu()),n=/Trident/i.test(Pu());if(n&&Ut(t)){var r=zn(t);if(r.position==="fixed")return null}var o=vi(t);for(Tu(o)&&(o=o.host);Ut(o)&&["html","body"].indexOf(Gt(o))<0;){var i=zn(o);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return o;o=o.parentNode}return null}function so(t){for(var e=ut(t),n=BL(t);n&&r1(n)&&zn(n).position==="static";)n=BL(n);return n&&(Gt(n)==="html"||Gt(n)==="body"&&zn(n).position==="static")?e:n||v6(t)||e}function Ca(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function Ta(t,e,n){return io(t,Ea(e,n))}function JL(t,e,n){var r=Ta(t,e,n);return r>n?n:r}function ud(){return{top:0,right:0,bottom:0,left:0}}function cd(t){return Object.assign({},ud(),t)}function fd(t,e){return e.reduce(function(n,r){return n[r]=t,n},{})}var w6=function(e,n){return e=typeof e=="function"?e(Object.assign({},n.rects,{placement:n.placement})):e,cd(typeof e!="number"?e:fd(e,ms))};function x6(t){var e,n=t.state,r=t.name,o=t.options,i=n.elements.arrow,s=n.modifiersData.popperOffsets,a=Kt(n.placement),l=Ca(a),u=[Ct,Dt].indexOf(a)>=0,c=u?"height":"width";if(!(!i||!s)){var f=w6(o.padding,n),d=Ra(i),p=l==="y"?wt:Ct,m=l==="y"?Jt:Dt,y=n.rects.reference[c]+n.rects.reference[l]-s[l]-n.rects.popper[c],w=s[l]-n.rects.reference[l],g=so(i),v=g?l==="y"?g.clientHeight||0:g.clientWidth||0:0,k=y/2-w/2,S=f[p],b=v-d[c]-f[m],x=v/2-d[c]/2+k,R=Ta(S,x,b),E=l;n.modifiersData[r]=(e={},e[E]=R,e.centerOffset=R-x,e)}}function S6(t){var e=t.state,n=t.options,r=n.element,o=r===void 0?"[data-popper-arrow]":r;o!=null&&(typeof o=="string"&&(o=e.elements.popper.querySelector(o),!o)||ld(e.elements.popper,o)&&(e.elements.arrow=o))}var UL={name:"arrow",enabled:!0,phase:"main",fn:x6,effect:S6,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function Br(t){return t.split("-")[1]}var k6={top:"auto",right:"auto",bottom:"auto",left:"auto"};function b6(t,e){var n=t.x,r=t.y,o=e.devicePixelRatio||1;return{x:yi(n*o)/o||0,y:yi(r*o)/o||0}}function _L(t){var e,n=t.popper,r=t.popperRect,o=t.placement,i=t.variation,s=t.offsets,a=t.position,l=t.gpuAcceleration,u=t.adaptive,c=t.roundOffsets,f=t.isFixed,d=s.x,p=d===void 0?0:d,m=s.y,y=m===void 0?0:m,w=typeof c=="function"?c({x:p,y}):{x:p,y};p=w.x,y=w.y;var g=s.hasOwnProperty("x"),v=s.hasOwnProperty("y"),k=Ct,S=wt,b=window;if(u){var x=so(n),R="clientHeight",E="clientWidth";if(x===ut(n)&&(x=ln(n),zn(x).position!=="static"&&a==="absolute"&&(R="scrollHeight",E="scrollWidth")),x=x,o===wt||(o===Ct||o===Dt)&&i===ba){S=Jt;var O=f&&x===b&&b.visualViewport?b.visualViewport.height:x[R];y-=O-r.height,y*=l?1:-1}if(o===Ct||(o===wt||o===Jt)&&i===ba){k=Dt;var I=f&&x===b&&b.visualViewport?b.visualViewport.width:x[E];p-=I-r.width,p*=l?1:-1}}var B=Object.assign({position:a},u&&k6),L=c===!0?b6({x:p,y},ut(n)):{x:p,y};if(p=L.x,y=L.y,l){var A;return Object.assign({},B,(A={},A[S]=v?"0":"",A[k]=g?"0":"",A.transform=(b.devicePixelRatio||1)<=1?"translate("+p+"px, "+y+"px)":"translate3d("+p+"px, "+y+"px, 0)",A))}return Object.assign({},B,(e={},e[S]=v?y+"px":"",e[k]=g?p+"px":"",e.transform="",e))}function E6(t){var e=t.state,n=t.options,r=n.gpuAcceleration,o=r===void 0?!0:r,i=n.adaptive,s=i===void 0?!0:i,a=n.roundOffsets,l=a===void 0?!0:a,u={placement:Kt(e.placement),variation:Br(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:o,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,_L(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:l})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,_L(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:l})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}var zL={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:E6,data:{}};var cy={passive:!0};function R6(t){var e=t.state,n=t.instance,r=t.options,o=r.scroll,i=o===void 0?!0:o,s=r.resize,a=s===void 0?!0:s,l=ut(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(c){c.addEventListener("scroll",n.update,cy)}),a&&l.addEventListener("resize",n.update,cy),function(){i&&u.forEach(function(c){c.removeEventListener("scroll",n.update,cy)}),a&&l.removeEventListener("resize",n.update,cy)}}var VL={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:R6,data:{}};var C6={left:"right",right:"left",bottom:"top",top:"bottom"};function Ou(t){return t.replace(/left|right|bottom|top/g,function(e){return C6[e]})}var T6={start:"end",end:"start"};function fy(t){return t.replace(/start|end/g,function(e){return T6[e]})}function Pa(t){var e=ut(t),n=e.pageXOffset,r=e.pageYOffset;return{scrollLeft:n,scrollTop:r}}function Oa(t){return Fr(ln(t)).left+Pa(t).scrollLeft}function o1(t,e){var n=ut(t),r=ln(t),o=n.visualViewport,i=r.clientWidth,s=r.clientHeight,a=0,l=0;if(o){i=o.width,s=o.height;var u=ad();(u||!u&&e==="fixed")&&(a=o.offsetLeft,l=o.offsetTop)}return{width:i,height:s,x:a+Oa(t),y:l}}function i1(t){var e,n=ln(t),r=Pa(t),o=(e=t.ownerDocument)==null?void 0:e.body,i=io(n.scrollWidth,n.clientWidth,o?o.scrollWidth:0,o?o.clientWidth:0),s=io(n.scrollHeight,n.clientHeight,o?o.scrollHeight:0,o?o.clientHeight:0),a=-r.scrollLeft+Oa(t),l=-r.scrollTop;return zn(o||n).direction==="rtl"&&(a+=io(n.clientWidth,o?o.clientWidth:0)-i),{width:i,height:s,x:a,y:l}}function Na(t){var e=zn(t),n=e.overflow,r=e.overflowX,o=e.overflowY;return/auto|scroll|overlay|hidden/.test(n+o+r)}function dy(t){return["html","body","#document"].indexOf(Gt(t))>=0?t.ownerDocument.body:Ut(t)&&Na(t)?t:dy(vi(t))}function hs(t,e){var n;e===void 0&&(e=[]);var r=dy(t),o=r===((n=t.ownerDocument)==null?void 0:n.body),i=ut(r),s=o?[i].concat(i.visualViewport||[],Na(r)?r:[]):r,a=e.concat(s);return o?a:a.concat(hs(vi(s)))}function Nu(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function P6(t,e){var n=Fr(t,!1,e==="fixed");return n.top=n.top+t.clientTop,n.left=n.left+t.clientLeft,n.bottom=n.top+t.clientHeight,n.right=n.left+t.clientWidth,n.width=t.clientWidth,n.height=t.clientHeight,n.x=n.left,n.y=n.top,n}function qL(t,e,n){return e===ly?Nu(o1(t,n)):Dr(e)?P6(e,n):Nu(i1(ln(t)))}function O6(t){var e=hs(vi(t)),n=["absolute","fixed"].indexOf(zn(t).position)>=0,r=n&&Ut(t)?so(t):t;return Dr(r)?e.filter(function(o){return Dr(o)&&ld(o,r)&&Gt(o)!=="body"}):[]}function s1(t,e,n,r){var o=e==="clippingParents"?O6(t):[].concat(e),i=[].concat(o,[n]),s=i[0],a=i.reduce(function(l,u){var c=qL(t,u,r);return l.top=io(c.top,l.top),l.right=Ea(c.right,l.right),l.bottom=Ea(c.bottom,l.bottom),l.left=io(c.left,l.left),l},qL(t,s,r));return a.width=a.right-a.left,a.height=a.bottom-a.top,a.x=a.left,a.y=a.top,a}function dd(t){var e=t.reference,n=t.element,r=t.placement,o=r?Kt(r):null,i=r?Br(r):null,s=e.x+e.width/2-n.width/2,a=e.y+e.height/2-n.height/2,l;switch(o){case wt:l={x:s,y:e.y-n.height};break;case Jt:l={x:s,y:e.y+e.height};break;case Dt:l={x:e.x+e.width,y:a};break;case Ct:l={x:e.x-n.width,y:a};break;default:l={x:e.x,y:e.y}}var u=o?Ca(o):null;if(u!=null){var c=u==="y"?"height":"width";switch(i){case gi:l[u]=l[u]-(e[c]/2-n[c]/2);break;case ba:l[u]=l[u]+(e[c]/2-n[c]/2);break;default:}}return l}function ao(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=r===void 0?t.placement:r,i=n.strategy,s=i===void 0?t.strategy:i,a=n.boundary,l=a===void 0?LL:a,u=n.rootBoundary,c=u===void 0?ly:u,f=n.elementContext,d=f===void 0?Cu:f,p=n.altBoundary,m=p===void 0?!1:p,y=n.padding,w=y===void 0?0:y,g=cd(typeof w!="number"?w:fd(w,ms)),v=d===Cu?DL:Cu,k=t.rects.popper,S=t.elements[m?v:d],b=s1(Dr(S)?S:S.contextElement||ln(t.elements.popper),l,c,s),x=Fr(t.elements.reference),R=dd({reference:x,element:k,strategy:"absolute",placement:o}),E=Nu(Object.assign({},k,R)),O=d===Cu?E:x,I={top:b.top-O.top+g.top,bottom:O.bottom-b.bottom+g.bottom,left:b.left-O.left+g.left,right:O.right-b.right+g.right},B=t.modifiersData.offset;if(d===Cu&&B){var L=B[o];Object.keys(I).forEach(function(A){var U=[Dt,Jt].indexOf(A)>=0?1:-1,V=[wt,Jt].indexOf(A)>=0?"y":"x";I[A]+=L[V]*U})}return I}function a1(t,e){e===void 0&&(e={});var n=e,r=n.placement,o=n.boundary,i=n.rootBoundary,s=n.padding,a=n.flipVariations,l=n.allowedAutoPlacements,u=l===void 0?uy:l,c=Br(r),f=c?a?n1:n1.filter(function(m){return Br(m)===c}):ms,d=f.filter(function(m){return u.indexOf(m)>=0});d.length===0&&(d=f);var p=d.reduce(function(m,y){return m[y]=ao(t,{placement:y,boundary:o,rootBoundary:i,padding:s})[Kt(y)],m},{});return Object.keys(p).sort(function(m,y){return p[m]-p[y]})}function N6(t){if(Kt(t)===ay)return[];var e=Ou(t);return[fy(t),e,fy(e)]}function M6(t){var e=t.state,n=t.options,r=t.name;if(!e.modifiersData[r]._skip){for(var o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,a=s===void 0?!0:s,l=n.fallbackPlacements,u=n.padding,c=n.boundary,f=n.rootBoundary,d=n.altBoundary,p=n.flipVariations,m=p===void 0?!0:p,y=n.allowedAutoPlacements,w=e.options.placement,g=Kt(w),v=g===w,k=l||(v||!m?[Ou(w)]:N6(w)),S=[w].concat(k).reduce(function(Qe,St){return Qe.concat(Kt(St)===ay?a1(e,{placement:St,boundary:c,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:y}):St)},[]),b=e.rects.reference,x=e.rects.popper,R=new Map,E=!0,O=S[0],I=0;I=0,V=U?"width":"height",Q=ao(e,{placement:B,boundary:c,rootBoundary:f,altBoundary:d,padding:u}),G=U?A?Dt:Ct:A?Jt:wt;b[V]>x[V]&&(G=Ou(G));var te=Ou(G),ve=[];if(i&&ve.push(Q[L]<=0),a&&ve.push(Q[G]<=0,Q[te]<=0),ve.every(function(Qe){return Qe})){O=B,E=!1;break}R.set(B,ve)}if(E)for(var C=m?3:1,it=function(St){var Tn=S.find(function(dn){var Ve=R.get(dn);if(Ve)return Ve.slice(0,St).every(function(pn){return pn})});if(Tn)return O=Tn,"break"},ct=C;ct>0;ct--){var T=it(ct);if(T==="break")break}e.placement!==O&&(e.modifiersData[r]._skip=!0,e.placement=O,e.reset=!0)}}var jL={name:"flip",enabled:!0,phase:"main",fn:M6,requiresIfExists:["offset"],data:{_skip:!1}};function HL(t,e,n){return n===void 0&&(n={x:0,y:0}),{top:t.top-e.height-n.y,right:t.right-e.width+n.x,bottom:t.bottom-e.height+n.y,left:t.left-e.width-n.x}}function $L(t){return[wt,Dt,Jt,Ct].some(function(e){return t[e]>=0})}function I6(t){var e=t.state,n=t.name,r=e.rects.reference,o=e.rects.popper,i=e.modifiersData.preventOverflow,s=ao(e,{elementContext:"reference"}),a=ao(e,{altBoundary:!0}),l=HL(s,r),u=HL(a,o,i),c=$L(l),f=$L(u);e.modifiersData[n]={referenceClippingOffsets:l,popperEscapeOffsets:u,isReferenceHidden:c,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":c,"data-popper-escaped":f})}var WL={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:I6};function A6(t,e,n){var r=Kt(t),o=[Ct,wt].indexOf(r)>=0?-1:1,i=typeof n=="function"?n(Object.assign({},e,{placement:t})):n,s=i[0],a=i[1];return s=s||0,a=(a||0)*o,[Ct,Dt].indexOf(r)>=0?{x:a,y:s}:{x:s,y:a}}function L6(t){var e=t.state,n=t.options,r=t.name,o=n.offset,i=o===void 0?[0,0]:o,s=uy.reduce(function(c,f){return c[f]=A6(f,e.rects,i),c},{}),a=s[e.placement],l=a.x,u=a.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=l,e.modifiersData.popperOffsets.y+=u),e.modifiersData[r]=s}var GL={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:L6};function D6(t){var e=t.state,n=t.name;e.modifiersData[n]=dd({reference:e.rects.reference,element:e.rects.popper,strategy:"absolute",placement:e.placement})}var KL={name:"popperOffsets",enabled:!0,phase:"read",fn:D6,data:{}};function l1(t){return t==="x"?"y":"x"}function F6(t){var e=t.state,n=t.options,r=t.name,o=n.mainAxis,i=o===void 0?!0:o,s=n.altAxis,a=s===void 0?!1:s,l=n.boundary,u=n.rootBoundary,c=n.altBoundary,f=n.padding,d=n.tether,p=d===void 0?!0:d,m=n.tetherOffset,y=m===void 0?0:m,w=ao(e,{boundary:l,rootBoundary:u,padding:f,altBoundary:c}),g=Kt(e.placement),v=Br(e.placement),k=!v,S=Ca(g),b=l1(S),x=e.modifiersData.popperOffsets,R=e.rects.reference,E=e.rects.popper,O=typeof y=="function"?y(Object.assign({},e.rects,{placement:e.placement})):y,I=typeof O=="number"?{mainAxis:O,altAxis:O}:Object.assign({mainAxis:0,altAxis:0},O),B=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,L={x:0,y:0};if(x){if(i){var A,U=S==="y"?wt:Ct,V=S==="y"?Jt:Dt,Q=S==="y"?"height":"width",G=x[S],te=G+w[U],ve=G-w[V],C=p?-E[Q]/2:0,it=v===gi?R[Q]:E[Q],ct=v===gi?-E[Q]:-R[Q],T=e.elements.arrow,Qe=p&&T?Ra(T):{width:0,height:0},St=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:ud(),Tn=St[U],dn=St[V],Ve=Ta(0,R[Q],Qe[Q]),pn=k?R[Q]/2-C-Ve-Tn-I.mainAxis:it-Ve-Tn-I.mainAxis,kt=k?-R[Q]/2+C+Ve+dn+I.mainAxis:ct+Ve+dn+I.mainAxis,Pn=e.elements.arrow&&so(e.elements.arrow),On=Pn?S==="y"?Pn.clientTop||0:Pn.clientLeft||0:0,Hr=(A=B?.[S])!=null?A:0,Jo=G+pn-Hr-On,Uo=G+kt-Hr,_o=Ta(p?Ea(te,Jo):te,G,p?io(ve,Uo):ve);x[S]=_o,L[S]=_o-G}if(a){var zo,Ri=S==="x"?wt:Ct,P=S==="x"?Jt:Dt,D=x[b],_=b==="y"?"height":"width",Z=D+w[Ri],Y=D-w[P],W=[wt,Ct].indexOf(g)!==-1,ue=(zo=B?.[b])!=null?zo:0,De=W?Z:D-R[_]-E[_]-ue+I.altAxis,F=W?D+R[_]+E[_]-ue-I.altAxis:Y,j=p&&W?JL(De,D,F):Ta(p?De:Z,D,p?F:Y);x[b]=j,L[b]=j-D}e.modifiersData[r]=L}}var YL={name:"preventOverflow",enabled:!0,phase:"main",fn:F6,requiresIfExists:["offset"]};function u1(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function c1(t){return t===ut(t)||!Ut(t)?Pa(t):u1(t)}function B6(t){var e=t.getBoundingClientRect(),n=yi(e.width)/t.offsetWidth||1,r=yi(e.height)/t.offsetHeight||1;return n!==1||r!==1}function f1(t,e,n){n===void 0&&(n=!1);var r=Ut(e),o=Ut(e)&&B6(e),i=ln(e),s=Fr(t,o,n),a={scrollLeft:0,scrollTop:0},l={x:0,y:0};return(r||!r&&!n)&&((Gt(e)!=="body"||Na(i))&&(a=c1(e)),Ut(e)?(l=Fr(e,!0),l.x+=e.clientLeft,l.y+=e.clientTop):i&&(l.x=Oa(i))),{x:s.left+a.scrollLeft-l.x,y:s.top+a.scrollTop-l.y,width:s.width,height:s.height}}function J6(t){var e=new Map,n=new Set,r=[];t.forEach(function(i){e.set(i.name,i)});function o(i){n.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(a){if(!n.has(a)){var l=e.get(a);l&&o(l)}}),r.push(i)}return t.forEach(function(i){n.has(i.name)||o(i)}),r}function d1(t){var e=J6(t);return FL.reduce(function(n,r){return n.concat(e.filter(function(o){return o.phase===r}))},[])}function p1(t){var e;return function(){return e||(e=new Promise(function(n){Promise.resolve().then(function(){e=void 0,n(t())})})),e}}function m1(t){var e=t.reduce(function(n,r){var o=n[r.name];return n[r.name]=o?Object.assign({},o,r,{options:Object.assign({},o.options,r.options),data:Object.assign({},o.data,r.data)}):r,n},{});return Object.keys(e).map(function(n){return e[n]})}var XL={placement:"bottom",modifiers:[],strategy:"absolute"};function QL(){for(var t=arguments.length,e=new Array(t),n=0;n-1}function pD(t,e){return typeof t=="function"?t.apply(void 0,e):t}function eD(t,e){if(e===0)return t;var n;return function(r){clearTimeout(n),n=setTimeout(function(){t(r)},e)}}function V6(t){return t.split(/\s+/).filter(Boolean)}function Mu(t){return[].concat(t)}function tD(t,e){t.indexOf(e)===-1&&t.push(e)}function q6(t){return t.filter(function(e,n){return t.indexOf(e)===n})}function j6(t){return t.split("-")[0]}function my(t){return[].slice.call(t)}function nD(t){return Object.keys(t).reduce(function(e,n){return t[n]!==void 0&&(e[n]=t[n]),e},{})}function pd(){return document.createElement("div")}function hy(t){return["Element","Fragment"].some(function(e){return k1(t,e)})}function H6(t){return k1(t,"NodeList")}function $6(t){return k1(t,"MouseEvent")}function W6(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function G6(t){return hy(t)?[t]:H6(t)?my(t):Array.isArray(t)?t:my(document.querySelectorAll(t))}function y1(t,e){t.forEach(function(n){n&&(n.style.transitionDuration=e+"ms")})}function rD(t,e){t.forEach(function(n){n&&n.setAttribute("data-state",e)})}function K6(t){var e,n=Mu(t),r=n[0];return r!=null&&(e=r.ownerDocument)!=null&&e.body?r.ownerDocument:document}function Y6(t,e){var n=e.clientX,r=e.clientY;return t.every(function(o){var i=o.popperRect,s=o.popperState,a=o.props,l=a.interactiveBorder,u=j6(s.placement),c=s.modifiersData.offset;if(!c)return!0;var f=u==="bottom"?c.top.y:0,d=u==="top"?c.bottom.y:0,p=u==="right"?c.left.x:0,m=u==="left"?c.right.x:0,y=i.top-r+f>l,w=r-i.bottom-d>l,g=i.left-n+p>l,v=n-i.right-m>l;return y||w||g||v})}function v1(t,e,n){var r=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(o){t[r](o,n)})}function oD(t,e){for(var n=e;n;){var r;if(t.contains(n))return!0;n=n.getRootNode==null||(r=n.getRootNode())==null?void 0:r.host}return!1}var Po={isTouch:!1},iD=0;function X6(){Po.isTouch||(Po.isTouch=!0,window.performance&&document.addEventListener("mousemove",mD))}function mD(){var t=performance.now();t-iD<20&&(Po.isTouch=!1,document.removeEventListener("mousemove",mD)),iD=t}function Q6(){var t=document.activeElement;if(W6(t)){var e=t._tippy;t.blur&&!e.state.isVisible&&t.blur()}}function Z6(){document.addEventListener("touchstart",X6,Ma),window.addEventListener("blur",Q6)}var e8=typeof window<"u"&&typeof document<"u",t8=e8?!!window.msCrypto:!1;var n8={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},r8={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},lo=Object.assign({appendTo:dD,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},n8,r8),o8=Object.keys(lo),i8=function(e){var n=Object.keys(e);n.forEach(function(r){lo[r]=e[r]})};function hD(t){var e=t.plugins||[],n=e.reduce(function(r,o){var i=o.name,s=o.defaultValue;if(i){var a;r[i]=t[i]!==void 0?t[i]:(a=lo[i])!=null?a:s}return r},{});return Object.assign({},t,n)}function s8(t,e){var n=e?Object.keys(hD(Object.assign({},lo,{plugins:e}))):o8,r=n.reduce(function(o,i){var s=(t.getAttribute("data-tippy-"+i)||"").trim();if(!s)return o;if(i==="content")o[i]=s;else try{o[i]=JSON.parse(s)}catch{o[i]=s}return o},{});return r}function sD(t,e){var n=Object.assign({},e,{content:pD(e.content,[t])},e.ignoreAttributes?{}:s8(t,e.plugins));return n.aria=Object.assign({},lo.aria,n.aria),n.aria={expanded:n.aria.expanded==="auto"?e.interactive:n.aria.expanded,content:n.aria.content==="auto"?e.interactive?null:"describedby":n.aria.content},n}var a8=function(){return"innerHTML"};function x1(t,e){t[a8()]=e}function aD(t){var e=pd();return t===!0?e.className=cD:(e.className=fD,hy(t)?e.appendChild(t):x1(e,t)),e}function lD(t,e){hy(e.content)?(x1(t,""),t.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?x1(t,e.content):t.textContent=e.content)}function S1(t){var e=t.firstElementChild,n=my(e.children);return{box:e,content:n.find(function(r){return r.classList.contains(uD)}),arrow:n.find(function(r){return r.classList.contains(cD)||r.classList.contains(fD)}),backdrop:n.find(function(r){return r.classList.contains(z6)})}}function gD(t){var e=pd(),n=pd();n.className=_6,n.setAttribute("data-state","hidden"),n.setAttribute("tabindex","-1");var r=pd();r.className=uD,r.setAttribute("data-state","hidden"),lD(r,t.props),e.appendChild(n),n.appendChild(r),o(t.props,t.props);function o(i,s){var a=S1(e),l=a.box,u=a.content,c=a.arrow;s.theme?l.setAttribute("data-theme",s.theme):l.removeAttribute("data-theme"),typeof s.animation=="string"?l.setAttribute("data-animation",s.animation):l.removeAttribute("data-animation"),s.inertia?l.setAttribute("data-inertia",""):l.removeAttribute("data-inertia"),l.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?l.setAttribute("role",s.role):l.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&lD(u,t.props),s.arrow?c?i.arrow!==s.arrow&&(l.removeChild(c),l.appendChild(aD(s.arrow))):l.appendChild(aD(s.arrow)):c&&l.removeChild(c)}return{popper:e,onUpdate:o}}gD.$$tippy=!0;var l8=1,py=[],w1=[];function u8(t,e){var n=sD(t,Object.assign({},lo,hD(nD(e)))),r,o,i,s=!1,a=!1,l=!1,u=!1,c,f,d,p=[],m=eD(Jo,n.interactiveDebounce),y,w=l8++,g=null,v=q6(n.plugins),k={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},S={id:w,reference:t,popper:pd(),popperInstance:g,props:n,state:k,plugins:v,clearDelayTimeouts:De,setProps:F,setContent:j,show:ce,hide:ze,hideWithInteractivity:Fe,enable:W,disable:ue,unmount:Zt,destroy:vr};if(!n.render)return S;var b=n.render(S),x=b.popper,R=b.onUpdate;x.setAttribute("data-tippy-root",""),x.id="tippy-"+S.id,S.popper=x,t._tippy=S,x._tippy=S;var E=v.map(function(J){return J.fn(S)}),O=t.hasAttribute("aria-expanded");return Pn(),C(),G(),te("onCreate",[S]),n.showOnCreate&&Z(),x.addEventListener("mouseenter",function(){S.props.interactive&&S.state.isVisible&&S.clearDelayTimeouts()}),x.addEventListener("mouseleave",function(){S.props.interactive&&S.props.trigger.indexOf("mouseenter")>=0&&U().addEventListener("mousemove",m)}),S;function I(){var J=S.props.touch;return Array.isArray(J)?J:[J,0]}function B(){return I()[0]==="hold"}function L(){var J;return!!((J=S.props.render)!=null&&J.$$tippy)}function A(){return y||t}function U(){var J=A().parentNode;return J?K6(J):document}function V(){return S1(x)}function Q(J){return S.state.isMounted&&!S.state.isVisible||Po.isTouch||c&&c.type==="focus"?0:g1(S.props.delay,J?0:1,lo.delay)}function G(J){J===void 0&&(J=!1),x.style.pointerEvents=S.props.interactive&&!J?"":"none",x.style.zIndex=""+S.props.zIndex}function te(J,ne,fe){if(fe===void 0&&(fe=!0),E.forEach(function(Oe){Oe[J]&&Oe[J].apply(Oe,ne)}),fe){var pe;(pe=S.props)[J].apply(pe,ne)}}function ve(){var J=S.props.aria;if(J.content){var ne="aria-"+J.content,fe=x.id,pe=Mu(S.props.triggerTarget||t);pe.forEach(function(Oe){var Ze=Oe.getAttribute(ne);if(S.state.isVisible)Oe.setAttribute(ne,Ze?Ze+" "+fe:fe);else{var wr=Ze&&Ze.replace(fe,"").trim();wr?Oe.setAttribute(ne,wr):Oe.removeAttribute(ne)}})}}function C(){if(!(O||!S.props.aria.expanded)){var J=Mu(S.props.triggerTarget||t);J.forEach(function(ne){S.props.interactive?ne.setAttribute("aria-expanded",S.state.isVisible&&ne===A()?"true":"false"):ne.removeAttribute("aria-expanded")})}}function it(){U().removeEventListener("mousemove",m),py=py.filter(function(J){return J!==m})}function ct(J){if(!(Po.isTouch&&(l||J.type==="mousedown"))){var ne=J.composedPath&&J.composedPath()[0]||J.target;if(!(S.props.interactive&&oD(x,ne))){if(Mu(S.props.triggerTarget||t).some(function(fe){return oD(fe,ne)})){if(Po.isTouch||S.state.isVisible&&S.props.trigger.indexOf("click")>=0)return}else te("onClickOutside",[S,J]);S.props.hideOnClick===!0&&(S.clearDelayTimeouts(),S.hide(),a=!0,setTimeout(function(){a=!1}),S.state.isMounted||Tn())}}}function T(){l=!0}function Qe(){l=!1}function St(){var J=U();J.addEventListener("mousedown",ct,!0),J.addEventListener("touchend",ct,Ma),J.addEventListener("touchstart",Qe,Ma),J.addEventListener("touchmove",T,Ma)}function Tn(){var J=U();J.removeEventListener("mousedown",ct,!0),J.removeEventListener("touchend",ct,Ma),J.removeEventListener("touchstart",Qe,Ma),J.removeEventListener("touchmove",T,Ma)}function dn(J,ne){pn(J,function(){!S.state.isVisible&&x.parentNode&&x.parentNode.contains(x)&&ne()})}function Ve(J,ne){pn(J,ne)}function pn(J,ne){var fe=V().box;function pe(Oe){Oe.target===fe&&(v1(fe,"remove",pe),ne())}if(J===0)return ne();v1(fe,"remove",f),v1(fe,"add",pe),f=pe}function kt(J,ne,fe){fe===void 0&&(fe=!1);var pe=Mu(S.props.triggerTarget||t);pe.forEach(function(Oe){Oe.addEventListener(J,ne,fe),p.push({node:Oe,eventType:J,handler:ne,options:fe})})}function Pn(){B()&&(kt("touchstart",Hr,{passive:!0}),kt("touchend",Uo,{passive:!0})),V6(S.props.trigger).forEach(function(J){if(J!=="manual")switch(kt(J,Hr),J){case"mouseenter":kt("mouseleave",Uo);break;case"focus":kt(t8?"focusout":"blur",_o);break;case"focusin":kt("focusout",_o);break}})}function On(){p.forEach(function(J){var ne=J.node,fe=J.eventType,pe=J.handler,Oe=J.options;ne.removeEventListener(fe,pe,Oe)}),p=[]}function Hr(J){var ne,fe=!1;if(!(!S.state.isEnabled||zo(J)||a)){var pe=((ne=c)==null?void 0:ne.type)==="focus";c=J,y=J.currentTarget,C(),!S.state.isVisible&&$6(J)&&py.forEach(function(Oe){return Oe(J)}),J.type==="click"&&(S.props.trigger.indexOf("mouseenter")<0||s)&&S.props.hideOnClick!==!1&&S.state.isVisible?fe=!0:Z(J),J.type==="click"&&(s=!fe),fe&&!pe&&Y(J)}}function Jo(J){var ne=J.target,fe=A().contains(ne)||x.contains(ne);if(!(J.type==="mousemove"&&fe)){var pe=_().concat(x).map(function(Oe){var Ze,wr=Oe._tippy,Wa=(Ze=wr.popperInstance)==null?void 0:Ze.state;return Wa?{popperRect:Oe.getBoundingClientRect(),popperState:Wa,props:n}:null}).filter(Boolean);Y6(pe,J)&&(it(),Y(J))}}function Uo(J){var ne=zo(J)||S.props.trigger.indexOf("click")>=0&&s;if(!ne){if(S.props.interactive){S.hideWithInteractivity(J);return}Y(J)}}function _o(J){S.props.trigger.indexOf("focusin")<0&&J.target!==A()||S.props.interactive&&J.relatedTarget&&x.contains(J.relatedTarget)||Y(J)}function zo(J){return Po.isTouch?B()!==J.type.indexOf("touch")>=0:!1}function Ri(){P();var J=S.props,ne=J.popperOptions,fe=J.placement,pe=J.offset,Oe=J.getReferenceClientRect,Ze=J.moveTransition,wr=L()?S1(x).arrow:null,Wa=Oe?{getBoundingClientRect:Oe,contextElement:Oe.contextElement||A()}:t,OR={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(Jd){var Ga=Jd.state;if(L()){var g3=V(),n0=g3.box;["placement","reference-hidden","escaped"].forEach(function(Ud){Ud==="placement"?n0.setAttribute("data-placement",Ga.placement):Ga.attributes.popper["data-popper-"+Ud]?n0.setAttribute("data-"+Ud,""):n0.removeAttribute("data-"+Ud)}),Ga.attributes.popper={}}}},Ps=[{name:"offset",options:{offset:pe}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!Ze}},OR];L()&&wr&&Ps.push({name:"arrow",options:{element:wr,padding:3}}),Ps.push.apply(Ps,ne?.modifiers||[]),S.popperInstance=h1(Wa,x,Object.assign({},ne,{placement:fe,onFirstUpdate:d,modifiers:Ps}))}function P(){S.popperInstance&&(S.popperInstance.destroy(),S.popperInstance=null)}function D(){var J=S.props.appendTo,ne,fe=A();S.props.interactive&&J===dD||J==="parent"?ne=fe.parentNode:ne=pD(J,[fe]),ne.contains(x)||ne.appendChild(x),S.state.isMounted=!0,Ri()}function _(){return my(x.querySelectorAll("[data-tippy-root]"))}function Z(J){S.clearDelayTimeouts(),J&&te("onTrigger",[S,J]),St();var ne=Q(!0),fe=I(),pe=fe[0],Oe=fe[1];Po.isTouch&&pe==="hold"&&Oe&&(ne=Oe),ne?r=setTimeout(function(){S.show()},ne):S.show()}function Y(J){if(S.clearDelayTimeouts(),te("onUntrigger",[S,J]),!S.state.isVisible){Tn();return}if(!(S.props.trigger.indexOf("mouseenter")>=0&&S.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(J.type)>=0&&s)){var ne=Q(!1);ne?o=setTimeout(function(){S.state.isVisible&&S.hide()},ne):i=requestAnimationFrame(function(){S.hide()})}}function W(){S.state.isEnabled=!0}function ue(){S.hide(),S.state.isEnabled=!1}function De(){clearTimeout(r),clearTimeout(o),cancelAnimationFrame(i)}function F(J){if(!S.state.isDestroyed){te("onBeforeUpdate",[S,J]),On();var ne=S.props,fe=sD(t,Object.assign({},ne,nD(J),{ignoreAttributes:!0}));S.props=fe,Pn(),ne.interactiveDebounce!==fe.interactiveDebounce&&(it(),m=eD(Jo,fe.interactiveDebounce)),ne.triggerTarget&&!fe.triggerTarget?Mu(ne.triggerTarget).forEach(function(pe){pe.removeAttribute("aria-expanded")}):fe.triggerTarget&&t.removeAttribute("aria-expanded"),C(),G(),R&&R(ne,fe),S.popperInstance&&(Ri(),_().forEach(function(pe){requestAnimationFrame(pe._tippy.popperInstance.forceUpdate)})),te("onAfterUpdate",[S,J])}}function j(J){S.setProps({content:J})}function ce(){var J=S.state.isVisible,ne=S.state.isDestroyed,fe=!S.state.isEnabled,pe=Po.isTouch&&!S.props.touch,Oe=g1(S.props.duration,0,lo.duration);if(!(J||ne||fe||pe)&&!A().hasAttribute("disabled")&&(te("onShow",[S],!1),S.props.onShow(S)!==!1)){if(S.state.isVisible=!0,L()&&(x.style.visibility="visible"),G(),St(),S.state.isMounted||(x.style.transition="none"),L()){var Ze=V(),wr=Ze.box,Wa=Ze.content;y1([wr,Wa],0)}d=function(){var Ps;if(!(!S.state.isVisible||u)){if(u=!0,x.offsetHeight,x.style.transition=S.props.moveTransition,L()&&S.props.animation){var t0=V(),Jd=t0.box,Ga=t0.content;y1([Jd,Ga],Oe),rD([Jd,Ga],"visible")}ve(),C(),tD(w1,S),(Ps=S.popperInstance)==null||Ps.forceUpdate(),te("onMount",[S]),S.props.animation&&L()&&Ve(Oe,function(){S.state.isShown=!0,te("onShown",[S])})}},D()}}function ze(){var J=!S.state.isVisible,ne=S.state.isDestroyed,fe=!S.state.isEnabled,pe=g1(S.props.duration,1,lo.duration);if(!(J||ne||fe)&&(te("onHide",[S],!1),S.props.onHide(S)!==!1)){if(S.state.isVisible=!1,S.state.isShown=!1,u=!1,s=!1,L()&&(x.style.visibility="hidden"),it(),Tn(),G(!0),L()){var Oe=V(),Ze=Oe.box,wr=Oe.content;S.props.animation&&(y1([Ze,wr],pe),rD([Ze,wr],"hidden"))}ve(),C(),S.props.animation?L()&&dn(pe,S.unmount):S.unmount()}}function Fe(J){U().addEventListener("mousemove",m),tD(py,m),m(J)}function Zt(){S.state.isVisible&&S.hide(),S.state.isMounted&&(P(),_().forEach(function(J){J._tippy.unmount()}),x.parentNode&&x.parentNode.removeChild(x),w1=w1.filter(function(J){return J!==S}),S.state.isMounted=!1,te("onHidden",[S]))}function vr(){S.state.isDestroyed||(S.clearDelayTimeouts(),S.unmount(),On(),delete t._tippy,S.state.isDestroyed=!0,te("onDestroy",[S]))}}function md(t,e){e===void 0&&(e={});var n=lo.plugins.concat(e.plugins||[]);Z6();var r=Object.assign({},e,{plugins:n}),o=G6(t);if(!1)var i,s;var a=o.reduce(function(l,u){var c=u&&u8(u,r);return c&&l.push(c),l},[]);return hy(t)?a[0]:a}md.defaultProps=lo;md.setDefaultProps=i8;md.currentInput=Po;var voe=Object.assign({},sd,{effect:function(e){var n=e.state,r={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(n.elements.popper.style,r.popper),n.styles=r,n.elements.arrow&&Object.assign(n.elements.arrow.style,r.arrow)}});md.setDefaultProps({render:gD});var yD=md;var b1=class{constructor({editor:e,element:n,view:r,tippyOptions:o={},updateDelay:i=250,shouldShow:s}){this.preventHide=!1,this.shouldShow=({view:a,state:l,from:u,to:c})=>{let{doc:f,selection:d}=l,{empty:p}=d,m=!f.textBetween(u,c).length&&ny(l.selection),y=this.element.contains(document.activeElement);return!(!(a.hasFocus()||y)||p||m||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:a})=>{var l;if(this.preventHide){this.preventHide=!1;return}a?.relatedTarget&&(!((l=this.element.parentNode)===null||l===void 0)&&l.contains(a.relatedTarget))||this.hide()},this.tippyBlurHandler=a=>{this.blurHandler({event:a})},this.handleDebouncedUpdate=(a,l)=>{let u=!l?.selection.eq(a.state.selection),c=!l?.doc.eq(a.state.doc);!u&&!c||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(a,u,c,l)},this.updateDelay))},this.updateHandler=(a,l,u,c)=>{var f,d,p;let{state:m,composing:y}=a,{selection:w}=m;if(y||!l&&!u)return;this.createTooltip();let{ranges:v}=w,k=Math.min(...v.map(x=>x.$from.pos)),S=Math.max(...v.map(x=>x.$to.pos));if(!((f=this.shouldShow)===null||f===void 0?void 0:f.call(this,{editor:this.editor,view:a,state:m,oldState:c,from:k,to:S}))){this.hide();return}(d=this.tippy)===null||d===void 0||d.setProps({getReferenceClientRect:((p=this.tippyOptions)===null||p===void 0?void 0:p.getReferenceClientRect)||(()=>{if(IL(m.selection)){let x=a.nodeDOM(k),R=x.dataset.nodeViewWrapper?x:x.querySelector("[data-node-view-wrapper]");if(R&&(x=R.firstChild),x)return x.getBoundingClientRect()}return AL(a,k,S)})}),this.show()},this.editor=e,this.element=n,this.view=r,this.updateDelay=i,s&&(this.shouldShow=s),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.tippyOptions=o,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){let{element:e}=this.editor.options,n=!!e.parentElement;this.tippy||!n||(this.tippy=yD(e,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"top",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,n){let{state:r}=e,o=r.selection.$from.pos!==r.selection.$to.pos;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(e,n);return}let i=!n?.selection.eq(e.state.selection),s=!n?.doc.eq(e.state.doc);this.updateHandler(e,i,s,n)}show(){var e;(e=this.tippy)===null||e===void 0||e.show()}hide(){var e;(e=this.tippy)===null||e===void 0||e.hide()}destroy(){var e,n;!((e=this.tippy)===null||e===void 0)&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(n=this.tippy)===null||n===void 0||n.destroy(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler)}},E1=t=>new At({key:typeof t.pluginKey=="string"?new an(t.pluginKey):t.pluginKey,view:e=>new b1({view:e,...t})}),boe=Ar.create({name:"bubbleMenu",addOptions(){return{element:null,tippyOptions:{},pluginKey:"bubbleMenu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[E1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,tippyOptions:this.options.tippyOptions,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow})]:[]}});var Ce=q(he(),1),gy=q(Sx(),1);var c8=({renderers:t})=>Ce.default.createElement(Ce.default.Fragment,null,Object.entries(t).map(([e,n])=>gy.default.createPortal(n.reactElement,n.element,e))),R1=class extends Ce.default.Component{constructor(e){super(e),this.editorContentRef=Ce.default.createRef(),this.initialized=!1,this.state={renderers:{}}}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let{editor:e}=this.props;if(e&&e.options.element){if(e.contentComponent)return;let n=this.editorContentRef.current;n.append(...e.options.element.childNodes),e.setOptions({element:n}),e.contentComponent=this,e.createNodeViews(),this.initialized=!0}}maybeFlushSync(e){this.initialized?(0,gy.flushSync)(e):e()}setRenderer(e,n){this.maybeFlushSync(()=>{this.setState(({renderers:r})=>({renderers:{...r,[e]:n}}))})}removeRenderer(e){this.maybeFlushSync(()=>{this.setState(({renderers:n})=>{let r={...n};return delete r[e],{renderers:r}})})}componentWillUnmount(){let{editor:e}=this.props;if(!e||(this.initialized=!1,e.isDestroyed||e.view.setProps({nodeViews:{}}),e.contentComponent=null,!e.options.element.firstChild))return;let n=document.createElement("div");n.append(...e.options.element.childNodes),e.setOptions({element:n})}render(){let{editor:e,...n}=this.props;return Ce.default.createElement(Ce.default.Fragment,null,Ce.default.createElement("div",{ref:this.editorContentRef,...n}),Ce.default.createElement(c8,{renderers:this.state.renderers}))}},f8=t=>{let e=Ce.default.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[t.editor]);return Ce.default.createElement(R1,{key:e,...t})},T1=Ce.default.memo(f8),C1=class extends Qg{constructor(){super(...arguments),this.contentComponent=null}};function d8(){let[,t]=(0,Ce.useState)(0);return()=>t(e=>e+1)}var vD=(t={},e=[])=>{let[n,r]=(0,Ce.useState)(null),o=d8(),{onBeforeCreate:i,onBlur:s,onCreate:a,onDestroy:l,onFocus:u,onSelectionUpdate:c,onTransaction:f,onUpdate:d}=t,p=(0,Ce.useRef)(i),m=(0,Ce.useRef)(s),y=(0,Ce.useRef)(a),w=(0,Ce.useRef)(l),g=(0,Ce.useRef)(u),v=(0,Ce.useRef)(c),k=(0,Ce.useRef)(f),S=(0,Ce.useRef)(d);return(0,Ce.useEffect)(()=>{n&&(i&&(n.off("beforeCreate",p.current),n.on("beforeCreate",i),p.current=i),s&&(n.off("blur",m.current),n.on("blur",s),m.current=s),a&&(n.off("create",y.current),n.on("create",a),y.current=a),l&&(n.off("destroy",w.current),n.on("destroy",l),w.current=l),u&&(n.off("focus",g.current),n.on("focus",u),g.current=u),c&&(n.off("selectionUpdate",v.current),n.on("selectionUpdate",c),v.current=c),f&&(n.off("transaction",k.current),n.on("transaction",f),k.current=f),d&&(n.off("update",S.current),n.on("update",d),S.current=d))},[i,s,a,l,u,c,f,d,n]),(0,Ce.useEffect)(()=>{let b=!0,x=new C1(t);return r(x),x.on("transaction",()=>{requestAnimationFrame(()=>{requestAnimationFrame(()=>{b&&o()})})}),()=>{b=!1}},e),(0,Ce.useEffect)(()=>()=>{n?.destroy()},[n]),n},wD=(0,Ce.createContext)({editor:null}),Poe=wD.Consumer,p8=()=>(0,Ce.useContext)(wD);var xD=t=>{let[e,n]=(0,Ce.useState)(null),{editor:r}=p8();return(0,Ce.useEffect)(()=>{var o;if(!e||!((o=t.editor)===null||o===void 0)&&o.isDestroyed||r?.isDestroyed)return;let{pluginKey:i="bubbleMenu",editor:s,tippyOptions:a={},updateDelay:l,shouldShow:u=null}=t,c=s||r;if(!c){console.warn("BubbleMenu component is not rendered inside of an editor component or does not have editor prop.");return}let f=E1({updateDelay:l,editor:c,element:e,pluginKey:i,shouldShow:u,tippyOptions:a});return c.registerPlugin(f),()=>c.unregisterPlugin(i)},[t.editor,r,e]),Ce.default.createElement("div",{ref:n,className:t.className,style:{visibility:"hidden"}},t.children)};var m8=(0,Ce.createContext)({onDragStart:void 0}),h8=()=>(0,Ce.useContext)(m8);var Ooe=Ce.default.forwardRef((t,e)=>{let{onDragStart:n}=h8(),r=t.as||"div";return Ce.default.createElement(r,{...t,ref:e,"data-node-view-wrapper":"",onDragStart:n,style:{whiteSpace:"normal",...t.style}})});var g8=pr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Wt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),SD=dr.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:t=>t.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["span",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{let n=iy(t,this.type);return Object.entries(n).some(([,o])=>!!o)?!0:e.unsetMark(this.name)}}}}),kD=/^\s*([-+*])\s$/,bD=pr.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:t}){return["ul",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(g8.name,this.editor.getAttributes(SD.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=t1({find:kD,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=t1({find:kD,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(SD.name),editor:this.editor})),[t]}});var ED=pr.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:t}){return["li",Wt(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var RD=pr.create({name:"text",group:"inline"});var CD=pr.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:t}){return["p",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var TD=pr.create({name:"doc",topNode:!0,content:"block+"});var Iu=q(he(),1);function y8({title:t,titleId:e,...n},r){return Iu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Iu.createElement("title",{id:e},t):null,Iu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M10.5 6h9.75M10.5 6a1.5 1.5 0 1 1-3 0m3 0a1.5 1.5 0 1 0-3 0M3.75 6H7.5m3 12h9.75m-9.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-3.75 0H7.5m9-6h3.75m-3.75 0a1.5 1.5 0 0 1-3 0m3 0a1.5 1.5 0 0 0-3 0m-9.75 0h9.75"}))}var v8=Iu.forwardRef(y8),P1=v8;var Au=q(he(),1);function w8({title:t,titleId:e,...n},r){return Au.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Au.createElement("title",{id:e},t):null,Au.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 8.25h15m-16.5 7.5h15m-1.8-13.5-3.9 19.5m-2.1-19.5-3.9 19.5"}))}var x8=Au.forwardRef(w8),hd=x8;var Lu=q(he(),1);function S8({title:t,titleId:e,...n},r){return Lu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Lu.createElement("title",{id:e},t):null,Lu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 6.75h12M8.25 12h12m-12 5.25h12M3.75 6.75h.007v.008H3.75V6.75Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0ZM3.75 12h.007v.008H3.75V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Zm-.375 5.25h.007v.008H3.75v-.008Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"}))}var k8=Lu.forwardRef(S8),O1=k8;var Du=q(he(),1);function b8({title:t,titleId:e,...n},r){return Du.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Du.createElement("title",{id:e},t):null,Du.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607ZM13.5 10.5h-6"}))}var E8=Du.forwardRef(b8),N1=E8;var Fu=q(he(),1);function R8({title:t,titleId:e,...n},r){return Fu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Fu.createElement("title",{id:e},t):null,Fu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"}))}var C8=Fu.forwardRef(R8),M1=C8;var Bu=q(he(),1);function T8({title:t,titleId:e,...n},r){return Bu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Bu.createElement("title",{id:e},t):null,Bu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12H9m12 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"}))}var P8=Bu.forwardRef(T8),I1=P8;var Ju=q(he(),1);function O8({title:t,titleId:e,...n},r){return Ju.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Ju.createElement("title",{id:e},t):null,Ju.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 12 3.269 3.125A59.769 59.769 0 0 1 21.485 12 59.768 59.768 0 0 1 3.27 20.875L5.999 12Zm0 0h7.5"}))}var N8=Ju.forwardRef(O8),A1=N8;var Uu=q(he(),1);function M8({title:t,titleId:e,...n},r){return Uu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?Uu.createElement("title",{id:e},t):null,Uu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"}))}var I8=Uu.forwardRef(M8),gd=I8;var _u=q(he(),1);function A8({title:t,titleId:e,...n},r){return _u.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?_u.createElement("title",{id:e},t):null,_u.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"}))}var L8=_u.forwardRef(A8),L1=L8;var zu=q(he(),1);function D8({title:t,titleId:e,...n},r){return zu.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24",strokeWidth:1.5,stroke:"currentColor","aria-hidden":"true","data-slot":"icon",ref:r,"aria-labelledby":e},n),t?zu.createElement("title",{id:e},t):null,zu.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0"}))}var F8=zu.forwardRef(D8),yd=F8;var B8="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",J8="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",ju=(t,e)=>{for(let n in e)t[n]=e[n];return t},U1="numeric",_1="ascii",z1="alpha",Sy="asciinumeric",yy="alphanumeric",V1="domain",FD="emoji",U8="scheme",_8="slashscheme",PD="whitespace";function z8(t,e){return t in e||(e[t]=[]),e[t]}function Ia(t,e,n){e[U1]&&(e[Sy]=!0,e[yy]=!0),e[_1]&&(e[Sy]=!0,e[z1]=!0),e[Sy]&&(e[yy]=!0),e[z1]&&(e[yy]=!0),e[yy]&&(e[V1]=!0),e[FD]&&(e[V1]=!0);for(let r in e){let o=z8(r,n);o.indexOf(t)<0&&o.push(t)}}function V8(t,e){let n={};for(let r in e)e[r].indexOf(t)>=0&&(n[r]=!0);return n}function Qn(t){t===void 0&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}Qn.groups={};Qn.prototype={accepts(){return!!this.t},go(t){let e=this,n=e.j[t];if(n)return n;for(let r=0;rt.ta(e,n,r,o),Jr=(t,e,n,r,o)=>t.tr(e,n,r,o),OD=(t,e,n,r,o)=>t.ts(e,n,r,o),X=(t,e,n,r,o)=>t.tt(e,n,r,o),wi="WORD",q1="UWORD",Sd="LOCALHOST",j1="TLD",H1="UTLD",ky="SCHEME",qu="SLASH_SCHEME",$1="NUM",BD="WS",W1="NL",vd="OPENBRACE",wd="CLOSEBRACE",by="OPENBRACKET",Ey="CLOSEBRACKET",Ry="OPENPAREN",Cy="CLOSEPAREN",Ty="OPENANGLEBRACKET",Py="CLOSEANGLEBRACKET",Oy="FULLWIDTHLEFTPAREN",Ny="FULLWIDTHRIGHTPAREN",My="LEFTCORNERBRACKET",Iy="RIGHTCORNERBRACKET",Ay="LEFTWHITECORNERBRACKET",Ly="RIGHTWHITECORNERBRACKET",Dy="FULLWIDTHLESSTHAN",Fy="FULLWIDTHGREATERTHAN",By="AMPERSAND",Jy="APOSTROPHE",Uy="ASTERISK",ys="AT",_y="BACKSLASH",zy="BACKTICK",Vy="CARET",vs="COLON",G1="COMMA",qy="DOLLAR",Oo="DOT",jy="EQUALS",K1="EXCLAMATION",No="HYPHEN",Hy="PERCENT",$y="PIPE",Wy="PLUS",Gy="POUND",Ky="QUERY",Y1="QUOTE",X1="SEMI",Mo="SLASH",xd="TILDE",Yy="UNDERSCORE",JD="EMOJI",Xy="SYM",UD=Object.freeze({__proto__:null,WORD:wi,UWORD:q1,LOCALHOST:Sd,TLD:j1,UTLD:H1,SCHEME:ky,SLASH_SCHEME:qu,NUM:$1,WS:BD,NL:W1,OPENBRACE:vd,CLOSEBRACE:wd,OPENBRACKET:by,CLOSEBRACKET:Ey,OPENPAREN:Ry,CLOSEPAREN:Cy,OPENANGLEBRACKET:Ty,CLOSEANGLEBRACKET:Py,FULLWIDTHLEFTPAREN:Oy,FULLWIDTHRIGHTPAREN:Ny,LEFTCORNERBRACKET:My,RIGHTCORNERBRACKET:Iy,LEFTWHITECORNERBRACKET:Ay,RIGHTWHITECORNERBRACKET:Ly,FULLWIDTHLESSTHAN:Dy,FULLWIDTHGREATERTHAN:Fy,AMPERSAND:By,APOSTROPHE:Jy,ASTERISK:Uy,AT:ys,BACKSLASH:_y,BACKTICK:zy,CARET:Vy,COLON:vs,COMMA:G1,DOLLAR:qy,DOT:Oo,EQUALS:jy,EXCLAMATION:K1,HYPHEN:No,PERCENT:Hy,PIPE:$y,PLUS:Wy,POUND:Gy,QUERY:Ky,QUOTE:Y1,SEMI:X1,SLASH:Mo,TILDE:xd,UNDERSCORE:Yy,EMOJI:JD,SYM:Xy}),Vu=/[a-z]/,D1=/\p{L}/u,F1=/\p{Emoji}/u;var B1=/\d/,ND=/\s/;var MD=` +`,q8="\uFE0F",j8="\u200D",vy=null,wy=null;function H8(t){t===void 0&&(t=[]);let e={};Qn.groups=e;let n=new Qn;vy==null&&(vy=ID(B8)),wy==null&&(wy=ID(J8)),X(n,"'",Jy),X(n,"{",vd),X(n,"}",wd),X(n,"[",by),X(n,"]",Ey),X(n,"(",Ry),X(n,")",Cy),X(n,"<",Ty),X(n,">",Py),X(n,"\uFF08",Oy),X(n,"\uFF09",Ny),X(n,"\u300C",My),X(n,"\u300D",Iy),X(n,"\u300E",Ay),X(n,"\u300F",Ly),X(n,"\uFF1C",Dy),X(n,"\uFF1E",Fy),X(n,"&",By),X(n,"*",Uy),X(n,"@",ys),X(n,"`",zy),X(n,"^",Vy),X(n,":",vs),X(n,",",G1),X(n,"$",qy),X(n,".",Oo),X(n,"=",jy),X(n,"!",K1),X(n,"-",No),X(n,"%",Hy),X(n,"|",$y),X(n,"+",Wy),X(n,"#",Gy),X(n,"?",Ky),X(n,'"',Y1),X(n,"/",Mo),X(n,";",X1),X(n,"~",xd),X(n,"_",Yy),X(n,"\\",_y);let r=Jr(n,B1,$1,{[U1]:!0});Jr(r,B1,r);let o=Jr(n,Vu,wi,{[_1]:!0});Jr(o,Vu,o);let i=Jr(n,D1,q1,{[z1]:!0});Jr(i,Vu),Jr(i,D1,i);let s=Jr(n,ND,BD,{[PD]:!0});X(n,MD,W1,{[PD]:!0}),X(s,MD),Jr(s,ND,s);let a=Jr(n,F1,JD,{[FD]:!0});Jr(a,F1,a),X(a,q8,a);let l=X(a,j8);Jr(l,F1,a);let u=[[Vu,o]],c=[[Vu,null],[D1,i]];for(let f=0;ff[0]>d[0]?1:-1);for(let f=0;f=0?m[V1]=!0:Vu.test(d)?B1.test(d)?m[Sy]=!0:m[_1]=!0:m[U1]=!0,OD(n,d,d,m)}return OD(n,"localhost",Sd,{ascii:!0}),n.jd=new Qn(Xy),{start:n,tokens:ju({groups:e},UD)}}function $8(t,e){let n=W8(e.replace(/[A-Z]/g,a=>a.toLowerCase())),r=n.length,o=[],i=0,s=0;for(;s=0&&(f+=n[s].length,d++),u+=n[s].length,i+=n[s].length,s++;i-=f,s-=d,u-=f,o.push({t:c.t,v:e.slice(i-u,i),s:i-u,e:i})}return o}function W8(t){let e=[],n=t.length,r=0;for(;r56319||r+1===n||(i=t.charCodeAt(r+1))<56320||i>57343?t[r]:t.slice(r,r+2);e.push(s),r+=s.length}return e}function gs(t,e,n,r,o){let i,s=e.length;for(let a=0;a=0;)i++;if(i>0){e.push(n.join(""));for(let s=parseInt(t.substring(r,r+i),10);s>0;s--)n.pop();r+=i}else n.push(t[r]),r++}return e}var kd={defaultProtocol:"http",events:null,format:AD,formatHref:AD,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Q1(t,e){e===void 0&&(e=null);let n=ju({},kd);t&&(n=ju(n,t instanceof Q1?t.o:t));let r=n.ignoreTags,o=[];for(let i=0;in?r.substring(0,n)+"\u2026":r},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return t===void 0&&(t=kd.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){let e=this,n=this.toHref(t.get("defaultProtocol")),r=t.get("formatHref",n,this),o=t.get("tagName",n,e),i=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),u=t.get("rel",n,e),c=t.getObj("attributes",n,e),f=t.getObj("events",n,e);return s.href=r,a&&(s.class=a),l&&(s.target=l),u&&(s.rel=u),c&&ju(s,c),{tagName:o,attributes:s,content:i,eventListeners:f}}};function Qy(t,e){class n extends _D{constructor(o,i){super(o,i),this.t=t}}for(let r in e)n.prototype[r]=e[r];return n.t=t,n}var LD=Qy("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),DD=Qy("text"),G8=Qy("nl"),xy=Qy("url",{isLink:!0,toHref(t){return t===void 0&&(t=kd.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){let t=this.tk;return t.length>=2&&t[0].t!==Sd&&t[1].t===vs}});var Ur=t=>new Qn(t);function K8(t){let{groups:e}=t,n=e.domain.concat([By,Uy,ys,_y,zy,Vy,qy,jy,No,$1,Hy,$y,Wy,Gy,Mo,Xy,xd,Yy]),r=[Jy,vs,G1,Oo,K1,Ky,Y1,X1,Ty,Py,vd,wd,Ey,by,Ry,Cy,Oy,Ny,My,Iy,Ay,Ly,Dy,Fy],o=[By,Jy,Uy,_y,zy,Vy,qy,jy,No,vd,wd,Hy,$y,Wy,Gy,Ky,Mo,Xy,xd,Yy],i=Ur(),s=X(i,xd);Re(s,o,s),Re(s,e.domain,s);let a=Ur(),l=Ur(),u=Ur();Re(i,e.domain,a),Re(i,e.scheme,l),Re(i,e.slashscheme,u),Re(a,o,s),Re(a,e.domain,a);let c=X(a,ys);X(s,ys,c),X(l,ys,c),X(u,ys,c);let f=X(s,Oo);Re(f,o,s),Re(f,e.domain,s);let d=Ur();Re(c,e.domain,d),Re(d,e.domain,d);let p=X(d,Oo);Re(p,e.domain,d);let m=Ur(LD);Re(p,e.tld,m),Re(p,e.utld,m),X(c,Sd,m);let y=X(d,No);Re(y,e.domain,d),Re(m,e.domain,d),X(m,Oo,p),X(m,No,y);let w=X(m,vs);Re(w,e.numeric,LD);let g=X(a,No),v=X(a,Oo);Re(g,e.domain,a),Re(v,o,s),Re(v,e.domain,a);let k=Ur(xy);Re(v,e.tld,k),Re(v,e.utld,k),Re(k,e.domain,a),Re(k,o,s),X(k,Oo,v),X(k,No,g),X(k,ys,c);let S=X(k,vs),b=Ur(xy);Re(S,e.numeric,b);let x=Ur(xy),R=Ur();Re(x,n,x),Re(x,r,R),Re(R,n,x),Re(R,r,R),X(k,Mo,x),X(b,Mo,x);let E=X(l,vs),O=X(u,vs),I=X(O,Mo),B=X(I,Mo);Re(l,e.domain,a),X(l,Oo,v),X(l,No,g),Re(u,e.domain,a),X(u,Oo,v),X(u,No,g),Re(E,e.domain,x),X(E,Mo,x),Re(B,e.domain,x),Re(B,n,x),X(B,Mo,x);let L=[[vd,wd],[by,Ey],[Ry,Cy],[Ty,Py],[Oy,Ny],[My,Iy],[Ay,Ly],[Dy,Fy]];for(let A=0;A=0&&d++,o++,c++;if(d<0)o-=c,o0&&(i.push(J1(DD,e,s)),s=[]),o-=d,c-=d;let p=f.t,m=n.slice(o-c,o);i.push(J1(p,e,m))}}return s.length>0&&i.push(J1(DD,e,s)),i}function J1(t,e,n){let r=n[0].s,o=n[n.length-1].e,i=e.slice(r,o);return new t(i,n)}var X8=typeof console<"u"&&console&&console.warn||(()=>{}),Q8="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",ht={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function zD(){Qn.groups={},ht.scanner=null,ht.parser=null,ht.tokenQueue=[],ht.pluginQueue=[],ht.customSchemes=[],ht.initialized=!1}function Z1(t,e){if(e===void 0&&(e=!1),ht.initialized&&X8(`linkifyjs: already initialized - will not register custom scheme "${t}" ${Q8}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error(`linkifyjs: incorrect scheme format. 1. Must only contain digits, lowercase ASCII letters or "-" 2. Cannot start or end with "-" -3. "-" cannot repeat`);mt.customSchemes.push([t,e])}function $9(){mt.scanner=J9(mt.customSchemes);for(let t=0;t{let o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,a=EL(n.doc,[...e]);if(CL(a).forEach(({newRange:u})=>{let c=RL(r.doc,u,p=>p.isTextblock),f,d;if(c.length>1?(f=c[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):c.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(f=c[0],d=r.doc.textBetween(f.pos,u.to,void 0," ")),f&&d){let p=d.split(" ").filter(w=>w!=="");if(p.length<=0)return!1;let m=p[p.length-1],y=f.pos+d.lastIndexOf(m);if(!m)return!1;Yy(m).filter(w=>w.isLink).map(w=>({...w,from:y+w.start+1,to:y+w.end+1})).filter(w=>r.schema.marks.code?!r.doc.rangeHasMark(w.from,w.to,r.schema.marks.code):!0).filter(w=>t.validate?t.validate(w.value):!0).forEach(w=>{ry(w.from,w.to,r.doc).some(g=>g.mark.type===t.type)||s.addMark(w.from,w.to,t.type.create({href:w.href}))})}}),!!s.steps.length)return s}})}function K9(t){return new At({key:new an("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||r.target.nodeName!=="A")return!1;let a=o1(e.state,t.type.name),l=r.target,u=(o=l?.href)!==null&&o!==void 0?o:a.href,c=(i=l?.target)!==null&&i!==void 0?i:a.target;return l&&u?(e.editable&&window.open(u,c),!0):!1}}})}function Y9(t){return new At({key:new an("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});let l=Yy(a).find(u=>u.isLink&&u.value===a);return!a||!l?!1:(t.editor.commands.setMark(t.type,{href:l.href}),!0)}}})}var BD=fr.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(t=>{if(typeof t=="string"){Y1(t);return}Y1(t.scheme,t.optionalSlashes)})},onDestroy(){FD()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:t}){var e;return!((e=t.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",$t(this.options.HTMLAttributes,{...t,href:""}),0]:["a",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Ir({find:(t,e)=>{var n;let r=(n=e?.clipboardData)===null||n===void 0?void 0:n.getData("text/html"),o=[];if(r){let i=new DOMParser().parseFromString(r,"text/html"),s=i.querySelectorAll("a");s.length&&[...s].forEach(a=>o.push({text:a.innerText,data:{href:a.getAttribute("href")},index:i.body.innerText.indexOf(a.innerText)+a.innerText.length}))}if(t){let i=Yy(t).filter(s=>s.isLink);i.length&&i.forEach(s=>o.push({text:s.value,data:{href:s.href},index:s.start}))}return o},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[];return this.options.autolink&&t.push(G9({type:this.type,validate:this.options.validate})),this.options.openOnClick&&t.push(K9({type:this.type})),this.options.linkOnPaste&&t.push(Y9({editor:this.editor,type:this.type})),t}});var X9=/(?:^|\s)\[([^\]]*)?\]\((\S+)(?: ["“](.+)["”])?\)$/i,Q9=/(?:^|\s)\[([^\]]*)?\]\((\S+)(?: ["“](.+)["”])?\)/gi;function Z9(t){let e=Co(t);return new Au({find:t.find,handler(n){let{tr:r}=n.state;e.handler(n),r.setMeta("preventAutolink",!0)}})}function e8(t){let e=Ir(t);return new od({find:t.find,handler(n){let{tr:r}=n.state;e.handler(n),r.setMeta("preventAutolink",!0)}})}var JD=BD.extend({inclusive:!1,addAttributes(){return{...this.parent?.(),title:{default:null}}},addInputRules(){return[Z9({find:X9,type:this.type,getAttributes(t){return{title:t.pop()?.trim(),href:t.pop()?.trim()}}})]},addPasteRules(){return[e8({find:Q9,type:this.type,getAttributes(t){return{title:t.pop()?.trim(),href:t.pop()?.trim()}}})]}});var X1=q(ge(),1);var Xy=q(ge(),1);var Mo=q(ge(),1);function UD(t,e){let[n,r]=Mo.useState(t);return Mo.useEffect(()=>{let o=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(o)}},[t,e]),n}var _D=rn([]);_D.debugLabel="tagsAtom";var zD=()=>{let[t,e]=Nt(_D);return{tags:t,getTags:async()=>{let r=await vt.getTags({});e(r.tags)},setTags:e}};var Io=q(ye(),1);function VD(t){let e=[t.name];for(let n of t.subTags)e=e.concat(`${t.name}/${VD(n)}`);return e}function t8(t){let e=[];for(let n of t)e=e.concat(VD(n));return e}var qD=({selectedTag:t,setSelectedTag:e,onAddTag:n})=>{let{tags:r,getTags:o}=zD();(0,Xy.useEffect)(()=>{o()},[]);let i=t8(r),s=c=>i.filter(f=>f.toLowerCase().indexOf(c.toLowerCase())===0),[a,l]=(0,Xy.useState)(s(t));return(0,Io.jsxs)("div",{className:"flex items-center gap-2",children:[(0,Io.jsx)(n8,{value:t,onChange:c=>{l(s(c)),e(c)},matchingOptions:a}),(0,Io.jsx)("button",{onClick:()=>n(t),className:"btn btn-square btn-primary",children:(0,Io.jsx)(Bf,{className:"h-6 w-6"})})]})},n8=({onChange:t,value:e,matchingOptions:n})=>{let r=UD(n,300);return(0,Io.jsxs)("div",{className:"max-w-md",children:[(0,Io.jsx)("input",{type:"text",value:e,onChange:o=>t(o.target.value),placeholder:"search by tag...",className:"input input-bordered w-full"}),r.length>0&&(0,Io.jsx)("ul",{className:"p-2 shadow menu dropdown-content bg-base-100 rounded-box w-52",children:r.map(o=>(0,Io.jsx)("li",{onClick:()=>t(o),children:o},o))})]})};var Na=q(ye(),1),qu=({onNewTag:t})=>{let[e,n]=(0,X1.useState)(!1),[r,o]=(0,X1.useState)("");return(0,Na.jsxs)("div",{children:[(0,Na.jsx)("button",{className:"btn",onClick:()=>n(!e),children:e?(0,Na.jsx)(Ok,{className:"h-6 w-6"}):(0,Na.jsx)(Bf,{className:"h-6 w-6"})}),e&&(0,Na.jsx)(qD,{selectedTag:r,setSelectedTag:o,onAddTag:s=>{s&&(n(!1),t(s))}})]})};var Yu=q(ge(),1);var Qy=q(ge(),1),Q1=q(ye(),1),Z1=({children:t,open:e})=>{let n=Qy.default.useRef(null);return(0,Qy.useEffect)(()=>{n.current&&(e?n.current.showModal():n.current.close())},[e]),(0,Q1.jsx)("dialog",{className:"modal",ref:n,children:(0,Q1.jsx)("div",{className:"modal-box",children:t})})};var jD=["http","https","mailto","tel"];function HD(t){let e=(t||"").trim(),n=e.charAt(0);if(n==="#"||n==="/")return e;let r=e.indexOf(":");if(r===-1)return e;let o=-1;for(;++oo||(o=e.indexOf("#"),o!==-1&&r>o)?e:"javascript:void(0)"}var Lv=q(ge(),1);var QD=q(eE(),1);function vs(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?WD(t.position):"start"in t||"end"in t?WD(t):"line"in t||"column"in t?tE(t):""}function tE(t){return GD(t&&t.line)+":"+GD(t&&t.column)}function WD(t){return tE(t&&t.start)+"-"+tE(t&&t.end)}function GD(t){return t&&typeof t=="number"?t:1}var bn=class extends Error{constructor(e,n,r){let o=[null,null],i={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof n=="string"&&(r=n,n=void 0),typeof r=="string"){let s=r.indexOf(":");s===-1?o[1]=r:(o[0]=r.slice(0,s),o[1]=r.slice(s+1))}n&&("type"in n||"position"in n?n.position&&(i=n.position):"start"in n||"end"in n?i=n:("line"in n||"column"in n)&&(i.start=n)),this.name=vs(n)||"1:1",this.message=typeof e=="object"?e.message:e,this.stack="",typeof e=="object"&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=i.start.line,this.column=i.start.column,this.position=i,this.source=o[0],this.ruleId=o[1],this.file,this.actual,this.expected,this.url,this.note}};bn.prototype.file="";bn.prototype.name="";bn.prototype.reason="";bn.prototype.message="";bn.prototype.stack="";bn.prototype.fatal=null;bn.prototype.column=null;bn.prototype.line=null;bn.prototype.source=null;bn.prototype.ruleId=null;bn.prototype.position=null;var ao={basename:r8,dirname:o8,extname:i8,join:s8,sep:"/"};function r8(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');xd(t);let n=0,r=-1,o=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;o--;)if(t.charCodeAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let s=-1,a=e.length-1;for(;o--;)if(t.charCodeAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(t.charCodeAt(o)===e.charCodeAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=t.length),t.slice(n,r)}function o8(t){if(xd(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.charCodeAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.charCodeAt(0)===47?"/":".":e===1&&t.charCodeAt(0)===47?"//":t.slice(0,e)}function i8(t){xd(t);let e=t.length,n=-1,r=0,o=-1,i=0,s;for(;e--;){let a=t.charCodeAt(e);if(a===47){if(s){r=e+1;break}continue}n<0&&(s=!0,n=e+1),a===46?o<0?o=e:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":t.slice(o,n)}function s8(...t){let e=-1,n;for(;++e0&&t.charCodeAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function l8(t,e){let n="",r=0,o=-1,i=0,s=-1,a,l;for(;++s<=t.length;){if(s2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function xd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var KD={cwd:u8};function u8(){return"/"}function ju(t){return t!==null&&typeof t=="object"&&t.href&&t.origin}function YD(t){if(typeof t=="string")t=new URL(t);else if(!ju(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return c8(t)}function c8(t){if(t.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 e=t.pathname,n=-1;for(;++ns.length,l;a&&s.push(o);try{l=t.apply(this,s)}catch(u){let c=u;if(a&&n)throw c;return o(c)}a||(l instanceof Promise?l.then(i,o):l instanceof Error?o(l):i(l))}function o(s,...a){n||(n=!0,e(s,...a))}function i(s){o(null,s)}}var cE=mF().freeze(),pF={}.hasOwnProperty;function mF(){let t=lF(),e=[],n={},r,o=-1;return i.data=s,i.Parser=void 0,i.Compiler=void 0,i.freeze=a,i.attachers=e,i.use=l,i.parse=u,i.stringify=c,i.run=f,i.runSync=d,i.process=p,i.processSync=m,i;function i(){let y=mF(),w=-1;for(;++w{if(x||!T||!E)b(x);else{let O=i.stringify(T,E);O==null||(h8(O)?E.value=O:E.result=O),b(x,E)}});function b(x,T){x||!T?k(x):v?v(T):w(null,T)}}}function m(y){let w;i.freeze(),sE("processSync",i.Parser),aE("processSync",i.Compiler);let g=kd(y);return i.process(g,v),fF("processSync","process",w),g;function v(k){w=!0,iE(k)}}}function uF(t,e){return typeof t=="function"&&t.prototype&&(p8(t.prototype)||e in t.prototype)}function p8(t){let e;for(e in t)if(pF.call(t,e))return!0;return!1}function sE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `Parser`")}function aE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `Compiler`")}function lE(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function cF(t){if(!Sd(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function fF(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function kd(t){return m8(t)?t:new Ma(t)}function m8(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function h8(t){return typeof t=="string"||(0,dF.default)(t)}var g8={};function fE(t,e){let n=e||g8,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return gF(t,r,o)}function gF(t,e,n){if(y8(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return hF(t.children,e,n)}return Array.isArray(t)?hF(t,e,n):""}function hF(t,e,n){let r=[],o=-1;for(;++oo?0:o+e:e=e>o?o:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i0?(un(t,t.length,0,e),t):e}var yF={}.hasOwnProperty;function vF(t){let e={},n=-1;for(;++ns))return;let T=e.events.length,E=T,O,A;for(;E--;)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){if(O){A=e.events[E][1].end;break}O=!0}for(g(r),x=T;xk;){let b=n[S];e.containerState=b[1],b[0].exit.call(e,t)}n.length=k}function v(){o.write([null]),i=void 0,o=void 0,e.containerState._closeFlow=void 0}}function k8(t,e,n){return ke(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function dE(t){if(t===null||Ct(t)||EF(t))return 1;if(bF(t))return 2}function Hu(t,e,n){let r=[],o=-1;for(;++o1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;let f=Object.assign({},t[r][1].end),d=Object.assign({},t[n][1].start);PF(f,-l),PF(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},t[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[n][1].start),end:d},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[r][1].end),end:Object.assign({},t[n][1].start)},o={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},t[r][1].end=Object.assign({},s.start),t[n][1].start=Object.assign({},a.end),u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=zn(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=zn(u,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",i,e]]),u=zn(u,Hu(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=zn(u,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",o,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=zn(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,un(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&Se(x)?ke(t,v,"linePrefix",i+1)(x):v(x)}function v(x){return x===null||oe(x)?t.check(NF,y,S)(x):(t.enter("codeFlowValue"),k(x))}function k(x){return x===null||oe(x)?(t.exit("codeFlowValue"),v(x)):(t.consume(x),k)}function S(x){return t.exit("codeFenced"),e(x)}function b(x,T,E){let O=0;return A;function A(V){return x.enter("lineEnding"),x.consume(V),x.exit("lineEnding"),B}function B(V){return x.enter("codeFencedFence"),Se(V)?ke(x,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):L(V)}function L(V){return V===a?(x.enter("codeFencedFenceSequence"),I(V)):E(V)}function I(V){return V===a?(O++,x.consume(V),I):O>=s?(x.exit("codeFencedFenceSequence"),Se(V)?ke(x,U,"whitespace")(V):U(V)):E(V)}function U(V){return V===null||oe(V)?(x.exit("codeFencedFence"),T(V)):E(V)}}}function A8(t,e,n){let r=this;return o;function o(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}var Cd={name:"codeIndented",tokenize:D8},L8={tokenize:F8,partial:!0};function D8(t,e,n){let r=this;return o;function o(u){return t.enter("codeIndented"),ke(t,i,"linePrefix",4+1)(u)}function i(u){let c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):oe(u)?t.attempt(L8,s,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||oe(u)?(t.exit("codeFlowValue"),s(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function F8(t,e,n){let r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):oe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):ke(t,i,"linePrefix",4+1)(s)}function i(s){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):oe(s)?o(s):n(s)}}var mE={name:"codeText",tokenize:U8,resolve:B8,previous:J8};function B8(t){let e=t.length-4,n=3,r,o;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function iv(t,e,n,r,o,i,s,a,l){let u=l||Number.POSITIVE_INFINITY,c=0;return f;function f(g){return g===60?(t.enter(r),t.enter(o),t.enter(i),t.consume(g),t.exit(i),d):g===null||g===32||g===41||bd(g)?n(g):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),y(g))}function d(g){return g===62?(t.enter(i),t.consume(g),t.exit(i),t.exit(o),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(t.exit("chunkString"),t.exit(a),d(g)):g===null||g===60||oe(g)?n(g):(t.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(t.consume(g),p):p(g)}function y(g){return!c&&(g===null||g===41||Ct(g))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(g)):c999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(t.exit(i),t.enter(o),t.consume(p),t.exit(o),t.exit(r),e):oe(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||oe(p)||a++>999?(t.exit("chunkString"),c(p)):(t.consume(p),l||(l=!Se(p)),p===92?d:f)}function d(p){return p===91||p===92||p===93?(t.consume(p),a++,f):f(p)}}function av(t,e,n,r,o,i){let s;return a;function a(d){return d===34||d===39||d===40?(t.enter(r),t.enter(o),t.consume(d),t.exit(o),s=d===40?41:d,l):n(d)}function l(d){return d===s?(t.enter(o),t.consume(d),t.exit(o),t.exit(r),e):(t.enter(i),u(d))}function u(d){return d===s?(t.exit(i),l(s)):d===null?n(d):oe(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),ke(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===s||d===null||oe(d)?(t.exit("chunkString"),u(d)):(t.consume(d),d===92?f:c)}function f(d){return d===s||d===92?(t.consume(d),c):c(d)}}function Ia(t,e){let n;return r;function r(o){return oe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),n=!0,r):Se(o)?ke(t,r,n?"linePrefix":"lineSuffix")(o):e(o)}}function wi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var gE={name:"definition",tokenize:$8},H8={tokenize:W8,partial:!0};function $8(t,e,n){let r=this,o;return i;function i(p){return t.enter("definition"),s(p)}function s(p){return sv.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=wi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):n(p)}function l(p){return Ct(p)?Ia(t,u)(p):u(p)}function u(p){return iv(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return t.attempt(H8,f,f)(p)}function f(p){return Se(p)?ke(t,d,"whitespace")(p):d(p)}function d(p){return p===null||oe(p)?(t.exit("definition"),r.parser.defined.push(o),e(p)):n(p)}}function W8(t,e,n){return r;function r(a){return Ct(a)?Ia(t,o)(a):n(a)}function o(a){return av(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return Se(a)?ke(t,s,"whitespace")(a):s(a)}function s(a){return a===null||oe(a)?e(a):n(a)}}var yE={name:"hardBreakEscape",tokenize:G8};function G8(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),o}function o(i){return oe(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}var vE={name:"headingAtx",tokenize:Y8,resolve:K8};function K8(t,e){let n=t.length-2,r=3,o,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},un(t,r,n-r+1,[["enter",o,e],["enter",i,e],["exit",i,e],["exit",o,e]])),t}function Y8(t,e,n){let r=0;return o;function o(c){return t.enter("atxHeading"),i(c)}function i(c){return t.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(t.consume(c),s):c===null||Ct(c)?(t.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||oe(c)?(t.exit("atxHeading"),e(c)):Se(c)?ke(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Ct(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}var MF=["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"],wE=["pre","script","style","textarea"];var xE={name:"htmlFlow",tokenize:eH,resolveTo:Z8,concrete:!0},X8={tokenize:nH,partial:!0},Q8={tokenize:tH,partial:!0};function Z8(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function eH(t,e,n){let r=this,o,i,s,a,l;return u;function u(C){return c(C)}function c(C){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(C),f}function f(C){return C===33?(t.consume(C),d):C===47?(t.consume(C),i=!0,y):C===63?(t.consume(C),o=3,r.interrupt?e:R):pr(C)?(t.consume(C),s=String.fromCharCode(C),w):n(C)}function d(C){return C===45?(t.consume(C),o=2,p):C===91?(t.consume(C),o=5,a=0,m):pr(C)?(t.consume(C),o=4,r.interrupt?e:R):n(C)}function p(C){return C===45?(t.consume(C),r.interrupt?e:R):n(C)}function m(C){let Qe="CDATA[";return C===Qe.charCodeAt(a++)?(t.consume(C),a===Qe.length?r.interrupt?e:L:m):n(C)}function y(C){return pr(C)?(t.consume(C),s=String.fromCharCode(C),w):n(C)}function w(C){if(C===null||C===47||C===62||Ct(C)){let Qe=C===47,St=s.toLowerCase();return!Qe&&!i&&wE.includes(St)?(o=1,r.interrupt?e(C):L(C)):MF.includes(s.toLowerCase())?(o=6,Qe?(t.consume(C),g):r.interrupt?e(C):L(C)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(C):i?v(C):k(C))}return C===45||Kt(C)?(t.consume(C),s+=String.fromCharCode(C),w):n(C)}function g(C){return C===62?(t.consume(C),r.interrupt?e:L):n(C)}function v(C){return Se(C)?(t.consume(C),v):A(C)}function k(C){return C===47?(t.consume(C),A):C===58||C===95||pr(C)?(t.consume(C),S):Se(C)?(t.consume(C),k):A(C)}function S(C){return C===45||C===46||C===58||C===95||Kt(C)?(t.consume(C),S):b(C)}function b(C){return C===61?(t.consume(C),x):Se(C)?(t.consume(C),b):k(C)}function x(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),l=C,T):Se(C)?(t.consume(C),x):E(C)}function T(C){return C===l?(t.consume(C),l=null,O):C===null||oe(C)?n(C):(t.consume(C),T)}function E(C){return C===null||C===34||C===39||C===47||C===60||C===61||C===62||C===96||Ct(C)?b(C):(t.consume(C),E)}function O(C){return C===47||C===62||Se(C)?k(C):n(C)}function A(C){return C===62?(t.consume(C),B):n(C)}function B(C){return C===null||oe(C)?L(C):Se(C)?(t.consume(C),B):n(C)}function L(C){return C===45&&o===2?(t.consume(C),Q):C===60&&o===1?(t.consume(C),G):C===62&&o===4?(t.consume(C),it):C===63&&o===3?(t.consume(C),R):C===93&&o===5?(t.consume(C),we):oe(C)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(X8,ct,I)(C)):C===null||oe(C)?(t.exit("htmlFlowData"),I(C)):(t.consume(C),L)}function I(C){return t.check(Q8,U,ct)(C)}function U(C){return t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),V}function V(C){return C===null||oe(C)?I(C):(t.enter("htmlFlowData"),L(C))}function Q(C){return C===45?(t.consume(C),R):L(C)}function G(C){return C===47?(t.consume(C),s="",te):L(C)}function te(C){if(C===62){let Qe=s.toLowerCase();return wE.includes(Qe)?(t.consume(C),it):L(C)}return pr(C)&&s.length<8?(t.consume(C),s+=String.fromCharCode(C),te):L(C)}function we(C){return C===93?(t.consume(C),R):L(C)}function R(C){return C===62?(t.consume(C),it):C===45&&o===2?(t.consume(C),R):L(C)}function it(C){return C===null||oe(C)?(t.exit("htmlFlowData"),ct(C)):(t.consume(C),it)}function ct(C){return t.exit("htmlFlow"),e(C)}}function tH(t,e,n){let r=this;return o;function o(s){return oe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function nH(t,e,n){return r;function r(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(xs,e,n)}}var SE={name:"htmlText",tokenize:rH};function rH(t,e,n){let r=this,o,i,s;return a;function a(R){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(R),l}function l(R){return R===33?(t.consume(R),u):R===47?(t.consume(R),b):R===63?(t.consume(R),k):pr(R)?(t.consume(R),E):n(R)}function u(R){return R===45?(t.consume(R),c):R===91?(t.consume(R),i=0,m):pr(R)?(t.consume(R),v):n(R)}function c(R){return R===45?(t.consume(R),p):n(R)}function f(R){return R===null?n(R):R===45?(t.consume(R),d):oe(R)?(s=f,G(R)):(t.consume(R),f)}function d(R){return R===45?(t.consume(R),p):f(R)}function p(R){return R===62?Q(R):R===45?d(R):f(R)}function m(R){let it="CDATA[";return R===it.charCodeAt(i++)?(t.consume(R),i===it.length?y:m):n(R)}function y(R){return R===null?n(R):R===93?(t.consume(R),w):oe(R)?(s=y,G(R)):(t.consume(R),y)}function w(R){return R===93?(t.consume(R),g):y(R)}function g(R){return R===62?Q(R):R===93?(t.consume(R),g):y(R)}function v(R){return R===null||R===62?Q(R):oe(R)?(s=v,G(R)):(t.consume(R),v)}function k(R){return R===null?n(R):R===63?(t.consume(R),S):oe(R)?(s=k,G(R)):(t.consume(R),k)}function S(R){return R===62?Q(R):k(R)}function b(R){return pr(R)?(t.consume(R),x):n(R)}function x(R){return R===45||Kt(R)?(t.consume(R),x):T(R)}function T(R){return oe(R)?(s=T,G(R)):Se(R)?(t.consume(R),T):Q(R)}function E(R){return R===45||Kt(R)?(t.consume(R),E):R===47||R===62||Ct(R)?O(R):n(R)}function O(R){return R===47?(t.consume(R),Q):R===58||R===95||pr(R)?(t.consume(R),A):oe(R)?(s=O,G(R)):Se(R)?(t.consume(R),O):Q(R)}function A(R){return R===45||R===46||R===58||R===95||Kt(R)?(t.consume(R),A):B(R)}function B(R){return R===61?(t.consume(R),L):oe(R)?(s=B,G(R)):Se(R)?(t.consume(R),B):O(R)}function L(R){return R===null||R===60||R===61||R===62||R===96?n(R):R===34||R===39?(t.consume(R),o=R,I):oe(R)?(s=L,G(R)):Se(R)?(t.consume(R),L):(t.consume(R),U)}function I(R){return R===o?(t.consume(R),o=void 0,V):R===null?n(R):oe(R)?(s=I,G(R)):(t.consume(R),I)}function U(R){return R===null||R===34||R===39||R===60||R===61||R===96?n(R):R===47||R===62||Ct(R)?O(R):(t.consume(R),U)}function V(R){return R===47||R===62||Ct(R)?O(R):n(R)}function Q(R){return R===62?(t.consume(R),t.exit("htmlTextData"),t.exit("htmlText"),e):n(R)}function G(R){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(R),t.exit("lineEnding"),te}function te(R){return Se(R)?ke(t,we,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(R):we(R)}function we(R){return t.enter("htmlTextData"),s(R)}}var Aa={name:"labelEnd",tokenize:uH,resolveTo:lH,resolveAll:aH},oH={tokenize:cH},iH={tokenize:fH},sH={tokenize:dH};function aH(t){let e=-1;for(;++e=3&&(u===null||oe(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===o?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),Se(u)?ke(t,a,"whitespace")(u):a(u))}}var En={name:"list",tokenize:wH,continuation:{tokenize:xH},exit:kH},yH={tokenize:bH,partial:!0},vH={tokenize:SH,partial:!0};function wH(t,e,n){let r=this,o=r.events[r.events.length-1],i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(p){let m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Ed(p)){if(r.containerState.type||(r.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(La,n,u)(p):u(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return n(p)}function l(p){return Ed(p)&&++s<10?(t.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):n(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(xs,r.interrupt?n:c,t.attempt(yH,d,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,d(p)}function f(p){return Se(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),d):n(p)}function d(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function xH(t,e,n){let r=this;return r.containerState._closeFlow=void 0,t.check(xs,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ke(t,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!Se(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(vH,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ke(t,t.attempt(En,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function SH(t,e,n){let r=this;return ke(t,o,"listItemIndent",r.containerState.size+1);function o(i){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(i):n(i)}}function kH(t){t.exit(this.containerState.type)}function bH(t,e,n){let r=this;return ke(t,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function o(i){let s=r.events[r.events.length-1];return!Se(i)&&s&&s[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}var lv={name:"setextUnderline",tokenize:RH,resolveTo:EH};function EH(t,e){let n=t.length,r,o,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(o=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);let s={type:"setextHeading",start:Object.assign({},t[o][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[o][1].type="setextHeadingText",i?(t.splice(o,0,["enter",s,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end=Object.assign({},t[i][1].end)):t[r][1]=s,t.push(["exit",s,e]),t}function RH(t,e,n){let r=this,o;return i;function i(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)?(t.enter("setextHeadingLine"),o=u,s(u)):n(u)}function s(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),Se(u)?ke(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||oe(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}var IF={tokenize:CH};function CH(t){let e=this,n=t.attempt(xs,r,t.attempt(this.parser.constructs.flowInitial,o,ke(t,t.attempt(this.parser.constructs.flow,o,t.attempt(hE,o)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function o(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}var AF={resolveAll:BF()},LF=FF("string"),DF=FF("text");function FF(t){return{tokenize:e,resolveAll:BF(t==="text"?TH:void 0)};function e(n){let r=this,o=this.parser.constructs[t],i=n.attempt(o,s,a);return s;function s(c){return u(c)?i(c):a(c)}function a(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"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;let f=o[c],d=-1;if(f)for(;++d-1){let a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(t[o].slice(0,i))}return s}function OH(t,e){let n=-1,r=[],o;for(;++n{let o=e.some(u=>u.docChanged)&&!n.doc.eq(r.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!o||i)return;let{tr:s}=r,a=OL(n.doc,[...e]);if(ML(a).forEach(({newRange:u})=>{let c=NL(r.doc,u,p=>p.isTextblock),f,d;if(c.length>1?(f=c[0],d=r.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ")):c.length&&r.doc.textBetween(u.from,u.to," "," ").endsWith(" ")&&(f=c[0],d=r.doc.textBetween(f.pos,u.to,void 0," ")),f&&d){let p=d.split(" ").filter(w=>w!=="");if(p.length<=0)return!1;let m=p[p.length-1],y=f.pos+d.lastIndexOf(m);if(!m)return!1;Zy(m).filter(w=>w.isLink).map(w=>({...w,from:y+w.start+1,to:y+w.end+1})).filter(w=>r.schema.marks.code?!r.doc.rangeHasMark(w.from,w.to,r.schema.marks.code):!0).filter(w=>t.validate?t.validate(w.value):!0).forEach(w=>{sy(w.from,w.to,r.doc).some(g=>g.mark.type===t.type)||s.addMark(w.from,w.to,t.type.create({href:w.href}))})}}),!!s.steps.length)return s}})}function n9(t){return new At({key:new an("handleClickLink"),props:{handleClick:(e,n,r)=>{var o,i;if(r.button!==0||r.target.nodeName!=="A")return!1;let a=e1(e.state,t.type.name),l=r.target,u=(o=l?.href)!==null&&o!==void 0?o:a.href,c=(i=l?.target)!==null&&i!==void 0?i:a.target;return l&&u?(e.editable&&window.open(u,c),!0):!1}}})}function r9(t){return new At({key:new an("handlePasteLink"),props:{handlePaste:(e,n,r)=>{let{state:o}=e,{selection:i}=o,{empty:s}=i;if(s)return!1;let a="";r.content.forEach(u=>{a+=u.textContent});let l=Zy(a).find(u=>u.isLink&&u.value===a);return!a||!l?!1:(t.editor.commands.setMark(t.type,{href:l.href}),!0)}}})}var VD=dr.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(t=>{if(typeof t=="string"){Z1(t);return}Z1(t.scheme,t.optionalSlashes)})},onDestroy(){zD()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:t}){var e;return!((e=t.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",Wt(this.options.HTMLAttributes,{...t,href:""}),0]:["a",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Lr({find:(t,e)=>{var n;let r=(n=e?.clipboardData)===null||n===void 0?void 0:n.getData("text/html"),o=[];if(r){let i=new DOMParser().parseFromString(r,"text/html"),s=i.querySelectorAll("a");s.length&&[...s].forEach(a=>o.push({text:a.innerText,data:{href:a.getAttribute("href")},index:i.body.innerText.indexOf(a.innerText)+a.innerText.length}))}if(t){let i=Zy(t).filter(s=>s.isLink);i.length&&i.forEach(s=>o.push({text:s.value,data:{href:s.href},index:s.start}))}return o},type:this.type,getAttributes:t=>{var e;return{href:(e=t.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){let t=[];return this.options.autolink&&t.push(t9({type:this.type,validate:this.options.validate})),this.options.openOnClick&&t.push(n9({type:this.type})),this.options.linkOnPaste&&t.push(r9({editor:this.editor,type:this.type})),t}});var o9=/(?:^|\s)\[([^\]]*)?\]\((\S+)(?: ["“](.+)["”])?\)$/i,i9=/(?:^|\s)\[([^\]]*)?\]\((\S+)(?: ["“](.+)["”])?\)/gi;function s9(t){let e=To(t);return new Ru({find:t.find,handler(n){let{tr:r}=n.state;e.handler(n),r.setMeta("preventAutolink",!0)}})}function a9(t){let e=Lr(t);return new od({find:t.find,handler(n){let{tr:r}=n.state;e.handler(n),r.setMeta("preventAutolink",!0)}})}var qD=VD.extend({inclusive:!1,addAttributes(){return{...this.parent?.(),title:{default:null}}},addInputRules(){return[s9({find:o9,type:this.type,getAttributes(t){return{title:t.pop()?.trim(),href:t.pop()?.trim()}}})]},addPasteRules(){return[a9({find:i9,type:this.type,getAttributes(t){return{title:t.pop()?.trim(),href:t.pop()?.trim()}}})]}});var eE=q(he(),1);var ev=q(he(),1);var Io=q(he(),1);function jD(t,e){let[n,r]=Io.useState(t);return Io.useEffect(()=>{let o=setTimeout(()=>{r(t)},e);return()=>{clearTimeout(o)}},[t,e]),n}var HD=qt([]);HD.debugLabel="tagsAtom";var $D=()=>{let[t,e]=Et(HD);return{tags:t,getTags:async()=>{let r=await mt.getTags({});e(r.tags)},setTags:e}};var mr=q(me(),1);function WD(t){let e=[t.name];for(let n of t.subTags)e=e.concat(`${t.name}/${WD(n)}`);return e}function l9(t){let e=[];for(let n of t)e=e.concat(WD(n));return e}var GD=({selectedTag:t,setSelectedTag:e,onAddTag:n})=>{let{tags:r,getTags:o}=$D();(0,ev.useEffect)(()=>{o()},[]);let i=l9(r),s=c=>i.filter(f=>f.toLowerCase().indexOf(c.toLowerCase())===0),[a,l]=(0,ev.useState)(s(t));return(0,mr.jsxs)("div",{className:"flex items-center gap-2",children:[(0,mr.jsx)(u9,{value:t,onChange:c=>{l(s(c)),e(c)},matchingOptions:a}),(0,mr.jsx)("button",{onClick:()=>n(t),className:"btn btn-square btn-primary",children:(0,mr.jsx)(hd,{className:"h-6 w-6"})})]})},u9=({onChange:t,value:e,matchingOptions:n})=>{let r=jD(n,300);return(0,mr.jsxs)(mr.Fragment,{children:[(0,mr.jsx)("input",{type:"text",value:e,onChange:o=>t(o.target.value),placeholder:"search by tag...",className:"input input-bordered w-full"}),r.length>0&&(0,mr.jsx)("ul",{className:"p-2 shadow menu dropdown-content bg-base-100 rounded-box w-52",children:r.map(o=>(0,mr.jsx)("li",{children:(0,mr.jsx)("a",{onClick:()=>{t(o)},children:o})},o))})]})};var Aa=q(me(),1),Hu=({onNewTag:t})=>{let[e,n]=(0,eE.useState)(!1),[r,o]=(0,eE.useState)("");return(0,Aa.jsxs)("div",{className:"flex flex-row",children:[(0,Aa.jsx)("button",{className:"btn flex",onClick:()=>n(!e),children:e?(0,Aa.jsx)(I1,{className:"h-6 w-6"}):(0,Aa.jsx)(hd,{className:"h-6 w-6"})}),e&&(0,Aa.jsx)(GD,{selectedTag:r,setSelectedTag:o,onAddTag:s=>{s&&(n(!1),t(s))}})]})};var Qu=q(he(),1);var tv=q(he(),1),tE=q(me(),1),nE=({children:t,open:e})=>{let n=tv.default.useRef(null);return(0,tv.useEffect)(()=>{n.current&&(e?n.current.showModal():n.current.close())},[e]),(0,tE.jsx)("dialog",{className:"modal",ref:n,children:(0,tE.jsx)("div",{className:"modal-box",children:t})})};var KD=["http","https","mailto","tel"];function YD(t){let e=(t||"").trim(),n=e.charAt(0);if(n==="#"||n==="/")return e;let r=e.indexOf(":");if(r===-1)return e;let o=-1;for(;++oo||(o=e.indexOf("#"),o!==-1&&r>o)?e:"javascript:void(0)"}var Bv=q(he(),1);var rF=q(rE(),1);function ws(t){return!t||typeof t!="object"?"":"position"in t||"type"in t?QD(t.position):"start"in t||"end"in t?QD(t):"line"in t||"column"in t?oE(t):""}function oE(t){return ZD(t&&t.line)+":"+ZD(t&&t.column)}function QD(t){return oE(t&&t.start)+"-"+oE(t&&t.end)}function ZD(t){return t&&typeof t=="number"?t:1}var bn=class extends Error{constructor(e,n,r){let o=[null,null],i={start:{line:null,column:null},end:{line:null,column:null}};if(super(),typeof n=="string"&&(r=n,n=void 0),typeof r=="string"){let s=r.indexOf(":");s===-1?o[1]=r:(o[0]=r.slice(0,s),o[1]=r.slice(s+1))}n&&("type"in n||"position"in n?n.position&&(i=n.position):"start"in n||"end"in n?i=n:("line"in n||"column"in n)&&(i.start=n)),this.name=ws(n)||"1:1",this.message=typeof e=="object"?e.message:e,this.stack="",typeof e=="object"&&e.stack&&(this.stack=e.stack),this.reason=this.message,this.fatal,this.line=i.start.line,this.column=i.start.column,this.position=i,this.source=o[0],this.ruleId=o[1],this.file,this.actual,this.expected,this.url,this.note}};bn.prototype.file="";bn.prototype.name="";bn.prototype.reason="";bn.prototype.message="";bn.prototype.stack="";bn.prototype.fatal=null;bn.prototype.column=null;bn.prototype.line=null;bn.prototype.source=null;bn.prototype.ruleId=null;bn.prototype.position=null;var uo={basename:c9,dirname:f9,extname:d9,join:p9,sep:"/"};function c9(t,e){if(e!==void 0&&typeof e!="string")throw new TypeError('"ext" argument must be a string');bd(t);let n=0,r=-1,o=t.length,i;if(e===void 0||e.length===0||e.length>t.length){for(;o--;)if(t.charCodeAt(o)===47){if(i){n=o+1;break}}else r<0&&(i=!0,r=o+1);return r<0?"":t.slice(n,r)}if(e===t)return"";let s=-1,a=e.length-1;for(;o--;)if(t.charCodeAt(o)===47){if(i){n=o+1;break}}else s<0&&(i=!0,s=o+1),a>-1&&(t.charCodeAt(o)===e.charCodeAt(a--)?a<0&&(r=o):(a=-1,r=s));return n===r?r=s:r<0&&(r=t.length),t.slice(n,r)}function f9(t){if(bd(t),t.length===0)return".";let e=-1,n=t.length,r;for(;--n;)if(t.charCodeAt(n)===47){if(r){e=n;break}}else r||(r=!0);return e<0?t.charCodeAt(0)===47?"/":".":e===1&&t.charCodeAt(0)===47?"//":t.slice(0,e)}function d9(t){bd(t);let e=t.length,n=-1,r=0,o=-1,i=0,s;for(;e--;){let a=t.charCodeAt(e);if(a===47){if(s){r=e+1;break}continue}n<0&&(s=!0,n=e+1),a===46?o<0?o=e:i!==1&&(i=1):o>-1&&(i=-1)}return o<0||n<0||i===0||i===1&&o===n-1&&o===r+1?"":t.slice(o,n)}function p9(...t){let e=-1,n;for(;++e0&&t.charCodeAt(t.length-1)===47&&(n+="/"),e?"/"+n:n}function h9(t,e){let n="",r=0,o=-1,i=0,s=-1,a,l;for(;++s<=t.length;){if(s2){if(l=n.lastIndexOf("/"),l!==n.length-1){l<0?(n="",r=0):(n=n.slice(0,l),r=n.length-1-n.lastIndexOf("/")),o=s,i=0;continue}}else if(n.length>0){n="",r=0,o=s,i=0;continue}}e&&(n=n.length>0?n+"/..":"..",r=2)}else n.length>0?n+="/"+t.slice(o+1,s):n=t.slice(o+1,s),r=s-o-1;o=s,i=0}else a===46&&i>-1?i++:i=-1}return n}function bd(t){if(typeof t!="string")throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}var eF={cwd:g9};function g9(){return"/"}function $u(t){return t!==null&&typeof t=="object"&&t.href&&t.origin}function tF(t){if(typeof t=="string")t=new URL(t);else if(!$u(t)){let e=new TypeError('The "path" argument must be of type string or an instance of URL. Received `'+t+"`");throw e.code="ERR_INVALID_ARG_TYPE",e}if(t.protocol!=="file:"){let e=new TypeError("The URL must be of scheme file");throw e.code="ERR_INVALID_URL_SCHEME",e}return y9(t)}function y9(t){if(t.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 e=t.pathname,n=-1;for(;++ns.length,l;a&&s.push(o);try{l=t.apply(this,s)}catch(u){let c=u;if(a&&n)throw c;return o(c)}a||(l instanceof Promise?l.then(i,o):l instanceof Error?o(l):i(l))}function o(s,...a){n||(n=!0,e(s,...a))}function i(s){o(null,s)}}var pE=wF().freeze(),vF={}.hasOwnProperty;function wF(){let t=pF(),e=[],n={},r,o=-1;return i.data=s,i.Parser=void 0,i.Compiler=void 0,i.freeze=a,i.attachers=e,i.use=l,i.parse=u,i.stringify=c,i.run=f,i.runSync=d,i.process=p,i.processSync=m,i;function i(){let y=wF(),w=-1;for(;++w{if(x||!R||!E)b(x);else{let O=i.stringify(R,E);O==null||(k9(O)?E.value=O:E.result=O),b(x,E)}});function b(x,R){x||!R?k(x):v?v(R):w(null,R)}}}function m(y){let w;i.freeze(),uE("processSync",i.Parser),cE("processSync",i.Compiler);let g=Rd(y);return i.process(g,v),gF("processSync","process",w),g;function v(k){w=!0,lE(k)}}}function mF(t,e){return typeof t=="function"&&t.prototype&&(x9(t.prototype)||e in t.prototype)}function x9(t){let e;for(e in t)if(vF.call(t,e))return!0;return!1}function uE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `Parser`")}function cE(t,e){if(typeof e!="function")throw new TypeError("Cannot `"+t+"` without `Compiler`")}function fE(t,e){if(e)throw new Error("Cannot call `"+t+"` on a frozen processor.\nCreate a new processor first, by calling it: use `processor()` instead of `processor`.")}function hF(t){if(!Ed(t)||typeof t.type!="string")throw new TypeError("Expected node, got `"+t+"`")}function gF(t,e,n){if(!n)throw new Error("`"+t+"` finished async. Use `"+e+"` instead")}function Rd(t){return S9(t)?t:new La(t)}function S9(t){return!!(t&&typeof t=="object"&&"message"in t&&"messages"in t)}function k9(t){return typeof t=="string"||(0,yF.default)(t)}var b9={};function mE(t,e){let n=e||b9,r=typeof n.includeImageAlt=="boolean"?n.includeImageAlt:!0,o=typeof n.includeHtml=="boolean"?n.includeHtml:!0;return SF(t,r,o)}function SF(t,e,n){if(E9(t)){if("value"in t)return t.type==="html"&&!n?"":t.value;if(e&&"alt"in t&&t.alt)return t.alt;if("children"in t)return xF(t.children,e,n)}return Array.isArray(t)?xF(t,e,n):""}function xF(t,e,n){let r=[],o=-1;for(;++oo?0:o+e:e=e>o?o:e,n=n>0?n:0,r.length<1e4)s=Array.from(r),s.unshift(e,n),t.splice(...s);else for(n&&t.splice(e,n);i0?(un(t,t.length,0,e),t):e}var kF={}.hasOwnProperty;function bF(t){let e={},n=-1;for(;++ns))return;let R=e.events.length,E=R,O,I;for(;E--;)if(e.events[E][0]==="exit"&&e.events[E][1].type==="chunkFlow"){if(O){I=e.events[E][1].end;break}O=!0}for(g(r),x=R;xk;){let b=n[S];e.containerState=b[1],b[0].exit.call(e,t)}n.length=k}function v(){o.write([null]),i=void 0,o=void 0,e.containerState._closeFlow=void 0}}function O9(t,e,n){return ke(t,t.attempt(this.parser.constructs.document,e,n),"linePrefix",this.parser.constructs.disable.null.includes("codeIndented")?void 0:4)}function hE(t){if(t===null||Tt(t)||OF(t))return 1;if(PF(t))return 2}function Wu(t,e,n){let r=[],o=-1;for(;++o1&&t[n][1].end.offset-t[n][1].start.offset>1?2:1;let f=Object.assign({},t[r][1].end),d=Object.assign({},t[n][1].start);AF(f,-l),AF(d,l),s={type:l>1?"strongSequence":"emphasisSequence",start:f,end:Object.assign({},t[r][1].end)},a={type:l>1?"strongSequence":"emphasisSequence",start:Object.assign({},t[n][1].start),end:d},i={type:l>1?"strongText":"emphasisText",start:Object.assign({},t[r][1].end),end:Object.assign({},t[n][1].start)},o={type:l>1?"strong":"emphasis",start:Object.assign({},s.start),end:Object.assign({},a.end)},t[r][1].end=Object.assign({},s.start),t[n][1].start=Object.assign({},a.end),u=[],t[r][1].end.offset-t[r][1].start.offset&&(u=Vn(u,[["enter",t[r][1],e],["exit",t[r][1],e]])),u=Vn(u,[["enter",o,e],["enter",s,e],["exit",s,e],["enter",i,e]]),u=Vn(u,Wu(e.parser.constructs.insideSpan.null,t.slice(r+1,n),e)),u=Vn(u,[["exit",i,e],["enter",a,e],["exit",a,e],["exit",o,e]]),t[n][1].end.offset-t[n][1].start.offset?(c=2,u=Vn(u,[["enter",t[n][1],e],["exit",t[n][1],e]])):c=0,un(t,r-1,n-r+3,u),n=r+u.length-c-2;break}}for(n=-1;++n0&&xe(x)?ke(t,v,"linePrefix",i+1)(x):v(x)}function v(x){return x===null||oe(x)?t.check(DF,y,S)(x):(t.enter("codeFlowValue"),k(x))}function k(x){return x===null||oe(x)?(t.exit("codeFlowValue"),v(x)):(t.consume(x),k)}function S(x){return t.exit("codeFenced"),e(x)}function b(x,R,E){let O=0;return I;function I(V){return x.enter("lineEnding"),x.consume(V),x.exit("lineEnding"),B}function B(V){return x.enter("codeFencedFence"),xe(V)?ke(x,L,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(V):L(V)}function L(V){return V===a?(x.enter("codeFencedFenceSequence"),A(V)):E(V)}function A(V){return V===a?(O++,x.consume(V),A):O>=s?(x.exit("codeFencedFenceSequence"),xe(V)?ke(x,U,"whitespace")(V):U(V)):E(V)}function U(V){return V===null||oe(V)?(x.exit("codeFencedFence"),R(V)):E(V)}}}function _9(t,e,n){let r=this;return o;function o(s){return s===null?n(s):(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i)}function i(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}var Od={name:"codeIndented",tokenize:V9},z9={tokenize:q9,partial:!0};function V9(t,e,n){let r=this;return o;function o(u){return t.enter("codeIndented"),ke(t,i,"linePrefix",4+1)(u)}function i(u){let c=r.events[r.events.length-1];return c&&c[1].type==="linePrefix"&&c[2].sliceSerialize(c[1],!0).length>=4?s(u):n(u)}function s(u){return u===null?l(u):oe(u)?t.attempt(z9,s,l)(u):(t.enter("codeFlowValue"),a(u))}function a(u){return u===null||oe(u)?(t.exit("codeFlowValue"),s(u)):(t.consume(u),a)}function l(u){return t.exit("codeIndented"),e(u)}}function q9(t,e,n){let r=this;return o;function o(s){return r.parser.lazy[r.now().line]?n(s):oe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),o):ke(t,i,"linePrefix",4+1)(s)}function i(s){let a=r.events[r.events.length-1];return a&&a[1].type==="linePrefix"&&a[2].sliceSerialize(a[1],!0).length>=4?e(s):oe(s)?o(s):n(s)}}var yE={name:"codeText",tokenize:$9,resolve:j9,previous:H9};function j9(t){let e=t.length-4,n=3,r,o;if((t[n][1].type==="lineEnding"||t[n][1].type==="space")&&(t[e][1].type==="lineEnding"||t[e][1].type==="space")){for(r=n;++r=4?e(s):t.interrupt(r.parser.constructs.flow,n,e)(s)}}function lv(t,e,n,r,o,i,s,a,l){let u=l||Number.POSITIVE_INFINITY,c=0;return f;function f(g){return g===60?(t.enter(r),t.enter(o),t.enter(i),t.consume(g),t.exit(i),d):g===null||g===32||g===41||Cd(g)?n(g):(t.enter(r),t.enter(s),t.enter(a),t.enter("chunkString",{contentType:"string"}),y(g))}function d(g){return g===62?(t.enter(i),t.consume(g),t.exit(i),t.exit(o),t.exit(r),e):(t.enter(a),t.enter("chunkString",{contentType:"string"}),p(g))}function p(g){return g===62?(t.exit("chunkString"),t.exit(a),d(g)):g===null||g===60||oe(g)?n(g):(t.consume(g),g===92?m:p)}function m(g){return g===60||g===62||g===92?(t.consume(g),p):p(g)}function y(g){return!c&&(g===null||g===41||Tt(g))?(t.exit("chunkString"),t.exit(a),t.exit(s),t.exit(r),e(g)):c999||p===null||p===91||p===93&&!l||p===94&&!a&&"_hiddenFootnoteSupport"in s.parser.constructs?n(p):p===93?(t.exit(i),t.enter(o),t.consume(p),t.exit(o),t.exit(r),e):oe(p)?(t.enter("lineEnding"),t.consume(p),t.exit("lineEnding"),c):(t.enter("chunkString",{contentType:"string"}),f(p))}function f(p){return p===null||p===91||p===93||oe(p)||a++>999?(t.exit("chunkString"),c(p)):(t.consume(p),l||(l=!xe(p)),p===92?d:f)}function d(p){return p===91||p===92||p===93?(t.consume(p),a++,f):f(p)}}function cv(t,e,n,r,o,i){let s;return a;function a(d){return d===34||d===39||d===40?(t.enter(r),t.enter(o),t.consume(d),t.exit(o),s=d===40?41:d,l):n(d)}function l(d){return d===s?(t.enter(o),t.consume(d),t.exit(o),t.exit(r),e):(t.enter(i),u(d))}function u(d){return d===s?(t.exit(i),l(s)):d===null?n(d):oe(d)?(t.enter("lineEnding"),t.consume(d),t.exit("lineEnding"),ke(t,u,"linePrefix")):(t.enter("chunkString",{contentType:"string"}),c(d))}function c(d){return d===s||d===null||oe(d)?(t.exit("chunkString"),u(d)):(t.consume(d),d===92?f:c)}function f(d){return d===s||d===92?(t.consume(d),c):c(d)}}function Da(t,e){let n;return r;function r(o){return oe(o)?(t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),n=!0,r):xe(o)?ke(t,r,n?"linePrefix":"lineSuffix")(o):e(o)}}function xi(t){return t.replace(/[\t\n\r ]+/g," ").replace(/^ | $/g,"").toLowerCase().toUpperCase()}var wE={name:"definition",tokenize:Z9},Q9={tokenize:eH,partial:!0};function Z9(t,e,n){let r=this,o;return i;function i(p){return t.enter("definition"),s(p)}function s(p){return uv.call(r,t,a,n,"definitionLabel","definitionLabelMarker","definitionLabelString")(p)}function a(p){return o=xi(r.sliceSerialize(r.events[r.events.length-1][1]).slice(1,-1)),p===58?(t.enter("definitionMarker"),t.consume(p),t.exit("definitionMarker"),l):n(p)}function l(p){return Tt(p)?Da(t,u)(p):u(p)}function u(p){return lv(t,c,n,"definitionDestination","definitionDestinationLiteral","definitionDestinationLiteralMarker","definitionDestinationRaw","definitionDestinationString")(p)}function c(p){return t.attempt(Q9,f,f)(p)}function f(p){return xe(p)?ke(t,d,"whitespace")(p):d(p)}function d(p){return p===null||oe(p)?(t.exit("definition"),r.parser.defined.push(o),e(p)):n(p)}}function eH(t,e,n){return r;function r(a){return Tt(a)?Da(t,o)(a):n(a)}function o(a){return cv(t,i,n,"definitionTitle","definitionTitleMarker","definitionTitleString")(a)}function i(a){return xe(a)?ke(t,s,"whitespace")(a):s(a)}function s(a){return a===null||oe(a)?e(a):n(a)}}var xE={name:"hardBreakEscape",tokenize:tH};function tH(t,e,n){return r;function r(i){return t.enter("hardBreakEscape"),t.consume(i),o}function o(i){return oe(i)?(t.exit("hardBreakEscape"),e(i)):n(i)}}var SE={name:"headingAtx",tokenize:rH,resolve:nH};function nH(t,e){let n=t.length-2,r=3,o,i;return t[r][1].type==="whitespace"&&(r+=2),n-2>r&&t[n][1].type==="whitespace"&&(n-=2),t[n][1].type==="atxHeadingSequence"&&(r===n-1||n-4>r&&t[n-2][1].type==="whitespace")&&(n-=r+1===n?2:4),n>r&&(o={type:"atxHeadingText",start:t[r][1].start,end:t[n][1].end},i={type:"chunkText",start:t[r][1].start,end:t[n][1].end,contentType:"text"},un(t,r,n-r+1,[["enter",o,e],["enter",i,e],["exit",i,e],["exit",o,e]])),t}function rH(t,e,n){let r=0;return o;function o(c){return t.enter("atxHeading"),i(c)}function i(c){return t.enter("atxHeadingSequence"),s(c)}function s(c){return c===35&&r++<6?(t.consume(c),s):c===null||Tt(c)?(t.exit("atxHeadingSequence"),a(c)):n(c)}function a(c){return c===35?(t.enter("atxHeadingSequence"),l(c)):c===null||oe(c)?(t.exit("atxHeading"),e(c)):xe(c)?ke(t,a,"whitespace")(c):(t.enter("atxHeadingText"),u(c))}function l(c){return c===35?(t.consume(c),l):(t.exit("atxHeadingSequence"),a(c))}function u(c){return c===null||c===35||Tt(c)?(t.exit("atxHeadingText"),a(c)):(t.consume(c),u)}}var FF=["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"],kE=["pre","script","style","textarea"];var bE={name:"htmlFlow",tokenize:aH,resolveTo:sH,concrete:!0},oH={tokenize:uH,partial:!0},iH={tokenize:lH,partial:!0};function sH(t){let e=t.length;for(;e--&&!(t[e][0]==="enter"&&t[e][1].type==="htmlFlow"););return e>1&&t[e-2][1].type==="linePrefix"&&(t[e][1].start=t[e-2][1].start,t[e+1][1].start=t[e-2][1].start,t.splice(e-2,2)),t}function aH(t,e,n){let r=this,o,i,s,a,l;return u;function u(T){return c(T)}function c(T){return t.enter("htmlFlow"),t.enter("htmlFlowData"),t.consume(T),f}function f(T){return T===33?(t.consume(T),d):T===47?(t.consume(T),i=!0,y):T===63?(t.consume(T),o=3,r.interrupt?e:C):hr(T)?(t.consume(T),s=String.fromCharCode(T),w):n(T)}function d(T){return T===45?(t.consume(T),o=2,p):T===91?(t.consume(T),o=5,a=0,m):hr(T)?(t.consume(T),o=4,r.interrupt?e:C):n(T)}function p(T){return T===45?(t.consume(T),r.interrupt?e:C):n(T)}function m(T){let Qe="CDATA[";return T===Qe.charCodeAt(a++)?(t.consume(T),a===Qe.length?r.interrupt?e:L:m):n(T)}function y(T){return hr(T)?(t.consume(T),s=String.fromCharCode(T),w):n(T)}function w(T){if(T===null||T===47||T===62||Tt(T)){let Qe=T===47,St=s.toLowerCase();return!Qe&&!i&&kE.includes(St)?(o=1,r.interrupt?e(T):L(T)):FF.includes(s.toLowerCase())?(o=6,Qe?(t.consume(T),g):r.interrupt?e(T):L(T)):(o=7,r.interrupt&&!r.parser.lazy[r.now().line]?n(T):i?v(T):k(T))}return T===45||Yt(T)?(t.consume(T),s+=String.fromCharCode(T),w):n(T)}function g(T){return T===62?(t.consume(T),r.interrupt?e:L):n(T)}function v(T){return xe(T)?(t.consume(T),v):I(T)}function k(T){return T===47?(t.consume(T),I):T===58||T===95||hr(T)?(t.consume(T),S):xe(T)?(t.consume(T),k):I(T)}function S(T){return T===45||T===46||T===58||T===95||Yt(T)?(t.consume(T),S):b(T)}function b(T){return T===61?(t.consume(T),x):xe(T)?(t.consume(T),b):k(T)}function x(T){return T===null||T===60||T===61||T===62||T===96?n(T):T===34||T===39?(t.consume(T),l=T,R):xe(T)?(t.consume(T),x):E(T)}function R(T){return T===l?(t.consume(T),l=null,O):T===null||oe(T)?n(T):(t.consume(T),R)}function E(T){return T===null||T===34||T===39||T===47||T===60||T===61||T===62||T===96||Tt(T)?b(T):(t.consume(T),E)}function O(T){return T===47||T===62||xe(T)?k(T):n(T)}function I(T){return T===62?(t.consume(T),B):n(T)}function B(T){return T===null||oe(T)?L(T):xe(T)?(t.consume(T),B):n(T)}function L(T){return T===45&&o===2?(t.consume(T),Q):T===60&&o===1?(t.consume(T),G):T===62&&o===4?(t.consume(T),it):T===63&&o===3?(t.consume(T),C):T===93&&o===5?(t.consume(T),ve):oe(T)&&(o===6||o===7)?(t.exit("htmlFlowData"),t.check(oH,ct,A)(T)):T===null||oe(T)?(t.exit("htmlFlowData"),A(T)):(t.consume(T),L)}function A(T){return t.check(iH,U,ct)(T)}function U(T){return t.enter("lineEnding"),t.consume(T),t.exit("lineEnding"),V}function V(T){return T===null||oe(T)?A(T):(t.enter("htmlFlowData"),L(T))}function Q(T){return T===45?(t.consume(T),C):L(T)}function G(T){return T===47?(t.consume(T),s="",te):L(T)}function te(T){if(T===62){let Qe=s.toLowerCase();return kE.includes(Qe)?(t.consume(T),it):L(T)}return hr(T)&&s.length<8?(t.consume(T),s+=String.fromCharCode(T),te):L(T)}function ve(T){return T===93?(t.consume(T),C):L(T)}function C(T){return T===62?(t.consume(T),it):T===45&&o===2?(t.consume(T),C):L(T)}function it(T){return T===null||oe(T)?(t.exit("htmlFlowData"),ct(T)):(t.consume(T),it)}function ct(T){return t.exit("htmlFlow"),e(T)}}function lH(t,e,n){let r=this;return o;function o(s){return oe(s)?(t.enter("lineEnding"),t.consume(s),t.exit("lineEnding"),i):n(s)}function i(s){return r.parser.lazy[r.now().line]?n(s):e(s)}}function uH(t,e,n){return r;function r(o){return t.enter("lineEnding"),t.consume(o),t.exit("lineEnding"),t.attempt(Ss,e,n)}}var EE={name:"htmlText",tokenize:cH};function cH(t,e,n){let r=this,o,i,s;return a;function a(C){return t.enter("htmlText"),t.enter("htmlTextData"),t.consume(C),l}function l(C){return C===33?(t.consume(C),u):C===47?(t.consume(C),b):C===63?(t.consume(C),k):hr(C)?(t.consume(C),E):n(C)}function u(C){return C===45?(t.consume(C),c):C===91?(t.consume(C),i=0,m):hr(C)?(t.consume(C),v):n(C)}function c(C){return C===45?(t.consume(C),p):n(C)}function f(C){return C===null?n(C):C===45?(t.consume(C),d):oe(C)?(s=f,G(C)):(t.consume(C),f)}function d(C){return C===45?(t.consume(C),p):f(C)}function p(C){return C===62?Q(C):C===45?d(C):f(C)}function m(C){let it="CDATA[";return C===it.charCodeAt(i++)?(t.consume(C),i===it.length?y:m):n(C)}function y(C){return C===null?n(C):C===93?(t.consume(C),w):oe(C)?(s=y,G(C)):(t.consume(C),y)}function w(C){return C===93?(t.consume(C),g):y(C)}function g(C){return C===62?Q(C):C===93?(t.consume(C),g):y(C)}function v(C){return C===null||C===62?Q(C):oe(C)?(s=v,G(C)):(t.consume(C),v)}function k(C){return C===null?n(C):C===63?(t.consume(C),S):oe(C)?(s=k,G(C)):(t.consume(C),k)}function S(C){return C===62?Q(C):k(C)}function b(C){return hr(C)?(t.consume(C),x):n(C)}function x(C){return C===45||Yt(C)?(t.consume(C),x):R(C)}function R(C){return oe(C)?(s=R,G(C)):xe(C)?(t.consume(C),R):Q(C)}function E(C){return C===45||Yt(C)?(t.consume(C),E):C===47||C===62||Tt(C)?O(C):n(C)}function O(C){return C===47?(t.consume(C),Q):C===58||C===95||hr(C)?(t.consume(C),I):oe(C)?(s=O,G(C)):xe(C)?(t.consume(C),O):Q(C)}function I(C){return C===45||C===46||C===58||C===95||Yt(C)?(t.consume(C),I):B(C)}function B(C){return C===61?(t.consume(C),L):oe(C)?(s=B,G(C)):xe(C)?(t.consume(C),B):O(C)}function L(C){return C===null||C===60||C===61||C===62||C===96?n(C):C===34||C===39?(t.consume(C),o=C,A):oe(C)?(s=L,G(C)):xe(C)?(t.consume(C),L):(t.consume(C),U)}function A(C){return C===o?(t.consume(C),o=void 0,V):C===null?n(C):oe(C)?(s=A,G(C)):(t.consume(C),A)}function U(C){return C===null||C===34||C===39||C===60||C===61||C===96?n(C):C===47||C===62||Tt(C)?O(C):(t.consume(C),U)}function V(C){return C===47||C===62||Tt(C)?O(C):n(C)}function Q(C){return C===62?(t.consume(C),t.exit("htmlTextData"),t.exit("htmlText"),e):n(C)}function G(C){return t.exit("htmlTextData"),t.enter("lineEnding"),t.consume(C),t.exit("lineEnding"),te}function te(C){return xe(C)?ke(t,ve,"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(C):ve(C)}function ve(C){return t.enter("htmlTextData"),s(C)}}var Fa={name:"labelEnd",tokenize:gH,resolveTo:hH,resolveAll:mH},fH={tokenize:yH},dH={tokenize:vH},pH={tokenize:wH};function mH(t){let e=-1;for(;++e=3&&(u===null||oe(u))?(t.exit("thematicBreak"),e(u)):n(u)}function l(u){return u===o?(t.consume(u),r++,l):(t.exit("thematicBreakSequence"),xe(u)?ke(t,a,"whitespace")(u):a(u))}}var En={name:"list",tokenize:CH,continuation:{tokenize:TH},exit:OH},EH={tokenize:NH,partial:!0},RH={tokenize:PH,partial:!0};function CH(t,e,n){let r=this,o=r.events[r.events.length-1],i=o&&o[1].type==="linePrefix"?o[2].sliceSerialize(o[1],!0).length:0,s=0;return a;function a(p){let m=r.containerState.type||(p===42||p===43||p===45?"listUnordered":"listOrdered");if(m==="listUnordered"?!r.containerState.marker||p===r.containerState.marker:Td(p)){if(r.containerState.type||(r.containerState.type=m,t.enter(m,{_container:!0})),m==="listUnordered")return t.enter("listItemPrefix"),p===42||p===45?t.check(Ba,n,u)(p):u(p);if(!r.interrupt||p===49)return t.enter("listItemPrefix"),t.enter("listItemValue"),l(p)}return n(p)}function l(p){return Td(p)&&++s<10?(t.consume(p),l):(!r.interrupt||s<2)&&(r.containerState.marker?p===r.containerState.marker:p===41||p===46)?(t.exit("listItemValue"),u(p)):n(p)}function u(p){return t.enter("listItemMarker"),t.consume(p),t.exit("listItemMarker"),r.containerState.marker=r.containerState.marker||p,t.check(Ss,r.interrupt?n:c,t.attempt(EH,d,f))}function c(p){return r.containerState.initialBlankLine=!0,i++,d(p)}function f(p){return xe(p)?(t.enter("listItemPrefixWhitespace"),t.consume(p),t.exit("listItemPrefixWhitespace"),d):n(p)}function d(p){return r.containerState.size=i+r.sliceSerialize(t.exit("listItemPrefix"),!0).length,e(p)}}function TH(t,e,n){let r=this;return r.containerState._closeFlow=void 0,t.check(Ss,o,i);function o(a){return r.containerState.furtherBlankLines=r.containerState.furtherBlankLines||r.containerState.initialBlankLine,ke(t,e,"listItemIndent",r.containerState.size+1)(a)}function i(a){return r.containerState.furtherBlankLines||!xe(a)?(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,s(a)):(r.containerState.furtherBlankLines=void 0,r.containerState.initialBlankLine=void 0,t.attempt(RH,e,s)(a))}function s(a){return r.containerState._closeFlow=!0,r.interrupt=void 0,ke(t,t.attempt(En,e,n),"linePrefix",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(a)}}function PH(t,e,n){let r=this;return ke(t,o,"listItemIndent",r.containerState.size+1);function o(i){let s=r.events[r.events.length-1];return s&&s[1].type==="listItemIndent"&&s[2].sliceSerialize(s[1],!0).length===r.containerState.size?e(i):n(i)}}function OH(t){t.exit(this.containerState.type)}function NH(t,e,n){let r=this;return ke(t,o,"listItemPrefixWhitespace",r.parser.constructs.disable.null.includes("codeIndented")?void 0:4+1);function o(i){let s=r.events[r.events.length-1];return!xe(i)&&s&&s[1].type==="listItemPrefixWhitespace"?e(i):n(i)}}var fv={name:"setextUnderline",tokenize:IH,resolveTo:MH};function MH(t,e){let n=t.length,r,o,i;for(;n--;)if(t[n][0]==="enter"){if(t[n][1].type==="content"){r=n;break}t[n][1].type==="paragraph"&&(o=n)}else t[n][1].type==="content"&&t.splice(n,1),!i&&t[n][1].type==="definition"&&(i=n);let s={type:"setextHeading",start:Object.assign({},t[o][1].start),end:Object.assign({},t[t.length-1][1].end)};return t[o][1].type="setextHeadingText",i?(t.splice(o,0,["enter",s,e]),t.splice(i+1,0,["exit",t[r][1],e]),t[r][1].end=Object.assign({},t[i][1].end)):t[r][1]=s,t.push(["exit",s,e]),t}function IH(t,e,n){let r=this,o;return i;function i(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)?(t.enter("setextHeadingLine"),o=u,s(u)):n(u)}function s(u){return t.enter("setextHeadingLineSequence"),a(u)}function a(u){return u===o?(t.consume(u),a):(t.exit("setextHeadingLineSequence"),xe(u)?ke(t,l,"lineSuffix")(u):l(u))}function l(u){return u===null||oe(u)?(t.exit("setextHeadingLine"),e(u)):n(u)}}var BF={tokenize:AH};function AH(t){let e=this,n=t.attempt(Ss,r,t.attempt(this.parser.constructs.flowInitial,o,ke(t,t.attempt(this.parser.constructs.flow,o,t.attempt(vE,o)),"linePrefix")));return n;function r(i){if(i===null){t.consume(i);return}return t.enter("lineEndingBlank"),t.consume(i),t.exit("lineEndingBlank"),e.currentConstruct=void 0,n}function o(i){if(i===null){t.consume(i);return}return t.enter("lineEnding"),t.consume(i),t.exit("lineEnding"),e.currentConstruct=void 0,n}}var JF={resolveAll:VF()},UF=zF("string"),_F=zF("text");function zF(t){return{tokenize:e,resolveAll:VF(t==="text"?LH:void 0)};function e(n){let r=this,o=this.parser.constructs[t],i=n.attempt(o,s,a);return s;function s(c){return u(c)?i(c):a(c)}function a(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"),i(c)):(n.consume(c),l)}function u(c){if(c===null)return!0;let f=o[c],d=-1;if(f)for(;++d-1){let a=s[0];typeof a=="string"?s[0]=a.slice(r):s.shift()}i>0&&s.push(t[o].slice(0,i))}return s}function FH(t,e){let n=-1,r=[],o;for(;++nBH,contentInitial:()=>MH,disable:()=>JH,document:()=>NH,flow:()=>AH,flowInitial:()=>IH,insideSpan:()=>FH,string:()=>LH,text:()=>DH});var NH={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:ev},MH={91:gE},IH={[-2]:Cd,[-1]:Cd,32:Cd},AH={35:vE,42:La,45:[lv,La],60:xE,61:lv,95:La,96:rv,126:rv},LH={38:nv,92:tv},DH={[-5]:Td,[-4]:Td,[-3]:Td,33:kE,38:nv,42:Rd,60:[pE,SE],91:bE,92:[yE,tv],93:Aa,95:Rd,96:mE},FH={null:[Rd,AF]},BH={null:[42,95]},JH={null:[]};function UF(t){let n=vF([EE,...(t||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:o(RF),document:o(TF),flow:o(IF),string:o(LF),text:o(DF)};return r;function o(i){return s;function s(a){return JF(r,i,a)}}}var _F=/[\0\t\n\r]/g;function zF(){let t=1,e="",n=!0,r;return o;function o(i,s,a){let l=[],u,c,f,d,p;for(i=e+i.toString(s),f=0,e="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCharCode(n)}var UH=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function qF(t){return t.replace(UH,_H)}function _H(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),i=o===120||o===88;return uv(n.slice(i?2:1),i?16:10)}return $u(n)||t}var HF={}.hasOwnProperty,RE=function(t,e,n){return typeof e!="string"&&(n=e,e=void 0),zH(n)(VF(UF(n).document().write(zF()(t,e,!0))))};function zH(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(D),autolinkProtocol:B,autolinkEmail:B,atxHeading:a(Uo),blockQuote:a(Tn),characterEscape:B,characterReference:B,codeFenced:a(Pn),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(Pn,l),codeText:a(qr,l),codeTextData:B,data:B,codeFlowValue:B,definition:a(Bo),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(Jo),hardBreakEscape:a(_o),hardBreakTrailing:a(_o),htmlFlow:a(Ei,l),htmlFlowData:B,htmlText:a(Ei,l),htmlTextData:B,image:a(P),label:l,link:a(D),listItem:a(Z),listItemValue:m,listOrdered:a(_,p),listUnordered:a(_),paragraph:a(Y),reference:St,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(Uo),strong:a(W),thematicBreak:a(De)},exit:{atxHeading:c(),atxHeadingSequence:T,autolink:c(),autolinkEmail:kt,autolinkProtocol:pn,blockQuote:c(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:dn,characterReferenceMarkerNumeric:dn,characterReferenceValue:Ve,codeFenced:c(v),codeFencedFence:g,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:L,codeIndented:c(k),codeText:c(G),codeTextData:L,data:L,definition:c(),definitionDestinationString:x,definitionLabelString:S,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(U),hardBreakTrailing:c(U),htmlFlow:c(V),htmlFlowData:L,htmlText:c(Q),htmlTextData:L,image:c(we),label:it,labelText:R,lineEnding:I,link:c(te),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Cn,resourceDestinationString:ct,resourceTitleString:C,resource:Qe,setextHeading:c(A),setextHeadingLineSequence:O,setextHeadingText:E,strong:c(),thematicBreak:c()}};$F(e,(t||{}).mdastExtensions||[]);let n={};return r;function r(F){let j={type:"root",children:[]},fe={stack:[j],tokenStack:[],config:e,enter:u,exit:f,buffer:l,resume:d,setData:i,getData:s},ze=[],Fe=-1;for(;++Fe0){let Qt=fe.tokenStack[fe.tokenStack.length-1];(Qt[1]||jF).call(fe,void 0,Qt[0])}for(j.position={start:Ss(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:Ss(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe{let r=this.data("settings");return RE(n,Object.assign({},r,t,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function WF(t,e){let n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function GF(t,e){let n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:` -`}]}function KF(t,e){let n=e.value?e.value+` -`:"",r=e.lang?e.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,o={};r&&(o.className=["language-"+r]);let i={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function YF(t,e){let n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function XF(t,e){let n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function Jr(t){let e=[],n=-1,r=0,o=0;for(;++n55295&&i<57344){let a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="\uFFFD"}else s=String.fromCharCode(i);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return e.join("")+t.slice(r)}function fv(t,e){let n=String(e.identifier).toUpperCase(),r=Jr(n.toLowerCase()),o=t.footnoteOrder.indexOf(n),i;o===-1?(t.footnoteOrder.push(n),t.footnoteCounts[n]=1,i=t.footnoteOrder.length):(t.footnoteCounts[n]++,i=o+1);let s=t.footnoteCounts[n],a={type:"element",tagName:"a",properties:{href:"#"+t.clobberPrefix+"fn-"+r,id:t.clobberPrefix+"fnref-"+r+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,a);let l={type:"element",tagName:"sup",properties:{},children:[a]};return t.patch(e,l),t.applyData(e,l)}function QF(t,e){let n=t.footnoteById,r=1;for(;r in n;)r++;let o=String(r);return n[o]={type:"footnoteDefinition",identifier:o,children:[{type:"paragraph",children:e.children}],position:e.position},fv(t,{type:"footnoteReference",identifier:o,position:e.position})}function ZF(t,e){let n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function e2(t,e){if(t.dangerous){let n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}return null}function dv(t,e){let n=e.referenceType,r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return{type:"text",value:"!["+e.alt+r};let o=t.all(e),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});let s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function t2(t,e){let n=t.definition(e.identifier);if(!n)return dv(t,e);let r={src:Jr(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(r.title=n.title);let o={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,o),t.applyData(e,o)}function n2(t,e){let n={src:Jr(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);let r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function r2(t,e){let n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function o2(t,e){let n=t.definition(e.identifier);if(!n)return dv(t,e);let r={href:Jr(n.url||"")};n.title!==null&&n.title!==void 0&&(r.title=n.title);let o={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function i2(t,e){let n={href:Jr(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);let r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function s2(t,e,n){let r=t.all(e),o=n?qH(n):a2(e),i={},s=[];if(typeof e.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:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++ajH,contentInitial:()=>JH,disable:()=>HH,document:()=>BH,flow:()=>_H,flowInitial:()=>UH,insideSpan:()=>qH,string:()=>zH,text:()=>VH});var BH={42:En,43:En,45:En,48:En,49:En,50:En,51:En,52:En,53:En,54:En,55:En,56:En,57:En,62:rv},JH={91:wE},UH={[-2]:Od,[-1]:Od,32:Od},_H={35:SE,42:Ba,45:[fv,Ba],60:bE,61:fv,95:Ba,96:sv,126:sv},zH={38:iv,92:ov},VH={[-5]:Nd,[-4]:Nd,[-3]:Nd,33:RE,38:iv,42:Pd,60:[gE,EE],91:CE,92:[xE,ov],93:Fa,95:Pd,96:yE},qH={null:[Pd,JF]},jH={null:[42,95]},HH={null:[]};function jF(t){let n=bF([TE,...(t||{}).extensions||[]]),r={defined:[],lazy:{},constructs:n,content:o(NF),document:o(IF),flow:o(BF),string:o(UF),text:o(_F)};return r;function o(i){return s;function s(a){return qF(r,i,a)}}}var HF=/[\0\t\n\r]/g;function $F(){let t=1,e="",n=!0,r;return o;function o(i,s,a){let l=[],u,c,f,d,p;for(i=e+i.toString(s),f=0,e="",n&&(i.charCodeAt(0)===65279&&f++,n=void 0);f13&&n<32||n>126&&n<160||n>55295&&n<57344||n>64975&&n<65008||(n&65535)===65535||(n&65535)===65534||n>1114111?"\uFFFD":String.fromCharCode(n)}var $H=/\\([!-/:-@[-`{-~])|&(#(?:\d{1,7}|x[\da-f]{1,6})|[\da-z]{1,31});/gi;function GF(t){return t.replace($H,WH)}function WH(t,e,n){if(e)return e;if(n.charCodeAt(0)===35){let o=n.charCodeAt(1),i=o===120||o===88;return dv(n.slice(i?2:1),i?16:10)}return Gu(n)||t}var YF={}.hasOwnProperty,PE=function(t,e,n){return typeof e!="string"&&(n=e,e=void 0),GH(n)(WF(jF(n).document().write($F()(t,e,!0))))};function GH(t){let e={transforms:[],canContainEols:["emphasis","fragment","heading","paragraph","strong"],enter:{autolink:a(D),autolinkProtocol:B,autolinkEmail:B,atxHeading:a(_o),blockQuote:a(Pn),characterEscape:B,characterReference:B,codeFenced:a(On),codeFencedFenceInfo:l,codeFencedFenceMeta:l,codeIndented:a(On,l),codeText:a(Hr,l),codeTextData:B,data:B,codeFlowValue:B,definition:a(Jo),definitionDestinationString:l,definitionLabelString:l,definitionTitleString:l,emphasis:a(Uo),hardBreakEscape:a(zo),hardBreakTrailing:a(zo),htmlFlow:a(Ri,l),htmlFlowData:B,htmlText:a(Ri,l),htmlTextData:B,image:a(P),label:l,link:a(D),listItem:a(Z),listItemValue:m,listOrdered:a(_,p),listUnordered:a(_),paragraph:a(Y),reference:St,referenceString:l,resourceDestinationString:l,resourceTitleString:l,setextHeading:a(_o),strong:a(W),thematicBreak:a(De)},exit:{atxHeading:c(),atxHeadingSequence:R,autolink:c(),autolinkEmail:kt,autolinkProtocol:pn,blockQuote:c(),characterEscapeValue:L,characterReferenceMarkerHexadecimal:dn,characterReferenceMarkerNumeric:dn,characterReferenceValue:Ve,codeFenced:c(v),codeFencedFence:g,codeFencedFenceInfo:y,codeFencedFenceMeta:w,codeFlowValue:L,codeIndented:c(k),codeText:c(G),codeTextData:L,data:L,definition:c(),definitionDestinationString:x,definitionLabelString:S,definitionTitleString:b,emphasis:c(),hardBreakEscape:c(U),hardBreakTrailing:c(U),htmlFlow:c(V),htmlFlowData:L,htmlText:c(Q),htmlTextData:L,image:c(ve),label:it,labelText:C,lineEnding:A,link:c(te),listItem:c(),listOrdered:c(),listUnordered:c(),paragraph:c(),referenceString:Tn,resourceDestinationString:ct,resourceTitleString:T,resource:Qe,setextHeading:c(I),setextHeadingLineSequence:O,setextHeadingText:E,strong:c(),thematicBreak:c()}};XF(e,(t||{}).mdastExtensions||[]);let n={};return r;function r(F){let j={type:"root",children:[]},ce={stack:[j],tokenStack:[],config:e,enter:u,exit:f,buffer:l,resume:d,setData:i,getData:s},ze=[],Fe=-1;for(;++Fe0){let Zt=ce.tokenStack[ce.tokenStack.length-1];(Zt[1]||KF).call(ce,void 0,Zt[0])}for(j.position={start:ks(F.length>0?F[0][1].start:{line:1,column:1,offset:0}),end:ks(F.length>0?F[F.length-2][1].end:{line:1,column:1,offset:0})},Fe=-1;++Fe{let r=this.data("settings");return PE(n,Object.assign({},r,t,{extensions:this.data("micromarkExtensions")||[],mdastExtensions:this.data("fromMarkdownExtensions")||[]}))}})}function QF(t,e){let n={type:"element",tagName:"blockquote",properties:{},children:t.wrap(t.all(e),!0)};return t.patch(e,n),t.applyData(e,n)}function ZF(t,e){let n={type:"element",tagName:"br",properties:{},children:[]};return t.patch(e,n),[t.applyData(e,n),{type:"text",value:` +`}]}function e2(t,e){let n=e.value?e.value+` +`:"",r=e.lang?e.lang.match(/^[^ \t]+(?=[ \t]|$)/):null,o={};r&&(o.className=["language-"+r]);let i={type:"element",tagName:"code",properties:o,children:[{type:"text",value:n}]};return e.meta&&(i.data={meta:e.meta}),t.patch(e,i),i=t.applyData(e,i),i={type:"element",tagName:"pre",properties:{},children:[i]},t.patch(e,i),i}function t2(t,e){let n={type:"element",tagName:"del",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function n2(t,e){let n={type:"element",tagName:"em",properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function _r(t){let e=[],n=-1,r=0,o=0;for(;++n55295&&i<57344){let a=t.charCodeAt(n+1);i<56320&&a>56319&&a<57344?(s=String.fromCharCode(i,a),o=1):s="\uFFFD"}else s=String.fromCharCode(i);s&&(e.push(t.slice(r,n),encodeURIComponent(s)),r=n+o+1,s=""),o&&(n+=o,o=0)}return e.join("")+t.slice(r)}function mv(t,e){let n=String(e.identifier).toUpperCase(),r=_r(n.toLowerCase()),o=t.footnoteOrder.indexOf(n),i;o===-1?(t.footnoteOrder.push(n),t.footnoteCounts[n]=1,i=t.footnoteOrder.length):(t.footnoteCounts[n]++,i=o+1);let s=t.footnoteCounts[n],a={type:"element",tagName:"a",properties:{href:"#"+t.clobberPrefix+"fn-"+r,id:t.clobberPrefix+"fnref-"+r+(s>1?"-"+s:""),dataFootnoteRef:!0,ariaDescribedBy:["footnote-label"]},children:[{type:"text",value:String(i)}]};t.patch(e,a);let l={type:"element",tagName:"sup",properties:{},children:[a]};return t.patch(e,l),t.applyData(e,l)}function r2(t,e){let n=t.footnoteById,r=1;for(;r in n;)r++;let o=String(r);return n[o]={type:"footnoteDefinition",identifier:o,children:[{type:"paragraph",children:e.children}],position:e.position},mv(t,{type:"footnoteReference",identifier:o,position:e.position})}function o2(t,e){let n={type:"element",tagName:"h"+e.depth,properties:{},children:t.all(e)};return t.patch(e,n),t.applyData(e,n)}function i2(t,e){if(t.dangerous){let n={type:"raw",value:e.value};return t.patch(e,n),t.applyData(e,n)}return null}function hv(t,e){let n=e.referenceType,r="]";if(n==="collapsed"?r+="[]":n==="full"&&(r+="["+(e.label||e.identifier)+"]"),e.type==="imageReference")return{type:"text",value:"!["+e.alt+r};let o=t.all(e),i=o[0];i&&i.type==="text"?i.value="["+i.value:o.unshift({type:"text",value:"["});let s=o[o.length-1];return s&&s.type==="text"?s.value+=r:o.push({type:"text",value:r}),o}function s2(t,e){let n=t.definition(e.identifier);if(!n)return hv(t,e);let r={src:_r(n.url||""),alt:e.alt};n.title!==null&&n.title!==void 0&&(r.title=n.title);let o={type:"element",tagName:"img",properties:r,children:[]};return t.patch(e,o),t.applyData(e,o)}function a2(t,e){let n={src:_r(e.url)};e.alt!==null&&e.alt!==void 0&&(n.alt=e.alt),e.title!==null&&e.title!==void 0&&(n.title=e.title);let r={type:"element",tagName:"img",properties:n,children:[]};return t.patch(e,r),t.applyData(e,r)}function l2(t,e){let n={type:"text",value:e.value.replace(/\r?\n|\r/g," ")};t.patch(e,n);let r={type:"element",tagName:"code",properties:{},children:[n]};return t.patch(e,r),t.applyData(e,r)}function u2(t,e){let n=t.definition(e.identifier);if(!n)return hv(t,e);let r={href:_r(n.url||"")};n.title!==null&&n.title!==void 0&&(r.title=n.title);let o={type:"element",tagName:"a",properties:r,children:t.all(e)};return t.patch(e,o),t.applyData(e,o)}function c2(t,e){let n={href:_r(e.url)};e.title!==null&&e.title!==void 0&&(n.title=e.title);let r={type:"element",tagName:"a",properties:n,children:t.all(e)};return t.patch(e,r),t.applyData(e,r)}function f2(t,e,n){let r=t.all(e),o=n?YH(n):d2(e),i={},s=[];if(typeof e.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:e.checked,disabled:!0},children:[]}),i.className=["task-list-item"]}let a=-1;for(;++a1}function l2(t,e){let n={},r=t.all(e),o=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++o-1?r.offset:null}}}function p2(t,e){let n=t.all(e),r=n.shift(),o=[];if(r){let s={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],s),o.push(s)}if(n.length>0){let s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=Wu(e.children[1]),l=Gu(e.children[e.children.length-1]);a.line&&l.line&&(s.position={start:a,end:l}),o.push(s)}let i={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(e,i),t.applyData(e,i)}function m2(t,e,n){let r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length,l=-1,u=[];for(;++l0,!0),r[0]),o=r.index+r[0].length,r=n.exec(e);return i.push(g2(e.slice(o),o>0,!1)),i.join("")}function g2(t,e,n){let r=0,o=t.length;if(e){let i=t.codePointAt(r);for(;i===9||i===32;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(o-1);for(;i===9||i===32;)o--,i=t.codePointAt(o-1)}return o>r?t.slice(r,o):""}function v2(t,e){let n={type:"text",value:y2(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function w2(t,e){let n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}var x2={blockquote:WF,break:GF,code:KF,delete:YF,emphasis:XF,footnoteReference:fv,footnote:QF,heading:ZF,html:e2,imageReference:t2,image:n2,inlineCode:r2,linkReference:o2,link:i2,listItem:s2,list:l2,paragraph:u2,root:c2,strong:f2,table:p2,tableCell:h2,tableRow:m2,text:v2,thematicBreak:w2,toml:pv,yaml:pv,definition:pv,footnoteDefinition:pv};function pv(){return null}var mv=function(t){if(t==null)return WH;if(typeof t=="string")return $H(t);if(typeof t=="object")return Array.isArray(t)?jH(t):HH(t);if(typeof t=="function")return hv(t);throw new Error("Expected function, string, or object as test")};function jH(t){let e=[],n=-1;for(;++n":""))+")"})}return f;function f(){let d=[],p,m,y;if((!e||o(a,l,u[u.length-1]||null))&&(d=GH(n(a,u)),d[0]===gv))return d;if(a.children&&d[0]!==PE)for(m=(r?a.children.length:-1)+i,y=u.concat(a);m>-1&&m{let o=k2(r.identifier);o&&!S2.call(e,o)&&(e[o]=r)}),n;function n(r){let o=k2(r);return o&&S2.call(e,o)?e[o]:null}}function k2(t){return String(t||"").toUpperCase()}var yv={}.hasOwnProperty;function b2(t,e){let n=e||{},r=n.allowDangerousHtml||!1,o={};return s.dangerous=r,s.clobberPrefix=n.clobberPrefix===void 0||n.clobberPrefix===null?"user-content-":n.clobberPrefix,s.footnoteLabel=n.footnoteLabel||"Footnotes",s.footnoteLabelTagName=n.footnoteLabelTagName||"h2",s.footnoteLabelProperties=n.footnoteLabelProperties||{className:["sr-only"]},s.footnoteBackLabel=n.footnoteBackLabel||"Back to content",s.unknownHandler=n.unknownHandler,s.passThrough=n.passThrough,s.handlers={...x2,...n.handlers},s.definition=ME(t),s.footnoteById=o,s.footnoteOrder=[],s.footnoteCounts={},s.patch=KH,s.applyData=YH,s.one=a,s.all=l,s.wrap=QH,s.augment=i,Da(t,"footnoteDefinition",u=>{let c=String(u.identifier).toUpperCase();yv.call(o,c)||(o[c]=u)}),s;function i(u,c){if(u&&"data"in u&&u.data){let f=u.data;f.hName&&(c.type!=="element"&&(c={type:"element",tagName:"",properties:{},children:[]}),c.tagName=f.hName),c.type==="element"&&f.hProperties&&(c.properties={...c.properties,...f.hProperties}),"children"in c&&c.children&&f.hChildren&&(c.children=f.hChildren)}if(u){let f="type"in u?u:{position:u};NE(f)||(c.position={start:Wu(f),end:Gu(f)})}return c}function s(u,c,f,d){return Array.isArray(f)&&(d=f,f={}),i(u,{type:"element",tagName:c,properties:f||{},children:d||[]})}function a(u,c){return E2(s,u,c)}function l(u){return IE(s,u)}}function KH(t,e){t.position&&(e.position=CE(t))}function YH(t,e){let n=e;if(t&&t.data){let r=t.data.hName,o=t.data.hChildren,i=t.data.hProperties;typeof r=="string"&&(n.type==="element"?n.tagName=r:n={type:"element",tagName:r,properties:{},children:[]}),n.type==="element"&&i&&(n.properties={...n.properties,...i}),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function E2(t,e,n){let r=e&&e.type;if(!r)throw new Error("Expected node, got `"+e+"`");return yv.call(t.handlers,r)?t.handlers[r](t,e,n):t.passThrough&&t.passThrough.includes(r)?"children"in e?{...e,children:IE(t,e)}:e:t.unknownHandler?t.unknownHandler(t,e,n):XH(t,e)}function IE(t,e){let n=[];if("children"in e){let r=e.children,o=-1;for(;++o1}function p2(t,e){let n={},r=t.all(e),o=-1;for(typeof e.start=="number"&&e.start!==1&&(n.start=e.start);++o-1?r.offset:null}}}function v2(t,e){let n=t.all(e),r=n.shift(),o=[];if(r){let s={type:"element",tagName:"thead",properties:{},children:t.wrap([r],!0)};t.patch(e.children[0],s),o.push(s)}if(n.length>0){let s={type:"element",tagName:"tbody",properties:{},children:t.wrap(n,!0)},a=Ku(e.children[1]),l=Yu(e.children[e.children.length-1]);a.line&&l.line&&(s.position={start:a,end:l}),o.push(s)}let i={type:"element",tagName:"table",properties:{},children:t.wrap(o,!0)};return t.patch(e,i),t.applyData(e,i)}function w2(t,e,n){let r=n?n.children:void 0,i=(r?r.indexOf(e):1)===0?"th":"td",s=n&&n.type==="table"?n.align:void 0,a=s?s.length:e.children.length,l=-1,u=[];for(;++l0,!0),r[0]),o=r.index+r[0].length,r=n.exec(e);return i.push(S2(e.slice(o),o>0,!1)),i.join("")}function S2(t,e,n){let r=0,o=t.length;if(e){let i=t.codePointAt(r);for(;i===9||i===32;)r++,i=t.codePointAt(r)}if(n){let i=t.codePointAt(o-1);for(;i===9||i===32;)o--,i=t.codePointAt(o-1)}return o>r?t.slice(r,o):""}function b2(t,e){let n={type:"text",value:k2(String(e.value))};return t.patch(e,n),t.applyData(e,n)}function E2(t,e){let n={type:"element",tagName:"hr",properties:{},children:[]};return t.patch(e,n),t.applyData(e,n)}var R2={blockquote:QF,break:ZF,code:e2,delete:t2,emphasis:n2,footnoteReference:mv,footnote:r2,heading:o2,html:i2,imageReference:s2,image:a2,inlineCode:l2,linkReference:u2,link:c2,listItem:f2,list:p2,paragraph:m2,root:h2,strong:g2,table:v2,tableCell:x2,tableRow:w2,text:b2,thematicBreak:E2,toml:gv,yaml:gv,definition:gv,footnoteDefinition:gv};function gv(){return null}var yv=function(t){if(t==null)return e$;if(typeof t=="string")return ZH(t);if(typeof t=="object")return Array.isArray(t)?XH(t):QH(t);if(typeof t=="function")return vv(t);throw new Error("Expected function, string, or object as test")};function XH(t){let e=[],n=-1;for(;++n":""))+")"})}return f;function f(){let d=[],p,m,y;if((!e||o(a,l,u[u.length-1]||null))&&(d=t$(n(a,u)),d[0]===wv))return d;if(a.children&&d[0]!==ME)for(m=(r?a.children.length:-1)+i,y=u.concat(a);m>-1&&m{let o=T2(r.identifier);o&&!C2.call(e,o)&&(e[o]=r)}),n;function n(r){let o=T2(r);return o&&C2.call(e,o)?e[o]:null}}function T2(t){return String(t||"").toUpperCase()}var xv={}.hasOwnProperty;function P2(t,e){let n=e||{},r=n.allowDangerousHtml||!1,o={};return s.dangerous=r,s.clobberPrefix=n.clobberPrefix===void 0||n.clobberPrefix===null?"user-content-":n.clobberPrefix,s.footnoteLabel=n.footnoteLabel||"Footnotes",s.footnoteLabelTagName=n.footnoteLabelTagName||"h2",s.footnoteLabelProperties=n.footnoteLabelProperties||{className:["sr-only"]},s.footnoteBackLabel=n.footnoteBackLabel||"Back to content",s.unknownHandler=n.unknownHandler,s.passThrough=n.passThrough,s.handlers={...R2,...n.handlers},s.definition=LE(t),s.footnoteById=o,s.footnoteOrder=[],s.footnoteCounts={},s.patch=n$,s.applyData=r$,s.one=a,s.all=l,s.wrap=i$,s.augment=i,Ja(t,"footnoteDefinition",u=>{let c=String(u.identifier).toUpperCase();xv.call(o,c)||(o[c]=u)}),s;function i(u,c){if(u&&"data"in u&&u.data){let f=u.data;f.hName&&(c.type!=="element"&&(c={type:"element",tagName:"",properties:{},children:[]}),c.tagName=f.hName),c.type==="element"&&f.hProperties&&(c.properties={...c.properties,...f.hProperties}),"children"in c&&c.children&&f.hChildren&&(c.children=f.hChildren)}if(u){let f="type"in u?u:{position:u};AE(f)||(c.position={start:Ku(f),end:Yu(f)})}return c}function s(u,c,f,d){return Array.isArray(f)&&(d=f,f={}),i(u,{type:"element",tagName:c,properties:f||{},children:d||[]})}function a(u,c){return O2(s,u,c)}function l(u){return DE(s,u)}}function n$(t,e){t.position&&(e.position=OE(t))}function r$(t,e){let n=e;if(t&&t.data){let r=t.data.hName,o=t.data.hChildren,i=t.data.hProperties;typeof r=="string"&&(n.type==="element"?n.tagName=r:n={type:"element",tagName:r,properties:{},children:[]}),n.type==="element"&&i&&(n.properties={...n.properties,...i}),"children"in n&&n.children&&o!==null&&o!==void 0&&(n.children=o)}return n}function O2(t,e,n){let r=e&&e.type;if(!r)throw new Error("Expected node, got `"+e+"`");return xv.call(t.handlers,r)?t.handlers[r](t,e,n):t.passThrough&&t.passThrough.includes(r)?"children"in e?{...e,children:DE(t,e)}:e:t.unknownHandler?t.unknownHandler(t,e,n):o$(t,e)}function DE(t,e){let n=[];if("children"in e){let r=e.children,o=-1;for(;++o0&&n.push({type:"text",value:` -`}),n}function R2(t){let e=[],n=-1;for(;++n1?"-"+a:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:t.footnoteBackLabel},children:[{type:"text",value:"\u21A9"}]};a>1&&f.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(a)}]}),l.length>0&&l.push({type:"text",value:" "}),l.push(f)}let u=o[o.length-1];if(u&&u.type==="element"&&u.tagName==="p"){let f=u.children[u.children.length-1];f&&f.type==="text"?f.value+=" ":u.children.push({type:"text",value:" "}),u.children.push(...l)}else o.push(...l);let c={type:"element",tagName:"li",properties:{id:t.clobberPrefix+"fn-"+s},children:t.wrap(o,!0)};t.patch(r,c),e.push(c)}if(e.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:t.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(t.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:t.footnoteLabel}]},{type:"text",value:` +`}),n}function N2(t){let e=[],n=-1;for(;++n1?"-"+a:""),dataFootnoteBackref:!0,className:["data-footnote-backref"],ariaLabel:t.footnoteBackLabel},children:[{type:"text",value:"\u21A9"}]};a>1&&f.children.push({type:"element",tagName:"sup",children:[{type:"text",value:String(a)}]}),l.length>0&&l.push({type:"text",value:" "}),l.push(f)}let u=o[o.length-1];if(u&&u.type==="element"&&u.tagName==="p"){let f=u.children[u.children.length-1];f&&f.type==="text"?f.value+=" ":u.children.push({type:"text",value:" "}),u.children.push(...l)}else o.push(...l);let c={type:"element",tagName:"li",properties:{id:t.clobberPrefix+"fn-"+s},children:t.wrap(o,!0)};t.patch(r,c),e.push(c)}if(e.length!==0)return{type:"element",tagName:"section",properties:{dataFootnotes:!0,className:["footnotes"]},children:[{type:"element",tagName:t.footnoteLabelTagName,properties:{...JSON.parse(JSON.stringify(t.footnoteLabelProperties)),id:"footnote-label"},children:[{type:"text",value:t.footnoteLabel}]},{type:"text",value:` `},{type:"element",tagName:"ol",properties:{},children:t.wrap(e,!0)},{type:"text",value:` -`}]}}function vv(t,e){let n=b2(t,e),r=n.one(t,null),o=R2(n);return o&&r.children.push({type:"text",value:` -`},o),Array.isArray(r)?{type:"root",children:r}:r}var ZH=function(t,e){return t&&"run"in t?e$(t,e):t$(t||e)},AE=ZH;function e$(t,e){return(n,r,o)=>{t.run(vv(n,e),r,i=>{o(i)})}}function t$(t){return e=>vv(e,t)}var xe=q(A2(),1);var xi=class{constructor(e,n,r){this.property=e,this.normal=n,r&&(this.space=r)}};xi.prototype.property={};xi.prototype.normal={};xi.prototype.space=null;function LE(t,e){let n={},r={},o=-1;for(;++obe,booleanish:()=>xt,commaOrSpaceSeparated:()=>Qn,commaSeparated:()=>ks,number:()=>H,overloadedBoolean:()=>DE,spaceSeparated:()=>We});var o$=0,be=Fa(),xt=Fa(),DE=Fa(),H=Fa(),We=Fa(),ks=Fa(),Qn=Fa();function Fa(){return 2**++o$}var FE=Object.keys(Od),Ba=class extends Rn{constructor(e,n,r,o){let i=-1;if(super(e,n),L2(this,"space",o),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&s$.test(e)){if(e.charAt(4)==="-"){let i=e.slice(5).replace(B2,u$);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=e.slice(4);if(!B2.test(i)){let s=i.replace(a$,l$);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}o=Ba}return new o(r,e)}function l$(t){return"-"+t.toLowerCase()}function u$(t){return t.charAt(1).toUpperCase()}var Sv={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 J2=LE([JE,BE,UE,_E,D2],"html"),U2=LE([JE,BE,UE,_E,F2],"svg");function VE(t){if(t.allowedElements&&t.disallowedElements)throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(t.allowedElements||t.disallowedElements||t.allowElement)return e=>{Da(e,"element",(n,r,o)=>{let i=o,s;if(t.allowedElements?s=!t.allowedElements.includes(n.tagName):t.disallowedElements&&(s=t.disallowedElements.includes(n.tagName)),!s&&t.allowElement&&typeof r=="number"&&(s=!t.allowElement(n,r,i)),s&&typeof r=="number")return t.unwrapDisallowed&&n.children?i.children.splice(r,1,...n.children):i.children.splice(r,1),r})}}var Iv=q(ge(),1),rB=q(q2(),1);function j2(t){let e=t&&typeof t=="object"&&t.type==="text"?t.value||"":t;return typeof e=="string"&&e.replace(/[ \t\n\f\r]/g,"")===""}function H2(t){return t.join(" ").trim()}function $2(t,e){let n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}var tB=q(eB(),1),nB=tB.default;var WE={}.hasOwnProperty,b$=new Set(["table","thead","tbody","tfoot","tr"]);function GE(t,e){let n=[],r=-1,o;for(;++r0?Iv.default.createElement(p,l,f):Iv.default.createElement(p,l)}function R$(t){let e=-1;for(;++e for more info)`),delete Av[i]}let e=cE().use(cv).use(t.remarkPlugins||[]).use(AE,{...t.remarkRehypeOptions,allowDangerousHtml:!0}).use(t.rehypePlugins||[]).use(VE,t),n=new Ma;typeof t.children=="string"?n.value=t.children:t.children!==void 0&&t.children!==null&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${t.children}\`)`);let r=e.runSync(e.parse(n),n);if(r.type!=="root")throw new TypeError("Expected a `root` node");let o=Lv.default.createElement(Lv.default.Fragment,{},GE({options:t,schema:J2,listDepth:0},r));return t.className&&(o=Lv.default.createElement("div",{className:t.className},o)),o}Ku.propTypes={children:xe.default.string,className:xe.default.string,allowElement:xe.default.func,allowedElements:xe.default.arrayOf(xe.default.string),disallowedElements:xe.default.arrayOf(xe.default.string),unwrapDisallowed:xe.default.bool,remarkPlugins:xe.default.arrayOf(xe.default.oneOfType([xe.default.object,xe.default.func,xe.default.arrayOf(xe.default.oneOfType([xe.default.bool,xe.default.string,xe.default.object,xe.default.func,xe.default.arrayOf(xe.default.any)]))])),rehypePlugins:xe.default.arrayOf(xe.default.oneOfType([xe.default.object,xe.default.func,xe.default.arrayOf(xe.default.oneOfType([xe.default.bool,xe.default.string,xe.default.object,xe.default.func,xe.default.arrayOf(xe.default.any)]))])),sourcePos:xe.default.bool,rawSourcePos:xe.default.bool,skipHtml:xe.default.bool,includeElementIndex:xe.default.bool,transformLinkUri:xe.default.oneOfType([xe.default.func,xe.default.bool]),linkTarget:xe.default.oneOfType([xe.default.func,xe.default.string]),transformImageUri:xe.default.func,components:xe.default.object};var ht=q(ye(),1),iB=({id:t,url:e,onChange:n})=>{let[r,o]=(0,Yu.useState)([]),[i,s]=(0,Yu.useState)([]),[a,l]=(0,Yu.useState)(void 0);return(0,Yu.useEffect)(()=>{(async()=>(await vt.search({contentID:t})).storedContent.forEach(c=>{c.related.forEach(f=>{switch(f.type.case){case"normalized":let d=f.type.value;switch(d.type.case){case"article":o([...r,{id:f.id,article:d.type.value}]);break;case"readme":s([...i,{id:f.id,readme:d.type.value}]);break}}})}))()},[]),(0,ht.jsxs)("div",{className:"form-group ",children:[(0,ht.jsx)("label",{htmlFor:"url",children:"URL"}),(0,ht.jsx)("input",{type:"text",className:"input w-full",id:"url",placeholder:"URL",value:e,onChange:u=>n(u.target.value)}),r.map(u=>(0,ht.jsx)("div",{className:"card",children:(0,ht.jsxs)("div",{className:"card-body",children:[(0,ht.jsx)("h2",{className:"card-title",children:u.article.title}),(0,ht.jsx)("p",{className:"max-h-72 truncate text-gray-500 font-normal",children:u.article.text}),(0,ht.jsx)("button",{className:"btn",onClick:()=>l(u.id),children:"read"}),(0,ht.jsxs)(Z1,{open:a===u.id,children:[(0,ht.jsx)("h1",{children:u.article.title}),(0,ht.jsx)("p",{children:u.article.text}),(0,ht.jsx)("div",{className:"flex justify-end",children:(0,ht.jsx)("button",{className:"btn",onClick:()=>l(void 0),children:"close"})})]})]})},u.id)),i.map(u=>(0,ht.jsx)("div",{className:"card",children:(0,ht.jsxs)("div",{className:"card-body",children:[(0,ht.jsx)("p",{className:"max-h-72 truncate text-gray-500 font-normal",children:u.readme.data}),(0,ht.jsx)("button",{className:"btn",onClick:()=>l(u.id),children:"read"}),(0,ht.jsxs)(Z1,{open:a===u.id,children:[(0,ht.jsx)(Ku,{className:"markdown",children:u.readme.data}),(0,ht.jsx)("div",{className:"flex justify-end",children:(0,ht.jsx)("button",{className:"btn",onClick:()=>l(void 0),children:"close"})})]})]})},u.id))]})};var Dv=200,cn=function(){};cn.prototype.append=function(e){return e.length?(e=cn.from(e),!this.length&&e||e.length=n?cn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};cn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};cn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};cn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};cn.from=function(e){return e instanceof cn?e:e&&e.length?new sB(e):cn.empty};var sB=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l=s;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Dv)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Dv)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(cn);cn.empty=new sB([]);var M$=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(cn),KE=cn;var I$=500,Ua=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){o||(o=this.remapping(r,d+1),i=o.maps.length),i--,c.push(f);return}if(o){c.push(new Ao(f.map));let p=f.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new Ao(m,void 0,void 0,u.length+c.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(i)):f.selection,l=new t(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let c=0;cL$&&(a=A$(a,u),s-=u),new t(a.append(i),s)}remapping(e,n){let r=new Hf;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Ao(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(d=>{d.selection&&a--},o);let l=n;this.items.forEach(d=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(d.step){let y=e.steps[p].invert(e.docs[p]),w=d.selection&&d.selection.map(i.slice(l+1,p));w&&a++,r.push(new Ao(m,y,w))}else r.push(new Ao(m))},o);let u=[];for(let d=n;dI$&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let f=new Ao(u.invert(),l,c),d,p=o.length-1;(d=o.length&&o[p].merge(f))?o[p]=d:o.push(f)}}else s.map&&r--},this.items.length,0),new t(KE.from(o.reverse()),i)}};Ua.empty=new Ua(KE.empty,0);function A$(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}var Ao=class t{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Lo=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},L$=20;function D$(t,e,n,r){let o=n.getMeta(bs),i;if(o)return o.historyState;n.getMeta(B$)&&(t=new Lo(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(bs))return s.getMeta(bs).redo?new Lo(t.done.addTransform(n,void 0,r,Fv(e)),t.undone,aB(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Lo(t.done,t.undone.addTransform(n,void 0,r,Fv(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!F$(n,t.prevRanges)),u=s?YE(t.prevRanges,n.mapping):aB(n.mapping.maps[n.steps.length-1]);return new Lo(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Fv(e)),Ua.empty,u,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Lo(t.done.rebased(n,i),t.undone.rebased(n,i),YE(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Lo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),YE(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function F$(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function aB(t){let e=[];return t.forEach((n,r,o,i)=>e.push(o,i)),e}function YE(t,e){if(!t)return null;let n=[];for(let r=0;r{let n=bs.getState(t);return!n||n.done.eventCount==0?!1:(e&&uB(n,t,e,!1),!0)},ZE=(t,e)=>{let n=bs.getState(t);return!n||n.undone.eventCount==0?!1:(e&&uB(n,t,e,!0),!0)};var fB=Mr.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>QE(t,e),redo:()=>({state:t,dispatch:e})=>ZE(t,e)}},addProseMirrorPlugins(){return[cB(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var za=q(ge(),1);function J$(t){let e={};for(let n of Object.keys(t)){let r=t[n];typeof r=="number"&&(e[r]=n.toLowerCase())}return e}var dB=J$(lt),pB=t=>{if(t.defaultValue===void 0)return"";switch(t.type){case lt.STRING:return t.defaultValue;case lt.BOOL:return t.defaultValue==="true";case lt.INT32:case lt.SINT32:case lt.SFIXED32:case lt.UINT32:case lt.FIXED32:return parseInt(t.defaultValue);case lt.INT64:case lt.SINT64:case lt.SFIXED64:case lt.UINT64:case lt.FIXED64:return BigInt(t.defaultValue);case lt.DOUBLE:case lt.FLOAT:return parseFloat(t.defaultValue);default:return""}};function eR(t){return t.replace(/(_\w)/g,e=>e[1].toUpperCase())}var mB=t=>{switch(t.type){case"msg":return pB(t.field);case"group":return{};case"map":return{};case"repeated":return[]}};function Bv(t,e){let n=i=>{let s=eR(i.name||"unknown"),a=i.type&&dB[i.type],l=i.label===Ul.REPEATED,u=d=>l?{type:"repeated",name:s,fieldType:a,field:i,repeatedField:d}:d;if(i.typeName===void 0)return u({type:"msg",field:i,name:s,fieldType:a});let c=i.typeName.substring(1),f=t.descLookup[c];if(f===void 0)throw new Error(`Unknown type ${c}`);if(f.options?.mapEntry){let d=Bv(t,f);if(d.length!==2)throw new Error(`Map entry ${c} has ${d.length} children`);return{type:"map",field:i,name:s,key:d[0],value:d[1],fieldType:a}}return u({type:"group",field:i,name:s,children:Bv(t,f),fieldType:a,isOneOf:!1})},r=e.field.filter(i=>i.oneofIndex===void 0).map(n),o=e.oneofDecl.map((i,s)=>{let a=e.field.filter(u=>u.oneofIndex===s).flatMap(n).filter(ra);return{type:"group",name:eR(i.name||"unknown"),field:i,children:a,fieldType:void 0,isOneOf:!0}});return[...r,...o]}var _e=q(ge(),1),Md=t=>t.type==="checkbox",Qu=t=>t instanceof Date,Vn=t=>t==null,kB=t=>typeof t=="object",_t=t=>!Vn(t)&&!Array.isArray(t)&&kB(t)&&!Qu(t),U$=t=>_t(t)&&t.target?Md(t.target)?t.target.checked:t.target.value:t,_$=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,z$=(t,e)=>t.has(_$(e)),V$=t=>{let e=t.constructor&&t.constructor.prototype;return _t(e)&&e.hasOwnProperty("isPrototypeOf")},gR=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Xt(t){let e,n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(gR&&(t instanceof Blob||t instanceof FileList))&&(n||_t(t)))if(e=n?[]:{},!n&&!V$(t))e=t;else for(let r in t)t.hasOwnProperty(r)&&(e[r]=Xt(t[r]));else return t;return e}var ec=t=>Array.isArray(t)?t.filter(Boolean):[],ot=t=>t===void 0,ie=(t,e,n)=>{if(!e||!_t(t))return n;let r=ec(e.split(/[,[\].]+?/)).reduce((o,i)=>Vn(o)?o:o[i],t);return ot(r)||r===t?ot(t[e])?n:t[e]:r},ki=t=>typeof t=="boolean",hB={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},zr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},Si={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},q$=_e.default.createContext(null),bB=()=>_e.default.useContext(q$);var j$=(t,e,n,r=!0)=>{let o={defaultValues:e._defaultValues};for(let i in t)Object.defineProperty(o,i,{get:()=>{let s=i;return e._proxyFormState[s]!==zr.all&&(e._proxyFormState[s]=!r||zr.all),n&&(n[s]=!0),t[s]}});return o},mr=t=>_t(t)&&!Object.keys(t).length,H$=(t,e,n,r)=>{n(t);let{name:o,...i}=t;return mr(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(s=>e[s]===(!r||zr.all))},hr=t=>Array.isArray(t)?t:[t],$$=(t,e,n)=>!t||!e||t===e||hr(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function yR(t){let e=_e.default.useRef(t);e.current=t,_e.default.useEffect(()=>{let n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}var Do=t=>typeof t=="string",EB=(t,e,n,r,o)=>Do(t)?(r&&e.watch.add(t),ie(n,t,o)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),ie(n,i))):(r&&(e.watchAll=!0),n);function qv(t){let e=bB(),{control:n=e.control,name:r,defaultValue:o,disabled:i,exact:s}=t||{},a=_e.default.useRef(r);a.current=r,yR({disabled:i,subject:n._subjects.values,next:c=>{$$(a.current,c.name,s)&&u(Xt(EB(a.current,n._names,c.values||n._formValues,!1,o)))}});let[l,u]=_e.default.useState(n._getWatch(r,o));return _e.default.useEffect(()=>n._removeUnmounted()),l}var vR=t=>/^\w*$/.test(t),RB=t=>ec(t.replace(/["|']|\]/g,"").split(/\.|\[/)),rt=(t,e,n)=>{let r=-1,o=vR(e)?[e]:RB(e),i=o.length,s=i-1;for(;++re?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:o||!0}}:{},Es=()=>{let t=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let n=(Math.random()*16+t)%16|0;return(e=="x"?n:n&3|8).toString(16)})},tR=(t,e,n={})=>n.shouldFocus||ot(n.shouldFocus)?n.focusName||`${t}.${ot(n.focusIndex)?e:n.focusIndex}.`:"",pR=t=>({isOnSubmit:!t||t===zr.onSubmit,isOnBlur:t===zr.onBlur,isOnChange:t===zr.onChange,isOnAll:t===zr.all,isOnTouch:t===zr.onTouched}),mR=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length)))),Zu=(t,e,n,r)=>{for(let o of n||Object.keys(t)){let i=ie(t,o);if(i){let{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],o)&&!r)break;if(s.ref&&e(s.ref,s.name)&&!r)break;Zu(a,e)}else _t(a)&&Zu(a,e)}}},CB=(t,e,n)=>{let r=ec(ie(t,n));return rt(r,"root",e[n]),rt(t,n,r),t},wR=t=>t.type==="file",Rs=t=>typeof t=="function",Uv=t=>{if(!gR)return!1;let e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},Jv=t=>Do(t),xR=t=>t.type==="radio",_v=t=>t instanceof RegExp,gB={value:!1,isValid:!1},yB={value:!0,isValid:!0},TB=t=>{if(Array.isArray(t)){if(t.length>1){let e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ot(t[0].attributes.value)?ot(t[0].value)||t[0].value===""?yB:{value:t[0].value,isValid:!0}:yB:gB}return gB},vB={isValid:!1,value:null},PB=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,vB):vB;function wB(t,e,n="validate"){if(Jv(t)||Array.isArray(t)&&t.every(Jv)||ki(t)&&!t)return{type:n,message:Jv(t)?t:"",ref:e}}var Xu=t=>_t(t)&&!_v(t)?t:{value:t,message:""},hR=async(t,e,n,r,o)=>{let{ref:i,refs:s,required:a,maxLength:l,minLength:u,min:c,max:f,pattern:d,validate:p,name:m,valueAsNumber:y,mount:w,disabled:g}=t._f,v=ie(e,m);if(!w||g)return{};let k=s?s[0]:i,S=L=>{r&&k.reportValidity&&(k.setCustomValidity(ki(L)?"":L||""),k.reportValidity())},b={},x=xR(i),T=Md(i),E=x||T,O=(y||wR(i))&&ot(i.value)&&ot(v)||Uv(i)&&i.value===""||v===""||Array.isArray(v)&&!v.length,A=W$.bind(null,m,n,b),B=(L,I,U,V=Si.maxLength,Q=Si.minLength)=>{let G=L?I:U;b[m]={type:L?V:Q,message:G,ref:i,...A(L?V:Q,G)}};if(o?!Array.isArray(v)||!v.length:a&&(!E&&(O||Vn(v))||ki(v)&&!v||T&&!TB(s).isValid||x&&!PB(s).isValid)){let{value:L,message:I}=Jv(a)?{value:!!a,message:a}:Xu(a);if(L&&(b[m]={type:Si.required,message:I,ref:k,...A(Si.required,I)},!n))return S(I),b}if(!O&&(!Vn(c)||!Vn(f))){let L,I,U=Xu(f),V=Xu(c);if(!Vn(v)&&!isNaN(v)){let Q=i.valueAsNumber||v&&+v;Vn(U.value)||(L=Q>U.value),Vn(V.value)||(I=Qnew Date(new Date().toDateString()+" "+R),te=i.type=="time",we=i.type=="week";Do(U.value)&&v&&(L=te?G(v)>G(U.value):we?v>U.value:Q>new Date(U.value)),Do(V.value)&&v&&(I=te?G(v)+L.value,V=!Vn(I.value)&&v.length<+I.value;if((U||V)&&(B(U,L.message,I.message),!n))return S(b[m].message),b}if(d&&!O&&Do(v)){let{value:L,message:I}=Xu(d);if(_v(L)&&!v.match(L)&&(b[m]={type:Si.pattern,message:I,ref:i,...A(Si.pattern,I)},!n))return S(I),b}if(p){if(Rs(p)){let L=await p(v,e),I=wB(L,k);if(I&&(b[m]={...I,...A(Si.validate,I.message)},!n))return S(I.message),b}else if(_t(p)){let L={};for(let I in p){if(!mr(L)&&!n)break;let U=wB(await p[I](v,e),k,I);U&&(L={...U,...A(I,U.message)},S(U.message),n&&(b[m]=L))}if(!mr(L)&&(b[m]={ref:k,...L},!n))return b}}return S(!0),b},nR=(t,e)=>[...t,...hr(e)],rR=t=>Array.isArray(t)?t.map(()=>{}):void 0;function oR(t,e,n){return[...t.slice(0,e),...hr(n),...t.slice(e)]}var iR=(t,e,n)=>Array.isArray(t)?(ot(t[n])&&(t[n]=void 0),t.splice(n,0,t.splice(e,1)[0]),t):[],sR=(t,e)=>[...hr(e),...hr(t)];function G$(t,e){let n=0,r=[...t];for(let o of e)r.splice(o-n,1),n++;return ec(r).length?r:[]}var aR=(t,e)=>ot(e)?[]:G$(t,hr(e).sort((n,r)=>n-r)),lR=(t,e,n)=>{[t[e],t[n]]=[t[n],t[e]]};function K$(t,e){let n=e.slice(0,-1).length,r=0;for(;r(t[e]=n,t);function OB(t){let e=bB(),{control:n=e.control,name:r,keyName:o="id",shouldUnregister:i}=t,[s,a]=_e.default.useState(n._getFieldArray(r)),l=_e.default.useRef(n._getFieldArray(r).map(Es)),u=_e.default.useRef(s),c=_e.default.useRef(r),f=_e.default.useRef(!1);c.current=r,u.current=s,n._names.array.add(r),t.rules&&n.register(r,t.rules),yR({next:({values:b,name:x})=>{if(x===c.current||!x){let T=ie(b,c.current);Array.isArray(T)&&(a(T),l.current=T.map(Es))}},subject:n._subjects.array});let d=_e.default.useCallback(b=>{f.current=!0,n._updateFieldArray(r,b)},[n,r]),p=(b,x)=>{let T=hr(Xt(b)),E=nR(n._getFieldArray(r),T);n._names.focus=tR(r,E.length-1,x),l.current=nR(l.current,T.map(Es)),d(E),a(E),n._updateFieldArray(r,E,nR,{argA:rR(b)})},m=(b,x)=>{let T=hr(Xt(b)),E=sR(n._getFieldArray(r),T);n._names.focus=tR(r,0,x),l.current=sR(l.current,T.map(Es)),d(E),a(E),n._updateFieldArray(r,E,sR,{argA:rR(b)})},y=b=>{let x=aR(n._getFieldArray(r),b);l.current=aR(l.current,b),d(x),a(x),n._updateFieldArray(r,x,aR,{argA:b})},w=(b,x,T)=>{let E=hr(Xt(x)),O=oR(n._getFieldArray(r),b,E);n._names.focus=tR(r,b,T),l.current=oR(l.current,b,E.map(Es)),d(O),a(O),n._updateFieldArray(r,O,oR,{argA:b,argB:rR(x)})},g=(b,x)=>{let T=n._getFieldArray(r);lR(T,b,x),lR(l.current,b,x),d(T),a(T),n._updateFieldArray(r,T,lR,{argA:b,argB:x},!1)},v=(b,x)=>{let T=n._getFieldArray(r);iR(T,b,x),iR(l.current,b,x),d(T),a(T),n._updateFieldArray(r,T,iR,{argA:b,argB:x},!1)},k=(b,x)=>{let T=Xt(x),E=xB(n._getFieldArray(r),b,T);l.current=[...E].map((O,A)=>!O||A===b?Es():l.current[A]),d(E),a([...E]),n._updateFieldArray(r,E,xB,{argA:b,argB:T},!0,!1)},S=b=>{let x=hr(Xt(b));l.current=x.map(Es),d([...x]),a([...x]),n._updateFieldArray(r,[...x],T=>T,{},!0,!1)};return _e.default.useEffect(()=>{if(n._state.action=!1,mR(r,n._names)&&n._subjects.state.next({...n._formState}),f.current&&(!pR(n._options.mode).isOnSubmit||n._formState.isSubmitted))if(n._options.resolver)n._executeSchema([r]).then(b=>{let x=ie(b.errors,r),T=ie(n._formState.errors,r);(T?!x&&T.type||x&&(T.type!==x.type||T.message!==x.message):x&&x.type)&&(x?rt(n._formState.errors,r,x):Yt(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let b=ie(n._fields,r);b&&b._f&&hR(b,n._formValues,n._options.criteriaMode===zr.all,n._options.shouldUseNativeValidation,!0).then(x=>!mr(x)&&n._subjects.state.next({errors:CB(n._formState.errors,x,r)}))}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&Zu(n._fields,(b,x)=>{if(n._names.focus&&x.startsWith(n._names.focus)&&b.focus)return b.focus(),1}),n._names.focus="",n._updateValid(),f.current=!1},[s,r,n]),_e.default.useEffect(()=>(!ie(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||i)&&n.unregister(r)}),[r,n,o,i]),{swap:_e.default.useCallback(g,[d,r,n]),move:_e.default.useCallback(v,[d,r,n]),prepend:_e.default.useCallback(m,[d,r,n]),append:_e.default.useCallback(p,[d,r,n]),remove:_e.default.useCallback(y,[d,r,n]),insert:_e.default.useCallback(w,[d,r,n]),update:_e.default.useCallback(k,[d,r,n]),replace:_e.default.useCallback(S,[d,r,n]),fields:_e.default.useMemo(()=>s.map((b,x)=>({...b,[o]:l.current[x]||Es()})),[s,o])}}var uR=()=>{let t=[];return{get observers(){return t},next:o=>{for(let i of t)i.next&&i.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(i=>i!==o)}}),unsubscribe:()=>{t=[]}}},zv=t=>Vn(t)||!kB(t);function _a(t,e){if(zv(t)||zv(e))return t===e;if(Qu(t)&&Qu(e))return t.getTime()===e.getTime();let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of n){let i=t[o];if(!r.includes(o))return!1;if(o!=="ref"){let s=e[o];if(Qu(i)&&Qu(s)||_t(i)&&_t(s)||Array.isArray(i)&&Array.isArray(s)?!_a(i,s):i!==s)return!1}}return!0}var NB=t=>t.type==="select-multiple",X$=t=>xR(t)||Md(t),cR=t=>Uv(t)&&t.isConnected,MB=t=>{for(let e in t)if(Rs(t[e]))return!0;return!1};function Vv(t,e={}){let n=Array.isArray(t);if(_t(t)||n)for(let r in t)Array.isArray(t[r])||_t(t[r])&&!MB(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Vv(t[r],e[r])):Vn(t[r])||(e[r]=!0);return e}function IB(t,e,n){let r=Array.isArray(t);if(_t(t)||r)for(let o in t)Array.isArray(t[o])||_t(t[o])&&!MB(t[o])?ot(e)||zv(n[o])?n[o]=Array.isArray(t[o])?Vv(t[o],[]):{...Vv(t[o])}:IB(t[o],Vn(e)?{}:e[o],n[o]):n[o]=!_a(t[o],e[o]);return n}var fR=(t,e)=>IB(t,e,Vv(e)),AB=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ot(t)?t:e?t===""?NaN:t&&+t:n&&Do(t)?new Date(t):r?r(t):t;function dR(t){let e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return wR(e)?e.files:xR(e)?PB(t.refs).value:NB(e)?[...e.selectedOptions].map(({value:n})=>n):Md(e)?TB(t.refs).value:AB(ot(e.value)?t.ref.value:e.value,t)}var Q$=(t,e,n,r)=>{let o={};for(let i of t){let s=ie(e,i);s&&rt(o,i,s._f)}return{criteriaMode:n,names:[...t],fields:o,shouldUseNativeValidation:r}},Nd=t=>ot(t)?t:_v(t)?t.source:_t(t)?_v(t.value)?t.value.source:t.value:t,Z$=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function SB(t,e,n){let r=ie(t,n);if(r||vR(n))return{error:r,name:n};let o=n.split(".");for(;o.length;){let i=o.join("."),s=ie(e,i),a=ie(t,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};o.pop()}return{name:n}}var eW=(t,e,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(e||t):(n?r.isOnBlur:o.isOnBlur)?!t:(n?r.isOnChange:o.isOnChange)?t:!0,tW=(t,e)=>!ec(ie(t,e)).length&&Yt(t,e),nW={mode:zr.onSubmit,reValidateMode:zr.onChange,shouldFocusError:!0};function rW(t={},e){let n={...nW,...t},r={submitCount:0,isDirty:!1,isLoading:Rs(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:n.errors||{},disabled:n.disabled||!1},o={},i=_t(n.defaultValues)||_t(n.values)?Xt(n.defaultValues||n.values)||{}:{},s=n.shouldUnregister?{}:Xt(i),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0,f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:uR(),array:uR(),state:uR()},p=pR(n.mode),m=pR(n.reValidateMode),y=n.criteriaMode===zr.all,w=P=>D=>{clearTimeout(c),c=setTimeout(P,D)},g=async P=>{if(f.isValid||P){let D=n.resolver?mr((await O()).errors):await B(o,!0);D!==r.isValid&&d.state.next({isValid:D})}},v=P=>f.isValidating&&d.state.next({isValidating:P}),k=(P,D=[],_,Z,Y=!0,W=!0)=>{if(Z&&_){if(a.action=!0,W&&Array.isArray(ie(o,P))){let ce=_(ie(o,P),Z.argA,Z.argB);Y&&rt(o,P,ce)}if(W&&Array.isArray(ie(r.errors,P))){let ce=_(ie(r.errors,P),Z.argA,Z.argB);Y&&rt(r.errors,P,ce),tW(r.errors,P)}if(f.touchedFields&&W&&Array.isArray(ie(r.touchedFields,P))){let ce=_(ie(r.touchedFields,P),Z.argA,Z.argB);Y&&rt(r.touchedFields,P,ce)}f.dirtyFields&&(r.dirtyFields=fR(i,s)),d.state.next({name:P,isDirty:I(P,D),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else rt(s,P,D)},S=(P,D)=>{rt(r.errors,P,D),d.state.next({errors:r.errors})},b=P=>{r.errors=P,d.state.next({errors:r.errors,isValid:!1})},x=(P,D,_,Z)=>{let Y=ie(o,P);if(Y){let W=ie(s,P,ot(_)?ie(i,P):_);ot(W)||Z&&Z.defaultChecked||D?rt(s,P,D?W:dR(Y._f)):Q(P,W),a.mount&&g()}},T=(P,D,_,Z,Y)=>{let W=!1,ce=!1,De={name:P},F=!!(ie(o,P)&&ie(o,P)._f.disabled);if(!_||Z){f.isDirty&&(ce=r.isDirty,r.isDirty=De.isDirty=I(),W=ce!==De.isDirty);let j=F||_a(ie(i,P),D);ce=!!(!F&&ie(r.dirtyFields,P)),j||F?Yt(r.dirtyFields,P):rt(r.dirtyFields,P,!0),De.dirtyFields=r.dirtyFields,W=W||f.dirtyFields&&ce!==!j}if(_){let j=ie(r.touchedFields,P);j||(rt(r.touchedFields,P,_),De.touchedFields=r.touchedFields,W=W||f.touchedFields&&j!==_)}return W&&Y&&d.state.next(De),W?De:{}},E=(P,D,_,Z)=>{let Y=ie(r.errors,P),W=f.isValid&&ki(D)&&r.isValid!==D;if(t.delayError&&_?(u=w(()=>S(P,_)),u(t.delayError)):(clearTimeout(c),u=null,_?rt(r.errors,P,_):Yt(r.errors,P)),(_?!_a(Y,_):Y)||!mr(Z)||W){let ce={...Z,...W&&ki(D)?{isValid:D}:{},errors:r.errors,name:P};r={...r,...ce},d.state.next(ce)}v(!1)},O=async P=>n.resolver(s,n.context,Q$(P||l.mount,o,n.criteriaMode,n.shouldUseNativeValidation)),A=async P=>{let{errors:D}=await O(P);if(P)for(let _ of P){let Z=ie(D,_);Z?rt(r.errors,_,Z):Yt(r.errors,_)}else r.errors=D;return D},B=async(P,D,_={valid:!0})=>{for(let Z in P){let Y=P[Z];if(Y){let{_f:W,...ce}=Y;if(W){let De=l.array.has(W.name),F=await hR(Y,s,y,n.shouldUseNativeValidation&&!D,De);if(F[W.name]&&(_.valid=!1,D))break;!D&&(ie(F,W.name)?De?CB(r.errors,F,W.name):rt(r.errors,W.name,F[W.name]):Yt(r.errors,W.name))}ce&&await B(ce,D,_)}}return _.valid},L=()=>{for(let P of l.unMount){let D=ie(o,P);D&&(D._f.refs?D._f.refs.every(_=>!cR(_)):!cR(D._f.ref))&&dn(P)}l.unMount=new Set},I=(P,D)=>(P&&D&&rt(s,P,D),!_a(ct(),i)),U=(P,D,_)=>EB(P,l,{...a.mount?s:ot(D)?i:Do(P)?{[P]:D}:D},_,D),V=P=>ec(ie(a.mount?s:i,P,t.shouldUnregister?ie(i,P,[]):[])),Q=(P,D,_={})=>{let Z=ie(o,P),Y=D;if(Z){let W=Z._f;W&&(!W.disabled&&rt(s,P,AB(D,W)),Y=Uv(W.ref)&&Vn(D)?"":D,NB(W.ref)?[...W.ref.options].forEach(ce=>ce.selected=Y.includes(ce.value)):W.refs?Md(W.ref)?W.refs.length>1?W.refs.forEach(ce=>(!ce.defaultChecked||!ce.disabled)&&(ce.checked=Array.isArray(Y)?!!Y.find(De=>De===ce.value):Y===ce.value)):W.refs[0]&&(W.refs[0].checked=!!Y):W.refs.forEach(ce=>ce.checked=ce.value===Y):wR(W.ref)?W.ref.value="":(W.ref.value=Y,W.ref.type||d.values.next({name:P,values:{...s}})))}(_.shouldDirty||_.shouldTouch)&&T(P,Y,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&it(P)},G=(P,D,_)=>{for(let Z in D){let Y=D[Z],W=`${P}.${Z}`,ce=ie(o,W);(l.array.has(P)||!zv(Y)||ce&&!ce._f)&&!Qu(Y)?G(W,Y,_):Q(W,Y,_)}},te=(P,D,_={})=>{let Z=ie(o,P),Y=l.array.has(P),W=Xt(D);rt(s,P,W),Y?(d.array.next({name:P,values:{...s}}),(f.isDirty||f.dirtyFields)&&_.shouldDirty&&d.state.next({name:P,dirtyFields:fR(i,s),isDirty:I(P,W)})):Z&&!Z._f&&!Vn(W)?G(P,W,_):Q(P,W,_),mR(P,l)&&d.state.next({...r}),d.values.next({name:P,values:{...s}}),!a.mount&&e()},we=async P=>{let D=P.target,_=D.name,Z=!0,Y=ie(o,_),W=()=>D.type?dR(Y._f):U$(P),ce=De=>{Z=Number.isNaN(De)||De===ie(s,_,De)};if(Y){let De,F,j=W(),fe=P.type===hB.BLUR||P.type===hB.FOCUS_OUT,ze=!Z$(Y._f)&&!n.resolver&&!ie(r.errors,_)&&!Y._f.deps||eW(fe,ie(r.touchedFields,_),r.isSubmitted,m,p),Fe=mR(_,l,fe);rt(s,_,j),fe?(Y._f.onBlur&&Y._f.onBlur(P),u&&u(0)):Y._f.onChange&&Y._f.onChange(P);let Qt=T(_,j,fe,!1),gr=!mr(Qt)||Fe;if(!fe&&d.values.next({name:_,type:P.type,values:{...s}}),ze)return f.isValid&&g(),gr&&d.state.next({name:_,...Fe?{}:Qt});if(!fe&&Fe&&d.state.next({...r}),v(!0),n.resolver){let{errors:J}=await O([_]);if(ce(j),Z){let ne=SB(r.errors,o,_),de=SB(J,o,ne.name||_);De=de.error,_=de.name,F=mr(J)}}else De=(await hR(Y,s,y,n.shouldUseNativeValidation))[_],ce(j),Z&&(De?F=!1:f.isValid&&(F=await B(o,!0)));Z&&(Y._f.deps&&it(Y._f.deps),E(_,F,De,Qt))}},R=(P,D)=>{if(ie(r.errors,D)&&P.focus)return P.focus(),1},it=async(P,D={})=>{let _,Z,Y=hr(P);if(v(!0),n.resolver){let W=await A(ot(P)?P:Y);_=mr(W),Z=P?!Y.some(ce=>ie(W,ce)):_}else P?(Z=(await Promise.all(Y.map(async W=>{let ce=ie(o,W);return await B(ce&&ce._f?{[W]:ce}:ce)}))).every(Boolean),!(!Z&&!r.isValid)&&g()):Z=_=await B(o);return d.state.next({...!Do(P)||f.isValid&&_!==r.isValid?{}:{name:P},...n.resolver||!P?{isValid:_}:{},errors:r.errors,isValidating:!1}),D.shouldFocus&&!Z&&Zu(o,R,P?Y:l.mount),Z},ct=P=>{let D={...i,...a.mount?s:{}};return ot(P)?D:Do(P)?ie(D,P):P.map(_=>ie(D,_))},C=(P,D)=>({invalid:!!ie((D||r).errors,P),isDirty:!!ie((D||r).dirtyFields,P),isTouched:!!ie((D||r).touchedFields,P),error:ie((D||r).errors,P)}),Qe=P=>{P&&hr(P).forEach(D=>Yt(r.errors,D)),d.state.next({errors:P?r.errors:{}})},St=(P,D,_)=>{let Z=(ie(o,P,{_f:{}})._f||{}).ref;rt(r.errors,P,{...D,ref:Z}),d.state.next({name:P,errors:r.errors,isValid:!1}),_&&_.shouldFocus&&Z&&Z.focus&&Z.focus()},Cn=(P,D)=>Rs(P)?d.values.subscribe({next:_=>P(U(void 0,D),_)}):U(P,D,!0),dn=(P,D={})=>{for(let _ of P?hr(P):l.mount)l.mount.delete(_),l.array.delete(_),D.keepValue||(Yt(o,_),Yt(s,_)),!D.keepError&&Yt(r.errors,_),!D.keepDirty&&Yt(r.dirtyFields,_),!D.keepTouched&&Yt(r.touchedFields,_),!n.shouldUnregister&&!D.keepDefaultValue&&Yt(i,_);d.values.next({values:{...s}}),d.state.next({...r,...D.keepDirty?{isDirty:I()}:{}}),!D.keepIsValid&&g()},Ve=({disabled:P,name:D,field:_,fields:Z,value:Y})=>{if(ki(P)){let W=P?void 0:ot(Y)?dR(_?_._f:ie(Z,D)._f):Y;rt(s,D,W),T(D,W,!1,!1,!0)}},pn=(P,D={})=>{let _=ie(o,P),Z=ki(D.disabled);return rt(o,P,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:P}},name:P,mount:!0,...D}}),l.mount.add(P),_?Ve({field:_,disabled:D.disabled,name:P,value:D.value}):x(P,!0,D.value),{...Z?{disabled:D.disabled}:{},...n.progressive?{required:!!D.required,min:Nd(D.min),max:Nd(D.max),minLength:Nd(D.minLength),maxLength:Nd(D.maxLength),pattern:Nd(D.pattern)}:{},name:P,onChange:we,onBlur:we,ref:Y=>{if(Y){pn(P,D),_=ie(o,P);let W=ot(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,ce=X$(W),De=_._f.refs||[];if(ce?De.find(F=>F===W):W===_._f.ref)return;rt(o,P,{_f:{..._._f,...ce?{refs:[...De.filter(cR),W,...Array.isArray(ie(i,P))?[{}]:[]],ref:{type:W.type,name:P}}:{ref:W}}}),x(P,!1,void 0,W)}else _=ie(o,P,{}),_._f&&(_._f.mount=!1),(n.shouldUnregister||D.shouldUnregister)&&!(z$(l.array,P)&&a.action)&&l.unMount.add(P)}}},kt=()=>n.shouldFocusError&&Zu(o,R,l.mount),Tn=P=>{ki(P)&&(d.state.next({disabled:P}),Zu(o,(D,_)=>{let Z=P,Y=ie(o,_);Y&&ki(Y._f.disabled)&&(Z||(Z=Y._f.disabled)),D.disabled=Z},0,!1))},Pn=(P,D)=>async _=>{_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist());let Z=Xt(s);if(d.state.next({isSubmitting:!0}),n.resolver){let{errors:Y,values:W}=await O();r.errors=Y,Z=W}else await B(o);Yt(r.errors,"root"),mr(r.errors)?(d.state.next({errors:{}}),await P(Z,_)):(D&&await D({...r.errors},_),kt(),setTimeout(kt)),d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:mr(r.errors),submitCount:r.submitCount+1,errors:r.errors})},qr=(P,D={})=>{ie(o,P)&&(ot(D.defaultValue)?te(P,Xt(ie(i,P))):(te(P,D.defaultValue),rt(i,P,Xt(D.defaultValue))),D.keepTouched||Yt(r.touchedFields,P),D.keepDirty||(Yt(r.dirtyFields,P),r.isDirty=D.defaultValue?I(P,Xt(ie(i,P))):I()),D.keepError||(Yt(r.errors,P),f.isValid&&g()),d.state.next({...r}))},Bo=(P,D={})=>{let _=P?Xt(P):i,Z=Xt(_),Y=P&&!mr(P)?Z:i;if(D.keepDefaultValues||(i=_),!D.keepValues){if(D.keepDirtyValues)for(let W of l.mount)ie(r.dirtyFields,W)?rt(Y,W,ie(s,W)):te(W,ie(Y,W));else{if(gR&&ot(P))for(let W of l.mount){let ce=ie(o,W);if(ce&&ce._f){let De=Array.isArray(ce._f.refs)?ce._f.refs[0]:ce._f.ref;if(Uv(De)){let F=De.closest("form");if(F){F.reset();break}}}}o={}}s=t.shouldUnregister?D.keepDefaultValues?Xt(i):{}:Xt(Y),d.array.next({values:{...Y}}),d.values.next({values:{...Y}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!a.mount&&e(),a.mount=!f.isValid||!!D.keepIsValid,a.watch=!!t.shouldUnregister,d.state.next({submitCount:D.keepSubmitCount?r.submitCount:0,isDirty:D.keepDirty?r.isDirty:!!(D.keepDefaultValues&&!_a(P,i)),isSubmitted:D.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:D.keepDirtyValues?r.dirtyFields:D.keepDefaultValues&&P?fR(i,P):{},touchedFields:D.keepTouched?r.touchedFields:{},errors:D.keepErrors?r.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Jo=(P,D)=>Bo(Rs(P)?P(s):P,D);return{control:{register:pn,unregister:dn,getFieldState:C,handleSubmit:Pn,setError:St,_executeSchema:O,_getWatch:U,_getDirty:I,_updateValid:g,_removeUnmounted:L,_updateFieldArray:k,_updateDisabledField:Ve,_getFieldArray:V,_reset:Bo,_resetDefaultValues:()=>Rs(n.defaultValues)&&n.defaultValues().then(P=>{Jo(P,n.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:P=>{r={...r,...P}},_disableForm:Tn,_subjects:d,_proxyFormState:f,_setErrors:b,get _fields(){return o},get _formValues(){return s},get _state(){return a},set _state(P){a=P},get _defaultValues(){return i},get _names(){return l},set _names(P){l=P},get _formState(){return r},set _formState(P){r=P},get _options(){return n},set _options(P){n={...n,...P}}},trigger:it,register:pn,handleSubmit:Pn,watch:Cn,setValue:te,getValues:ct,reset:Jo,resetField:qr,clearErrors:Qe,unregister:dn,setError:St,setFocus:(P,D={})=>{let _=ie(o,P),Z=_&&_._f;if(Z){let Y=Z.refs?Z.refs[0]:Z.ref;Y.focus&&(Y.focus(),D.shouldSelect&&Y.select())}},getFieldState:C}}function tc(t={}){let e=_e.default.useRef(),n=_e.default.useRef(),[r,o]=_e.default.useState({isDirty:!1,isValidating:!1,isLoading:Rs(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Rs(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...rW(t,()=>o(s=>({...s}))),formState:r});let i=e.current.control;return i._options=t,yR({subject:i._subjects.state,next:s=>{H$(s,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),_e.default.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),_e.default.useEffect(()=>{if(i._proxyFormState.isDirty){let s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),_e.default.useEffect(()=>{t.values&&!_a(t.values,n.current)?(i._reset(t.values,i._options.resetOptions),n.current=t.values,o(s=>({...s}))):i._resetDefaultValues()},[t.values,i]),_e.default.useEffect(()=>{t.errors&&i._setErrors(t.errors)},[t.errors,i]),_e.default.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=j$(r,i),e.current}var pe=q(ye(),1),nc=rn(void 0);nc.debugLabel="formControlAtom";var LB=rn(void 0);LB.debugLabel="formTypesAtom";var jv=()=>{let[t,e]=Nt(LB),n=async()=>{let o=await vt.types({});e(o)};return{fields:(0,za.useMemo)(()=>{if(!(!t||!t.content?.msg))return Bv(t.content,t.content.msg)},[t]),loadFormTypes:n}},Hv=({fields:t})=>{let[e]=Nt(nc);if(e===void 0)return null;let n=["data"];return(0,pe.jsx)("div",{className:"grpc-request-form",children:(0,pe.jsx)("table",{children:(0,pe.jsx)("tbody",{children:t.map(r=>(0,pe.jsxs)("tr",{className:"message_field",children:[(0,pe.jsxs)("td",{className:"name",children:[(0,pe.jsx)("strong",{children:r.name}),(0,pe.jsx)("br",{}),r.fieldType]}),(0,pe.jsx)("td",{children:(0,pe.jsx)("div",{className:"input_container two-of-2 three-of-3 two-of-4 one-of-5",children:(0,pe.jsx)("div",{className:"field-content",children:(0,pe.jsx)($v,{fc:e,field:r,path:[...n,r.name]})})})})]},r.name))})})})},$v=({fc:t,path:e,field:n})=>{switch(n.type){case"repeated":return(0,pe.jsx)(oW,{fc:t,field:n,path:e});case"msg":return(0,pe.jsx)(iW,{fc:t,field:n,path:e});case"map":return(0,pe.jsx)(DB,{fc:t,field:n,path:e});case"group":return(0,pe.jsx)(FB,{fc:t,field:n,path:e})}},oW=({fc:t,path:e,field:n})=>{let{control:r}=t,o=n.repeatedField,{fields:i,append:s,remove:a}=OB({control:r,name:e.join(".")});return(0,pe.jsx)("table",{children:(0,pe.jsxs)("tbody",{children:[i.map((l,u)=>{let c=e.concat(u.toString());return(0,pe.jsx)("tr",{className:"array_element",children:(0,pe.jsxs)("td",{children:[(0,pe.jsx)($v,{fc:t,field:o,path:c}),(0,pe.jsx)("button",{className:"btn btn-error",onClick:()=>a(u),children:"Remove"})]})},c.join("."))}),(0,pe.jsx)("tr",{children:(0,pe.jsx)("td",{children:(0,pe.jsx)("button",{onClick:()=>s(mB(o)),children:"New"})})})]})})},iW=({field:t,path:e,fc:n})=>{let{control:r,register:o}=n,i=e.join("."),a=qv({control:r,name:i,defaultValue:""})||"";switch(t.field.type){case lt.STRING:return(0,pe.jsx)("input",{type:"text",className:"input input-bordered",value:a,...o(i)});case lt.BOOL:return(0,pe.jsx)("input",{type:"checkbox",checked:a,...o(i)});case lt.INT32:return(0,pe.jsx)("input",{type:"number",className:"input input-bordered",value:a,...o(i)});default:return(0,pe.jsx)("input",{type:"text",className:"input input-bordered",value:a,...o(i)})}},DB=({fc:t,path:e,field:n})=>{let[r,o]=(0,za.useState)(void 0),{resetField:i,setValue:s}=t,a=e.join("."),l=qv({control:t.control,name:a})||{};return(0,pe.jsx)("table",{children:(0,pe.jsxs)("tbody",{children:[Object.keys(l).filter(u=>l[u]!==void 0).map((u,c)=>{let f=e.concat(u);return(0,pe.jsx)("tr",{className:"array_element",children:(0,pe.jsxs)("td",{children:[(0,pe.jsx)("button",{className:"btn btn-error",onClick:()=>{s(f.join("."),void 0)},children:"remove"}),(0,pe.jsxs)("div",{className:"map_key",children:[(0,pe.jsx)("input",{type:"text",className:"input input-bordered",value:r?.prev===u?r.new:u,onChange:d=>{o({prev:u,new:d.target.value})}}),r?.prev===u&&(0,pe.jsx)("button",{className:"btn btn-sm",onClick:()=>{r?.prev===u&&(i(f.join(".")),o(void 0),s(e.concat(r?.new).join("."),l))},children:"save"})]}),u!==""&&(0,pe.jsx)("div",{className:"map_value",children:(0,pe.jsx)($v,{fc:t,field:n.value,path:f})})]})},e.concat(u.toString()).join("."))}),(0,pe.jsx)("tr",{children:(0,pe.jsx)("td",{children:(0,pe.jsx)("button",{onClick:()=>{s(e.concat("key").join("."),{})},children:"New"})})})]})})},FB=({field:t,path:e,fc:n})=>{let{resetField:r}=n,[o,i]=(0,za.useState)([]),s=u=>{t.children.forEach(c=>{r([...e,c.name].join("."))})},a=u=>{t.isOneOf?(i([u]),s(u)):o.some(c=>c===u)?i(c=>c.filter(f=>f!==u)):i(c=>[...c,u])},l=u=>o.some(c=>c===u);return(0,pe.jsx)("div",{className:"oneof",children:(0,pe.jsx)("table",{children:(0,pe.jsx)("tbody",{children:t.children.map(u=>{let c=t.isOneOf?[...e.slice(0,-1),u.name]:[...e,u.name];return(0,pe.jsx)(sW,{onSelect:a,isOneOf:t.isOneOf,checked:l(u.name),path:c,field:u,fc:n},c.join("."))})})})})},sW=({field:t,path:e,isOneOf:n,checked:r,onSelect:o,fc:i})=>{let s=e.join("."),a=qv({control:i.control,name:s});return(0,za.useEffect)(()=>{!r&&a!==void 0&&o(t.name)},[a]),(0,pe.jsxs)("tr",{children:[(0,pe.jsxs)("td",{className:"name",children:[(0,pe.jsx)("strong",{children:t.name}),(0,pe.jsx)("br",{}),t.fieldType]}),(0,pe.jsx)("td",{children:(0,pe.jsx)("input",{type:n?"radio":"checkbox",checked:r,onChange:()=>o(t.name)})}),(0,pe.jsx)("td",{children:r?(0,pe.jsx)($v,{field:t,fc:i,path:e}):"unset"})]})};function Va(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return t.map(n=>Va(n)).filter(n=>!(typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0));let e={};for(let[n,r]of Object.entries(t)){let o=Va(r);o===""||o===void 0||typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length===0||(e[n]=o)}return e}var Wv=q(ge(),1);var bi=q(ye(),1),BB=({id:t,file:e,onChange:n})=>{let[r,o]=(0,Wv.useState)([]);return(0,Wv.useEffect)(()=>{(async()=>(await vt.search({contentID:t})).storedContent.forEach(s=>{s.related.forEach(a=>{switch(a.type.case){case"normalized":let l=a.type.value;switch(l.type.case){case"transcript":console.log(l),o([...r,l.type.value.segments.map(u=>u.text).join(" ")]);break}}})}))()},[]),(0,bi.jsxs)(bi.Fragment,{children:[(0,bi.jsx)("h5",{children:e.file}),(0,bi.jsx)("audio",{src:e.url,controls:!0}),(0,bi.jsx)("ul",{children:r.map(i=>(0,bi.jsx)("li",{children:i},i))})]})};var Gv=q(ge(),1);var Fo=q(ge(),1);var gt=q(ye(),1);function aW(t){if(t?.type.case==="post")return{id:t.id,tags:t.tags,post:t.type.value}}var JB=({section:t,onUpdate:e,onDelete:n})=>{let[r,o]=(0,Fo.useState)([]),[i,s]=(0,Fo.useState)(void 0),[a,l]=(0,Fo.useState)(void 0),[u,c]=(0,Fo.useState)(t.tags),[f,d]=(0,Fo.useState)(!1),[p,m]=(0,Fo.useState)(t.menu?.name??""),y=tc();(0,Fo.useEffect)(()=>{o([]),m(t.menu?.name??""),c(t.tags)},[t]),(0,Fo.useEffect)(()=>{w(u)},[u]);let w=async b=>{try{let x=await vt.search({tags:b});o(x.storedContent.map(T=>aW(T.content)).filter(ra))}catch(x){console.error(x),He.error("Failed to get posts")}},g=(b,x)=>{x&&b&&s(b),x||s(void 0)},v=async b=>{c(b),e(new si({...t,tags:b}))},k=b=>{l(b)};return(0,gt.jsxs)("div",{className:"space-y-3",children:[(0,gt.jsx)("input",{type:"text",placeholder:"name",className:"input w-full max-w-xs",value:p,onChange:b=>{m(b.target.value),e(new si({...t,menu:new Zs({...t.menu,name:b.target.value})}))}}),(0,gt.jsxs)("div",{className:"flex flex-row space-x-2",children:[(0,gt.jsx)(qu,{onNewTag:b=>{v([...u,b])}}),(0,gt.jsx)("button",{className:"btn",onClick:()=>{d(!f)},children:f?(0,gt.jsx)(Tk,{className:"h-5 w-5"}):(0,gt.jsx)(Pk,{className:"h-5 w-5"})}),(0,gt.jsx)("button",{className:"btn",onClick:n,children:(0,gt.jsx)(Jf,{className:"h-5 w-5"})})]}),u.map(b=>(0,gt.jsx)("span",{className:"badge badge-outline badge-sm",onClick:()=>{v(u.filter(x=>x!==b))},children:b},b)),f&&(0,gt.jsxs)("table",{className:"table w-full",children:[(0,gt.jsx)("thead",{children:(0,gt.jsxs)("tr",{children:[(0,gt.jsx)("th",{children:"title"}),(0,gt.jsx)("th",{children:"tags"})]})}),(0,gt.jsx)("tbody",{children:r.filter(ra).map((b,x)=>(0,gt.jsxs)("tr",{children:[(0,gt.jsx)("td",{children:b.post.title}),(0,gt.jsx)("td",{children:(0,gt.jsx)("div",{className:"flex gap-3",children:b.tags.map(T=>(0,gt.jsx)("span",{className:"badge badge-outline badge-sm",children:T},T))})})]},x))})]})]})};var Vr=q(ye(),1),UB=({site:t,onUpdate:e})=>{let[n,r]=(0,Gv.useState)(void 0),o=()=>{e(new ts({...t,sections:t.sections.filter((i,s)=>s!==n)}))};return(0,Gv.useEffect)(()=>{t.sections.length===0&&e(new ts({...t,sections:[new si({})]})),t.sections.length>0&&n===void 0&&r(0)},[t]),(0,Vr.jsxs)(Vr.Fragment,{children:[(0,Vr.jsx)("div",{className:"text-gray-600 px-3 py-2",children:(0,Vr.jsxs)("h4",{className:"text-lg font-semibold",children:["site: ",t.hugoConfig?.title||"untitled"]})}),(0,Vr.jsx)("button",{className:"btn",onClick:()=>{e(new ts({...t,sections:[...t.sections,new si({})]}))},children:(0,Vr.jsx)(Mk,{className:"h-6 w-6"})}),(0,Vr.jsx)("div",{className:"tabs tabs-bordered my-6",children:t.sections.map((i,s)=>(0,Vr.jsx)("a",{className:`tab ${s===n?"tab-active":""}`,onClick:()=>r(s),children:i.menu?.name||"untitled"},s))}),n!==void 0&&(0,Vr.jsx)(JB,{section:t.sections[n],onUpdate:i=>{e(new ts({...t,sections:t.sections.map((s,a)=>a===n?i:s)}))},onDelete:o})]})};var Id=q(ge(),1);var lo=q(ye(),1),_B=({conversation:t,onUpdate:e,className:n})=>{let[r,o]=(0,Id.useState)([]),[i,s]=(0,Id.useState)([]),a=Object.keys(t.mapping).find(c=>!t.mapping[c].parent),l=(c,f)=>{let d=c;for(;d&&t.mapping[d].children.length>0;)f.push(d),d=t.mapping[d].children[0];d&&f.push(d),s(f)};(0,Id.useEffect)(()=>{a!==void 0&&l(a,[])},[t]);let u=(c,f)=>{l(c,i.slice(0,f))};return(0,lo.jsx)("div",{className:`${n||""} p-4 bg-gray-100 rounded-md shadow`,children:(0,lo.jsx)("div",{className:"flex flex-col gap-2",children:i.map((c,f)=>{let d=t.mapping[c];if(!d)return console.warn(`Node ${c} not found in conversation mapping`),null;let p=r.includes(c),m=d.message?.author,y=t.mapping[d.parent??""],w=y?y.children:[],g=d.message?.content?.textParts.join(" ");return g===void 0||g===""?(console.log("skipping node",c,d.message?.content),null):(0,lo.jsxs)("div",{children:[(0,lo.jsxs)("div",{className:`chat ${m?.role!=="user"?"chat-start":"chat-end"}`,children:[(0,lo.jsx)("div",{className:"chat-header",children:m?.role}),(0,lo.jsx)("div",{className:`chat-bubble overflow-x-auto ${p?"max-h-32 overflow-hidden":""}`,onClick:()=>{},children:(0,lo.jsx)(Ku,{className:p?"clamp":"",children:g})})]}),m?.role==="user"&&w.length>1&&(0,lo.jsx)("div",{className:"flex gap-2 mt-2",children:w.map(v=>(0,lo.jsx)("button",{className:`max-w-sm text-ellipsis px-2 py-1 text-sm rounded ${v===c?"bg-blue-500 text-white":"bg-gray-200"}`,onClick:()=>u(v,f),children:t.mapping[v].message?.content?.textParts.join(" ")},v))})]},d.id)})})})};var lW=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,uW=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,cW=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,fW=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,zB=fr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Co({find:lW,type:this.type}),Co({find:cW,type:this.type})]},addPasteRules(){return[Ir({find:uW,type:this.type}),Ir({find:fW,type:this.type})]}});var dW=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,pW=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,mW=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,hW=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,VB=fr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Co({find:dW,type:this.type}),Co({find:mW,type:this.type})]},addPasteRules(){return[Ir({find:pW,type:this.type}),Ir({find:hW,type:this.type})]}});var gW=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,yW=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,qB=fr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",$t(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){let t={};return ey()?t["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():t["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),t},addInputRules(){return[Co({find:gW,type:this.type})]},addPasteRules(){return[Ir({find:yW,type:this.type})]}});var Le=q(ye(),1),HB=({})=>{let t=(0,qa.useRef)(null),{editedContent:e,editContent:n,selectedContent:r}=uu(),{getSources:o}=lu(),[i,s]=Nt(nc),{fields:a,loadFormTypes:l}=jv(),u=tc(),{setValue:c}=u,f=(0,qa.useRef)(void 0);(0,qa.useEffect)(()=>(l(),s(u),()=>{f.current&&f.current.abort()}),[]),(0,qa.useEffect)(()=>{e&&c("data",e.toJson())},[e]),(0,qa.useEffect)(()=>{r&&(c("data",r.toJson()),y&&y.commands.setContent(jB(r)),n(r))},[r]);let d=async S=>{e&&n(new Ge({...e,tags:[...e.tags,S]}))},p=async S=>{e&&n(new Ge({...e,tags:e.tags.filter(b=>b!==S)}))},m=async S=>{f.current&&f.current.abort();let b=new AbortController;f.current=b;try{let x=vt.infer({prompt:S},{timeoutMs:void 0,signal:b.signal});for await(let T of x)y?.chain().focus().insertContent(T.text||"").run()}catch(x){He.error(x.message),console.log(x)}finally{f.current=void 0}},y=pD({extensions:[kD,SD,xD,vD,wD,JD,zB,VB,qB,fB.configure({depth:100})],onUpdate:({editor:S})=>{if(localStorage.setItem("editorContent",S.getHTML()),e)switch(e.type.case){case"post":e.type.value.content=S?.getHTML()||"",n(new Ge({...e,type:{case:"post",value:e.type.value}}));break}},content:jB(e),editorProps:{handleKeyDown:(S,b)=>b.key==="Tab"?(b.preventDefault(),y===null?!1:(b.preventDefault(),b.shiftKey?y.chain().focus().liftListItem("listItem").run():y.chain().focus().sinkListItem("listItem").run(),!0)):!1}}),w=()=>{if(!i)return;let S=Va(i.getValues().data);try{return Ge.fromJson(S)}catch(b){return console.error("failed to parse content",b,"data",Va(S)),e}},g=async()=>{try{let S=await vt.save({content:w(),related:[]});o(),He.success("Saved content")}catch(S){He.error("Failed to save content"),console.error("failed to save",S)}},v=()=>{f.current?.abort()},k=()=>{y&&y.commands.setContent("")};return(0,Le.jsxs)("div",{children:[(0,Le.jsxs)("div",{className:"",children:[y&&(0,Le.jsx)(vW,{content:e,onUpdate:n,editor:y}),y&&(0,Le.jsx)(hD,{editor:y,tippyOptions:{duration:100},children:(0,Le.jsx)("button",{onClick:()=>{let{view:S,state:b}=y,{from:x,to:T}=S.state.selection,E=b.doc.textBetween(x,T,"");y.commands.setTextSelection({from:T,to:T}),y.commands.enter(),E&&m(E)},className:"btn "+y.isActive("bold")?"is-active":"",children:"ai"})}),(0,Le.jsx)("dialog",{id:"my_modal_1",className:"modal",ref:t,children:(0,Le.jsxs)("div",{className:"modal-box",children:[a&&(0,Le.jsx)(Hv,{fields:a}),(0,Le.jsx)("form",{method:"dialog",children:(0,Le.jsx)("div",{className:"modal-action",children:(0,Le.jsx)("button",{className:"btn",onClick:()=>{n(w())},children:"save"})})})]})})]}),(0,Le.jsxs)("div",{className:"flex justify-between w-full",children:[(0,Le.jsxs)("div",{className:"flex flex-row space-x-2",children:[(0,Le.jsx)(qu,{onNewTag:d}),(0,Le.jsx)("span",{children:(0,Le.jsx)("button",{className:"btn",onClick:()=>t.current?.showModal(),children:(0,Le.jsx)(Ck,{className:"h-6 w-6"})})}),f.current&&(0,Le.jsx)("button",{className:"btn",onClick:v,children:(0,Le.jsx)(Ik,{className:"h-6 w-6"})})]}),(0,Le.jsx)("button",{className:"btn",onClick:g,children:(0,Le.jsx)(Nk,{className:"h-6 w-6"})})]}),(0,Le.jsx)("span",{children:e?.tags.map(S=>(0,Le.jsx)("span",{className:"badge badge-outline badge-sm",onClick:()=>p(S),children:S},S))})]})};var vW=({content:t,editor:e,onUpdate:n})=>(0,Le.jsx)("div",{children:(o=>{if(o)switch(o.type.case){case"chatgptConversation":return(0,Le.jsx)(_B,{className:"h-screen overflow-y-auto space-y-2",conversation:o.type.value,onUpdate:a=>{n(new Ge({...o,type:{case:"chatgptConversation",value:a}}))}});case"site":return(0,Le.jsx)(UB,{site:o.type.value,onUpdate:a=>{n(new Ge({...o,type:{case:"site",value:a}}))}});case"post":let i=o.type.value;return(0,Le.jsxs)("div",{className:"space-y-2",children:[(0,Le.jsx)("input",{type:"text",value:i.title,onChange:a=>{n(new Ge({...o,type:{case:"post",value:{...i,title:a.target.value}}}))},placeholder:"title",className:"input w-full max-w-xs"}),(0,Le.jsx)(M1,{className:"max-h-72 overflow-y-auto",editor:e})]});case"data":let s=o.type.value;switch(s.type.case){case"file":return(0,Le.jsx)(BB,{id:o.id,file:s.type.value,onChange:l=>{n(new Ge({...o,type:{case:"data",value:{...o.type.value,type:{case:"file",value:l}}}}))}});case"url":let a=s.type.value;return(0,Le.jsx)(iB,{id:o.id,url:a.url,onChange:l=>{n(new Ge({...o,type:{case:"data",value:{...o.type.value,type:{case:"url",value:{...a,url:l}}}}}))}})}}return(0,Le.jsx)(M1,{className:"max-h-72 overflow-y-auto",editor:e})})(t)}),jB=t=>{let e="don't think, write.";if(!t)return e;switch(t.type.case){case"post":return t.type.value.content;case"data":let n=t.type.value;switch(n.type.case){case"text":return n.type.value.data.toString()}break}return e};var Ad=q(ge(),1);var WB=q(ye(),1),$B=({children:t})=>{let[e,n]=(0,Ad.useState)(!1),r=(0,Ad.useCallback)(async s=>{s.preventDefault(),n(!1);let a=s.dataTransfer.files[0];if(a){let l=new FileReader;l.onload=u=>{try{let c=u.target.result;if(c){let f=new Uint8Array(c),d=vt.save({content:{type:{case:"data",value:new ea({type:{case:"file",value:new Tf({file:a.name,data:f})}})}}},{timeoutMs:void 0})}}catch(c){console.error(c)}},l.readAsArrayBuffer(a)}},[]),o=s=>{s.preventDefault(),n(!1)},i=(0,Ad.useCallback)(s=>{s.preventDefault(),n(!0)},[]);return(0,WB.jsx)("div",{onDrop:r,onDragOver:i,onDragLeave:o,style:{border:e?"2px dashed #cccccc":""},children:t})};function GB(){return new Ge({tags:[],type:{case:"site",value:{sections:[]}}})}function KB(t){return new Ge({tags:[],type:{case:"post",value:new Cf({content:t})}})}function wW(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,n=t==="x"?e:e&3|8;return n.toString(16)})}function YB(t,e){return new Ge({id:wW(),tags:e,type:{case:"data",value:new ea({type:{case:"url",value:{url:t}}})}})}var ue=q(ye(),1),XB=()=>{let{sources:t,types:e,setSelected:n,getSources:r,tags:o}=lu(),{editContent:i}=uu(),{id:s}=Xs(),{logout:a}=ko();(0,SR.useEffect)(()=>{r()},[e,o]),(0,SR.useEffect)(()=>{s&&(async()=>{try{let c=await vt.search({contentID:s});if(c.storedContent.length===0)return;i(c.storedContent[0].content||void 0)}catch(c){console.error("failed to get sources",c)}})()},[s]);let l=c=>{n(c)},u=async()=>{try{let c=await vt.publish({});He.success("Published content")}catch(c){He.error("Failed to publish content"),console.error("failed to publish",c)}};return t?(0,ue.jsxs)("div",{className:"p-5 h-[95vh] flex flex-col",children:[(0,ue.jsxs)("div",{className:"navbar bg-base-100",children:[(0,ue.jsx)("div",{className:"flex-1",children:(0,ue.jsx)("p",{className:"text-xl",children:"just share."})}),(0,ue.jsx)("div",{className:"flex-none",children:(0,ue.jsxs)("ul",{className:"menu menu-horizontal px-1",children:[(0,ue.jsx)("li",{children:(0,ue.jsx)(xW,{})}),(0,ue.jsx)("li",{children:(0,ue.jsxs)("details",{className:"dropdown",children:[(0,ue.jsx)("summary",{children:"new"}),(0,ue.jsxs)("ul",{className:"p-2 shadow menu dropdown-content z-[1] bg-base-100 rounded-box w-52",children:[(0,ue.jsx)("li",{onClick:()=>{i(YB("https://example.com",[]))},children:"url"}),(0,ue.jsx)("li",{onClick:()=>{i(KB("Don't think, write."))},children:"post"}),(0,ue.jsx)("li",{onClick:()=>{i(GB())},children:"site"})]})]})}),(0,ue.jsx)("li",{children:(0,ue.jsx)("a",{onClick:u,children:"publish"})}),(0,ue.jsx)("li",{children:(0,ue.jsx)("a",{onClick:a,children:"logout"})})]})})]}),(0,ue.jsx)("div",{className:"flex-grow",children:(0,ue.jsx)($B,{children:(0,ue.jsx)("div",{className:"card bg-base-100 shadow-xl",children:(0,ue.jsx)("div",{className:"card-body",children:(0,ue.jsx)(HB,{})})})})})]}):(0,ue.jsx)("div",{className:"loading loading-lg"})},xW=()=>{let{selected:t,setTypes:e,setTags:n,tags:r}=lu(),o=i=>async()=>{e(s=>s.includes(i)?s.filter(a=>a!==i):[...s,i])};return(0,ue.jsxs)("div",{className:"drawer z-50",children:[(0,ue.jsx)("input",{id:"my-drawer",type:"checkbox",className:"drawer-toggle"}),(0,ue.jsx)("div",{className:"drawer-content",children:(0,ue.jsx)("label",{htmlFor:"my-drawer",className:"drawer-button",children:"your shit"})}),(0,ue.jsxs)("div",{className:"drawer-side",children:[(0,ue.jsx)("label",{htmlFor:"my-drawer","aria-label":"close sidebar",className:"drawer-overlay"}),t&&(0,ue.jsxs)("div",{className:"flex flex-col p-4 w-80 min-h-full bg-base-200 text-base-content",children:[(0,ue.jsxs)("div",{className:"flex flex-row space-y-2",children:[(0,ue.jsx)("div",{children:(0,ue.jsxs)("details",{className:"dropdown",children:[(0,ue.jsx)("summary",{className:"btn",children:"type"}),(0,ue.jsxs)("ul",{className:"p-2 shadow menu dropdown-content z-[1] bg-base-100 rounded-box w-52",children:[(0,ue.jsx)("li",{onClick:o("site"),children:"site"}),(0,ue.jsx)("li",{onClick:o("post"),children:"post"})]})]})}),(0,ue.jsx)(qu,{onNewTag:i=>{n(s=>s.includes(i)?s:[...s,i])}}),r.map(i=>(0,ue.jsx)("span",{className:"badge badge-outline badge-sm",onClick:()=>{n(s=>s.filter(a=>a!==i))},children:i},i))]}),(0,ue.jsx)("div",{className:"overflow-x-auto",children:(0,ue.jsx)(SW,{displayContent:t.displayContent})})]})]})]})},SW=({displayContent:t})=>{let{selectedContent:e,selectContent:n}=uu(),{getSources:r}=lu(),o=(a,l)=>{l&&a&&n(a),l||n(void 0)},i=async()=>{if(e)try{let a=await vt.delete({contentIds:[e.id]});r(),He.success("Deleted content")}catch(a){He.error("Failed to delete content"),console.error("failed to delete",a)}},s=e?[t.find(a=>a.content?.id===e.id),...t.filter(a=>a.content?.id!==e.id)]:t;return(0,ue.jsxs)("table",{className:"table w-full",children:[(0,ue.jsx)("thead",{children:(0,ue.jsxs)("tr",{children:[(0,ue.jsx)("th",{children:e&&(0,ue.jsx)(Jf,{onClick:i,className:"h-5 w-5"})}),(0,ue.jsx)("th",{children:"title"}),(0,ue.jsx)("th",{children:"tags"})]})}),(0,ue.jsx)("tbody",{children:s.filter(ra).map((a,l)=>(0,ue.jsxs)("tr",{children:[(0,ue.jsx)("td",{children:(0,ue.jsx)("input",{type:"checkbox",className:"checkbox checkbox-accent",checked:e?.id===a.content?.id,onChange:u=>o(a.content,u.target.checked)})}),(0,ue.jsx)("td",{children:a.title}),(0,ue.jsx)("td",{children:(0,ue.jsx)("div",{className:"gap-3",children:a.content?.tags.map(u=>(0,ue.jsx)("span",{className:"badge badge-outline badge-sm",children:u},u))})})]},l))})]})};var QB=q(ge(),1),Kv=q(ye(),1);function rc(){let{user:t,tryLogin:e}=ko();return(0,QB.useEffect)(()=>{e()},[]),(0,Kv.jsx)("div",{className:"h-screen flex flex-col gap-4 w-full",children:t?(0,Kv.jsx)(XB,{}):(0,Kv.jsx)(ns,{allowRegister:!0})})}var uo=q(ye(),1),ZB=()=>{let{setCurrentGroup:t,user:e}=jM(),[n,r]=(0,Ld.useState)(!1),[o,i]=(0,Ld.useState)(void 0),{secret:s}=Xs();(0,Ld.useEffect)(()=>{(async()=>{let c=await So.groupInfo({secret:s});i(c.name)})()},[s]);let a=async()=>{try{let c=await So.joinGroup({secret:s});He.success("Joined group"),r(!0),t(c.id)}catch(c){console.error(c),He.error("Failed to join group")}};return n?(0,uo.jsx)(rc,{}):(0,uo.jsxs)("div",{className:"flex flex-col gap-5 h-screen w-screen justify-center items-center",children:[o?(0,uo.jsxs)("h3",{children:["Want to join ",o,"?"]}):(0,uo.jsx)("span",{className:"loading loading-spinner"}),e?(0,uo.jsx)("button",{className:"btn",onClick:a,children:"Join Group"}):(0,uo.jsx)(uo.Fragment,{children:(0,uo.jsx)(ns,{allowRegister:!0})})]})};var r3=q(ge(),1);var kW=rn([]),e3=()=>{let[t,e]=Nt(kW);return{messages:t,setMessages:e,getMessages:()=>{let r=new AbortController;return(async()=>{try{let o=pg.receiveMessages({},{signal:r.signal});for await(let i of o)e(s=>[i,...s]),console.log(t)}catch(o){console.log(o),He.error("Failed to receive messages")}})(),()=>{r.abort()}}}};var oc=q(ge(),1);function t3(t){return new Date(Number(t)*1e3).toLocaleString()}var Ke=q(ye(),1),n3=()=>{let{user:t,logout:e}=ko(),{messages:n,getMessages:r}=e3(),[o,i]=(0,oc.useState)("");(0,oc.useEffect)(r,[]);let s=oc.default.useRef(null),a=()=>{s.current&&s.current.showModal()},l=async()=>{let u=await pg.sendMessage({message:o});i("")};return(0,Ke.jsxs)("div",{className:"bg-opacity-0",children:[(0,Ke.jsxs)("div",{className:"flex flex-row gap-2",children:[t?(0,Ke.jsx)("button",{className:"btn",onClick:e,children:"logout"}):(0,Ke.jsx)("button",{className:"btn",onClick:a,children:"login"}),(0,Ke.jsx)("dialog",{className:"modal",ref:s,children:(0,Ke.jsxs)("div",{className:"modal-box",children:[(0,Ke.jsx)(ns,{allowRegister:!0,next:"/app/chat"}),(0,Ke.jsx)("div",{className:"modal-action",children:(0,Ke.jsx)("form",{method:"dialog",children:(0,Ke.jsx)("button",{className:"btn",children:"Close"})})})]})}),(0,Ke.jsxs)("a",{className:"btn",href:"https://paypal.me/ineedafix",children:["donate",(0,Ke.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,Ke.jsx)("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})})]}),(0,Ke.jsxs)("a",{className:"btn",href:"https://github.com/lunabrain-ai/lunabrain",children:["code",(0,Ke.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",className:"w-6 h-6",children:(0,Ke.jsx)("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"})})]})]}),(0,Ke.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,Ke.jsx)("input",{type:"text",placeholder:"Type here",value:o,onKeyDown:u=>{u.key==="Enter"&&l()},onChange:u=>i(u.target.value),className:"input input-bordered w-full max-w-xs"}),(0,Ke.jsx)("button",{className:"btn",onClick:l,children:"Send"})]}),(0,Ke.jsx)("div",{className:"w-full",children:n.map((u,c)=>(0,Ke.jsxs)("div",{className:"chat chat-start",children:[(0,Ke.jsxs)("div",{className:"chat-header",children:[(0,Ke.jsx)("span",{className:"mx-1",children:u.user}),(0,Ke.jsx)("time",{className:"text-xs opacity-50",children:t3(u.timestamp)})]}),(0,Ke.jsx)("div",{className:"chat-bubble",children:u.text})]},c))})]})};var kR=q(ye(),1),o3=()=>{let{user:t,tryLogin:e}=ko();return(0,r3.useEffect)(()=>{e()},[]),(0,kR.jsx)("div",{className:"h-screen flex flex-col gap-4 w-full",children:(0,kR.jsx)(n3,{})})};var Yv=q(ge(),1);var ic=q(ye(),1),i3=()=>{let[t,e]=(0,Yv.useState)(!1),{secret:n}=Xs(),r=async()=>{try{let o=await So.verifyUser({secret:n});He.success("Joined group"),e(!0)}catch(o){console.error(o),He.error("Failed to join group")}};return(0,Yv.useEffect)(()=>{r()},[]),t?(0,ic.jsx)(ns,{}):(0,ic.jsxs)("div",{className:"flex flex-col gap-5 h-screen w-screen justify-center items-center",children:[(0,ic.jsx)("h3",{children:"Verifying..."}),(0,ic.jsx)("span",{className:"loading loading-spinner"})]})};var Xv=q(ge(),1);var Tt=q(ye(),1),s3=["ui"],a3=()=>{let[t,e]=Xv.default.useState(s3[0]);return(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsxs)("div",{className:"navbar bg-base-100",children:[(0,Tt.jsx)("div",{className:"flex-1",children:(0,Tt.jsx)("a",{className:"btn btn-ghost text-xl",children:"admin"})}),(0,Tt.jsx)("div",{className:"flex-none",children:(0,Tt.jsx)("ul",{className:"menu menu-horizontal px-1",children:s3.map(n=>(0,Tt.jsx)("li",{children:(0,Tt.jsx)("a",{className:`btn btn-ghost ${n===t?"btn-active":""}`,onClick:()=>e(n),children:n})},n))})})]}),(0,Tt.jsx)(bW,{tab:t})]})},bW=({tab:t})=>{switch(t){case"ui":return(0,Tt.jsx)(EW,{})}},EW=()=>(0,Tt.jsx)("div",{className:"container mx-auto",children:(0,Tt.jsx)(Mm,{children:(0,Tt.jsx)(RW,{})})}),RW=()=>{let[t,e]=Nt(nc),{fields:n,loadFormTypes:r}=jv(),o=tc();return(0,Xv.useEffect)(()=>{r(),e(o)},[]),n===void 0?null:(0,Tt.jsxs)(Tt.Fragment,{children:[(0,Tt.jsx)(Hv,{fields:n}),(0,Tt.jsx)("button",{className:"btn btn-primary",onClick:()=>{let i=Va(t?.getValues().data);console.log(Ge.fromJson(i))},children:"submit"})]})};var fn=q(ye(),1),CW=()=>{let e=sS([...[{path:"/app",element:(0,fn.jsx)(rc,{})},{path:"/app/group/:groupID",element:(0,fn.jsx)(rc,{})},{path:"/app/group/join/:secret",element:(0,fn.jsx)(ZB,{})},{path:"/app/chat",element:(0,fn.jsx)(o3,{})},{path:"/app/verify/:secret",element:(0,fn.jsx)(i3,{})},{path:"/app/content/:id",element:(0,fn.jsx)(rc,{})},{path:"/app/admin",element:(0,fn.jsx)(a3,{})}]]);return(0,fn.jsx)(fn.Fragment,{children:e})},l3=({dev:t})=>(0,fn.jsx)(Tm,{FallbackComponent:PN,children:(0,fn.jsxs)(Mm,{children:[(0,fn.jsx)(bN,{children:(0,fn.jsx)(CW,{})}),(0,fn.jsx)(uN,{})]})});var bR=q(ye(),1);window.React=ER.default;var c3=!1;c3&&new EventSource("/esbuild").addEventListener("change",()=>location.reload());var TW=u3.default.createRoot(document.getElementById("root"));TW.render((0,bR.jsx)(ER.default.StrictMode,{children:(0,bR.jsx)(l3,{dev:c3})}));})(); +`}]}}function Sv(t,e){let n=P2(t,e),r=n.one(t,null),o=N2(n);return o&&r.children.push({type:"text",value:` +`},o),Array.isArray(r)?{type:"root",children:r}:r}var s$=function(t,e){return t&&"run"in t?a$(t,e):l$(t||e)},FE=s$;function a$(t,e){return(n,r,o)=>{t.run(Sv(n,e),r,i=>{o(i)})}}function l$(t){return e=>Sv(e,t)}var we=q(J2(),1);var Si=class{constructor(e,n,r){this.property=e,this.normal=n,r&&(this.space=r)}};Si.prototype.property={};Si.prototype.normal={};Si.prototype.space=null;function BE(t,e){let n={},r={},o=-1;for(;++obe,booleanish:()=>xt,commaOrSpaceSeparated:()=>Zn,commaSeparated:()=>bs,number:()=>H,overloadedBoolean:()=>JE,spaceSeparated:()=>We});var f$=0,be=Ua(),xt=Ua(),JE=Ua(),H=Ua(),We=Ua(),bs=Ua(),Zn=Ua();function Ua(){return 2**++f$}var UE=Object.keys(Id),_a=class extends Rn{constructor(e,n,r,o){let i=-1;if(super(e,n),U2(this,"space",o),typeof r=="number")for(;++i4&&n.slice(0,4)==="data"&&p$.test(e)){if(e.charAt(4)==="-"){let i=e.slice(5).replace(V2,g$);r="data"+i.charAt(0).toUpperCase()+i.slice(1)}else{let i=e.slice(4);if(!V2.test(i)){let s=i.replace(m$,h$);s.charAt(0)!=="-"&&(s="-"+s),e="data"+s}}o=_a}return new o(r,e)}function h$(t){return"-"+t.toLowerCase()}function g$(t){return t.charAt(1).toUpperCase()}var Ev={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 q2=BE([zE,_E,VE,qE,_2],"html"),j2=BE([zE,_E,VE,qE,z2],"svg");function HE(t){if(t.allowedElements&&t.disallowedElements)throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(t.allowedElements||t.disallowedElements||t.allowElement)return e=>{Ja(e,"element",(n,r,o)=>{let i=o,s;if(t.allowedElements?s=!t.allowedElements.includes(n.tagName):t.disallowedElements&&(s=t.disallowedElements.includes(n.tagName)),!s&&t.allowElement&&typeof r=="number"&&(s=!t.allowElement(n,r,i)),s&&typeof r=="number")return t.unwrapDisallowed&&n.children?i.children.splice(r,1,...n.children):i.children.splice(r,1),r})}}var Dv=q(he(),1),lB=q(G2(),1);function K2(t){let e=t&&typeof t=="object"&&t.type==="text"?t.value||"":t;return typeof e=="string"&&e.replace(/[ \t\n\f\r]/g,"")===""}function Y2(t){return t.join(" ").trim()}function X2(t,e){let n=e||{};return(t[t.length-1]===""?[...t,""]:t).join((n.padRight?" ":"")+","+(n.padLeft===!1?"":" ")).trim()}var sB=q(iB(),1),aB=sB.default;var YE={}.hasOwnProperty,N$=new Set(["table","thead","tbody","tfoot","tr"]);function XE(t,e){let n=[],r=-1,o;for(;++r0?Dv.default.createElement(p,l,f):Dv.default.createElement(p,l)}function I$(t){let e=-1;for(;++e for more info)`),delete Fv[i]}let e=pE().use(pv).use(t.remarkPlugins||[]).use(FE,{...t.remarkRehypeOptions,allowDangerousHtml:!0}).use(t.rehypePlugins||[]).use(HE,t),n=new La;typeof t.children=="string"?n.value=t.children:t.children!==void 0&&t.children!==null&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${t.children}\`)`);let r=e.runSync(e.parse(n),n);if(r.type!=="root")throw new TypeError("Expected a `root` node");let o=Bv.default.createElement(Bv.default.Fragment,{},XE({options:t,schema:q2,listDepth:0},r));return t.className&&(o=Bv.default.createElement("div",{className:t.className},o)),o}Xu.propTypes={children:we.default.string,className:we.default.string,allowElement:we.default.func,allowedElements:we.default.arrayOf(we.default.string),disallowedElements:we.default.arrayOf(we.default.string),unwrapDisallowed:we.default.bool,remarkPlugins:we.default.arrayOf(we.default.oneOfType([we.default.object,we.default.func,we.default.arrayOf(we.default.oneOfType([we.default.bool,we.default.string,we.default.object,we.default.func,we.default.arrayOf(we.default.any)]))])),rehypePlugins:we.default.arrayOf(we.default.oneOfType([we.default.object,we.default.func,we.default.arrayOf(we.default.oneOfType([we.default.bool,we.default.string,we.default.object,we.default.func,we.default.arrayOf(we.default.any)]))])),sourcePos:we.default.bool,rawSourcePos:we.default.bool,skipHtml:we.default.bool,includeElementIndex:we.default.bool,transformLinkUri:we.default.oneOfType([we.default.func,we.default.bool]),linkTarget:we.default.oneOfType([we.default.func,we.default.string]),transformImageUri:we.default.func,components:we.default.object};var gt=q(me(),1),cB=({id:t,url:e,onChange:n})=>{let[r,o]=(0,Qu.useState)([]),[i,s]=(0,Qu.useState)([]),[a,l]=(0,Qu.useState)(void 0);return(0,Qu.useEffect)(()=>{(async()=>(await mt.search({contentID:t})).storedContent.forEach(c=>{c.related.forEach(f=>{switch(f.type.case){case"normalized":let d=f.type.value;switch(d.type.case){case"article":o([...r,{id:f.id,article:d.type.value}]);break;case"readme":s([...i,{id:f.id,readme:d.type.value}]);break}}})}))()},[]),(0,gt.jsxs)("div",{className:"form-group ",children:[(0,gt.jsx)("label",{htmlFor:"url",children:"URL"}),(0,gt.jsx)("input",{type:"text",className:"input w-full",id:"url",placeholder:"URL",value:e,onChange:u=>n(u.target.value)}),r.map(u=>(0,gt.jsx)("div",{className:"card",children:(0,gt.jsxs)("div",{className:"card-body",children:[(0,gt.jsx)("h2",{className:"card-title",children:u.article.title}),(0,gt.jsx)("p",{className:"max-h-72 truncate text-gray-500 font-normal",children:u.article.text}),(0,gt.jsx)("button",{className:"btn",onClick:()=>l(u.id),children:"read"}),(0,gt.jsxs)(nE,{open:a===u.id,children:[(0,gt.jsx)("h1",{children:u.article.title}),(0,gt.jsx)("p",{children:u.article.text}),(0,gt.jsx)("div",{className:"flex justify-end",children:(0,gt.jsx)("button",{className:"btn",onClick:()=>l(void 0),children:"close"})})]})]})},u.id)),i.map(u=>(0,gt.jsx)("div",{className:"card",children:(0,gt.jsxs)("div",{className:"card-body",children:[(0,gt.jsx)("p",{className:"max-h-72 truncate text-gray-500 font-normal",children:u.readme.data}),(0,gt.jsx)("button",{className:"btn",onClick:()=>l(u.id),children:"read"}),(0,gt.jsxs)(nE,{open:a===u.id,children:[(0,gt.jsx)(Xu,{className:"markdown",children:u.readme.data}),(0,gt.jsx)("div",{className:"flex justify-end",children:(0,gt.jsx)("button",{className:"btn",onClick:()=>l(void 0),children:"close"})})]})]})},u.id))]})};var Jv=200,cn=function(){};cn.prototype.append=function(e){return e.length?(e=cn.from(e),!this.length&&e||e.length=n?cn.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,n))};cn.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};cn.prototype.forEach=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length),n<=r?this.forEachInner(e,n,r,0):this.forEachInvertedInner(e,n,r,0)};cn.prototype.map=function(e,n,r){n===void 0&&(n=0),r===void 0&&(r=this.length);var o=[];return this.forEach(function(i,s){return o.push(e(i,s))},n,r),o};cn.from=function(e){return e instanceof cn?e:e&&e.length?new fB(e):cn.empty};var fB=function(t){function e(r){t.call(this),this.values=r}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(o,i){return o==0&&i==this.length?this:new e(this.values.slice(o,i))},e.prototype.getInner=function(o){return this.values[o]},e.prototype.forEachInner=function(o,i,s,a){for(var l=i;l=s;l--)if(o(this.values[l],a+l)===!1)return!1},e.prototype.leafAppend=function(o){if(this.length+o.length<=Jv)return new e(this.values.concat(o.flatten()))},e.prototype.leafPrepend=function(o){if(this.length+o.length<=Jv)return new e(o.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(cn);cn.empty=new fB([]);var J$=function(t){function e(n,r){t.call(this),this.left=n,this.right=r,this.length=n.length+r.length,this.depth=Math.max(n.depth,r.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(r){return ra&&this.right.forEachInner(r,Math.max(o-a,0),Math.min(this.length,i)-a,s+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,o,i,s){var a=this.left.length;if(o>a&&this.right.forEachInvertedInner(r,o-a,Math.max(i,a)-a,s+a)===!1||i=i?this.right.slice(r-i,o-i):this.left.slice(r,i).append(this.right.slice(0,o-i))},e.prototype.leafAppend=function(r){var o=this.right.leafAppend(r);if(o)return new e(this.left,o)},e.prototype.leafPrepend=function(r){var o=this.left.leafPrepend(r);if(o)return new e(o,this.right)},e.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new e(this.left,new e(this.right,r)):new e(this,r)},e}(cn),QE=cn;var U$=500,Va=class t{constructor(e,n){this.items=e,this.eventCount=n}popEvent(e,n){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let o,i;n&&(o=this.remapping(r,this.items.length),i=o.maps.length);let s=e.tr,a,l,u=[],c=[];return this.items.forEach((f,d)=>{if(!f.step){o||(o=this.remapping(r,d+1),i=o.maps.length),i--,c.push(f);return}if(o){c.push(new Ao(f.map));let p=f.step.map(o.slice(i)),m;p&&s.maybeStep(p).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new Ao(m,void 0,void 0,u.length+c.length))),i--,m&&o.appendMap(m,i)}else s.maybeStep(f.step);if(f.selection)return a=o?f.selection.map(o.slice(i)):f.selection,l=new t(this.items.slice(0,r).append(c.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(e,n,r,o){let i=[],s=this.eventCount,a=this.items,l=!o&&a.length?a.get(a.length-1):null;for(let c=0;cz$&&(a=_$(a,u),s-=u),new t(a.append(i),s)}remapping(e,n){let r=new Hf;return this.items.forEach((o,i)=>{let s=o.mirrorOffset!=null&&i-o.mirrorOffset>=e?r.maps.length-o.mirrorOffset:void 0;r.appendMap(o.map,s)},e,n),r}addMaps(e){return this.eventCount==0?this:new t(this.items.append(e.map(n=>new Ao(n))),this.eventCount)}rebased(e,n){if(!this.eventCount)return this;let r=[],o=Math.max(0,this.items.length-n),i=e.mapping,s=e.steps.length,a=this.eventCount;this.items.forEach(d=>{d.selection&&a--},o);let l=n;this.items.forEach(d=>{let p=i.getMirror(--l);if(p==null)return;s=Math.min(s,p);let m=i.maps[p];if(d.step){let y=e.steps[p].invert(e.docs[p]),w=d.selection&&d.selection.map(i.slice(l+1,p));w&&a++,r.push(new Ao(m,y,w))}else r.push(new Ao(m))},o);let u=[];for(let d=n;dU$&&(f=f.compress(this.items.length-r.length)),f}emptyItemCount(){let e=0;return this.items.forEach(n=>{n.step||e++}),e}compress(e=this.items.length){let n=this.remapping(0,e),r=n.maps.length,o=[],i=0;return this.items.forEach((s,a)=>{if(a>=e)o.push(s),s.selection&&i++;else if(s.step){let l=s.step.map(n.slice(r)),u=l&&l.getMap();if(r--,u&&n.appendMap(u,r),l){let c=s.selection&&s.selection.map(n.slice(r));c&&i++;let f=new Ao(u.invert(),l,c),d,p=o.length-1;(d=o.length&&o[p].merge(f))?o[p]=d:o.push(f)}}else s.map&&r--},this.items.length,0),new t(QE.from(o.reverse()),i)}};Va.empty=new Va(QE.empty,0);function _$(t,e){let n;return t.forEach((r,o)=>{if(r.selection&&e--==0)return n=o,!1}),t.slice(n)}var Ao=class t{constructor(e,n,r,o){this.map=e,this.step=n,this.selection=r,this.mirrorOffset=o}merge(e){if(this.step&&e.step&&!e.selection){let n=e.step.merge(this.step);if(n)return new t(n.getMap().invert(),n,this.selection)}}},Lo=class{constructor(e,n,r,o,i){this.done=e,this.undone=n,this.prevRanges=r,this.prevTime=o,this.prevComposition=i}},z$=20;function V$(t,e,n,r){let o=n.getMeta(Es),i;if(o)return o.historyState;n.getMeta(j$)&&(t=new Lo(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(n.steps.length==0)return t;if(s&&s.getMeta(Es))return s.getMeta(Es).redo?new Lo(t.done.addTransform(n,void 0,r,Uv(e)),t.undone,dB(n.mapping.maps[n.steps.length-1]),t.prevTime,t.prevComposition):new Lo(t.done,t.undone.addTransform(n,void 0,r,Uv(e)),null,t.prevTime,t.prevComposition);if(n.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=n.getMeta("composition"),l=t.prevTime==0||!s&&t.prevComposition!=a&&(t.prevTime<(n.time||0)-r.newGroupDelay||!q$(n,t.prevRanges)),u=s?ZE(t.prevRanges,n.mapping):dB(n.mapping.maps[n.steps.length-1]);return new Lo(t.done.addTransform(n,l?e.selection.getBookmark():void 0,r,Uv(e)),Va.empty,u,n.time,a??t.prevComposition)}else return(i=n.getMeta("rebased"))?new Lo(t.done.rebased(n,i),t.undone.rebased(n,i),ZE(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new Lo(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),ZE(t.prevRanges,n.mapping),t.prevTime,t.prevComposition)}function q$(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach((r,o)=>{for(let i=0;i=e[i]&&(n=!0)}),n}function dB(t){let e=[];return t.forEach((n,r,o,i)=>e.push(o,i)),e}function ZE(t,e){if(!t)return null;let n=[];for(let r=0;r{let n=Es.getState(t);return!n||n.done.eventCount==0?!1:(e&&mB(n,t,e,!1),!0)},nR=(t,e)=>{let n=Es.getState(t);return!n||n.undone.eventCount==0?!1:(e&&mB(n,t,e,!0),!0)};var gB=Ar.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:t,dispatch:e})=>tR(t,e),redo:()=>({state:t,dispatch:e})=>nR(t,e)}},addProseMirrorPlugins(){return[hB(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-Z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-Y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Shift-Mod-Z":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var Ha=q(he(),1);function qa(t){return t!=null}function H$(t){let e={};for(let n of Object.keys(t)){let r=t[n];typeof r=="number"&&(e[r]=n.toLowerCase())}return e}var yB=H$(lt),vB=t=>{if(t.defaultValue===void 0)return"";switch(t.type){case lt.STRING:return t.defaultValue;case lt.BOOL:return t.defaultValue==="true";case lt.INT32:case lt.SINT32:case lt.SFIXED32:case lt.UINT32:case lt.FIXED32:return parseInt(t.defaultValue);case lt.INT64:case lt.SINT64:case lt.SFIXED64:case lt.UINT64:case lt.FIXED64:return BigInt(t.defaultValue);case lt.DOUBLE:case lt.FLOAT:return parseFloat(t.defaultValue);default:return""}};function rR(t){return t.replace(/(_\w)/g,e=>e[1].toUpperCase())}var wB=t=>{switch(t.type){case"msg":return vB(t.field);case"group":return{};case"map":return{};case"repeated":return[]}};function _v(t,e){let n=i=>{let s=rR(i.name||"unknown"),a=i.type&&yB[i.type],l=i.label===Vl.REPEATED,u=d=>l?{type:"repeated",name:s,fieldType:a,field:i,repeatedField:d}:d;if(i.typeName===void 0)return u({type:"msg",field:i,name:s,fieldType:a});let c=i.typeName.substring(1),f=t.descLookup[c];if(f===void 0)throw new Error(`Unknown type ${c}`);if(f.options?.mapEntry){let d=_v(t,f);if(d.length!==2)throw new Error(`Map entry ${c} has ${d.length} children`);return{type:"map",field:i,name:s,key:d[0],value:d[1],fieldType:a}}return u({type:"group",field:i,name:s,children:_v(t,f),fieldType:a,isOneOf:!1})},r=e.field.filter(i=>i.oneofIndex===void 0).map(n),o=e.oneofDecl.map((i,s)=>{let a=e.field.filter(u=>u.oneofIndex===s).flatMap(n).filter(qa);return{type:"group",name:rR(i.name||"unknown"),field:i,children:a,fieldType:void 0,isOneOf:!0}});return[...r,...o]}var _e=q(he(),1),Ld=t=>t.type==="checkbox",ec=t=>t instanceof Date,qn=t=>t==null,TB=t=>typeof t=="object",_t=t=>!qn(t)&&!Array.isArray(t)&&TB(t)&&!ec(t),$$=t=>_t(t)&&t.target?Ld(t.target)?t.target.checked:t.target.value:t,W$=t=>t.substring(0,t.search(/\.\d+(\.|$)/))||t,G$=(t,e)=>t.has(W$(e)),K$=t=>{let e=t.constructor&&t.constructor.prototype;return _t(e)&&e.hasOwnProperty("isPrototypeOf")},wR=typeof window<"u"&&typeof window.HTMLElement<"u"&&typeof document<"u";function Qt(t){let e,n=Array.isArray(t);if(t instanceof Date)e=new Date(t);else if(t instanceof Set)e=new Set(t);else if(!(wR&&(t instanceof Blob||t instanceof FileList))&&(n||_t(t)))if(e=n?[]:{},!n&&!K$(t))e=t;else for(let r in t)t.hasOwnProperty(r)&&(e[r]=Qt(t[r]));else return t;return e}var nc=t=>Array.isArray(t)?t.filter(Boolean):[],ot=t=>t===void 0,ie=(t,e,n)=>{if(!e||!_t(t))return n;let r=nc(e.split(/[,[\].]+?/)).reduce((o,i)=>qn(o)?o:o[i],t);return ot(r)||r===t?ot(t[e])?n:t[e]:r},bi=t=>typeof t=="boolean",xB={BLUR:"blur",FOCUS_OUT:"focusout",CHANGE:"change"},qr={onBlur:"onBlur",onChange:"onChange",onSubmit:"onSubmit",onTouched:"onTouched",all:"all"},ki={max:"max",min:"min",maxLength:"maxLength",minLength:"minLength",pattern:"pattern",required:"required",validate:"validate"},Y$=_e.default.createContext(null),PB=()=>_e.default.useContext(Y$);var X$=(t,e,n,r=!0)=>{let o={defaultValues:e._defaultValues};for(let i in t)Object.defineProperty(o,i,{get:()=>{let s=i;return e._proxyFormState[s]!==qr.all&&(e._proxyFormState[s]=!r||qr.all),n&&(n[s]=!0),t[s]}});return o},gr=t=>_t(t)&&!Object.keys(t).length,Q$=(t,e,n,r)=>{n(t);let{name:o,...i}=t;return gr(i)||Object.keys(i).length>=Object.keys(e).length||Object.keys(i).find(s=>e[s]===(!r||qr.all))},yr=t=>Array.isArray(t)?t:[t],Z$=(t,e,n)=>!t||!e||t===e||yr(t).some(r=>r&&(n?r===e:r.startsWith(e)||e.startsWith(r)));function xR(t){let e=_e.default.useRef(t);e.current=t,_e.default.useEffect(()=>{let n=!t.disabled&&e.current.subject&&e.current.subject.subscribe({next:e.current.next});return()=>{n&&n.unsubscribe()}},[t.disabled])}var Do=t=>typeof t=="string",OB=(t,e,n,r,o)=>Do(t)?(r&&e.watch.add(t),ie(n,t,o)):Array.isArray(t)?t.map(i=>(r&&e.watch.add(i),ie(n,i))):(r&&(e.watchAll=!0),n);function $v(t){let e=PB(),{control:n=e.control,name:r,defaultValue:o,disabled:i,exact:s}=t||{},a=_e.default.useRef(r);a.current=r,xR({disabled:i,subject:n._subjects.values,next:c=>{Z$(a.current,c.name,s)&&u(Qt(OB(a.current,n._names,c.values||n._formValues,!1,o)))}});let[l,u]=_e.default.useState(n._getWatch(r,o));return _e.default.useEffect(()=>n._removeUnmounted()),l}var SR=t=>/^\w*$/.test(t),NB=t=>nc(t.replace(/["|']|\]/g,"").split(/\.|\[/)),rt=(t,e,n)=>{let r=-1,o=SR(e)?[e]:NB(e),i=o.length,s=i-1;for(;++re?{...n[t],types:{...n[t]&&n[t].types?n[t].types:{},[r]:o||!0}}:{},Rs=()=>{let t=typeof performance>"u"?Date.now():performance.now()*1e3;return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let n=(Math.random()*16+t)%16|0;return(e=="x"?n:n&3|8).toString(16)})},oR=(t,e,n={})=>n.shouldFocus||ot(n.shouldFocus)?n.focusName||`${t}.${ot(n.focusIndex)?e:n.focusIndex}.`:"",gR=t=>({isOnSubmit:!t||t===qr.onSubmit,isOnBlur:t===qr.onBlur,isOnChange:t===qr.onChange,isOnAll:t===qr.all,isOnTouch:t===qr.onTouched}),yR=(t,e,n)=>!n&&(e.watchAll||e.watch.has(t)||[...e.watch].some(r=>t.startsWith(r)&&/^\.\w+/.test(t.slice(r.length)))),tc=(t,e,n,r)=>{for(let o of n||Object.keys(t)){let i=ie(t,o);if(i){let{_f:s,...a}=i;if(s){if(s.refs&&s.refs[0]&&e(s.refs[0],o)&&!r)break;if(s.ref&&e(s.ref,s.name)&&!r)break;tc(a,e)}else _t(a)&&tc(a,e)}}},MB=(t,e,n)=>{let r=nc(ie(t,n));return rt(r,"root",e[n]),rt(t,n,r),t},kR=t=>t.type==="file",Cs=t=>typeof t=="function",Vv=t=>{if(!wR)return!1;let e=t?t.ownerDocument:0;return t instanceof(e&&e.defaultView?e.defaultView.HTMLElement:HTMLElement)},zv=t=>Do(t),bR=t=>t.type==="radio",qv=t=>t instanceof RegExp,SB={value:!1,isValid:!1},kB={value:!0,isValid:!0},IB=t=>{if(Array.isArray(t)){if(t.length>1){let e=t.filter(n=>n&&n.checked&&!n.disabled).map(n=>n.value);return{value:e,isValid:!!e.length}}return t[0].checked&&!t[0].disabled?t[0].attributes&&!ot(t[0].attributes.value)?ot(t[0].value)||t[0].value===""?kB:{value:t[0].value,isValid:!0}:kB:SB}return SB},bB={isValid:!1,value:null},AB=t=>Array.isArray(t)?t.reduce((e,n)=>n&&n.checked&&!n.disabled?{isValid:!0,value:n.value}:e,bB):bB;function EB(t,e,n="validate"){if(zv(t)||Array.isArray(t)&&t.every(zv)||bi(t)&&!t)return{type:n,message:zv(t)?t:"",ref:e}}var Zu=t=>_t(t)&&!qv(t)?t:{value:t,message:""},vR=async(t,e,n,r,o)=>{let{ref:i,refs:s,required:a,maxLength:l,minLength:u,min:c,max:f,pattern:d,validate:p,name:m,valueAsNumber:y,mount:w,disabled:g}=t._f,v=ie(e,m);if(!w||g)return{};let k=s?s[0]:i,S=L=>{r&&k.reportValidity&&(k.setCustomValidity(bi(L)?"":L||""),k.reportValidity())},b={},x=bR(i),R=Ld(i),E=x||R,O=(y||kR(i))&&ot(i.value)&&ot(v)||Vv(i)&&i.value===""||v===""||Array.isArray(v)&&!v.length,I=eW.bind(null,m,n,b),B=(L,A,U,V=ki.maxLength,Q=ki.minLength)=>{let G=L?A:U;b[m]={type:L?V:Q,message:G,ref:i,...I(L?V:Q,G)}};if(o?!Array.isArray(v)||!v.length:a&&(!E&&(O||qn(v))||bi(v)&&!v||R&&!IB(s).isValid||x&&!AB(s).isValid)){let{value:L,message:A}=zv(a)?{value:!!a,message:a}:Zu(a);if(L&&(b[m]={type:ki.required,message:A,ref:k,...I(ki.required,A)},!n))return S(A),b}if(!O&&(!qn(c)||!qn(f))){let L,A,U=Zu(f),V=Zu(c);if(!qn(v)&&!isNaN(v)){let Q=i.valueAsNumber||v&&+v;qn(U.value)||(L=Q>U.value),qn(V.value)||(A=Qnew Date(new Date().toDateString()+" "+C),te=i.type=="time",ve=i.type=="week";Do(U.value)&&v&&(L=te?G(v)>G(U.value):ve?v>U.value:Q>new Date(U.value)),Do(V.value)&&v&&(A=te?G(v)+L.value,V=!qn(A.value)&&v.length<+A.value;if((U||V)&&(B(U,L.message,A.message),!n))return S(b[m].message),b}if(d&&!O&&Do(v)){let{value:L,message:A}=Zu(d);if(qv(L)&&!v.match(L)&&(b[m]={type:ki.pattern,message:A,ref:i,...I(ki.pattern,A)},!n))return S(A),b}if(p){if(Cs(p)){let L=await p(v,e),A=EB(L,k);if(A&&(b[m]={...A,...I(ki.validate,A.message)},!n))return S(A.message),b}else if(_t(p)){let L={};for(let A in p){if(!gr(L)&&!n)break;let U=EB(await p[A](v,e),k,A);U&&(L={...U,...I(A,U.message)},S(U.message),n&&(b[m]=L))}if(!gr(L)&&(b[m]={ref:k,...L},!n))return b}}return S(!0),b},iR=(t,e)=>[...t,...yr(e)],sR=t=>Array.isArray(t)?t.map(()=>{}):void 0;function aR(t,e,n){return[...t.slice(0,e),...yr(n),...t.slice(e)]}var lR=(t,e,n)=>Array.isArray(t)?(ot(t[n])&&(t[n]=void 0),t.splice(n,0,t.splice(e,1)[0]),t):[],uR=(t,e)=>[...yr(e),...yr(t)];function tW(t,e){let n=0,r=[...t];for(let o of e)r.splice(o-n,1),n++;return nc(r).length?r:[]}var cR=(t,e)=>ot(e)?[]:tW(t,yr(e).sort((n,r)=>n-r)),fR=(t,e,n)=>{[t[e],t[n]]=[t[n],t[e]]};function nW(t,e){let n=e.slice(0,-1).length,r=0;for(;r(t[e]=n,t);function LB(t){let e=PB(),{control:n=e.control,name:r,keyName:o="id",shouldUnregister:i}=t,[s,a]=_e.default.useState(n._getFieldArray(r)),l=_e.default.useRef(n._getFieldArray(r).map(Rs)),u=_e.default.useRef(s),c=_e.default.useRef(r),f=_e.default.useRef(!1);c.current=r,u.current=s,n._names.array.add(r),t.rules&&n.register(r,t.rules),xR({next:({values:b,name:x})=>{if(x===c.current||!x){let R=ie(b,c.current);Array.isArray(R)&&(a(R),l.current=R.map(Rs))}},subject:n._subjects.array});let d=_e.default.useCallback(b=>{f.current=!0,n._updateFieldArray(r,b)},[n,r]),p=(b,x)=>{let R=yr(Qt(b)),E=iR(n._getFieldArray(r),R);n._names.focus=oR(r,E.length-1,x),l.current=iR(l.current,R.map(Rs)),d(E),a(E),n._updateFieldArray(r,E,iR,{argA:sR(b)})},m=(b,x)=>{let R=yr(Qt(b)),E=uR(n._getFieldArray(r),R);n._names.focus=oR(r,0,x),l.current=uR(l.current,R.map(Rs)),d(E),a(E),n._updateFieldArray(r,E,uR,{argA:sR(b)})},y=b=>{let x=cR(n._getFieldArray(r),b);l.current=cR(l.current,b),d(x),a(x),n._updateFieldArray(r,x,cR,{argA:b})},w=(b,x,R)=>{let E=yr(Qt(x)),O=aR(n._getFieldArray(r),b,E);n._names.focus=oR(r,b,R),l.current=aR(l.current,b,E.map(Rs)),d(O),a(O),n._updateFieldArray(r,O,aR,{argA:b,argB:sR(x)})},g=(b,x)=>{let R=n._getFieldArray(r);fR(R,b,x),fR(l.current,b,x),d(R),a(R),n._updateFieldArray(r,R,fR,{argA:b,argB:x},!1)},v=(b,x)=>{let R=n._getFieldArray(r);lR(R,b,x),lR(l.current,b,x),d(R),a(R),n._updateFieldArray(r,R,lR,{argA:b,argB:x},!1)},k=(b,x)=>{let R=Qt(x),E=RB(n._getFieldArray(r),b,R);l.current=[...E].map((O,I)=>!O||I===b?Rs():l.current[I]),d(E),a([...E]),n._updateFieldArray(r,E,RB,{argA:b,argB:R},!0,!1)},S=b=>{let x=yr(Qt(b));l.current=x.map(Rs),d([...x]),a([...x]),n._updateFieldArray(r,[...x],R=>R,{},!0,!1)};return _e.default.useEffect(()=>{if(n._state.action=!1,yR(r,n._names)&&n._subjects.state.next({...n._formState}),f.current&&(!gR(n._options.mode).isOnSubmit||n._formState.isSubmitted))if(n._options.resolver)n._executeSchema([r]).then(b=>{let x=ie(b.errors,r),R=ie(n._formState.errors,r);(R?!x&&R.type||x&&(R.type!==x.type||R.message!==x.message):x&&x.type)&&(x?rt(n._formState.errors,r,x):Xt(n._formState.errors,r),n._subjects.state.next({errors:n._formState.errors}))});else{let b=ie(n._fields,r);b&&b._f&&vR(b,n._formValues,n._options.criteriaMode===qr.all,n._options.shouldUseNativeValidation,!0).then(x=>!gr(x)&&n._subjects.state.next({errors:MB(n._formState.errors,x,r)}))}n._subjects.values.next({name:r,values:{...n._formValues}}),n._names.focus&&tc(n._fields,(b,x)=>{if(n._names.focus&&x.startsWith(n._names.focus)&&b.focus)return b.focus(),1}),n._names.focus="",n._updateValid(),f.current=!1},[s,r,n]),_e.default.useEffect(()=>(!ie(n._formValues,r)&&n._updateFieldArray(r),()=>{(n._options.shouldUnregister||i)&&n.unregister(r)}),[r,n,o,i]),{swap:_e.default.useCallback(g,[d,r,n]),move:_e.default.useCallback(v,[d,r,n]),prepend:_e.default.useCallback(m,[d,r,n]),append:_e.default.useCallback(p,[d,r,n]),remove:_e.default.useCallback(y,[d,r,n]),insert:_e.default.useCallback(w,[d,r,n]),update:_e.default.useCallback(k,[d,r,n]),replace:_e.default.useCallback(S,[d,r,n]),fields:_e.default.useMemo(()=>s.map((b,x)=>({...b,[o]:l.current[x]||Rs()})),[s,o])}}var dR=()=>{let t=[];return{get observers(){return t},next:o=>{for(let i of t)i.next&&i.next(o)},subscribe:o=>(t.push(o),{unsubscribe:()=>{t=t.filter(i=>i!==o)}}),unsubscribe:()=>{t=[]}}},jv=t=>qn(t)||!TB(t);function ja(t,e){if(jv(t)||jv(e))return t===e;if(ec(t)&&ec(e))return t.getTime()===e.getTime();let n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(let o of n){let i=t[o];if(!r.includes(o))return!1;if(o!=="ref"){let s=e[o];if(ec(i)&&ec(s)||_t(i)&&_t(s)||Array.isArray(i)&&Array.isArray(s)?!ja(i,s):i!==s)return!1}}return!0}var DB=t=>t.type==="select-multiple",oW=t=>bR(t)||Ld(t),pR=t=>Vv(t)&&t.isConnected,FB=t=>{for(let e in t)if(Cs(t[e]))return!0;return!1};function Hv(t,e={}){let n=Array.isArray(t);if(_t(t)||n)for(let r in t)Array.isArray(t[r])||_t(t[r])&&!FB(t[r])?(e[r]=Array.isArray(t[r])?[]:{},Hv(t[r],e[r])):qn(t[r])||(e[r]=!0);return e}function BB(t,e,n){let r=Array.isArray(t);if(_t(t)||r)for(let o in t)Array.isArray(t[o])||_t(t[o])&&!FB(t[o])?ot(e)||jv(n[o])?n[o]=Array.isArray(t[o])?Hv(t[o],[]):{...Hv(t[o])}:BB(t[o],qn(e)?{}:e[o],n[o]):n[o]=!ja(t[o],e[o]);return n}var mR=(t,e)=>BB(t,e,Hv(e)),JB=(t,{valueAsNumber:e,valueAsDate:n,setValueAs:r})=>ot(t)?t:e?t===""?NaN:t&&+t:n&&Do(t)?new Date(t):r?r(t):t;function hR(t){let e=t.ref;if(!(t.refs?t.refs.every(n=>n.disabled):e.disabled))return kR(e)?e.files:bR(e)?AB(t.refs).value:DB(e)?[...e.selectedOptions].map(({value:n})=>n):Ld(e)?IB(t.refs).value:JB(ot(e.value)?t.ref.value:e.value,t)}var iW=(t,e,n,r)=>{let o={};for(let i of t){let s=ie(e,i);s&&rt(o,i,s._f)}return{criteriaMode:n,names:[...t],fields:o,shouldUseNativeValidation:r}},Ad=t=>ot(t)?t:qv(t)?t.source:_t(t)?qv(t.value)?t.value.source:t.value:t,sW=t=>t.mount&&(t.required||t.min||t.max||t.maxLength||t.minLength||t.pattern||t.validate);function CB(t,e,n){let r=ie(t,n);if(r||SR(n))return{error:r,name:n};let o=n.split(".");for(;o.length;){let i=o.join("."),s=ie(e,i),a=ie(t,i);if(s&&!Array.isArray(s)&&n!==i)return{name:n};if(a&&a.type)return{name:i,error:a};o.pop()}return{name:n}}var aW=(t,e,n,r,o)=>o.isOnAll?!1:!n&&o.isOnTouch?!(e||t):(n?r.isOnBlur:o.isOnBlur)?!t:(n?r.isOnChange:o.isOnChange)?t:!0,lW=(t,e)=>!nc(ie(t,e)).length&&Xt(t,e),uW={mode:qr.onSubmit,reValidateMode:qr.onChange,shouldFocusError:!0};function cW(t={},e){let n={...uW,...t},r={submitCount:0,isDirty:!1,isLoading:Cs(n.defaultValues),isValidating:!1,isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,touchedFields:{},dirtyFields:{},errors:n.errors||{},disabled:n.disabled||!1},o={},i=_t(n.defaultValues)||_t(n.values)?Qt(n.defaultValues||n.values)||{}:{},s=n.shouldUnregister?{}:Qt(i),a={action:!1,mount:!1,watch:!1},l={mount:new Set,unMount:new Set,array:new Set,watch:new Set},u,c=0,f={isDirty:!1,dirtyFields:!1,touchedFields:!1,isValidating:!1,isValid:!1,errors:!1},d={values:dR(),array:dR(),state:dR()},p=gR(n.mode),m=gR(n.reValidateMode),y=n.criteriaMode===qr.all,w=P=>D=>{clearTimeout(c),c=setTimeout(P,D)},g=async P=>{if(f.isValid||P){let D=n.resolver?gr((await O()).errors):await B(o,!0);D!==r.isValid&&d.state.next({isValid:D})}},v=P=>f.isValidating&&d.state.next({isValidating:P}),k=(P,D=[],_,Z,Y=!0,W=!0)=>{if(Z&&_){if(a.action=!0,W&&Array.isArray(ie(o,P))){let ue=_(ie(o,P),Z.argA,Z.argB);Y&&rt(o,P,ue)}if(W&&Array.isArray(ie(r.errors,P))){let ue=_(ie(r.errors,P),Z.argA,Z.argB);Y&&rt(r.errors,P,ue),lW(r.errors,P)}if(f.touchedFields&&W&&Array.isArray(ie(r.touchedFields,P))){let ue=_(ie(r.touchedFields,P),Z.argA,Z.argB);Y&&rt(r.touchedFields,P,ue)}f.dirtyFields&&(r.dirtyFields=mR(i,s)),d.state.next({name:P,isDirty:A(P,D),dirtyFields:r.dirtyFields,errors:r.errors,isValid:r.isValid})}else rt(s,P,D)},S=(P,D)=>{rt(r.errors,P,D),d.state.next({errors:r.errors})},b=P=>{r.errors=P,d.state.next({errors:r.errors,isValid:!1})},x=(P,D,_,Z)=>{let Y=ie(o,P);if(Y){let W=ie(s,P,ot(_)?ie(i,P):_);ot(W)||Z&&Z.defaultChecked||D?rt(s,P,D?W:hR(Y._f)):Q(P,W),a.mount&&g()}},R=(P,D,_,Z,Y)=>{let W=!1,ue=!1,De={name:P},F=!!(ie(o,P)&&ie(o,P)._f.disabled);if(!_||Z){f.isDirty&&(ue=r.isDirty,r.isDirty=De.isDirty=A(),W=ue!==De.isDirty);let j=F||ja(ie(i,P),D);ue=!!(!F&&ie(r.dirtyFields,P)),j||F?Xt(r.dirtyFields,P):rt(r.dirtyFields,P,!0),De.dirtyFields=r.dirtyFields,W=W||f.dirtyFields&&ue!==!j}if(_){let j=ie(r.touchedFields,P);j||(rt(r.touchedFields,P,_),De.touchedFields=r.touchedFields,W=W||f.touchedFields&&j!==_)}return W&&Y&&d.state.next(De),W?De:{}},E=(P,D,_,Z)=>{let Y=ie(r.errors,P),W=f.isValid&&bi(D)&&r.isValid!==D;if(t.delayError&&_?(u=w(()=>S(P,_)),u(t.delayError)):(clearTimeout(c),u=null,_?rt(r.errors,P,_):Xt(r.errors,P)),(_?!ja(Y,_):Y)||!gr(Z)||W){let ue={...Z,...W&&bi(D)?{isValid:D}:{},errors:r.errors,name:P};r={...r,...ue},d.state.next(ue)}v(!1)},O=async P=>n.resolver(s,n.context,iW(P||l.mount,o,n.criteriaMode,n.shouldUseNativeValidation)),I=async P=>{let{errors:D}=await O(P);if(P)for(let _ of P){let Z=ie(D,_);Z?rt(r.errors,_,Z):Xt(r.errors,_)}else r.errors=D;return D},B=async(P,D,_={valid:!0})=>{for(let Z in P){let Y=P[Z];if(Y){let{_f:W,...ue}=Y;if(W){let De=l.array.has(W.name),F=await vR(Y,s,y,n.shouldUseNativeValidation&&!D,De);if(F[W.name]&&(_.valid=!1,D))break;!D&&(ie(F,W.name)?De?MB(r.errors,F,W.name):rt(r.errors,W.name,F[W.name]):Xt(r.errors,W.name))}ue&&await B(ue,D,_)}}return _.valid},L=()=>{for(let P of l.unMount){let D=ie(o,P);D&&(D._f.refs?D._f.refs.every(_=>!pR(_)):!pR(D._f.ref))&&dn(P)}l.unMount=new Set},A=(P,D)=>(P&&D&&rt(s,P,D),!ja(ct(),i)),U=(P,D,_)=>OB(P,l,{...a.mount?s:ot(D)?i:Do(P)?{[P]:D}:D},_,D),V=P=>nc(ie(a.mount?s:i,P,t.shouldUnregister?ie(i,P,[]):[])),Q=(P,D,_={})=>{let Z=ie(o,P),Y=D;if(Z){let W=Z._f;W&&(!W.disabled&&rt(s,P,JB(D,W)),Y=Vv(W.ref)&&qn(D)?"":D,DB(W.ref)?[...W.ref.options].forEach(ue=>ue.selected=Y.includes(ue.value)):W.refs?Ld(W.ref)?W.refs.length>1?W.refs.forEach(ue=>(!ue.defaultChecked||!ue.disabled)&&(ue.checked=Array.isArray(Y)?!!Y.find(De=>De===ue.value):Y===ue.value)):W.refs[0]&&(W.refs[0].checked=!!Y):W.refs.forEach(ue=>ue.checked=ue.value===Y):kR(W.ref)?W.ref.value="":(W.ref.value=Y,W.ref.type||d.values.next({name:P,values:{...s}})))}(_.shouldDirty||_.shouldTouch)&&R(P,Y,_.shouldTouch,_.shouldDirty,!0),_.shouldValidate&&it(P)},G=(P,D,_)=>{for(let Z in D){let Y=D[Z],W=`${P}.${Z}`,ue=ie(o,W);(l.array.has(P)||!jv(Y)||ue&&!ue._f)&&!ec(Y)?G(W,Y,_):Q(W,Y,_)}},te=(P,D,_={})=>{let Z=ie(o,P),Y=l.array.has(P),W=Qt(D);rt(s,P,W),Y?(d.array.next({name:P,values:{...s}}),(f.isDirty||f.dirtyFields)&&_.shouldDirty&&d.state.next({name:P,dirtyFields:mR(i,s),isDirty:A(P,W)})):Z&&!Z._f&&!qn(W)?G(P,W,_):Q(P,W,_),yR(P,l)&&d.state.next({...r}),d.values.next({name:P,values:{...s}}),!a.mount&&e()},ve=async P=>{let D=P.target,_=D.name,Z=!0,Y=ie(o,_),W=()=>D.type?hR(Y._f):$$(P),ue=De=>{Z=Number.isNaN(De)||De===ie(s,_,De)};if(Y){let De,F,j=W(),ce=P.type===xB.BLUR||P.type===xB.FOCUS_OUT,ze=!sW(Y._f)&&!n.resolver&&!ie(r.errors,_)&&!Y._f.deps||aW(ce,ie(r.touchedFields,_),r.isSubmitted,m,p),Fe=yR(_,l,ce);rt(s,_,j),ce?(Y._f.onBlur&&Y._f.onBlur(P),u&&u(0)):Y._f.onChange&&Y._f.onChange(P);let Zt=R(_,j,ce,!1),vr=!gr(Zt)||Fe;if(!ce&&d.values.next({name:_,type:P.type,values:{...s}}),ze)return f.isValid&&g(),vr&&d.state.next({name:_,...Fe?{}:Zt});if(!ce&&Fe&&d.state.next({...r}),v(!0),n.resolver){let{errors:J}=await O([_]);if(ue(j),Z){let ne=CB(r.errors,o,_),fe=CB(J,o,ne.name||_);De=fe.error,_=fe.name,F=gr(J)}}else De=(await vR(Y,s,y,n.shouldUseNativeValidation))[_],ue(j),Z&&(De?F=!1:f.isValid&&(F=await B(o,!0)));Z&&(Y._f.deps&&it(Y._f.deps),E(_,F,De,Zt))}},C=(P,D)=>{if(ie(r.errors,D)&&P.focus)return P.focus(),1},it=async(P,D={})=>{let _,Z,Y=yr(P);if(v(!0),n.resolver){let W=await I(ot(P)?P:Y);_=gr(W),Z=P?!Y.some(ue=>ie(W,ue)):_}else P?(Z=(await Promise.all(Y.map(async W=>{let ue=ie(o,W);return await B(ue&&ue._f?{[W]:ue}:ue)}))).every(Boolean),!(!Z&&!r.isValid)&&g()):Z=_=await B(o);return d.state.next({...!Do(P)||f.isValid&&_!==r.isValid?{}:{name:P},...n.resolver||!P?{isValid:_}:{},errors:r.errors,isValidating:!1}),D.shouldFocus&&!Z&&tc(o,C,P?Y:l.mount),Z},ct=P=>{let D={...i,...a.mount?s:{}};return ot(P)?D:Do(P)?ie(D,P):P.map(_=>ie(D,_))},T=(P,D)=>({invalid:!!ie((D||r).errors,P),isDirty:!!ie((D||r).dirtyFields,P),isTouched:!!ie((D||r).touchedFields,P),error:ie((D||r).errors,P)}),Qe=P=>{P&&yr(P).forEach(D=>Xt(r.errors,D)),d.state.next({errors:P?r.errors:{}})},St=(P,D,_)=>{let Z=(ie(o,P,{_f:{}})._f||{}).ref;rt(r.errors,P,{...D,ref:Z}),d.state.next({name:P,errors:r.errors,isValid:!1}),_&&_.shouldFocus&&Z&&Z.focus&&Z.focus()},Tn=(P,D)=>Cs(P)?d.values.subscribe({next:_=>P(U(void 0,D),_)}):U(P,D,!0),dn=(P,D={})=>{for(let _ of P?yr(P):l.mount)l.mount.delete(_),l.array.delete(_),D.keepValue||(Xt(o,_),Xt(s,_)),!D.keepError&&Xt(r.errors,_),!D.keepDirty&&Xt(r.dirtyFields,_),!D.keepTouched&&Xt(r.touchedFields,_),!n.shouldUnregister&&!D.keepDefaultValue&&Xt(i,_);d.values.next({values:{...s}}),d.state.next({...r,...D.keepDirty?{isDirty:A()}:{}}),!D.keepIsValid&&g()},Ve=({disabled:P,name:D,field:_,fields:Z,value:Y})=>{if(bi(P)){let W=P?void 0:ot(Y)?hR(_?_._f:ie(Z,D)._f):Y;rt(s,D,W),R(D,W,!1,!1,!0)}},pn=(P,D={})=>{let _=ie(o,P),Z=bi(D.disabled);return rt(o,P,{..._||{},_f:{..._&&_._f?_._f:{ref:{name:P}},name:P,mount:!0,...D}}),l.mount.add(P),_?Ve({field:_,disabled:D.disabled,name:P,value:D.value}):x(P,!0,D.value),{...Z?{disabled:D.disabled}:{},...n.progressive?{required:!!D.required,min:Ad(D.min),max:Ad(D.max),minLength:Ad(D.minLength),maxLength:Ad(D.maxLength),pattern:Ad(D.pattern)}:{},name:P,onChange:ve,onBlur:ve,ref:Y=>{if(Y){pn(P,D),_=ie(o,P);let W=ot(Y.value)&&Y.querySelectorAll&&Y.querySelectorAll("input,select,textarea")[0]||Y,ue=oW(W),De=_._f.refs||[];if(ue?De.find(F=>F===W):W===_._f.ref)return;rt(o,P,{_f:{..._._f,...ue?{refs:[...De.filter(pR),W,...Array.isArray(ie(i,P))?[{}]:[]],ref:{type:W.type,name:P}}:{ref:W}}}),x(P,!1,void 0,W)}else _=ie(o,P,{}),_._f&&(_._f.mount=!1),(n.shouldUnregister||D.shouldUnregister)&&!(G$(l.array,P)&&a.action)&&l.unMount.add(P)}}},kt=()=>n.shouldFocusError&&tc(o,C,l.mount),Pn=P=>{bi(P)&&(d.state.next({disabled:P}),tc(o,(D,_)=>{let Z=P,Y=ie(o,_);Y&&bi(Y._f.disabled)&&(Z||(Z=Y._f.disabled)),D.disabled=Z},0,!1))},On=(P,D)=>async _=>{_&&(_.preventDefault&&_.preventDefault(),_.persist&&_.persist());let Z=Qt(s);if(d.state.next({isSubmitting:!0}),n.resolver){let{errors:Y,values:W}=await O();r.errors=Y,Z=W}else await B(o);Xt(r.errors,"root"),gr(r.errors)?(d.state.next({errors:{}}),await P(Z,_)):(D&&await D({...r.errors},_),kt(),setTimeout(kt)),d.state.next({isSubmitted:!0,isSubmitting:!1,isSubmitSuccessful:gr(r.errors),submitCount:r.submitCount+1,errors:r.errors})},Hr=(P,D={})=>{ie(o,P)&&(ot(D.defaultValue)?te(P,Qt(ie(i,P))):(te(P,D.defaultValue),rt(i,P,Qt(D.defaultValue))),D.keepTouched||Xt(r.touchedFields,P),D.keepDirty||(Xt(r.dirtyFields,P),r.isDirty=D.defaultValue?A(P,Qt(ie(i,P))):A()),D.keepError||(Xt(r.errors,P),f.isValid&&g()),d.state.next({...r}))},Jo=(P,D={})=>{let _=P?Qt(P):i,Z=Qt(_),Y=P&&!gr(P)?Z:i;if(D.keepDefaultValues||(i=_),!D.keepValues){if(D.keepDirtyValues)for(let W of l.mount)ie(r.dirtyFields,W)?rt(Y,W,ie(s,W)):te(W,ie(Y,W));else{if(wR&&ot(P))for(let W of l.mount){let ue=ie(o,W);if(ue&&ue._f){let De=Array.isArray(ue._f.refs)?ue._f.refs[0]:ue._f.ref;if(Vv(De)){let F=De.closest("form");if(F){F.reset();break}}}}o={}}s=t.shouldUnregister?D.keepDefaultValues?Qt(i):{}:Qt(Y),d.array.next({values:{...Y}}),d.values.next({values:{...Y}})}l={mount:new Set,unMount:new Set,array:new Set,watch:new Set,watchAll:!1,focus:""},!a.mount&&e(),a.mount=!f.isValid||!!D.keepIsValid,a.watch=!!t.shouldUnregister,d.state.next({submitCount:D.keepSubmitCount?r.submitCount:0,isDirty:D.keepDirty?r.isDirty:!!(D.keepDefaultValues&&!ja(P,i)),isSubmitted:D.keepIsSubmitted?r.isSubmitted:!1,dirtyFields:D.keepDirtyValues?r.dirtyFields:D.keepDefaultValues&&P?mR(i,P):{},touchedFields:D.keepTouched?r.touchedFields:{},errors:D.keepErrors?r.errors:{},isSubmitSuccessful:D.keepIsSubmitSuccessful?r.isSubmitSuccessful:!1,isSubmitting:!1})},Uo=(P,D)=>Jo(Cs(P)?P(s):P,D);return{control:{register:pn,unregister:dn,getFieldState:T,handleSubmit:On,setError:St,_executeSchema:O,_getWatch:U,_getDirty:A,_updateValid:g,_removeUnmounted:L,_updateFieldArray:k,_updateDisabledField:Ve,_getFieldArray:V,_reset:Jo,_resetDefaultValues:()=>Cs(n.defaultValues)&&n.defaultValues().then(P=>{Uo(P,n.resetOptions),d.state.next({isLoading:!1})}),_updateFormState:P=>{r={...r,...P}},_disableForm:Pn,_subjects:d,_proxyFormState:f,_setErrors:b,get _fields(){return o},get _formValues(){return s},get _state(){return a},set _state(P){a=P},get _defaultValues(){return i},get _names(){return l},set _names(P){l=P},get _formState(){return r},set _formState(P){r=P},get _options(){return n},set _options(P){n={...n,...P}}},trigger:it,register:pn,handleSubmit:On,watch:Tn,setValue:te,getValues:ct,reset:Uo,resetField:Hr,clearErrors:Qe,unregister:dn,setError:St,setFocus:(P,D={})=>{let _=ie(o,P),Z=_&&_._f;if(Z){let Y=Z.refs?Z.refs[0]:Z.ref;Y.focus&&(Y.focus(),D.shouldSelect&&Y.select())}},getFieldState:T}}function rc(t={}){let e=_e.default.useRef(),n=_e.default.useRef(),[r,o]=_e.default.useState({isDirty:!1,isValidating:!1,isLoading:Cs(t.defaultValues),isSubmitted:!1,isSubmitting:!1,isSubmitSuccessful:!1,isValid:!1,submitCount:0,dirtyFields:{},touchedFields:{},errors:t.errors||{},disabled:t.disabled||!1,defaultValues:Cs(t.defaultValues)?void 0:t.defaultValues});e.current||(e.current={...cW(t,()=>o(s=>({...s}))),formState:r});let i=e.current.control;return i._options=t,xR({subject:i._subjects.state,next:s=>{Q$(s,i._proxyFormState,i._updateFormState,!0)&&o({...i._formState})}}),_e.default.useEffect(()=>i._disableForm(t.disabled),[i,t.disabled]),_e.default.useEffect(()=>{if(i._proxyFormState.isDirty){let s=i._getDirty();s!==r.isDirty&&i._subjects.state.next({isDirty:s})}},[i,r.isDirty]),_e.default.useEffect(()=>{t.values&&!ja(t.values,n.current)?(i._reset(t.values,i._options.resetOptions),n.current=t.values,o(s=>({...s}))):i._resetDefaultValues()},[t.values,i]),_e.default.useEffect(()=>{t.errors&&i._setErrors(t.errors)},[t.errors,i]),_e.default.useEffect(()=>{i._state.mount||(i._updateValid(),i._state.mount=!0),i._state.watch&&(i._state.watch=!1,i._subjects.state.next({...i._formState})),i._removeUnmounted()}),e.current.formState=X$(r,i),e.current}var de=q(me(),1),oc=qt(void 0);oc.debugLabel="formControlAtom";var UB=qt(void 0);UB.debugLabel="formTypesAtom";var Wv=()=>{let[t,e]=Et(UB),n=async()=>{let o=await mt.types({});e(o)};return{fields:(0,Ha.useMemo)(()=>{if(!(!t||!t.content?.msg))return _v(t.content,t.content.msg)},[t]),loadFormTypes:n}},Gv=({fields:t})=>{let[e]=Et(oc);if(e===void 0)return null;let n=["data"];return(0,de.jsx)("div",{className:"grpc-request-form",children:(0,de.jsx)("table",{children:(0,de.jsx)("tbody",{children:t.map(r=>(0,de.jsxs)("tr",{className:"message_field",children:[(0,de.jsxs)("td",{className:"name",children:[(0,de.jsx)("strong",{children:r.name}),(0,de.jsx)("br",{}),r.fieldType]}),(0,de.jsx)("td",{children:(0,de.jsx)("div",{className:"input_container two-of-2 three-of-3 two-of-4 one-of-5",children:(0,de.jsx)("div",{className:"field-content",children:(0,de.jsx)(Kv,{fc:e,field:r,path:[...n,r.name]})})})})]},r.name))})})})},Kv=({fc:t,path:e,field:n})=>{switch(n.type){case"repeated":return(0,de.jsx)(fW,{fc:t,field:n,path:e});case"msg":return(0,de.jsx)(dW,{fc:t,field:n,path:e});case"map":return(0,de.jsx)(_B,{fc:t,field:n,path:e});case"group":return(0,de.jsx)(zB,{fc:t,field:n,path:e})}},fW=({fc:t,path:e,field:n})=>{let{control:r}=t,o=n.repeatedField,{fields:i,append:s,remove:a}=LB({control:r,name:e.join(".")});return(0,de.jsx)("table",{children:(0,de.jsxs)("tbody",{children:[i.map((l,u)=>{let c=e.concat(u.toString());return(0,de.jsx)("tr",{className:"array_element",children:(0,de.jsxs)("td",{children:[(0,de.jsx)(Kv,{fc:t,field:o,path:c}),(0,de.jsx)("button",{className:"btn btn-error",onClick:()=>a(u),children:"Remove"})]})},c.join("."))}),(0,de.jsx)("tr",{children:(0,de.jsx)("td",{children:(0,de.jsx)("button",{onClick:()=>s(wB(o)),children:"New"})})})]})})},dW=({field:t,path:e,fc:n})=>{let{control:r,register:o}=n,i=e.join("."),a=$v({control:r,name:i,defaultValue:""})||"";switch(t.field.type){case lt.STRING:return(0,de.jsx)("input",{type:"text",className:"input input-bordered",value:a,...o(i)});case lt.BOOL:return(0,de.jsx)("input",{type:"checkbox",checked:a,...o(i)});case lt.INT32:return(0,de.jsx)("input",{type:"number",className:"input input-bordered",value:a,...o(i)});default:return(0,de.jsx)("input",{type:"text",className:"input input-bordered",value:a,...o(i)})}},_B=({fc:t,path:e,field:n})=>{let[r,o]=(0,Ha.useState)(void 0),{resetField:i,setValue:s}=t,a=e.join("."),l=$v({control:t.control,name:a})||{};return(0,de.jsx)("table",{children:(0,de.jsxs)("tbody",{children:[Object.keys(l).filter(u=>l[u]!==void 0).map((u,c)=>{let f=e.concat(u);return(0,de.jsx)("tr",{className:"array_element",children:(0,de.jsxs)("td",{children:[(0,de.jsx)("button",{className:"btn btn-error",onClick:()=>{s(f.join("."),void 0)},children:"remove"}),(0,de.jsxs)("div",{className:"map_key",children:[(0,de.jsx)("input",{type:"text",className:"input input-bordered",value:r?.prev===u?r.new:u,onChange:d=>{o({prev:u,new:d.target.value})}}),r?.prev===u&&(0,de.jsx)("button",{className:"btn btn-sm",onClick:()=>{r?.prev===u&&(i(f.join(".")),o(void 0),s(e.concat(r?.new).join("."),l))},children:"save"})]}),u!==""&&(0,de.jsx)("div",{className:"map_value",children:(0,de.jsx)(Kv,{fc:t,field:n.value,path:f})})]})},e.concat(u.toString()).join("."))}),(0,de.jsx)("tr",{children:(0,de.jsx)("td",{children:(0,de.jsx)("button",{onClick:()=>{s(e.concat("key").join("."),{})},children:"New"})})})]})})},zB=({field:t,path:e,fc:n})=>{let{resetField:r}=n,[o,i]=(0,Ha.useState)([]),s=u=>{t.children.forEach(c=>{r([...e,c.name].join("."))})},a=u=>{t.isOneOf?(i([u]),s(u)):o.some(c=>c===u)?i(c=>c.filter(f=>f!==u)):i(c=>[...c,u])},l=u=>o.some(c=>c===u);return(0,de.jsx)("div",{className:"oneof",children:(0,de.jsx)("table",{children:(0,de.jsx)("tbody",{children:t.children.map(u=>{let c=t.isOneOf?[...e.slice(0,-1),u.name]:[...e,u.name];return(0,de.jsx)(pW,{onSelect:a,isOneOf:t.isOneOf,checked:l(u.name),path:c,field:u,fc:n},c.join("."))})})})})},pW=({field:t,path:e,isOneOf:n,checked:r,onSelect:o,fc:i})=>{let s=e.join("."),a=$v({control:i.control,name:s});return(0,Ha.useEffect)(()=>{!r&&a!==void 0&&o(t.name)},[a]),(0,de.jsxs)("tr",{children:[(0,de.jsxs)("td",{className:"name",children:[(0,de.jsx)("strong",{children:t.name}),(0,de.jsx)("br",{}),t.fieldType]}),(0,de.jsx)("td",{children:(0,de.jsx)("input",{type:n?"radio":"checkbox",checked:r,onChange:()=>o(t.name)})}),(0,de.jsx)("td",{children:r?(0,de.jsx)(Kv,{field:t,fc:i,path:e}):"unset"})]})};function $a(t){if(typeof t!="object"||t===null)return t;if(Array.isArray(t))return t.map(n=>$a(n)).filter(n=>!(typeof n=="object"&&!Array.isArray(n)&&Object.keys(n).length===0));let e={};for(let[n,r]of Object.entries(t)){let o=$a(r);o===""||o===void 0||typeof o=="object"&&!Array.isArray(o)&&Object.keys(o).length===0||(e[n]=o)}return e}var Yv=q(he(),1);var Ei=q(me(),1),VB=({id:t,file:e,onChange:n})=>{let[r,o]=(0,Yv.useState)([]);return(0,Yv.useEffect)(()=>{(async()=>(await mt.search({contentID:t})).storedContent.forEach(s=>{s.related.forEach(a=>{switch(a.type.case){case"normalized":let l=a.type.value;switch(l.type.case){case"transcript":console.log(l),o([...r,l.type.value.segments.map(u=>u.text).join(" ")]);break}}})}))()},[]),(0,Ei.jsxs)(Ei.Fragment,{children:[(0,Ei.jsx)("h5",{children:e.file}),(0,Ei.jsx)("audio",{src:e.url,controls:!0}),(0,Ei.jsx)("ul",{children:r.map(i=>(0,Ei.jsx)("li",{children:i},i))})]})};var Xv=q(he(),1);var Fo=q(he(),1);var yt=q(me(),1);function mW(t){if(t?.type.case==="post")return{id:t.id,tags:t.tags,post:t.type.value}}var qB=({section:t,onUpdate:e,onDelete:n})=>{let[r,o]=(0,Fo.useState)([]),[i,s]=(0,Fo.useState)(void 0),[a,l]=(0,Fo.useState)(void 0),[u,c]=(0,Fo.useState)(t.tags),[f,d]=(0,Fo.useState)(!1),[p,m]=(0,Fo.useState)(t.menu?.name??""),y=rc();(0,Fo.useEffect)(()=>{o([]),m(t.menu?.name??""),c(t.tags)},[t]),(0,Fo.useEffect)(()=>{w(u)},[u]);let w=async b=>{try{let x=await mt.search({tags:b});o(x.storedContent.map(R=>mW(R.content)).filter(qa))}catch(x){console.error(x),je.error("Failed to get posts")}},g=(b,x)=>{x&&b&&s(b),x||s(void 0)},v=async b=>{c(b),e(new ai({...t,tags:b}))},k=b=>{l(b)};return(0,yt.jsxs)("div",{className:"space-y-3",children:[(0,yt.jsx)("input",{type:"text",placeholder:"name",className:"input w-full max-w-xs",value:p,onChange:b=>{m(b.target.value),e(new ai({...t,menu:new ta({...t.menu,name:b.target.value})}))}}),(0,yt.jsxs)("div",{className:"flex flex-row space-x-2",children:[(0,yt.jsx)(Hu,{onNewTag:b=>{v([...u,b])}}),(0,yt.jsx)("button",{className:"btn",onClick:()=>{d(!f)},children:f?(0,yt.jsx)(N1,{className:"h-5 w-5"}):(0,yt.jsx)(M1,{className:"h-5 w-5"})}),(0,yt.jsx)("button",{className:"btn",onClick:n,children:(0,yt.jsx)(yd,{className:"h-5 w-5"})})]}),u.map(b=>(0,yt.jsx)("span",{className:"badge badge-outline badge-sm",onClick:()=>{v(u.filter(x=>x!==b))},children:b},b)),f&&(0,yt.jsxs)("table",{className:"table w-full",children:[(0,yt.jsx)("thead",{children:(0,yt.jsxs)("tr",{children:[(0,yt.jsx)("th",{children:"title"}),(0,yt.jsx)("th",{children:"tags"})]})}),(0,yt.jsx)("tbody",{children:r.filter(qa).map((b,x)=>(0,yt.jsxs)("tr",{children:[(0,yt.jsx)("td",{children:b.post.title}),(0,yt.jsx)("td",{children:(0,yt.jsx)("div",{className:"flex gap-3",children:b.tags.map(R=>(0,yt.jsx)("span",{className:"badge badge-outline badge-sm",children:R},R))})})]},x))})]})]})};var jr=q(me(),1),jB=({site:t,onUpdate:e})=>{let[n,r]=(0,Xv.useState)(void 0),o=()=>{e(new ns({...t,sections:t.sections.filter((i,s)=>s!==n)}))};return(0,Xv.useEffect)(()=>{t.sections.length===0&&e(new ns({...t,sections:[new ai({})]})),t.sections.length>0&&n===void 0&&r(0)},[t]),(0,jr.jsxs)(jr.Fragment,{children:[(0,jr.jsx)("div",{className:"text-gray-600 px-3 py-2",children:(0,jr.jsxs)("h4",{className:"text-lg font-semibold",children:["site: ",t.hugoConfig?.title||"untitled"]})}),(0,jr.jsx)("button",{className:"btn",onClick:()=>{e(new ns({...t,sections:[...t.sections,new ai({})]}))},children:(0,jr.jsx)(gd,{className:"h-6 w-6"})}),(0,jr.jsx)("div",{className:"tabs tabs-bordered my-6",children:t.sections.map((i,s)=>(0,jr.jsx)("a",{className:`tab ${s===n?"tab-active":""}`,onClick:()=>r(s),children:i.menu?.name||"untitled"},s))}),n!==void 0&&(0,jr.jsx)(qB,{section:t.sections[n],onUpdate:i=>{e(new ns({...t,sections:t.sections.map((s,a)=>a===n?i:s)}))},onDelete:o})]})};var Dd=q(he(),1);var Bo=q(me(),1),HB=({conversation:t,onUpdate:e,className:n})=>{let[r,o]=(0,Dd.useState)([]),[i,s]=(0,Dd.useState)([]),a=Object.keys(t.mapping).find(c=>!t.mapping[c].parent),l=(c,f)=>{let d=c;for(;d&&t.mapping[d].children.length>0;)f.push(d),d=t.mapping[d].children[0];d&&f.push(d),s(f)};(0,Dd.useEffect)(()=>{a!==void 0&&l(a,[])},[t]);let u=(c,f)=>{l(c,i.slice(0,f))};return(0,Bo.jsx)("div",{className:"flex flex-col gap-2",children:i.map((c,f)=>{let d=t.mapping[c];if(!d)return console.warn(`Node ${c} not found in conversation mapping`),null;let p=r.includes(c),m=d.message?.author,y=t.mapping[d.parent??""],w=y?y.children:[],g=d.message?.content?.textParts.join(" ");return g===void 0||g===""?(console.log("skipping node",c,d.message?.content),null):(0,Bo.jsxs)("div",{children:[(0,Bo.jsxs)("div",{className:`chat ${m?.role!=="user"?"chat-start":"chat-end"}`,children:[(0,Bo.jsx)("div",{className:"chat-header",children:m?.role}),(0,Bo.jsx)("div",{className:`chat-bubble overflow-x-auto ${p?"max-h-32 overflow-hidden":""}`,onClick:()=>{},children:(0,Bo.jsx)(Xu,{className:p?"clamp":"",children:g})})]}),m?.role==="user"&&w.length>1&&(0,Bo.jsx)("div",{className:"flex gap-2 mt-2",children:w.map(v=>(0,Bo.jsx)("button",{className:`max-w-sm text-ellipsis px-2 py-1 text-sm rounded ${v===c?"bg-blue-500 text-white":"bg-gray-200"}`,onClick:()=>u(v,f),children:t.mapping[v].message?.content?.textParts.join(" ")},v))})]},d.id)})})};var hW=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))$/,gW=/(?:^|\s)((?:\*\*)((?:[^*]+))(?:\*\*))/g,yW=/(?:^|\s)((?:__)((?:[^__]+))(?:__))$/,vW=/(?:^|\s)((?:__)((?:[^__]+))(?:__))/g,$B=dr.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:t=>t.style.fontWeight!=="normal"&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}]},renderHTML({HTMLAttributes:t}){return["strong",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[To({find:hW,type:this.type}),To({find:yW,type:this.type})]},addPasteRules(){return[Lr({find:gW,type:this.type}),Lr({find:vW,type:this.type})]}});var wW=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))$/,xW=/(?:^|\s)((?:\*)((?:[^*]+))(?:\*))/g,SW=/(?:^|\s)((?:_)((?:[^_]+))(?:_))$/,kW=/(?:^|\s)((?:_)((?:[^_]+))(?:_))/g,WB=dr.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:t=>t.style.fontStyle!=="normal"&&null},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:t}){return["em",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[To({find:wW,type:this.type}),To({find:SW,type:this.type})]},addPasteRules(){return[Lr({find:xW,type:this.type}),Lr({find:kW,type:this.type})]}});var bW=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,EW=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,GB=dr.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>t.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:t}){return["s",Wt(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){let t={};return ry()?t["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():t["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),t},addInputRules(){return[To({find:bW,type:this.type})]},addPasteRules(){return[Lr({find:EW,type:this.type})]}});var Le=q(me(),1),KB=()=>{let{selected:t,setTypes:e,setTags:n,tags:r}=ia(),o=i=>async()=>{e(s=>s.includes(i)?s.filter(a=>a!==i):[...s,i])};return(0,Le.jsxs)("div",{className:"drawer z-50",children:[(0,Le.jsx)("input",{id:"my-drawer",type:"checkbox",className:"drawer-toggle"}),(0,Le.jsx)("div",{className:"drawer-content",children:(0,Le.jsx)("label",{htmlFor:"my-drawer",className:"drawer-button",children:(0,Le.jsx)(O1,{className:"h-6 w-6"})})}),(0,Le.jsxs)("div",{className:"drawer-side",children:[(0,Le.jsx)("label",{htmlFor:"my-drawer","aria-label":"close sidebar",className:"drawer-overlay"}),t&&(0,Le.jsxs)("div",{className:"flex flex-col p-4 w-80 min-h-full bg-base-200 text-base-content",children:[(0,Le.jsxs)("div",{className:"flex flex-row space-y-2",children:[(0,Le.jsx)("div",{children:(0,Le.jsxs)("details",{className:"dropdown",children:[(0,Le.jsx)("summary",{className:"btn",children:"type"}),(0,Le.jsxs)("ul",{className:"p-2 shadow menu dropdown-content z-[1] bg-base-100 rounded-box w-52",children:[(0,Le.jsx)("li",{onClick:o("site"),children:"site"}),(0,Le.jsx)("li",{onClick:o("post"),children:"post"})]})]})}),(0,Le.jsx)(Hu,{onNewTag:i=>{n(s=>s.includes(i)?s:[...s,i])}}),r.map(i=>(0,Le.jsx)("span",{className:"badge badge-outline badge-sm",onClick:()=>{n(s=>s.filter(a=>a!==i))},children:i},i))]}),(0,Le.jsx)("div",{className:"overflow-x-auto",children:(0,Le.jsx)(RW,{displayContent:t.displayContent})})]})]})]})},RW=({displayContent:t})=>{let{selectedContent:e,selectContent:n}=sa(),{getSources:r}=ia(),o=(a,l)=>{l&&a&&n(a),l||n(void 0)},i=async()=>{if(e)try{let a=await mt.delete({contentIds:[e.id]});r(),je.success("Deleted content")}catch(a){je.error("Failed to delete content"),console.error("failed to delete",a)}},s=e?[t.find(a=>a.content?.id===e.id),...t.filter(a=>a.content?.id!==e.id)]:t;return(0,Le.jsxs)("table",{className:"table w-full",children:[(0,Le.jsx)("thead",{children:(0,Le.jsxs)("tr",{children:[(0,Le.jsx)("th",{children:e&&(0,Le.jsx)(yd,{onClick:i,className:"h-5 w-5"})}),(0,Le.jsx)("th",{children:"title"}),(0,Le.jsx)("th",{children:"tags"})]})}),(0,Le.jsx)("tbody",{children:s.filter(qa).map((a,l)=>(0,Le.jsxs)("tr",{children:[(0,Le.jsx)("td",{children:(0,Le.jsx)("input",{type:"checkbox",className:"checkbox checkbox-accent",checked:e?.id===a.content?.id,onChange:u=>o(a.content,u.target.checked)})}),(0,Le.jsx)("td",{children:a.title}),(0,Le.jsx)("td",{children:(0,Le.jsx)("div",{className:"gap-3",children:a.content?.tags.map(u=>(0,Le.jsx)("span",{className:"badge badge-outline badge-sm",children:u},u))})})]},l))})]})};function YB(){return new Ge({tags:[],type:{case:"site",value:{sections:[]}}})}function XB(t){return new Ge({tags:[],type:{case:"post",value:new Pf({content:t})}})}function CW(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var e=Math.random()*16|0,n=t==="x"?e:e&3|8;return n.toString(16)})}function QB(t,e){return new Ge({id:CW(),tags:e,type:{case:"data",value:new na({type:{case:"url",value:{url:t}}})}})}var Se=q(me(),1),ZB=({})=>{let t=(0,Ts.useRef)(null),{editedContent:e,editContent:n,selectedContent:r,newContent:o,setNewContent:i,changeContent:s}=sa(),{getSources:a}=ia(),[l,u]=Et(oc),{fields:c,loadFormTypes:f}=Wv(),d=rc(),{setValue:p}=d,m=(0,Ts.useRef)(void 0);(0,Ts.useEffect)(()=>(f(),u(d),()=>{m.current&&m.current.abort()}),[]),(0,Ts.useEffect)(()=>{e&&p("data",e.toJson())},[e]),(0,Ts.useEffect)(()=>{v&&v.commands.setContent(ER(e)),i(!1)},[o]),(0,Ts.useEffect)(()=>{r&&(p("data",r.toJson()),v&&v.commands.setContent(ER(r)),n(r))},[r]);let y=async R=>{e&&n(new Ge({...e,tags:[...e.tags,R]}))},w=async R=>{e&&n(new Ge({...e,tags:e.tags.filter(E=>E!==R)}))},g=async R=>{m.current&&m.current.abort();let E=new AbortController;m.current=E;try{let O=mt.infer({prompt:R},{timeoutMs:void 0,signal:E.signal});for await(let I of O)v?.chain().focus().insertContent(I.text||"").run()}catch(O){je.error(O.message),console.log(O)}finally{m.current=void 0}},v=vD({extensions:[TD,CD,RD,bD,ED,qD,$B,WB,GB,gB.configure({depth:100})],onUpdate:({editor:R})=>{if(localStorage.setItem("editorContent",R.getHTML()),e)switch(e.type.case){case"post":e.type.value.content=R?.getHTML()||"",n(new Ge({...e,type:{case:"post",value:e.type.value}}));break}},content:ER(e),editorProps:{handleKeyDown:(R,E)=>E.key==="Tab"?(E.preventDefault(),v===null?!1:(E.preventDefault(),E.shiftKey?v.chain().focus().liftListItem("listItem").run():v.chain().focus().sinkListItem("listItem").run(),!0)):!1}}),k=()=>{if(!l)return;let R=$a(l.getValues().data);try{return Ge.fromJson(R)}catch(E){return console.error("failed to parse content",E,"data",$a(R)),e}},S=async()=>{try{let R=await mt.save({content:k(),related:[]});a(),je.success("Saved content")}catch(R){je.error("Failed to save content"),console.error("failed to save",R)}},b=()=>{m.current?.abort()},x=()=>{v&&v.commands.setContent("")};return(0,Se.jsxs)("div",{className:"sm:mx-4 lg:mx-16",children:[(0,Se.jsxs)("div",{className:"mb-16 flex flex-col",children:[(0,Se.jsxs)("div",{className:"flex flex-row justify-between",children:[(0,Se.jsx)("span",{children:e?.tags.map(R=>(0,Se.jsx)("span",{className:"badge badge-outline badge-sm",onClick:()=>w(R),children:R},R))}),(0,Se.jsx)("button",{onClick:()=>t.current?.showModal(),children:(0,Se.jsx)(P1,{className:"h-6 w-6"})})]}),v&&(0,Se.jsx)(TW,{content:e,onUpdate:n,editor:v}),v&&(0,Se.jsx)(xD,{editor:v,tippyOptions:{duration:100},children:(0,Se.jsx)("button",{onClick:()=>{let{view:R,state:E}=v,{from:O,to:I}=R.state.selection,B=E.doc.textBetween(O,I,"");v.commands.setTextSelection({from:I,to:I}),v.commands.enter(),B&&g(B)},className:"btn "+v.isActive("bold")?"is-active":"",children:"ai"})}),(0,Se.jsx)("dialog",{id:"my_modal_1",className:"modal",ref:t,children:(0,Se.jsxs)("div",{className:"modal-box",children:[c&&(0,Se.jsx)(Gv,{fields:c}),(0,Se.jsx)("form",{method:"dialog",children:(0,Se.jsx)("div",{className:"modal-action",children:(0,Se.jsx)("button",{className:"btn",onClick:()=>{n(k())},children:"save"})})})]})})]}),(0,Se.jsxs)("div",{className:"btm-nav",children:[(0,Se.jsx)(KB,{}),(0,Se.jsxs)("details",{className:"dropdown dropdown-top flex",children:[(0,Se.jsx)("summary",{tabIndex:0,className:"btn",children:(0,Se.jsx)(gd,{className:"h-6 w-6"})}),(0,Se.jsxs)("ul",{tabIndex:0,className:"dropdown-content z-50 menu p-2 shadow bg-base-100 rounded-box w-52",children:[(0,Se.jsx)("li",{onClick:()=>{s(QB("https://example.com",[]))},children:(0,Se.jsx)("a",{children:"url"})}),(0,Se.jsx)("li",{onClick:()=>{console.log("hello"),s(XB("Don't think, write."))},children:(0,Se.jsx)("a",{children:"post"})}),(0,Se.jsx)("li",{onClick:()=>{s(YB())},children:(0,Se.jsx)("a",{children:"site"})})]})]}),(0,Se.jsx)(Hu,{onNewTag:y}),m.current&&(0,Se.jsx)("button",{onClick:b,children:(0,Se.jsx)(L1,{className:"h-6 w-6"})}),(0,Se.jsx)("button",{onClick:S,children:(0,Se.jsx)(A1,{className:"h-6 w-6"})})]})]})};var TW=({content:t,editor:e,onUpdate:n})=>(0,Se.jsx)("div",{children:(o=>{if(o)switch(o.type.case){case"chatgptConversation":return(0,Se.jsx)(HB,{className:"space-y-2",conversation:o.type.value,onUpdate:a=>{n(new Ge({...o,type:{case:"chatgptConversation",value:a}}))}});case"site":return(0,Se.jsx)(jB,{site:o.type.value,onUpdate:a=>{n(new Ge({...o,type:{case:"site",value:a}}))}});case"post":let i=o.type.value;return(0,Se.jsxs)("div",{className:"space-y-2",children:[(0,Se.jsx)("input",{type:"text",value:i.title,onChange:a=>{n(new Ge({...o,type:{case:"post",value:{...i,title:a.target.value}}}))},placeholder:"title",className:"input w-full max-w-xs"}),(0,Se.jsx)(T1,{editor:e})]});case"data":let s=o.type.value;switch(s.type.case){case"file":return(0,Se.jsx)(VB,{id:o.id,file:s.type.value,onChange:l=>{n(new Ge({...o,type:{case:"data",value:{...o.type.value,type:{case:"file",value:l}}}}))}});case"url":let a=s.type.value;return(0,Se.jsx)(cB,{id:o.id,url:a.url,onChange:l=>{n(new Ge({...o,type:{case:"data",value:{...o.type.value,type:{case:"url",value:{...a,url:l}}}}}))}})}}return(0,Se.jsx)(T1,{editor:e})})(t)}),ER=t=>{let e="don't think, write.";if(!t)return e;switch(t.type.case){case"post":return t.type.value.content;case"data":let n=t.type.value;switch(n.type.case){case"text":return n.type.value.data.toString()}break}return e};var Fd=q(he(),1);var t3=q(me(),1),e3=({children:t})=>{let[e,n]=(0,Fd.useState)(!1),r=(0,Fd.useCallback)(async s=>{s.preventDefault(),n(!1);let a=s.dataTransfer.files[0];if(a){let l=new FileReader;l.onload=u=>{try{let c=u.target.result;if(c){let f=new Uint8Array(c),d=mt.save({content:{type:{case:"data",value:new na({type:{case:"file",value:new Of({file:a.name,data:f})}})}}},{timeoutMs:void 0})}}catch(c){console.error(c)}},l.readAsArrayBuffer(a)}},[]),o=s=>{s.preventDefault(),n(!1)},i=(0,Fd.useCallback)(s=>{s.preventDefault(),n(!0)},[]);return(0,t3.jsx)("div",{onDrop:r,onDragOver:i,onDragLeave:o,style:{border:e?"2px dashed #cccccc":""},children:t})};var Cn=q(me(),1),n3=()=>{let{sources:t,types:e,setSelected:n,getSources:r,tags:o}=ia(),{editContent:i}=sa(),{id:s}=Zs(),{logout:a}=bo();(0,RR.useEffect)(()=>{r()},[e,o]),(0,RR.useEffect)(()=>{s&&(async()=>{try{let c=await mt.search({contentID:s});if(c.storedContent.length===0)return;i(c.storedContent[0].content||void 0)}catch(c){console.error("failed to get sources",c)}})()},[s]);let l=c=>{n(c)},u=async()=>{try{let c=await mt.publish({});je.success("Published content")}catch(c){je.error("Failed to publish content"),console.error("failed to publish",c)}};return t?(0,Cn.jsxs)("div",{className:"p-5 h-[95vh] flex flex-col",children:[(0,Cn.jsxs)("div",{className:"navbar bg-base-100",children:[(0,Cn.jsx)("div",{className:"flex-1",children:(0,Cn.jsx)("p",{className:"text-xl",children:"just share."})}),(0,Cn.jsx)("div",{className:"flex-none",children:(0,Cn.jsxs)("ul",{className:"menu menu-horizontal px-1",children:[(0,Cn.jsx)("li",{children:(0,Cn.jsx)("a",{onClick:u,children:"publish"})}),(0,Cn.jsx)("li",{children:(0,Cn.jsx)("a",{onClick:a,children:"logout"})})]})})]}),(0,Cn.jsx)("div",{className:"flex-grow",children:(0,Cn.jsx)(e3,{children:(0,Cn.jsx)(ZB,{})})})]}):(0,Cn.jsx)("div",{className:"loading loading-lg"})};var r3=q(he(),1),Qv=q(me(),1);function ic(){let{user:t,tryLogin:e}=bo();return(0,r3.useEffect)(()=>{e()},[]),(0,Qv.jsx)("div",{className:"h-screen flex flex-col gap-4 w-full",children:t?(0,Qv.jsx)(n3,{}):(0,Qv.jsx)(rs,{allowRegister:!0})})}var co=q(me(),1),o3=()=>{let{setCurrentGroup:t,user:e}=GM(),[n,r]=(0,Bd.useState)(!1),[o,i]=(0,Bd.useState)(void 0),{secret:s}=Zs();(0,Bd.useEffect)(()=>{(async()=>{let c=await ko.groupInfo({secret:s});i(c.name)})()},[s]);let a=async()=>{try{let c=await ko.joinGroup({secret:s});je.success("Joined group"),r(!0),t(c.id)}catch(c){console.error(c),je.error("Failed to join group")}};return n?(0,co.jsx)(ic,{}):(0,co.jsxs)("div",{className:"flex flex-col gap-5 h-screen w-screen justify-center items-center",children:[o?(0,co.jsxs)("h3",{children:["Want to join ",o,"?"]}):(0,co.jsx)("span",{className:"loading loading-spinner"}),e?(0,co.jsx)("button",{className:"btn",onClick:a,children:"Join Group"}):(0,co.jsx)(co.Fragment,{children:(0,co.jsx)(rs,{allowRegister:!0})})]})};var l3=q(he(),1);var PW=qt([]),i3=()=>{let[t,e]=Et(PW);return{messages:t,setMessages:e,getMessages:()=>{let r=new AbortController;return(async()=>{try{let o=gg.receiveMessages({},{signal:r.signal});for await(let i of o)e(s=>[i,...s]),console.log(t)}catch(o){console.log(o),je.error("Failed to receive messages")}})(),()=>{r.abort()}}}};var sc=q(he(),1);function s3(t){return new Date(Number(t)*1e3).toLocaleString()}var Ke=q(me(),1),a3=()=>{let{user:t,logout:e}=bo(),{messages:n,getMessages:r}=i3(),[o,i]=(0,sc.useState)("");(0,sc.useEffect)(r,[]);let s=sc.default.useRef(null),a=()=>{s.current&&s.current.showModal()},l=async()=>{let u=await gg.sendMessage({message:o});i("")};return(0,Ke.jsxs)("div",{className:"bg-opacity-0",children:[(0,Ke.jsxs)("div",{className:"flex flex-row gap-2",children:[t?(0,Ke.jsx)("button",{className:"btn",onClick:e,children:"logout"}):(0,Ke.jsx)("button",{className:"btn",onClick:a,children:"login"}),(0,Ke.jsx)("dialog",{className:"modal",ref:s,children:(0,Ke.jsxs)("div",{className:"modal-box",children:[(0,Ke.jsx)(rs,{allowRegister:!0,next:"/app/chat"}),(0,Ke.jsx)("div",{className:"modal-action",children:(0,Ke.jsx)("form",{method:"dialog",children:(0,Ke.jsx)("button",{className:"btn",children:"Close"})})})]})}),(0,Ke.jsxs)("a",{className:"btn",href:"https://paypal.me/ineedafix",children:["donate",(0,Ke.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",children:(0,Ke.jsx)("path",{"stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",d:"M4.318 6.318a4.5 4.5 0 000 6.364L12 20.364l7.682-7.682a4.5 4.5 0 00-6.364-6.364L12 7.636l-1.318-1.318a4.5 4.5 0 00-6.364 0z"})})]}),(0,Ke.jsxs)("a",{className:"btn",href:"https://github.com/lunabrain-ai/lunabrain",children:["code",(0,Ke.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 24 24","stroke-width":"1.5",stroke:"currentColor",className:"w-6 h-6",children:(0,Ke.jsx)("path",{"stroke-linecap":"round","stroke-linejoin":"round",d:"M17.25 6.75 22.5 12l-5.25 5.25m-10.5 0L1.5 12l5.25-5.25m7.5-3-4.5 16.5"})})]})]}),(0,Ke.jsxs)("div",{className:"flex flex-row gap-2",children:[(0,Ke.jsx)("input",{type:"text",placeholder:"Type here",value:o,onKeyDown:u=>{u.key==="Enter"&&l()},onChange:u=>i(u.target.value),className:"input input-bordered w-full max-w-xs"}),(0,Ke.jsx)("button",{className:"btn",onClick:l,children:"Send"})]}),(0,Ke.jsx)("div",{className:"w-full",children:n.map((u,c)=>(0,Ke.jsxs)("div",{className:"chat chat-start",children:[(0,Ke.jsxs)("div",{className:"chat-header",children:[(0,Ke.jsx)("span",{className:"mx-1",children:u.user}),(0,Ke.jsx)("time",{className:"text-xs opacity-50",children:s3(u.timestamp)})]}),(0,Ke.jsx)("div",{className:"chat-bubble",children:u.text})]},c))})]})};var CR=q(me(),1),u3=()=>{let{user:t,tryLogin:e}=bo();return(0,l3.useEffect)(()=>{e()},[]),(0,CR.jsx)("div",{className:"h-screen flex flex-col gap-4 w-full",children:(0,CR.jsx)(a3,{})})};var Zv=q(he(),1);var ac=q(me(),1),c3=()=>{let[t,e]=(0,Zv.useState)(!1),{secret:n}=Zs(),r=async()=>{try{let o=await ko.verifyUser({secret:n});je.success("Joined group"),e(!0)}catch(o){console.error(o),je.error("Failed to join group")}};return(0,Zv.useEffect)(()=>{r()},[]),t?(0,ac.jsx)(rs,{}):(0,ac.jsxs)("div",{className:"flex flex-col gap-5 h-screen w-screen justify-center items-center",children:[(0,ac.jsx)("h3",{children:"Verifying..."}),(0,ac.jsx)("span",{className:"loading loading-spinner"})]})};var e0=q(he(),1);var Pt=q(me(),1),f3=["ui"],d3=()=>{let[t,e]=e0.default.useState(f3[0]);return(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsxs)("div",{className:"navbar bg-base-100",children:[(0,Pt.jsx)("div",{className:"flex-1",children:(0,Pt.jsx)("a",{className:"btn btn-ghost text-xl",children:"admin"})}),(0,Pt.jsx)("div",{className:"flex-none",children:(0,Pt.jsx)("ul",{className:"menu menu-horizontal px-1",children:f3.map(n=>(0,Pt.jsx)("li",{children:(0,Pt.jsx)("a",{className:`btn btn-ghost ${n===t?"btn-active":""}`,onClick:()=>e(n),children:n})},n))})})]}),(0,Pt.jsx)(OW,{tab:t})]})},OW=({tab:t})=>{switch(t){case"ui":return(0,Pt.jsx)(NW,{})}},NW=()=>(0,Pt.jsx)("div",{className:"container mx-auto",children:(0,Pt.jsx)(Lm,{children:(0,Pt.jsx)(MW,{})})}),MW=()=>{let[t,e]=Et(oc),{fields:n,loadFormTypes:r}=Wv(),o=rc();return(0,e0.useEffect)(()=>{r(),e(o)},[]),n===void 0?null:(0,Pt.jsxs)(Pt.Fragment,{children:[(0,Pt.jsx)(Gv,{fields:n}),(0,Pt.jsx)("button",{className:"btn btn-primary",onClick:()=>{let i=$a(t?.getValues().data);console.log(Ge.fromJson(i))},children:"submit"})]})};var fn=q(me(),1),IW=()=>{let e=uS([...[{path:"/app",element:(0,fn.jsx)(ic,{})},{path:"/app/group/:groupID",element:(0,fn.jsx)(ic,{})},{path:"/app/group/join/:secret",element:(0,fn.jsx)(o3,{})},{path:"/app/chat",element:(0,fn.jsx)(u3,{})},{path:"/app/verify/:secret",element:(0,fn.jsx)(c3,{})},{path:"/app/content/:id",element:(0,fn.jsx)(ic,{})},{path:"/app/admin",element:(0,fn.jsx)(d3,{})}]]);return(0,fn.jsx)(fn.Fragment,{children:e})},p3=({dev:t})=>(0,fn.jsx)(Nm,{FallbackComponent:IN,children:(0,fn.jsxs)(Lm,{children:[(0,fn.jsx)(TN,{children:(0,fn.jsx)(IW,{})}),(0,fn.jsx)(pN,{})]})});var TR=q(me(),1);window.React=PR.default;var h3=!1;h3&&new EventSource("/esbuild").addEventListener("change",()=>location.reload());var AW=m3.default.createRoot(document.getElementById("root"));AW.render((0,TR.jsx)(PR.default.StrictMode,{children:(0,TR.jsx)(p3,{dev:h3})}));})(); /*! Bundled license information: react/cjs/react.production.min.js: diff --git a/js/dist/site/index.js.map b/js/dist/site/index.js.map index 9591df4..1688b8f 100644 --- a/js/dist/site/index.js.map +++ b/js/dist/site/index.js.map @@ -1,7 +1,7 @@ { "version": 3, - "sources": ["../../../node_modules/react/cjs/react.production.min.js", "../../../node_modules/react/index.js", "../../../node_modules/react-dom/node_modules/scheduler/cjs/scheduler.production.min.js", "../../../node_modules/react-dom/node_modules/scheduler/index.js", "../../../node_modules/react-dom/cjs/react-dom.production.min.js", "../../../node_modules/react-dom/index.js", "../../../node_modules/react-dom/client.js", "../../../node_modules/source-map/lib/base64.js", "../../../node_modules/source-map/lib/base64-vlq.js", "../../../node_modules/source-map/lib/util.js", "../../../node_modules/source-map/lib/array-set.js", "../../../node_modules/source-map/lib/mapping-list.js", "../../../node_modules/source-map/lib/source-map-generator.js", "../../../node_modules/source-map/lib/binary-search.js", "../../../node_modules/source-map/lib/quick-sort.js", "../../../node_modules/source-map/lib/source-map-consumer.js", "../../../node_modules/source-map/lib/source-node.js", "../../../node_modules/source-map/source-map.js", "node-modules-polyfills:path", "node-modules-polyfills-commonjs:path", "node-modules-polyfills:fs", "node-modules-polyfills-commonjs:fs", "../../../node_modules/buffer-from/index.js", "../../../node_modules/source-map-support/source-map-support.js", "../../../node_modules/react/cjs/react-jsx-runtime.production.min.js", "../../../node_modules/react/jsx-runtime.js", "../../../node_modules/is-buffer/index.js", "../../../node_modules/extend/index.js", "../../../node_modules/prop-types/lib/ReactPropTypesSecret.js", "../../../node_modules/prop-types/factoryWithThrowingShims.js", "../../../node_modules/prop-types/index.js", "../../../node_modules/react-is/cjs/react-is.production.min.js", "../../../node_modules/react-is/index.js", "../../../node_modules/inline-style-parser/index.js", "../../../node_modules/style-to-object/index.js", "../../site/index.tsx", "../../../node_modules/source-map-support/register.js", "../../../node_modules/react-hot-toast/src/core/types.ts", "../../../node_modules/react-hot-toast/src/core/utils.ts", "../../../node_modules/react-hot-toast/src/core/store.ts", "../../../node_modules/react-hot-toast/src/core/toast.ts", "../../../node_modules/react-hot-toast/src/core/use-toaster.ts", "../../../node_modules/react-hot-toast/src/components/toast-bar.tsx", "../../../node_modules/react-hot-toast/src/components/toast-icon.tsx", "../../../node_modules/react-hot-toast/src/components/error.tsx", "../../../node_modules/react-hot-toast/src/components/loader.tsx", "../../../node_modules/react-hot-toast/src/components/checkmark.tsx", "../../../node_modules/react-hot-toast/src/components/toaster.tsx", "../../../node_modules/react-hot-toast/src/index.ts", "../../../node_modules/goober/dist/goober.modern.js", "../../../node_modules/@remix-run/router/history.ts", "../../../node_modules/@remix-run/router/utils.ts", "../../../node_modules/@remix-run/router/router.ts", "../../../node_modules/react-router/lib/context.ts", "../../../node_modules/react-router/lib/hooks.tsx", "../../../node_modules/react-router/lib/components.tsx", "../../../node_modules/react-router/index.ts", "../../../node_modules/react-router-dom/dom.ts", "../../../node_modules/react-router-dom/index.tsx", "../../../node_modules/react-error-boundary/dist/react-error-boundary.esm.js", "../../site/react/FallbackError.tsx", "../../site/auth/JoinGroupPage.tsx", "../../site/auth/AuthForm.tsx", "../../../node_modules/jotai/esm/vanilla.mjs", "../../../node_modules/jotai/esm/react.mjs", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/assert.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/enum.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/message.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/message-type.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/proto-runtime.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/field.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/google/varint.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/proto-int64.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/binary-encoding.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/field-wrapper.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/scalars.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/binary-format-common.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/binary-format-proto3.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/proto-base64.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/json-format-common.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/json-format-proto3.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/util-common.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/field-list.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/names.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/field.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/proto3.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/binary-format-proto2.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/private/json-format-proto2.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/proto2.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/service-type.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/google/protobuf/descriptor_pb.js", "../../../node_modules/@bufbuild/protobuf/dist/esm/google/protobuf/empty_pb.js", "../../rpc/user/user_pb.ts", "../../rpc/content/chatgpt/conversation_pb.ts", "../../rpc/content/browser/history_pb.ts", "../../rpc/content/blog_pb.ts", "../../rpc/content/content_pb.ts", "../../rpc/protoflow_pb.ts", "../../rpc/ai_pb.ts", "../../rpc/protoflow_connect.ts", "../../rpc/content/content_connect.ts", "../../rpc/user/user_connect.ts", "../../rpc/chat/chat_pb.ts", "../../rpc/chat/chat_connect.ts", "../../rpc/event/event_pb.ts", "../../rpc/event/event_connect.ts", "../../../node_modules/@connectrpc/connect/dist/esm/code.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/code-string.js", "../../../node_modules/@connectrpc/connect/dist/esm/connect-error.js", "../../../node_modules/@connectrpc/connect/dist/esm/http-headers.js", "../../../node_modules/@connectrpc/connect/dist/esm/any-client.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/envelope.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/async-iterable.js", "../../../node_modules/@connectrpc/connect/dist/esm/promise-client.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/signals.js", "../../../node_modules/@connectrpc/connect/dist/esm/context-values.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/create-method-url.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/normalize.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/serialization.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/content-type.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/error-json.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/end-stream.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/headers.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/http-status.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/trailer-mux.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/version.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/request-header.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/validate-response.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol-connect/get-request.js", "../../../node_modules/@connectrpc/connect/dist/esm/protocol/run-call.js", "../../../node_modules/@connectrpc/connect-web/dist/esm/assert-fetch-api.js", "../../../node_modules/@connectrpc/connect-web/dist/esm/connect-transport.js", "../../site/service.ts", "../../site/auth/state.ts", "../../site/react/ProjectProvider.tsx", "../../site/source/SourcePage.tsx", "../../site/source/state.ts", "../../site/source/ContentCard.tsx", "../../../node_modules/@heroicons/react/24/outline/esm/AdjustmentsHorizontalIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/HashtagIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassMinusIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/MagnifyingGlassIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/MinusCircleIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/PaperAirplaneIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/PlusIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/StopIcon.js", "../../../node_modules/@heroicons/react/24/outline/esm/TrashIcon.js", "../../site/util/predicates.ts", "../../site/source/ContentEditor.tsx", "../../../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-view/dist/index.js", "../../../node_modules/w3c-keyname/index.js", "../../../node_modules/prosemirror-keymap/dist/index.js", "../../../node_modules/prosemirror-commands/dist/index.js", "../../../node_modules/prosemirror-schema-list/dist/index.js", "../../../node_modules/@tiptap/core/src/helpers/createChainableState.ts", "../../../node_modules/@tiptap/core/src/CommandManager.ts", "../../../node_modules/@tiptap/core/src/EventEmitter.ts", "../../../node_modules/@tiptap/core/src/helpers/getExtensionField.ts", "../../../node_modules/@tiptap/core/src/helpers/splitExtensions.ts", "../../../node_modules/@tiptap/core/src/helpers/getAttributesFromExtensions.ts", "../../../node_modules/@tiptap/core/src/helpers/getNodeType.ts", "../../../node_modules/@tiptap/core/src/utilities/mergeAttributes.ts", "../../../node_modules/@tiptap/core/src/helpers/getRenderedAttributes.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/utilities/fromString.ts", "../../../node_modules/@tiptap/core/src/helpers/injectExtensionAttributesToParseRule.ts", "../../../node_modules/@tiptap/core/src/helpers/getSchemaByResolvedExtensions.ts", "../../../node_modules/@tiptap/core/src/helpers/getSchemaTypeByName.ts", "../../../node_modules/@tiptap/core/src/helpers/isExtensionRulesEnabled.ts", "../../../node_modules/@tiptap/core/src/helpers/getTextContentFromNodes.ts", "../../../node_modules/@tiptap/core/src/utilities/isRegExp.ts", "../../../node_modules/@tiptap/core/src/InputRule.ts", "../../../node_modules/@tiptap/core/src/utilities/isNumber.ts", "../../../node_modules/@tiptap/core/src/PasteRule.ts", "../../../node_modules/@tiptap/core/src/utilities/findDuplicates.ts", "../../../node_modules/@tiptap/core/src/ExtensionManager.ts", "../../../node_modules/@tiptap/core/src/utilities/isPlainObject.ts", "../../../node_modules/@tiptap/core/src/utilities/mergeDeep.ts", "../../../node_modules/@tiptap/core/src/Extension.ts", "../../../node_modules/@tiptap/core/src/helpers/getTextBetween.ts", "../../../node_modules/@tiptap/core/src/helpers/getTextSerializersFromSchema.ts", "../../../node_modules/@tiptap/core/src/extensions/clipboardTextSerializer.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/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/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/extendMarkRange.ts", "../../../node_modules/@tiptap/core/src/commands/first.ts", "../../../node_modules/@tiptap/core/src/helpers/isTextSelection.ts", "../../../node_modules/@tiptap/core/src/utilities/minMax.ts", "../../../node_modules/@tiptap/core/src/helpers/resolveFocusPosition.ts", "../../../node_modules/@tiptap/core/src/utilities/isiOS.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/utilities/elementFromString.ts", "../../../node_modules/@tiptap/core/src/helpers/createNodeFromContent.ts", "../../../node_modules/@tiptap/core/src/helpers/selectionToInsertionEnd.ts", "../../../node_modules/@tiptap/core/src/commands/insertContentAt.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/utilities/isMacOS.ts", "../../../node_modules/@tiptap/core/src/commands/keyboardShortcut.ts", "../../../node_modules/@tiptap/core/src/helpers/isNodeActive.ts", "../../../node_modules/@tiptap/core/src/commands/lift.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/getHTMLFromFragment.ts", "../../../node_modules/@tiptap/core/src/helpers/getSchema.ts", "../../../node_modules/@tiptap/core/src/helpers/generateHTML.ts", "../../../node_modules/@tiptap/core/src/helpers/generateJSON.ts", "../../../node_modules/@tiptap/core/src/helpers/getText.ts", "../../../node_modules/@tiptap/core/src/helpers/generateText.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/getSplittedAttributes.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/isList.ts", "../../../node_modules/@tiptap/core/src/helpers/isNodeEmpty.ts", "../../../node_modules/@tiptap/core/src/helpers/isNodeSelection.ts", "../../../node_modules/@tiptap/core/src/helpers/posToDOMRect.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/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/updateAttributes.ts", "../../../node_modules/@tiptap/core/src/commands/wrapIn.ts", "../../../node_modules/@tiptap/core/src/commands/wrapInList.ts", "../../../node_modules/@tiptap/core/src/extensions/commands.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/tabindex.ts", "../../../node_modules/@tiptap/core/src/style.ts", "../../../node_modules/@tiptap/core/src/utilities/createStyleTag.ts", "../../../node_modules/@tiptap/core/src/Editor.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/Mark.ts", "../../../node_modules/@tiptap/core/src/Node.ts", "../../../node_modules/@tiptap/core/src/utilities/isAndroid.ts", "../../../node_modules/@tiptap/core/src/NodeView.ts", "../../../node_modules/@tiptap/core/src/pasteRules/markPasteRule.ts", "../../../node_modules/@tiptap/core/src/utilities/escapeForRegEx.ts", "../../../node_modules/@tiptap/core/src/utilities/isString.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/@popperjs/core/lib/enums.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getNodeName.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindow.js", "../../../node_modules/@popperjs/core/lib/dom-utils/instanceOf.js", "../../../node_modules/@popperjs/core/lib/modifiers/applyStyles.js", "../../../node_modules/@popperjs/core/lib/utils/getBasePlacement.js", "../../../node_modules/@popperjs/core/lib/utils/math.js", "../../../node_modules/@popperjs/core/lib/utils/userAgent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isLayoutViewport.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getBoundingClientRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getLayoutRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/contains.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getComputedStyle.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isTableElement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentElement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getParentNode.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getOffsetParent.js", "../../../node_modules/@popperjs/core/lib/utils/getMainAxisFromPlacement.js", "../../../node_modules/@popperjs/core/lib/utils/within.js", "../../../node_modules/@popperjs/core/lib/utils/getFreshSideObject.js", "../../../node_modules/@popperjs/core/lib/utils/mergePaddingObject.js", "../../../node_modules/@popperjs/core/lib/utils/expandToHashMap.js", "../../../node_modules/@popperjs/core/lib/modifiers/arrow.js", "../../../node_modules/@popperjs/core/lib/utils/getVariation.js", "../../../node_modules/@popperjs/core/lib/modifiers/computeStyles.js", "../../../node_modules/@popperjs/core/lib/modifiers/eventListeners.js", "../../../node_modules/@popperjs/core/lib/utils/getOppositePlacement.js", "../../../node_modules/@popperjs/core/lib/utils/getOppositeVariationPlacement.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getWindowScrollBarX.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getViewportRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getDocumentRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/isScrollParent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getScrollParent.js", "../../../node_modules/@popperjs/core/lib/dom-utils/listScrollParents.js", "../../../node_modules/@popperjs/core/lib/utils/rectToClientRect.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getClippingRect.js", "../../../node_modules/@popperjs/core/lib/utils/computeOffsets.js", "../../../node_modules/@popperjs/core/lib/utils/detectOverflow.js", "../../../node_modules/@popperjs/core/lib/utils/computeAutoPlacement.js", "../../../node_modules/@popperjs/core/lib/modifiers/flip.js", "../../../node_modules/@popperjs/core/lib/modifiers/hide.js", "../../../node_modules/@popperjs/core/lib/modifiers/offset.js", "../../../node_modules/@popperjs/core/lib/modifiers/popperOffsets.js", "../../../node_modules/@popperjs/core/lib/utils/getAltAxis.js", "../../../node_modules/@popperjs/core/lib/modifiers/preventOverflow.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getHTMLElementScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getNodeScroll.js", "../../../node_modules/@popperjs/core/lib/dom-utils/getCompositeRect.js", "../../../node_modules/@popperjs/core/lib/utils/orderModifiers.js", "../../../node_modules/@popperjs/core/lib/utils/debounce.js", "../../../node_modules/@popperjs/core/lib/utils/mergeByName.js", "../../../node_modules/@popperjs/core/lib/createPopper.js", "../../../node_modules/@popperjs/core/lib/popper.js", "../../../node_modules/tippy.js/src/constants.ts", "../../../node_modules/tippy.js/src/utils.ts", "../../../node_modules/tippy.js/src/dom-utils.ts", "../../../node_modules/tippy.js/src/bindGlobalEventListeners.ts", "../../../node_modules/tippy.js/src/browser.ts", "../../../node_modules/tippy.js/src/validation.ts", "../../../node_modules/tippy.js/src/props.ts", "../../../node_modules/tippy.js/src/template.ts", "../../../node_modules/tippy.js/src/createTippy.ts", "../../../node_modules/tippy.js/src/index.ts", "../../../node_modules/tippy.js/src/addons/createSingleton.ts", "../../../node_modules/tippy.js/src/addons/delegate.ts", "../../../node_modules/tippy.js/src/plugins/animateFill.ts", "../../../node_modules/tippy.js/src/plugins/followCursor.ts", "../../../node_modules/tippy.js/src/plugins/inlinePositioning.ts", "../../../node_modules/tippy.js/src/plugins/sticky.ts", "../../../node_modules/tippy.js/build/base.js", "../../../node_modules/@tiptap/extension-bubble-menu/src/bubble-menu-plugin.ts", "../../../node_modules/@tiptap/extension-bubble-menu/src/bubble-menu.ts", "../../../node_modules/@tiptap/react/src/EditorContent.tsx", "../../../node_modules/@tiptap/react/src/Editor.ts", "../../../node_modules/@tiptap/react/src/useEditor.ts", "../../../node_modules/@tiptap/react/src/Context.tsx", "../../../node_modules/@tiptap/react/src/BubbleMenu.tsx", "../../../node_modules/@tiptap/react/src/FloatingMenu.tsx", "../../../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/ReactRenderer.tsx", "../../../node_modules/@tiptap/react/src/ReactNodeViewRenderer.tsx", "../../../node_modules/@tiptap/extension-list-item/src/list-item.ts", "../../../node_modules/@tiptap/extension-text-style/src/text-style.ts", "../../../node_modules/@tiptap/extension-bullet-list/src/bullet-list.ts", "../../../node_modules/@tiptap/extension-list-item/src/list-item.ts", "../../../node_modules/@tiptap/extension-text/src/text.ts", "../../../node_modules/@tiptap/extension-paragraph/src/paragraph.ts", "../../../node_modules/@tiptap/extension-document/src/document.ts", "../../../node_modules/linkifyjs/dist/linkify.es.js", "../../../node_modules/@tiptap/extension-link/src/helpers/autolink.ts", "../../../node_modules/@tiptap/extension-link/src/helpers/clickHandler.ts", "../../../node_modules/@tiptap/extension-link/src/helpers/pasteHandler.ts", "../../../node_modules/@tiptap/extension-link/src/link.ts", "../../site/source/rich-text-links.ts", "../../site/tag/AddTagBadge.tsx", "../../site/tag/FilteredTagInput.tsx", "../../../node_modules/@uidotdev/usehooks/index.js", "../../site/tag/state.ts", "../../site/source/URLEditor.tsx", "../../site/components/modal.tsx", "../../../node_modules/react-markdown/lib/uri-transformer.js", "../../../node_modules/react-markdown/lib/react-markdown.js", "../../../node_modules/vfile/lib/index.js", "../../../node_modules/unist-util-stringify-position/lib/index.js", "../../../node_modules/vfile-message/lib/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/bail/index.js", "../../../node_modules/unified/lib/index.js", "../../../node_modules/is-plain-obj/index.js", "../../../node_modules/trough/index.js", "../../../node_modules/mdast-util-to-string/lib/index.js", "../../../node_modules/micromark-util-chunked/index.js", "../../../node_modules/micromark-util-combine-extensions/index.js", "../../../node_modules/micromark-util-character/lib/unicode-punctuation-regex.js", "../../../node_modules/micromark-util-character/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/decode-named-character-reference/index.dom.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/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-util-normalize-identifier/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/create-tokenizer.js", "../../../node_modules/micromark/lib/constructs.js", "../../../node_modules/micromark/lib/parse.js", "../../../node_modules/micromark/lib/preprocess.js", "../../../node_modules/micromark/lib/postprocess.js", "../../../node_modules/micromark-util-decode-numeric-character-reference/index.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-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/micromark-util-sanitize-uri/index.js", "../../../node_modules/mdast-util-to-hast/lib/handlers/footnote-reference.js", "../../../node_modules/mdast-util-to-hast/lib/handlers/footnote.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/unist-util-position/lib/index.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/unist-util-is/lib/index.js", "../../../node_modules/unist-util-visit-parents/lib/index.js", "../../../node_modules/unist-util-visit/lib/index.js", "../../../node_modules/unist-util-generated/lib/index.js", "../../../node_modules/mdast-util-definitions/lib/index.js", "../../../node_modules/mdast-util-to-hast/lib/state.js", "../../../node_modules/mdast-util-to-hast/lib/footer.js", "../../../node_modules/mdast-util-to-hast/lib/index.js", "../../../node_modules/remark-rehype/lib/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/xlink.js", "../../../node_modules/property-information/lib/xml.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/xmlns.js", "../../../node_modules/property-information/lib/aria.js", "../../../node_modules/property-information/lib/html.js", "../../../node_modules/property-information/lib/svg.js", "../../../node_modules/property-information/lib/find.js", "../../../node_modules/property-information/lib/hast-to-react.js", "../../../node_modules/property-information/index.js", "../../../node_modules/react-markdown/lib/rehype-filter.js", "../../../node_modules/react-markdown/lib/ast-to-react.js", "../../../node_modules/hast-util-whitespace/index.js", "../../../node_modules/space-separated-tokens/index.js", "../../../node_modules/comma-separated-tokens/index.js", "../../../node_modules/style-to-object/index.mjs", "../../../node_modules/rope-sequence/dist/index.js", "../../../node_modules/prosemirror-history/dist/index.js", "../../../node_modules/@tiptap/extension-history/src/history.ts", "../../site/form/Form.tsx", "../../site/util/proto.ts", "../../site/util/text.ts", "../../site/form/walk.ts", "../../../node_modules/react-hook-form/src/utils/isCheckBoxInput.ts", "../../../node_modules/react-hook-form/src/utils/isDateObject.ts", "../../../node_modules/react-hook-form/src/utils/isNullOrUndefined.ts", "../../../node_modules/react-hook-form/src/utils/isObject.ts", "../../../node_modules/react-hook-form/src/logic/getEventValue.ts", "../../../node_modules/react-hook-form/src/logic/getNodeParentName.ts", "../../../node_modules/react-hook-form/src/logic/isNameInFieldArray.ts", "../../../node_modules/react-hook-form/src/utils/isPlainObject.ts", "../../../node_modules/react-hook-form/src/utils/isWeb.ts", "../../../node_modules/react-hook-form/src/utils/cloneObject.ts", "../../../node_modules/react-hook-form/src/utils/compact.ts", "../../../node_modules/react-hook-form/src/utils/isUndefined.ts", "../../../node_modules/react-hook-form/src/utils/get.ts", "../../../node_modules/react-hook-form/src/utils/isBoolean.ts", "../../../node_modules/react-hook-form/src/constants.ts", "../../../node_modules/react-hook-form/src/useFormContext.tsx", "../../../node_modules/react-hook-form/src/logic/getProxyFormState.ts", "../../../node_modules/react-hook-form/src/utils/isEmptyObject.ts", "../../../node_modules/react-hook-form/src/logic/shouldRenderFormState.ts", "../../../node_modules/react-hook-form/src/utils/convertToArrayPayload.ts", "../../../node_modules/react-hook-form/src/logic/shouldSubscribeByName.ts", "../../../node_modules/react-hook-form/src/useSubscribe.ts", "../../../node_modules/react-hook-form/src/useFormState.ts", "../../../node_modules/react-hook-form/src/utils/isString.ts", "../../../node_modules/react-hook-form/src/logic/generateWatchOutput.ts", "../../../node_modules/react-hook-form/src/useWatch.ts", "../../../node_modules/react-hook-form/src/utils/isKey.ts", "../../../node_modules/react-hook-form/src/utils/stringToPath.ts", "../../../node_modules/react-hook-form/src/utils/set.ts", "../../../node_modules/react-hook-form/src/useController.ts", "../../../node_modules/react-hook-form/src/controller.tsx", "../../../node_modules/react-hook-form/src/form.tsx", "../../../node_modules/react-hook-form/src/logic/appendErrors.ts", "../../../node_modules/react-hook-form/src/logic/generateId.ts", "../../../node_modules/react-hook-form/src/logic/getFocusFieldName.ts", "../../../node_modules/react-hook-form/src/logic/getValidationModes.ts", "../../../node_modules/react-hook-form/src/logic/isWatched.ts", "../../../node_modules/react-hook-form/src/logic/iterateFieldsByAction.ts", "../../../node_modules/react-hook-form/src/logic/updateFieldArrayRootError.ts", "../../../node_modules/react-hook-form/src/utils/isFileInput.ts", "../../../node_modules/react-hook-form/src/utils/isFunction.ts", "../../../node_modules/react-hook-form/src/utils/isHTMLElement.ts", "../../../node_modules/react-hook-form/src/utils/isMessage.ts", "../../../node_modules/react-hook-form/src/utils/isRadioInput.ts", "../../../node_modules/react-hook-form/src/utils/isRegex.ts", "../../../node_modules/react-hook-form/src/logic/getCheckboxValue.ts", "../../../node_modules/react-hook-form/src/logic/getRadioValue.ts", "../../../node_modules/react-hook-form/src/logic/getValidateError.ts", "../../../node_modules/react-hook-form/src/logic/getValueAndMessage.ts", "../../../node_modules/react-hook-form/src/logic/validateField.ts", "../../../node_modules/react-hook-form/src/utils/append.ts", "../../../node_modules/react-hook-form/src/utils/fillEmptyArray.ts", "../../../node_modules/react-hook-form/src/utils/insert.ts", "../../../node_modules/react-hook-form/src/utils/move.ts", "../../../node_modules/react-hook-form/src/utils/prepend.ts", "../../../node_modules/react-hook-form/src/utils/remove.ts", "../../../node_modules/react-hook-form/src/utils/swap.ts", "../../../node_modules/react-hook-form/src/utils/unset.ts", "../../../node_modules/react-hook-form/src/utils/update.ts", "../../../node_modules/react-hook-form/src/useFieldArray.ts", "../../../node_modules/react-hook-form/src/utils/createSubject.ts", "../../../node_modules/react-hook-form/src/utils/isPrimitive.ts", "../../../node_modules/react-hook-form/src/utils/deepEqual.ts", "../../../node_modules/react-hook-form/src/utils/isMultipleSelect.ts", "../../../node_modules/react-hook-form/src/utils/isRadioOrCheckbox.ts", "../../../node_modules/react-hook-form/src/utils/live.ts", "../../../node_modules/react-hook-form/src/utils/objectHasFunction.ts", "../../../node_modules/react-hook-form/src/logic/getDirtyFields.ts", "../../../node_modules/react-hook-form/src/logic/getFieldValueAs.ts", "../../../node_modules/react-hook-form/src/logic/getFieldValue.ts", "../../../node_modules/react-hook-form/src/logic/getResolverOptions.ts", "../../../node_modules/react-hook-form/src/logic/getRuleValue.ts", "../../../node_modules/react-hook-form/src/logic/hasValidation.ts", "../../../node_modules/react-hook-form/src/logic/schemaErrorLookup.ts", "../../../node_modules/react-hook-form/src/logic/skipValidation.ts", "../../../node_modules/react-hook-form/src/logic/unsetEmptyArray.ts", "../../../node_modules/react-hook-form/src/logic/createFormControl.ts", "../../../node_modules/react-hook-form/src/useForm.ts", "../../site/util/form.ts", "../../site/source/editors/FileEditor.tsx", "../../site/source/editors/SiteEditor.tsx", "../../site/source/editors/SectionEditor.tsx", "../../site/source/editors/ChatGPTConversationEditor.tsx", "../../../node_modules/@tiptap/extension-bold/src/bold.ts", "../../../node_modules/@tiptap/extension-italic/src/italic.ts", "../../../node_modules/@tiptap/extension-strike/src/strike.ts", "../../site/file/FileDrop.tsx", "../../extension/util.ts", "../../site/home/Home.tsx", "../../site/chat/ChatPage.tsx", "../../site/chat/state.ts", "../../site/chat/Chat.tsx", "../../site/util/time.ts", "../../site/auth/VerifyPage.tsx", "../../site/admin/Admin.tsx", "../../site/App.tsx"], - "sourcesContent": ["/**\n * @license React\n * react.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';var l=Symbol.for(\"react.element\"),n=Symbol.for(\"react.portal\"),p=Symbol.for(\"react.fragment\"),q=Symbol.for(\"react.strict_mode\"),r=Symbol.for(\"react.profiler\"),t=Symbol.for(\"react.provider\"),u=Symbol.for(\"react.context\"),v=Symbol.for(\"react.forward_ref\"),w=Symbol.for(\"react.suspense\"),x=Symbol.for(\"react.memo\"),y=Symbol.for(\"react.lazy\"),z=Symbol.iterator;function A(a){if(null===a||\"object\"!==typeof a)return null;a=z&&a[z]||a[\"@@iterator\"];return\"function\"===typeof a?a:null}\nvar B={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},C=Object.assign,D={};function E(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}E.prototype.isReactComponent={};\nE.prototype.setState=function(a,b){if(\"object\"!==typeof a&&\"function\"!==typeof a&&null!=a)throw Error(\"setState(...): takes an object of state variables to update or a function which returns an object of state variables.\");this.updater.enqueueSetState(this,a,b,\"setState\")};E.prototype.forceUpdate=function(a){this.updater.enqueueForceUpdate(this,a,\"forceUpdate\")};function F(){}F.prototype=E.prototype;function G(a,b,e){this.props=a;this.context=b;this.refs=D;this.updater=e||B}var H=G.prototype=new F;\nH.constructor=G;C(H,E.prototype);H.isPureReactComponent=!0;var I=Array.isArray,J=Object.prototype.hasOwnProperty,K={current:null},L={key:!0,ref:!0,__self:!0,__source:!0};\nfunction M(a,b,e){var d,c={},k=null,h=null;if(null!=b)for(d in void 0!==b.ref&&(h=b.ref),void 0!==b.key&&(k=\"\"+b.key),b)J.call(b,d)&&!L.hasOwnProperty(d)&&(c[d]=b[d]);var g=arguments.length-2;if(1===g)c.children=e;else if(1>>1,e=a[d];if(0>>1;dg(C,c))ng(x,C)?(a[d]=x,a[n]=c,d=n):(a[d]=C,a[m]=c,d=m);else if(ng(x,c))a[d]=x,a[n]=c,d=n;else break a}}return b}\nfunction g(a,b){var c=a.sortIndex-b.sortIndex;return 0!==c?c:a.id-b.id}if(\"object\"===typeof performance&&\"function\"===typeof performance.now){var l=performance;exports.unstable_now=function(){return l.now()}}else{var p=Date,q=p.now();exports.unstable_now=function(){return p.now()-q}}var r=[],t=[],u=1,v=null,y=3,z=!1,A=!1,B=!1,D=\"function\"===typeof setTimeout?setTimeout:null,E=\"function\"===typeof clearTimeout?clearTimeout:null,F=\"undefined\"!==typeof setImmediate?setImmediate:null;\n\"undefined\"!==typeof navigator&&void 0!==navigator.scheduling&&void 0!==navigator.scheduling.isInputPending&&navigator.scheduling.isInputPending.bind(navigator.scheduling);function G(a){for(var b=h(t);null!==b;){if(null===b.callback)k(t);else if(b.startTime<=a)k(t),b.sortIndex=b.expirationTime,f(r,b);else break;b=h(t)}}function H(a){B=!1;G(a);if(!A)if(null!==h(r))A=!0,I(J);else{var b=h(t);null!==b&&K(H,b.startTime-a)}}\nfunction J(a,b){A=!1;B&&(B=!1,E(L),L=-1);z=!0;var c=y;try{G(b);for(v=h(r);null!==v&&(!(v.expirationTime>b)||a&&!M());){var d=v.callback;if(\"function\"===typeof d){v.callback=null;y=v.priorityLevel;var e=d(v.expirationTime<=b);b=exports.unstable_now();\"function\"===typeof e?v.callback=e:v===h(r)&&k(r);G(b)}else k(r);v=h(r)}if(null!==v)var w=!0;else{var m=h(t);null!==m&&K(H,m.startTime-b);w=!1}return w}finally{v=null,y=c,z=!1}}var N=!1,O=null,L=-1,P=5,Q=-1;\nfunction M(){return exports.unstable_now()-Qa||125d?(a.sortIndex=c,f(t,a),null===h(r)&&a===h(t)&&(B?(E(L),L=-1):B=!0,K(H,c-d))):(a.sortIndex=e,f(r,a),A||z||(A=!0,I(J)));return a};\nexports.unstable_shouldYield=M;exports.unstable_wrapCallback=function(a){var b=y;return function(){var c=y;y=b;try{return a.apply(this,arguments)}finally{y=c}}};\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/scheduler.production.min.js');\n} else {\n module.exports = require('./cjs/scheduler.development.js');\n}\n", "/**\n * @license React\n * react-dom.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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 Modernizr 3.0.0pre (Custom Build) | MIT\n*/\n'use strict';var aa=require(\"react\"),ca=require(\"scheduler\");function p(a){for(var b=\"https://reactjs.org/docs/error-decoder.html?invariant=\"+a,c=1;cb}return!1}function v(a,b,c,d,e,f,g){this.acceptsBooleans=2===b||3===b||4===b;this.attributeName=d;this.attributeNamespace=e;this.mustUseProperty=c;this.propertyName=a;this.type=b;this.sanitizeURL=f;this.removeEmptyString=g}var z={};\n\"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style\".split(\" \").forEach(function(a){z[a]=new v(a,0,!1,a,null,!1,!1)});[[\"acceptCharset\",\"accept-charset\"],[\"className\",\"class\"],[\"htmlFor\",\"for\"],[\"httpEquiv\",\"http-equiv\"]].forEach(function(a){var b=a[0];z[b]=new v(b,1,!1,a[1],null,!1,!1)});[\"contentEditable\",\"draggable\",\"spellCheck\",\"value\"].forEach(function(a){z[a]=new v(a,2,!1,a.toLowerCase(),null,!1,!1)});\n[\"autoReverse\",\"externalResourcesRequired\",\"focusable\",\"preserveAlpha\"].forEach(function(a){z[a]=new v(a,2,!1,a,null,!1,!1)});\"allowFullScreen async autoFocus autoPlay controls default defer disabled disablePictureInPicture disableRemotePlayback formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope\".split(\" \").forEach(function(a){z[a]=new v(a,3,!1,a.toLowerCase(),null,!1,!1)});\n[\"checked\",\"multiple\",\"muted\",\"selected\"].forEach(function(a){z[a]=new v(a,3,!0,a,null,!1,!1)});[\"capture\",\"download\"].forEach(function(a){z[a]=new v(a,4,!1,a,null,!1,!1)});[\"cols\",\"rows\",\"size\",\"span\"].forEach(function(a){z[a]=new v(a,6,!1,a,null,!1,!1)});[\"rowSpan\",\"start\"].forEach(function(a){z[a]=new v(a,5,!1,a.toLowerCase(),null,!1,!1)});var ra=/[\\-:]([a-z])/g;function sa(a){return a[1].toUpperCase()}\n\"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height\".split(\" \").forEach(function(a){var b=a.replace(ra,\nsa);z[b]=new v(b,1,!1,a,null,!1,!1)});\"xlink:actuate xlink:arcrole xlink:role xlink:show xlink:title xlink:type\".split(\" \").forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/1999/xlink\",!1,!1)});[\"xml:base\",\"xml:lang\",\"xml:space\"].forEach(function(a){var b=a.replace(ra,sa);z[b]=new v(b,1,!1,a,\"http://www.w3.org/XML/1998/namespace\",!1,!1)});[\"tabIndex\",\"crossOrigin\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!1,!1)});\nz.xlinkHref=new v(\"xlinkHref\",1,!1,\"xlink:href\",\"http://www.w3.org/1999/xlink\",!0,!1);[\"src\",\"href\",\"action\",\"formAction\"].forEach(function(a){z[a]=new v(a,1,!1,a.toLowerCase(),null,!0,!0)});\nfunction ta(a,b,c,d){var e=z.hasOwnProperty(b)?z[b]:null;if(null!==e?0!==e.type:d||!(2h||e[g]!==f[h]){var k=\"\\n\"+e[g].replace(\" at new \",\" at \");a.displayName&&k.includes(\"\")&&(k=k.replace(\"\",a.displayName));return k}while(1<=g&&0<=h)}break}}}finally{Na=!1,Error.prepareStackTrace=c}return(a=a?a.displayName||a.name:\"\")?Ma(a):\"\"}\nfunction Pa(a){switch(a.tag){case 5:return Ma(a.type);case 16:return Ma(\"Lazy\");case 13:return Ma(\"Suspense\");case 19:return Ma(\"SuspenseList\");case 0:case 2:case 15:return a=Oa(a.type,!1),a;case 11:return a=Oa(a.type.render,!1),a;case 1:return a=Oa(a.type,!0),a;default:return\"\"}}\nfunction Qa(a){if(null==a)return null;if(\"function\"===typeof a)return a.displayName||a.name||null;if(\"string\"===typeof a)return a;switch(a){case ya:return\"Fragment\";case wa:return\"Portal\";case Aa:return\"Profiler\";case za:return\"StrictMode\";case Ea:return\"Suspense\";case Fa:return\"SuspenseList\"}if(\"object\"===typeof a)switch(a.$$typeof){case Ca:return(a.displayName||\"Context\")+\".Consumer\";case Ba:return(a._context.displayName||\"Context\")+\".Provider\";case Da:var b=a.render;a=a.displayName;a||(a=b.displayName||\nb.name||\"\",a=\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");return a;case Ga:return b=a.displayName||null,null!==b?b:Qa(a.type)||\"Memo\";case Ha:b=a._payload;a=a._init;try{return Qa(a(b))}catch(c){}}return null}\nfunction Ra(a){var b=a.type;switch(a.tag){case 24:return\"Cache\";case 9:return(b.displayName||\"Context\")+\".Consumer\";case 10:return(b._context.displayName||\"Context\")+\".Provider\";case 18:return\"DehydratedFragment\";case 11:return a=b.render,a=a.displayName||a.name||\"\",b.displayName||(\"\"!==a?\"ForwardRef(\"+a+\")\":\"ForwardRef\");case 7:return\"Fragment\";case 5:return b;case 4:return\"Portal\";case 3:return\"Root\";case 6:return\"Text\";case 16:return Qa(b);case 8:return b===za?\"StrictMode\":\"Mode\";case 22:return\"Offscreen\";\ncase 12:return\"Profiler\";case 21:return\"Scope\";case 13:return\"Suspense\";case 19:return\"SuspenseList\";case 25:return\"TracingMarker\";case 1:case 0:case 17:case 2:case 14:case 15:if(\"function\"===typeof b)return b.displayName||b.name||null;if(\"string\"===typeof b)return b}return null}function Sa(a){switch(typeof a){case \"boolean\":case \"number\":case \"string\":case \"undefined\":return a;case \"object\":return a;default:return\"\"}}\nfunction Ta(a){var b=a.type;return(a=a.nodeName)&&\"input\"===a.toLowerCase()&&(\"checkbox\"===b||\"radio\"===b)}\nfunction Ua(a){var b=Ta(a)?\"checked\":\"value\",c=Object.getOwnPropertyDescriptor(a.constructor.prototype,b),d=\"\"+a[b];if(!a.hasOwnProperty(b)&&\"undefined\"!==typeof c&&\"function\"===typeof c.get&&\"function\"===typeof c.set){var e=c.get,f=c.set;Object.defineProperty(a,b,{configurable:!0,get:function(){return e.call(this)},set:function(a){d=\"\"+a;f.call(this,a)}});Object.defineProperty(a,b,{enumerable:c.enumerable});return{getValue:function(){return d},setValue:function(a){d=\"\"+a},stopTracking:function(){a._valueTracker=\nnull;delete a[b]}}}}function Va(a){a._valueTracker||(a._valueTracker=Ua(a))}function Wa(a){if(!a)return!1;var b=a._valueTracker;if(!b)return!0;var c=b.getValue();var d=\"\";a&&(d=Ta(a)?a.checked?\"true\":\"false\":a.value);a=d;return a!==c?(b.setValue(a),!0):!1}function Xa(a){a=a||(\"undefined\"!==typeof document?document:void 0);if(\"undefined\"===typeof a)return null;try{return a.activeElement||a.body}catch(b){return a.body}}\nfunction Ya(a,b){var c=b.checked;return A({},b,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=c?c:a._wrapperState.initialChecked})}function Za(a,b){var c=null==b.defaultValue?\"\":b.defaultValue,d=null!=b.checked?b.checked:b.defaultChecked;c=Sa(null!=b.value?b.value:c);a._wrapperState={initialChecked:d,initialValue:c,controlled:\"checkbox\"===b.type||\"radio\"===b.type?null!=b.checked:null!=b.value}}function ab(a,b){b=b.checked;null!=b&&ta(a,\"checked\",b,!1)}\nfunction bb(a,b){ab(a,b);var c=Sa(b.value),d=b.type;if(null!=c)if(\"number\"===d){if(0===c&&\"\"===a.value||a.value!=c)a.value=\"\"+c}else a.value!==\"\"+c&&(a.value=\"\"+c);else if(\"submit\"===d||\"reset\"===d){a.removeAttribute(\"value\");return}b.hasOwnProperty(\"value\")?cb(a,b.type,c):b.hasOwnProperty(\"defaultValue\")&&cb(a,b.type,Sa(b.defaultValue));null==b.checked&&null!=b.defaultChecked&&(a.defaultChecked=!!b.defaultChecked)}\nfunction db(a,b,c){if(b.hasOwnProperty(\"value\")||b.hasOwnProperty(\"defaultValue\")){var d=b.type;if(!(\"submit\"!==d&&\"reset\"!==d||void 0!==b.value&&null!==b.value))return;b=\"\"+a._wrapperState.initialValue;c||b===a.value||(a.value=b);a.defaultValue=b}c=a.name;\"\"!==c&&(a.name=\"\");a.defaultChecked=!!a._wrapperState.initialChecked;\"\"!==c&&(a.name=c)}\nfunction cb(a,b,c){if(\"number\"!==b||Xa(a.ownerDocument)!==a)null==c?a.defaultValue=\"\"+a._wrapperState.initialValue:a.defaultValue!==\"\"+c&&(a.defaultValue=\"\"+c)}var eb=Array.isArray;\nfunction fb(a,b,c,d){a=a.options;if(b){b={};for(var e=0;e\"+b.valueOf().toString()+\"\";for(b=mb.firstChild;a.firstChild;)a.removeChild(a.firstChild);for(;b.firstChild;)a.appendChild(b.firstChild)}});\nfunction ob(a,b){if(b){var c=a.firstChild;if(c&&c===a.lastChild&&3===c.nodeType){c.nodeValue=b;return}}a.textContent=b}\nvar pb={animationIterationCount:!0,aspectRatio:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridArea:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,\nzoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},qb=[\"Webkit\",\"ms\",\"Moz\",\"O\"];Object.keys(pb).forEach(function(a){qb.forEach(function(b){b=b+a.charAt(0).toUpperCase()+a.substring(1);pb[b]=pb[a]})});function rb(a,b,c){return null==b||\"boolean\"===typeof b||\"\"===b?\"\":c||\"number\"!==typeof b||0===b||pb.hasOwnProperty(a)&&pb[a]?(\"\"+b).trim():b+\"px\"}\nfunction sb(a,b){a=a.style;for(var c in b)if(b.hasOwnProperty(c)){var d=0===c.indexOf(\"--\"),e=rb(c,b[c],d);\"float\"===c&&(c=\"cssFloat\");d?a.setProperty(c,e):a[c]=e}}var tb=A({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0});\nfunction ub(a,b){if(b){if(tb[a]&&(null!=b.children||null!=b.dangerouslySetInnerHTML))throw Error(p(137,a));if(null!=b.dangerouslySetInnerHTML){if(null!=b.children)throw Error(p(60));if(\"object\"!==typeof b.dangerouslySetInnerHTML||!(\"__html\"in b.dangerouslySetInnerHTML))throw Error(p(61));}if(null!=b.style&&\"object\"!==typeof b.style)throw Error(p(62));}}\nfunction vb(a,b){if(-1===a.indexOf(\"-\"))return\"string\"===typeof b.is;switch(a){case \"annotation-xml\":case \"color-profile\":case \"font-face\":case \"font-face-src\":case \"font-face-uri\":case \"font-face-format\":case \"font-face-name\":case \"missing-glyph\":return!1;default:return!0}}var wb=null;function xb(a){a=a.target||a.srcElement||window;a.correspondingUseElement&&(a=a.correspondingUseElement);return 3===a.nodeType?a.parentNode:a}var yb=null,zb=null,Ab=null;\nfunction Bb(a){if(a=Cb(a)){if(\"function\"!==typeof yb)throw Error(p(280));var b=a.stateNode;b&&(b=Db(b),yb(a.stateNode,a.type,b))}}function Eb(a){zb?Ab?Ab.push(a):Ab=[a]:zb=a}function Fb(){if(zb){var a=zb,b=Ab;Ab=zb=null;Bb(a);if(b)for(a=0;a>>=0;return 0===a?32:31-(pc(a)/qc|0)|0}var rc=64,sc=4194304;\nfunction tc(a){switch(a&-a){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:case 128:case 256:case 512:case 1024:case 2048:case 4096:case 8192:case 16384:case 32768:case 65536:case 131072:case 262144:case 524288:case 1048576:case 2097152:return a&4194240;case 4194304:case 8388608:case 16777216:case 33554432:case 67108864:return a&130023424;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 1073741824;\ndefault:return a}}function uc(a,b){var c=a.pendingLanes;if(0===c)return 0;var d=0,e=a.suspendedLanes,f=a.pingedLanes,g=c&268435455;if(0!==g){var h=g&~e;0!==h?d=tc(h):(f&=g,0!==f&&(d=tc(f)))}else g=c&~e,0!==g?d=tc(g):0!==f&&(d=tc(f));if(0===d)return 0;if(0!==b&&b!==d&&0===(b&e)&&(e=d&-d,f=b&-b,e>=f||16===e&&0!==(f&4194240)))return b;0!==(d&4)&&(d|=c&16);b=a.entangledLanes;if(0!==b)for(a=a.entanglements,b&=d;0c;c++)b.push(a);return b}\nfunction Ac(a,b,c){a.pendingLanes|=b;536870912!==b&&(a.suspendedLanes=0,a.pingedLanes=0);a=a.eventTimes;b=31-oc(b);a[b]=c}function Bc(a,b){var c=a.pendingLanes&~b;a.pendingLanes=b;a.suspendedLanes=0;a.pingedLanes=0;a.expiredLanes&=b;a.mutableReadLanes&=b;a.entangledLanes&=b;b=a.entanglements;var d=a.eventTimes;for(a=a.expirationTimes;0=be),ee=String.fromCharCode(32),fe=!1;\nfunction ge(a,b){switch(a){case \"keyup\":return-1!==$d.indexOf(b.keyCode);case \"keydown\":return 229!==b.keyCode;case \"keypress\":case \"mousedown\":case \"focusout\":return!0;default:return!1}}function he(a){a=a.detail;return\"object\"===typeof a&&\"data\"in a?a.data:null}var ie=!1;function je(a,b){switch(a){case \"compositionend\":return he(b);case \"keypress\":if(32!==b.which)return null;fe=!0;return ee;case \"textInput\":return a=b.data,a===ee&&fe?null:a;default:return null}}\nfunction ke(a,b){if(ie)return\"compositionend\"===a||!ae&&ge(a,b)?(a=nd(),md=ld=kd=null,ie=!1,a):null;switch(a){case \"paste\":return null;case \"keypress\":if(!(b.ctrlKey||b.altKey||b.metaKey)||b.ctrlKey&&b.altKey){if(b.char&&1=b)return{node:c,offset:b-a};a=d}a:{for(;c;){if(c.nextSibling){c=c.nextSibling;break a}c=c.parentNode}c=void 0}c=Je(c)}}function Le(a,b){return a&&b?a===b?!0:a&&3===a.nodeType?!1:b&&3===b.nodeType?Le(a,b.parentNode):\"contains\"in a?a.contains(b):a.compareDocumentPosition?!!(a.compareDocumentPosition(b)&16):!1:!1}\nfunction Me(){for(var a=window,b=Xa();b instanceof a.HTMLIFrameElement;){try{var c=\"string\"===typeof b.contentWindow.location.href}catch(d){c=!1}if(c)a=b.contentWindow;else break;b=Xa(a.document)}return b}function Ne(a){var b=a&&a.nodeName&&a.nodeName.toLowerCase();return b&&(\"input\"===b&&(\"text\"===a.type||\"search\"===a.type||\"tel\"===a.type||\"url\"===a.type||\"password\"===a.type)||\"textarea\"===b||\"true\"===a.contentEditable)}\nfunction Oe(a){var b=Me(),c=a.focusedElem,d=a.selectionRange;if(b!==c&&c&&c.ownerDocument&&Le(c.ownerDocument.documentElement,c)){if(null!==d&&Ne(c))if(b=d.start,a=d.end,void 0===a&&(a=b),\"selectionStart\"in c)c.selectionStart=b,c.selectionEnd=Math.min(a,c.value.length);else if(a=(b=c.ownerDocument||document)&&b.defaultView||window,a.getSelection){a=a.getSelection();var e=c.textContent.length,f=Math.min(d.start,e);d=void 0===d.end?f:Math.min(d.end,e);!a.extend&&f>d&&(e=d,d=f,f=e);e=Ke(c,f);var g=Ke(c,\nd);e&&g&&(1!==a.rangeCount||a.anchorNode!==e.node||a.anchorOffset!==e.offset||a.focusNode!==g.node||a.focusOffset!==g.offset)&&(b=b.createRange(),b.setStart(e.node,e.offset),a.removeAllRanges(),f>d?(a.addRange(b),a.extend(g.node,g.offset)):(b.setEnd(g.node,g.offset),a.addRange(b)))}b=[];for(a=c;a=a.parentNode;)1===a.nodeType&&b.push({element:a,left:a.scrollLeft,top:a.scrollTop});\"function\"===typeof c.focus&&c.focus();for(c=0;c=document.documentMode,Qe=null,Re=null,Se=null,Te=!1;\nfunction Ue(a,b,c){var d=c.window===c?c.document:9===c.nodeType?c:c.ownerDocument;Te||null==Qe||Qe!==Xa(d)||(d=Qe,\"selectionStart\"in d&&Ne(d)?d={start:d.selectionStart,end:d.selectionEnd}:(d=(d.ownerDocument&&d.ownerDocument.defaultView||window).getSelection(),d={anchorNode:d.anchorNode,anchorOffset:d.anchorOffset,focusNode:d.focusNode,focusOffset:d.focusOffset}),Se&&Ie(Se,d)||(Se=d,d=oe(Re,\"onSelect\"),0Tf||(a.current=Sf[Tf],Sf[Tf]=null,Tf--)}function G(a,b){Tf++;Sf[Tf]=a.current;a.current=b}var Vf={},H=Uf(Vf),Wf=Uf(!1),Xf=Vf;function Yf(a,b){var c=a.type.contextTypes;if(!c)return Vf;var d=a.stateNode;if(d&&d.__reactInternalMemoizedUnmaskedChildContext===b)return d.__reactInternalMemoizedMaskedChildContext;var e={},f;for(f in c)e[f]=b[f];d&&(a=a.stateNode,a.__reactInternalMemoizedUnmaskedChildContext=b,a.__reactInternalMemoizedMaskedChildContext=e);return e}\nfunction Zf(a){a=a.childContextTypes;return null!==a&&void 0!==a}function $f(){E(Wf);E(H)}function ag(a,b,c){if(H.current!==Vf)throw Error(p(168));G(H,b);G(Wf,c)}function bg(a,b,c){var d=a.stateNode;b=b.childContextTypes;if(\"function\"!==typeof d.getChildContext)return c;d=d.getChildContext();for(var e in d)if(!(e in b))throw Error(p(108,Ra(a)||\"Unknown\",e));return A({},c,d)}\nfunction cg(a){a=(a=a.stateNode)&&a.__reactInternalMemoizedMergedChildContext||Vf;Xf=H.current;G(H,a);G(Wf,Wf.current);return!0}function dg(a,b,c){var d=a.stateNode;if(!d)throw Error(p(169));c?(a=bg(a,b,Xf),d.__reactInternalMemoizedMergedChildContext=a,E(Wf),E(H),G(H,a)):E(Wf);G(Wf,c)}var eg=null,fg=!1,gg=!1;function hg(a){null===eg?eg=[a]:eg.push(a)}function ig(a){fg=!0;hg(a)}\nfunction jg(){if(!gg&&null!==eg){gg=!0;var a=0,b=C;try{var c=eg;for(C=1;a>=g;e-=g;rg=1<<32-oc(b)+e|c<w?(x=u,u=null):x=u.sibling;var n=r(e,u,h[w],k);if(null===n){null===u&&(u=x);break}a&&u&&null===n.alternate&&b(e,u);g=f(n,g,w);null===m?l=n:m.sibling=n;m=n;u=x}if(w===h.length)return c(e,u),I&&tg(e,w),l;if(null===u){for(;ww?(x=m,m=null):x=m.sibling;var t=r(e,m,n.value,k);if(null===t){null===m&&(m=x);break}a&&m&&null===t.alternate&&b(e,m);g=f(t,g,w);null===u?l=t:u.sibling=t;u=t;m=x}if(n.done)return c(e,\nm),I&&tg(e,w),l;if(null===m){for(;!n.done;w++,n=h.next())n=q(e,n.value,k),null!==n&&(g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);I&&tg(e,w);return l}for(m=d(e,m);!n.done;w++,n=h.next())n=y(m,e,w,n.value,k),null!==n&&(a&&null!==n.alternate&&m.delete(null===n.key?w:n.key),g=f(n,g,w),null===u?l=n:u.sibling=n,u=n);a&&m.forEach(function(a){return b(e,a)});I&&tg(e,w);return l}function J(a,d,f,h){\"object\"===typeof f&&null!==f&&f.type===ya&&null===f.key&&(f=f.props.children);if(\"object\"===typeof f&&null!==f){switch(f.$$typeof){case va:a:{for(var k=\nf.key,l=d;null!==l;){if(l.key===k){k=f.type;if(k===ya){if(7===l.tag){c(a,l.sibling);d=e(l,f.props.children);d.return=a;a=d;break a}}else if(l.elementType===k||\"object\"===typeof k&&null!==k&&k.$$typeof===Ha&&uh(k)===l.type){c(a,l.sibling);d=e(l,f.props);d.ref=sh(a,l,f);d.return=a;a=d;break a}c(a,l);break}else b(a,l);l=l.sibling}f.type===ya?(d=Ah(f.props.children,a.mode,h,f.key),d.return=a,a=d):(h=yh(f.type,f.key,f.props,null,a.mode,h),h.ref=sh(a,d,f),h.return=a,a=h)}return g(a);case wa:a:{for(l=f.key;null!==\nd;){if(d.key===l)if(4===d.tag&&d.stateNode.containerInfo===f.containerInfo&&d.stateNode.implementation===f.implementation){c(a,d.sibling);d=e(d,f.children||[]);d.return=a;a=d;break a}else{c(a,d);break}else b(a,d);d=d.sibling}d=zh(f,a.mode,h);d.return=a;a=d}return g(a);case Ha:return l=f._init,J(a,d,l(f._payload),h)}if(eb(f))return n(a,d,f,h);if(Ka(f))return t(a,d,f,h);th(a,f)}return\"string\"===typeof f&&\"\"!==f||\"number\"===typeof f?(f=\"\"+f,null!==d&&6===d.tag?(c(a,d.sibling),d=e(d,f),d.return=a,a=d):\n(c(a,d),d=xh(f,a.mode,h),d.return=a,a=d),g(a)):c(a,d)}return J}var Bh=vh(!0),Ch=vh(!1),Dh={},Eh=Uf(Dh),Fh=Uf(Dh),Gh=Uf(Dh);function Hh(a){if(a===Dh)throw Error(p(174));return a}function Ih(a,b){G(Gh,b);G(Fh,a);G(Eh,Dh);a=b.nodeType;switch(a){case 9:case 11:b=(b=b.documentElement)?b.namespaceURI:lb(null,\"\");break;default:a=8===a?b.parentNode:b,b=a.namespaceURI||null,a=a.tagName,b=lb(b,a)}E(Eh);G(Eh,b)}function Jh(){E(Eh);E(Fh);E(Gh)}\nfunction Kh(a){Hh(Gh.current);var b=Hh(Eh.current);var c=lb(b,a.type);b!==c&&(G(Fh,a),G(Eh,c))}function Lh(a){Fh.current===a&&(E(Eh),E(Fh))}var M=Uf(0);\nfunction Mh(a){for(var b=a;null!==b;){if(13===b.tag){var c=b.memoizedState;if(null!==c&&(c=c.dehydrated,null===c||\"$?\"===c.data||\"$!\"===c.data))return b}else if(19===b.tag&&void 0!==b.memoizedProps.revealOrder){if(0!==(b.flags&128))return b}else if(null!==b.child){b.child.return=b;b=b.child;continue}if(b===a)break;for(;null===b.sibling;){if(null===b.return||b.return===a)return null;b=b.return}b.sibling.return=b.return;b=b.sibling}return null}var Nh=[];\nfunction Oh(){for(var a=0;ac?c:4;a(!0);var d=Qh.transition;Qh.transition={};try{a(!1),b()}finally{C=c,Qh.transition=d}}function Fi(){return di().memoizedState}\nfunction Gi(a,b,c){var d=lh(a);c={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,c);else if(c=Yg(a,b,c,d),null!==c){var e=L();mh(c,a,d,e);Ji(c,b,d)}}\nfunction ri(a,b,c){var d=lh(a),e={lane:d,action:c,hasEagerState:!1,eagerState:null,next:null};if(Hi(a))Ii(b,e);else{var f=a.alternate;if(0===a.lanes&&(null===f||0===f.lanes)&&(f=b.lastRenderedReducer,null!==f))try{var g=b.lastRenderedState,h=f(g,c);e.hasEagerState=!0;e.eagerState=h;if(He(h,g)){var k=b.interleaved;null===k?(e.next=e,Xg(b)):(e.next=k.next,k.next=e);b.interleaved=e;return}}catch(l){}finally{}c=Yg(a,b,e,d);null!==c&&(e=L(),mh(c,a,d,e),Ji(c,b,d))}}\nfunction Hi(a){var b=a.alternate;return a===N||null!==b&&b===N}function Ii(a,b){Th=Sh=!0;var c=a.pending;null===c?b.next=b:(b.next=c.next,c.next=b);a.pending=b}function Ji(a,b,c){if(0!==(c&4194240)){var d=b.lanes;d&=a.pendingLanes;c|=d;b.lanes=c;Cc(a,c)}}\nvar ai={readContext:Vg,useCallback:Q,useContext:Q,useEffect:Q,useImperativeHandle:Q,useInsertionEffect:Q,useLayoutEffect:Q,useMemo:Q,useReducer:Q,useRef:Q,useState:Q,useDebugValue:Q,useDeferredValue:Q,useTransition:Q,useMutableSource:Q,useSyncExternalStore:Q,useId:Q,unstable_isNewReconciler:!1},Yh={readContext:Vg,useCallback:function(a,b){ci().memoizedState=[a,void 0===b?null:b];return a},useContext:Vg,useEffect:vi,useImperativeHandle:function(a,b,c){c=null!==c&&void 0!==c?c.concat([a]):null;return ti(4194308,\n4,yi.bind(null,b,a),c)},useLayoutEffect:function(a,b){return ti(4194308,4,a,b)},useInsertionEffect:function(a,b){return ti(4,2,a,b)},useMemo:function(a,b){var c=ci();b=void 0===b?null:b;a=a();c.memoizedState=[a,b];return a},useReducer:function(a,b,c){var d=ci();b=void 0!==c?c(b):b;d.memoizedState=d.baseState=b;a={pending:null,interleaved:null,lanes:0,dispatch:null,lastRenderedReducer:a,lastRenderedState:b};d.queue=a;a=a.dispatch=Gi.bind(null,N,a);return[d.memoizedState,a]},useRef:function(a){var b=\nci();a={current:a};return b.memoizedState=a},useState:qi,useDebugValue:Ai,useDeferredValue:function(a){return ci().memoizedState=a},useTransition:function(){var a=qi(!1),b=a[0];a=Ei.bind(null,a[1]);ci().memoizedState=a;return[b,a]},useMutableSource:function(){},useSyncExternalStore:function(a,b,c){var d=N,e=ci();if(I){if(void 0===c)throw Error(p(407));c=c()}else{c=b();if(null===R)throw Error(p(349));0!==(Rh&30)||ni(d,b,c)}e.memoizedState=c;var f={value:c,getSnapshot:b};e.queue=f;vi(ki.bind(null,d,\nf,a),[a]);d.flags|=2048;li(9,mi.bind(null,d,f,c,b),void 0,null);return c},useId:function(){var a=ci(),b=R.identifierPrefix;if(I){var c=sg;var d=rg;c=(d&~(1<<32-oc(d)-1)).toString(32)+c;b=\":\"+b+\"R\"+c;c=Uh++;0\\x3c/script>\",a=a.removeChild(a.firstChild)):\n\"string\"===typeof d.is?a=g.createElement(c,{is:d.is}):(a=g.createElement(c),\"select\"===c&&(g=a,d.multiple?g.multiple=!0:d.size&&(g.size=d.size))):a=g.createElementNS(a,c);a[Of]=b;a[Pf]=d;Aj(a,b,!1,!1);b.stateNode=a;a:{g=vb(c,d);switch(c){case \"dialog\":D(\"cancel\",a);D(\"close\",a);e=d;break;case \"iframe\":case \"object\":case \"embed\":D(\"load\",a);e=d;break;case \"video\":case \"audio\":for(e=0;eHj&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304)}else{if(!d)if(a=Mh(g),null!==a){if(b.flags|=128,d=!0,c=a.updateQueue,null!==c&&(b.updateQueue=c,b.flags|=4),Ej(f,!0),null===f.tail&&\"hidden\"===f.tailMode&&!g.alternate&&!I)return S(b),null}else 2*B()-f.renderingStartTime>Hj&&1073741824!==c&&(b.flags|=128,d=!0,Ej(f,!1),b.lanes=4194304);f.isBackwards?(g.sibling=b.child,b.child=g):(c=f.last,null!==c?c.sibling=g:b.child=g,f.last=g)}if(null!==f.tail)return b=f.tail,f.rendering=\nb,f.tail=b.sibling,f.renderingStartTime=B(),b.sibling=null,c=M.current,G(M,d?c&1|2:c&1),b;S(b);return null;case 22:case 23:return Ij(),d=null!==b.memoizedState,null!==a&&null!==a.memoizedState!==d&&(b.flags|=8192),d&&0!==(b.mode&1)?0!==(gj&1073741824)&&(S(b),b.subtreeFlags&6&&(b.flags|=8192)):S(b),null;case 24:return null;case 25:return null}throw Error(p(156,b.tag));}\nfunction Jj(a,b){wg(b);switch(b.tag){case 1:return Zf(b.type)&&$f(),a=b.flags,a&65536?(b.flags=a&-65537|128,b):null;case 3:return Jh(),E(Wf),E(H),Oh(),a=b.flags,0!==(a&65536)&&0===(a&128)?(b.flags=a&-65537|128,b):null;case 5:return Lh(b),null;case 13:E(M);a=b.memoizedState;if(null!==a&&null!==a.dehydrated){if(null===b.alternate)throw Error(p(340));Ig()}a=b.flags;return a&65536?(b.flags=a&-65537|128,b):null;case 19:return E(M),null;case 4:return Jh(),null;case 10:return Rg(b.type._context),null;case 22:case 23:return Ij(),\nnull;case 24:return null;default:return null}}var Kj=!1,U=!1,Lj=\"function\"===typeof WeakSet?WeakSet:Set,V=null;function Mj(a,b){var c=a.ref;if(null!==c)if(\"function\"===typeof c)try{c(null)}catch(d){W(a,b,d)}else c.current=null}function Nj(a,b,c){try{c()}catch(d){W(a,b,d)}}var Oj=!1;\nfunction Pj(a,b){Cf=dd;a=Me();if(Ne(a)){if(\"selectionStart\"in a)var c={start:a.selectionStart,end:a.selectionEnd};else a:{c=(c=a.ownerDocument)&&c.defaultView||window;var d=c.getSelection&&c.getSelection();if(d&&0!==d.rangeCount){c=d.anchorNode;var e=d.anchorOffset,f=d.focusNode;d=d.focusOffset;try{c.nodeType,f.nodeType}catch(F){c=null;break a}var g=0,h=-1,k=-1,l=0,m=0,q=a,r=null;b:for(;;){for(var y;;){q!==c||0!==e&&3!==q.nodeType||(h=g+e);q!==f||0!==d&&3!==q.nodeType||(k=g+d);3===q.nodeType&&(g+=\nq.nodeValue.length);if(null===(y=q.firstChild))break;r=q;q=y}for(;;){if(q===a)break b;r===c&&++l===e&&(h=g);r===f&&++m===d&&(k=g);if(null!==(y=q.nextSibling))break;q=r;r=q.parentNode}q=y}c=-1===h||-1===k?null:{start:h,end:k}}else c=null}c=c||{start:0,end:0}}else c=null;Df={focusedElem:a,selectionRange:c};dd=!1;for(V=b;null!==V;)if(b=V,a=b.child,0!==(b.subtreeFlags&1028)&&null!==a)a.return=b,V=a;else for(;null!==V;){b=V;try{var n=b.alternate;if(0!==(b.flags&1024))switch(b.tag){case 0:case 11:case 15:break;\ncase 1:if(null!==n){var t=n.memoizedProps,J=n.memoizedState,x=b.stateNode,w=x.getSnapshotBeforeUpdate(b.elementType===b.type?t:Lg(b.type,t),J);x.__reactInternalSnapshotBeforeUpdate=w}break;case 3:var u=b.stateNode.containerInfo;1===u.nodeType?u.textContent=\"\":9===u.nodeType&&u.documentElement&&u.removeChild(u.documentElement);break;case 5:case 6:case 4:case 17:break;default:throw Error(p(163));}}catch(F){W(b,b.return,F)}a=b.sibling;if(null!==a){a.return=b.return;V=a;break}V=b.return}n=Oj;Oj=!1;return n}\nfunction Qj(a,b,c){var d=b.updateQueue;d=null!==d?d.lastEffect:null;if(null!==d){var e=d=d.next;do{if((e.tag&a)===a){var f=e.destroy;e.destroy=void 0;void 0!==f&&Nj(b,c,f)}e=e.next}while(e!==d)}}function Rj(a,b){b=b.updateQueue;b=null!==b?b.lastEffect:null;if(null!==b){var c=b=b.next;do{if((c.tag&a)===a){var d=c.create;c.destroy=d()}c=c.next}while(c!==b)}}function Sj(a){var b=a.ref;if(null!==b){var c=a.stateNode;switch(a.tag){case 5:a=c;break;default:a=c}\"function\"===typeof b?b(a):b.current=a}}\nfunction Tj(a){var b=a.alternate;null!==b&&(a.alternate=null,Tj(b));a.child=null;a.deletions=null;a.sibling=null;5===a.tag&&(b=a.stateNode,null!==b&&(delete b[Of],delete b[Pf],delete b[of],delete b[Qf],delete b[Rf]));a.stateNode=null;a.return=null;a.dependencies=null;a.memoizedProps=null;a.memoizedState=null;a.pendingProps=null;a.stateNode=null;a.updateQueue=null}function Uj(a){return 5===a.tag||3===a.tag||4===a.tag}\nfunction Vj(a){a:for(;;){for(;null===a.sibling;){if(null===a.return||Uj(a.return))return null;a=a.return}a.sibling.return=a.return;for(a=a.sibling;5!==a.tag&&6!==a.tag&&18!==a.tag;){if(a.flags&2)continue a;if(null===a.child||4===a.tag)continue a;else a.child.return=a,a=a.child}if(!(a.flags&2))return a.stateNode}}\nfunction Wj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?8===c.nodeType?c.parentNode.insertBefore(a,b):c.insertBefore(a,b):(8===c.nodeType?(b=c.parentNode,b.insertBefore(a,c)):(b=c,b.appendChild(a)),c=c._reactRootContainer,null!==c&&void 0!==c||null!==b.onclick||(b.onclick=Bf));else if(4!==d&&(a=a.child,null!==a))for(Wj(a,b,c),a=a.sibling;null!==a;)Wj(a,b,c),a=a.sibling}\nfunction Xj(a,b,c){var d=a.tag;if(5===d||6===d)a=a.stateNode,b?c.insertBefore(a,b):c.appendChild(a);else if(4!==d&&(a=a.child,null!==a))for(Xj(a,b,c),a=a.sibling;null!==a;)Xj(a,b,c),a=a.sibling}var X=null,Yj=!1;function Zj(a,b,c){for(c=c.child;null!==c;)ak(a,b,c),c=c.sibling}\nfunction ak(a,b,c){if(lc&&\"function\"===typeof lc.onCommitFiberUnmount)try{lc.onCommitFiberUnmount(kc,c)}catch(h){}switch(c.tag){case 5:U||Mj(c,b);case 6:var d=X,e=Yj;X=null;Zj(a,b,c);X=d;Yj=e;null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?a.parentNode.removeChild(c):a.removeChild(c)):X.removeChild(c.stateNode));break;case 18:null!==X&&(Yj?(a=X,c=c.stateNode,8===a.nodeType?Kf(a.parentNode,c):1===a.nodeType&&Kf(a,c),bd(a)):Kf(X,c.stateNode));break;case 4:d=X;e=Yj;X=c.stateNode.containerInfo;Yj=!0;\nZj(a,b,c);X=d;Yj=e;break;case 0:case 11:case 14:case 15:if(!U&&(d=c.updateQueue,null!==d&&(d=d.lastEffect,null!==d))){e=d=d.next;do{var f=e,g=f.destroy;f=f.tag;void 0!==g&&(0!==(f&2)?Nj(c,b,g):0!==(f&4)&&Nj(c,b,g));e=e.next}while(e!==d)}Zj(a,b,c);break;case 1:if(!U&&(Mj(c,b),d=c.stateNode,\"function\"===typeof d.componentWillUnmount))try{d.props=c.memoizedProps,d.state=c.memoizedState,d.componentWillUnmount()}catch(h){W(c,b,h)}Zj(a,b,c);break;case 21:Zj(a,b,c);break;case 22:c.mode&1?(U=(d=U)||null!==\nc.memoizedState,Zj(a,b,c),U=d):Zj(a,b,c);break;default:Zj(a,b,c)}}function bk(a){var b=a.updateQueue;if(null!==b){a.updateQueue=null;var c=a.stateNode;null===c&&(c=a.stateNode=new Lj);b.forEach(function(b){var d=ck.bind(null,a,b);c.has(b)||(c.add(b),b.then(d,d))})}}\nfunction dk(a,b){var c=b.deletions;if(null!==c)for(var d=0;de&&(e=g);d&=~f}d=e;d=B()-d;d=(120>d?120:480>d?480:1080>d?1080:1920>d?1920:3E3>d?3E3:4320>d?4320:1960*mk(d/1960))-d;if(10a?16:a;if(null===xk)var d=!1;else{a=xk;xk=null;yk=0;if(0!==(K&6))throw Error(p(331));var e=K;K|=4;for(V=a.current;null!==V;){var f=V,g=f.child;if(0!==(V.flags&16)){var h=f.deletions;if(null!==h){for(var k=0;kB()-gk?Lk(a,0):sk|=c);Ek(a,b)}function Zk(a,b){0===b&&(0===(a.mode&1)?b=1:(b=sc,sc<<=1,0===(sc&130023424)&&(sc=4194304)));var c=L();a=Zg(a,b);null!==a&&(Ac(a,b,c),Ek(a,c))}function vj(a){var b=a.memoizedState,c=0;null!==b&&(c=b.retryLane);Zk(a,c)}\nfunction ck(a,b){var c=0;switch(a.tag){case 13:var d=a.stateNode;var e=a.memoizedState;null!==e&&(c=e.retryLane);break;case 19:d=a.stateNode;break;default:throw Error(p(314));}null!==d&&d.delete(b);Zk(a,c)}var Wk;\nWk=function(a,b,c){if(null!==a)if(a.memoizedProps!==b.pendingProps||Wf.current)Ug=!0;else{if(0===(a.lanes&c)&&0===(b.flags&128))return Ug=!1,zj(a,b,c);Ug=0!==(a.flags&131072)?!0:!1}else Ug=!1,I&&0!==(b.flags&1048576)&&ug(b,ng,b.index);b.lanes=0;switch(b.tag){case 2:var d=b.type;jj(a,b);a=b.pendingProps;var e=Yf(b,H.current);Tg(b,c);e=Xh(null,b,d,a,e,c);var f=bi();b.flags|=1;\"object\"===typeof e&&null!==e&&\"function\"===typeof e.render&&void 0===e.$$typeof?(b.tag=1,b.memoizedState=null,b.updateQueue=\nnull,Zf(d)?(f=!0,cg(b)):f=!1,b.memoizedState=null!==e.state&&void 0!==e.state?e.state:null,ah(b),e.updater=nh,b.stateNode=e,e._reactInternals=b,rh(b,d,a,c),b=kj(null,b,d,!0,f,c)):(b.tag=0,I&&f&&vg(b),Yi(null,b,e,c),b=b.child);return b;case 16:d=b.elementType;a:{jj(a,b);a=b.pendingProps;e=d._init;d=e(d._payload);b.type=d;e=b.tag=$k(d);a=Lg(d,a);switch(e){case 0:b=dj(null,b,d,a,c);break a;case 1:b=ij(null,b,d,a,c);break a;case 11:b=Zi(null,b,d,a,c);break a;case 14:b=aj(null,b,d,Lg(d.type,a),c);break a}throw Error(p(306,\nd,\"\"));}return b;case 0:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),dj(a,b,d,e,c);case 1:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),ij(a,b,d,e,c);case 3:a:{lj(b);if(null===a)throw Error(p(387));d=b.pendingProps;f=b.memoizedState;e=f.element;bh(a,b);gh(b,d,null,c);var g=b.memoizedState;d=g.element;if(f.isDehydrated)if(f={element:d,isDehydrated:!1,cache:g.cache,pendingSuspenseBoundaries:g.pendingSuspenseBoundaries,transitions:g.transitions},b.updateQueue.baseState=\nf,b.memoizedState=f,b.flags&256){e=Ki(Error(p(423)),b);b=mj(a,b,d,c,e);break a}else if(d!==e){e=Ki(Error(p(424)),b);b=mj(a,b,d,c,e);break a}else for(yg=Lf(b.stateNode.containerInfo.firstChild),xg=b,I=!0,zg=null,c=Ch(b,null,d,c),b.child=c;c;)c.flags=c.flags&-3|4096,c=c.sibling;else{Ig();if(d===e){b=$i(a,b,c);break a}Yi(a,b,d,c)}b=b.child}return b;case 5:return Kh(b),null===a&&Eg(b),d=b.type,e=b.pendingProps,f=null!==a?a.memoizedProps:null,g=e.children,Ef(d,e)?g=null:null!==f&&Ef(d,f)&&(b.flags|=32),\nhj(a,b),Yi(a,b,g,c),b.child;case 6:return null===a&&Eg(b),null;case 13:return pj(a,b,c);case 4:return Ih(b,b.stateNode.containerInfo),d=b.pendingProps,null===a?b.child=Bh(b,null,d,c):Yi(a,b,d,c),b.child;case 11:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),Zi(a,b,d,e,c);case 7:return Yi(a,b,b.pendingProps,c),b.child;case 8:return Yi(a,b,b.pendingProps.children,c),b.child;case 12:return Yi(a,b,b.pendingProps.children,c),b.child;case 10:a:{d=b.type._context;e=b.pendingProps;f=b.memoizedProps;\ng=e.value;G(Mg,d._currentValue);d._currentValue=g;if(null!==f)if(He(f.value,g)){if(f.children===e.children&&!Wf.current){b=$i(a,b,c);break a}}else for(f=b.child,null!==f&&(f.return=b);null!==f;){var h=f.dependencies;if(null!==h){g=f.child;for(var k=h.firstContext;null!==k;){if(k.context===d){if(1===f.tag){k=ch(-1,c&-c);k.tag=2;var l=f.updateQueue;if(null!==l){l=l.shared;var m=l.pending;null===m?k.next=k:(k.next=m.next,m.next=k);l.pending=k}}f.lanes|=c;k=f.alternate;null!==k&&(k.lanes|=c);Sg(f.return,\nc,b);h.lanes|=c;break}k=k.next}}else if(10===f.tag)g=f.type===b.type?null:f.child;else if(18===f.tag){g=f.return;if(null===g)throw Error(p(341));g.lanes|=c;h=g.alternate;null!==h&&(h.lanes|=c);Sg(g,c,b);g=f.sibling}else g=f.child;if(null!==g)g.return=f;else for(g=f;null!==g;){if(g===b){g=null;break}f=g.sibling;if(null!==f){f.return=g.return;g=f;break}g=g.return}f=g}Yi(a,b,e.children,c);b=b.child}return b;case 9:return e=b.type,d=b.pendingProps.children,Tg(b,c),e=Vg(e),d=d(e),b.flags|=1,Yi(a,b,d,c),\nb.child;case 14:return d=b.type,e=Lg(d,b.pendingProps),e=Lg(d.type,e),aj(a,b,d,e,c);case 15:return cj(a,b,b.type,b.pendingProps,c);case 17:return d=b.type,e=b.pendingProps,e=b.elementType===d?e:Lg(d,e),jj(a,b),b.tag=1,Zf(d)?(a=!0,cg(b)):a=!1,Tg(b,c),ph(b,d,e),rh(b,d,e,c),kj(null,b,d,!0,a,c);case 19:return yj(a,b,c);case 22:return ej(a,b,c)}throw Error(p(156,b.tag));};function Gk(a,b){return ac(a,b)}\nfunction al(a,b,c,d){this.tag=a;this.key=c;this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null;this.index=0;this.ref=null;this.pendingProps=b;this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null;this.mode=d;this.subtreeFlags=this.flags=0;this.deletions=null;this.childLanes=this.lanes=0;this.alternate=null}function Bg(a,b,c,d){return new al(a,b,c,d)}function bj(a){a=a.prototype;return!(!a||!a.isReactComponent)}\nfunction $k(a){if(\"function\"===typeof a)return bj(a)?1:0;if(void 0!==a&&null!==a){a=a.$$typeof;if(a===Da)return 11;if(a===Ga)return 14}return 2}\nfunction wh(a,b){var c=a.alternate;null===c?(c=Bg(a.tag,b,a.key,a.mode),c.elementType=a.elementType,c.type=a.type,c.stateNode=a.stateNode,c.alternate=a,a.alternate=c):(c.pendingProps=b,c.type=a.type,c.flags=0,c.subtreeFlags=0,c.deletions=null);c.flags=a.flags&14680064;c.childLanes=a.childLanes;c.lanes=a.lanes;c.child=a.child;c.memoizedProps=a.memoizedProps;c.memoizedState=a.memoizedState;c.updateQueue=a.updateQueue;b=a.dependencies;c.dependencies=null===b?null:{lanes:b.lanes,firstContext:b.firstContext};\nc.sibling=a.sibling;c.index=a.index;c.ref=a.ref;return c}\nfunction yh(a,b,c,d,e,f){var g=2;d=a;if(\"function\"===typeof a)bj(a)&&(g=1);else if(\"string\"===typeof a)g=5;else a:switch(a){case ya:return Ah(c.children,e,f,b);case za:g=8;e|=8;break;case Aa:return a=Bg(12,c,b,e|2),a.elementType=Aa,a.lanes=f,a;case Ea:return a=Bg(13,c,b,e),a.elementType=Ea,a.lanes=f,a;case Fa:return a=Bg(19,c,b,e),a.elementType=Fa,a.lanes=f,a;case Ia:return qj(c,e,f,b);default:if(\"object\"===typeof a&&null!==a)switch(a.$$typeof){case Ba:g=10;break a;case Ca:g=9;break a;case Da:g=11;\nbreak a;case Ga:g=14;break a;case Ha:g=16;d=null;break a}throw Error(p(130,null==a?a:typeof a,\"\"));}b=Bg(g,c,b,e);b.elementType=a;b.type=d;b.lanes=f;return b}function Ah(a,b,c,d){a=Bg(7,a,d,b);a.lanes=c;return a}function qj(a,b,c,d){a=Bg(22,a,d,b);a.elementType=Ia;a.lanes=c;a.stateNode={isHidden:!1};return a}function xh(a,b,c){a=Bg(6,a,null,b);a.lanes=c;return a}\nfunction zh(a,b,c){b=Bg(4,null!==a.children?a.children:[],a.key,b);b.lanes=c;b.stateNode={containerInfo:a.containerInfo,pendingChildren:null,implementation:a.implementation};return b}\nfunction bl(a,b,c,d,e){this.tag=b;this.containerInfo=a;this.finishedWork=this.pingCache=this.current=this.pendingChildren=null;this.timeoutHandle=-1;this.callbackNode=this.pendingContext=this.context=null;this.callbackPriority=0;this.eventTimes=zc(0);this.expirationTimes=zc(-1);this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0;this.entanglements=zc(0);this.identifierPrefix=d;this.onRecoverableError=e;this.mutableSourceEagerHydrationData=\nnull}function cl(a,b,c,d,e,f,g,h,k){a=new bl(a,b,c,h,k);1===b?(b=1,!0===f&&(b|=8)):b=0;f=Bg(3,null,null,b);a.current=f;f.stateNode=a;f.memoizedState={element:d,isDehydrated:c,cache:null,transitions:null,pendingSuspenseBoundaries:null};ah(f);return a}function dl(a,b,c){var d=3> 1;\n return isNegative\n ? -shifted\n : shifted;\n}\n\n/**\n * Returns the base 64 VLQ encoded value.\n */\nexports.encode = function base64VLQ_encode(aValue) {\n var encoded = \"\";\n var digit;\n\n var vlq = toVLQSigned(aValue);\n\n do {\n digit = vlq & VLQ_BASE_MASK;\n vlq >>>= VLQ_BASE_SHIFT;\n if (vlq > 0) {\n // There are still more digits in this value, so we must make sure the\n // continuation bit is marked.\n digit |= VLQ_CONTINUATION_BIT;\n }\n encoded += base64.encode(digit);\n } while (vlq > 0);\n\n return encoded;\n};\n\n/**\n * Decodes the next base 64 VLQ value from the given string and returns the\n * value and the rest of the string via the out parameter.\n */\nexports.decode = function base64VLQ_decode(aStr, aIndex, aOutParam) {\n var strLen = aStr.length;\n var result = 0;\n var shift = 0;\n var continuation, digit;\n\n do {\n if (aIndex >= strLen) {\n throw new Error(\"Expected more digits in base 64 VLQ value.\");\n }\n\n digit = base64.decode(aStr.charCodeAt(aIndex++));\n if (digit === -1) {\n throw new Error(\"Invalid base64 digit: \" + aStr.charAt(aIndex - 1));\n }\n\n continuation = !!(digit & VLQ_CONTINUATION_BIT);\n digit &= VLQ_BASE_MASK;\n result = result + (digit << shift);\n shift += VLQ_BASE_SHIFT;\n } while (continuation);\n\n aOutParam.value = fromVLQSigned(result);\n aOutParam.rest = aIndex;\n};\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n/**\n * This is a helper function for getting values from parameter/options\n * objects.\n *\n * @param args The object we are extracting values from\n * @param name The name of the property we are getting.\n * @param defaultValue An optional value to return if the property is missing\n * from the object. If this is not specified and the property is missing, an\n * error will be thrown.\n */\nfunction getArg(aArgs, aName, aDefaultValue) {\n if (aName in aArgs) {\n return aArgs[aName];\n } else if (arguments.length === 3) {\n return aDefaultValue;\n } else {\n throw new Error('\"' + aName + '\" is a required argument.');\n }\n}\nexports.getArg = getArg;\n\nvar urlRegexp = /^(?:([\\w+\\-.]+):)?\\/\\/(?:(\\w+:\\w+)@)?([\\w.-]*)(?::(\\d+))?(.*)$/;\nvar dataUrlRegexp = /^data:.+\\,.+$/;\n\nfunction urlParse(aUrl) {\n var match = aUrl.match(urlRegexp);\n if (!match) {\n return null;\n }\n return {\n scheme: match[1],\n auth: match[2],\n host: match[3],\n port: match[4],\n path: match[5]\n };\n}\nexports.urlParse = urlParse;\n\nfunction urlGenerate(aParsedUrl) {\n var url = '';\n if (aParsedUrl.scheme) {\n url += aParsedUrl.scheme + ':';\n }\n url += '//';\n if (aParsedUrl.auth) {\n url += aParsedUrl.auth + '@';\n }\n if (aParsedUrl.host) {\n url += aParsedUrl.host;\n }\n if (aParsedUrl.port) {\n url += \":\" + aParsedUrl.port\n }\n if (aParsedUrl.path) {\n url += aParsedUrl.path;\n }\n return url;\n}\nexports.urlGenerate = urlGenerate;\n\n/**\n * Normalizes a path, or the path portion of a URL:\n *\n * - Replaces consecutive slashes with one slash.\n * - Removes unnecessary '.' parts.\n * - Removes unnecessary '/..' parts.\n *\n * Based on code in the Node.js 'path' core module.\n *\n * @param aPath The path or url to normalize.\n */\nfunction normalize(aPath) {\n var path = aPath;\n var url = urlParse(aPath);\n if (url) {\n if (!url.path) {\n return aPath;\n }\n path = url.path;\n }\n var isAbsolute = exports.isAbsolute(path);\n\n var parts = path.split(/\\/+/);\n for (var part, up = 0, i = parts.length - 1; i >= 0; i--) {\n part = parts[i];\n if (part === '.') {\n parts.splice(i, 1);\n } else if (part === '..') {\n up++;\n } else if (up > 0) {\n if (part === '') {\n // The first part is blank if the path is absolute. Trying to go\n // above the root is a no-op. Therefore we can remove all '..' parts\n // directly after the root.\n parts.splice(i + 1, up);\n up = 0;\n } else {\n parts.splice(i, 2);\n up--;\n }\n }\n }\n path = parts.join('/');\n\n if (path === '') {\n path = isAbsolute ? '/' : '.';\n }\n\n if (url) {\n url.path = path;\n return urlGenerate(url);\n }\n return path;\n}\nexports.normalize = normalize;\n\n/**\n * Joins two paths/URLs.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be joined with the root.\n *\n * - If aPath is a URL or a data URI, aPath is returned, unless aPath is a\n * scheme-relative URL: Then the scheme of aRoot, if any, is prepended\n * first.\n * - Otherwise aPath is a path. If aRoot is a URL, then its path portion\n * is updated with the result and aRoot is returned. Otherwise the result\n * is returned.\n * - If aPath is absolute, the result is aPath.\n * - Otherwise the two paths are joined with a slash.\n * - Joining for example 'http://' and 'www.example.com' is also supported.\n */\nfunction join(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n if (aPath === \"\") {\n aPath = \".\";\n }\n var aPathUrl = urlParse(aPath);\n var aRootUrl = urlParse(aRoot);\n if (aRootUrl) {\n aRoot = aRootUrl.path || '/';\n }\n\n // `join(foo, '//www.example.org')`\n if (aPathUrl && !aPathUrl.scheme) {\n if (aRootUrl) {\n aPathUrl.scheme = aRootUrl.scheme;\n }\n return urlGenerate(aPathUrl);\n }\n\n if (aPathUrl || aPath.match(dataUrlRegexp)) {\n return aPath;\n }\n\n // `join('http://', 'www.example.com')`\n if (aRootUrl && !aRootUrl.host && !aRootUrl.path) {\n aRootUrl.host = aPath;\n return urlGenerate(aRootUrl);\n }\n\n var joined = aPath.charAt(0) === '/'\n ? aPath\n : normalize(aRoot.replace(/\\/+$/, '') + '/' + aPath);\n\n if (aRootUrl) {\n aRootUrl.path = joined;\n return urlGenerate(aRootUrl);\n }\n return joined;\n}\nexports.join = join;\n\nexports.isAbsolute = function (aPath) {\n return aPath.charAt(0) === '/' || urlRegexp.test(aPath);\n};\n\n/**\n * Make a path relative to a URL or another path.\n *\n * @param aRoot The root path or URL.\n * @param aPath The path or URL to be made relative to aRoot.\n */\nfunction relative(aRoot, aPath) {\n if (aRoot === \"\") {\n aRoot = \".\";\n }\n\n aRoot = aRoot.replace(/\\/$/, '');\n\n // It is possible for the path to be above the root. In this case, simply\n // checking whether the root is a prefix of the path won't work. Instead, we\n // need to remove components from the root one by one, until either we find\n // a prefix that fits, or we run out of components to remove.\n var level = 0;\n while (aPath.indexOf(aRoot + '/') !== 0) {\n var index = aRoot.lastIndexOf(\"/\");\n if (index < 0) {\n return aPath;\n }\n\n // If the only part of the root that is left is the scheme (i.e. http://,\n // file:///, etc.), one or more slashes (/), or simply nothing at all, we\n // have exhausted all components, so the path is not relative to the root.\n aRoot = aRoot.slice(0, index);\n if (aRoot.match(/^([^\\/]+:\\/)?\\/*$/)) {\n return aPath;\n }\n\n ++level;\n }\n\n // Make sure we add a \"../\" for each component we removed from the root.\n return Array(level + 1).join(\"../\") + aPath.substr(aRoot.length + 1);\n}\nexports.relative = relative;\n\nvar supportsNullProto = (function () {\n var obj = Object.create(null);\n return !('__proto__' in obj);\n}());\n\nfunction identity (s) {\n return s;\n}\n\n/**\n * Because behavior goes wacky when you set `__proto__` on objects, we\n * have to prefix all the strings in our set with an arbitrary character.\n *\n * See https://github.com/mozilla/source-map/pull/31 and\n * https://github.com/mozilla/source-map/issues/30\n *\n * @param String aStr\n */\nfunction toSetString(aStr) {\n if (isProtoString(aStr)) {\n return '$' + aStr;\n }\n\n return aStr;\n}\nexports.toSetString = supportsNullProto ? identity : toSetString;\n\nfunction fromSetString(aStr) {\n if (isProtoString(aStr)) {\n return aStr.slice(1);\n }\n\n return aStr;\n}\nexports.fromSetString = supportsNullProto ? identity : fromSetString;\n\nfunction isProtoString(s) {\n if (!s) {\n return false;\n }\n\n var length = s.length;\n\n if (length < 9 /* \"__proto__\".length */) {\n return false;\n }\n\n if (s.charCodeAt(length - 1) !== 95 /* '_' */ ||\n s.charCodeAt(length - 2) !== 95 /* '_' */ ||\n s.charCodeAt(length - 3) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 4) !== 116 /* 't' */ ||\n s.charCodeAt(length - 5) !== 111 /* 'o' */ ||\n s.charCodeAt(length - 6) !== 114 /* 'r' */ ||\n s.charCodeAt(length - 7) !== 112 /* 'p' */ ||\n s.charCodeAt(length - 8) !== 95 /* '_' */ ||\n s.charCodeAt(length - 9) !== 95 /* '_' */) {\n return false;\n }\n\n for (var i = length - 10; i >= 0; i--) {\n if (s.charCodeAt(i) !== 36 /* '$' */) {\n return false;\n }\n }\n\n return true;\n}\n\n/**\n * Comparator between two mappings where the original positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same original source/line/column, but different generated\n * line and column the same. Useful when searching for a mapping with a\n * stubbed out mapping.\n */\nfunction compareByOriginalPositions(mappingA, mappingB, onlyCompareOriginal) {\n var cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0 || onlyCompareOriginal) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByOriginalPositions = compareByOriginalPositions;\n\n/**\n * Comparator between two mappings with deflated source and name indices where\n * the generated positions are compared.\n *\n * Optionally pass in `true` as `onlyCompareGenerated` to consider two\n * mappings with the same generated line and column, but different\n * source/name/original line and column the same. Useful when searching for a\n * mapping with a stubbed out mapping.\n */\nfunction compareByGeneratedPositionsDeflated(mappingA, mappingB, onlyCompareGenerated) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0 || onlyCompareGenerated) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsDeflated = compareByGeneratedPositionsDeflated;\n\nfunction strcmp(aStr1, aStr2) {\n if (aStr1 === aStr2) {\n return 0;\n }\n\n if (aStr1 === null) {\n return 1; // aStr2 !== null\n }\n\n if (aStr2 === null) {\n return -1; // aStr1 !== null\n }\n\n if (aStr1 > aStr2) {\n return 1;\n }\n\n return -1;\n}\n\n/**\n * Comparator between two mappings with inflated source and name strings where\n * the generated positions are compared.\n */\nfunction compareByGeneratedPositionsInflated(mappingA, mappingB) {\n var cmp = mappingA.generatedLine - mappingB.generatedLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.generatedColumn - mappingB.generatedColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = strcmp(mappingA.source, mappingB.source);\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalLine - mappingB.originalLine;\n if (cmp !== 0) {\n return cmp;\n }\n\n cmp = mappingA.originalColumn - mappingB.originalColumn;\n if (cmp !== 0) {\n return cmp;\n }\n\n return strcmp(mappingA.name, mappingB.name);\n}\nexports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflated;\n\n/**\n * Strip any JSON XSSI avoidance prefix from the string (as documented\n * in the source maps specification), and then parse the string as\n * JSON.\n */\nfunction parseSourceMapInput(str) {\n return JSON.parse(str.replace(/^\\)]}'[^\\n]*\\n/, ''));\n}\nexports.parseSourceMapInput = parseSourceMapInput;\n\n/**\n * Compute the URL of a source given the the source root, the source's\n * URL, and the source map's URL.\n */\nfunction computeSourceURL(sourceRoot, sourceURL, sourceMapURL) {\n sourceURL = sourceURL || '';\n\n if (sourceRoot) {\n // This follows what Chrome does.\n if (sourceRoot[sourceRoot.length - 1] !== '/' && sourceURL[0] !== '/') {\n sourceRoot += '/';\n }\n // The spec says:\n // Line 4: An optional source root, useful for relocating source\n // files on a server or removing repeated values in the\n // \u201Csources\u201D entry. This value is prepended to the individual\n // entries in the \u201Csource\u201D field.\n sourceURL = sourceRoot + sourceURL;\n }\n\n // Historically, SourceMapConsumer did not take the sourceMapURL as\n // a parameter. This mode is still somewhat supported, which is why\n // this code block is conditional. However, it's preferable to pass\n // the source map URL to SourceMapConsumer, so that this function\n // can implement the source URL resolution algorithm as outlined in\n // the spec. This block is basically the equivalent of:\n // new URL(sourceURL, sourceMapURL).toString()\n // ... except it avoids using URL, which wasn't available in the\n // older releases of node still supported by this library.\n //\n // The spec says:\n // If the sources are not absolute URLs after prepending of the\n // \u201CsourceRoot\u201D, the sources are resolved relative to the\n // SourceMap (like resolving script src in a html document).\n if (sourceMapURL) {\n var parsed = urlParse(sourceMapURL);\n if (!parsed) {\n throw new Error(\"sourceMapURL could not be parsed\");\n }\n if (parsed.path) {\n // Strip the last path component, but keep the \"/\".\n var index = parsed.path.lastIndexOf('/');\n if (index >= 0) {\n parsed.path = parsed.path.substring(0, index + 1);\n }\n }\n sourceURL = join(urlGenerate(parsed), sourceURL);\n }\n\n return normalize(sourceURL);\n}\nexports.computeSourceURL = computeSourceURL;\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar has = Object.prototype.hasOwnProperty;\nvar hasNativeMap = typeof Map !== \"undefined\";\n\n/**\n * A data structure which is a combination of an array and a set. Adding a new\n * member is O(1), testing for membership is O(1), and finding the index of an\n * element is O(1). Removing elements from the set is not supported. Only\n * strings are supported for membership.\n */\nfunction ArraySet() {\n this._array = [];\n this._set = hasNativeMap ? new Map() : Object.create(null);\n}\n\n/**\n * Static method for creating ArraySet instances from an existing array.\n */\nArraySet.fromArray = function ArraySet_fromArray(aArray, aAllowDuplicates) {\n var set = new ArraySet();\n for (var i = 0, len = aArray.length; i < len; i++) {\n set.add(aArray[i], aAllowDuplicates);\n }\n return set;\n};\n\n/**\n * Return how many unique items are in this ArraySet. If duplicates have been\n * added, than those do not count towards the size.\n *\n * @returns Number\n */\nArraySet.prototype.size = function ArraySet_size() {\n return hasNativeMap ? this._set.size : Object.getOwnPropertyNames(this._set).length;\n};\n\n/**\n * Add the given string to this set.\n *\n * @param String aStr\n */\nArraySet.prototype.add = function ArraySet_add(aStr, aAllowDuplicates) {\n var sStr = hasNativeMap ? aStr : util.toSetString(aStr);\n var isDuplicate = hasNativeMap ? this.has(aStr) : has.call(this._set, sStr);\n var idx = this._array.length;\n if (!isDuplicate || aAllowDuplicates) {\n this._array.push(aStr);\n }\n if (!isDuplicate) {\n if (hasNativeMap) {\n this._set.set(aStr, idx);\n } else {\n this._set[sStr] = idx;\n }\n }\n};\n\n/**\n * Is the given string a member of this set?\n *\n * @param String aStr\n */\nArraySet.prototype.has = function ArraySet_has(aStr) {\n if (hasNativeMap) {\n return this._set.has(aStr);\n } else {\n var sStr = util.toSetString(aStr);\n return has.call(this._set, sStr);\n }\n};\n\n/**\n * What is the index of the given string in the array?\n *\n * @param String aStr\n */\nArraySet.prototype.indexOf = function ArraySet_indexOf(aStr) {\n if (hasNativeMap) {\n var idx = this._set.get(aStr);\n if (idx >= 0) {\n return idx;\n }\n } else {\n var sStr = util.toSetString(aStr);\n if (has.call(this._set, sStr)) {\n return this._set[sStr];\n }\n }\n\n throw new Error('\"' + aStr + '\" is not in the set.');\n};\n\n/**\n * What is the element at the given index?\n *\n * @param Number aIdx\n */\nArraySet.prototype.at = function ArraySet_at(aIdx) {\n if (aIdx >= 0 && aIdx < this._array.length) {\n return this._array[aIdx];\n }\n throw new Error('No element indexed by ' + aIdx);\n};\n\n/**\n * Returns the array representation of this set (which has the proper indices\n * indicated by indexOf). Note that this is a copy of the internal array used\n * for storing the members so that no one can mess with internal state.\n */\nArraySet.prototype.toArray = function ArraySet_toArray() {\n return this._array.slice();\n};\n\nexports.ArraySet = ArraySet;\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2014 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\n\n/**\n * Determine whether mappingB is after mappingA with respect to generated\n * position.\n */\nfunction generatedPositionAfter(mappingA, mappingB) {\n // Optimized for most common case\n var lineA = mappingA.generatedLine;\n var lineB = mappingB.generatedLine;\n var columnA = mappingA.generatedColumn;\n var columnB = mappingB.generatedColumn;\n return lineB > lineA || lineB == lineA && columnB >= columnA ||\n util.compareByGeneratedPositionsInflated(mappingA, mappingB) <= 0;\n}\n\n/**\n * A data structure to provide a sorted view of accumulated mappings in a\n * performance conscious manner. It trades a neglibable overhead in general\n * case for a large speedup in case of mappings being added in order.\n */\nfunction MappingList() {\n this._array = [];\n this._sorted = true;\n // Serves as infimum\n this._last = {generatedLine: -1, generatedColumn: 0};\n}\n\n/**\n * Iterate through internal items. This method takes the same arguments that\n * `Array.prototype.forEach` takes.\n *\n * NOTE: The order of the mappings is NOT guaranteed.\n */\nMappingList.prototype.unsortedForEach =\n function MappingList_forEach(aCallback, aThisArg) {\n this._array.forEach(aCallback, aThisArg);\n };\n\n/**\n * Add the given source mapping.\n *\n * @param Object aMapping\n */\nMappingList.prototype.add = function MappingList_add(aMapping) {\n if (generatedPositionAfter(this._last, aMapping)) {\n this._last = aMapping;\n this._array.push(aMapping);\n } else {\n this._sorted = false;\n this._array.push(aMapping);\n }\n};\n\n/**\n * Returns the flat, sorted array of mappings. The mappings are sorted by\n * generated position.\n *\n * WARNING: This method returns internal data without copying, for\n * performance. The return value must NOT be mutated, and should be treated as\n * an immutable borrow. If you want to take ownership, you must make your own\n * copy.\n */\nMappingList.prototype.toArray = function MappingList_toArray() {\n if (!this._sorted) {\n this._array.sort(util.compareByGeneratedPositionsInflated);\n this._sorted = true;\n }\n return this._array;\n};\n\nexports.MappingList = MappingList;\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar base64VLQ = require('./base64-vlq');\nvar util = require('./util');\nvar ArraySet = require('./array-set').ArraySet;\nvar MappingList = require('./mapping-list').MappingList;\n\n/**\n * An instance of the SourceMapGenerator represents a source map which is\n * being built incrementally. You may pass an object with the following\n * properties:\n *\n * - file: The filename of the generated source.\n * - sourceRoot: A root for all relative URLs in this source map.\n */\nfunction SourceMapGenerator(aArgs) {\n if (!aArgs) {\n aArgs = {};\n }\n this._file = util.getArg(aArgs, 'file', null);\n this._sourceRoot = util.getArg(aArgs, 'sourceRoot', null);\n this._skipValidation = util.getArg(aArgs, 'skipValidation', false);\n this._sources = new ArraySet();\n this._names = new ArraySet();\n this._mappings = new MappingList();\n this._sourcesContents = null;\n}\n\nSourceMapGenerator.prototype._version = 3;\n\n/**\n * Creates a new SourceMapGenerator based on a SourceMapConsumer\n *\n * @param aSourceMapConsumer The SourceMap.\n */\nSourceMapGenerator.fromSourceMap =\n function SourceMapGenerator_fromSourceMap(aSourceMapConsumer) {\n var sourceRoot = aSourceMapConsumer.sourceRoot;\n var generator = new SourceMapGenerator({\n file: aSourceMapConsumer.file,\n sourceRoot: sourceRoot\n });\n aSourceMapConsumer.eachMapping(function (mapping) {\n var newMapping = {\n generated: {\n line: mapping.generatedLine,\n column: mapping.generatedColumn\n }\n };\n\n if (mapping.source != null) {\n newMapping.source = mapping.source;\n if (sourceRoot != null) {\n newMapping.source = util.relative(sourceRoot, newMapping.source);\n }\n\n newMapping.original = {\n line: mapping.originalLine,\n column: mapping.originalColumn\n };\n\n if (mapping.name != null) {\n newMapping.name = mapping.name;\n }\n }\n\n generator.addMapping(newMapping);\n });\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var sourceRelative = sourceFile;\n if (sourceRoot !== null) {\n sourceRelative = util.relative(sourceRoot, sourceFile);\n }\n\n if (!generator._sources.has(sourceRelative)) {\n generator._sources.add(sourceRelative);\n }\n\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n generator.setSourceContent(sourceFile, content);\n }\n });\n return generator;\n };\n\n/**\n * Add a single mapping from original source line and column to the generated\n * source's line and column for this source map being created. The mapping\n * object should have the following properties:\n *\n * - generated: An object with the generated line and column positions.\n * - original: An object with the original line and column positions.\n * - source: The original source file (relative to the sourceRoot).\n * - name: An optional original token name for this mapping.\n */\nSourceMapGenerator.prototype.addMapping =\n function SourceMapGenerator_addMapping(aArgs) {\n var generated = util.getArg(aArgs, 'generated');\n var original = util.getArg(aArgs, 'original', null);\n var source = util.getArg(aArgs, 'source', null);\n var name = util.getArg(aArgs, 'name', null);\n\n if (!this._skipValidation) {\n this._validateMapping(generated, original, source, name);\n }\n\n if (source != null) {\n source = String(source);\n if (!this._sources.has(source)) {\n this._sources.add(source);\n }\n }\n\n if (name != null) {\n name = String(name);\n if (!this._names.has(name)) {\n this._names.add(name);\n }\n }\n\n this._mappings.add({\n generatedLine: generated.line,\n generatedColumn: generated.column,\n originalLine: original != null && original.line,\n originalColumn: original != null && original.column,\n source: source,\n name: name\n });\n };\n\n/**\n * Set the source content for a source file.\n */\nSourceMapGenerator.prototype.setSourceContent =\n function SourceMapGenerator_setSourceContent(aSourceFile, aSourceContent) {\n var source = aSourceFile;\n if (this._sourceRoot != null) {\n source = util.relative(this._sourceRoot, source);\n }\n\n if (aSourceContent != null) {\n // Add the source content to the _sourcesContents map.\n // Create a new _sourcesContents map if the property is null.\n if (!this._sourcesContents) {\n this._sourcesContents = Object.create(null);\n }\n this._sourcesContents[util.toSetString(source)] = aSourceContent;\n } else if (this._sourcesContents) {\n // Remove the source file from the _sourcesContents map.\n // If the _sourcesContents map is empty, set the property to null.\n delete this._sourcesContents[util.toSetString(source)];\n if (Object.keys(this._sourcesContents).length === 0) {\n this._sourcesContents = null;\n }\n }\n };\n\n/**\n * Applies the mappings of a sub-source-map for a specific source file to the\n * source map being generated. Each mapping to the supplied source file is\n * rewritten using the supplied source map. Note: The resolution for the\n * resulting mappings is the minimium of this map and the supplied map.\n *\n * @param aSourceMapConsumer The source map to be applied.\n * @param aSourceFile Optional. The filename of the source file.\n * If omitted, SourceMapConsumer's file property will be used.\n * @param aSourceMapPath Optional. The dirname of the path to the source map\n * to be applied. If relative, it is relative to the SourceMapConsumer.\n * This parameter is needed when the two source maps aren't in the same\n * directory, and the source map to be applied contains relative source\n * paths. If so, those relative source paths need to be rewritten\n * relative to the SourceMapGenerator.\n */\nSourceMapGenerator.prototype.applySourceMap =\n function SourceMapGenerator_applySourceMap(aSourceMapConsumer, aSourceFile, aSourceMapPath) {\n var sourceFile = aSourceFile;\n // If aSourceFile is omitted, we will use the file property of the SourceMap\n if (aSourceFile == null) {\n if (aSourceMapConsumer.file == null) {\n throw new Error(\n 'SourceMapGenerator.prototype.applySourceMap requires either an explicit source file, ' +\n 'or the source map\\'s \"file\" property. Both were omitted.'\n );\n }\n sourceFile = aSourceMapConsumer.file;\n }\n var sourceRoot = this._sourceRoot;\n // Make \"sourceFile\" relative if an absolute Url is passed.\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n // Applying the SourceMap can add and remove items from the sources and\n // the names array.\n var newSources = new ArraySet();\n var newNames = new ArraySet();\n\n // Find mappings for the \"sourceFile\"\n this._mappings.unsortedForEach(function (mapping) {\n if (mapping.source === sourceFile && mapping.originalLine != null) {\n // Check if it can be mapped by the source map, then update the mapping.\n var original = aSourceMapConsumer.originalPositionFor({\n line: mapping.originalLine,\n column: mapping.originalColumn\n });\n if (original.source != null) {\n // Copy mapping\n mapping.source = original.source;\n if (aSourceMapPath != null) {\n mapping.source = util.join(aSourceMapPath, mapping.source)\n }\n if (sourceRoot != null) {\n mapping.source = util.relative(sourceRoot, mapping.source);\n }\n mapping.originalLine = original.line;\n mapping.originalColumn = original.column;\n if (original.name != null) {\n mapping.name = original.name;\n }\n }\n }\n\n var source = mapping.source;\n if (source != null && !newSources.has(source)) {\n newSources.add(source);\n }\n\n var name = mapping.name;\n if (name != null && !newNames.has(name)) {\n newNames.add(name);\n }\n\n }, this);\n this._sources = newSources;\n this._names = newNames;\n\n // Copy sourcesContents of applied map.\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aSourceMapPath != null) {\n sourceFile = util.join(aSourceMapPath, sourceFile);\n }\n if (sourceRoot != null) {\n sourceFile = util.relative(sourceRoot, sourceFile);\n }\n this.setSourceContent(sourceFile, content);\n }\n }, this);\n };\n\n/**\n * A mapping can have one of the three levels of data:\n *\n * 1. Just the generated position.\n * 2. The Generated position, original position, and original source.\n * 3. Generated and original position, original source, as well as a name\n * token.\n *\n * To maintain consistency, we validate that any new mapping being added falls\n * in to one of these categories.\n */\nSourceMapGenerator.prototype._validateMapping =\n function SourceMapGenerator_validateMapping(aGenerated, aOriginal, aSource,\n aName) {\n // When aOriginal is truthy but has empty values for .line and .column,\n // it is most likely a programmer error. In this case we throw a very\n // specific error message to try to guide them the right way.\n // For example: https://github.com/Polymer/polymer-bundler/pull/519\n if (aOriginal && typeof aOriginal.line !== 'number' && typeof aOriginal.column !== 'number') {\n throw new Error(\n 'original.line and original.column are not numbers -- you probably meant to omit ' +\n 'the original mapping entirely and only map the generated position. If so, pass ' +\n 'null for the original mapping instead of an object with empty or null values.'\n );\n }\n\n if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aGenerated.line > 0 && aGenerated.column >= 0\n && !aOriginal && !aSource && !aName) {\n // Case 1.\n return;\n }\n else if (aGenerated && 'line' in aGenerated && 'column' in aGenerated\n && aOriginal && 'line' in aOriginal && 'column' in aOriginal\n && aGenerated.line > 0 && aGenerated.column >= 0\n && aOriginal.line > 0 && aOriginal.column >= 0\n && aSource) {\n // Cases 2 and 3.\n return;\n }\n else {\n throw new Error('Invalid mapping: ' + JSON.stringify({\n generated: aGenerated,\n source: aSource,\n original: aOriginal,\n name: aName\n }));\n }\n };\n\n/**\n * Serialize the accumulated mappings in to the stream of base 64 VLQs\n * specified by the source map format.\n */\nSourceMapGenerator.prototype._serializeMappings =\n function SourceMapGenerator_serializeMappings() {\n var previousGeneratedColumn = 0;\n var previousGeneratedLine = 1;\n var previousOriginalColumn = 0;\n var previousOriginalLine = 0;\n var previousName = 0;\n var previousSource = 0;\n var result = '';\n var next;\n var mapping;\n var nameIdx;\n var sourceIdx;\n\n var mappings = this._mappings.toArray();\n for (var i = 0, len = mappings.length; i < len; i++) {\n mapping = mappings[i];\n next = ''\n\n if (mapping.generatedLine !== previousGeneratedLine) {\n previousGeneratedColumn = 0;\n while (mapping.generatedLine !== previousGeneratedLine) {\n next += ';';\n previousGeneratedLine++;\n }\n }\n else {\n if (i > 0) {\n if (!util.compareByGeneratedPositionsInflated(mapping, mappings[i - 1])) {\n continue;\n }\n next += ',';\n }\n }\n\n next += base64VLQ.encode(mapping.generatedColumn\n - previousGeneratedColumn);\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (mapping.source != null) {\n sourceIdx = this._sources.indexOf(mapping.source);\n next += base64VLQ.encode(sourceIdx - previousSource);\n previousSource = sourceIdx;\n\n // lines are stored 0-based in SourceMap spec version 3\n next += base64VLQ.encode(mapping.originalLine - 1\n - previousOriginalLine);\n previousOriginalLine = mapping.originalLine - 1;\n\n next += base64VLQ.encode(mapping.originalColumn\n - previousOriginalColumn);\n previousOriginalColumn = mapping.originalColumn;\n\n if (mapping.name != null) {\n nameIdx = this._names.indexOf(mapping.name);\n next += base64VLQ.encode(nameIdx - previousName);\n previousName = nameIdx;\n }\n }\n\n result += next;\n }\n\n return result;\n };\n\nSourceMapGenerator.prototype._generateSourcesContent =\n function SourceMapGenerator_generateSourcesContent(aSources, aSourceRoot) {\n return aSources.map(function (source) {\n if (!this._sourcesContents) {\n return null;\n }\n if (aSourceRoot != null) {\n source = util.relative(aSourceRoot, source);\n }\n var key = util.toSetString(source);\n return Object.prototype.hasOwnProperty.call(this._sourcesContents, key)\n ? this._sourcesContents[key]\n : null;\n }, this);\n };\n\n/**\n * Externalize the source map.\n */\nSourceMapGenerator.prototype.toJSON =\n function SourceMapGenerator_toJSON() {\n var map = {\n version: this._version,\n sources: this._sources.toArray(),\n names: this._names.toArray(),\n mappings: this._serializeMappings()\n };\n if (this._file != null) {\n map.file = this._file;\n }\n if (this._sourceRoot != null) {\n map.sourceRoot = this._sourceRoot;\n }\n if (this._sourcesContents) {\n map.sourcesContent = this._generateSourcesContent(map.sources, map.sourceRoot);\n }\n\n return map;\n };\n\n/**\n * Render the source map being generated to a string.\n */\nSourceMapGenerator.prototype.toString =\n function SourceMapGenerator_toString() {\n return JSON.stringify(this.toJSON());\n };\n\nexports.SourceMapGenerator = SourceMapGenerator;\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nexports.GREATEST_LOWER_BOUND = 1;\nexports.LEAST_UPPER_BOUND = 2;\n\n/**\n * Recursive implementation of binary search.\n *\n * @param aLow Indices here and lower do not contain the needle.\n * @param aHigh Indices here and higher do not contain the needle.\n * @param aNeedle The element being searched for.\n * @param aHaystack The non-empty array being searched.\n * @param aCompare Function which takes two elements and returns -1, 0, or 1.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n */\nfunction recursiveSearch(aLow, aHigh, aNeedle, aHaystack, aCompare, aBias) {\n // This function terminates when one of the following is true:\n //\n // 1. We find the exact element we are looking for.\n //\n // 2. We did not find the exact element, but we can return the index of\n // the next-closest element.\n //\n // 3. We did not find the exact element, and there is no next-closest\n // element than the one we are searching for, so we return -1.\n var mid = Math.floor((aHigh - aLow) / 2) + aLow;\n var cmp = aCompare(aNeedle, aHaystack[mid], true);\n if (cmp === 0) {\n // Found the element we are looking for.\n return mid;\n }\n else if (cmp > 0) {\n // Our needle is greater than aHaystack[mid].\n if (aHigh - mid > 1) {\n // The element is in the upper half.\n return recursiveSearch(mid, aHigh, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // The exact needle element was not found in this haystack. Determine if\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return aHigh < aHaystack.length ? aHigh : -1;\n } else {\n return mid;\n }\n }\n else {\n // Our needle is less than aHaystack[mid].\n if (mid - aLow > 1) {\n // The element is in the lower half.\n return recursiveSearch(aLow, mid, aNeedle, aHaystack, aCompare, aBias);\n }\n\n // we are in termination case (3) or (2) and return the appropriate thing.\n if (aBias == exports.LEAST_UPPER_BOUND) {\n return mid;\n } else {\n return aLow < 0 ? -1 : aLow;\n }\n }\n}\n\n/**\n * This is an implementation of binary search which will always try and return\n * the index of the closest element if there is no exact hit. This is because\n * mappings between original and generated line/col pairs are single points,\n * and there is an implicit region between each of them, so a miss just means\n * that you aren't on the very start of a region.\n *\n * @param aNeedle The element you are looking for.\n * @param aHaystack The array that is being searched.\n * @param aCompare A function which takes the needle and an element in the\n * array and returns -1, 0, or 1 depending on whether the needle is less\n * than, equal to, or greater than the element, respectively.\n * @param aBias Either 'binarySearch.GREATEST_LOWER_BOUND' or\n * 'binarySearch.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'binarySearch.GREATEST_LOWER_BOUND'.\n */\nexports.search = function search(aNeedle, aHaystack, aCompare, aBias) {\n if (aHaystack.length === 0) {\n return -1;\n }\n\n var index = recursiveSearch(-1, aHaystack.length, aNeedle, aHaystack,\n aCompare, aBias || exports.GREATEST_LOWER_BOUND);\n if (index < 0) {\n return -1;\n }\n\n // We have found either the exact element, or the next-closest element than\n // the one we are searching for. However, there may be more than one such\n // element. Make sure we always return the smallest of these.\n while (index - 1 >= 0) {\n if (aCompare(aHaystack[index], aHaystack[index - 1], true) !== 0) {\n break;\n }\n --index;\n }\n\n return index;\n};\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\n// It turns out that some (most?) JavaScript engines don't self-host\n// `Array.prototype.sort`. This makes sense because C++ will likely remain\n// faster than JS when doing raw CPU-intensive sorting. However, when using a\n// custom comparator function, calling back and forth between the VM's C++ and\n// JIT'd JS is rather slow *and* loses JIT type information, resulting in\n// worse generated code for the comparator function than would be optimal. In\n// fact, when sorting with a comparator, these costs outweigh the benefits of\n// sorting in C++. By using our own JS-implemented Quick Sort (below), we get\n// a ~3500ms mean speed-up in `bench/bench.html`.\n\n/**\n * Swap the elements indexed by `x` and `y` in the array `ary`.\n *\n * @param {Array} ary\n * The array.\n * @param {Number} x\n * The index of the first item.\n * @param {Number} y\n * The index of the second item.\n */\nfunction swap(ary, x, y) {\n var temp = ary[x];\n ary[x] = ary[y];\n ary[y] = temp;\n}\n\n/**\n * Returns a random integer within the range `low .. high` inclusive.\n *\n * @param {Number} low\n * The lower bound on the range.\n * @param {Number} high\n * The upper bound on the range.\n */\nfunction randomIntInRange(low, high) {\n return Math.round(low + (Math.random() * (high - low)));\n}\n\n/**\n * The Quick Sort algorithm.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n * @param {Number} p\n * Start index of the array\n * @param {Number} r\n * End index of the array\n */\nfunction doQuickSort(ary, comparator, p, r) {\n // If our lower bound is less than our upper bound, we (1) partition the\n // array into two pieces and (2) recurse on each half. If it is not, this is\n // the empty array and our base case.\n\n if (p < r) {\n // (1) Partitioning.\n //\n // The partitioning chooses a pivot between `p` and `r` and moves all\n // elements that are less than or equal to the pivot to the before it, and\n // all the elements that are greater than it after it. The effect is that\n // once partition is done, the pivot is in the exact place it will be when\n // the array is put in sorted order, and it will not need to be moved\n // again. This runs in O(n) time.\n\n // Always choose a random pivot so that an input array which is reverse\n // sorted does not cause O(n^2) running time.\n var pivotIndex = randomIntInRange(p, r);\n var i = p - 1;\n\n swap(ary, pivotIndex, r);\n var pivot = ary[r];\n\n // Immediately after `j` is incremented in this loop, the following hold\n // true:\n //\n // * Every element in `ary[p .. i]` is less than or equal to the pivot.\n //\n // * Every element in `ary[i+1 .. j-1]` is greater than the pivot.\n for (var j = p; j < r; j++) {\n if (comparator(ary[j], pivot) <= 0) {\n i += 1;\n swap(ary, i, j);\n }\n }\n\n swap(ary, i + 1, j);\n var q = i + 1;\n\n // (2) Recurse on each half.\n\n doQuickSort(ary, comparator, p, q - 1);\n doQuickSort(ary, comparator, q + 1, r);\n }\n}\n\n/**\n * Sort the given array in-place with the given comparator function.\n *\n * @param {Array} ary\n * An array to sort.\n * @param {function} comparator\n * Function to use to compare two items.\n */\nexports.quickSort = function (ary, comparator) {\n doQuickSort(ary, comparator, 0, ary.length - 1);\n};\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar util = require('./util');\nvar binarySearch = require('./binary-search');\nvar ArraySet = require('./array-set').ArraySet;\nvar base64VLQ = require('./base64-vlq');\nvar quickSort = require('./quick-sort').quickSort;\n\nfunction SourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n return sourceMap.sections != null\n ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)\n : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);\n}\n\nSourceMapConsumer.fromSourceMap = function(aSourceMap, aSourceMapURL) {\n return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);\n}\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nSourceMapConsumer.prototype._version = 3;\n\n// `__generatedMappings` and `__originalMappings` are arrays that hold the\n// parsed mapping coordinates from the source map's \"mappings\" attribute. They\n// are lazily instantiated, accessed via the `_generatedMappings` and\n// `_originalMappings` getters respectively, and we only parse the mappings\n// and create these arrays once queried for a source location. We jump through\n// these hoops because there can be many thousands of mappings, and parsing\n// them is expensive, so we only want to do it if we must.\n//\n// Each object in the arrays is of the form:\n//\n// {\n// generatedLine: The line number in the generated code,\n// generatedColumn: The column number in the generated code,\n// source: The path to the original source file that generated this\n// chunk of code,\n// originalLine: The line number in the original source that\n// corresponds to this chunk of generated code,\n// originalColumn: The column number in the original source that\n// corresponds to this chunk of generated code,\n// name: The name of the original symbol which generated this chunk of\n// code.\n// }\n//\n// All properties except for `generatedLine` and `generatedColumn` can be\n// `null`.\n//\n// `_generatedMappings` is ordered by the generated positions.\n//\n// `_originalMappings` is ordered by the original positions.\n\nSourceMapConsumer.prototype.__generatedMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_generatedMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__generatedMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__generatedMappings;\n }\n});\n\nSourceMapConsumer.prototype.__originalMappings = null;\nObject.defineProperty(SourceMapConsumer.prototype, '_originalMappings', {\n configurable: true,\n enumerable: true,\n get: function () {\n if (!this.__originalMappings) {\n this._parseMappings(this._mappings, this.sourceRoot);\n }\n\n return this.__originalMappings;\n }\n});\n\nSourceMapConsumer.prototype._charIsMappingSeparator =\n function SourceMapConsumer_charIsMappingSeparator(aStr, index) {\n var c = aStr.charAt(index);\n return c === \";\" || c === \",\";\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n throw new Error(\"Subclasses must implement _parseMappings\");\n };\n\nSourceMapConsumer.GENERATED_ORDER = 1;\nSourceMapConsumer.ORIGINAL_ORDER = 2;\n\nSourceMapConsumer.GREATEST_LOWER_BOUND = 1;\nSourceMapConsumer.LEAST_UPPER_BOUND = 2;\n\n/**\n * Iterate over each mapping between an original source/line/column and a\n * generated line/column in this source map.\n *\n * @param Function aCallback\n * The function that is called with each mapping.\n * @param Object aContext\n * Optional. If specified, this object will be the value of `this` every\n * time that `aCallback` is called.\n * @param aOrder\n * Either `SourceMapConsumer.GENERATED_ORDER` or\n * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to\n * iterate over the mappings sorted by the generated file's line/column\n * order or the original's source/line/column order, respectively. Defaults to\n * `SourceMapConsumer.GENERATED_ORDER`.\n */\nSourceMapConsumer.prototype.eachMapping =\n function SourceMapConsumer_eachMapping(aCallback, aContext, aOrder) {\n var context = aContext || null;\n var order = aOrder || SourceMapConsumer.GENERATED_ORDER;\n\n var mappings;\n switch (order) {\n case SourceMapConsumer.GENERATED_ORDER:\n mappings = this._generatedMappings;\n break;\n case SourceMapConsumer.ORIGINAL_ORDER:\n mappings = this._originalMappings;\n break;\n default:\n throw new Error(\"Unknown order of iteration.\");\n }\n\n var sourceRoot = this.sourceRoot;\n mappings.map(function (mapping) {\n var source = mapping.source === null ? null : this._sources.at(mapping.source);\n source = util.computeSourceURL(sourceRoot, source, this._sourceMapURL);\n return {\n source: source,\n generatedLine: mapping.generatedLine,\n generatedColumn: mapping.generatedColumn,\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: mapping.name === null ? null : this._names.at(mapping.name)\n };\n }, this).forEach(aCallback, context);\n };\n\n/**\n * Returns all generated line and column information for the original source,\n * line, and column provided. If no column is provided, returns all mappings\n * corresponding to a either the line we are searching for or the next\n * closest line that has any mappings. Otherwise, returns all mappings\n * corresponding to the given line and either the column we are searching for\n * or the next closest column that has any offsets.\n *\n * The only argument is an object with the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number is 1-based.\n * - column: Optional. the column number in the original source.\n * The column number is 0-based.\n *\n * and an array of objects is returned, each with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nSourceMapConsumer.prototype.allGeneratedPositionsFor =\n function SourceMapConsumer_allGeneratedPositionsFor(aArgs) {\n var line = util.getArg(aArgs, 'line');\n\n // When there is no exact match, BasicSourceMapConsumer.prototype._findMapping\n // returns the index of the closest mapping less than the needle. By\n // setting needle.originalColumn to 0, we thus find the last mapping for\n // the given line, provided such a mapping exists.\n var needle = {\n source: util.getArg(aArgs, 'source'),\n originalLine: line,\n originalColumn: util.getArg(aArgs, 'column', 0)\n };\n\n needle.source = this._findSourceIndex(needle.source);\n if (needle.source < 0) {\n return [];\n }\n\n var mappings = [];\n\n var index = this._findMapping(needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n binarySearch.LEAST_UPPER_BOUND);\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (aArgs.column === undefined) {\n var originalLine = mapping.originalLine;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we found. Since\n // mappings are sorted, this is guaranteed to find all mappings for\n // the line we found.\n while (mapping && mapping.originalLine === originalLine) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n } else {\n var originalColumn = mapping.originalColumn;\n\n // Iterate until either we run out of mappings, or we run into\n // a mapping for a different line than the one we were searching for.\n // Since mappings are sorted, this is guaranteed to find all mappings for\n // the line we are searching for.\n while (mapping &&\n mapping.originalLine === line &&\n mapping.originalColumn == originalColumn) {\n mappings.push({\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n });\n\n mapping = this._originalMappings[++index];\n }\n }\n }\n\n return mappings;\n };\n\nexports.SourceMapConsumer = SourceMapConsumer;\n\n/**\n * A BasicSourceMapConsumer instance represents a parsed source map which we can\n * query for information about the original file positions by giving it a file\n * position in the generated source.\n *\n * The first parameter is the raw source map (either as a JSON string, or\n * already parsed to an object). According to the spec, source maps have the\n * following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - sources: An array of URLs to the original source files.\n * - names: An array of identifiers which can be referrenced by individual mappings.\n * - sourceRoot: Optional. The URL root from which all sources are relative.\n * - sourcesContent: Optional. An array of contents of the original source files.\n * - mappings: A string of base64 VLQs which contain the actual mappings.\n * - file: Optional. The generated file this source map is associated with.\n *\n * Here is an example source map, taken from the source map spec[0]:\n *\n * {\n * version : 3,\n * file: \"out.js\",\n * sourceRoot : \"\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AA,AB;;ABCDE;\"\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#\n */\nfunction BasicSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sources = util.getArg(sourceMap, 'sources');\n // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which\n // requires the array) to play nice here.\n var names = util.getArg(sourceMap, 'names', []);\n var sourceRoot = util.getArg(sourceMap, 'sourceRoot', null);\n var sourcesContent = util.getArg(sourceMap, 'sourcesContent', null);\n var mappings = util.getArg(sourceMap, 'mappings');\n var file = util.getArg(sourceMap, 'file', null);\n\n // Once again, Sass deviates from the spec and supplies the version as a\n // string rather than a number, so we use loose equality checking here.\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n if (sourceRoot) {\n sourceRoot = util.normalize(sourceRoot);\n }\n\n sources = sources\n .map(String)\n // Some source maps produce relative source paths like \"./foo.js\" instead of\n // \"foo.js\". Normalize these first so that future comparisons will succeed.\n // See bugzil.la/1090768.\n .map(util.normalize)\n // Always ensure that absolute sources are internally stored relative to\n // the source root, if the source root is absolute. Not doing this would\n // be particularly problematic when the source root is a prefix of the\n // source (valid, but why??). See github issue #199 and bugzil.la/1188982.\n .map(function (source) {\n return sourceRoot && util.isAbsolute(sourceRoot) && util.isAbsolute(source)\n ? util.relative(sourceRoot, source)\n : source;\n });\n\n // Pass `true` below to allow duplicate names and sources. While source maps\n // are intended to be compressed and deduplicated, the TypeScript compiler\n // sometimes generates source maps with duplicates in them. See Github issue\n // #72 and bugzil.la/889492.\n this._names = ArraySet.fromArray(names.map(String), true);\n this._sources = ArraySet.fromArray(sources, true);\n\n this._absoluteSources = this._sources.toArray().map(function (s) {\n return util.computeSourceURL(sourceRoot, s, aSourceMapURL);\n });\n\n this.sourceRoot = sourceRoot;\n this.sourcesContent = sourcesContent;\n this._mappings = mappings;\n this._sourceMapURL = aSourceMapURL;\n this.file = file;\n}\n\nBasicSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nBasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;\n\n/**\n * Utility function to find the index of a source. Returns -1 if not\n * found.\n */\nBasicSourceMapConsumer.prototype._findSourceIndex = function(aSource) {\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n if (this._sources.has(relativeSource)) {\n return this._sources.indexOf(relativeSource);\n }\n\n // Maybe aSource is an absolute URL as returned by |sources|. In\n // this case we can't simply undo the transform.\n var i;\n for (i = 0; i < this._absoluteSources.length; ++i) {\n if (this._absoluteSources[i] == aSource) {\n return i;\n }\n }\n\n return -1;\n};\n\n/**\n * Create a BasicSourceMapConsumer from a SourceMapGenerator.\n *\n * @param SourceMapGenerator aSourceMap\n * The source map that will be consumed.\n * @param String aSourceMapURL\n * The URL at which the source map can be found (optional)\n * @returns BasicSourceMapConsumer\n */\nBasicSourceMapConsumer.fromSourceMap =\n function SourceMapConsumer_fromSourceMap(aSourceMap, aSourceMapURL) {\n var smc = Object.create(BasicSourceMapConsumer.prototype);\n\n var names = smc._names = ArraySet.fromArray(aSourceMap._names.toArray(), true);\n var sources = smc._sources = ArraySet.fromArray(aSourceMap._sources.toArray(), true);\n smc.sourceRoot = aSourceMap._sourceRoot;\n smc.sourcesContent = aSourceMap._generateSourcesContent(smc._sources.toArray(),\n smc.sourceRoot);\n smc.file = aSourceMap._file;\n smc._sourceMapURL = aSourceMapURL;\n smc._absoluteSources = smc._sources.toArray().map(function (s) {\n return util.computeSourceURL(smc.sourceRoot, s, aSourceMapURL);\n });\n\n // Because we are modifying the entries (by converting string sources and\n // names to indices into the sources and names ArraySets), we have to make\n // a copy of the entry or else bad things happen. Shared mutable state\n // strikes again! See github issue #191.\n\n var generatedMappings = aSourceMap._mappings.toArray().slice();\n var destGeneratedMappings = smc.__generatedMappings = [];\n var destOriginalMappings = smc.__originalMappings = [];\n\n for (var i = 0, length = generatedMappings.length; i < length; i++) {\n var srcMapping = generatedMappings[i];\n var destMapping = new Mapping;\n destMapping.generatedLine = srcMapping.generatedLine;\n destMapping.generatedColumn = srcMapping.generatedColumn;\n\n if (srcMapping.source) {\n destMapping.source = sources.indexOf(srcMapping.source);\n destMapping.originalLine = srcMapping.originalLine;\n destMapping.originalColumn = srcMapping.originalColumn;\n\n if (srcMapping.name) {\n destMapping.name = names.indexOf(srcMapping.name);\n }\n\n destOriginalMappings.push(destMapping);\n }\n\n destGeneratedMappings.push(destMapping);\n }\n\n quickSort(smc.__originalMappings, util.compareByOriginalPositions);\n\n return smc;\n };\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nBasicSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(BasicSourceMapConsumer.prototype, 'sources', {\n get: function () {\n return this._absoluteSources.slice();\n }\n});\n\n/**\n * Provide the JIT with a nice shape / hidden class.\n */\nfunction Mapping() {\n this.generatedLine = 0;\n this.generatedColumn = 0;\n this.source = null;\n this.originalLine = null;\n this.originalColumn = null;\n this.name = null;\n}\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nBasicSourceMapConsumer.prototype._parseMappings =\n function SourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n var generatedLine = 1;\n var previousGeneratedColumn = 0;\n var previousOriginalLine = 0;\n var previousOriginalColumn = 0;\n var previousSource = 0;\n var previousName = 0;\n var length = aStr.length;\n var index = 0;\n var cachedSegments = {};\n var temp = {};\n var originalMappings = [];\n var generatedMappings = [];\n var mapping, str, segment, end, value;\n\n while (index < length) {\n if (aStr.charAt(index) === ';') {\n generatedLine++;\n index++;\n previousGeneratedColumn = 0;\n }\n else if (aStr.charAt(index) === ',') {\n index++;\n }\n else {\n mapping = new Mapping();\n mapping.generatedLine = generatedLine;\n\n // Because each offset is encoded relative to the previous one,\n // many segments often have the same encoding. We can exploit this\n // fact by caching the parsed variable length fields of each segment,\n // allowing us to avoid a second parse if we encounter the same\n // segment again.\n for (end = index; end < length; end++) {\n if (this._charIsMappingSeparator(aStr, end)) {\n break;\n }\n }\n str = aStr.slice(index, end);\n\n segment = cachedSegments[str];\n if (segment) {\n index += str.length;\n } else {\n segment = [];\n while (index < end) {\n base64VLQ.decode(aStr, index, temp);\n value = temp.value;\n index = temp.rest;\n segment.push(value);\n }\n\n if (segment.length === 2) {\n throw new Error('Found a source, but no line and column');\n }\n\n if (segment.length === 3) {\n throw new Error('Found a source and line, but no column');\n }\n\n cachedSegments[str] = segment;\n }\n\n // Generated column.\n mapping.generatedColumn = previousGeneratedColumn + segment[0];\n previousGeneratedColumn = mapping.generatedColumn;\n\n if (segment.length > 1) {\n // Original source.\n mapping.source = previousSource + segment[1];\n previousSource += segment[1];\n\n // Original line.\n mapping.originalLine = previousOriginalLine + segment[2];\n previousOriginalLine = mapping.originalLine;\n // Lines are stored 0-based\n mapping.originalLine += 1;\n\n // Original column.\n mapping.originalColumn = previousOriginalColumn + segment[3];\n previousOriginalColumn = mapping.originalColumn;\n\n if (segment.length > 4) {\n // Original name.\n mapping.name = previousName + segment[4];\n previousName += segment[4];\n }\n }\n\n generatedMappings.push(mapping);\n if (typeof mapping.originalLine === 'number') {\n originalMappings.push(mapping);\n }\n }\n }\n\n quickSort(generatedMappings, util.compareByGeneratedPositionsDeflated);\n this.__generatedMappings = generatedMappings;\n\n quickSort(originalMappings, util.compareByOriginalPositions);\n this.__originalMappings = originalMappings;\n };\n\n/**\n * Find the mapping that best matches the hypothetical \"needle\" mapping that\n * we are searching for in the given \"haystack\" of mappings.\n */\nBasicSourceMapConsumer.prototype._findMapping =\n function SourceMapConsumer_findMapping(aNeedle, aMappings, aLineName,\n aColumnName, aComparator, aBias) {\n // To return the position we are searching for, we must first find the\n // mapping for the given position and then return the opposite position it\n // points to. Because the mappings are sorted, we can use binary search to\n // find the best mapping.\n\n if (aNeedle[aLineName] <= 0) {\n throw new TypeError('Line must be greater than or equal to 1, got '\n + aNeedle[aLineName]);\n }\n if (aNeedle[aColumnName] < 0) {\n throw new TypeError('Column must be greater than or equal to 0, got '\n + aNeedle[aColumnName]);\n }\n\n return binarySearch.search(aNeedle, aMappings, aComparator, aBias);\n };\n\n/**\n * Compute the last column for each generated mapping. The last column is\n * inclusive.\n */\nBasicSourceMapConsumer.prototype.computeColumnSpans =\n function SourceMapConsumer_computeColumnSpans() {\n for (var index = 0; index < this._generatedMappings.length; ++index) {\n var mapping = this._generatedMappings[index];\n\n // Mappings do not contain a field for the last generated columnt. We\n // can come up with an optimistic estimate, however, by assuming that\n // mappings are contiguous (i.e. given two consecutive mappings, the\n // first mapping ends where the second one starts).\n if (index + 1 < this._generatedMappings.length) {\n var nextMapping = this._generatedMappings[index + 1];\n\n if (mapping.generatedLine === nextMapping.generatedLine) {\n mapping.lastGeneratedColumn = nextMapping.generatedColumn - 1;\n continue;\n }\n }\n\n // The last mapping for each line spans the entire line.\n mapping.lastGeneratedColumn = Infinity;\n }\n };\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nBasicSourceMapConsumer.prototype.originalPositionFor =\n function SourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._generatedMappings,\n \"generatedLine\",\n \"generatedColumn\",\n util.compareByGeneratedPositionsDeflated,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._generatedMappings[index];\n\n if (mapping.generatedLine === needle.generatedLine) {\n var source = util.getArg(mapping, 'source', null);\n if (source !== null) {\n source = this._sources.at(source);\n source = util.computeSourceURL(this.sourceRoot, source, this._sourceMapURL);\n }\n var name = util.getArg(mapping, 'name', null);\n if (name !== null) {\n name = this._names.at(name);\n }\n return {\n source: source,\n line: util.getArg(mapping, 'originalLine', null),\n column: util.getArg(mapping, 'originalColumn', null),\n name: name\n };\n }\n }\n\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nBasicSourceMapConsumer.prototype.hasContentsOfAllSources =\n function BasicSourceMapConsumer_hasContentsOfAllSources() {\n if (!this.sourcesContent) {\n return false;\n }\n return this.sourcesContent.length >= this._sources.size() &&\n !this.sourcesContent.some(function (sc) { return sc == null; });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nBasicSourceMapConsumer.prototype.sourceContentFor =\n function SourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n if (!this.sourcesContent) {\n return null;\n }\n\n var index = this._findSourceIndex(aSource);\n if (index >= 0) {\n return this.sourcesContent[index];\n }\n\n var relativeSource = aSource;\n if (this.sourceRoot != null) {\n relativeSource = util.relative(this.sourceRoot, relativeSource);\n }\n\n var url;\n if (this.sourceRoot != null\n && (url = util.urlParse(this.sourceRoot))) {\n // XXX: file:// URIs and absolute paths lead to unexpected behavior for\n // many users. We can help them out when they expect file:// URIs to\n // behave like it would if they were running a local HTTP server. See\n // https://bugzilla.mozilla.org/show_bug.cgi?id=885597.\n var fileUriAbsPath = relativeSource.replace(/^file:\\/\\//, \"\");\n if (url.scheme == \"file\"\n && this._sources.has(fileUriAbsPath)) {\n return this.sourcesContent[this._sources.indexOf(fileUriAbsPath)]\n }\n\n if ((!url.path || url.path == \"/\")\n && this._sources.has(\"/\" + relativeSource)) {\n return this.sourcesContent[this._sources.indexOf(\"/\" + relativeSource)];\n }\n }\n\n // This function is used recursively from\n // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we\n // don't want to throw if we can't find the source - we just want to\n // return null, so we provide a flag to exit gracefully.\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + relativeSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or\n * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the\n * closest element that is smaller than or greater than the one we are\n * searching for, respectively, if the exact element cannot be found.\n * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based.\n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nBasicSourceMapConsumer.prototype.generatedPositionFor =\n function SourceMapConsumer_generatedPositionFor(aArgs) {\n var source = util.getArg(aArgs, 'source');\n source = this._findSourceIndex(source);\n if (source < 0) {\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n }\n\n var needle = {\n source: source,\n originalLine: util.getArg(aArgs, 'line'),\n originalColumn: util.getArg(aArgs, 'column')\n };\n\n var index = this._findMapping(\n needle,\n this._originalMappings,\n \"originalLine\",\n \"originalColumn\",\n util.compareByOriginalPositions,\n util.getArg(aArgs, 'bias', SourceMapConsumer.GREATEST_LOWER_BOUND)\n );\n\n if (index >= 0) {\n var mapping = this._originalMappings[index];\n\n if (mapping.source === needle.source) {\n return {\n line: util.getArg(mapping, 'generatedLine', null),\n column: util.getArg(mapping, 'generatedColumn', null),\n lastColumn: util.getArg(mapping, 'lastGeneratedColumn', null)\n };\n }\n }\n\n return {\n line: null,\n column: null,\n lastColumn: null\n };\n };\n\nexports.BasicSourceMapConsumer = BasicSourceMapConsumer;\n\n/**\n * An IndexedSourceMapConsumer instance represents a parsed source map which\n * we can query for information. It differs from BasicSourceMapConsumer in\n * that it takes \"indexed\" source maps (i.e. ones with a \"sections\" field) as\n * input.\n *\n * The first parameter is a raw source map (either as a JSON string, or already\n * parsed to an object). According to the spec for indexed source maps, they\n * have the following attributes:\n *\n * - version: Which version of the source map spec this map is following.\n * - file: Optional. The generated file this source map is associated with.\n * - sections: A list of section definitions.\n *\n * Each value under the \"sections\" field has two fields:\n * - offset: The offset into the original specified at which this section\n * begins to apply, defined as an object with a \"line\" and \"column\"\n * field.\n * - map: A source map definition. This source map could also be indexed,\n * but doesn't have to be.\n *\n * Instead of the \"map\" field, it's also possible to have a \"url\" field\n * specifying a URL to retrieve a source map from, but that's currently\n * unsupported.\n *\n * Here's an example source map, taken from the source map spec[0], but\n * modified to omit a section which uses the \"url\" field.\n *\n * {\n * version : 3,\n * file: \"app.js\",\n * sections: [{\n * offset: {line:100, column:10},\n * map: {\n * version : 3,\n * file: \"section.js\",\n * sources: [\"foo.js\", \"bar.js\"],\n * names: [\"src\", \"maps\", \"are\", \"fun\"],\n * mappings: \"AAAA,E;;ABCDE;\"\n * }\n * }],\n * }\n *\n * The second parameter, if given, is a string whose value is the URL\n * at which the source map was found. This URL is used to compute the\n * sources array.\n *\n * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt\n */\nfunction IndexedSourceMapConsumer(aSourceMap, aSourceMapURL) {\n var sourceMap = aSourceMap;\n if (typeof aSourceMap === 'string') {\n sourceMap = util.parseSourceMapInput(aSourceMap);\n }\n\n var version = util.getArg(sourceMap, 'version');\n var sections = util.getArg(sourceMap, 'sections');\n\n if (version != this._version) {\n throw new Error('Unsupported version: ' + version);\n }\n\n this._sources = new ArraySet();\n this._names = new ArraySet();\n\n var lastOffset = {\n line: -1,\n column: 0\n };\n this._sections = sections.map(function (s) {\n if (s.url) {\n // The url field will require support for asynchronicity.\n // See https://github.com/mozilla/source-map/issues/16\n throw new Error('Support for url field in sections not implemented.');\n }\n var offset = util.getArg(s, 'offset');\n var offsetLine = util.getArg(offset, 'line');\n var offsetColumn = util.getArg(offset, 'column');\n\n if (offsetLine < lastOffset.line ||\n (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)) {\n throw new Error('Section offsets must be ordered and non-overlapping.');\n }\n lastOffset = offset;\n\n return {\n generatedOffset: {\n // The offset fields are 0-based, but we use 1-based indices when\n // encoding/decoding from VLQ.\n generatedLine: offsetLine + 1,\n generatedColumn: offsetColumn + 1\n },\n consumer: new SourceMapConsumer(util.getArg(s, 'map'), aSourceMapURL)\n }\n });\n}\n\nIndexedSourceMapConsumer.prototype = Object.create(SourceMapConsumer.prototype);\nIndexedSourceMapConsumer.prototype.constructor = SourceMapConsumer;\n\n/**\n * The version of the source mapping spec that we are consuming.\n */\nIndexedSourceMapConsumer.prototype._version = 3;\n\n/**\n * The list of original sources.\n */\nObject.defineProperty(IndexedSourceMapConsumer.prototype, 'sources', {\n get: function () {\n var sources = [];\n for (var i = 0; i < this._sections.length; i++) {\n for (var j = 0; j < this._sections[i].consumer.sources.length; j++) {\n sources.push(this._sections[i].consumer.sources[j]);\n }\n }\n return sources;\n }\n});\n\n/**\n * Returns the original source, line, and column information for the generated\n * source's line and column positions provided. The only argument is an object\n * with the following properties:\n *\n * - line: The line number in the generated source. The line number\n * is 1-based.\n * - column: The column number in the generated source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - source: The original source file, or null.\n * - line: The line number in the original source, or null. The\n * line number is 1-based.\n * - column: The column number in the original source, or null. The\n * column number is 0-based.\n * - name: The original identifier, or null.\n */\nIndexedSourceMapConsumer.prototype.originalPositionFor =\n function IndexedSourceMapConsumer_originalPositionFor(aArgs) {\n var needle = {\n generatedLine: util.getArg(aArgs, 'line'),\n generatedColumn: util.getArg(aArgs, 'column')\n };\n\n // Find the section containing the generated position we're trying to map\n // to an original position.\n var sectionIndex = binarySearch.search(needle, this._sections,\n function(needle, section) {\n var cmp = needle.generatedLine - section.generatedOffset.generatedLine;\n if (cmp) {\n return cmp;\n }\n\n return (needle.generatedColumn -\n section.generatedOffset.generatedColumn);\n });\n var section = this._sections[sectionIndex];\n\n if (!section) {\n return {\n source: null,\n line: null,\n column: null,\n name: null\n };\n }\n\n return section.consumer.originalPositionFor({\n line: needle.generatedLine -\n (section.generatedOffset.generatedLine - 1),\n column: needle.generatedColumn -\n (section.generatedOffset.generatedLine === needle.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n bias: aArgs.bias\n });\n };\n\n/**\n * Return true if we have the source content for every source in the source\n * map, false otherwise.\n */\nIndexedSourceMapConsumer.prototype.hasContentsOfAllSources =\n function IndexedSourceMapConsumer_hasContentsOfAllSources() {\n return this._sections.every(function (s) {\n return s.consumer.hasContentsOfAllSources();\n });\n };\n\n/**\n * Returns the original source content. The only argument is the url of the\n * original source file. Returns null if no original source content is\n * available.\n */\nIndexedSourceMapConsumer.prototype.sourceContentFor =\n function IndexedSourceMapConsumer_sourceContentFor(aSource, nullOnMissing) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n var content = section.consumer.sourceContentFor(aSource, true);\n if (content) {\n return content;\n }\n }\n if (nullOnMissing) {\n return null;\n }\n else {\n throw new Error('\"' + aSource + '\" is not in the SourceMap.');\n }\n };\n\n/**\n * Returns the generated line and column information for the original source,\n * line, and column positions provided. The only argument is an object with\n * the following properties:\n *\n * - source: The filename of the original source.\n * - line: The line number in the original source. The line number\n * is 1-based.\n * - column: The column number in the original source. The column\n * number is 0-based.\n *\n * and an object is returned with the following properties:\n *\n * - line: The line number in the generated source, or null. The\n * line number is 1-based. \n * - column: The column number in the generated source, or null.\n * The column number is 0-based.\n */\nIndexedSourceMapConsumer.prototype.generatedPositionFor =\n function IndexedSourceMapConsumer_generatedPositionFor(aArgs) {\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n\n // Only consider this section if the requested source is in the list of\n // sources of the consumer.\n if (section.consumer._findSourceIndex(util.getArg(aArgs, 'source')) === -1) {\n continue;\n }\n var generatedPosition = section.consumer.generatedPositionFor(aArgs);\n if (generatedPosition) {\n var ret = {\n line: generatedPosition.line +\n (section.generatedOffset.generatedLine - 1),\n column: generatedPosition.column +\n (section.generatedOffset.generatedLine === generatedPosition.line\n ? section.generatedOffset.generatedColumn - 1\n : 0)\n };\n return ret;\n }\n }\n\n return {\n line: null,\n column: null\n };\n };\n\n/**\n * Parse the mappings in a string in to a data structure which we can easily\n * query (the ordered arrays in the `this.__generatedMappings` and\n * `this.__originalMappings` properties).\n */\nIndexedSourceMapConsumer.prototype._parseMappings =\n function IndexedSourceMapConsumer_parseMappings(aStr, aSourceRoot) {\n this.__generatedMappings = [];\n this.__originalMappings = [];\n for (var i = 0; i < this._sections.length; i++) {\n var section = this._sections[i];\n var sectionMappings = section.consumer._generatedMappings;\n for (var j = 0; j < sectionMappings.length; j++) {\n var mapping = sectionMappings[j];\n\n var source = section.consumer._sources.at(mapping.source);\n source = util.computeSourceURL(section.consumer.sourceRoot, source, this._sourceMapURL);\n this._sources.add(source);\n source = this._sources.indexOf(source);\n\n var name = null;\n if (mapping.name) {\n name = section.consumer._names.at(mapping.name);\n this._names.add(name);\n name = this._names.indexOf(name);\n }\n\n // The mappings coming from the consumer for the section have\n // generated positions relative to the start of the section, so we\n // need to offset them to be relative to the start of the concatenated\n // generated file.\n var adjustedMapping = {\n source: source,\n generatedLine: mapping.generatedLine +\n (section.generatedOffset.generatedLine - 1),\n generatedColumn: mapping.generatedColumn +\n (section.generatedOffset.generatedLine === mapping.generatedLine\n ? section.generatedOffset.generatedColumn - 1\n : 0),\n originalLine: mapping.originalLine,\n originalColumn: mapping.originalColumn,\n name: name\n };\n\n this.__generatedMappings.push(adjustedMapping);\n if (typeof adjustedMapping.originalLine === 'number') {\n this.__originalMappings.push(adjustedMapping);\n }\n }\n }\n\n quickSort(this.__generatedMappings, util.compareByGeneratedPositionsDeflated);\n quickSort(this.__originalMappings, util.compareByOriginalPositions);\n };\n\nexports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;\n", "/* -*- Mode: js; js-indent-level: 2; -*- */\n/*\n * Copyright 2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\n\nvar SourceMapGenerator = require('./source-map-generator').SourceMapGenerator;\nvar util = require('./util');\n\n// Matches a Windows-style `\\r\\n` newline or a `\\n` newline used by all other\n// operating systems these days (capturing the result).\nvar REGEX_NEWLINE = /(\\r?\\n)/;\n\n// Newline character code for charCodeAt() comparisons\nvar NEWLINE_CODE = 10;\n\n// Private symbol for identifying `SourceNode`s when multiple versions of\n// the source-map library are loaded. This MUST NOT CHANGE across\n// versions!\nvar isSourceNode = \"$$$isSourceNode$$$\";\n\n/**\n * SourceNodes provide a way to abstract over interpolating/concatenating\n * snippets of generated JavaScript source code while maintaining the line and\n * column information associated with the original source code.\n *\n * @param aLine The original line number.\n * @param aColumn The original column number.\n * @param aSource The original source's filename.\n * @param aChunks Optional. An array of strings which are snippets of\n * generated JS, or other SourceNodes.\n * @param aName The original identifier.\n */\nfunction SourceNode(aLine, aColumn, aSource, aChunks, aName) {\n this.children = [];\n this.sourceContents = {};\n this.line = aLine == null ? null : aLine;\n this.column = aColumn == null ? null : aColumn;\n this.source = aSource == null ? null : aSource;\n this.name = aName == null ? null : aName;\n this[isSourceNode] = true;\n if (aChunks != null) this.add(aChunks);\n}\n\n/**\n * Creates a SourceNode from generated code and a SourceMapConsumer.\n *\n * @param aGeneratedCode The generated code\n * @param aSourceMapConsumer The SourceMap for the generated code\n * @param aRelativePath Optional. The path that relative sources in the\n * SourceMapConsumer should be relative to.\n */\nSourceNode.fromStringWithSourceMap =\n function SourceNode_fromStringWithSourceMap(aGeneratedCode, aSourceMapConsumer, aRelativePath) {\n // The SourceNode we want to fill with the generated code\n // and the SourceMap\n var node = new SourceNode();\n\n // All even indices of this array are one line of the generated code,\n // while all odd indices are the newlines between two adjacent lines\n // (since `REGEX_NEWLINE` captures its match).\n // Processed fragments are accessed by calling `shiftNextLine`.\n var remainingLines = aGeneratedCode.split(REGEX_NEWLINE);\n var remainingLinesIndex = 0;\n var shiftNextLine = function() {\n var lineContents = getNextLine();\n // The last line of a file might not have a newline.\n var newLine = getNextLine() || \"\";\n return lineContents + newLine;\n\n function getNextLine() {\n return remainingLinesIndex < remainingLines.length ?\n remainingLines[remainingLinesIndex++] : undefined;\n }\n };\n\n // We need to remember the position of \"remainingLines\"\n var lastGeneratedLine = 1, lastGeneratedColumn = 0;\n\n // The generate SourceNodes we need a code range.\n // To extract it current and last mapping is used.\n // Here we store the last mapping.\n var lastMapping = null;\n\n aSourceMapConsumer.eachMapping(function (mapping) {\n if (lastMapping !== null) {\n // We add the code from \"lastMapping\" to \"mapping\":\n // First check if there is a new line in between.\n if (lastGeneratedLine < mapping.generatedLine) {\n // Associate first line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n lastGeneratedLine++;\n lastGeneratedColumn = 0;\n // The remaining code is added without mapping\n } else {\n // There is no new line in between.\n // Associate the code between \"lastGeneratedColumn\" and\n // \"mapping.generatedColumn\" with \"lastMapping\"\n var nextLine = remainingLines[remainingLinesIndex] || '';\n var code = nextLine.substr(0, mapping.generatedColumn -\n lastGeneratedColumn);\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn -\n lastGeneratedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n addMappingWithCode(lastMapping, code);\n // No more remaining code, continue\n lastMapping = mapping;\n return;\n }\n }\n // We add the generated code until the first mapping\n // to the SourceNode without any mapping.\n // Each line is added as separate string.\n while (lastGeneratedLine < mapping.generatedLine) {\n node.add(shiftNextLine());\n lastGeneratedLine++;\n }\n if (lastGeneratedColumn < mapping.generatedColumn) {\n var nextLine = remainingLines[remainingLinesIndex] || '';\n node.add(nextLine.substr(0, mapping.generatedColumn));\n remainingLines[remainingLinesIndex] = nextLine.substr(mapping.generatedColumn);\n lastGeneratedColumn = mapping.generatedColumn;\n }\n lastMapping = mapping;\n }, this);\n // We have processed all mappings.\n if (remainingLinesIndex < remainingLines.length) {\n if (lastMapping) {\n // Associate the remaining code in the current line with \"lastMapping\"\n addMappingWithCode(lastMapping, shiftNextLine());\n }\n // and add the remaining lines without any mapping\n node.add(remainingLines.splice(remainingLinesIndex).join(\"\"));\n }\n\n // Copy sourcesContent into SourceNode\n aSourceMapConsumer.sources.forEach(function (sourceFile) {\n var content = aSourceMapConsumer.sourceContentFor(sourceFile);\n if (content != null) {\n if (aRelativePath != null) {\n sourceFile = util.join(aRelativePath, sourceFile);\n }\n node.setSourceContent(sourceFile, content);\n }\n });\n\n return node;\n\n function addMappingWithCode(mapping, code) {\n if (mapping === null || mapping.source === undefined) {\n node.add(code);\n } else {\n var source = aRelativePath\n ? util.join(aRelativePath, mapping.source)\n : mapping.source;\n node.add(new SourceNode(mapping.originalLine,\n mapping.originalColumn,\n source,\n code,\n mapping.name));\n }\n }\n };\n\n/**\n * Add a chunk of generated JS to this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.add = function SourceNode_add(aChunk) {\n if (Array.isArray(aChunk)) {\n aChunk.forEach(function (chunk) {\n this.add(chunk);\n }, this);\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n if (aChunk) {\n this.children.push(aChunk);\n }\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Add a chunk of generated JS to the beginning of this source node.\n *\n * @param aChunk A string snippet of generated JS code, another instance of\n * SourceNode, or an array where each member is one of those things.\n */\nSourceNode.prototype.prepend = function SourceNode_prepend(aChunk) {\n if (Array.isArray(aChunk)) {\n for (var i = aChunk.length-1; i >= 0; i--) {\n this.prepend(aChunk[i]);\n }\n }\n else if (aChunk[isSourceNode] || typeof aChunk === \"string\") {\n this.children.unshift(aChunk);\n }\n else {\n throw new TypeError(\n \"Expected a SourceNode, string, or an array of SourceNodes and strings. Got \" + aChunk\n );\n }\n return this;\n};\n\n/**\n * Walk over the tree of JS snippets in this node and its children. The\n * walking function is called once for each snippet of JS and is passed that\n * snippet and the its original associated source's line/column location.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walk = function SourceNode_walk(aFn) {\n var chunk;\n for (var i = 0, len = this.children.length; i < len; i++) {\n chunk = this.children[i];\n if (chunk[isSourceNode]) {\n chunk.walk(aFn);\n }\n else {\n if (chunk !== '') {\n aFn(chunk, { source: this.source,\n line: this.line,\n column: this.column,\n name: this.name });\n }\n }\n }\n};\n\n/**\n * Like `String.prototype.join` except for SourceNodes. Inserts `aStr` between\n * each of `this.children`.\n *\n * @param aSep The separator.\n */\nSourceNode.prototype.join = function SourceNode_join(aSep) {\n var newChildren;\n var i;\n var len = this.children.length;\n if (len > 0) {\n newChildren = [];\n for (i = 0; i < len-1; i++) {\n newChildren.push(this.children[i]);\n newChildren.push(aSep);\n }\n newChildren.push(this.children[i]);\n this.children = newChildren;\n }\n return this;\n};\n\n/**\n * Call String.prototype.replace on the very right-most source snippet. Useful\n * for trimming whitespace from the end of a source node, etc.\n *\n * @param aPattern The pattern to replace.\n * @param aReplacement The thing to replace the pattern with.\n */\nSourceNode.prototype.replaceRight = function SourceNode_replaceRight(aPattern, aReplacement) {\n var lastChild = this.children[this.children.length - 1];\n if (lastChild[isSourceNode]) {\n lastChild.replaceRight(aPattern, aReplacement);\n }\n else if (typeof lastChild === 'string') {\n this.children[this.children.length - 1] = lastChild.replace(aPattern, aReplacement);\n }\n else {\n this.children.push(''.replace(aPattern, aReplacement));\n }\n return this;\n};\n\n/**\n * Set the source content for a source file. This will be added to the SourceMapGenerator\n * in the sourcesContent field.\n *\n * @param aSourceFile The filename of the source file\n * @param aSourceContent The content of the source file\n */\nSourceNode.prototype.setSourceContent =\n function SourceNode_setSourceContent(aSourceFile, aSourceContent) {\n this.sourceContents[util.toSetString(aSourceFile)] = aSourceContent;\n };\n\n/**\n * Walk over the tree of SourceNodes. The walking function is called for each\n * source file content and is passed the filename and source content.\n *\n * @param aFn The traversal function.\n */\nSourceNode.prototype.walkSourceContents =\n function SourceNode_walkSourceContents(aFn) {\n for (var i = 0, len = this.children.length; i < len; i++) {\n if (this.children[i][isSourceNode]) {\n this.children[i].walkSourceContents(aFn);\n }\n }\n\n var sources = Object.keys(this.sourceContents);\n for (var i = 0, len = sources.length; i < len; i++) {\n aFn(util.fromSetString(sources[i]), this.sourceContents[sources[i]]);\n }\n };\n\n/**\n * Return the string representation of this source node. Walks over the tree\n * and concatenates all the various snippets together to one string.\n */\nSourceNode.prototype.toString = function SourceNode_toString() {\n var str = \"\";\n this.walk(function (chunk) {\n str += chunk;\n });\n return str;\n};\n\n/**\n * Returns the string representation of this source node along with a source\n * map.\n */\nSourceNode.prototype.toStringWithSourceMap = function SourceNode_toStringWithSourceMap(aArgs) {\n var generated = {\n code: \"\",\n line: 1,\n column: 0\n };\n var map = new SourceMapGenerator(aArgs);\n var sourceMappingActive = false;\n var lastOriginalSource = null;\n var lastOriginalLine = null;\n var lastOriginalColumn = null;\n var lastOriginalName = null;\n this.walk(function (chunk, original) {\n generated.code += chunk;\n if (original.source !== null\n && original.line !== null\n && original.column !== null) {\n if(lastOriginalSource !== original.source\n || lastOriginalLine !== original.line\n || lastOriginalColumn !== original.column\n || lastOriginalName !== original.name) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n lastOriginalSource = original.source;\n lastOriginalLine = original.line;\n lastOriginalColumn = original.column;\n lastOriginalName = original.name;\n sourceMappingActive = true;\n } else if (sourceMappingActive) {\n map.addMapping({\n generated: {\n line: generated.line,\n column: generated.column\n }\n });\n lastOriginalSource = null;\n sourceMappingActive = false;\n }\n for (var idx = 0, length = chunk.length; idx < length; idx++) {\n if (chunk.charCodeAt(idx) === NEWLINE_CODE) {\n generated.line++;\n generated.column = 0;\n // Mappings end at eol\n if (idx + 1 === length) {\n lastOriginalSource = null;\n sourceMappingActive = false;\n } else if (sourceMappingActive) {\n map.addMapping({\n source: original.source,\n original: {\n line: original.line,\n column: original.column\n },\n generated: {\n line: generated.line,\n column: generated.column\n },\n name: original.name\n });\n }\n } else {\n generated.column++;\n }\n }\n });\n this.walkSourceContents(function (sourceFile, sourceContent) {\n map.setSourceContent(sourceFile, sourceContent);\n });\n\n return { code: generated.code, map: map };\n};\n\nexports.SourceNode = SourceNode;\n", "/*\n * Copyright 2009-2011 Mozilla Foundation and contributors\n * Licensed under the New BSD license. See LICENSE.txt or:\n * http://opensource.org/licenses/BSD-3-Clause\n */\nexports.SourceMapGenerator = require('./lib/source-map-generator').SourceMapGenerator;\nexports.SourceMapConsumer = require('./lib/source-map-consumer').SourceMapConsumer;\nexports.SourceNode = require('./lib/source-node').SourceNode;\n", "// Copyright Joyent, Inc. and other Node contributors.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a\n// copy of this software and associated documentation files (the\n// \"Software\"), to deal in the Software without restriction, including\n// without limitation the rights to use, copy, modify, merge, publish,\n// distribute, sublicense, and/or sell copies of the Software, and to permit\n// persons to whom the Software is furnished to do so, subject to the\n// following conditions:\n//\n// The above copyright notice and this permission notice shall be included\n// in all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS\n// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\n// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN\n// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,\n// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR\n// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE\n// USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n// resolves . and .. elements in a path array with directory names there\n// must be no slashes, empty elements, or device names (c:\\) in the array\n// (so also no leading and trailing slashes - it does not distinguish\n// relative and absolute paths)\nfunction normalizeArray(parts, allowAboveRoot) {\n // if the path tries to go above the root, `up` ends up > 0\n var up = 0;\n for (var i = parts.length - 1; i >= 0; i--) {\n var last = parts[i];\n if (last === '.') {\n parts.splice(i, 1);\n } else if (last === '..') {\n parts.splice(i, 1);\n up++;\n } else if (up) {\n parts.splice(i, 1);\n up--;\n }\n }\n\n // if the path is allowed to go above the root, restore leading ..s\n if (allowAboveRoot) {\n for (; up--; up) {\n parts.unshift('..');\n }\n }\n\n return parts;\n}\n\n// Split a filename into [root, dir, basename, ext], unix version\n// 'root' is just a slash, or nothing.\nvar splitPathRe =\n /^(\\/?|)([\\s\\S]*?)((?:\\.{1,2}|[^\\/]+?|)(\\.[^.\\/]*|))(?:[\\/]*)$/;\nvar splitPath = function(filename) {\n return splitPathRe.exec(filename).slice(1);\n};\n\n// path.resolve([from ...], to)\n// posix version\nexport function resolve() {\n var resolvedPath = '',\n resolvedAbsolute = false;\n\n for (var i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {\n var path = (i >= 0) ? arguments[i] : '/';\n\n // Skip empty and invalid entries\n if (typeof path !== 'string') {\n throw new TypeError('Arguments to path.resolve must be strings');\n } else if (!path) {\n continue;\n }\n\n resolvedPath = path + '/' + resolvedPath;\n resolvedAbsolute = path.charAt(0) === '/';\n }\n\n // At this point the path should be resolved to a full absolute path, but\n // handle relative paths to be safe (might happen when process.cwd() fails)\n\n // Normalize the path\n resolvedPath = normalizeArray(filter(resolvedPath.split('/'), function(p) {\n return !!p;\n }), !resolvedAbsolute).join('/');\n\n return ((resolvedAbsolute ? '/' : '') + resolvedPath) || '.';\n};\n\n// path.normalize(path)\n// posix version\nexport function normalize(path) {\n var isPathAbsolute = isAbsolute(path),\n trailingSlash = substr(path, -1) === '/';\n\n // Normalize the path\n path = normalizeArray(filter(path.split('/'), function(p) {\n return !!p;\n }), !isPathAbsolute).join('/');\n\n if (!path && !isPathAbsolute) {\n path = '.';\n }\n if (path && trailingSlash) {\n path += '/';\n }\n\n return (isPathAbsolute ? '/' : '') + path;\n};\n\n// posix version\nexport function isAbsolute(path) {\n return path.charAt(0) === '/';\n}\n\n// posix version\nexport function join() {\n var paths = Array.prototype.slice.call(arguments, 0);\n return normalize(filter(paths, function(p, index) {\n if (typeof p !== 'string') {\n throw new TypeError('Arguments to path.join must be strings');\n }\n return p;\n }).join('/'));\n}\n\n\n// path.relative(from, to)\n// posix version\nexport function relative(from, to) {\n from = resolve(from).substr(1);\n to = resolve(to).substr(1);\n\n function trim(arr) {\n var start = 0;\n for (; start < arr.length; start++) {\n if (arr[start] !== '') break;\n }\n\n var end = arr.length - 1;\n for (; end >= 0; end--) {\n if (arr[end] !== '') break;\n }\n\n if (start > end) return [];\n return arr.slice(start, end - start + 1);\n }\n\n var fromParts = trim(from.split('/'));\n var toParts = trim(to.split('/'));\n\n var length = Math.min(fromParts.length, toParts.length);\n var samePartsLength = length;\n for (var i = 0; i < length; i++) {\n if (fromParts[i] !== toParts[i]) {\n samePartsLength = i;\n break;\n }\n }\n\n var outputParts = [];\n for (var i = samePartsLength; i < fromParts.length; i++) {\n outputParts.push('..');\n }\n\n outputParts = outputParts.concat(toParts.slice(samePartsLength));\n\n return outputParts.join('/');\n}\n\nexport var sep = '/';\nexport var delimiter = ':';\n\nexport function dirname(path) {\n var result = splitPath(path),\n root = result[0],\n dir = result[1];\n\n if (!root && !dir) {\n // No dirname whatsoever\n return '.';\n }\n\n if (dir) {\n // It has a dirname, strip trailing slash\n dir = dir.substr(0, dir.length - 1);\n }\n\n return root + dir;\n}\n\nexport function basename(path, ext) {\n var f = splitPath(path)[2];\n // TODO: make this comparison case-insensitive on windows?\n if (ext && f.substr(-1 * ext.length) === ext) {\n f = f.substr(0, f.length - ext.length);\n }\n return f;\n}\n\n\nexport function extname(path) {\n return splitPath(path)[3];\n}\nexport default {\n extname: extname,\n basename: basename,\n dirname: dirname,\n sep: sep,\n delimiter: delimiter,\n relative: relative,\n join: join,\n isAbsolute: isAbsolute,\n normalize: normalize,\n resolve: resolve\n};\nfunction filter (xs, f) {\n if (xs.filter) return xs.filter(f);\n var res = [];\n for (var i = 0; i < xs.length; i++) {\n if (f(xs[i], i, xs)) res.push(xs[i]);\n }\n return res;\n}\n\n// String.prototype.substr - negative index don't work in IE8\nvar substr = 'ab'.substr(-1) === 'b' ?\n function (str, start, len) { return str.substr(start, len) } :\n function (str, start, len) {\n if (start < 0) start = str.length + start;\n return str.substr(start, len);\n }\n;\n", "\nconst polyfill = require('path')\n\nif (polyfill && polyfill.default) {\n module.exports = polyfill.default\n for (let k in polyfill) {\n module.exports[k] = polyfill[k]\n }\n} else if (polyfill) {\n module.exports = polyfill\n}\n\n\n", "export default {};\n", "\nconst polyfill = require('fs')\n\nif (polyfill && polyfill.default) {\n module.exports = polyfill.default\n for (let k in polyfill) {\n module.exports[k] = polyfill[k]\n }\n} else if (polyfill) {\n module.exports = polyfill\n}\n\n\n", "/* eslint-disable node/no-deprecated-api */\n\nvar toString = Object.prototype.toString\n\nvar isModern = (\n typeof Buffer !== 'undefined' &&\n typeof Buffer.alloc === 'function' &&\n typeof Buffer.allocUnsafe === 'function' &&\n typeof Buffer.from === 'function'\n)\n\nfunction isArrayBuffer (input) {\n return toString.call(input).slice(8, -1) === 'ArrayBuffer'\n}\n\nfunction fromArrayBuffer (obj, byteOffset, length) {\n byteOffset >>>= 0\n\n var maxLength = obj.byteLength - byteOffset\n\n if (maxLength < 0) {\n throw new RangeError(\"'offset' is out of bounds\")\n }\n\n if (length === undefined) {\n length = maxLength\n } else {\n length >>>= 0\n\n if (length > maxLength) {\n throw new RangeError(\"'length' is out of bounds\")\n }\n }\n\n return isModern\n ? Buffer.from(obj.slice(byteOffset, byteOffset + length))\n : new Buffer(new Uint8Array(obj.slice(byteOffset, byteOffset + length)))\n}\n\nfunction fromString (string, encoding) {\n if (typeof encoding !== 'string' || encoding === '') {\n encoding = 'utf8'\n }\n\n if (!Buffer.isEncoding(encoding)) {\n throw new TypeError('\"encoding\" must be a valid string encoding')\n }\n\n return isModern\n ? Buffer.from(string, encoding)\n : new Buffer(string, encoding)\n}\n\nfunction bufferFrom (value, encodingOrOffset, length) {\n if (typeof value === 'number') {\n throw new TypeError('\"value\" argument must not be a number')\n }\n\n if (isArrayBuffer(value)) {\n return fromArrayBuffer(value, encodingOrOffset, length)\n }\n\n if (typeof value === 'string') {\n return fromString(value, encodingOrOffset)\n }\n\n return isModern\n ? Buffer.from(value)\n : new Buffer(value)\n}\n\nmodule.exports = bufferFrom\n", "var SourceMapConsumer = require('source-map').SourceMapConsumer;\nvar path = require('path');\n\nvar fs;\ntry {\n fs = require('fs');\n if (!fs.existsSync || !fs.readFileSync) {\n // fs doesn't have all methods we need\n fs = null;\n }\n} catch (err) {\n /* nop */\n}\n\nvar bufferFrom = require('buffer-from');\n\n/**\n * Requires a module which is protected against bundler minification.\n *\n * @param {NodeModule} mod\n * @param {string} request\n */\nfunction dynamicRequire(mod, request) {\n return mod.require(request);\n}\n\n// Only install once if called multiple times\nvar errorFormatterInstalled = false;\nvar uncaughtShimInstalled = false;\n\n// If true, the caches are reset before a stack trace formatting operation\nvar emptyCacheBetweenOperations = false;\n\n// Supports {browser, node, auto}\nvar environment = \"auto\";\n\n// Maps a file path to a string containing the file contents\nvar fileContentsCache = {};\n\n// Maps a file path to a source map for that file\nvar sourceMapCache = {};\n\n// Regex for detecting source maps\nvar reSourceMap = /^data:application\\/json[^,]+base64,/;\n\n// Priority list of retrieve handlers\nvar retrieveFileHandlers = [];\nvar retrieveMapHandlers = [];\n\nfunction isInBrowser() {\n if (environment === \"browser\")\n return true;\n if (environment === \"node\")\n return false;\n return ((typeof window !== 'undefined') && (typeof XMLHttpRequest === 'function') && !(window.require && window.module && window.process && window.process.type === \"renderer\"));\n}\n\nfunction hasGlobalProcessEventEmitter() {\n return ((typeof process === 'object') && (process !== null) && (typeof process.on === 'function'));\n}\n\nfunction globalProcessVersion() {\n if ((typeof process === 'object') && (process !== null)) {\n return process.version;\n } else {\n return '';\n }\n}\n\nfunction globalProcessStderr() {\n if ((typeof process === 'object') && (process !== null)) {\n return process.stderr;\n }\n}\n\nfunction globalProcessExit(code) {\n if ((typeof process === 'object') && (process !== null) && (typeof process.exit === 'function')) {\n return process.exit(code);\n }\n}\n\nfunction handlerExec(list) {\n return function(arg) {\n for (var i = 0; i < list.length; i++) {\n var ret = list[i](arg);\n if (ret) {\n return ret;\n }\n }\n return null;\n };\n}\n\nvar retrieveFile = handlerExec(retrieveFileHandlers);\n\nretrieveFileHandlers.push(function(path) {\n // Trim the path to make sure there is no extra whitespace.\n path = path.trim();\n if (/^file:/.test(path)) {\n // existsSync/readFileSync can't handle file protocol, but once stripped, it works\n path = path.replace(/file:\\/\\/\\/(\\w:)?/, function(protocol, drive) {\n return drive ?\n '' : // file:///C:/dir/file -> C:/dir/file\n '/'; // file:///root-dir/file -> /root-dir/file\n });\n }\n if (path in fileContentsCache) {\n return fileContentsCache[path];\n }\n\n var contents = '';\n try {\n if (!fs) {\n // Use SJAX if we are in the browser\n var xhr = new XMLHttpRequest();\n xhr.open('GET', path, /** async */ false);\n xhr.send(null);\n if (xhr.readyState === 4 && xhr.status === 200) {\n contents = xhr.responseText;\n }\n } else if (fs.existsSync(path)) {\n // Otherwise, use the filesystem\n contents = fs.readFileSync(path, 'utf8');\n }\n } catch (er) {\n /* ignore any errors */\n }\n\n return fileContentsCache[path] = contents;\n});\n\n// Support URLs relative to a directory, but be careful about a protocol prefix\n// in case we are in the browser (i.e. directories may start with \"http://\" or \"file:///\")\nfunction supportRelativeURL(file, url) {\n if (!file) return url;\n var dir = path.dirname(file);\n var match = /^\\w+:\\/\\/[^\\/]*/.exec(dir);\n var protocol = match ? match[0] : '';\n var startPath = dir.slice(protocol.length);\n if (protocol && /^\\/\\w\\:/.test(startPath)) {\n // handle file:///C:/ paths\n protocol += '/';\n return protocol + path.resolve(dir.slice(protocol.length), url).replace(/\\\\/g, '/');\n }\n return protocol + path.resolve(dir.slice(protocol.length), url);\n}\n\nfunction retrieveSourceMapURL(source) {\n var fileData;\n\n if (isInBrowser()) {\n try {\n var xhr = new XMLHttpRequest();\n xhr.open('GET', source, false);\n xhr.send(null);\n fileData = xhr.readyState === 4 ? xhr.responseText : null;\n\n // Support providing a sourceMappingURL via the SourceMap header\n var sourceMapHeader = xhr.getResponseHeader(\"SourceMap\") ||\n xhr.getResponseHeader(\"X-SourceMap\");\n if (sourceMapHeader) {\n return sourceMapHeader;\n }\n } catch (e) {\n }\n }\n\n // Get the URL of the source map\n fileData = retrieveFile(source);\n var re = /(?:\\/\\/[@#][\\s]*sourceMappingURL=([^\\s'\"]+)[\\s]*$)|(?:\\/\\*[@#][\\s]*sourceMappingURL=([^\\s*'\"]+)[\\s]*(?:\\*\\/)[\\s]*$)/mg;\n // Keep executing the search to find the *last* sourceMappingURL to avoid\n // picking up sourceMappingURLs from comments, strings, etc.\n var lastMatch, match;\n while (match = re.exec(fileData)) lastMatch = match;\n if (!lastMatch) return null;\n return lastMatch[1];\n};\n\n// Can be overridden by the retrieveSourceMap option to install. Takes a\n// generated source filename; returns a {map, optional url} object, or null if\n// there is no source map. The map field may be either a string or the parsed\n// JSON object (ie, it must be a valid argument to the SourceMapConsumer\n// constructor).\nvar retrieveSourceMap = handlerExec(retrieveMapHandlers);\nretrieveMapHandlers.push(function(source) {\n var sourceMappingURL = retrieveSourceMapURL(source);\n if (!sourceMappingURL) return null;\n\n // Read the contents of the source map\n var sourceMapData;\n if (reSourceMap.test(sourceMappingURL)) {\n // Support source map URL as a data url\n var rawData = sourceMappingURL.slice(sourceMappingURL.indexOf(',') + 1);\n sourceMapData = bufferFrom(rawData, \"base64\").toString();\n sourceMappingURL = source;\n } else {\n // Support source map URLs relative to the source URL\n sourceMappingURL = supportRelativeURL(source, sourceMappingURL);\n sourceMapData = retrieveFile(sourceMappingURL);\n }\n\n if (!sourceMapData) {\n return null;\n }\n\n return {\n url: sourceMappingURL,\n map: sourceMapData\n };\n});\n\nfunction mapSourcePosition(position) {\n var sourceMap = sourceMapCache[position.source];\n if (!sourceMap) {\n // Call the (overrideable) retrieveSourceMap function to get the source map.\n var urlAndMap = retrieveSourceMap(position.source);\n if (urlAndMap) {\n sourceMap = sourceMapCache[position.source] = {\n url: urlAndMap.url,\n map: new SourceMapConsumer(urlAndMap.map)\n };\n\n // Load all sources stored inline with the source map into the file cache\n // to pretend like they are already loaded. They may not exist on disk.\n if (sourceMap.map.sourcesContent) {\n sourceMap.map.sources.forEach(function(source, i) {\n var contents = sourceMap.map.sourcesContent[i];\n if (contents) {\n var url = supportRelativeURL(sourceMap.url, source);\n fileContentsCache[url] = contents;\n }\n });\n }\n } else {\n sourceMap = sourceMapCache[position.source] = {\n url: null,\n map: null\n };\n }\n }\n\n // Resolve the source URL relative to the URL of the source map\n if (sourceMap && sourceMap.map && typeof sourceMap.map.originalPositionFor === 'function') {\n var originalPosition = sourceMap.map.originalPositionFor(position);\n\n // Only return the original position if a matching line was found. If no\n // matching line is found then we return position instead, which will cause\n // the stack trace to print the path and line for the compiled file. It is\n // better to give a precise location in the compiled file than a vague\n // location in the original file.\n if (originalPosition.source !== null) {\n originalPosition.source = supportRelativeURL(\n sourceMap.url, originalPosition.source);\n return originalPosition;\n }\n }\n\n return position;\n}\n\n// Parses code generated by FormatEvalOrigin(), a function inside V8:\n// https://code.google.com/p/v8/source/browse/trunk/src/messages.js\nfunction mapEvalOrigin(origin) {\n // Most eval() calls are in this format\n var match = /^eval at ([^(]+) \\((.+):(\\d+):(\\d+)\\)$/.exec(origin);\n if (match) {\n var position = mapSourcePosition({\n source: match[2],\n line: +match[3],\n column: match[4] - 1\n });\n return 'eval at ' + match[1] + ' (' + position.source + ':' +\n position.line + ':' + (position.column + 1) + ')';\n }\n\n // Parse nested eval() calls using recursion\n match = /^eval at ([^(]+) \\((.+)\\)$/.exec(origin);\n if (match) {\n return 'eval at ' + match[1] + ' (' + mapEvalOrigin(match[2]) + ')';\n }\n\n // Make sure we still return useful information if we didn't find anything\n return origin;\n}\n\n// This is copied almost verbatim from the V8 source code at\n// https://code.google.com/p/v8/source/browse/trunk/src/messages.js. The\n// implementation of wrapCallSite() used to just forward to the actual source\n// code of CallSite.prototype.toString but unfortunately a new release of V8\n// did something to the prototype chain and broke the shim. The only fix I\n// could find was copy/paste.\nfunction CallSiteToString() {\n var fileName;\n var fileLocation = \"\";\n if (this.isNative()) {\n fileLocation = \"native\";\n } else {\n fileName = this.getScriptNameOrSourceURL();\n if (!fileName && this.isEval()) {\n fileLocation = this.getEvalOrigin();\n fileLocation += \", \"; // Expecting source position to follow.\n }\n\n if (fileName) {\n fileLocation += fileName;\n } else {\n // Source code does not originate from a file and is not native, but we\n // can still get the source position inside the source string, e.g. in\n // an eval string.\n fileLocation += \"\";\n }\n var lineNumber = this.getLineNumber();\n if (lineNumber != null) {\n fileLocation += \":\" + lineNumber;\n var columnNumber = this.getColumnNumber();\n if (columnNumber) {\n fileLocation += \":\" + columnNumber;\n }\n }\n }\n\n var line = \"\";\n var functionName = this.getFunctionName();\n var addSuffix = true;\n var isConstructor = this.isConstructor();\n var isMethodCall = !(this.isToplevel() || isConstructor);\n if (isMethodCall) {\n var typeName = this.getTypeName();\n // Fixes shim to be backward compatable with Node v0 to v4\n if (typeName === \"[object Object]\") {\n typeName = \"null\";\n }\n var methodName = this.getMethodName();\n if (functionName) {\n if (typeName && functionName.indexOf(typeName) != 0) {\n line += typeName + \".\";\n }\n line += functionName;\n if (methodName && functionName.indexOf(\".\" + methodName) != functionName.length - methodName.length - 1) {\n line += \" [as \" + methodName + \"]\";\n }\n } else {\n line += typeName + \".\" + (methodName || \"\");\n }\n } else if (isConstructor) {\n line += \"new \" + (functionName || \"\");\n } else if (functionName) {\n line += functionName;\n } else {\n line += fileLocation;\n addSuffix = false;\n }\n if (addSuffix) {\n line += \" (\" + fileLocation + \")\";\n }\n return line;\n}\n\nfunction cloneCallSite(frame) {\n var object = {};\n Object.getOwnPropertyNames(Object.getPrototypeOf(frame)).forEach(function(name) {\n object[name] = /^(?:is|get)/.test(name) ? function() { return frame[name].call(frame); } : frame[name];\n });\n object.toString = CallSiteToString;\n return object;\n}\n\nfunction wrapCallSite(frame, state) {\n // provides interface backward compatibility\n if (state === undefined) {\n state = { nextPosition: null, curPosition: null }\n }\n if(frame.isNative()) {\n state.curPosition = null;\n return frame;\n }\n\n // Most call sites will return the source file from getFileName(), but code\n // passed to eval() ending in \"//# sourceURL=...\" will return the source file\n // from getScriptNameOrSourceURL() instead\n var source = frame.getFileName() || frame.getScriptNameOrSourceURL();\n if (source) {\n var line = frame.getLineNumber();\n var column = frame.getColumnNumber() - 1;\n\n // Fix position in Node where some (internal) code is prepended.\n // See https://github.com/evanw/node-source-map-support/issues/36\n // Header removed in node at ^10.16 || >=11.11.0\n // v11 is not an LTS candidate, we can just test the one version with it.\n // Test node versions for: 10.16-19, 10.20+, 12-19, 20-99, 100+, or 11.11\n var noHeader = /^v(10\\.1[6-9]|10\\.[2-9][0-9]|10\\.[0-9]{3,}|1[2-9]\\d*|[2-9]\\d|\\d{3,}|11\\.11)/;\n var headerLength = noHeader.test(globalProcessVersion()) ? 0 : 62;\n if (line === 1 && column > headerLength && !isInBrowser() && !frame.isEval()) {\n column -= headerLength;\n }\n\n var position = mapSourcePosition({\n source: source,\n line: line,\n column: column\n });\n state.curPosition = position;\n frame = cloneCallSite(frame);\n var originalFunctionName = frame.getFunctionName;\n frame.getFunctionName = function() {\n if (state.nextPosition == null) {\n return originalFunctionName();\n }\n return state.nextPosition.name || originalFunctionName();\n };\n frame.getFileName = function() { return position.source; };\n frame.getLineNumber = function() { return position.line; };\n frame.getColumnNumber = function() { return position.column + 1; };\n frame.getScriptNameOrSourceURL = function() { return position.source; };\n return frame;\n }\n\n // Code called using eval() needs special handling\n var origin = frame.isEval() && frame.getEvalOrigin();\n if (origin) {\n origin = mapEvalOrigin(origin);\n frame = cloneCallSite(frame);\n frame.getEvalOrigin = function() { return origin; };\n return frame;\n }\n\n // If we get here then we were unable to change the source position\n return frame;\n}\n\n// This function is part of the V8 stack trace API, for more info see:\n// https://v8.dev/docs/stack-trace-api\nfunction prepareStackTrace(error, stack) {\n if (emptyCacheBetweenOperations) {\n fileContentsCache = {};\n sourceMapCache = {};\n }\n\n var name = error.name || 'Error';\n var message = error.message || '';\n var errorString = name + \": \" + message;\n\n var state = { nextPosition: null, curPosition: null };\n var processedStack = [];\n for (var i = stack.length - 1; i >= 0; i--) {\n processedStack.push('\\n at ' + wrapCallSite(stack[i], state));\n state.nextPosition = state.curPosition;\n }\n state.curPosition = state.nextPosition = null;\n return errorString + processedStack.reverse().join('');\n}\n\n// Generate position and snippet of original source with pointer\nfunction getErrorSource(error) {\n var match = /\\n at [^(]+ \\((.*):(\\d+):(\\d+)\\)/.exec(error.stack);\n if (match) {\n var source = match[1];\n var line = +match[2];\n var column = +match[3];\n\n // Support the inline sourceContents inside the source map\n var contents = fileContentsCache[source];\n\n // Support files on disk\n if (!contents && fs && fs.existsSync(source)) {\n try {\n contents = fs.readFileSync(source, 'utf8');\n } catch (er) {\n contents = '';\n }\n }\n\n // Format the line from the original source code like node does\n if (contents) {\n var code = contents.split(/(?:\\r\\n|\\r|\\n)/)[line - 1];\n if (code) {\n return source + ':' + line + '\\n' + code + '\\n' +\n new Array(column).join(' ') + '^';\n }\n }\n }\n return null;\n}\n\nfunction printErrorAndExit (error) {\n var source = getErrorSource(error);\n\n // Ensure error is printed synchronously and not truncated\n var stderr = globalProcessStderr();\n if (stderr && stderr._handle && stderr._handle.setBlocking) {\n stderr._handle.setBlocking(true);\n }\n\n if (source) {\n console.error();\n console.error(source);\n }\n\n console.error(error.stack);\n globalProcessExit(1);\n}\n\nfunction shimEmitUncaughtException () {\n var origEmit = process.emit;\n\n process.emit = function (type) {\n if (type === 'uncaughtException') {\n var hasStack = (arguments[1] && arguments[1].stack);\n var hasListeners = (this.listeners(type).length > 0);\n\n if (hasStack && !hasListeners) {\n return printErrorAndExit(arguments[1]);\n }\n }\n\n return origEmit.apply(this, arguments);\n };\n}\n\nvar originalRetrieveFileHandlers = retrieveFileHandlers.slice(0);\nvar originalRetrieveMapHandlers = retrieveMapHandlers.slice(0);\n\nexports.wrapCallSite = wrapCallSite;\nexports.getErrorSource = getErrorSource;\nexports.mapSourcePosition = mapSourcePosition;\nexports.retrieveSourceMap = retrieveSourceMap;\n\nexports.install = function(options) {\n options = options || {};\n\n if (options.environment) {\n environment = options.environment;\n if ([\"node\", \"browser\", \"auto\"].indexOf(environment) === -1) {\n throw new Error(\"environment \" + environment + \" was unknown. Available options are {auto, browser, node}\")\n }\n }\n\n // Allow sources to be found by methods other than reading the files\n // directly from disk.\n if (options.retrieveFile) {\n if (options.overrideRetrieveFile) {\n retrieveFileHandlers.length = 0;\n }\n\n retrieveFileHandlers.unshift(options.retrieveFile);\n }\n\n // Allow source maps to be found by methods other than reading the files\n // directly from disk.\n if (options.retrieveSourceMap) {\n if (options.overrideRetrieveSourceMap) {\n retrieveMapHandlers.length = 0;\n }\n\n retrieveMapHandlers.unshift(options.retrieveSourceMap);\n }\n\n // Support runtime transpilers that include inline source maps\n if (options.hookRequire && !isInBrowser()) {\n // Use dynamicRequire to avoid including in browser bundles\n var Module = dynamicRequire(module, 'module');\n var $compile = Module.prototype._compile;\n\n if (!$compile.__sourceMapSupport) {\n Module.prototype._compile = function(content, filename) {\n fileContentsCache[filename] = content;\n sourceMapCache[filename] = undefined;\n return $compile.call(this, content, filename);\n };\n\n Module.prototype._compile.__sourceMapSupport = true;\n }\n }\n\n // Configure options\n if (!emptyCacheBetweenOperations) {\n emptyCacheBetweenOperations = 'emptyCacheBetweenOperations' in options ?\n options.emptyCacheBetweenOperations : false;\n }\n\n // Install the error reformatter\n if (!errorFormatterInstalled) {\n errorFormatterInstalled = true;\n Error.prepareStackTrace = prepareStackTrace;\n }\n\n if (!uncaughtShimInstalled) {\n var installHandler = 'handleUncaughtExceptions' in options ?\n options.handleUncaughtExceptions : true;\n\n // Do not override 'uncaughtException' with our own handler in Node.js\n // Worker threads. Workers pass the error to the main thread as an event,\n // rather than printing something to stderr and exiting.\n try {\n // We need to use `dynamicRequire` because `require` on it's own will be optimized by WebPack/Browserify.\n var worker_threads = dynamicRequire(module, 'worker_threads');\n if (worker_threads.isMainThread === false) {\n installHandler = false;\n }\n } catch(e) {}\n\n // Provide the option to not install the uncaught exception handler. This is\n // to support other uncaught exception handlers (in test frameworks, for\n // example). If this handler is not installed and there are no other uncaught\n // exception handlers, uncaught exceptions will be caught by node's built-in\n // exception handler and the process will still be terminated. However, the\n // generated JavaScript code will be shown above the stack trace instead of\n // the original source code.\n if (installHandler && hasGlobalProcessEventEmitter()) {\n uncaughtShimInstalled = true;\n shimEmitUncaughtException();\n }\n }\n};\n\nexports.resetRetrieveHandlers = function() {\n retrieveFileHandlers.length = 0;\n retrieveMapHandlers.length = 0;\n\n retrieveFileHandlers = originalRetrieveFileHandlers.slice(0);\n retrieveMapHandlers = originalRetrieveMapHandlers.slice(0);\n\n retrieveSourceMap = handlerExec(retrieveMapHandlers);\n retrieveFile = handlerExec(retrieveFileHandlers);\n}\n", "/**\n * @license React\n * react-jsx-runtime.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';var f=require(\"react\"),k=Symbol.for(\"react.element\"),l=Symbol.for(\"react.fragment\"),m=Object.prototype.hasOwnProperty,n=f.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,p={key:!0,ref:!0,__self:!0,__source:!0};\nfunction q(c,a,g){var b,d={},e=null,h=null;void 0!==g&&(e=\"\"+g);void 0!==a.key&&(e=\"\"+a.key);void 0!==a.ref&&(h=a.ref);for(b in a)m.call(a,b)&&!p.hasOwnProperty(b)&&(d[b]=a[b]);if(c&&c.defaultProps)for(b in a=c.defaultProps,a)void 0===d[b]&&(d[b]=a[b]);return{$$typeof:k,type:c,key:e,ref:h,props:d,_owner:n.current}}exports.Fragment=l;exports.jsx=q;exports.jsxs=q;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-jsx-runtime.production.min.js');\n} else {\n module.exports = require('./cjs/react-jsx-runtime.development.js');\n}\n", "/*!\n * Determine if an object is a Buffer\n *\n * @author Feross Aboukhadijeh \n * @license MIT\n */\n\nmodule.exports = function isBuffer (obj) {\n return obj != null && obj.constructor != null &&\n typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)\n}\n", "'use strict';\n\nvar hasOwn = Object.prototype.hasOwnProperty;\nvar toStr = Object.prototype.toString;\nvar defineProperty = Object.defineProperty;\nvar gOPD = Object.getOwnPropertyDescriptor;\n\nvar isArray = function isArray(arr) {\n\tif (typeof Array.isArray === 'function') {\n\t\treturn Array.isArray(arr);\n\t}\n\n\treturn toStr.call(arr) === '[object Array]';\n};\n\nvar isPlainObject = function isPlainObject(obj) {\n\tif (!obj || toStr.call(obj) !== '[object Object]') {\n\t\treturn false;\n\t}\n\n\tvar hasOwnConstructor = hasOwn.call(obj, 'constructor');\n\tvar hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');\n\t// Not own constructor property must be Object\n\tif (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {\n\t\treturn false;\n\t}\n\n\t// Own properties are enumerated firstly, so to speed up,\n\t// if last one is own, then all properties are own.\n\tvar key;\n\tfor (key in obj) { /**/ }\n\n\treturn typeof key === 'undefined' || hasOwn.call(obj, key);\n};\n\n// If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target\nvar setProperty = function setProperty(target, options) {\n\tif (defineProperty && options.name === '__proto__') {\n\t\tdefineProperty(target, options.name, {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: true,\n\t\t\tvalue: options.newValue,\n\t\t\twritable: true\n\t\t});\n\t} else {\n\t\ttarget[options.name] = options.newValue;\n\t}\n};\n\n// Return undefined instead of __proto__ if '__proto__' is not an own property\nvar getProperty = function getProperty(obj, name) {\n\tif (name === '__proto__') {\n\t\tif (!hasOwn.call(obj, name)) {\n\t\t\treturn void 0;\n\t\t} else if (gOPD) {\n\t\t\t// In early versions of node, obj['__proto__'] is buggy when obj has\n\t\t\t// __proto__ as an own property. Object.getOwnPropertyDescriptor() works.\n\t\t\treturn gOPD(obj, name).value;\n\t\t}\n\t}\n\n\treturn obj[name];\n};\n\nmodule.exports = function extend() {\n\tvar options, name, src, copy, copyIsArray, clone;\n\tvar target = arguments[0];\n\tvar i = 1;\n\tvar length = arguments.length;\n\tvar deep = false;\n\n\t// Handle a deep copy situation\n\tif (typeof target === 'boolean') {\n\t\tdeep = target;\n\t\ttarget = arguments[1] || {};\n\t\t// skip the boolean and the target\n\t\ti = 2;\n\t}\n\tif (target == null || (typeof target !== 'object' && typeof target !== 'function')) {\n\t\ttarget = {};\n\t}\n\n\tfor (; i < length; ++i) {\n\t\toptions = arguments[i];\n\t\t// Only deal with non-null/undefined values\n\t\tif (options != null) {\n\t\t\t// Extend the base object\n\t\t\tfor (name in options) {\n\t\t\t\tsrc = getProperty(target, name);\n\t\t\t\tcopy = getProperty(options, name);\n\n\t\t\t\t// Prevent never-ending loop\n\t\t\t\tif (target !== copy) {\n\t\t\t\t\t// Recurse if we're merging plain objects or arrays\n\t\t\t\t\tif (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {\n\t\t\t\t\t\tif (copyIsArray) {\n\t\t\t\t\t\t\tcopyIsArray = false;\n\t\t\t\t\t\t\tclone = src && isArray(src) ? src : [];\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tclone = src && isPlainObject(src) ? src : {};\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// Never move original objects, clone them\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: extend(deep, clone, copy) });\n\n\t\t\t\t\t// Don't bring in undefined values\n\t\t\t\t\t} else if (typeof copy !== 'undefined') {\n\t\t\t\t\t\tsetProperty(target, { name: name, newValue: copy });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\t// Return the modified object\n\treturn target;\n};\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\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';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\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';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bigint: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n", "/**\n * Copyright (c) 2013-present, Facebook, Inc.\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\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n", "/**\n * @license React\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its 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'use strict';var b=Symbol.for(\"react.element\"),c=Symbol.for(\"react.portal\"),d=Symbol.for(\"react.fragment\"),e=Symbol.for(\"react.strict_mode\"),f=Symbol.for(\"react.profiler\"),g=Symbol.for(\"react.provider\"),h=Symbol.for(\"react.context\"),k=Symbol.for(\"react.server_context\"),l=Symbol.for(\"react.forward_ref\"),m=Symbol.for(\"react.suspense\"),n=Symbol.for(\"react.suspense_list\"),p=Symbol.for(\"react.memo\"),q=Symbol.for(\"react.lazy\"),t=Symbol.for(\"react.offscreen\"),u;u=Symbol.for(\"react.module.reference\");\nfunction v(a){if(\"object\"===typeof a&&null!==a){var r=a.$$typeof;switch(r){case b:switch(a=a.type,a){case d:case f:case e:case m:case n:return a;default:switch(a=a&&a.$$typeof,a){case k:case h:case l:case q:case p:case g:return a;default:return r}}case c:return r}}}exports.ContextConsumer=h;exports.ContextProvider=g;exports.Element=b;exports.ForwardRef=l;exports.Fragment=d;exports.Lazy=q;exports.Memo=p;exports.Portal=c;exports.Profiler=f;exports.StrictMode=e;exports.Suspense=m;\nexports.SuspenseList=n;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return v(a)===h};exports.isContextProvider=function(a){return v(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return v(a)===l};exports.isFragment=function(a){return v(a)===d};exports.isLazy=function(a){return v(a)===q};exports.isMemo=function(a){return v(a)===p};\nexports.isPortal=function(a){return v(a)===c};exports.isProfiler=function(a){return v(a)===f};exports.isStrictMode=function(a){return v(a)===e};exports.isSuspense=function(a){return v(a)===m};exports.isSuspenseList=function(a){return v(a)===n};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===e||a===m||a===n||a===t||\"object\"===typeof a&&null!==a&&(a.$$typeof===q||a.$$typeof===p||a.$$typeof===g||a.$$typeof===h||a.$$typeof===l||a.$$typeof===u||void 0!==a.getModuleId)?!0:!1};exports.typeOf=v;\n", "'use strict';\n\nif (process.env.NODE_ENV === 'production') {\n module.exports = require('./cjs/react-is.production.min.js');\n} else {\n module.exports = require('./cjs/react-is.development.js');\n}\n", "// http://www.w3.org/TR/CSS21/grammar.html\n// https://github.com/visionmedia/css-parse/pull/49#issuecomment-30088027\nvar COMMENT_REGEX = /\\/\\*[^*]*\\*+([^/*][^*]*\\*+)*\\//g;\n\nvar NEWLINE_REGEX = /\\n/g;\nvar WHITESPACE_REGEX = /^\\s*/;\n\n// declaration\nvar PROPERTY_REGEX = /^(\\*?[-#/*\\\\\\w]+(\\[[0-9a-z_-]+\\])?)\\s*/;\nvar COLON_REGEX = /^:\\s*/;\nvar VALUE_REGEX = /^((?:'(?:\\\\'|.)*?'|\"(?:\\\\\"|.)*?\"|\\([^)]*?\\)|[^};])+)/;\nvar SEMICOLON_REGEX = /^[;\\s]*/;\n\n// https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String/Trim#Polyfill\nvar TRIM_REGEX = /^\\s+|\\s+$/g;\n\n// strings\nvar NEWLINE = '\\n';\nvar FORWARD_SLASH = '/';\nvar ASTERISK = '*';\nvar EMPTY_STRING = '';\n\n// types\nvar TYPE_COMMENT = 'comment';\nvar TYPE_DECLARATION = 'declaration';\n\n/**\n * @param {String} style\n * @param {Object} [options]\n * @return {Object[]}\n * @throws {TypeError}\n * @throws {Error}\n */\nmodule.exports = function(style, options) {\n if (typeof style !== 'string') {\n throw new TypeError('First argument must be a string');\n }\n\n if (!style) return [];\n\n options = options || {};\n\n /**\n * Positional.\n */\n var lineno = 1;\n var column = 1;\n\n /**\n * Update lineno and column based on `str`.\n *\n * @param {String} str\n */\n function updatePosition(str) {\n var lines = str.match(NEWLINE_REGEX);\n if (lines) lineno += lines.length;\n var i = str.lastIndexOf(NEWLINE);\n column = ~i ? str.length - i : column + str.length;\n }\n\n /**\n * Mark position and patch `node.position`.\n *\n * @return {Function}\n */\n function position() {\n var start = { line: lineno, column: column };\n return function(node) {\n node.position = new Position(start);\n whitespace();\n return node;\n };\n }\n\n /**\n * Store position information for a node.\n *\n * @constructor\n * @property {Object} start\n * @property {Object} end\n * @property {undefined|String} source\n */\n function Position(start) {\n this.start = start;\n this.end = { line: lineno, column: column };\n this.source = options.source;\n }\n\n /**\n * Non-enumerable source string.\n */\n Position.prototype.content = style;\n\n var errorsList = [];\n\n /**\n * Error `msg`.\n *\n * @param {String} msg\n * @throws {Error}\n */\n function error(msg) {\n var err = new Error(\n options.source + ':' + lineno + ':' + column + ': ' + msg\n );\n err.reason = msg;\n err.filename = options.source;\n err.line = lineno;\n err.column = column;\n err.source = style;\n\n if (options.silent) {\n errorsList.push(err);\n } else {\n throw err;\n }\n }\n\n /**\n * Match `re` and return captures.\n *\n * @param {RegExp} re\n * @return {undefined|Array}\n */\n function match(re) {\n var m = re.exec(style);\n if (!m) return;\n var str = m[0];\n updatePosition(str);\n style = style.slice(str.length);\n return m;\n }\n\n /**\n * Parse whitespace.\n */\n function whitespace() {\n match(WHITESPACE_REGEX);\n }\n\n /**\n * Parse comments.\n *\n * @param {Object[]} [rules]\n * @return {Object[]}\n */\n function comments(rules) {\n var c;\n rules = rules || [];\n while ((c = comment())) {\n if (c !== false) {\n rules.push(c);\n }\n }\n return rules;\n }\n\n /**\n * Parse comment.\n *\n * @return {Object}\n * @throws {Error}\n */\n function comment() {\n var pos = position();\n if (FORWARD_SLASH != style.charAt(0) || ASTERISK != style.charAt(1)) return;\n\n var i = 2;\n while (\n EMPTY_STRING != style.charAt(i) &&\n (ASTERISK != style.charAt(i) || FORWARD_SLASH != style.charAt(i + 1))\n ) {\n ++i;\n }\n i += 2;\n\n if (EMPTY_STRING === style.charAt(i - 1)) {\n return error('End of comment missing');\n }\n\n var str = style.slice(2, i - 2);\n column += 2;\n updatePosition(str);\n style = style.slice(i);\n column += 2;\n\n return pos({\n type: TYPE_COMMENT,\n comment: str\n });\n }\n\n /**\n * Parse declaration.\n *\n * @return {Object}\n * @throws {Error}\n */\n function declaration() {\n var pos = position();\n\n // prop\n var prop = match(PROPERTY_REGEX);\n if (!prop) return;\n comment();\n\n // :\n if (!match(COLON_REGEX)) return error(\"property missing ':'\");\n\n // val\n var val = match(VALUE_REGEX);\n\n var ret = pos({\n type: TYPE_DECLARATION,\n property: trim(prop[0].replace(COMMENT_REGEX, EMPTY_STRING)),\n value: val\n ? trim(val[0].replace(COMMENT_REGEX, EMPTY_STRING))\n : EMPTY_STRING\n });\n\n // ;\n match(SEMICOLON_REGEX);\n\n return ret;\n }\n\n /**\n * Parse declarations.\n *\n * @return {Object[]}\n */\n function declarations() {\n var decls = [];\n\n comments(decls);\n\n // declarations\n var decl;\n while ((decl = declaration())) {\n if (decl !== false) {\n decls.push(decl);\n comments(decls);\n }\n }\n\n return decls;\n }\n\n whitespace();\n return declarations();\n};\n\n/**\n * Trim `str`.\n *\n * @param {String} str\n * @return {String}\n */\nfunction trim(str) {\n return str ? str.replace(TRIM_REGEX, EMPTY_STRING) : EMPTY_STRING;\n}\n", "var parse = require('inline-style-parser');\n\n/**\n * Parses inline style to object.\n *\n * @example\n * // returns { 'line-height': '42' }\n * StyleToObject('line-height: 42;');\n *\n * @param {String} style - The inline style.\n * @param {Function} [iterator] - The iterator function.\n * @return {null|Object}\n */\nfunction StyleToObject(style, iterator) {\n var output = null;\n if (!style || typeof style !== 'string') {\n return output;\n }\n\n var declaration;\n var declarations = parse(style);\n var hasIterator = typeof iterator === 'function';\n var property;\n var value;\n\n for (var i = 0, len = declarations.length; i < len; i++) {\n declaration = declarations[i];\n property = declaration.property;\n value = declaration.value;\n\n if (hasIterator) {\n iterator(property, value, declaration);\n } else if (value) {\n output || (output = {});\n output[property] = value;\n }\n }\n\n return output;\n}\n\nmodule.exports = StyleToObject;\nmodule.exports.default = StyleToObject; // ESM support\n", "import React from \"react\";\nimport ReactDOM from \"react-dom/client\";\nimport 'source-map-support/register';\nimport {App} from \"@/App\";\nimport * as rrweb from 'rrweb';\nimport {HTMLEvents, RRWebRecorder} from \"@/event/HTMLEvents\";\n\nglobal.React = React;\n\nconst isDev = process.env.PRODUCTION === \"false\";\n\n// TODO breadchris more logic can be added here to improve performance https://github.com/evanw/esbuild/blob/7d11ef1e24a3f0981e45e37200957268c4e22619/CHANGELOG.md?plain=1#L1009\nif (isDev) {\n new EventSource('/esbuild').addEventListener('change', () => location.reload())\n}\n\n// const recorder = new RRWebRecorder();\n// recorder.startRecording();\n\nconst root = ReactDOM.createRoot(document.getElementById(\"root\") as HTMLElement);\nroot.render(\n \n \n \n);\n", "require('./').install();\n", "import { CSSProperties } from 'react';\n\nexport type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';\nexport type ToastPosition =\n | 'top-left'\n | 'top-center'\n | 'top-right'\n | 'bottom-left'\n | 'bottom-center'\n | 'bottom-right';\n\nexport type Renderable = JSX.Element | string | null;\n\nexport interface IconTheme {\n primary: string;\n secondary: string;\n}\n\nexport type ValueFunction = (arg: TArg) => TValue;\nexport type ValueOrFunction =\n | TValue\n | ValueFunction;\n\nconst isFunction = (\n valOrFunction: ValueOrFunction\n): valOrFunction is ValueFunction =>\n typeof valOrFunction === 'function';\n\nexport const resolveValue = (\n valOrFunction: ValueOrFunction,\n arg: TArg\n): TValue => (isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction);\n\nexport interface Toast {\n type: ToastType;\n id: string;\n message: ValueOrFunction;\n icon?: Renderable;\n duration?: number;\n pauseDuration: number;\n position?: ToastPosition;\n\n ariaProps: {\n role: 'status' | 'alert';\n 'aria-live': 'assertive' | 'off' | 'polite';\n };\n\n style?: CSSProperties;\n className?: string;\n iconTheme?: IconTheme;\n\n createdAt: number;\n visible: boolean;\n height?: number;\n}\n\nexport type ToastOptions = Partial<\n Pick<\n Toast,\n | 'id'\n | 'icon'\n | 'duration'\n | 'ariaProps'\n | 'className'\n | 'style'\n | 'position'\n | 'iconTheme'\n >\n>;\n\nexport type DefaultToastOptions = ToastOptions & {\n [key in ToastType]?: ToastOptions;\n};\n\nexport interface ToasterProps {\n position?: ToastPosition;\n toastOptions?: DefaultToastOptions;\n reverseOrder?: boolean;\n gutter?: number;\n containerStyle?: React.CSSProperties;\n containerClassName?: string;\n children?: (toast: Toast) => JSX.Element;\n}\n\nexport interface ToastWrapperProps {\n id: string;\n className?: string;\n style?: React.CSSProperties;\n onHeightUpdate: (id: string, height: number) => void;\n children?: React.ReactNode;\n}\n", "export const genId = (() => {\n let count = 0;\n return () => {\n return (++count).toString();\n };\n})();\n\nexport const prefersReducedMotion = (() => {\n // Cache result\n let shouldReduceMotion: boolean | undefined = undefined;\n\n return () => {\n if (shouldReduceMotion === undefined && typeof window !== 'undefined') {\n const mediaQuery = matchMedia('(prefers-reduced-motion: reduce)');\n shouldReduceMotion = !mediaQuery || mediaQuery.matches;\n }\n return shouldReduceMotion;\n };\n})();\n", "import { useEffect, useState } from 'react';\nimport { DefaultToastOptions, Toast, ToastType } from './types';\n\nconst TOAST_LIMIT = 20;\n\nexport enum ActionType {\n ADD_TOAST,\n UPDATE_TOAST,\n UPSERT_TOAST,\n DISMISS_TOAST,\n REMOVE_TOAST,\n START_PAUSE,\n END_PAUSE,\n}\n\ntype Action =\n | {\n type: ActionType.ADD_TOAST;\n toast: Toast;\n }\n | {\n type: ActionType.UPSERT_TOAST;\n toast: Toast;\n }\n | {\n type: ActionType.UPDATE_TOAST;\n toast: Partial;\n }\n | {\n type: ActionType.DISMISS_TOAST;\n toastId?: string;\n }\n | {\n type: ActionType.REMOVE_TOAST;\n toastId?: string;\n }\n | {\n type: ActionType.START_PAUSE;\n time: number;\n }\n | {\n type: ActionType.END_PAUSE;\n time: number;\n };\n\ninterface State {\n toasts: Toast[];\n pausedAt: number | undefined;\n}\n\nconst toastTimeouts = new Map>();\n\nexport const TOAST_EXPIRE_DISMISS_DELAY = 1000;\n\nconst addToRemoveQueue = (toastId: string) => {\n if (toastTimeouts.has(toastId)) {\n return;\n }\n\n const timeout = setTimeout(() => {\n toastTimeouts.delete(toastId);\n dispatch({\n type: ActionType.REMOVE_TOAST,\n toastId: toastId,\n });\n }, TOAST_EXPIRE_DISMISS_DELAY);\n\n toastTimeouts.set(toastId, timeout);\n};\n\nconst clearFromRemoveQueue = (toastId: string) => {\n const timeout = toastTimeouts.get(toastId);\n if (timeout) {\n clearTimeout(timeout);\n }\n};\n\nexport const reducer = (state: State, action: Action): State => {\n switch (action.type) {\n case ActionType.ADD_TOAST:\n return {\n ...state,\n toasts: [action.toast, ...state.toasts].slice(0, TOAST_LIMIT),\n };\n\n case ActionType.UPDATE_TOAST:\n // ! Side effects !\n if (action.toast.id) {\n clearFromRemoveQueue(action.toast.id);\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === action.toast.id ? { ...t, ...action.toast } : t\n ),\n };\n\n case ActionType.UPSERT_TOAST:\n const { toast } = action;\n return state.toasts.find((t) => t.id === toast.id)\n ? reducer(state, { type: ActionType.UPDATE_TOAST, toast })\n : reducer(state, { type: ActionType.ADD_TOAST, toast });\n\n case ActionType.DISMISS_TOAST:\n const { toastId } = action;\n\n // ! Side effects ! - This could be execrated into a dismissToast() action, but I'll keep it here for simplicity\n if (toastId) {\n addToRemoveQueue(toastId);\n } else {\n state.toasts.forEach((toast) => {\n addToRemoveQueue(toast.id);\n });\n }\n\n return {\n ...state,\n toasts: state.toasts.map((t) =>\n t.id === toastId || toastId === undefined\n ? {\n ...t,\n visible: false,\n }\n : t\n ),\n };\n case ActionType.REMOVE_TOAST:\n if (action.toastId === undefined) {\n return {\n ...state,\n toasts: [],\n };\n }\n return {\n ...state,\n toasts: state.toasts.filter((t) => t.id !== action.toastId),\n };\n\n case ActionType.START_PAUSE:\n return {\n ...state,\n pausedAt: action.time,\n };\n\n case ActionType.END_PAUSE:\n const diff = action.time - (state.pausedAt || 0);\n\n return {\n ...state,\n pausedAt: undefined,\n toasts: state.toasts.map((t) => ({\n ...t,\n pauseDuration: t.pauseDuration + diff,\n })),\n };\n }\n};\n\nconst listeners: Array<(state: State) => void> = [];\n\nlet memoryState: State = { toasts: [], pausedAt: undefined };\n\nexport const dispatch = (action: Action) => {\n memoryState = reducer(memoryState, action);\n listeners.forEach((listener) => {\n listener(memoryState);\n });\n};\n\nexport const defaultTimeouts: {\n [key in ToastType]: number;\n} = {\n blank: 4000,\n error: 4000,\n success: 2000,\n loading: Infinity,\n custom: 4000,\n};\n\nexport const useStore = (toastOptions: DefaultToastOptions = {}): State => {\n const [state, setState] = useState(memoryState);\n useEffect(() => {\n listeners.push(setState);\n return () => {\n const index = listeners.indexOf(setState);\n if (index > -1) {\n listeners.splice(index, 1);\n }\n };\n }, [state]);\n\n const mergedToasts = state.toasts.map((t) => ({\n ...toastOptions,\n ...toastOptions[t.type],\n ...t,\n duration:\n t.duration ||\n toastOptions[t.type]?.duration ||\n toastOptions?.duration ||\n defaultTimeouts[t.type],\n style: {\n ...toastOptions.style,\n ...toastOptions[t.type]?.style,\n ...t.style,\n },\n }));\n\n return {\n ...state,\n toasts: mergedToasts,\n };\n};\n", "import {\n Renderable,\n Toast,\n ToastOptions,\n ToastType,\n DefaultToastOptions,\n ValueOrFunction,\n resolveValue,\n} from './types';\nimport { genId } from './utils';\nimport { dispatch, ActionType } from './store';\n\ntype Message = ValueOrFunction;\n\ntype ToastHandler = (message: Message, options?: ToastOptions) => string;\n\nconst createToast = (\n message: Message,\n type: ToastType = 'blank',\n opts?: ToastOptions\n): Toast => ({\n createdAt: Date.now(),\n visible: true,\n type,\n ariaProps: {\n role: 'status',\n 'aria-live': 'polite',\n },\n message,\n pauseDuration: 0,\n ...opts,\n id: opts?.id || genId(),\n});\n\nconst createHandler =\n (type?: ToastType): ToastHandler =>\n (message, options) => {\n const toast = createToast(message, type, options);\n dispatch({ type: ActionType.UPSERT_TOAST, toast });\n return toast.id;\n };\n\nconst toast = (message: Message, opts?: ToastOptions) =>\n createHandler('blank')(message, opts);\n\ntoast.error = createHandler('error');\ntoast.success = createHandler('success');\ntoast.loading = createHandler('loading');\ntoast.custom = createHandler('custom');\n\ntoast.dismiss = (toastId?: string) => {\n dispatch({\n type: ActionType.DISMISS_TOAST,\n toastId,\n });\n};\n\ntoast.remove = (toastId?: string) =>\n dispatch({ type: ActionType.REMOVE_TOAST, toastId });\n\ntoast.promise = (\n promise: Promise,\n msgs: {\n loading: Renderable;\n success: ValueOrFunction;\n error: ValueOrFunction;\n },\n opts?: DefaultToastOptions\n) => {\n const id = toast.loading(msgs.loading, { ...opts, ...opts?.loading });\n\n promise\n .then((p) => {\n toast.success(resolveValue(msgs.success, p), {\n id,\n ...opts,\n ...opts?.success,\n });\n return p;\n })\n .catch((e) => {\n toast.error(resolveValue(msgs.error, e), {\n id,\n ...opts,\n ...opts?.error,\n });\n });\n\n return promise;\n};\n\nexport { toast };\n", "import { useEffect, useCallback } from 'react';\nimport { dispatch, ActionType, useStore } from './store';\nimport { toast } from './toast';\nimport { DefaultToastOptions, Toast, ToastPosition } from './types';\n\nconst updateHeight = (toastId: string, height: number) => {\n dispatch({\n type: ActionType.UPDATE_TOAST,\n toast: { id: toastId, height },\n });\n};\nconst startPause = () => {\n dispatch({\n type: ActionType.START_PAUSE,\n time: Date.now(),\n });\n};\n\nexport const useToaster = (toastOptions?: DefaultToastOptions) => {\n const { toasts, pausedAt } = useStore(toastOptions);\n\n useEffect(() => {\n if (pausedAt) {\n return;\n }\n\n const now = Date.now();\n const timeouts = toasts.map((t) => {\n if (t.duration === Infinity) {\n return;\n }\n\n const durationLeft =\n (t.duration || 0) + t.pauseDuration - (now - t.createdAt);\n\n if (durationLeft < 0) {\n if (t.visible) {\n toast.dismiss(t.id);\n }\n return;\n }\n return setTimeout(() => toast.dismiss(t.id), durationLeft);\n });\n\n return () => {\n timeouts.forEach((timeout) => timeout && clearTimeout(timeout));\n };\n }, [toasts, pausedAt]);\n\n const endPause = useCallback(() => {\n if (pausedAt) {\n dispatch({ type: ActionType.END_PAUSE, time: Date.now() });\n }\n }, [pausedAt]);\n\n const calculateOffset = useCallback(\n (\n toast: Toast,\n opts?: {\n reverseOrder?: boolean;\n gutter?: number;\n defaultPosition?: ToastPosition;\n }\n ) => {\n const { reverseOrder = false, gutter = 8, defaultPosition } = opts || {};\n\n const relevantToasts = toasts.filter(\n (t) =>\n (t.position || defaultPosition) ===\n (toast.position || defaultPosition) && t.height\n );\n const toastIndex = relevantToasts.findIndex((t) => t.id === toast.id);\n const toastsBefore = relevantToasts.filter(\n (toast, i) => i < toastIndex && toast.visible\n ).length;\n\n const offset = relevantToasts\n .filter((t) => t.visible)\n .slice(...(reverseOrder ? [toastsBefore + 1] : [0, toastsBefore]))\n .reduce((acc, t) => acc + (t.height || 0) + gutter, 0);\n\n return offset;\n },\n [toasts]\n );\n\n return {\n toasts,\n handlers: {\n updateHeight,\n startPause,\n endPause,\n calculateOffset,\n },\n };\n};\n", "import * as React from 'react';\nimport { styled, keyframes } from 'goober';\n\nimport { Toast, ToastPosition, resolveValue, Renderable } from '../core/types';\nimport { ToastIcon } from './toast-icon';\nimport { prefersReducedMotion } from '../core/utils';\n\nconst enterAnimation = (factor: number) => `\n0% {transform: translate3d(0,${factor * -200}%,0) scale(.6); opacity:.5;}\n100% {transform: translate3d(0,0,0) scale(1); opacity:1;}\n`;\n\nconst exitAnimation = (factor: number) => `\n0% {transform: translate3d(0,0,-1px) scale(1); opacity:1;}\n100% {transform: translate3d(0,${factor * -150}%,-1px) scale(.6); opacity:0;}\n`;\n\nconst fadeInAnimation = `0%{opacity:0;} 100%{opacity:1;}`;\nconst fadeOutAnimation = `0%{opacity:1;} 100%{opacity:0;}`;\n\nconst ToastBarBase = styled('div')`\n display: flex;\n align-items: center;\n background: #fff;\n color: #363636;\n line-height: 1.3;\n will-change: transform;\n box-shadow: 0 3px 10px rgba(0, 0, 0, 0.1), 0 3px 3px rgba(0, 0, 0, 0.05);\n max-width: 350px;\n pointer-events: auto;\n padding: 8px 10px;\n border-radius: 8px;\n`;\n\nconst Message = styled('div')`\n display: flex;\n justify-content: center;\n margin: 4px 10px;\n color: inherit;\n flex: 1 1 auto;\n white-space: pre-line;\n`;\n\ninterface ToastBarProps {\n toast: Toast;\n position?: ToastPosition;\n style?: React.CSSProperties;\n children?: (components: {\n icon: Renderable;\n message: Renderable;\n }) => Renderable;\n}\n\nconst getAnimationStyle = (\n position: ToastPosition,\n visible: boolean\n): React.CSSProperties => {\n const top = position.includes('top');\n const factor = top ? 1 : -1;\n\n const [enter, exit] = prefersReducedMotion()\n ? [fadeInAnimation, fadeOutAnimation]\n : [enterAnimation(factor), exitAnimation(factor)];\n\n return {\n animation: visible\n ? `${keyframes(enter)} 0.35s cubic-bezier(.21,1.02,.73,1) forwards`\n : `${keyframes(exit)} 0.4s forwards cubic-bezier(.06,.71,.55,1)`,\n };\n};\n\nexport const ToastBar: React.FC = React.memo(\n ({ toast, position, style, children }) => {\n const animationStyle: React.CSSProperties = toast.height\n ? getAnimationStyle(\n toast.position || position || 'top-center',\n toast.visible\n )\n : { opacity: 0 };\n\n const icon = ;\n const message = (\n \n {resolveValue(toast.message, toast)}\n \n );\n\n return (\n \n {typeof children === 'function' ? (\n children({\n icon,\n message,\n })\n ) : (\n <>\n {icon}\n {message}\n \n )}\n \n );\n }\n);\n", "import * as React from 'react';\nimport { styled, keyframes } from 'goober';\n\nimport { Toast } from '../core/types';\nimport { ErrorIcon, ErrorTheme } from './error';\nimport { LoaderIcon, LoaderTheme } from './loader';\nimport { CheckmarkIcon, CheckmarkTheme } from './checkmark';\n\nconst StatusWrapper = styled('div')`\n position: absolute;\n`;\n\nconst IndicatorWrapper = styled('div')`\n position: relative;\n display: flex;\n justify-content: center;\n align-items: center;\n min-width: 20px;\n min-height: 20px;\n`;\n\nconst enter = keyframes`\nfrom {\n transform: scale(0.6);\n opacity: 0.4;\n}\nto {\n transform: scale(1);\n opacity: 1;\n}`;\n\nexport const AnimatedIconWrapper = styled('div')`\n position: relative;\n transform: scale(0.6);\n opacity: 0.4;\n min-width: 20px;\n animation: ${enter} 0.3s 0.12s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n forwards;\n`;\n\nexport type IconThemes = Partial<{\n success: CheckmarkTheme;\n error: ErrorTheme;\n loading: LoaderTheme;\n}>;\n\nexport const ToastIcon: React.FC<{\n toast: Toast;\n}> = ({ toast }) => {\n const { icon, type, iconTheme } = toast;\n if (icon !== undefined) {\n if (typeof icon === 'string') {\n return {icon};\n } else {\n return icon;\n }\n }\n\n if (type === 'blank') {\n return null;\n }\n\n return (\n \n \n {type !== 'loading' && (\n \n {type === 'error' ? (\n \n ) : (\n \n )}\n \n )}\n \n );\n};\n", "import { styled, keyframes } from 'goober';\n\nconst circleAnimation = keyframes`\nfrom {\n transform: scale(0) rotate(45deg);\n\topacity: 0;\n}\nto {\n transform: scale(1) rotate(45deg);\n opacity: 1;\n}`;\n\nconst firstLineAnimation = keyframes`\nfrom {\n transform: scale(0);\n opacity: 0;\n}\nto {\n transform: scale(1);\n opacity: 1;\n}`;\n\nconst secondLineAnimation = keyframes`\nfrom {\n transform: scale(0) rotate(90deg);\n\topacity: 0;\n}\nto {\n transform: scale(1) rotate(90deg);\n\topacity: 1;\n}`;\n\nexport interface ErrorTheme {\n primary?: string;\n secondary?: string;\n}\n\nexport const ErrorIcon = styled('div')`\n width: 20px;\n opacity: 0;\n height: 20px;\n border-radius: 10px;\n background: ${(p) => p.primary || '#ff4b4b'};\n position: relative;\n transform: rotate(45deg);\n\n animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n forwards;\n animation-delay: 100ms;\n\n &:after,\n &:before {\n content: '';\n animation: ${firstLineAnimation} 0.15s ease-out forwards;\n animation-delay: 150ms;\n position: absolute;\n border-radius: 3px;\n opacity: 0;\n background: ${(p) => p.secondary || '#fff'};\n bottom: 9px;\n left: 4px;\n height: 2px;\n width: 12px;\n }\n\n &:before {\n animation: ${secondLineAnimation} 0.15s ease-out forwards;\n animation-delay: 180ms;\n transform: rotate(90deg);\n }\n`;\n", "import { styled, keyframes } from 'goober';\n\nconst rotate = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(360deg);\n }\n`;\n\nexport interface LoaderTheme {\n primary?: string;\n secondary?: string;\n}\n\nexport const LoaderIcon = styled('div')`\n width: 12px;\n height: 12px;\n box-sizing: border-box;\n border: 2px solid;\n border-radius: 100%;\n border-color: ${(p) => p.secondary || '#e0e0e0'};\n border-right-color: ${(p) => p.primary || '#616161'};\n animation: ${rotate} 1s linear infinite;\n`;\n", "import { styled, keyframes } from 'goober';\n\nconst circleAnimation = keyframes`\nfrom {\n transform: scale(0) rotate(45deg);\n\topacity: 0;\n}\nto {\n transform: scale(1) rotate(45deg);\n\topacity: 1;\n}`;\n\nconst checkmarkAnimation = keyframes`\n0% {\n\theight: 0;\n\twidth: 0;\n\topacity: 0;\n}\n40% {\n height: 0;\n\twidth: 6px;\n\topacity: 1;\n}\n100% {\n opacity: 1;\n height: 10px;\n}`;\n\nexport interface CheckmarkTheme {\n primary?: string;\n secondary?: string;\n}\n\nexport const CheckmarkIcon = styled('div')`\n width: 20px;\n opacity: 0;\n height: 20px;\n border-radius: 10px;\n background: ${(p) => p.primary || '#61d345'};\n position: relative;\n transform: rotate(45deg);\n\n animation: ${circleAnimation} 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275)\n forwards;\n animation-delay: 100ms;\n &:after {\n content: '';\n box-sizing: border-box;\n animation: ${checkmarkAnimation} 0.2s ease-out forwards;\n opacity: 0;\n animation-delay: 200ms;\n position: absolute;\n border-right: 2px solid;\n border-bottom: 2px solid;\n border-color: ${(p) => p.secondary || '#fff'};\n bottom: 6px;\n left: 6px;\n height: 10px;\n width: 6px;\n }\n`;\n", "import { css, setup } from 'goober';\nimport * as React from 'react';\nimport {\n resolveValue,\n ToasterProps,\n ToastPosition,\n ToastWrapperProps,\n} from '../core/types';\nimport { useToaster } from '../core/use-toaster';\nimport { prefersReducedMotion } from '../core/utils';\nimport { ToastBar } from './toast-bar';\n\nsetup(React.createElement);\n\nconst ToastWrapper = ({\n id,\n className,\n style,\n onHeightUpdate,\n children,\n}: ToastWrapperProps) => {\n const ref = React.useCallback(\n (el: HTMLElement | null) => {\n if (el) {\n const updateHeight = () => {\n const height = el.getBoundingClientRect().height;\n onHeightUpdate(id, height);\n };\n updateHeight();\n new MutationObserver(updateHeight).observe(el, {\n subtree: true,\n childList: true,\n characterData: true,\n });\n }\n },\n [id, onHeightUpdate]\n );\n\n return (\n
\n {children}\n
\n );\n};\n\nconst getPositionStyle = (\n position: ToastPosition,\n offset: number\n): React.CSSProperties => {\n const top = position.includes('top');\n const verticalStyle: React.CSSProperties = top ? { top: 0 } : { bottom: 0 };\n const horizontalStyle: React.CSSProperties = position.includes('center')\n ? {\n justifyContent: 'center',\n }\n : position.includes('right')\n ? {\n justifyContent: 'flex-end',\n }\n : {};\n return {\n left: 0,\n right: 0,\n display: 'flex',\n position: 'absolute',\n transition: prefersReducedMotion()\n ? undefined\n : `all 230ms cubic-bezier(.21,1.02,.73,1)`,\n transform: `translateY(${offset * (top ? 1 : -1)}px)`,\n ...verticalStyle,\n ...horizontalStyle,\n };\n};\n\nconst activeClass = css`\n z-index: 9999;\n > * {\n pointer-events: auto;\n }\n`;\n\nconst DEFAULT_OFFSET = 16;\n\nexport const Toaster: React.FC = ({\n reverseOrder,\n position = 'top-center',\n toastOptions,\n gutter,\n children,\n containerStyle,\n containerClassName,\n}) => {\n const { toasts, handlers } = useToaster(toastOptions);\n\n return (\n \n {toasts.map((t) => {\n const toastPosition = t.position || position;\n const offset = handlers.calculateOffset(t, {\n reverseOrder,\n gutter,\n defaultPosition: position,\n });\n const positionStyle = getPositionStyle(toastPosition, offset);\n\n return (\n \n {t.type === 'custom' ? (\n resolveValue(t.message, t)\n ) : children ? (\n children(t)\n ) : (\n \n )}\n \n );\n })}\n \n );\n};\n", "import { toast } from './core/toast';\n\nexport * from './headless';\n\nexport { ToastBar } from './components/toast-bar';\nexport { ToastIcon } from './components/toast-icon';\nexport { Toaster } from './components/toaster';\nexport { CheckmarkIcon } from './components/checkmark';\nexport { ErrorIcon } from './components/error';\nexport { LoaderIcon } from './components/loader';\n\nexport { toast };\nexport default toast;\n", "let e={data:\"\"},t=t=>\"object\"==typeof window?((t?t.querySelector(\"#_goober\"):window._goober)||Object.assign((t||document.head).appendChild(document.createElement(\"style\")),{innerHTML:\" \",id:\"_goober\"})).firstChild:t||e,r=e=>{let r=t(e),l=r.data;return r.data=\"\",l},l=/(?:([\\u0080-\\uFFFF\\w-%@]+) *:? *([^{;]+?);|([^;}{]*?) *{)|(}\\s*)/g,a=/\\/\\*[^]*?\\*\\/| +/g,n=/\\n+/g,o=(e,t)=>{let r=\"\",l=\"\",a=\"\";for(let n in e){let c=e[n];\"@\"==n[0]?\"i\"==n[1]?r=n+\" \"+c+\";\":l+=\"f\"==n[1]?o(c,n):n+\"{\"+o(c,\"k\"==n[1]?\"\":t)+\"}\":\"object\"==typeof c?l+=o(c,t?t.replace(/([^,])+/g,e=>n.replace(/(^:.*)|([^,])+/g,t=>/&/.test(t)?t.replace(/&/g,e):e?e+\" \"+t:t)):n):null!=c&&(n=/^--/.test(n)?n:n.replace(/[A-Z]/g,\"-$&\").toLowerCase(),a+=o.p?o.p(n,c):n+\":\"+c+\";\")}return r+(t&&a?t+\"{\"+a+\"}\":a)+l},c={},s=e=>{if(\"object\"==typeof e){let t=\"\";for(let r in e)t+=r+s(e[r]);return t}return e},i=(e,t,r,i,p)=>{let u=s(e),d=c[u]||(c[u]=(e=>{let t=0,r=11;for(;t>>0;return\"go\"+r})(u));if(!c[d]){let t=u!==e?e:(e=>{let t,r,o=[{}];for(;t=l.exec(e.replace(a,\"\"));)t[4]?o.shift():t[3]?(r=t[3].replace(n,\" \").trim(),o.unshift(o[0][r]=o[0][r]||{})):o[0][t[1]]=t[2].replace(n,\" \").trim();return o[0]})(e);c[d]=o(p?{[\"@keyframes \"+d]:t}:t,r?\"\":\".\"+d)}let f=r&&c.g?c.g:null;return r&&(c.g=c[d]),((e,t,r,l)=>{l?t.data=t.data.replace(l,e):-1===t.data.indexOf(e)&&(t.data=r?e+t.data:t.data+e)})(c[d],t,i,f),d},p=(e,t,r)=>e.reduce((e,l,a)=>{let n=t[a];if(n&&n.call){let e=n(r),t=e&&e.props&&e.props.className||/^go/.test(e)&&e;n=t?\".\"+t:e&&\"object\"==typeof e?e.props?\"\":o(e,\"\"):!1===e?\"\":e}return e+l+(null==n?\"\":n)},\"\");function u(e){let r=this||{},l=e.call?e(r.p):e;return i(l.unshift?l.raw?p(l,[].slice.call(arguments,1),r.p):l.reduce((e,t)=>Object.assign(e,t&&t.call?t(r.p):t),{}):l,t(r.target),r.g,r.o,r.k)}let d,f,g,b=u.bind({g:1}),h=u.bind({k:1});function m(e,t,r,l){o.p=t,d=e,f=r,g=l}function j(e,t){let r=this||{};return function(){let l=arguments;function a(n,o){let c=Object.assign({},n),s=c.className||a.className;r.p=Object.assign({theme:f&&f()},c),r.o=/ *go\\d+/.test(s),c.className=u.apply(r,l)+(s?\" \"+s:\"\"),t&&(c.ref=o);let i=e;return e[0]&&(i=c.as||e,delete c.as),g&&i[0]&&g(c),d(i,c)}return t?t(a):a}}export{u as css,r as extractCss,b as glob,h as keyframes,m as setup,j as styled};\n", "////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Actions represent the type of change to a location value.\n */\nexport enum Action {\n /**\n * A POP indicates a change to an arbitrary index in the history stack, such\n * as a back or forward navigation. It does not describe the direction of the\n * navigation, only that the current index changed.\n *\n * Note: This is the default action for newly created history objects.\n */\n Pop = \"POP\",\n\n /**\n * A PUSH indicates a new entry being added to the history stack, such as when\n * a link is clicked and a new page loads. When this happens, all subsequent\n * entries in the stack are lost.\n */\n Push = \"PUSH\",\n\n /**\n * A REPLACE indicates the entry at the current index in the history stack\n * being replaced by a new one.\n */\n Replace = \"REPLACE\",\n}\n\n/**\n * The pathname, search, and hash values of a URL.\n */\nexport interface Path {\n /**\n * A URL pathname, beginning with a /.\n */\n pathname: string;\n\n /**\n * A URL search string, beginning with a ?.\n */\n search: string;\n\n /**\n * A URL fragment identifier, beginning with a #.\n */\n hash: string;\n}\n\n/**\n * An entry in a history stack. A location contains information about the\n * URL path, as well as possibly some arbitrary state and a key.\n */\nexport interface Location extends Path {\n /**\n * A value of arbitrary data associated with this location.\n */\n state: any;\n\n /**\n * A unique string associated with this location. May be used to safely store\n * and retrieve data in some other storage API, like `localStorage`.\n *\n * Note: This value is always \"default\" on the initial location.\n */\n key: string;\n}\n\n/**\n * A change to the current location.\n */\nexport interface Update {\n /**\n * The action that triggered the change.\n */\n action: Action;\n\n /**\n * The new location.\n */\n location: Location;\n\n /**\n * The delta between this location and the former location in the history stack\n */\n delta: number | null;\n}\n\n/**\n * A function that receives notifications about location changes.\n */\nexport interface Listener {\n (update: Update): void;\n}\n\n/**\n * Describes a location that is the destination of some navigation, either via\n * `history.push` or `history.replace`. May be either a URL or the pieces of a\n * URL path.\n */\nexport type To = string | Partial;\n\n/**\n * A history is an interface to the navigation stack. The history serves as the\n * source of truth for the current location, as well as provides a set of\n * methods that may be used to change it.\n *\n * It is similar to the DOM's `window.history` object, but with a smaller, more\n * focused API.\n */\nexport interface History {\n /**\n * The last action that modified the current location. This will always be\n * Action.Pop when a history instance is first created. This value is mutable.\n */\n readonly action: Action;\n\n /**\n * The current location. This value is mutable.\n */\n readonly location: Location;\n\n /**\n * Returns a valid href for the given `to` value that may be used as\n * the value of an attribute.\n *\n * @param to - The destination URL\n */\n createHref(to: To): string;\n\n /**\n * Returns a URL for the given `to` value\n *\n * @param to - The destination URL\n */\n createURL(to: To): URL;\n\n /**\n * Encode a location the same way window.history would do (no-op for memory\n * history) so we ensure our PUSH/REPLACE navigations for data routers\n * behave the same as POP\n *\n * @param to Unencoded path\n */\n encodeLocation(to: To): Path;\n\n /**\n * Pushes a new location onto the history stack, increasing its length by one.\n * If there were any entries in the stack after the current one, they are\n * lost.\n *\n * @param to - The new URL\n * @param state - Data to associate with the new location\n */\n push(to: To, state?: any): void;\n\n /**\n * Replaces the current location in the history stack with a new one. The\n * location that was replaced will no longer be available.\n *\n * @param to - The new URL\n * @param state - Data to associate with the new location\n */\n replace(to: To, state?: any): void;\n\n /**\n * Navigates `n` entries backward/forward in the history stack relative to the\n * current index. For example, a \"back\" navigation would use go(-1).\n *\n * @param delta - The delta in the stack index\n */\n go(delta: number): void;\n\n /**\n * Sets up a listener that will be called whenever the current location\n * changes.\n *\n * @param listener - A function that will be called when the location changes\n * @returns unlisten - A function that may be used to stop listening\n */\n listen(listener: Listener): () => void;\n}\n\ntype HistoryState = {\n usr: any;\n key?: string;\n idx: number;\n};\n\nconst PopStateEventType = \"popstate\";\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Memory History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A user-supplied object that describes a location. Used when providing\n * entries to `createMemoryHistory` via its `initialEntries` option.\n */\nexport type InitialEntry = string | Partial;\n\nexport type MemoryHistoryOptions = {\n initialEntries?: InitialEntry[];\n initialIndex?: number;\n v5Compat?: boolean;\n};\n\n/**\n * A memory history stores locations in memory. This is useful in stateful\n * environments where there is no web browser, such as node tests or React\n * Native.\n */\nexport interface MemoryHistory extends History {\n /**\n * The current index in the history stack.\n */\n readonly index: number;\n}\n\n/**\n * Memory history stores the current location in memory. It is designed for use\n * in stateful non-browser environments like tests and React Native.\n */\nexport function createMemoryHistory(\n options: MemoryHistoryOptions = {}\n): MemoryHistory {\n let { initialEntries = [\"/\"], initialIndex, v5Compat = false } = options;\n let entries: Location[]; // Declare so we can access from createMemoryLocation\n entries = initialEntries.map((entry, index) =>\n createMemoryLocation(\n entry,\n typeof entry === \"string\" ? null : entry.state,\n index === 0 ? \"default\" : undefined\n )\n );\n let index = clampIndex(\n initialIndex == null ? entries.length - 1 : initialIndex\n );\n let action = Action.Pop;\n let listener: Listener | null = null;\n\n function clampIndex(n: number): number {\n return Math.min(Math.max(n, 0), entries.length - 1);\n }\n function getCurrentLocation(): Location {\n return entries[index];\n }\n function createMemoryLocation(\n to: To,\n state: any = null,\n key?: string\n ): Location {\n let location = createLocation(\n entries ? getCurrentLocation().pathname : \"/\",\n to,\n state,\n key\n );\n warning(\n location.pathname.charAt(0) === \"/\",\n `relative pathnames are not supported in memory history: ${JSON.stringify(\n to\n )}`\n );\n return location;\n }\n\n function createHref(to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n let history: MemoryHistory = {\n get index() {\n return index;\n },\n get action() {\n return action;\n },\n get location() {\n return getCurrentLocation();\n },\n createHref,\n createURL(to) {\n return new URL(createHref(to), \"http://localhost\");\n },\n encodeLocation(to: To) {\n let path = typeof to === \"string\" ? parsePath(to) : to;\n return {\n pathname: path.pathname || \"\",\n search: path.search || \"\",\n hash: path.hash || \"\",\n };\n },\n push(to, state) {\n action = Action.Push;\n let nextLocation = createMemoryLocation(to, state);\n index += 1;\n entries.splice(index, entries.length, nextLocation);\n if (v5Compat && listener) {\n listener({ action, location: nextLocation, delta: 1 });\n }\n },\n replace(to, state) {\n action = Action.Replace;\n let nextLocation = createMemoryLocation(to, state);\n entries[index] = nextLocation;\n if (v5Compat && listener) {\n listener({ action, location: nextLocation, delta: 0 });\n }\n },\n go(delta) {\n action = Action.Pop;\n let nextIndex = clampIndex(index + delta);\n let nextLocation = entries[nextIndex];\n index = nextIndex;\n if (listener) {\n listener({ action, location: nextLocation, delta });\n }\n },\n listen(fn: Listener) {\n listener = fn;\n return () => {\n listener = null;\n };\n },\n };\n\n return history;\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Browser History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A browser history stores the current location in regular URLs in a web\n * browser environment. This is the standard for most web apps and provides the\n * cleanest URLs the browser's address bar.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#browserhistory\n */\nexport interface BrowserHistory extends UrlHistory {}\n\nexport type BrowserHistoryOptions = UrlHistoryOptions;\n\n/**\n * Browser history stores the location in regular URLs. This is the standard for\n * most web apps, but it requires some configuration on the server to ensure you\n * serve the same app at multiple URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createbrowserhistory\n */\nexport function createBrowserHistory(\n options: BrowserHistoryOptions = {}\n): BrowserHistory {\n function createBrowserLocation(\n window: Window,\n globalHistory: Window[\"history\"]\n ) {\n let { pathname, search, hash } = window.location;\n return createLocation(\n \"\",\n { pathname, search, hash },\n // state defaults to `null` because `window.history.state` does\n (globalHistory.state && globalHistory.state.usr) || null,\n (globalHistory.state && globalHistory.state.key) || \"default\"\n );\n }\n\n function createBrowserHref(window: Window, to: To) {\n return typeof to === \"string\" ? to : createPath(to);\n }\n\n return getUrlBasedHistory(\n createBrowserLocation,\n createBrowserHref,\n null,\n options\n );\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Hash History\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A hash history stores the current location in the fragment identifier portion\n * of the URL in a web browser environment.\n *\n * This is ideal for apps that do not control the server for some reason\n * (because the fragment identifier is never sent to the server), including some\n * shared hosting environments that do not provide fine-grained controls over\n * which pages are served at which URLs.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#hashhistory\n */\nexport interface HashHistory extends UrlHistory {}\n\nexport type HashHistoryOptions = UrlHistoryOptions;\n\n/**\n * Hash history stores the location in window.location.hash. This makes it ideal\n * for situations where you don't want to send the location to the server for\n * some reason, either because you do cannot configure it or the URL space is\n * reserved for something else.\n *\n * @see https://github.com/remix-run/history/tree/main/docs/api-reference.md#createhashhistory\n */\nexport function createHashHistory(\n options: HashHistoryOptions = {}\n): HashHistory {\n function createHashLocation(\n window: Window,\n globalHistory: Window[\"history\"]\n ) {\n let {\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n } = parsePath(window.location.hash.substr(1));\n\n // Hash URL should always have a leading / just like window.location.pathname\n // does, so if an app ends up at a route like /#something then we add a\n // leading slash so all of our path-matching behaves the same as if it would\n // in a browser router. This is particularly important when there exists a\n // root splat route () since that matches internally against\n // \"/*\" and we'd expect /#something to 404 in a hash router app.\n if (!pathname.startsWith(\"/\") && !pathname.startsWith(\".\")) {\n pathname = \"/\" + pathname;\n }\n\n return createLocation(\n \"\",\n { pathname, search, hash },\n // state defaults to `null` because `window.history.state` does\n (globalHistory.state && globalHistory.state.usr) || null,\n (globalHistory.state && globalHistory.state.key) || \"default\"\n );\n }\n\n function createHashHref(window: Window, to: To) {\n let base = window.document.querySelector(\"base\");\n let href = \"\";\n\n if (base && base.getAttribute(\"href\")) {\n let url = window.location.href;\n let hashIndex = url.indexOf(\"#\");\n href = hashIndex === -1 ? url : url.slice(0, hashIndex);\n }\n\n return href + \"#\" + (typeof to === \"string\" ? to : createPath(to));\n }\n\n function validateHashLocation(location: Location, to: To) {\n warning(\n location.pathname.charAt(0) === \"/\",\n `relative pathnames are not supported in hash history.push(${JSON.stringify(\n to\n )})`\n );\n }\n\n return getUrlBasedHistory(\n createHashLocation,\n createHashHref,\n validateHashLocation,\n options\n );\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region UTILS\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * @private\n */\nexport function invariant(value: boolean, message?: string): asserts value;\nexport function invariant(\n value: T | null | undefined,\n message?: string\n): asserts value is T;\nexport function invariant(value: any, message?: string) {\n if (value === false || value === null || typeof value === \"undefined\") {\n throw new Error(message);\n }\n}\n\nexport function warning(cond: any, message: string) {\n if (!cond) {\n // eslint-disable-next-line no-console\n if (typeof console !== \"undefined\") console.warn(message);\n\n try {\n // Welcome to debugging history!\n //\n // This error is thrown as a convenience so you can more easily\n // find the source for a warning that appears in the console by\n // enabling \"pause on exceptions\" in your JavaScript debugger.\n throw new Error(message);\n // eslint-disable-next-line no-empty\n } catch (e) {}\n }\n}\n\nfunction createKey() {\n return Math.random().toString(36).substr(2, 8);\n}\n\n/**\n * For browser-based histories, we combine the state and key into an object\n */\nfunction getHistoryState(location: Location, index: number): HistoryState {\n return {\n usr: location.state,\n key: location.key,\n idx: index,\n };\n}\n\n/**\n * Creates a Location object with a unique key from the given Path\n */\nexport function createLocation(\n current: string | Location,\n to: To,\n state: any = null,\n key?: string\n): Readonly {\n let location: Readonly = {\n pathname: typeof current === \"string\" ? current : current.pathname,\n search: \"\",\n hash: \"\",\n ...(typeof to === \"string\" ? parsePath(to) : to),\n state,\n // TODO: This could be cleaned up. push/replace should probably just take\n // full Locations now and avoid the need to run through this flow at all\n // But that's a pretty big refactor to the current test suite so going to\n // keep as is for the time being and just let any incoming keys take precedence\n key: (to && (to as Location).key) || key || createKey(),\n };\n return location;\n}\n\n/**\n * Creates a string URL path from the given pathname, search, and hash components.\n */\nexport function createPath({\n pathname = \"/\",\n search = \"\",\n hash = \"\",\n}: Partial) {\n if (search && search !== \"?\")\n pathname += search.charAt(0) === \"?\" ? search : \"?\" + search;\n if (hash && hash !== \"#\")\n pathname += hash.charAt(0) === \"#\" ? hash : \"#\" + hash;\n return pathname;\n}\n\n/**\n * Parses a string URL path into its separate pathname, search, and hash components.\n */\nexport function parsePath(path: string): Partial {\n let parsedPath: Partial = {};\n\n if (path) {\n let hashIndex = path.indexOf(\"#\");\n if (hashIndex >= 0) {\n parsedPath.hash = path.substr(hashIndex);\n path = path.substr(0, hashIndex);\n }\n\n let searchIndex = path.indexOf(\"?\");\n if (searchIndex >= 0) {\n parsedPath.search = path.substr(searchIndex);\n path = path.substr(0, searchIndex);\n }\n\n if (path) {\n parsedPath.pathname = path;\n }\n }\n\n return parsedPath;\n}\n\nexport interface UrlHistory extends History {}\n\nexport type UrlHistoryOptions = {\n window?: Window;\n v5Compat?: boolean;\n};\n\nfunction getUrlBasedHistory(\n getLocation: (window: Window, globalHistory: Window[\"history\"]) => Location,\n createHref: (window: Window, to: To) => string,\n validateLocation: ((location: Location, to: To) => void) | null,\n options: UrlHistoryOptions = {}\n): UrlHistory {\n let { window = document.defaultView!, v5Compat = false } = options;\n let globalHistory = window.history;\n let action = Action.Pop;\n let listener: Listener | null = null;\n\n let index = getIndex()!;\n // Index should only be null when we initialize. If not, it's because the\n // user called history.pushState or history.replaceState directly, in which\n // case we should log a warning as it will result in bugs.\n if (index == null) {\n index = 0;\n globalHistory.replaceState({ ...globalHistory.state, idx: index }, \"\");\n }\n\n function getIndex(): number {\n let state = globalHistory.state || { idx: null };\n return state.idx;\n }\n\n function handlePop() {\n action = Action.Pop;\n let nextIndex = getIndex();\n let delta = nextIndex == null ? null : nextIndex - index;\n index = nextIndex;\n if (listener) {\n listener({ action, location: history.location, delta });\n }\n }\n\n function push(to: To, state?: any) {\n action = Action.Push;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n\n index = getIndex() + 1;\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n\n // try...catch because iOS limits us to 100 pushState calls :/\n try {\n globalHistory.pushState(historyState, \"\", url);\n } catch (error) {\n // If the exception is because `state` can't be serialized, let that throw\n // outwards just like a replace call would so the dev knows the cause\n // https://html.spec.whatwg.org/multipage/nav-history-apis.html#shared-history-push/replace-state-steps\n // https://html.spec.whatwg.org/multipage/structured-data.html#structuredserializeinternal\n if (error instanceof DOMException && error.name === \"DataCloneError\") {\n throw error;\n }\n // They are going to lose state here, but there is no real\n // way to warn them about it since the page will refresh...\n window.location.assign(url);\n }\n\n if (v5Compat && listener) {\n listener({ action, location: history.location, delta: 1 });\n }\n }\n\n function replace(to: To, state?: any) {\n action = Action.Replace;\n let location = createLocation(history.location, to, state);\n if (validateLocation) validateLocation(location, to);\n\n index = getIndex();\n let historyState = getHistoryState(location, index);\n let url = history.createHref(location);\n globalHistory.replaceState(historyState, \"\", url);\n\n if (v5Compat && listener) {\n listener({ action, location: history.location, delta: 0 });\n }\n }\n\n function createURL(to: To): URL {\n // window.location.origin is \"null\" (the literal string value) in Firefox\n // under certain conditions, notably when serving from a local HTML file\n // See https://bugzilla.mozilla.org/show_bug.cgi?id=878297\n let base =\n window.location.origin !== \"null\"\n ? window.location.origin\n : window.location.href;\n\n let href = typeof to === \"string\" ? to : createPath(to);\n invariant(\n base,\n `No window.location.(origin|href) available to create URL for href: ${href}`\n );\n return new URL(href, base);\n }\n\n let history: History = {\n get action() {\n return action;\n },\n get location() {\n return getLocation(window, globalHistory);\n },\n listen(fn: Listener) {\n if (listener) {\n throw new Error(\"A history only accepts one active listener\");\n }\n window.addEventListener(PopStateEventType, handlePop);\n listener = fn;\n\n return () => {\n window.removeEventListener(PopStateEventType, handlePop);\n listener = null;\n };\n },\n createHref(to) {\n return createHref(window, to);\n },\n createURL,\n encodeLocation(to) {\n // Encode a Location the same way window.location would\n let url = createURL(to);\n return {\n pathname: url.pathname,\n search: url.search,\n hash: url.hash,\n };\n },\n push,\n replace,\n go(n) {\n return globalHistory.go(n);\n },\n };\n\n return history;\n}\n\n//#endregion\n", "import type { Location, Path, To } from \"./history\";\nimport { warning, invariant, parsePath } from \"./history\";\n\n/**\n * Map of routeId -> data returned from a loader/action/error\n */\nexport interface RouteData {\n [routeId: string]: any;\n}\n\nexport enum ResultType {\n data = \"data\",\n deferred = \"deferred\",\n redirect = \"redirect\",\n error = \"error\",\n}\n\n/**\n * Successful result from a loader or action\n */\nexport interface SuccessResult {\n type: ResultType.data;\n data: any;\n statusCode?: number;\n headers?: Headers;\n}\n\n/**\n * Successful defer() result from a loader or action\n */\nexport interface DeferredResult {\n type: ResultType.deferred;\n deferredData: DeferredData;\n statusCode?: number;\n headers?: Headers;\n}\n\n/**\n * Redirect result from a loader or action\n */\nexport interface RedirectResult {\n type: ResultType.redirect;\n status: number;\n location: string;\n revalidate: boolean;\n reloadDocument?: boolean;\n}\n\n/**\n * Unsuccessful result from a loader or action\n */\nexport interface ErrorResult {\n type: ResultType.error;\n error: any;\n headers?: Headers;\n}\n\n/**\n * Result from a loader or action - potentially successful or unsuccessful\n */\nexport type DataResult =\n | SuccessResult\n | DeferredResult\n | RedirectResult\n | ErrorResult;\n\ntype LowerCaseFormMethod = \"get\" | \"post\" | \"put\" | \"patch\" | \"delete\";\ntype UpperCaseFormMethod = Uppercase;\n\n/**\n * Users can specify either lowercase or uppercase form methods on
,\n * useSubmit(), , etc.\n */\nexport type HTMLFormMethod = LowerCaseFormMethod | UpperCaseFormMethod;\n\n/**\n * Active navigation/fetcher form methods are exposed in lowercase on the\n * RouterState\n */\nexport type FormMethod = LowerCaseFormMethod;\nexport type MutationFormMethod = Exclude;\n\n/**\n * In v7, active navigation/fetcher form methods are exposed in uppercase on the\n * RouterState. This is to align with the normalization done via fetch().\n */\nexport type V7_FormMethod = UpperCaseFormMethod;\nexport type V7_MutationFormMethod = Exclude;\n\nexport type FormEncType =\n | \"application/x-www-form-urlencoded\"\n | \"multipart/form-data\"\n | \"application/json\"\n | \"text/plain\";\n\n// Thanks https://github.com/sindresorhus/type-fest!\ntype JsonObject = { [Key in string]: JsonValue } & {\n [Key in string]?: JsonValue | undefined;\n};\ntype JsonArray = JsonValue[] | readonly JsonValue[];\ntype JsonPrimitive = string | number | boolean | null;\ntype JsonValue = JsonPrimitive | JsonObject | JsonArray;\n\n/**\n * @private\n * Internal interface to pass around for action submissions, not intended for\n * external consumption\n */\nexport type Submission =\n | {\n formMethod: FormMethod | V7_FormMethod;\n formAction: string;\n formEncType: FormEncType;\n formData: FormData;\n json: undefined;\n text: undefined;\n }\n | {\n formMethod: FormMethod | V7_FormMethod;\n formAction: string;\n formEncType: FormEncType;\n formData: undefined;\n json: JsonValue;\n text: undefined;\n }\n | {\n formMethod: FormMethod | V7_FormMethod;\n formAction: string;\n formEncType: FormEncType;\n formData: undefined;\n json: undefined;\n text: string;\n };\n\n/**\n * @private\n * Arguments passed to route loader/action functions. Same for now but we keep\n * this as a private implementation detail in case they diverge in the future.\n */\ninterface DataFunctionArgs {\n request: Request;\n params: Params;\n context?: any;\n}\n\n/**\n * Arguments passed to loader functions\n */\nexport interface LoaderFunctionArgs extends DataFunctionArgs {}\n\n/**\n * Arguments passed to action functions\n */\nexport interface ActionFunctionArgs extends DataFunctionArgs {}\n\n/**\n * Loaders and actions can return anything except `undefined` (`null` is a\n * valid return value if there is no data to return). Responses are preferred\n * and will ease any future migration to Remix\n */\ntype DataFunctionValue = Response | NonNullable | null;\n\n/**\n * Route loader function signature\n */\nexport interface LoaderFunction {\n (args: LoaderFunctionArgs): Promise | DataFunctionValue;\n}\n\n/**\n * Route action function signature\n */\nexport interface ActionFunction {\n (args: ActionFunctionArgs): Promise | DataFunctionValue;\n}\n\n/**\n * Route shouldRevalidate function signature. This runs after any submission\n * (navigation or fetcher), so we flatten the navigation/fetcher submission\n * onto the arguments. It shouldn't matter whether it came from a navigation\n * or a fetcher, what really matters is the URLs and the formData since loaders\n * have to re-run based on the data models that were potentially mutated.\n */\nexport interface ShouldRevalidateFunction {\n (args: {\n currentUrl: URL;\n currentParams: AgnosticDataRouteMatch[\"params\"];\n nextUrl: URL;\n nextParams: AgnosticDataRouteMatch[\"params\"];\n formMethod?: Submission[\"formMethod\"];\n formAction?: Submission[\"formAction\"];\n formEncType?: Submission[\"formEncType\"];\n text?: Submission[\"text\"];\n formData?: Submission[\"formData\"];\n json?: Submission[\"json\"];\n actionResult?: DataResult;\n defaultShouldRevalidate: boolean;\n }): boolean;\n}\n\n/**\n * Function provided by the framework-aware layers to set `hasErrorBoundary`\n * from the framework-aware `errorElement` prop\n *\n * @deprecated Use `mapRouteProperties` instead\n */\nexport interface DetectErrorBoundaryFunction {\n (route: AgnosticRouteObject): boolean;\n}\n\n/**\n * Function provided by the framework-aware layers to set any framework-specific\n * properties from framework-agnostic properties\n */\nexport interface MapRoutePropertiesFunction {\n (route: AgnosticRouteObject): {\n hasErrorBoundary: boolean;\n } & Record;\n}\n\n/**\n * Keys we cannot change from within a lazy() function. We spread all other keys\n * onto the route. Either they're meaningful to the router, or they'll get\n * ignored.\n */\nexport type ImmutableRouteKey =\n | \"lazy\"\n | \"caseSensitive\"\n | \"path\"\n | \"id\"\n | \"index\"\n | \"children\";\n\nexport const immutableRouteKeys = new Set([\n \"lazy\",\n \"caseSensitive\",\n \"path\",\n \"id\",\n \"index\",\n \"children\",\n]);\n\ntype RequireOne = Exclude<\n {\n [K in keyof T]: K extends Key ? Omit & Required> : never;\n }[keyof T],\n undefined\n>;\n\n/**\n * lazy() function to load a route definition, which can add non-matching\n * related properties to a route\n */\nexport interface LazyRouteFunction {\n (): Promise>>;\n}\n\n/**\n * Base RouteObject with common props shared by all types of routes\n */\ntype AgnosticBaseRouteObject = {\n caseSensitive?: boolean;\n path?: string;\n id?: string;\n loader?: LoaderFunction;\n action?: ActionFunction;\n hasErrorBoundary?: boolean;\n shouldRevalidate?: ShouldRevalidateFunction;\n handle?: any;\n lazy?: LazyRouteFunction;\n};\n\n/**\n * Index routes must not have children\n */\nexport type AgnosticIndexRouteObject = AgnosticBaseRouteObject & {\n children?: undefined;\n index: true;\n};\n\n/**\n * Non-index routes may have children, but cannot have index\n */\nexport type AgnosticNonIndexRouteObject = AgnosticBaseRouteObject & {\n children?: AgnosticRouteObject[];\n index?: false;\n};\n\n/**\n * A route object represents a logical route, with (optionally) its child\n * routes organized in a tree-like structure.\n */\nexport type AgnosticRouteObject =\n | AgnosticIndexRouteObject\n | AgnosticNonIndexRouteObject;\n\nexport type AgnosticDataIndexRouteObject = AgnosticIndexRouteObject & {\n id: string;\n};\n\nexport type AgnosticDataNonIndexRouteObject = AgnosticNonIndexRouteObject & {\n children?: AgnosticDataRouteObject[];\n id: string;\n};\n\n/**\n * A data route object, which is just a RouteObject with a required unique ID\n */\nexport type AgnosticDataRouteObject =\n | AgnosticDataIndexRouteObject\n | AgnosticDataNonIndexRouteObject;\n\nexport type RouteManifest = Record;\n\n// Recursive helper for finding path parameters in the absence of wildcards\ntype _PathParam =\n // split path into individual path segments\n Path extends `${infer L}/${infer R}`\n ? _PathParam | _PathParam\n : // find params after `:`\n Path extends `:${infer Param}`\n ? Param extends `${infer Optional}?`\n ? Optional\n : Param\n : // otherwise, there aren't any params present\n never;\n\n/**\n * Examples:\n * \"/a/b/*\" -> \"*\"\n * \":a\" -> \"a\"\n * \"/a/:b\" -> \"b\"\n * \"/a/blahblahblah:b\" -> \"b\"\n * \"/:a/:b\" -> \"a\" | \"b\"\n * \"/:a/b/:c/*\" -> \"a\" | \"c\" | \"*\"\n */\ntype PathParam =\n // check if path is just a wildcard\n Path extends \"*\" | \"/*\"\n ? \"*\"\n : // look for wildcard at the end of the path\n Path extends `${infer Rest}/*`\n ? \"*\" | _PathParam\n : // look for params in the absence of wildcards\n _PathParam;\n\n// Attempt to parse the given string segment. If it fails, then just return the\n// plain string type as a default fallback. Otherwise return the union of the\n// parsed string literals that were referenced as dynamic segments in the route.\nexport type ParamParseKey =\n // if could not find path params, fallback to `string`\n [PathParam] extends [never] ? string : PathParam;\n\n/**\n * The parameters that were parsed from the URL path.\n */\nexport type Params = {\n readonly [key in Key]: string | undefined;\n};\n\n/**\n * A RouteMatch contains info about how a route matched a URL.\n */\nexport interface AgnosticRouteMatch<\n ParamKey extends string = string,\n RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject\n> {\n /**\n * The names and values of dynamic parameters in the URL.\n */\n params: Params;\n /**\n * The portion of the URL pathname that was matched.\n */\n pathname: string;\n /**\n * The portion of the URL pathname that was matched before child routes.\n */\n pathnameBase: string;\n /**\n * The route object that was used to match.\n */\n route: RouteObjectType;\n}\n\nexport interface AgnosticDataRouteMatch\n extends AgnosticRouteMatch {}\n\nfunction isIndexRoute(\n route: AgnosticRouteObject\n): route is AgnosticIndexRouteObject {\n return route.index === true;\n}\n\n// Walk the route tree generating unique IDs where necessary so we are working\n// solely with AgnosticDataRouteObject's within the Router\nexport function convertRoutesToDataRoutes(\n routes: AgnosticRouteObject[],\n mapRouteProperties: MapRoutePropertiesFunction,\n parentPath: number[] = [],\n manifest: RouteManifest = {}\n): AgnosticDataRouteObject[] {\n return routes.map((route, index) => {\n let treePath = [...parentPath, index];\n let id = typeof route.id === \"string\" ? route.id : treePath.join(\"-\");\n invariant(\n route.index !== true || !route.children,\n `Cannot specify children on an index route`\n );\n invariant(\n !manifest[id],\n `Found a route id collision on id \"${id}\". Route ` +\n \"id's must be globally unique within Data Router usages\"\n );\n\n if (isIndexRoute(route)) {\n let indexRoute: AgnosticDataIndexRouteObject = {\n ...route,\n ...mapRouteProperties(route),\n id,\n };\n manifest[id] = indexRoute;\n return indexRoute;\n } else {\n let pathOrLayoutRoute: AgnosticDataNonIndexRouteObject = {\n ...route,\n ...mapRouteProperties(route),\n id,\n children: undefined,\n };\n manifest[id] = pathOrLayoutRoute;\n\n if (route.children) {\n pathOrLayoutRoute.children = convertRoutesToDataRoutes(\n route.children,\n mapRouteProperties,\n treePath,\n manifest\n );\n }\n\n return pathOrLayoutRoute;\n }\n });\n}\n\n/**\n * Matches the given routes to a location and returns the match data.\n *\n * @see https://reactrouter.com/utils/match-routes\n */\nexport function matchRoutes<\n RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject\n>(\n routes: RouteObjectType[],\n locationArg: Partial | string,\n basename = \"/\"\n): AgnosticRouteMatch[] | null {\n let location =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n let pathname = stripBasename(location.pathname || \"/\", basename);\n\n if (pathname == null) {\n return null;\n }\n\n let branches = flattenRoutes(routes);\n rankRouteBranches(branches);\n\n let matches = null;\n for (let i = 0; matches == null && i < branches.length; ++i) {\n matches = matchRouteBranch(\n branches[i],\n // Incoming pathnames are generally encoded from either window.location\n // or from router.navigate, but we want to match against the unencoded\n // paths in the route definitions. Memory router locations won't be\n // encoded here but there also shouldn't be anything to decode so this\n // should be a safe operation. This avoids needing matchRoutes to be\n // history-aware.\n safelyDecodeURI(pathname)\n );\n }\n\n return matches;\n}\n\ninterface RouteMeta<\n RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject\n> {\n relativePath: string;\n caseSensitive: boolean;\n childrenIndex: number;\n route: RouteObjectType;\n}\n\ninterface RouteBranch<\n RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject\n> {\n path: string;\n score: number;\n routesMeta: RouteMeta[];\n}\n\nfunction flattenRoutes<\n RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject\n>(\n routes: RouteObjectType[],\n branches: RouteBranch[] = [],\n parentsMeta: RouteMeta[] = [],\n parentPath = \"\"\n): RouteBranch[] {\n let flattenRoute = (\n route: RouteObjectType,\n index: number,\n relativePath?: string\n ) => {\n let meta: RouteMeta = {\n relativePath:\n relativePath === undefined ? route.path || \"\" : relativePath,\n caseSensitive: route.caseSensitive === true,\n childrenIndex: index,\n route,\n };\n\n if (meta.relativePath.startsWith(\"/\")) {\n invariant(\n meta.relativePath.startsWith(parentPath),\n `Absolute route path \"${meta.relativePath}\" nested under path ` +\n `\"${parentPath}\" is not valid. An absolute child route path ` +\n `must start with the combined path of all its parent routes.`\n );\n\n meta.relativePath = meta.relativePath.slice(parentPath.length);\n }\n\n let path = joinPaths([parentPath, meta.relativePath]);\n let routesMeta = parentsMeta.concat(meta);\n\n // Add the children before adding this route to the array so we traverse the\n // route tree depth-first and child routes appear before their parents in\n // the \"flattened\" version.\n if (route.children && route.children.length > 0) {\n invariant(\n // Our types know better, but runtime JS may not!\n // @ts-expect-error\n route.index !== true,\n `Index routes must not have child routes. Please remove ` +\n `all child routes from route path \"${path}\".`\n );\n\n flattenRoutes(route.children, branches, routesMeta, path);\n }\n\n // Routes without a path shouldn't ever match by themselves unless they are\n // index routes, so don't add them to the list of possible branches.\n if (route.path == null && !route.index) {\n return;\n }\n\n branches.push({\n path,\n score: computeScore(path, route.index),\n routesMeta,\n });\n };\n routes.forEach((route, index) => {\n // coarse-grain check for optional params\n if (route.path === \"\" || !route.path?.includes(\"?\")) {\n flattenRoute(route, index);\n } else {\n for (let exploded of explodeOptionalSegments(route.path)) {\n flattenRoute(route, index, exploded);\n }\n }\n });\n\n return branches;\n}\n\n/**\n * Computes all combinations of optional path segments for a given path,\n * excluding combinations that are ambiguous and of lower priority.\n *\n * For example, `/one/:two?/three/:four?/:five?` explodes to:\n * - `/one/three`\n * - `/one/:two/three`\n * - `/one/three/:four`\n * - `/one/three/:five`\n * - `/one/:two/three/:four`\n * - `/one/:two/three/:five`\n * - `/one/three/:four/:five`\n * - `/one/:two/three/:four/:five`\n */\nfunction explodeOptionalSegments(path: string): string[] {\n let segments = path.split(\"/\");\n if (segments.length === 0) return [];\n\n let [first, ...rest] = segments;\n\n // Optional path segments are denoted by a trailing `?`\n let isOptional = first.endsWith(\"?\");\n // Compute the corresponding required segment: `foo?` -> `foo`\n let required = first.replace(/\\?$/, \"\");\n\n if (rest.length === 0) {\n // Intepret empty string as omitting an optional segment\n // `[\"one\", \"\", \"three\"]` corresponds to omitting `:two` from `/one/:two?/three` -> `/one/three`\n return isOptional ? [required, \"\"] : [required];\n }\n\n let restExploded = explodeOptionalSegments(rest.join(\"/\"));\n\n let result: string[] = [];\n\n // All child paths with the prefix. Do this for all children before the\n // optional version for all children so we get consistent ordering where the\n // parent optional aspect is preferred as required. Otherwise, we can get\n // child sections interspersed where deeper optional segments are higher than\n // parent optional segments, where for example, /:two would explodes _earlier_\n // then /:one. By always including the parent as required _for all children_\n // first, we avoid this issue\n result.push(\n ...restExploded.map((subpath) =>\n subpath === \"\" ? required : [required, subpath].join(\"/\")\n )\n );\n\n // Then if this is an optional value, add all child versions without\n if (isOptional) {\n result.push(...restExploded);\n }\n\n // for absolute paths, ensure `/` instead of empty segment\n return result.map((exploded) =>\n path.startsWith(\"/\") && exploded === \"\" ? \"/\" : exploded\n );\n}\n\nfunction rankRouteBranches(branches: RouteBranch[]): void {\n branches.sort((a, b) =>\n a.score !== b.score\n ? b.score - a.score // Higher score first\n : compareIndexes(\n a.routesMeta.map((meta) => meta.childrenIndex),\n b.routesMeta.map((meta) => meta.childrenIndex)\n )\n );\n}\n\nconst paramRe = /^:\\w+$/;\nconst dynamicSegmentValue = 3;\nconst indexRouteValue = 2;\nconst emptySegmentValue = 1;\nconst staticSegmentValue = 10;\nconst splatPenalty = -2;\nconst isSplat = (s: string) => s === \"*\";\n\nfunction computeScore(path: string, index: boolean | undefined): number {\n let segments = path.split(\"/\");\n let initialScore = segments.length;\n if (segments.some(isSplat)) {\n initialScore += splatPenalty;\n }\n\n if (index) {\n initialScore += indexRouteValue;\n }\n\n return segments\n .filter((s) => !isSplat(s))\n .reduce(\n (score, segment) =>\n score +\n (paramRe.test(segment)\n ? dynamicSegmentValue\n : segment === \"\"\n ? emptySegmentValue\n : staticSegmentValue),\n initialScore\n );\n}\n\nfunction compareIndexes(a: number[], b: number[]): number {\n let siblings =\n a.length === b.length && a.slice(0, -1).every((n, i) => n === b[i]);\n\n return siblings\n ? // If two routes are siblings, we should try to match the earlier sibling\n // first. This allows people to have fine-grained control over the matching\n // behavior by simply putting routes with identical paths in the order they\n // want them tried.\n a[a.length - 1] - b[b.length - 1]\n : // Otherwise, it doesn't really make sense to rank non-siblings by index,\n // so they sort equally.\n 0;\n}\n\nfunction matchRouteBranch<\n ParamKey extends string = string,\n RouteObjectType extends AgnosticRouteObject = AgnosticRouteObject\n>(\n branch: RouteBranch,\n pathname: string\n): AgnosticRouteMatch[] | null {\n let { routesMeta } = branch;\n\n let matchedParams = {};\n let matchedPathname = \"/\";\n let matches: AgnosticRouteMatch[] = [];\n for (let i = 0; i < routesMeta.length; ++i) {\n let meta = routesMeta[i];\n let end = i === routesMeta.length - 1;\n let remainingPathname =\n matchedPathname === \"/\"\n ? pathname\n : pathname.slice(matchedPathname.length) || \"/\";\n let match = matchPath(\n { path: meta.relativePath, caseSensitive: meta.caseSensitive, end },\n remainingPathname\n );\n\n if (!match) return null;\n\n Object.assign(matchedParams, match.params);\n\n let route = meta.route;\n\n matches.push({\n // TODO: Can this as be avoided?\n params: matchedParams as Params,\n pathname: joinPaths([matchedPathname, match.pathname]),\n pathnameBase: normalizePathname(\n joinPaths([matchedPathname, match.pathnameBase])\n ),\n route,\n });\n\n if (match.pathnameBase !== \"/\") {\n matchedPathname = joinPaths([matchedPathname, match.pathnameBase]);\n }\n }\n\n return matches;\n}\n\n/**\n * Returns a path with params interpolated.\n *\n * @see https://reactrouter.com/utils/generate-path\n */\nexport function generatePath(\n originalPath: Path,\n params: {\n [key in PathParam]: string | null;\n } = {} as any\n): string {\n let path: string = originalPath;\n if (path.endsWith(\"*\") && path !== \"*\" && !path.endsWith(\"/*\")) {\n warning(\n false,\n `Route path \"${path}\" will be treated as if it were ` +\n `\"${path.replace(/\\*$/, \"/*\")}\" because the \\`*\\` character must ` +\n `always follow a \\`/\\` in the pattern. To get rid of this warning, ` +\n `please change the route path to \"${path.replace(/\\*$/, \"/*\")}\".`\n );\n path = path.replace(/\\*$/, \"/*\") as Path;\n }\n\n // ensure `/` is added at the beginning if the path is absolute\n const prefix = path.startsWith(\"/\") ? \"/\" : \"\";\n\n const stringify = (p: any) =>\n p == null ? \"\" : typeof p === \"string\" ? p : String(p);\n\n const segments = path\n .split(/\\/+/)\n .map((segment, index, array) => {\n const isLastSegment = index === array.length - 1;\n\n // only apply the splat if it's the last segment\n if (isLastSegment && segment === \"*\") {\n const star = \"*\" as PathParam;\n // Apply the splat\n return stringify(params[star]);\n }\n\n const keyMatch = segment.match(/^:(\\w+)(\\??)$/);\n if (keyMatch) {\n const [, key, optional] = keyMatch;\n let param = params[key as PathParam];\n invariant(optional === \"?\" || param != null, `Missing \":${key}\" param`);\n return stringify(param);\n }\n\n // Remove any optional markers from optional static segments\n return segment.replace(/\\?$/g, \"\");\n })\n // Remove empty segments\n .filter((segment) => !!segment);\n\n return prefix + segments.join(\"/\");\n}\n\n/**\n * A PathPattern is used to match on some portion of a URL pathname.\n */\nexport interface PathPattern {\n /**\n * A string to match against a URL pathname. May contain `:id`-style segments\n * to indicate placeholders for dynamic parameters. May also end with `/*` to\n * indicate matching the rest of the URL pathname.\n */\n path: Path;\n /**\n * Should be `true` if the static portions of the `path` should be matched in\n * the same case.\n */\n caseSensitive?: boolean;\n /**\n * Should be `true` if this pattern should match the entire URL pathname.\n */\n end?: boolean;\n}\n\n/**\n * A PathMatch contains info about how a PathPattern matched on a URL pathname.\n */\nexport interface PathMatch {\n /**\n * The names and values of dynamic parameters in the URL.\n */\n params: Params;\n /**\n * The portion of the URL pathname that was matched.\n */\n pathname: string;\n /**\n * The portion of the URL pathname that was matched before child routes.\n */\n pathnameBase: string;\n /**\n * The pattern that was used to match.\n */\n pattern: PathPattern;\n}\n\ntype Mutable = {\n -readonly [P in keyof T]: T[P];\n};\n\n/**\n * Performs pattern matching on a URL pathname and returns information about\n * the match.\n *\n * @see https://reactrouter.com/utils/match-path\n */\nexport function matchPath<\n ParamKey extends ParamParseKey,\n Path extends string\n>(\n pattern: PathPattern | Path,\n pathname: string\n): PathMatch | null {\n if (typeof pattern === \"string\") {\n pattern = { path: pattern, caseSensitive: false, end: true };\n }\n\n let [matcher, paramNames] = compilePath(\n pattern.path,\n pattern.caseSensitive,\n pattern.end\n );\n\n let match = pathname.match(matcher);\n if (!match) return null;\n\n let matchedPathname = match[0];\n let pathnameBase = matchedPathname.replace(/(.)\\/+$/, \"$1\");\n let captureGroups = match.slice(1);\n let params: Params = paramNames.reduce>(\n (memo, paramName, index) => {\n // We need to compute the pathnameBase here using the raw splat value\n // instead of using params[\"*\"] later because it will be decoded then\n if (paramName === \"*\") {\n let splatValue = captureGroups[index] || \"\";\n pathnameBase = matchedPathname\n .slice(0, matchedPathname.length - splatValue.length)\n .replace(/(.)\\/+$/, \"$1\");\n }\n\n memo[paramName] = safelyDecodeURIComponent(\n captureGroups[index] || \"\",\n paramName\n );\n return memo;\n },\n {}\n );\n\n return {\n params,\n pathname: matchedPathname,\n pathnameBase,\n pattern,\n };\n}\n\nfunction compilePath(\n path: string,\n caseSensitive = false,\n end = true\n): [RegExp, string[]] {\n warning(\n path === \"*\" || !path.endsWith(\"*\") || path.endsWith(\"/*\"),\n `Route path \"${path}\" will be treated as if it were ` +\n `\"${path.replace(/\\*$/, \"/*\")}\" because the \\`*\\` character must ` +\n `always follow a \\`/\\` in the pattern. To get rid of this warning, ` +\n `please change the route path to \"${path.replace(/\\*$/, \"/*\")}\".`\n );\n\n let paramNames: string[] = [];\n let regexpSource =\n \"^\" +\n path\n .replace(/\\/*\\*?$/, \"\") // Ignore trailing / and /*, we'll handle it below\n .replace(/^\\/*/, \"/\") // Make sure it has a leading /\n .replace(/[\\\\.*+^$?{}|()[\\]]/g, \"\\\\$&\") // Escape special regex chars\n .replace(/\\/:(\\w+)/g, (_: string, paramName: string) => {\n paramNames.push(paramName);\n return \"/([^\\\\/]+)\";\n });\n\n if (path.endsWith(\"*\")) {\n paramNames.push(\"*\");\n regexpSource +=\n path === \"*\" || path === \"/*\"\n ? \"(.*)$\" // Already matched the initial /, just match the rest\n : \"(?:\\\\/(.+)|\\\\/*)$\"; // Don't include the / in params[\"*\"]\n } else if (end) {\n // When matching to the end, ignore trailing slashes\n regexpSource += \"\\\\/*$\";\n } else if (path !== \"\" && path !== \"/\") {\n // If our path is non-empty and contains anything beyond an initial slash,\n // then we have _some_ form of path in our regex so we should expect to\n // match only if we find the end of this path segment. Look for an optional\n // non-captured trailing slash (to match a portion of the URL) or the end\n // of the path (if we've matched to the end). We used to do this with a\n // word boundary but that gives false positives on routes like\n // /user-preferences since `-` counts as a word boundary.\n regexpSource += \"(?:(?=\\\\/|$))\";\n } else {\n // Nothing to match for \"\" or \"/\"\n }\n\n let matcher = new RegExp(regexpSource, caseSensitive ? undefined : \"i\");\n\n return [matcher, paramNames];\n}\n\nfunction safelyDecodeURI(value: string) {\n try {\n return decodeURI(value);\n } catch (error) {\n warning(\n false,\n `The URL path \"${value}\" could not be decoded because it is is a ` +\n `malformed URL segment. This is probably due to a bad percent ` +\n `encoding (${error}).`\n );\n\n return value;\n }\n}\n\nfunction safelyDecodeURIComponent(value: string, paramName: string) {\n try {\n return decodeURIComponent(value);\n } catch (error) {\n warning(\n false,\n `The value for the URL param \"${paramName}\" will not be decoded because` +\n ` the string \"${value}\" is a malformed URL segment. This is probably` +\n ` due to a bad percent encoding (${error}).`\n );\n\n return value;\n }\n}\n\n/**\n * @private\n */\nexport function stripBasename(\n pathname: string,\n basename: string\n): string | null {\n if (basename === \"/\") return pathname;\n\n if (!pathname.toLowerCase().startsWith(basename.toLowerCase())) {\n return null;\n }\n\n // We want to leave trailing slash behavior in the user's control, so if they\n // specify a basename with a trailing slash, we should support it\n let startIndex = basename.endsWith(\"/\")\n ? basename.length - 1\n : basename.length;\n let nextChar = pathname.charAt(startIndex);\n if (nextChar && nextChar !== \"/\") {\n // pathname does not start with basename/\n return null;\n }\n\n return pathname.slice(startIndex) || \"/\";\n}\n\n/**\n * Returns a resolved path object relative to the given pathname.\n *\n * @see https://reactrouter.com/utils/resolve-path\n */\nexport function resolvePath(to: To, fromPathname = \"/\"): Path {\n let {\n pathname: toPathname,\n search = \"\",\n hash = \"\",\n } = typeof to === \"string\" ? parsePath(to) : to;\n\n let pathname = toPathname\n ? toPathname.startsWith(\"/\")\n ? toPathname\n : resolvePathname(toPathname, fromPathname)\n : fromPathname;\n\n return {\n pathname,\n search: normalizeSearch(search),\n hash: normalizeHash(hash),\n };\n}\n\nfunction resolvePathname(relativePath: string, fromPathname: string): string {\n let segments = fromPathname.replace(/\\/+$/, \"\").split(\"/\");\n let relativeSegments = relativePath.split(\"/\");\n\n relativeSegments.forEach((segment) => {\n if (segment === \"..\") {\n // Keep the root \"\" segment so the pathname starts at /\n if (segments.length > 1) segments.pop();\n } else if (segment !== \".\") {\n segments.push(segment);\n }\n });\n\n return segments.length > 1 ? segments.join(\"/\") : \"/\";\n}\n\nfunction getInvalidPathError(\n char: string,\n field: string,\n dest: string,\n path: Partial\n) {\n return (\n `Cannot include a '${char}' character in a manually specified ` +\n `\\`to.${field}\\` field [${JSON.stringify(\n path\n )}]. Please separate it out to the ` +\n `\\`to.${dest}\\` field. Alternatively you may provide the full path as ` +\n `a string in and the router will parse it for you.`\n );\n}\n\n/**\n * @private\n *\n * When processing relative navigation we want to ignore ancestor routes that\n * do not contribute to the path, such that index/pathless layout routes don't\n * interfere.\n *\n * For example, when moving a route element into an index route and/or a\n * pathless layout route, relative link behavior contained within should stay\n * the same. Both of the following examples should link back to the root:\n *\n * \n * \n * \n *\n * \n * \n * }> // <-- Does not contribute\n * // <-- Does not contribute\n * \n * \n */\nexport function getPathContributingMatches<\n T extends AgnosticRouteMatch = AgnosticRouteMatch\n>(matches: T[]) {\n return matches.filter(\n (match, index) =>\n index === 0 || (match.route.path && match.route.path.length > 0)\n );\n}\n\n/**\n * @private\n */\nexport function resolveTo(\n toArg: To,\n routePathnames: string[],\n locationPathname: string,\n isPathRelative = false\n): Path {\n let to: Partial;\n if (typeof toArg === \"string\") {\n to = parsePath(toArg);\n } else {\n to = { ...toArg };\n\n invariant(\n !to.pathname || !to.pathname.includes(\"?\"),\n getInvalidPathError(\"?\", \"pathname\", \"search\", to)\n );\n invariant(\n !to.pathname || !to.pathname.includes(\"#\"),\n getInvalidPathError(\"#\", \"pathname\", \"hash\", to)\n );\n invariant(\n !to.search || !to.search.includes(\"#\"),\n getInvalidPathError(\"#\", \"search\", \"hash\", to)\n );\n }\n\n let isEmptyPath = toArg === \"\" || to.pathname === \"\";\n let toPathname = isEmptyPath ? \"/\" : to.pathname;\n\n let from: string;\n\n // Routing is relative to the current pathname if explicitly requested.\n //\n // If a pathname is explicitly provided in `to`, it should be relative to the\n // route context. This is explained in `Note on `` values` in our\n // migration guide from v5 as a means of disambiguation between `to` values\n // that begin with `/` and those that do not. However, this is problematic for\n // `to` values that do not provide a pathname. `to` can simply be a search or\n // hash string, in which case we should assume that the navigation is relative\n // to the current location's pathname and *not* the route pathname.\n if (isPathRelative || toPathname == null) {\n from = locationPathname;\n } else {\n let routePathnameIndex = routePathnames.length - 1;\n\n if (toPathname.startsWith(\"..\")) {\n let toSegments = toPathname.split(\"/\");\n\n // Each leading .. segment means \"go up one route\" instead of \"go up one\n // URL segment\". This is a key difference from how works and a\n // major reason we call this a \"to\" value instead of a \"href\".\n while (toSegments[0] === \"..\") {\n toSegments.shift();\n routePathnameIndex -= 1;\n }\n\n to.pathname = toSegments.join(\"/\");\n }\n\n // If there are more \"..\" segments than parent routes, resolve relative to\n // the root / URL.\n from = routePathnameIndex >= 0 ? routePathnames[routePathnameIndex] : \"/\";\n }\n\n let path = resolvePath(to, from);\n\n // Ensure the pathname has a trailing slash if the original \"to\" had one\n let hasExplicitTrailingSlash =\n toPathname && toPathname !== \"/\" && toPathname.endsWith(\"/\");\n // Or if this was a link to the current path which has a trailing slash\n let hasCurrentTrailingSlash =\n (isEmptyPath || toPathname === \".\") && locationPathname.endsWith(\"/\");\n if (\n !path.pathname.endsWith(\"/\") &&\n (hasExplicitTrailingSlash || hasCurrentTrailingSlash)\n ) {\n path.pathname += \"/\";\n }\n\n return path;\n}\n\n/**\n * @private\n */\nexport function getToPathname(to: To): string | undefined {\n // Empty strings should be treated the same as / paths\n return to === \"\" || (to as Path).pathname === \"\"\n ? \"/\"\n : typeof to === \"string\"\n ? parsePath(to).pathname\n : to.pathname;\n}\n\n/**\n * @private\n */\nexport const joinPaths = (paths: string[]): string =>\n paths.join(\"/\").replace(/\\/\\/+/g, \"/\");\n\n/**\n * @private\n */\nexport const normalizePathname = (pathname: string): string =>\n pathname.replace(/\\/+$/, \"\").replace(/^\\/*/, \"/\");\n\n/**\n * @private\n */\nexport const normalizeSearch = (search: string): string =>\n !search || search === \"?\"\n ? \"\"\n : search.startsWith(\"?\")\n ? search\n : \"?\" + search;\n\n/**\n * @private\n */\nexport const normalizeHash = (hash: string): string =>\n !hash || hash === \"#\" ? \"\" : hash.startsWith(\"#\") ? hash : \"#\" + hash;\n\nexport type JsonFunction = (\n data: Data,\n init?: number | ResponseInit\n) => Response;\n\n/**\n * This is a shortcut for creating `application/json` responses. Converts `data`\n * to JSON and sets the `Content-Type` header.\n */\nexport const json: JsonFunction = (data, init = {}) => {\n let responseInit = typeof init === \"number\" ? { status: init } : init;\n\n let headers = new Headers(responseInit.headers);\n if (!headers.has(\"Content-Type\")) {\n headers.set(\"Content-Type\", \"application/json; charset=utf-8\");\n }\n\n return new Response(JSON.stringify(data), {\n ...responseInit,\n headers,\n });\n};\n\nexport interface TrackedPromise extends Promise {\n _tracked?: boolean;\n _data?: any;\n _error?: any;\n}\n\nexport class AbortedDeferredError extends Error {}\n\nexport class DeferredData {\n private pendingKeysSet: Set = new Set();\n private controller: AbortController;\n private abortPromise: Promise;\n private unlistenAbortSignal: () => void;\n private subscribers: Set<(aborted: boolean, settledKey?: string) => void> =\n new Set();\n data: Record;\n init?: ResponseInit;\n deferredKeys: string[] = [];\n\n constructor(data: Record, responseInit?: ResponseInit) {\n invariant(\n data && typeof data === \"object\" && !Array.isArray(data),\n \"defer() only accepts plain objects\"\n );\n\n // Set up an AbortController + Promise we can race against to exit early\n // cancellation\n let reject: (e: AbortedDeferredError) => void;\n this.abortPromise = new Promise((_, r) => (reject = r));\n this.controller = new AbortController();\n let onAbort = () =>\n reject(new AbortedDeferredError(\"Deferred data aborted\"));\n this.unlistenAbortSignal = () =>\n this.controller.signal.removeEventListener(\"abort\", onAbort);\n this.controller.signal.addEventListener(\"abort\", onAbort);\n\n this.data = Object.entries(data).reduce(\n (acc, [key, value]) =>\n Object.assign(acc, {\n [key]: this.trackPromise(key, value),\n }),\n {}\n );\n\n if (this.done) {\n // All incoming values were resolved\n this.unlistenAbortSignal();\n }\n\n this.init = responseInit;\n }\n\n private trackPromise(\n key: string,\n value: Promise | unknown\n ): TrackedPromise | unknown {\n if (!(value instanceof Promise)) {\n return value;\n }\n\n this.deferredKeys.push(key);\n this.pendingKeysSet.add(key);\n\n // We store a little wrapper promise that will be extended with\n // _data/_error props upon resolve/reject\n let promise: TrackedPromise = Promise.race([value, this.abortPromise]).then(\n (data) => this.onSettle(promise, key, undefined, data as unknown),\n (error) => this.onSettle(promise, key, error as unknown)\n );\n\n // Register rejection listeners to avoid uncaught promise rejections on\n // errors or aborted deferred values\n promise.catch(() => {});\n\n Object.defineProperty(promise, \"_tracked\", { get: () => true });\n return promise;\n }\n\n private onSettle(\n promise: TrackedPromise,\n key: string,\n error: unknown,\n data?: unknown\n ): unknown {\n if (\n this.controller.signal.aborted &&\n error instanceof AbortedDeferredError\n ) {\n this.unlistenAbortSignal();\n Object.defineProperty(promise, \"_error\", { get: () => error });\n return Promise.reject(error);\n }\n\n this.pendingKeysSet.delete(key);\n\n if (this.done) {\n // Nothing left to abort!\n this.unlistenAbortSignal();\n }\n\n // If the promise was resolved/rejected with undefined, we'll throw an error as you\n // should always resolve with a value or null\n if (error === undefined && data === undefined) {\n let undefinedError = new Error(\n `Deferred data for key \"${key}\" resolved/rejected with \\`undefined\\`, ` +\n `you must resolve/reject with a value or \\`null\\`.`\n );\n Object.defineProperty(promise, \"_error\", { get: () => undefinedError });\n this.emit(false, key);\n return Promise.reject(undefinedError);\n }\n\n if (data === undefined) {\n Object.defineProperty(promise, \"_error\", { get: () => error });\n this.emit(false, key);\n return Promise.reject(error);\n }\n\n Object.defineProperty(promise, \"_data\", { get: () => data });\n this.emit(false, key);\n return data;\n }\n\n private emit(aborted: boolean, settledKey?: string) {\n this.subscribers.forEach((subscriber) => subscriber(aborted, settledKey));\n }\n\n subscribe(fn: (aborted: boolean, settledKey?: string) => void) {\n this.subscribers.add(fn);\n return () => this.subscribers.delete(fn);\n }\n\n cancel() {\n this.controller.abort();\n this.pendingKeysSet.forEach((v, k) => this.pendingKeysSet.delete(k));\n this.emit(true);\n }\n\n async resolveData(signal: AbortSignal) {\n let aborted = false;\n if (!this.done) {\n let onAbort = () => this.cancel();\n signal.addEventListener(\"abort\", onAbort);\n aborted = await new Promise((resolve) => {\n this.subscribe((aborted) => {\n signal.removeEventListener(\"abort\", onAbort);\n if (aborted || this.done) {\n resolve(aborted);\n }\n });\n });\n }\n return aborted;\n }\n\n get done() {\n return this.pendingKeysSet.size === 0;\n }\n\n get unwrappedData() {\n invariant(\n this.data !== null && this.done,\n \"Can only unwrap data on initialized and settled deferreds\"\n );\n\n return Object.entries(this.data).reduce(\n (acc, [key, value]) =>\n Object.assign(acc, {\n [key]: unwrapTrackedPromise(value),\n }),\n {}\n );\n }\n\n get pendingKeys() {\n return Array.from(this.pendingKeysSet);\n }\n}\n\nfunction isTrackedPromise(value: any): value is TrackedPromise {\n return (\n value instanceof Promise && (value as TrackedPromise)._tracked === true\n );\n}\n\nfunction unwrapTrackedPromise(value: any) {\n if (!isTrackedPromise(value)) {\n return value;\n }\n\n if (value._error) {\n throw value._error;\n }\n return value._data;\n}\n\nexport type DeferFunction = (\n data: Record,\n init?: number | ResponseInit\n) => DeferredData;\n\nexport const defer: DeferFunction = (data, init = {}) => {\n let responseInit = typeof init === \"number\" ? { status: init } : init;\n\n return new DeferredData(data, responseInit);\n};\n\nexport type RedirectFunction = (\n url: string,\n init?: number | ResponseInit\n) => Response;\n\n/**\n * A redirect response. Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nexport const redirect: RedirectFunction = (url, init = 302) => {\n let responseInit = init;\n if (typeof responseInit === \"number\") {\n responseInit = { status: responseInit };\n } else if (typeof responseInit.status === \"undefined\") {\n responseInit.status = 302;\n }\n\n let headers = new Headers(responseInit.headers);\n headers.set(\"Location\", url);\n\n return new Response(null, {\n ...responseInit,\n headers,\n });\n};\n\n/**\n * A redirect response that will force a document reload to the new location.\n * Sets the status code and the `Location` header.\n * Defaults to \"302 Found\".\n */\nexport const redirectDocument: RedirectFunction = (url, init) => {\n let response = redirect(url, init);\n response.headers.set(\"X-Remix-Reload-Document\", \"true\");\n return response;\n};\n\n/**\n * @private\n * Utility class we use to hold auto-unwrapped 4xx/5xx Response bodies\n */\nexport class ErrorResponse {\n status: number;\n statusText: string;\n data: any;\n error?: Error;\n internal: boolean;\n\n constructor(\n status: number,\n statusText: string | undefined,\n data: any,\n internal = false\n ) {\n this.status = status;\n this.statusText = statusText || \"\";\n this.internal = internal;\n if (data instanceof Error) {\n this.data = data.toString();\n this.error = data;\n } else {\n this.data = data;\n }\n }\n}\n\n/**\n * Check if the given error is an ErrorResponse generated from a 4xx/5xx\n * Response thrown from an action/loader\n */\nexport function isRouteErrorResponse(error: any): error is ErrorResponse {\n return (\n error != null &&\n typeof error.status === \"number\" &&\n typeof error.statusText === \"string\" &&\n typeof error.internal === \"boolean\" &&\n \"data\" in error\n );\n}\n", "import type { History, Location, Path, To } from \"./history\";\nimport {\n Action as HistoryAction,\n createLocation,\n createPath,\n invariant,\n parsePath,\n warning,\n} from \"./history\";\nimport type {\n DataResult,\n DeferredData,\n AgnosticDataRouteMatch,\n AgnosticDataRouteObject,\n DeferredResult,\n ErrorResult,\n FormEncType,\n FormMethod,\n DetectErrorBoundaryFunction,\n RedirectResult,\n RouteData,\n AgnosticRouteObject,\n Submission,\n SuccessResult,\n AgnosticRouteMatch,\n ShouldRevalidateFunction,\n RouteManifest,\n ImmutableRouteKey,\n ActionFunction,\n LoaderFunction,\n V7_MutationFormMethod,\n V7_FormMethod,\n HTMLFormMethod,\n MutationFormMethod,\n MapRoutePropertiesFunction,\n} from \"./utils\";\nimport {\n ErrorResponse,\n ResultType,\n convertRoutesToDataRoutes,\n getPathContributingMatches,\n immutableRouteKeys,\n isRouteErrorResponse,\n joinPaths,\n matchRoutes,\n resolveTo,\n stripBasename,\n} from \"./utils\";\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Types and Constants\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * A Router instance manages all navigation and data loading/mutations\n */\nexport interface Router {\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Return the basename for the router\n */\n get basename(): RouterInit[\"basename\"];\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Return the current state of the router\n */\n get state(): RouterState;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Return the routes for this router instance\n */\n get routes(): AgnosticDataRouteObject[];\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Initialize the router, including adding history listeners and kicking off\n * initial data fetches. Returns a function to cleanup listeners and abort\n * any in-progress loads\n */\n initialize(): Router;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Subscribe to router.state updates\n *\n * @param fn function to call with the new state\n */\n subscribe(fn: RouterSubscriber): () => void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Enable scroll restoration behavior in the router\n *\n * @param savedScrollPositions Object that will manage positions, in case\n * it's being restored from sessionStorage\n * @param getScrollPosition Function to get the active Y scroll position\n * @param getKey Function to get the key to use for restoration\n */\n enableScrollRestoration(\n savedScrollPositions: Record,\n getScrollPosition: GetScrollPositionFunction,\n getKey?: GetScrollRestorationKeyFunction\n ): () => void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Navigate forward/backward in the history stack\n * @param to Delta to move in the history stack\n */\n navigate(to: number): Promise;\n\n /**\n * Navigate to the given path\n * @param to Path to navigate to\n * @param opts Navigation options (method, submission, etc.)\n */\n navigate(to: To | null, opts?: RouterNavigateOptions): Promise;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Trigger a fetcher load/submission\n *\n * @param key Fetcher key\n * @param routeId Route that owns the fetcher\n * @param href href to fetch\n * @param opts Fetcher options, (method, submission, etc.)\n */\n fetch(\n key: string,\n routeId: string,\n href: string | null,\n opts?: RouterFetchOptions\n ): void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Trigger a revalidation of all current route loaders and fetcher loads\n */\n revalidate(): void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Utility function to create an href for the given location\n * @param location\n */\n createHref(location: Location | URL): string;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Utility function to URL encode a destination path according to the internal\n * history implementation\n * @param to\n */\n encodeLocation(to: To): Path;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Get/create a fetcher for the given key\n * @param key\n */\n getFetcher(key?: string): Fetcher;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Delete the fetcher for a given key\n * @param key\n */\n deleteFetcher(key?: string): void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Cleanup listeners and abort any in-progress loads\n */\n dispose(): void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Get a navigation blocker\n * @param key The identifier for the blocker\n * @param fn The blocker function implementation\n */\n getBlocker(key: string, fn: BlockerFunction): Blocker;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Delete a navigation blocker\n * @param key The identifier for the blocker\n */\n deleteBlocker(key: string): void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * HMR needs to pass in-flight route updates to React Router\n * TODO: Replace this with granular route update APIs (addRoute, updateRoute, deleteRoute)\n */\n _internalSetRoutes(routes: AgnosticRouteObject[]): void;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Internal fetch AbortControllers accessed by unit tests\n */\n _internalFetchControllers: Map;\n\n /**\n * @internal\n * PRIVATE - DO NOT USE\n *\n * Internal pending DeferredData instances accessed by unit tests\n */\n _internalActiveDeferreds: Map;\n}\n\n/**\n * State maintained internally by the router. During a navigation, all states\n * reflect the the \"old\" location unless otherwise noted.\n */\nexport interface RouterState {\n /**\n * The action of the most recent navigation\n */\n historyAction: HistoryAction;\n\n /**\n * The current location reflected by the router\n */\n location: Location;\n\n /**\n * The current set of route matches\n */\n matches: AgnosticDataRouteMatch[];\n\n /**\n * Tracks whether we've completed our initial data load\n */\n initialized: boolean;\n\n /**\n * Current scroll position we should start at for a new view\n * - number -> scroll position to restore to\n * - false -> do not restore scroll at all (used during submissions)\n * - null -> don't have a saved position, scroll to hash or top of page\n */\n restoreScrollPosition: number | false | null;\n\n /**\n * Indicate whether this navigation should skip resetting the scroll position\n * if we are unable to restore the scroll position\n */\n preventScrollReset: boolean;\n\n /**\n * Tracks the state of the current navigation\n */\n navigation: Navigation;\n\n /**\n * Tracks any in-progress revalidations\n */\n revalidation: RevalidationState;\n\n /**\n * Data from the loaders for the current matches\n */\n loaderData: RouteData;\n\n /**\n * Data from the action for the current matches\n */\n actionData: RouteData | null;\n\n /**\n * Errors caught from loaders for the current matches\n */\n errors: RouteData | null;\n\n /**\n * Map of current fetchers\n */\n fetchers: Map;\n\n /**\n * Map of current blockers\n */\n blockers: Map;\n}\n\n/**\n * Data that can be passed into hydrate a Router from SSR\n */\nexport type HydrationState = Partial<\n Pick\n>;\n\n/**\n * Future flags to toggle new feature behavior\n */\nexport interface FutureConfig {\n v7_normalizeFormMethod: boolean;\n v7_prependBasename: boolean;\n}\n\n/**\n * Initialization options for createRouter\n */\nexport interface RouterInit {\n routes: AgnosticRouteObject[];\n history: History;\n basename?: string;\n /**\n * @deprecated Use `mapRouteProperties` instead\n */\n detectErrorBoundary?: DetectErrorBoundaryFunction;\n mapRouteProperties?: MapRoutePropertiesFunction;\n future?: Partial;\n hydrationData?: HydrationState;\n window?: Window;\n}\n\n/**\n * State returned from a server-side query() call\n */\nexport interface StaticHandlerContext {\n basename: Router[\"basename\"];\n location: RouterState[\"location\"];\n matches: RouterState[\"matches\"];\n loaderData: RouterState[\"loaderData\"];\n actionData: RouterState[\"actionData\"];\n errors: RouterState[\"errors\"];\n statusCode: number;\n loaderHeaders: Record;\n actionHeaders: Record;\n activeDeferreds: Record | null;\n _deepestRenderedBoundaryId?: string | null;\n}\n\n/**\n * A StaticHandler instance manages a singular SSR navigation/fetch event\n */\nexport interface StaticHandler {\n dataRoutes: AgnosticDataRouteObject[];\n query(\n request: Request,\n opts?: { requestContext?: unknown }\n ): Promise;\n queryRoute(\n request: Request,\n opts?: { routeId?: string; requestContext?: unknown }\n ): Promise;\n}\n\n/**\n * Subscriber function signature for changes to router state\n */\nexport interface RouterSubscriber {\n (state: RouterState): void;\n}\n\ninterface UseMatchesMatch {\n id: string;\n pathname: string;\n params: AgnosticRouteMatch[\"params\"];\n data: unknown;\n handle: unknown;\n}\n\n/**\n * Function signature for determining the key to be used in scroll restoration\n * for a given location\n */\nexport interface GetScrollRestorationKeyFunction {\n (location: Location, matches: UseMatchesMatch[]): string | null;\n}\n\n/**\n * Function signature for determining the current scroll position\n */\nexport interface GetScrollPositionFunction {\n (): number;\n}\n\nexport type RelativeRoutingType = \"route\" | \"path\";\n\n// Allowed for any navigation or fetch\ntype BaseNavigateOrFetchOptions = {\n preventScrollReset?: boolean;\n relative?: RelativeRoutingType;\n};\n\n// Only allowed for navigations\ntype BaseNavigateOptions = BaseNavigateOrFetchOptions & {\n replace?: boolean;\n state?: any;\n fromRouteId?: string;\n};\n\n// Only allowed for submission navigations\ntype BaseSubmissionOptions = {\n formMethod?: HTMLFormMethod;\n formEncType?: FormEncType;\n} & (\n | { formData: FormData; body?: undefined }\n | { formData?: undefined; body: any }\n);\n\n/**\n * Options for a navigate() call for a normal (non-submission) navigation\n */\ntype LinkNavigateOptions = BaseNavigateOptions;\n\n/**\n * Options for a navigate() call for a submission navigation\n */\ntype SubmissionNavigateOptions = BaseNavigateOptions & BaseSubmissionOptions;\n\n/**\n * Options to pass to navigate() for a navigation\n */\nexport type RouterNavigateOptions =\n | LinkNavigateOptions\n | SubmissionNavigateOptions;\n\n/**\n * Options for a fetch() load\n */\ntype LoadFetchOptions = BaseNavigateOrFetchOptions;\n\n/**\n * Options for a fetch() submission\n */\ntype SubmitFetchOptions = BaseNavigateOrFetchOptions & BaseSubmissionOptions;\n\n/**\n * Options to pass to fetch()\n */\nexport type RouterFetchOptions = LoadFetchOptions | SubmitFetchOptions;\n\n/**\n * Potential states for state.navigation\n */\nexport type NavigationStates = {\n Idle: {\n state: \"idle\";\n location: undefined;\n formMethod: undefined;\n formAction: undefined;\n formEncType: undefined;\n formData: undefined;\n json: undefined;\n text: undefined;\n };\n Loading: {\n state: \"loading\";\n location: Location;\n formMethod: Submission[\"formMethod\"] | undefined;\n formAction: Submission[\"formAction\"] | undefined;\n formEncType: Submission[\"formEncType\"] | undefined;\n formData: Submission[\"formData\"] | undefined;\n json: Submission[\"json\"] | undefined;\n text: Submission[\"text\"] | undefined;\n };\n Submitting: {\n state: \"submitting\";\n location: Location;\n formMethod: Submission[\"formMethod\"];\n formAction: Submission[\"formAction\"];\n formEncType: Submission[\"formEncType\"];\n formData: Submission[\"formData\"];\n json: Submission[\"json\"];\n text: Submission[\"text\"];\n };\n};\n\nexport type Navigation = NavigationStates[keyof NavigationStates];\n\nexport type RevalidationState = \"idle\" | \"loading\";\n\n/**\n * Potential states for fetchers\n */\ntype FetcherStates = {\n Idle: {\n state: \"idle\";\n formMethod: undefined;\n formAction: undefined;\n formEncType: undefined;\n text: undefined;\n formData: undefined;\n json: undefined;\n data: TData | undefined;\n \" _hasFetcherDoneAnything \"?: boolean;\n };\n Loading: {\n state: \"loading\";\n formMethod: Submission[\"formMethod\"] | undefined;\n formAction: Submission[\"formAction\"] | undefined;\n formEncType: Submission[\"formEncType\"] | undefined;\n text: Submission[\"text\"] | undefined;\n formData: Submission[\"formData\"] | undefined;\n json: Submission[\"json\"] | undefined;\n data: TData | undefined;\n \" _hasFetcherDoneAnything \"?: boolean;\n };\n Submitting: {\n state: \"submitting\";\n formMethod: Submission[\"formMethod\"];\n formAction: Submission[\"formAction\"];\n formEncType: Submission[\"formEncType\"];\n text: Submission[\"text\"];\n formData: Submission[\"formData\"];\n json: Submission[\"json\"];\n data: TData | undefined;\n \" _hasFetcherDoneAnything \"?: boolean;\n };\n};\n\nexport type Fetcher =\n FetcherStates[keyof FetcherStates];\n\ninterface BlockerBlocked {\n state: \"blocked\";\n reset(): void;\n proceed(): void;\n location: Location;\n}\n\ninterface BlockerUnblocked {\n state: \"unblocked\";\n reset: undefined;\n proceed: undefined;\n location: undefined;\n}\n\ninterface BlockerProceeding {\n state: \"proceeding\";\n reset: undefined;\n proceed: undefined;\n location: Location;\n}\n\nexport type Blocker = BlockerUnblocked | BlockerBlocked | BlockerProceeding;\n\nexport type BlockerFunction = (args: {\n currentLocation: Location;\n nextLocation: Location;\n historyAction: HistoryAction;\n}) => boolean;\n\ninterface ShortCircuitable {\n /**\n * startNavigation does not need to complete the navigation because we\n * redirected or got interrupted\n */\n shortCircuited?: boolean;\n}\n\ninterface HandleActionResult extends ShortCircuitable {\n /**\n * Error thrown from the current action, keyed by the route containing the\n * error boundary to render the error. To be committed to the state after\n * loaders have completed\n */\n pendingActionError?: RouteData;\n /**\n * Data returned from the current action, keyed by the route owning the action.\n * To be committed to the state after loaders have completed\n */\n pendingActionData?: RouteData;\n}\n\ninterface HandleLoadersResult extends ShortCircuitable {\n /**\n * loaderData returned from the current set of loaders\n */\n loaderData?: RouterState[\"loaderData\"];\n /**\n * errors thrown from the current set of loaders\n */\n errors?: RouterState[\"errors\"];\n}\n\n/**\n * Cached info for active fetcher.load() instances so they can participate\n * in revalidation\n */\ninterface FetchLoadMatch {\n routeId: string;\n path: string;\n}\n\n/**\n * Identified fetcher.load() calls that need to be revalidated\n */\ninterface RevalidatingFetcher extends FetchLoadMatch {\n key: string;\n match: AgnosticDataRouteMatch | null;\n matches: AgnosticDataRouteMatch[] | null;\n controller: AbortController | null;\n}\n\n/**\n * Wrapper object to allow us to throw any response out from callLoaderOrAction\n * for queryRouter while preserving whether or not it was thrown or returned\n * from the loader/action\n */\ninterface QueryRouteResponse {\n type: ResultType.data | ResultType.error;\n response: Response;\n}\n\nconst validMutationMethodsArr: MutationFormMethod[] = [\n \"post\",\n \"put\",\n \"patch\",\n \"delete\",\n];\nconst validMutationMethods = new Set(\n validMutationMethodsArr\n);\n\nconst validRequestMethodsArr: FormMethod[] = [\n \"get\",\n ...validMutationMethodsArr,\n];\nconst validRequestMethods = new Set(validRequestMethodsArr);\n\nconst redirectStatusCodes = new Set([301, 302, 303, 307, 308]);\nconst redirectPreserveMethodStatusCodes = new Set([307, 308]);\n\nexport const IDLE_NAVIGATION: NavigationStates[\"Idle\"] = {\n state: \"idle\",\n location: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n};\n\nexport const IDLE_FETCHER: FetcherStates[\"Idle\"] = {\n state: \"idle\",\n data: undefined,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n};\n\nexport const IDLE_BLOCKER: BlockerUnblocked = {\n state: \"unblocked\",\n proceed: undefined,\n reset: undefined,\n location: undefined,\n};\n\nconst ABSOLUTE_URL_REGEX = /^(?:[a-z][a-z0-9+.-]*:|\\/\\/)/i;\n\nconst defaultMapRouteProperties: MapRoutePropertiesFunction = (route) => ({\n hasErrorBoundary: Boolean(route.hasErrorBoundary),\n});\n\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region createRouter\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Create a router and listen to history POP navigations\n */\nexport function createRouter(init: RouterInit): Router {\n const routerWindow = init.window\n ? init.window\n : typeof window !== \"undefined\"\n ? window\n : undefined;\n const isBrowser =\n typeof routerWindow !== \"undefined\" &&\n typeof routerWindow.document !== \"undefined\" &&\n typeof routerWindow.document.createElement !== \"undefined\";\n const isServer = !isBrowser;\n\n invariant(\n init.routes.length > 0,\n \"You must provide a non-empty routes array to createRouter\"\n );\n\n let mapRouteProperties: MapRoutePropertiesFunction;\n if (init.mapRouteProperties) {\n mapRouteProperties = init.mapRouteProperties;\n } else if (init.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = init.detectErrorBoundary;\n mapRouteProperties = (route) => ({\n hasErrorBoundary: detectErrorBoundary(route),\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n\n // Routes keyed by ID\n let manifest: RouteManifest = {};\n // Routes in tree format for matching\n let dataRoutes = convertRoutesToDataRoutes(\n init.routes,\n mapRouteProperties,\n undefined,\n manifest\n );\n let inFlightDataRoutes: AgnosticDataRouteObject[] | undefined;\n let basename = init.basename || \"/\";\n // Config driven behavior flags\n let future: FutureConfig = {\n v7_normalizeFormMethod: false,\n v7_prependBasename: false,\n ...init.future,\n };\n // Cleanup function for history\n let unlistenHistory: (() => void) | null = null;\n // Externally-provided functions to call on all state changes\n let subscribers = new Set();\n // Externally-provided object to hold scroll restoration locations during routing\n let savedScrollPositions: Record | null = null;\n // Externally-provided function to get scroll restoration keys\n let getScrollRestorationKey: GetScrollRestorationKeyFunction | null = null;\n // Externally-provided function to get current scroll position\n let getScrollPosition: GetScrollPositionFunction | null = null;\n // One-time flag to control the initial hydration scroll restoration. Because\n // we don't get the saved positions from until _after_\n // the initial render, we need to manually trigger a separate updateState to\n // send along the restoreScrollPosition\n // Set to true if we have `hydrationData` since we assume we were SSR'd and that\n // SSR did the initial scroll restoration.\n let initialScrollRestored = init.hydrationData != null;\n\n let initialMatches = matchRoutes(dataRoutes, init.history.location, basename);\n let initialErrors: RouteData | null = null;\n\n if (initialMatches == null) {\n // If we do not match a user-provided-route, fall back to the root\n // to allow the error boundary to take over\n let error = getInternalRouterError(404, {\n pathname: init.history.location.pathname,\n });\n let { matches, route } = getShortCircuitMatches(dataRoutes);\n initialMatches = matches;\n initialErrors = { [route.id]: error };\n }\n\n let initialized =\n // All initialMatches need to be loaded before we're ready. If we have lazy\n // functions around still then we'll need to run them in initialize()\n !initialMatches.some((m) => m.route.lazy) &&\n // And we have to either have no loaders or have been provided hydrationData\n (!initialMatches.some((m) => m.route.loader) || init.hydrationData != null);\n\n let router: Router;\n let state: RouterState = {\n historyAction: init.history.action,\n location: init.history.location,\n matches: initialMatches,\n initialized,\n navigation: IDLE_NAVIGATION,\n // Don't restore on initial updateState() if we were SSR'd\n restoreScrollPosition: init.hydrationData != null ? false : null,\n preventScrollReset: false,\n revalidation: \"idle\",\n loaderData: (init.hydrationData && init.hydrationData.loaderData) || {},\n actionData: (init.hydrationData && init.hydrationData.actionData) || null,\n errors: (init.hydrationData && init.hydrationData.errors) || initialErrors,\n fetchers: new Map(),\n blockers: new Map(),\n };\n\n // -- Stateful internal variables to manage navigations --\n // Current navigation in progress (to be committed in completeNavigation)\n let pendingAction: HistoryAction = HistoryAction.Pop;\n\n // Should the current navigation prevent the scroll reset if scroll cannot\n // be restored?\n let pendingPreventScrollReset = false;\n\n // AbortController for the active navigation\n let pendingNavigationController: AbortController | null;\n\n // We use this to avoid touching history in completeNavigation if a\n // revalidation is entirely uninterrupted\n let isUninterruptedRevalidation = false;\n\n // Use this internal flag to force revalidation of all loaders:\n // - submissions (completed or interrupted)\n // - useRevalidator()\n // - X-Remix-Revalidate (from redirect)\n let isRevalidationRequired = false;\n\n // Use this internal array to capture routes that require revalidation due\n // to a cancelled deferred on action submission\n let cancelledDeferredRoutes: string[] = [];\n\n // Use this internal array to capture fetcher loads that were cancelled by an\n // action navigation and require revalidation\n let cancelledFetcherLoads: string[] = [];\n\n // AbortControllers for any in-flight fetchers\n let fetchControllers = new Map();\n\n // Track loads based on the order in which they started\n let incrementingLoadId = 0;\n\n // Track the outstanding pending navigation data load to be compared against\n // the globally incrementing load when a fetcher load lands after a completed\n // navigation\n let pendingNavigationLoadId = -1;\n\n // Fetchers that triggered data reloads as a result of their actions\n let fetchReloadIds = new Map();\n\n // Fetchers that triggered redirect navigations\n let fetchRedirectIds = new Set();\n\n // Most recent href/match for fetcher.load calls for fetchers\n let fetchLoadMatches = new Map();\n\n // Store DeferredData instances for active route matches. When a\n // route loader returns defer() we stick one in here. Then, when a nested\n // promise resolves we update loaderData. If a new navigation starts we\n // cancel active deferreds for eliminated routes.\n let activeDeferreds = new Map();\n\n // Store blocker functions in a separate Map outside of router state since\n // we don't need to update UI state if they change\n let blockerFunctions = new Map();\n\n // Flag to ignore the next history update, so we can revert the URL change on\n // a POP navigation that was blocked by the user without touching router state\n let ignoreNextHistoryUpdate = false;\n\n // Initialize the router, all side effects should be kicked off from here.\n // Implemented as a Fluent API for ease of:\n // let router = createRouter(init).initialize();\n function initialize() {\n // If history informs us of a POP navigation, start the navigation but do not update\n // state. We'll update our own state once the navigation completes\n unlistenHistory = init.history.listen(\n ({ action: historyAction, location, delta }) => {\n // Ignore this event if it was just us resetting the URL from a\n // blocked POP navigation\n if (ignoreNextHistoryUpdate) {\n ignoreNextHistoryUpdate = false;\n return;\n }\n\n warning(\n blockerFunctions.size === 0 || delta != null,\n \"You are trying to use a blocker on a POP navigation to a location \" +\n \"that was not created by @remix-run/router. This will fail silently in \" +\n \"production. This can happen if you are navigating outside the router \" +\n \"via `window.history.pushState`/`window.location.hash` instead of using \" +\n \"router navigation APIs. This can also happen if you are using \" +\n \"createHashRouter and the user manually changes the URL.\"\n );\n\n let blockerKey = shouldBlockNavigation({\n currentLocation: state.location,\n nextLocation: location,\n historyAction,\n });\n\n if (blockerKey && delta != null) {\n // Restore the URL to match the current UI, but don't update router state\n ignoreNextHistoryUpdate = true;\n init.history.go(delta * -1);\n\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location,\n proceed() {\n updateBlocker(blockerKey!, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location,\n });\n // Re-do the same POP navigation we just blocked\n init.history.go(delta);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey!, IDLE_BLOCKER);\n updateState({ blockers });\n },\n });\n return;\n }\n\n return startNavigation(historyAction, location);\n }\n );\n\n // Kick off initial data load if needed. Use Pop to avoid modifying history\n // Note we don't do any handling of lazy here. For SPA's it'll get handled\n // in the normal navigation flow. For SSR it's expected that lazy modules are\n // resolved prior to router creation since we can't go into a fallbackElement\n // UI for SSR'd apps\n if (!state.initialized) {\n startNavigation(HistoryAction.Pop, state.location);\n }\n\n return router;\n }\n\n // Clean up a router and it's side effects\n function dispose() {\n if (unlistenHistory) {\n unlistenHistory();\n }\n subscribers.clear();\n pendingNavigationController && pendingNavigationController.abort();\n state.fetchers.forEach((_, key) => deleteFetcher(key));\n state.blockers.forEach((_, key) => deleteBlocker(key));\n }\n\n // Subscribe to state updates for the router\n function subscribe(fn: RouterSubscriber) {\n subscribers.add(fn);\n return () => subscribers.delete(fn);\n }\n\n // Update our state and notify the calling context of the change\n function updateState(newState: Partial): void {\n state = {\n ...state,\n ...newState,\n };\n subscribers.forEach((subscriber) => subscriber(state));\n }\n\n // Complete a navigation returning the state.navigation back to the IDLE_NAVIGATION\n // and setting state.[historyAction/location/matches] to the new route.\n // - Location is a required param\n // - Navigation will always be set to IDLE_NAVIGATION\n // - Can pass any other state in newState\n function completeNavigation(\n location: Location,\n newState: Partial>\n ): void {\n // Deduce if we're in a loading/actionReload state:\n // - We have committed actionData in the store\n // - The current navigation was a mutation submission\n // - We're past the submitting state and into the loading state\n // - The location being loaded is not the result of a redirect\n let isActionReload =\n state.actionData != null &&\n state.navigation.formMethod != null &&\n isMutationMethod(state.navigation.formMethod) &&\n state.navigation.state === \"loading\" &&\n location.state?._isRedirect !== true;\n\n let actionData: RouteData | null;\n if (newState.actionData) {\n if (Object.keys(newState.actionData).length > 0) {\n actionData = newState.actionData;\n } else {\n // Empty actionData -> clear prior actionData due to an action error\n actionData = null;\n }\n } else if (isActionReload) {\n // Keep the current data if we're wrapping up the action reload\n actionData = state.actionData;\n } else {\n // Clear actionData on any other completed navigations\n actionData = null;\n }\n\n // Always preserve any existing loaderData from re-used routes\n let loaderData = newState.loaderData\n ? mergeLoaderData(\n state.loaderData,\n newState.loaderData,\n newState.matches || [],\n newState.errors\n )\n : state.loaderData;\n\n // On a successful navigation we can assume we got through all blockers\n // so we can start fresh\n let blockers = state.blockers;\n if (blockers.size > 0) {\n blockers = new Map(blockers);\n blockers.forEach((_, k) => blockers.set(k, IDLE_BLOCKER));\n }\n\n // Always respect the user flag. Otherwise don't reset on mutation\n // submission navigations unless they redirect\n let preventScrollReset =\n pendingPreventScrollReset === true ||\n (state.navigation.formMethod != null &&\n isMutationMethod(state.navigation.formMethod) &&\n location.state?._isRedirect !== true);\n\n if (inFlightDataRoutes) {\n dataRoutes = inFlightDataRoutes;\n inFlightDataRoutes = undefined;\n }\n\n if (isUninterruptedRevalidation) {\n // If this was an uninterrupted revalidation then do not touch history\n } else if (pendingAction === HistoryAction.Pop) {\n // Do nothing for POP - URL has already been updated\n } else if (pendingAction === HistoryAction.Push) {\n init.history.push(location, location.state);\n } else if (pendingAction === HistoryAction.Replace) {\n init.history.replace(location, location.state);\n }\n\n updateState({\n ...newState, // matches, errors, fetchers go through as-is\n actionData,\n loaderData,\n historyAction: pendingAction,\n location,\n initialized: true,\n navigation: IDLE_NAVIGATION,\n revalidation: \"idle\",\n restoreScrollPosition: getSavedScrollPosition(\n location,\n newState.matches || state.matches\n ),\n preventScrollReset,\n blockers,\n });\n\n // Reset stateful navigation vars\n pendingAction = HistoryAction.Pop;\n pendingPreventScrollReset = false;\n isUninterruptedRevalidation = false;\n isRevalidationRequired = false;\n cancelledDeferredRoutes = [];\n cancelledFetcherLoads = [];\n }\n\n // Trigger a navigation event, which can either be a numerical POP or a PUSH\n // replace with an optional submission\n async function navigate(\n to: number | To | null,\n opts?: RouterNavigateOptions\n ): Promise {\n if (typeof to === \"number\") {\n init.history.go(to);\n return;\n }\n\n let normalizedPath = normalizeTo(\n state.location,\n state.matches,\n basename,\n future.v7_prependBasename,\n to,\n opts?.fromRouteId,\n opts?.relative\n );\n let { path, submission, error } = normalizeNavigateOptions(\n future.v7_normalizeFormMethod,\n false,\n normalizedPath,\n opts\n );\n\n let currentLocation = state.location;\n let nextLocation = createLocation(state.location, path, opts && opts.state);\n\n // When using navigate as a PUSH/REPLACE we aren't reading an already-encoded\n // URL from window.location, so we need to encode it here so the behavior\n // remains the same as POP and non-data-router usages. new URL() does all\n // the same encoding we'd get from a history.pushState/window.location read\n // without having to touch history\n nextLocation = {\n ...nextLocation,\n ...init.history.encodeLocation(nextLocation),\n };\n\n let userReplace = opts && opts.replace != null ? opts.replace : undefined;\n\n let historyAction = HistoryAction.Push;\n\n if (userReplace === true) {\n historyAction = HistoryAction.Replace;\n } else if (userReplace === false) {\n // no-op\n } else if (\n submission != null &&\n isMutationMethod(submission.formMethod) &&\n submission.formAction === state.location.pathname + state.location.search\n ) {\n // By default on submissions to the current location we REPLACE so that\n // users don't have to double-click the back button to get to the prior\n // location. If the user redirects to a different location from the\n // action/loader this will be ignored and the redirect will be a PUSH\n historyAction = HistoryAction.Replace;\n }\n\n let preventScrollReset =\n opts && \"preventScrollReset\" in opts\n ? opts.preventScrollReset === true\n : undefined;\n\n let blockerKey = shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction,\n });\n\n if (blockerKey) {\n // Put the blocker into a blocked state\n updateBlocker(blockerKey, {\n state: \"blocked\",\n location: nextLocation,\n proceed() {\n updateBlocker(blockerKey!, {\n state: \"proceeding\",\n proceed: undefined,\n reset: undefined,\n location: nextLocation,\n });\n // Send the same navigation through\n navigate(to, opts);\n },\n reset() {\n let blockers = new Map(state.blockers);\n blockers.set(blockerKey!, IDLE_BLOCKER);\n updateState({ blockers });\n },\n });\n return;\n }\n\n return await startNavigation(historyAction, nextLocation, {\n submission,\n // Send through the formData serialization error if we have one so we can\n // render at the right error boundary after we match routes\n pendingError: error,\n preventScrollReset,\n replace: opts && opts.replace,\n });\n }\n\n // Revalidate all current loaders. If a navigation is in progress or if this\n // is interrupted by a navigation, allow this to \"succeed\" by calling all\n // loaders during the next loader round\n function revalidate() {\n interruptActiveLoads();\n updateState({ revalidation: \"loading\" });\n\n // If we're currently submitting an action, we don't need to start a new\n // navigation, we'll just let the follow up loader execution call all loaders\n if (state.navigation.state === \"submitting\") {\n return;\n }\n\n // If we're currently in an idle state, start a new navigation for the current\n // action/location and mark it as uninterrupted, which will skip the history\n // update in completeNavigation\n if (state.navigation.state === \"idle\") {\n startNavigation(state.historyAction, state.location, {\n startUninterruptedRevalidation: true,\n });\n return;\n }\n\n // Otherwise, if we're currently in a loading state, just start a new\n // navigation to the navigation.location but do not trigger an uninterrupted\n // revalidation so that history correctly updates once the navigation completes\n startNavigation(\n pendingAction || state.historyAction,\n state.navigation.location,\n { overrideNavigation: state.navigation }\n );\n }\n\n // Start a navigation to the given action/location. Can optionally provide a\n // overrideNavigation which will override the normalLoad in the case of a redirect\n // navigation\n async function startNavigation(\n historyAction: HistoryAction,\n location: Location,\n opts?: {\n submission?: Submission;\n fetcherSubmission?: Submission;\n overrideNavigation?: Navigation;\n pendingError?: ErrorResponse;\n startUninterruptedRevalidation?: boolean;\n preventScrollReset?: boolean;\n replace?: boolean;\n }\n ): Promise {\n // Abort any in-progress navigations and start a new one. Unset any ongoing\n // uninterrupted revalidations unless told otherwise, since we want this\n // new navigation to update history normally\n pendingNavigationController && pendingNavigationController.abort();\n pendingNavigationController = null;\n pendingAction = historyAction;\n isUninterruptedRevalidation =\n (opts && opts.startUninterruptedRevalidation) === true;\n\n // Save the current scroll position every time we start a new navigation,\n // and track whether we should reset scroll on completion\n saveScrollPosition(state.location, state.matches);\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let loadingNavigation = opts && opts.overrideNavigation;\n let matches = matchRoutes(routesToUse, location, basename);\n\n // Short circuit with a 404 on the root error boundary if we match nothing\n if (!matches) {\n let error = getInternalRouterError(404, { pathname: location.pathname });\n let { matches: notFoundMatches, route } =\n getShortCircuitMatches(routesToUse);\n // Cancel all pending deferred on 404s since we don't keep any routes\n cancelActiveDeferreds();\n completeNavigation(location, {\n matches: notFoundMatches,\n loaderData: {},\n errors: {\n [route.id]: error,\n },\n });\n return;\n }\n\n // Short circuit if it's only a hash change and not a revalidation or\n // mutation submission.\n //\n // Ignore on initial page loads because since the initial load will always\n // be \"same hash\". For example, on /page#hash and submit a \n // which will default to a navigation to /page\n if (\n state.initialized &&\n !isRevalidationRequired &&\n isHashChangeOnly(state.location, location) &&\n !(opts && opts.submission && isMutationMethod(opts.submission.formMethod))\n ) {\n completeNavigation(location, { matches });\n return;\n }\n\n // Create a controller/Request for this navigation\n pendingNavigationController = new AbortController();\n let request = createClientSideRequest(\n init.history,\n location,\n pendingNavigationController.signal,\n opts && opts.submission\n );\n let pendingActionData: RouteData | undefined;\n let pendingError: RouteData | undefined;\n\n if (opts && opts.pendingError) {\n // If we have a pendingError, it means the user attempted a GET submission\n // with binary FormData so assign here and skip to handleLoaders. That\n // way we handle calling loaders above the boundary etc. It's not really\n // different from an actionError in that sense.\n pendingError = {\n [findNearestBoundary(matches).route.id]: opts.pendingError,\n };\n } else if (\n opts &&\n opts.submission &&\n isMutationMethod(opts.submission.formMethod)\n ) {\n // Call action if we received an action submission\n let actionOutput = await handleAction(\n request,\n location,\n opts.submission,\n matches,\n { replace: opts.replace }\n );\n\n if (actionOutput.shortCircuited) {\n return;\n }\n\n pendingActionData = actionOutput.pendingActionData;\n pendingError = actionOutput.pendingActionError;\n loadingNavigation = getLoadingNavigation(location, opts.submission);\n\n // Create a GET request for the loaders\n request = new Request(request.url, { signal: request.signal });\n }\n\n // Call loaders\n let { shortCircuited, loaderData, errors } = await handleLoaders(\n request,\n location,\n matches,\n loadingNavigation,\n opts && opts.submission,\n opts && opts.fetcherSubmission,\n opts && opts.replace,\n pendingActionData,\n pendingError\n );\n\n if (shortCircuited) {\n return;\n }\n\n // Clean up now that the action/loaders have completed. Don't clean up if\n // we short circuited because pendingNavigationController will have already\n // been assigned to a new controller for the next navigation\n pendingNavigationController = null;\n\n completeNavigation(location, {\n matches,\n ...(pendingActionData ? { actionData: pendingActionData } : {}),\n loaderData,\n errors,\n });\n }\n\n // Call the action matched by the leaf route for this navigation and handle\n // redirects/errors\n async function handleAction(\n request: Request,\n location: Location,\n submission: Submission,\n matches: AgnosticDataRouteMatch[],\n opts: { replace?: boolean } = {}\n ): Promise {\n interruptActiveLoads();\n\n // Put us in a submitting state\n let navigation = getSubmittingNavigation(location, submission);\n updateState({ navigation });\n\n // Call our action and get the result\n let result: DataResult;\n let actionMatch = getTargetMatch(matches, location);\n\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n result = {\n type: ResultType.error,\n error: getInternalRouterError(405, {\n method: request.method,\n pathname: location.pathname,\n routeId: actionMatch.route.id,\n }),\n };\n } else {\n result = await callLoaderOrAction(\n \"action\",\n request,\n actionMatch,\n matches,\n manifest,\n mapRouteProperties,\n basename\n );\n\n if (request.signal.aborted) {\n return { shortCircuited: true };\n }\n }\n\n if (isRedirectResult(result)) {\n let replace: boolean;\n if (opts && opts.replace != null) {\n replace = opts.replace;\n } else {\n // If the user didn't explicity indicate replace behavior, replace if\n // we redirected to the exact same location we're currently at to avoid\n // double back-buttons\n replace =\n result.location === state.location.pathname + state.location.search;\n }\n await startRedirectNavigation(state, result, { submission, replace });\n return { shortCircuited: true };\n }\n\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n\n // By default, all submissions are REPLACE navigations, but if the\n // action threw an error that'll be rendered in an errorElement, we fall\n // back to PUSH so that the user can use the back button to get back to\n // the pre-submission form location to try again\n if ((opts && opts.replace) !== true) {\n pendingAction = HistoryAction.Push;\n }\n\n return {\n // Send back an empty object we can use to clear out any prior actionData\n pendingActionData: {},\n pendingActionError: { [boundaryMatch.route.id]: result.error },\n };\n }\n\n if (isDeferredResult(result)) {\n throw getInternalRouterError(400, { type: \"defer-action\" });\n }\n\n return {\n pendingActionData: { [actionMatch.route.id]: result.data },\n };\n }\n\n // Call all applicable loaders for the given matches, handling redirects,\n // errors, etc.\n async function handleLoaders(\n request: Request,\n location: Location,\n matches: AgnosticDataRouteMatch[],\n overrideNavigation?: Navigation,\n submission?: Submission,\n fetcherSubmission?: Submission,\n replace?: boolean,\n pendingActionData?: RouteData,\n pendingError?: RouteData\n ): Promise {\n // Figure out the right navigation we want to use for data loading\n let loadingNavigation =\n overrideNavigation || getLoadingNavigation(location, submission);\n\n // If this was a redirect from an action we don't have a \"submission\" but\n // we have it on the loading navigation so use that if available\n let activeSubmission =\n submission ||\n fetcherSubmission ||\n getSubmissionFromNavigation(loadingNavigation);\n\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(\n init.history,\n state,\n matches,\n activeSubmission,\n location,\n isRevalidationRequired,\n cancelledDeferredRoutes,\n cancelledFetcherLoads,\n fetchLoadMatches,\n fetchRedirectIds,\n routesToUse,\n basename,\n pendingActionData,\n pendingError\n );\n\n // Cancel pending deferreds for no-longer-matched routes or routes we're\n // about to reload. Note that if this is an action reload we would have\n // already cancelled all pending deferreds so this would be a no-op\n cancelActiveDeferreds(\n (routeId) =>\n !(matches && matches.some((m) => m.route.id === routeId)) ||\n (matchesToLoad && matchesToLoad.some((m) => m.route.id === routeId))\n );\n\n pendingNavigationLoadId = ++incrementingLoadId;\n\n // Short circuit if we have no loaders to run\n if (matchesToLoad.length === 0 && revalidatingFetchers.length === 0) {\n let updatedFetchers = markFetchRedirectsDone();\n completeNavigation(location, {\n matches,\n loaderData: {},\n // Commit pending error if we're short circuiting\n errors: pendingError || null,\n ...(pendingActionData ? { actionData: pendingActionData } : {}),\n ...(updatedFetchers ? { fetchers: new Map(state.fetchers) } : {}),\n });\n return { shortCircuited: true };\n }\n\n // If this is an uninterrupted revalidation, we remain in our current idle\n // state. If not, we need to switch to our loading state and load data,\n // preserving any new action data or existing action data (in the case of\n // a revalidation interrupting an actionReload)\n if (!isUninterruptedRevalidation) {\n revalidatingFetchers.forEach((rf) => {\n let fetcher = state.fetchers.get(rf.key);\n let revalidatingFetcher = getLoadingFetcher(\n undefined,\n fetcher ? fetcher.data : undefined\n );\n state.fetchers.set(rf.key, revalidatingFetcher);\n });\n let actionData = pendingActionData || state.actionData;\n updateState({\n navigation: loadingNavigation,\n ...(actionData\n ? Object.keys(actionData).length === 0\n ? { actionData: null }\n : { actionData }\n : {}),\n ...(revalidatingFetchers.length > 0\n ? { fetchers: new Map(state.fetchers) }\n : {}),\n });\n }\n\n revalidatingFetchers.forEach((rf) => {\n if (fetchControllers.has(rf.key)) {\n abortFetcher(rf.key);\n }\n if (rf.controller) {\n // Fetchers use an independent AbortController so that aborting a fetcher\n // (via deleteFetcher) does not abort the triggering navigation that\n // triggered the revalidation\n fetchControllers.set(rf.key, rf.controller);\n }\n });\n\n // Proxy navigation abort through to revalidation fetchers\n let abortPendingFetchRevalidations = () =>\n revalidatingFetchers.forEach((f) => abortFetcher(f.key));\n if (pendingNavigationController) {\n pendingNavigationController.signal.addEventListener(\n \"abort\",\n abortPendingFetchRevalidations\n );\n }\n\n let { results, loaderResults, fetcherResults } =\n await callLoadersAndMaybeResolveData(\n state.matches,\n matches,\n matchesToLoad,\n revalidatingFetchers,\n request\n );\n\n if (request.signal.aborted) {\n return { shortCircuited: true };\n }\n\n // Clean up _after_ loaders have completed. Don't clean up if we short\n // circuited because fetchControllers would have been aborted and\n // reassigned to new controllers for the next navigation\n if (pendingNavigationController) {\n pendingNavigationController.signal.removeEventListener(\n \"abort\",\n abortPendingFetchRevalidations\n );\n }\n revalidatingFetchers.forEach((rf) => fetchControllers.delete(rf.key));\n\n // If any loaders returned a redirect Response, start a new REPLACE navigation\n let redirect = findRedirect(results);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey =\n revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n await startRedirectNavigation(state, redirect.result, { replace });\n return { shortCircuited: true };\n }\n\n // Process and commit output from loaders\n let { loaderData, errors } = processLoaderData(\n state,\n matches,\n matchesToLoad,\n loaderResults,\n pendingError,\n revalidatingFetchers,\n fetcherResults,\n activeDeferreds\n );\n\n // Wire up subscribers to update loaderData as promises settle\n activeDeferreds.forEach((deferredData, routeId) => {\n deferredData.subscribe((aborted) => {\n // Note: No need to updateState here since the TrackedPromise on\n // loaderData is stable across resolve/reject\n // Remove this instance if we were aborted or if promises have settled\n if (aborted || deferredData.done) {\n activeDeferreds.delete(routeId);\n }\n });\n });\n\n let updatedFetchers = markFetchRedirectsDone();\n let didAbortFetchLoads = abortStaleFetchLoads(pendingNavigationLoadId);\n let shouldUpdateFetchers =\n updatedFetchers || didAbortFetchLoads || revalidatingFetchers.length > 0;\n\n return {\n loaderData,\n errors,\n ...(shouldUpdateFetchers ? { fetchers: new Map(state.fetchers) } : {}),\n };\n }\n\n function getFetcher(key: string): Fetcher {\n return state.fetchers.get(key) || IDLE_FETCHER;\n }\n\n // Trigger a fetcher load/submit for the given fetcher key\n function fetch(\n key: string,\n routeId: string,\n href: string | null,\n opts?: RouterFetchOptions\n ) {\n if (isServer) {\n throw new Error(\n \"router.fetch() was called during the server render, but it shouldn't be. \" +\n \"You are likely calling a useFetcher() method in the body of your component. \" +\n \"Try moving it to a useEffect or a callback.\"\n );\n }\n\n if (fetchControllers.has(key)) abortFetcher(key);\n\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let normalizedPath = normalizeTo(\n state.location,\n state.matches,\n basename,\n future.v7_prependBasename,\n href,\n routeId,\n opts?.relative\n );\n let matches = matchRoutes(routesToUse, normalizedPath, basename);\n\n if (!matches) {\n setFetcherError(\n key,\n routeId,\n getInternalRouterError(404, { pathname: normalizedPath })\n );\n return;\n }\n\n let { path, submission, error } = normalizeNavigateOptions(\n future.v7_normalizeFormMethod,\n true,\n normalizedPath,\n opts\n );\n\n if (error) {\n setFetcherError(key, routeId, error);\n return;\n }\n\n let match = getTargetMatch(matches, path);\n\n pendingPreventScrollReset = (opts && opts.preventScrollReset) === true;\n\n if (submission && isMutationMethod(submission.formMethod)) {\n handleFetcherAction(key, routeId, path, match, matches, submission);\n return;\n }\n\n // Store off the match so we can call it's shouldRevalidate on subsequent\n // revalidations\n fetchLoadMatches.set(key, { routeId, path });\n handleFetcherLoader(key, routeId, path, match, matches, submission);\n }\n\n // Call the action for the matched fetcher.submit(), and then handle redirects,\n // errors, and revalidation\n async function handleFetcherAction(\n key: string,\n routeId: string,\n path: string,\n match: AgnosticDataRouteMatch,\n requestMatches: AgnosticDataRouteMatch[],\n submission: Submission\n ) {\n interruptActiveLoads();\n fetchLoadMatches.delete(key);\n\n if (!match.route.action && !match.route.lazy) {\n let error = getInternalRouterError(405, {\n method: submission.formMethod,\n pathname: path,\n routeId: routeId,\n });\n setFetcherError(key, routeId, error);\n return;\n }\n\n // Put this fetcher into it's submitting state\n let existingFetcher = state.fetchers.get(key);\n let fetcher = getSubmittingFetcher(submission, existingFetcher);\n state.fetchers.set(key, fetcher);\n updateState({ fetchers: new Map(state.fetchers) });\n\n // Call the action for the fetcher\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(\n init.history,\n path,\n abortController.signal,\n submission\n );\n fetchControllers.set(key, abortController);\n\n let originatingLoadId = incrementingLoadId;\n let actionResult = await callLoaderOrAction(\n \"action\",\n fetchRequest,\n match,\n requestMatches,\n manifest,\n mapRouteProperties,\n basename\n );\n\n if (fetchRequest.signal.aborted) {\n // We can delete this so long as we weren't aborted by ou our own fetcher\n // re-submit which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n return;\n }\n\n if (isRedirectResult(actionResult)) {\n fetchControllers.delete(key);\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our action started, so that\n // should take precedence over this redirect navigation. We already\n // set isRevalidationRequired so all loaders for the new route should\n // fire unless opted out via shouldRevalidate\n let doneFetcher = getDoneFetcher(undefined);\n state.fetchers.set(key, doneFetcher);\n updateState({ fetchers: new Map(state.fetchers) });\n return;\n } else {\n fetchRedirectIds.add(key);\n let loadingFetcher = getLoadingFetcher(submission);\n state.fetchers.set(key, loadingFetcher);\n updateState({ fetchers: new Map(state.fetchers) });\n\n return startRedirectNavigation(state, actionResult, {\n submission,\n isFetchActionRedirect: true,\n });\n }\n }\n\n // Process any non-redirect errors thrown\n if (isErrorResult(actionResult)) {\n setFetcherError(key, routeId, actionResult.error);\n return;\n }\n\n if (isDeferredResult(actionResult)) {\n throw getInternalRouterError(400, { type: \"defer-action\" });\n }\n\n // Start the data load for current matches, or the next location if we're\n // in the middle of a navigation\n let nextLocation = state.navigation.location || state.location;\n let revalidationRequest = createClientSideRequest(\n init.history,\n nextLocation,\n abortController.signal\n );\n let routesToUse = inFlightDataRoutes || dataRoutes;\n let matches =\n state.navigation.state !== \"idle\"\n ? matchRoutes(routesToUse, state.navigation.location, basename)\n : state.matches;\n\n invariant(matches, \"Didn't find any matches after fetcher action\");\n\n let loadId = ++incrementingLoadId;\n fetchReloadIds.set(key, loadId);\n\n let loadFetcher = getLoadingFetcher(submission, actionResult.data);\n state.fetchers.set(key, loadFetcher);\n\n let [matchesToLoad, revalidatingFetchers] = getMatchesToLoad(\n init.history,\n state,\n matches,\n submission,\n nextLocation,\n isRevalidationRequired,\n cancelledDeferredRoutes,\n cancelledFetcherLoads,\n fetchLoadMatches,\n fetchRedirectIds,\n routesToUse,\n basename,\n { [match.route.id]: actionResult.data },\n undefined // No need to send through errors since we short circuit above\n );\n\n // Put all revalidating fetchers into the loading state, except for the\n // current fetcher which we want to keep in it's current loading state which\n // contains it's action submission info + action data\n revalidatingFetchers\n .filter((rf) => rf.key !== key)\n .forEach((rf) => {\n let staleKey = rf.key;\n let existingFetcher = state.fetchers.get(staleKey);\n let revalidatingFetcher = getLoadingFetcher(\n undefined,\n existingFetcher ? existingFetcher.data : undefined\n );\n state.fetchers.set(staleKey, revalidatingFetcher);\n if (fetchControllers.has(staleKey)) {\n abortFetcher(staleKey);\n }\n if (rf.controller) {\n fetchControllers.set(staleKey, rf.controller);\n }\n });\n\n updateState({ fetchers: new Map(state.fetchers) });\n\n let abortPendingFetchRevalidations = () =>\n revalidatingFetchers.forEach((rf) => abortFetcher(rf.key));\n\n abortController.signal.addEventListener(\n \"abort\",\n abortPendingFetchRevalidations\n );\n\n let { results, loaderResults, fetcherResults } =\n await callLoadersAndMaybeResolveData(\n state.matches,\n matches,\n matchesToLoad,\n revalidatingFetchers,\n revalidationRequest\n );\n\n if (abortController.signal.aborted) {\n return;\n }\n\n abortController.signal.removeEventListener(\n \"abort\",\n abortPendingFetchRevalidations\n );\n\n fetchReloadIds.delete(key);\n fetchControllers.delete(key);\n revalidatingFetchers.forEach((r) => fetchControllers.delete(r.key));\n\n let redirect = findRedirect(results);\n if (redirect) {\n if (redirect.idx >= matchesToLoad.length) {\n // If this redirect came from a fetcher make sure we mark it in\n // fetchRedirectIds so it doesn't get revalidated on the next set of\n // loader executions\n let fetcherKey =\n revalidatingFetchers[redirect.idx - matchesToLoad.length].key;\n fetchRedirectIds.add(fetcherKey);\n }\n return startRedirectNavigation(state, redirect.result);\n }\n\n // Process and commit output from loaders\n let { loaderData, errors } = processLoaderData(\n state,\n state.matches,\n matchesToLoad,\n loaderResults,\n undefined,\n revalidatingFetchers,\n fetcherResults,\n activeDeferreds\n );\n\n // Since we let revalidations complete even if the submitting fetcher was\n // deleted, only put it back to idle if it hasn't been deleted\n if (state.fetchers.has(key)) {\n let doneFetcher = getDoneFetcher(actionResult.data);\n state.fetchers.set(key, doneFetcher);\n }\n\n let didAbortFetchLoads = abortStaleFetchLoads(loadId);\n\n // If we are currently in a navigation loading state and this fetcher is\n // more recent than the navigation, we want the newer data so abort the\n // navigation and complete it with the fetcher data\n if (\n state.navigation.state === \"loading\" &&\n loadId > pendingNavigationLoadId\n ) {\n invariant(pendingAction, \"Expected pending action\");\n pendingNavigationController && pendingNavigationController.abort();\n\n completeNavigation(state.navigation.location, {\n matches,\n loaderData,\n errors,\n fetchers: new Map(state.fetchers),\n });\n } else {\n // otherwise just update with the fetcher data, preserving any existing\n // loaderData for loaders that did not need to reload. We have to\n // manually merge here since we aren't going through completeNavigation\n updateState({\n errors,\n loaderData: mergeLoaderData(\n state.loaderData,\n loaderData,\n matches,\n errors\n ),\n ...(didAbortFetchLoads || revalidatingFetchers.length > 0\n ? { fetchers: new Map(state.fetchers) }\n : {}),\n });\n isRevalidationRequired = false;\n }\n }\n\n // Call the matched loader for fetcher.load(), handling redirects, errors, etc.\n async function handleFetcherLoader(\n key: string,\n routeId: string,\n path: string,\n match: AgnosticDataRouteMatch,\n matches: AgnosticDataRouteMatch[],\n submission?: Submission\n ) {\n let existingFetcher = state.fetchers.get(key);\n // Put this fetcher into it's loading state\n let loadingFetcher = getLoadingFetcher(\n submission,\n existingFetcher ? existingFetcher.data : undefined\n );\n state.fetchers.set(key, loadingFetcher);\n updateState({ fetchers: new Map(state.fetchers) });\n\n // Call the loader for this fetcher route match\n let abortController = new AbortController();\n let fetchRequest = createClientSideRequest(\n init.history,\n path,\n abortController.signal\n );\n fetchControllers.set(key, abortController);\n\n let originatingLoadId = incrementingLoadId;\n let result: DataResult = await callLoaderOrAction(\n \"loader\",\n fetchRequest,\n match,\n matches,\n manifest,\n mapRouteProperties,\n basename\n );\n\n // Deferred isn't supported for fetcher loads, await everything and treat it\n // as a normal load. resolveDeferredData will return undefined if this\n // fetcher gets aborted, so we just leave result untouched and short circuit\n // below if that happens\n if (isDeferredResult(result)) {\n result =\n (await resolveDeferredData(result, fetchRequest.signal, true)) ||\n result;\n }\n\n // We can delete this so long as we weren't aborted by our our own fetcher\n // re-load which would have put _new_ controller is in fetchControllers\n if (fetchControllers.get(key) === abortController) {\n fetchControllers.delete(key);\n }\n\n if (fetchRequest.signal.aborted) {\n return;\n }\n\n // If the loader threw a redirect Response, start a new REPLACE navigation\n if (isRedirectResult(result)) {\n if (pendingNavigationLoadId > originatingLoadId) {\n // A new navigation was kicked off after our loader started, so that\n // should take precedence over this redirect navigation\n let doneFetcher = getDoneFetcher(undefined);\n state.fetchers.set(key, doneFetcher);\n updateState({ fetchers: new Map(state.fetchers) });\n return;\n } else {\n fetchRedirectIds.add(key);\n await startRedirectNavigation(state, result);\n return;\n }\n }\n\n // Process any non-redirect errors thrown\n if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n state.fetchers.delete(key);\n // TODO: In remix, this would reset to IDLE_NAVIGATION if it was a catch -\n // do we need to behave any differently with our non-redirect errors?\n // What if it was a non-redirect Response?\n updateState({\n fetchers: new Map(state.fetchers),\n errors: {\n [boundaryMatch.route.id]: result.error,\n },\n });\n return;\n }\n\n invariant(!isDeferredResult(result), \"Unhandled fetcher deferred data\");\n\n // Put the fetcher back into an idle state\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n updateState({ fetchers: new Map(state.fetchers) });\n }\n\n /**\n * Utility function to handle redirects returned from an action or loader.\n * Normally, a redirect \"replaces\" the navigation that triggered it. So, for\n * example:\n *\n * - user is on /a\n * - user clicks a link to /b\n * - loader for /b redirects to /c\n *\n * In a non-JS app the browser would track the in-flight navigation to /b and\n * then replace it with /c when it encountered the redirect response. In\n * the end it would only ever update the URL bar with /c.\n *\n * In client-side routing using pushState/replaceState, we aim to emulate\n * this behavior and we also do not update history until the end of the\n * navigation (including processed redirects). This means that we never\n * actually touch history until we've processed redirects, so we just use\n * the history action from the original navigation (PUSH or REPLACE).\n */\n async function startRedirectNavigation(\n state: RouterState,\n redirect: RedirectResult,\n {\n submission,\n replace,\n isFetchActionRedirect,\n }: {\n submission?: Submission;\n replace?: boolean;\n isFetchActionRedirect?: boolean;\n } = {}\n ) {\n if (redirect.revalidate) {\n isRevalidationRequired = true;\n }\n\n let redirectLocation = createLocation(\n state.location,\n redirect.location,\n // TODO: This can be removed once we get rid of useTransition in Remix v2\n {\n _isRedirect: true,\n ...(isFetchActionRedirect ? { _isFetchActionRedirect: true } : {}),\n }\n );\n invariant(\n redirectLocation,\n \"Expected a location on the redirect navigation\"\n );\n\n if (isBrowser) {\n let isDocumentReload = false;\n\n if (redirect.reloadDocument) {\n // Hard reload if the response contained X-Remix-Reload-Document\n isDocumentReload = true;\n } else if (ABSOLUTE_URL_REGEX.test(redirect.location)) {\n const url = init.history.createURL(redirect.location);\n isDocumentReload =\n // Hard reload if it's an absolute URL to a new origin\n url.origin !== routerWindow.location.origin ||\n // Hard reload if it's an absolute URL that does not match our basename\n stripBasename(url.pathname, basename) == null;\n }\n\n if (isDocumentReload) {\n if (replace) {\n routerWindow.location.replace(redirect.location);\n } else {\n routerWindow.location.assign(redirect.location);\n }\n return;\n }\n }\n\n // There's no need to abort on redirects, since we don't detect the\n // redirect until the action/loaders have settled\n pendingNavigationController = null;\n\n let redirectHistoryAction =\n replace === true ? HistoryAction.Replace : HistoryAction.Push;\n\n // Use the incoming submission if provided, fallback on the active one in\n // state.navigation\n let activeSubmission =\n submission || getSubmissionFromNavigation(state.navigation);\n\n // If this was a 307/308 submission we want to preserve the HTTP method and\n // re-submit the GET/POST/PUT/PATCH/DELETE as a submission navigation to the\n // redirected location\n if (\n redirectPreserveMethodStatusCodes.has(redirect.status) &&\n activeSubmission &&\n isMutationMethod(activeSubmission.formMethod)\n ) {\n await startNavigation(redirectHistoryAction, redirectLocation, {\n submission: {\n ...activeSubmission,\n formAction: redirect.location,\n },\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset,\n });\n } else if (isFetchActionRedirect) {\n // For a fetch action redirect, we kick off a new loading navigation\n // without the fetcher submission, but we send it along for shouldRevalidate\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation: getLoadingNavigation(redirectLocation),\n fetcherSubmission: activeSubmission,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset,\n });\n } else {\n // If we have a submission, we will preserve it through the redirect navigation\n let overrideNavigation = getLoadingNavigation(\n redirectLocation,\n activeSubmission\n );\n await startNavigation(redirectHistoryAction, redirectLocation, {\n overrideNavigation,\n // Preserve this flag across redirects\n preventScrollReset: pendingPreventScrollReset,\n });\n }\n }\n\n async function callLoadersAndMaybeResolveData(\n currentMatches: AgnosticDataRouteMatch[],\n matches: AgnosticDataRouteMatch[],\n matchesToLoad: AgnosticDataRouteMatch[],\n fetchersToLoad: RevalidatingFetcher[],\n request: Request\n ) {\n // Call all navigation loaders and revalidating fetcher loaders in parallel,\n // then slice off the results into separate arrays so we can handle them\n // accordingly\n let results = await Promise.all([\n ...matchesToLoad.map((match) =>\n callLoaderOrAction(\n \"loader\",\n request,\n match,\n matches,\n manifest,\n mapRouteProperties,\n basename\n )\n ),\n ...fetchersToLoad.map((f) => {\n if (f.matches && f.match && f.controller) {\n return callLoaderOrAction(\n \"loader\",\n createClientSideRequest(init.history, f.path, f.controller.signal),\n f.match,\n f.matches,\n manifest,\n mapRouteProperties,\n basename\n );\n } else {\n let error: ErrorResult = {\n type: ResultType.error,\n error: getInternalRouterError(404, { pathname: f.path }),\n };\n return error;\n }\n }),\n ]);\n let loaderResults = results.slice(0, matchesToLoad.length);\n let fetcherResults = results.slice(matchesToLoad.length);\n\n await Promise.all([\n resolveDeferredResults(\n currentMatches,\n matchesToLoad,\n loaderResults,\n loaderResults.map(() => request.signal),\n false,\n state.loaderData\n ),\n resolveDeferredResults(\n currentMatches,\n fetchersToLoad.map((f) => f.match),\n fetcherResults,\n fetchersToLoad.map((f) => (f.controller ? f.controller.signal : null)),\n true\n ),\n ]);\n\n return { results, loaderResults, fetcherResults };\n }\n\n function interruptActiveLoads() {\n // Every interruption triggers a revalidation\n isRevalidationRequired = true;\n\n // Cancel pending route-level deferreds and mark cancelled routes for\n // revalidation\n cancelledDeferredRoutes.push(...cancelActiveDeferreds());\n\n // Abort in-flight fetcher loads\n fetchLoadMatches.forEach((_, key) => {\n if (fetchControllers.has(key)) {\n cancelledFetcherLoads.push(key);\n abortFetcher(key);\n }\n });\n }\n\n function setFetcherError(key: string, routeId: string, error: any) {\n let boundaryMatch = findNearestBoundary(state.matches, routeId);\n deleteFetcher(key);\n updateState({\n errors: {\n [boundaryMatch.route.id]: error,\n },\n fetchers: new Map(state.fetchers),\n });\n }\n\n function deleteFetcher(key: string): void {\n let fetcher = state.fetchers.get(key);\n // Don't abort the controller if this is a deletion of a fetcher.submit()\n // in it's loading phase since - we don't want to abort the corresponding\n // revalidation and want them to complete and land\n if (\n fetchControllers.has(key) &&\n !(fetcher && fetcher.state === \"loading\" && fetchReloadIds.has(key))\n ) {\n abortFetcher(key);\n }\n fetchLoadMatches.delete(key);\n fetchReloadIds.delete(key);\n fetchRedirectIds.delete(key);\n state.fetchers.delete(key);\n }\n\n function abortFetcher(key: string) {\n let controller = fetchControllers.get(key);\n invariant(controller, `Expected fetch controller: ${key}`);\n controller.abort();\n fetchControllers.delete(key);\n }\n\n function markFetchersDone(keys: string[]) {\n for (let key of keys) {\n let fetcher = getFetcher(key);\n let doneFetcher = getDoneFetcher(fetcher.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n\n function markFetchRedirectsDone(): boolean {\n let doneKeys = [];\n let updatedFetchers = false;\n for (let key of fetchRedirectIds) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, `Expected fetcher: ${key}`);\n if (fetcher.state === \"loading\") {\n fetchRedirectIds.delete(key);\n doneKeys.push(key);\n updatedFetchers = true;\n }\n }\n markFetchersDone(doneKeys);\n return updatedFetchers;\n }\n\n function abortStaleFetchLoads(landedId: number): boolean {\n let yeetedKeys = [];\n for (let [key, id] of fetchReloadIds) {\n if (id < landedId) {\n let fetcher = state.fetchers.get(key);\n invariant(fetcher, `Expected fetcher: ${key}`);\n if (fetcher.state === \"loading\") {\n abortFetcher(key);\n fetchReloadIds.delete(key);\n yeetedKeys.push(key);\n }\n }\n }\n markFetchersDone(yeetedKeys);\n return yeetedKeys.length > 0;\n }\n\n function getBlocker(key: string, fn: BlockerFunction) {\n let blocker: Blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\n if (blockerFunctions.get(key) !== fn) {\n blockerFunctions.set(key, fn);\n }\n\n return blocker;\n }\n\n function deleteBlocker(key: string) {\n state.blockers.delete(key);\n blockerFunctions.delete(key);\n }\n\n // Utility function to update blockers, ensuring valid state transitions\n function updateBlocker(key: string, newBlocker: Blocker) {\n let blocker = state.blockers.get(key) || IDLE_BLOCKER;\n\n // Poor mans state machine :)\n // https://mermaid.live/edit#pako:eNqVkc9OwzAMxl8l8nnjAYrEtDIOHEBIgwvKJTReGy3_lDpIqO27k6awMG0XcrLlnz87nwdonESogKXXBuE79rq75XZO3-yHds0RJVuv70YrPlUrCEe2HfrORS3rubqZfuhtpg5C9wk5tZ4VKcRUq88q9Z8RS0-48cE1iHJkL0ugbHuFLus9L6spZy8nX9MP2CNdomVaposqu3fGayT8T8-jJQwhepo_UtpgBQaDEUom04dZhAN1aJBDlUKJBxE1ceB2Smj0Mln-IBW5AFU2dwUiktt_2Qaq2dBfaKdEup85UV7Yd-dKjlnkabl2Pvr0DTkTreM\n invariant(\n (blocker.state === \"unblocked\" && newBlocker.state === \"blocked\") ||\n (blocker.state === \"blocked\" && newBlocker.state === \"blocked\") ||\n (blocker.state === \"blocked\" && newBlocker.state === \"proceeding\") ||\n (blocker.state === \"blocked\" && newBlocker.state === \"unblocked\") ||\n (blocker.state === \"proceeding\" && newBlocker.state === \"unblocked\"),\n `Invalid blocker state transition: ${blocker.state} -> ${newBlocker.state}`\n );\n\n let blockers = new Map(state.blockers);\n blockers.set(key, newBlocker);\n updateState({ blockers });\n }\n\n function shouldBlockNavigation({\n currentLocation,\n nextLocation,\n historyAction,\n }: {\n currentLocation: Location;\n nextLocation: Location;\n historyAction: HistoryAction;\n }): string | undefined {\n if (blockerFunctions.size === 0) {\n return;\n }\n\n // We ony support a single active blocker at the moment since we don't have\n // any compelling use cases for multi-blocker yet\n if (blockerFunctions.size > 1) {\n warning(false, \"A router only supports one blocker at a time\");\n }\n\n let entries = Array.from(blockerFunctions.entries());\n let [blockerKey, blockerFunction] = entries[entries.length - 1];\n let blocker = state.blockers.get(blockerKey);\n\n if (blocker && blocker.state === \"proceeding\") {\n // If the blocker is currently proceeding, we don't need to re-check\n // it and can let this navigation continue\n return;\n }\n\n // At this point, we know we're unblocked/blocked so we need to check the\n // user-provided blocker function\n if (blockerFunction({ currentLocation, nextLocation, historyAction })) {\n return blockerKey;\n }\n }\n\n function cancelActiveDeferreds(\n predicate?: (routeId: string) => boolean\n ): string[] {\n let cancelledRouteIds: string[] = [];\n activeDeferreds.forEach((dfd, routeId) => {\n if (!predicate || predicate(routeId)) {\n // Cancel the deferred - but do not remove from activeDeferreds here -\n // we rely on the subscribers to do that so our tests can assert proper\n // cleanup via _internalActiveDeferreds\n dfd.cancel();\n cancelledRouteIds.push(routeId);\n activeDeferreds.delete(routeId);\n }\n });\n return cancelledRouteIds;\n }\n\n // Opt in to capturing and reporting scroll positions during navigations,\n // used by the component\n function enableScrollRestoration(\n positions: Record,\n getPosition: GetScrollPositionFunction,\n getKey?: GetScrollRestorationKeyFunction\n ) {\n savedScrollPositions = positions;\n getScrollPosition = getPosition;\n getScrollRestorationKey = getKey || null;\n\n // Perform initial hydration scroll restoration, since we miss the boat on\n // the initial updateState() because we've not yet rendered \n // and therefore have no savedScrollPositions available\n if (!initialScrollRestored && state.navigation === IDLE_NAVIGATION) {\n initialScrollRestored = true;\n let y = getSavedScrollPosition(state.location, state.matches);\n if (y != null) {\n updateState({ restoreScrollPosition: y });\n }\n }\n\n return () => {\n savedScrollPositions = null;\n getScrollPosition = null;\n getScrollRestorationKey = null;\n };\n }\n\n function getScrollKey(location: Location, matches: AgnosticDataRouteMatch[]) {\n if (getScrollRestorationKey) {\n let key = getScrollRestorationKey(\n location,\n matches.map((m) => createUseMatchesMatch(m, state.loaderData))\n );\n return key || location.key;\n }\n return location.key;\n }\n\n function saveScrollPosition(\n location: Location,\n matches: AgnosticDataRouteMatch[]\n ): void {\n if (savedScrollPositions && getScrollPosition) {\n let key = getScrollKey(location, matches);\n savedScrollPositions[key] = getScrollPosition();\n }\n }\n\n function getSavedScrollPosition(\n location: Location,\n matches: AgnosticDataRouteMatch[]\n ): number | null {\n if (savedScrollPositions) {\n let key = getScrollKey(location, matches);\n let y = savedScrollPositions[key];\n if (typeof y === \"number\") {\n return y;\n }\n }\n return null;\n }\n\n function _internalSetRoutes(newRoutes: AgnosticDataRouteObject[]) {\n manifest = {};\n inFlightDataRoutes = convertRoutesToDataRoutes(\n newRoutes,\n mapRouteProperties,\n undefined,\n manifest\n );\n }\n\n router = {\n get basename() {\n return basename;\n },\n get state() {\n return state;\n },\n get routes() {\n return dataRoutes;\n },\n initialize,\n subscribe,\n enableScrollRestoration,\n navigate,\n fetch,\n revalidate,\n // Passthrough to history-aware createHref used by useHref so we get proper\n // hash-aware URLs in DOM paths\n createHref: (to: To) => init.history.createHref(to),\n encodeLocation: (to: To) => init.history.encodeLocation(to),\n getFetcher,\n deleteFetcher,\n dispose,\n getBlocker,\n deleteBlocker,\n _internalFetchControllers: fetchControllers,\n _internalActiveDeferreds: activeDeferreds,\n // TODO: Remove setRoutes, it's temporary to avoid dealing with\n // updating the tree while validating the update algorithm.\n _internalSetRoutes,\n };\n\n return router;\n}\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region createStaticHandler\n////////////////////////////////////////////////////////////////////////////////\n\nexport const UNSAFE_DEFERRED_SYMBOL = Symbol(\"deferred\");\n\nexport interface CreateStaticHandlerOptions {\n basename?: string;\n /**\n * @deprecated Use `mapRouteProperties` instead\n */\n detectErrorBoundary?: DetectErrorBoundaryFunction;\n mapRouteProperties?: MapRoutePropertiesFunction;\n}\n\nexport function createStaticHandler(\n routes: AgnosticRouteObject[],\n opts?: CreateStaticHandlerOptions\n): StaticHandler {\n invariant(\n routes.length > 0,\n \"You must provide a non-empty routes array to createStaticHandler\"\n );\n\n let manifest: RouteManifest = {};\n let basename = (opts ? opts.basename : null) || \"/\";\n let mapRouteProperties: MapRoutePropertiesFunction;\n if (opts?.mapRouteProperties) {\n mapRouteProperties = opts.mapRouteProperties;\n } else if (opts?.detectErrorBoundary) {\n // If they are still using the deprecated version, wrap it with the new API\n let detectErrorBoundary = opts.detectErrorBoundary;\n mapRouteProperties = (route) => ({\n hasErrorBoundary: detectErrorBoundary(route),\n });\n } else {\n mapRouteProperties = defaultMapRouteProperties;\n }\n\n let dataRoutes = convertRoutesToDataRoutes(\n routes,\n mapRouteProperties,\n undefined,\n manifest\n );\n\n /**\n * The query() method is intended for document requests, in which we want to\n * call an optional action and potentially multiple loaders for all nested\n * routes. It returns a StaticHandlerContext object, which is very similar\n * to the router state (location, loaderData, actionData, errors, etc.) and\n * also adds SSR-specific information such as the statusCode and headers\n * from action/loaders Responses.\n *\n * It _should_ never throw and should report all errors through the\n * returned context.errors object, properly associating errors to their error\n * boundary. Additionally, it tracks _deepestRenderedBoundaryId which can be\n * used to emulate React error boundaries during SSr by performing a second\n * pass only down to the boundaryId.\n *\n * The one exception where we do not return a StaticHandlerContext is when a\n * redirect response is returned or thrown from any action/loader. We\n * propagate that out and return the raw Response so the HTTP server can\n * return it directly.\n */\n async function query(\n request: Request,\n { requestContext }: { requestContext?: unknown } = {}\n ): Promise {\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\") {\n let error = getInternalRouterError(405, { method });\n let { matches: methodNotAllowedMatches, route } =\n getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: methodNotAllowedMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error,\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null,\n };\n } else if (!matches) {\n let error = getInternalRouterError(404, { pathname: location.pathname });\n let { matches: notFoundMatches, route } =\n getShortCircuitMatches(dataRoutes);\n return {\n basename,\n location,\n matches: notFoundMatches,\n loaderData: {},\n actionData: null,\n errors: {\n [route.id]: error,\n },\n statusCode: error.status,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null,\n };\n }\n\n let result = await queryImpl(request, location, matches, requestContext);\n if (isResponse(result)) {\n return result;\n }\n\n // When returning StaticHandlerContext, we patch back in the location here\n // since we need it for React Context. But this helps keep our submit and\n // loadRouteData operating on a Request instead of a Location\n return { location, basename, ...result };\n }\n\n /**\n * The queryRoute() method is intended for targeted route requests, either\n * for fetch ?_data requests or resource route requests. In this case, we\n * are only ever calling a single action or loader, and we are returning the\n * returned value directly. In most cases, this will be a Response returned\n * from the action/loader, but it may be a primitive or other value as well -\n * and in such cases the calling context should handle that accordingly.\n *\n * We do respect the throw/return differentiation, so if an action/loader\n * throws, then this method will throw the value. This is important so we\n * can do proper boundary identification in Remix where a thrown Response\n * must go to the Catch Boundary but a returned Response is happy-path.\n *\n * One thing to note is that any Router-initiated Errors that make sense\n * to associate with a status code will be thrown as an ErrorResponse\n * instance which include the raw Error, such that the calling context can\n * serialize the error as they see fit while including the proper response\n * code. Examples here are 404 and 405 errors that occur prior to reaching\n * any user-defined loaders.\n */\n async function queryRoute(\n request: Request,\n {\n routeId,\n requestContext,\n }: { requestContext?: unknown; routeId?: string } = {}\n ): Promise {\n let url = new URL(request.url);\n let method = request.method;\n let location = createLocation(\"\", createPath(url), null, \"default\");\n let matches = matchRoutes(dataRoutes, location, basename);\n\n // SSR supports HEAD requests while SPA doesn't\n if (!isValidMethod(method) && method !== \"HEAD\" && method !== \"OPTIONS\") {\n throw getInternalRouterError(405, { method });\n } else if (!matches) {\n throw getInternalRouterError(404, { pathname: location.pathname });\n }\n\n let match = routeId\n ? matches.find((m) => m.route.id === routeId)\n : getTargetMatch(matches, location);\n\n if (routeId && !match) {\n throw getInternalRouterError(403, {\n pathname: location.pathname,\n routeId,\n });\n } else if (!match) {\n // This should never hit I don't think?\n throw getInternalRouterError(404, { pathname: location.pathname });\n }\n\n let result = await queryImpl(\n request,\n location,\n matches,\n requestContext,\n match\n );\n if (isResponse(result)) {\n return result;\n }\n\n let error = result.errors ? Object.values(result.errors)[0] : undefined;\n if (error !== undefined) {\n // If we got back result.errors, that means the loader/action threw\n // _something_ that wasn't a Response, but it's not guaranteed/required\n // to be an `instanceof Error` either, so we have to use throw here to\n // preserve the \"error\" state outside of queryImpl.\n throw error;\n }\n\n // Pick off the right state value to return\n if (result.actionData) {\n return Object.values(result.actionData)[0];\n }\n\n if (result.loaderData) {\n let data = Object.values(result.loaderData)[0];\n if (result.activeDeferreds?.[match.route.id]) {\n data[UNSAFE_DEFERRED_SYMBOL] = result.activeDeferreds[match.route.id];\n }\n return data;\n }\n\n return undefined;\n }\n\n async function queryImpl(\n request: Request,\n location: Location,\n matches: AgnosticDataRouteMatch[],\n requestContext: unknown,\n routeMatch?: AgnosticDataRouteMatch\n ): Promise | Response> {\n invariant(\n request.signal,\n \"query()/queryRoute() requests must contain an AbortController signal\"\n );\n\n try {\n if (isMutationMethod(request.method.toLowerCase())) {\n let result = await submit(\n request,\n matches,\n routeMatch || getTargetMatch(matches, location),\n requestContext,\n routeMatch != null\n );\n return result;\n }\n\n let result = await loadRouteData(\n request,\n matches,\n requestContext,\n routeMatch\n );\n return isResponse(result)\n ? result\n : {\n ...result,\n actionData: null,\n actionHeaders: {},\n };\n } catch (e) {\n // If the user threw/returned a Response in callLoaderOrAction, we throw\n // it to bail out and then return or throw here based on whether the user\n // returned or threw\n if (isQueryRouteResponse(e)) {\n if (e.type === ResultType.error) {\n throw e.response;\n }\n return e.response;\n }\n // Redirects are always returned since they don't propagate to catch\n // boundaries\n if (isRedirectResponse(e)) {\n return e;\n }\n throw e;\n }\n }\n\n async function submit(\n request: Request,\n matches: AgnosticDataRouteMatch[],\n actionMatch: AgnosticDataRouteMatch,\n requestContext: unknown,\n isRouteRequest: boolean\n ): Promise | Response> {\n let result: DataResult;\n\n if (!actionMatch.route.action && !actionMatch.route.lazy) {\n let error = getInternalRouterError(405, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: actionMatch.route.id,\n });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error,\n };\n } else {\n result = await callLoaderOrAction(\n \"action\",\n request,\n actionMatch,\n matches,\n manifest,\n mapRouteProperties,\n basename,\n { isStaticRequest: true, isRouteRequest, requestContext }\n );\n\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(`${method}() call aborted`);\n }\n }\n\n if (isRedirectResult(result)) {\n // Uhhhh - this should never happen, we should always throw these from\n // callLoaderOrAction, but the type narrowing here keeps TS happy and we\n // can get back on the \"throw all redirect responses\" train here should\n // this ever happen :/\n throw new Response(null, {\n status: result.status,\n headers: {\n Location: result.location,\n },\n });\n }\n\n if (isDeferredResult(result)) {\n let error = getInternalRouterError(400, { type: \"defer-action\" });\n if (isRouteRequest) {\n throw error;\n }\n result = {\n type: ResultType.error,\n error,\n };\n }\n\n if (isRouteRequest) {\n // Note: This should only be non-Response values if we get here, since\n // isRouteRequest should throw any Response received in callLoaderOrAction\n if (isErrorResult(result)) {\n throw result.error;\n }\n\n return {\n matches: [actionMatch],\n loaderData: {},\n actionData: { [actionMatch.route.id]: result.data },\n errors: null,\n // Note: statusCode + headers are unused here since queryRoute will\n // return the raw Response or value\n statusCode: 200,\n loaderHeaders: {},\n actionHeaders: {},\n activeDeferreds: null,\n };\n }\n\n if (isErrorResult(result)) {\n // Store off the pending error - we use it to determine which loaders\n // to call and will commit it when we complete the navigation\n let boundaryMatch = findNearestBoundary(matches, actionMatch.route.id);\n let context = await loadRouteData(\n request,\n matches,\n requestContext,\n undefined,\n {\n [boundaryMatch.route.id]: result.error,\n }\n );\n\n // action status codes take precedence over loader status codes\n return {\n ...context,\n statusCode: isRouteErrorResponse(result.error)\n ? result.error.status\n : 500,\n actionData: null,\n actionHeaders: {\n ...(result.headers ? { [actionMatch.route.id]: result.headers } : {}),\n },\n };\n }\n\n // Create a GET request for the loaders\n let loaderRequest = new Request(request.url, {\n headers: request.headers,\n redirect: request.redirect,\n signal: request.signal,\n });\n let context = await loadRouteData(loaderRequest, matches, requestContext);\n\n return {\n ...context,\n // action status codes take precedence over loader status codes\n ...(result.statusCode ? { statusCode: result.statusCode } : {}),\n actionData: {\n [actionMatch.route.id]: result.data,\n },\n actionHeaders: {\n ...(result.headers ? { [actionMatch.route.id]: result.headers } : {}),\n },\n };\n }\n\n async function loadRouteData(\n request: Request,\n matches: AgnosticDataRouteMatch[],\n requestContext: unknown,\n routeMatch?: AgnosticDataRouteMatch,\n pendingActionError?: RouteData\n ): Promise<\n | Omit<\n StaticHandlerContext,\n \"location\" | \"basename\" | \"actionData\" | \"actionHeaders\"\n >\n | Response\n > {\n let isRouteRequest = routeMatch != null;\n\n // Short circuit if we have no loaders to run (queryRoute())\n if (\n isRouteRequest &&\n !routeMatch?.route.loader &&\n !routeMatch?.route.lazy\n ) {\n throw getInternalRouterError(400, {\n method: request.method,\n pathname: new URL(request.url).pathname,\n routeId: routeMatch?.route.id,\n });\n }\n\n let requestMatches = routeMatch\n ? [routeMatch]\n : getLoaderMatchesUntilBoundary(\n matches,\n Object.keys(pendingActionError || {})[0]\n );\n let matchesToLoad = requestMatches.filter(\n (m) => m.route.loader || m.route.lazy\n );\n\n // Short circuit if we have no loaders to run (query())\n if (matchesToLoad.length === 0) {\n return {\n matches,\n // Add a null for all matched routes for proper revalidation on the client\n loaderData: matches.reduce(\n (acc, m) => Object.assign(acc, { [m.route.id]: null }),\n {}\n ),\n errors: pendingActionError || null,\n statusCode: 200,\n loaderHeaders: {},\n activeDeferreds: null,\n };\n }\n\n let results = await Promise.all([\n ...matchesToLoad.map((match) =>\n callLoaderOrAction(\n \"loader\",\n request,\n match,\n matches,\n manifest,\n mapRouteProperties,\n basename,\n { isStaticRequest: true, isRouteRequest, requestContext }\n )\n ),\n ]);\n\n if (request.signal.aborted) {\n let method = isRouteRequest ? \"queryRoute\" : \"query\";\n throw new Error(`${method}() call aborted`);\n }\n\n // Process and commit output from loaders\n let activeDeferreds = new Map();\n let context = processRouteLoaderData(\n matches,\n matchesToLoad,\n results,\n pendingActionError,\n activeDeferreds\n );\n\n // Add a null for any non-loader matches for proper revalidation on the client\n let executedLoaders = new Set(\n matchesToLoad.map((match) => match.route.id)\n );\n matches.forEach((match) => {\n if (!executedLoaders.has(match.route.id)) {\n context.loaderData[match.route.id] = null;\n }\n });\n\n return {\n ...context,\n matches,\n activeDeferreds:\n activeDeferreds.size > 0\n ? Object.fromEntries(activeDeferreds.entries())\n : null,\n };\n }\n\n return {\n dataRoutes,\n query,\n queryRoute,\n };\n}\n\n//#endregion\n\n////////////////////////////////////////////////////////////////////////////////\n//#region Helpers\n////////////////////////////////////////////////////////////////////////////////\n\n/**\n * Given an existing StaticHandlerContext and an error thrown at render time,\n * provide an updated StaticHandlerContext suitable for a second SSR render\n */\nexport function getStaticContextFromError(\n routes: AgnosticDataRouteObject[],\n context: StaticHandlerContext,\n error: any\n) {\n let newContext: StaticHandlerContext = {\n ...context,\n statusCode: 500,\n errors: {\n [context._deepestRenderedBoundaryId || routes[0].id]: error,\n },\n };\n return newContext;\n}\n\nfunction isSubmissionNavigation(\n opts: RouterNavigateOptions\n): opts is SubmissionNavigateOptions {\n return (\n opts != null &&\n ((\"formData\" in opts && opts.formData != null) ||\n (\"body\" in opts && opts.body !== undefined))\n );\n}\n\nfunction normalizeTo(\n location: Path,\n matches: AgnosticDataRouteMatch[],\n basename: string,\n prependBasename: boolean,\n to: To | null,\n fromRouteId?: string,\n relative?: RelativeRoutingType\n) {\n let contextualMatches: AgnosticDataRouteMatch[];\n let activeRouteMatch: AgnosticDataRouteMatch | undefined;\n if (fromRouteId != null && relative !== \"path\") {\n // Grab matches up to the calling route so our route-relative logic is\n // relative to the correct source route. When using relative:path,\n // fromRouteId is ignored since that is always relative to the current\n // location path\n contextualMatches = [];\n for (let match of matches) {\n contextualMatches.push(match);\n if (match.route.id === fromRouteId) {\n activeRouteMatch = match;\n break;\n }\n }\n } else {\n contextualMatches = matches;\n activeRouteMatch = matches[matches.length - 1];\n }\n\n // Resolve the relative path\n let path = resolveTo(\n to ? to : \".\",\n getPathContributingMatches(contextualMatches).map((m) => m.pathnameBase),\n stripBasename(location.pathname, basename) || location.pathname,\n relative === \"path\"\n );\n\n // When `to` is not specified we inherit search/hash from the current\n // location, unlike when to=\".\" and we just inherit the path.\n // See https://github.com/remix-run/remix/issues/927\n if (to == null) {\n path.search = location.search;\n path.hash = location.hash;\n }\n\n // Add an ?index param for matched index routes if we don't already have one\n if (\n (to == null || to === \"\" || to === \".\") &&\n activeRouteMatch &&\n activeRouteMatch.route.index &&\n !hasNakedIndexQuery(path.search)\n ) {\n path.search = path.search\n ? path.search.replace(/^\\?/, \"?index&\")\n : \"?index\";\n }\n\n // If we're operating within a basename, prepend it to the pathname. If\n // this is a root navigation, then just use the raw basename which allows\n // the basename to have full control over the presence of a trailing slash\n // on root actions\n if (prependBasename && basename !== \"/\") {\n path.pathname =\n path.pathname === \"/\" ? basename : joinPaths([basename, path.pathname]);\n }\n\n return createPath(path);\n}\n\n// Normalize navigation options by converting formMethod=GET formData objects to\n// URLSearchParams so they behave identically to links with query params\nfunction normalizeNavigateOptions(\n normalizeFormMethod: boolean,\n isFetcher: boolean,\n path: string,\n opts?: RouterNavigateOptions\n): {\n path: string;\n submission?: Submission;\n error?: ErrorResponse;\n} {\n // Return location verbatim on non-submission navigations\n if (!opts || !isSubmissionNavigation(opts)) {\n return { path };\n }\n\n if (opts.formMethod && !isValidMethod(opts.formMethod)) {\n return {\n path,\n error: getInternalRouterError(405, { method: opts.formMethod }),\n };\n }\n\n let getInvalidBodyError = () => ({\n path,\n error: getInternalRouterError(400, { type: \"invalid-body\" }),\n });\n\n // Create a Submission on non-GET navigations\n let rawFormMethod = opts.formMethod || \"get\";\n let formMethod = normalizeFormMethod\n ? (rawFormMethod.toUpperCase() as V7_FormMethod)\n : (rawFormMethod.toLowerCase() as FormMethod);\n let formAction = stripHashFromPath(path);\n\n if (opts.body !== undefined) {\n if (opts.formEncType === \"text/plain\") {\n // text only support POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n\n let text =\n typeof opts.body === \"string\"\n ? opts.body\n : opts.body instanceof FormData ||\n opts.body instanceof URLSearchParams\n ? // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#plain-text-form-data\n Array.from(opts.body.entries()).reduce(\n (acc, [name, value]) => `${acc}${name}=${value}\\n`,\n \"\"\n )\n : String(opts.body);\n\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json: undefined,\n text,\n },\n };\n } else if (opts.formEncType === \"application/json\") {\n // json only supports POST/PUT/PATCH/DELETE submissions\n if (!isMutationMethod(formMethod)) {\n return getInvalidBodyError();\n }\n\n try {\n let json =\n typeof opts.body === \"string\" ? JSON.parse(opts.body) : opts.body;\n\n return {\n path,\n submission: {\n formMethod,\n formAction,\n formEncType: opts.formEncType,\n formData: undefined,\n json,\n text: undefined,\n },\n };\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n }\n\n invariant(\n typeof FormData === \"function\",\n \"FormData is not available in this environment\"\n );\n\n let searchParams: URLSearchParams;\n let formData: FormData;\n\n if (opts.formData) {\n searchParams = convertFormDataToSearchParams(opts.formData);\n formData = opts.formData;\n } else if (opts.body instanceof FormData) {\n searchParams = convertFormDataToSearchParams(opts.body);\n formData = opts.body;\n } else if (opts.body instanceof URLSearchParams) {\n searchParams = opts.body;\n formData = convertSearchParamsToFormData(searchParams);\n } else if (opts.body == null) {\n searchParams = new URLSearchParams();\n formData = new FormData();\n } else {\n try {\n searchParams = new URLSearchParams(opts.body);\n formData = convertSearchParamsToFormData(searchParams);\n } catch (e) {\n return getInvalidBodyError();\n }\n }\n\n let submission: Submission = {\n formMethod,\n formAction,\n formEncType:\n (opts && opts.formEncType) || \"application/x-www-form-urlencoded\",\n formData,\n json: undefined,\n text: undefined,\n };\n\n if (isMutationMethod(submission.formMethod)) {\n return { path, submission };\n }\n\n // Flatten submission onto URLSearchParams for GET submissions\n let parsedPath = parsePath(path);\n // On GET navigation submissions we can drop the ?index param from the\n // resulting location since all loaders will run. But fetcher GET submissions\n // only run a single loader so we need to preserve any incoming ?index params\n if (isFetcher && parsedPath.search && hasNakedIndexQuery(parsedPath.search)) {\n searchParams.append(\"index\", \"\");\n }\n parsedPath.search = `?${searchParams}`;\n\n return { path: createPath(parsedPath), submission };\n}\n\n// Filter out all routes below any caught error as they aren't going to\n// render so we don't need to load them\nfunction getLoaderMatchesUntilBoundary(\n matches: AgnosticDataRouteMatch[],\n boundaryId?: string\n) {\n let boundaryMatches = matches;\n if (boundaryId) {\n let index = matches.findIndex((m) => m.route.id === boundaryId);\n if (index >= 0) {\n boundaryMatches = matches.slice(0, index);\n }\n }\n return boundaryMatches;\n}\n\nfunction getMatchesToLoad(\n history: History,\n state: RouterState,\n matches: AgnosticDataRouteMatch[],\n submission: Submission | undefined,\n location: Location,\n isRevalidationRequired: boolean,\n cancelledDeferredRoutes: string[],\n cancelledFetcherLoads: string[],\n fetchLoadMatches: Map,\n fetchRedirectIds: Set,\n routesToUse: AgnosticDataRouteObject[],\n basename: string | undefined,\n pendingActionData?: RouteData,\n pendingError?: RouteData\n): [AgnosticDataRouteMatch[], RevalidatingFetcher[]] {\n let actionResult = pendingError\n ? Object.values(pendingError)[0]\n : pendingActionData\n ? Object.values(pendingActionData)[0]\n : undefined;\n\n let currentUrl = history.createURL(state.location);\n let nextUrl = history.createURL(location);\n\n // Pick navigation matches that are net-new or qualify for revalidation\n let boundaryId = pendingError ? Object.keys(pendingError)[0] : undefined;\n let boundaryMatches = getLoaderMatchesUntilBoundary(matches, boundaryId);\n\n let navigationMatches = boundaryMatches.filter((match, index) => {\n if (match.route.lazy) {\n // We haven't loaded this route yet so we don't know if it's got a loader!\n return true;\n }\n if (match.route.loader == null) {\n return false;\n }\n\n // Always call the loader on new route instances and pending defer cancellations\n if (\n isNewLoader(state.loaderData, state.matches[index], match) ||\n cancelledDeferredRoutes.some((id) => id === match.route.id)\n ) {\n return true;\n }\n\n // This is the default implementation for when we revalidate. If the route\n // provides it's own implementation, then we give them full control but\n // provide this value so they can leverage it if needed after they check\n // their own specific use cases\n let currentRouteMatch = state.matches[index];\n let nextRouteMatch = match;\n\n return shouldRevalidateLoader(match, {\n currentUrl,\n currentParams: currentRouteMatch.params,\n nextUrl,\n nextParams: nextRouteMatch.params,\n ...submission,\n actionResult,\n defaultShouldRevalidate:\n // Forced revalidation due to submission, useRevalidator, or X-Remix-Revalidate\n isRevalidationRequired ||\n // Clicked the same link, resubmitted a GET form\n currentUrl.pathname + currentUrl.search ===\n nextUrl.pathname + nextUrl.search ||\n // Search params affect all loaders\n currentUrl.search !== nextUrl.search ||\n isNewRouteInstance(currentRouteMatch, nextRouteMatch),\n });\n });\n\n // Pick fetcher.loads that need to be revalidated\n let revalidatingFetchers: RevalidatingFetcher[] = [];\n fetchLoadMatches.forEach((f, key) => {\n // Don't revalidate if fetcher won't be present in the subsequent render\n if (!matches.some((m) => m.route.id === f.routeId)) {\n return;\n }\n\n let fetcherMatches = matchRoutes(routesToUse, f.path, basename);\n\n // If the fetcher path no longer matches, push it in with null matches so\n // we can trigger a 404 in callLoadersAndMaybeResolveData. Note this is\n // currently only a use-case for Remix HMR where the route tree can change\n // at runtime and remove a route previously loaded via a fetcher\n if (!fetcherMatches) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: null,\n match: null,\n controller: null,\n });\n return;\n }\n\n // Revalidating fetchers are decoupled from the route matches since they\n // load from a static href. They revalidate based on explicit revalidation\n // (submission, useRevalidator, or X-Remix-Revalidate)\n let fetcher = state.fetchers.get(key);\n let fetcherMatch = getTargetMatch(fetcherMatches, f.path);\n\n let shouldRevalidate = false;\n if (fetchRedirectIds.has(key)) {\n // Never trigger a revalidation of an actively redirecting fetcher\n shouldRevalidate = false;\n } else if (cancelledFetcherLoads.includes(key)) {\n // Always revalidate if the fetcher was cancelled\n shouldRevalidate = true;\n } else if (\n fetcher &&\n fetcher.state !== \"idle\" &&\n fetcher.data === undefined\n ) {\n // If the fetcher hasn't ever completed loading yet, then this isn't a\n // revalidation, it would just be a brand new load if an explicit\n // revalidation is required\n shouldRevalidate = isRevalidationRequired;\n } else {\n // Otherwise fall back on any user-defined shouldRevalidate, defaulting\n // to explicit revalidations only\n shouldRevalidate = shouldRevalidateLoader(fetcherMatch, {\n currentUrl,\n currentParams: state.matches[state.matches.length - 1].params,\n nextUrl,\n nextParams: matches[matches.length - 1].params,\n ...submission,\n actionResult,\n defaultShouldRevalidate: isRevalidationRequired,\n });\n }\n\n if (shouldRevalidate) {\n revalidatingFetchers.push({\n key,\n routeId: f.routeId,\n path: f.path,\n matches: fetcherMatches,\n match: fetcherMatch,\n controller: new AbortController(),\n });\n }\n });\n\n return [navigationMatches, revalidatingFetchers];\n}\n\nfunction isNewLoader(\n currentLoaderData: RouteData,\n currentMatch: AgnosticDataRouteMatch,\n match: AgnosticDataRouteMatch\n) {\n let isNew =\n // [a] -> [a, b]\n !currentMatch ||\n // [a, b] -> [a, c]\n match.route.id !== currentMatch.route.id;\n\n // Handle the case that we don't have data for a re-used route, potentially\n // from a prior error or from a cancelled pending deferred\n let isMissingData = currentLoaderData[match.route.id] === undefined;\n\n // Always load if this is a net-new route or we don't yet have data\n return isNew || isMissingData;\n}\n\nfunction isNewRouteInstance(\n currentMatch: AgnosticDataRouteMatch,\n match: AgnosticDataRouteMatch\n) {\n let currentPath = currentMatch.route.path;\n return (\n // param change for this match, /users/123 -> /users/456\n currentMatch.pathname !== match.pathname ||\n // splat param changed, which is not present in match.path\n // e.g. /files/images/avatar.jpg -> files/finances.xls\n (currentPath != null &&\n currentPath.endsWith(\"*\") &&\n currentMatch.params[\"*\"] !== match.params[\"*\"])\n );\n}\n\nfunction shouldRevalidateLoader(\n loaderMatch: AgnosticDataRouteMatch,\n arg: Parameters[0]\n) {\n if (loaderMatch.route.shouldRevalidate) {\n let routeChoice = loaderMatch.route.shouldRevalidate(arg);\n if (typeof routeChoice === \"boolean\") {\n return routeChoice;\n }\n }\n\n return arg.defaultShouldRevalidate;\n}\n\n/**\n * Execute route.lazy() methods to lazily load route modules (loader, action,\n * shouldRevalidate) and update the routeManifest in place which shares objects\n * with dataRoutes so those get updated as well.\n */\nasync function loadLazyRouteModule(\n route: AgnosticDataRouteObject,\n mapRouteProperties: MapRoutePropertiesFunction,\n manifest: RouteManifest\n) {\n if (!route.lazy) {\n return;\n }\n\n let lazyRoute = await route.lazy();\n\n // If the lazy route function was executed and removed by another parallel\n // call then we can return - first lazy() to finish wins because the return\n // value of lazy is expected to be static\n if (!route.lazy) {\n return;\n }\n\n let routeToUpdate = manifest[route.id];\n invariant(routeToUpdate, \"No route found in manifest\");\n\n // Update the route in place. This should be safe because there's no way\n // we could yet be sitting on this route as we can't get there without\n // resolving lazy() first.\n //\n // This is different than the HMR \"update\" use-case where we may actively be\n // on the route being updated. The main concern boils down to \"does this\n // mutation affect any ongoing navigations or any current state.matches\n // values?\". If not, it should be safe to update in place.\n let routeUpdates: Record = {};\n for (let lazyRouteProperty in lazyRoute) {\n let staticRouteValue =\n routeToUpdate[lazyRouteProperty as keyof typeof routeToUpdate];\n\n let isPropertyStaticallyDefined =\n staticRouteValue !== undefined &&\n // This property isn't static since it should always be updated based\n // on the route updates\n lazyRouteProperty !== \"hasErrorBoundary\";\n\n warning(\n !isPropertyStaticallyDefined,\n `Route \"${routeToUpdate.id}\" has a static property \"${lazyRouteProperty}\" ` +\n `defined but its lazy function is also returning a value for this property. ` +\n `The lazy route property \"${lazyRouteProperty}\" will be ignored.`\n );\n\n if (\n !isPropertyStaticallyDefined &&\n !immutableRouteKeys.has(lazyRouteProperty as ImmutableRouteKey)\n ) {\n routeUpdates[lazyRouteProperty] =\n lazyRoute[lazyRouteProperty as keyof typeof lazyRoute];\n }\n }\n\n // Mutate the route with the provided updates. Do this first so we pass\n // the updated version to mapRouteProperties\n Object.assign(routeToUpdate, routeUpdates);\n\n // Mutate the `hasErrorBoundary` property on the route based on the route\n // updates and remove the `lazy` function so we don't resolve the lazy\n // route again.\n Object.assign(routeToUpdate, {\n // To keep things framework agnostic, we use the provided\n // `mapRouteProperties` (or wrapped `detectErrorBoundary`) function to\n // set the framework-aware properties (`element`/`hasErrorBoundary`) since\n // the logic will differ between frameworks.\n ...mapRouteProperties(routeToUpdate),\n lazy: undefined,\n });\n}\n\nasync function callLoaderOrAction(\n type: \"loader\" | \"action\",\n request: Request,\n match: AgnosticDataRouteMatch,\n matches: AgnosticDataRouteMatch[],\n manifest: RouteManifest,\n mapRouteProperties: MapRoutePropertiesFunction,\n basename: string,\n opts: {\n isStaticRequest?: boolean;\n isRouteRequest?: boolean;\n requestContext?: unknown;\n } = {}\n): Promise {\n let resultType;\n let result;\n let onReject: (() => void) | undefined;\n\n let runHandler = (handler: ActionFunction | LoaderFunction) => {\n // Setup a promise we can race against so that abort signals short circuit\n let reject: () => void;\n let abortPromise = new Promise((_, r) => (reject = r));\n onReject = () => reject();\n request.signal.addEventListener(\"abort\", onReject);\n return Promise.race([\n handler({\n request,\n params: match.params,\n context: opts.requestContext,\n }),\n abortPromise,\n ]);\n };\n\n try {\n let handler = match.route[type];\n\n if (match.route.lazy) {\n if (handler) {\n // Run statically defined handler in parallel with lazy()\n let values = await Promise.all([\n runHandler(handler),\n loadLazyRouteModule(match.route, mapRouteProperties, manifest),\n ]);\n result = values[0];\n } else {\n // Load lazy route module, then run any returned handler\n await loadLazyRouteModule(match.route, mapRouteProperties, manifest);\n\n handler = match.route[type];\n if (handler) {\n // Handler still run even if we got interrupted to maintain consistency\n // with un-abortable behavior of handler execution on non-lazy or\n // previously-lazy-loaded routes\n result = await runHandler(handler);\n } else if (type === \"action\") {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(405, {\n method: request.method,\n pathname,\n routeId: match.route.id,\n });\n } else {\n // lazy() route has no loader to run. Short circuit here so we don't\n // hit the invariant below that errors on returning undefined.\n return { type: ResultType.data, data: undefined };\n }\n }\n } else if (!handler) {\n let url = new URL(request.url);\n let pathname = url.pathname + url.search;\n throw getInternalRouterError(404, {\n pathname,\n });\n } else {\n result = await runHandler(handler);\n }\n\n invariant(\n result !== undefined,\n `You defined ${type === \"action\" ? \"an action\" : \"a loader\"} for route ` +\n `\"${match.route.id}\" but didn't return anything from your \\`${type}\\` ` +\n `function. Please return a value or \\`null\\`.`\n );\n } catch (e) {\n resultType = ResultType.error;\n result = e;\n } finally {\n if (onReject) {\n request.signal.removeEventListener(\"abort\", onReject);\n }\n }\n\n if (isResponse(result)) {\n let status = result.status;\n\n // Process redirects\n if (redirectStatusCodes.has(status)) {\n let location = result.headers.get(\"Location\");\n invariant(\n location,\n \"Redirects returned/thrown from loaders/actions must have a Location header\"\n );\n\n // Support relative routing in internal redirects\n if (!ABSOLUTE_URL_REGEX.test(location)) {\n location = normalizeTo(\n new URL(request.url),\n matches.slice(0, matches.indexOf(match) + 1),\n basename,\n true,\n location\n );\n } else if (!opts.isStaticRequest) {\n // Strip off the protocol+origin for same-origin + same-basename absolute\n // redirects. If this is a static request, we can let it go back to the\n // browser as-is\n let currentUrl = new URL(request.url);\n let url = location.startsWith(\"//\")\n ? new URL(currentUrl.protocol + location)\n : new URL(location);\n let isSameBasename = stripBasename(url.pathname, basename) != null;\n if (url.origin === currentUrl.origin && isSameBasename) {\n location = url.pathname + url.search + url.hash;\n }\n }\n\n // Don't process redirects in the router during static requests requests.\n // Instead, throw the Response and let the server handle it with an HTTP\n // redirect. We also update the Location header in place in this flow so\n // basename and relative routing is taken into account\n if (opts.isStaticRequest) {\n result.headers.set(\"Location\", location);\n throw result;\n }\n\n return {\n type: ResultType.redirect,\n status,\n location,\n revalidate: result.headers.get(\"X-Remix-Revalidate\") !== null,\n reloadDocument: result.headers.get(\"X-Remix-Reload-Document\") !== null,\n };\n }\n\n // For SSR single-route requests, we want to hand Responses back directly\n // without unwrapping. We do this with the QueryRouteResponse wrapper\n // interface so we can know whether it was returned or thrown\n if (opts.isRouteRequest) {\n let queryRouteResponse: QueryRouteResponse = {\n type:\n resultType === ResultType.error ? ResultType.error : ResultType.data,\n response: result,\n };\n throw queryRouteResponse;\n }\n\n let data: any;\n let contentType = result.headers.get(\"Content-Type\");\n // Check between word boundaries instead of startsWith() due to the last\n // paragraph of https://httpwg.org/specs/rfc9110.html#field.content-type\n if (contentType && /\\bapplication\\/json\\b/.test(contentType)) {\n data = await result.json();\n } else {\n data = await result.text();\n }\n\n if (resultType === ResultType.error) {\n return {\n type: resultType,\n error: new ErrorResponse(status, result.statusText, data),\n headers: result.headers,\n };\n }\n\n return {\n type: ResultType.data,\n data,\n statusCode: result.status,\n headers: result.headers,\n };\n }\n\n if (resultType === ResultType.error) {\n return { type: resultType, error: result };\n }\n\n if (isDeferredData(result)) {\n return {\n type: ResultType.deferred,\n deferredData: result,\n statusCode: result.init?.status,\n headers: result.init?.headers && new Headers(result.init.headers),\n };\n }\n\n return { type: ResultType.data, data: result };\n}\n\n// Utility method for creating the Request instances for loaders/actions during\n// client-side navigations and fetches. During SSR we will always have a\n// Request instance from the static handler (query/queryRoute)\nfunction createClientSideRequest(\n history: History,\n location: string | Location,\n signal: AbortSignal,\n submission?: Submission\n): Request {\n let url = history.createURL(stripHashFromPath(location)).toString();\n let init: RequestInit = { signal };\n\n if (submission && isMutationMethod(submission.formMethod)) {\n let { formMethod, formEncType } = submission;\n // Didn't think we needed this but it turns out unlike other methods, patch\n // won't be properly normalized to uppercase and results in a 405 error.\n // See: https://fetch.spec.whatwg.org/#concept-method\n init.method = formMethod.toUpperCase();\n\n if (formEncType === \"application/json\") {\n init.headers = new Headers({ \"Content-Type\": formEncType });\n init.body = JSON.stringify(submission.json);\n } else if (formEncType === \"text/plain\") {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.text;\n } else if (\n formEncType === \"application/x-www-form-urlencoded\" &&\n submission.formData\n ) {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = convertFormDataToSearchParams(submission.formData);\n } else {\n // Content-Type is inferred (https://fetch.spec.whatwg.org/#dom-request)\n init.body = submission.formData;\n }\n }\n\n return new Request(url, init);\n}\n\nfunction convertFormDataToSearchParams(formData: FormData): URLSearchParams {\n let searchParams = new URLSearchParams();\n\n for (let [key, value] of formData.entries()) {\n // https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#converting-an-entry-list-to-a-list-of-name-value-pairs\n searchParams.append(key, typeof value === \"string\" ? value : value.name);\n }\n\n return searchParams;\n}\n\nfunction convertSearchParamsToFormData(\n searchParams: URLSearchParams\n): FormData {\n let formData = new FormData();\n for (let [key, value] of searchParams.entries()) {\n formData.append(key, value);\n }\n return formData;\n}\n\nfunction processRouteLoaderData(\n matches: AgnosticDataRouteMatch[],\n matchesToLoad: AgnosticDataRouteMatch[],\n results: DataResult[],\n pendingError: RouteData | undefined,\n activeDeferreds: Map\n): {\n loaderData: RouterState[\"loaderData\"];\n errors: RouterState[\"errors\"] | null;\n statusCode: number;\n loaderHeaders: Record;\n} {\n // Fill in loaderData/errors from our loaders\n let loaderData: RouterState[\"loaderData\"] = {};\n let errors: RouterState[\"errors\"] | null = null;\n let statusCode: number | undefined;\n let foundError = false;\n let loaderHeaders: Record = {};\n\n // Process loader results into state.loaderData/state.errors\n results.forEach((result, index) => {\n let id = matchesToLoad[index].route.id;\n invariant(\n !isRedirectResult(result),\n \"Cannot handle redirect results in processLoaderData\"\n );\n if (isErrorResult(result)) {\n // Look upwards from the matched route for the closest ancestor\n // error boundary, defaulting to the root match\n let boundaryMatch = findNearestBoundary(matches, id);\n let error = result.error;\n // If we have a pending action error, we report it at the highest-route\n // that throws a loader error, and then clear it out to indicate that\n // it was consumed\n if (pendingError) {\n error = Object.values(pendingError)[0];\n pendingError = undefined;\n }\n\n errors = errors || {};\n\n // Prefer higher error values if lower errors bubble to the same boundary\n if (errors[boundaryMatch.route.id] == null) {\n errors[boundaryMatch.route.id] = error;\n }\n\n // Clear our any prior loaderData for the throwing route\n loaderData[id] = undefined;\n\n // Once we find our first (highest) error, we set the status code and\n // prevent deeper status codes from overriding\n if (!foundError) {\n foundError = true;\n statusCode = isRouteErrorResponse(result.error)\n ? result.error.status\n : 500;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n } else {\n if (isDeferredResult(result)) {\n activeDeferreds.set(id, result.deferredData);\n loaderData[id] = result.deferredData.data;\n } else {\n loaderData[id] = result.data;\n }\n\n // Error status codes always override success status codes, but if all\n // loaders are successful we take the deepest status code.\n if (\n result.statusCode != null &&\n result.statusCode !== 200 &&\n !foundError\n ) {\n statusCode = result.statusCode;\n }\n if (result.headers) {\n loaderHeaders[id] = result.headers;\n }\n }\n });\n\n // If we didn't consume the pending action error (i.e., all loaders\n // resolved), then consume it here. Also clear out any loaderData for the\n // throwing route\n if (pendingError) {\n errors = pendingError;\n loaderData[Object.keys(pendingError)[0]] = undefined;\n }\n\n return {\n loaderData,\n errors,\n statusCode: statusCode || 200,\n loaderHeaders,\n };\n}\n\nfunction processLoaderData(\n state: RouterState,\n matches: AgnosticDataRouteMatch[],\n matchesToLoad: AgnosticDataRouteMatch[],\n results: DataResult[],\n pendingError: RouteData | undefined,\n revalidatingFetchers: RevalidatingFetcher[],\n fetcherResults: DataResult[],\n activeDeferreds: Map\n): {\n loaderData: RouterState[\"loaderData\"];\n errors?: RouterState[\"errors\"];\n} {\n let { loaderData, errors } = processRouteLoaderData(\n matches,\n matchesToLoad,\n results,\n pendingError,\n activeDeferreds\n );\n\n // Process results from our revalidating fetchers\n for (let index = 0; index < revalidatingFetchers.length; index++) {\n let { key, match, controller } = revalidatingFetchers[index];\n invariant(\n fetcherResults !== undefined && fetcherResults[index] !== undefined,\n \"Did not find corresponding fetcher result\"\n );\n let result = fetcherResults[index];\n\n // Process fetcher non-redirect errors\n if (controller && controller.signal.aborted) {\n // Nothing to do for aborted fetchers\n continue;\n } else if (isErrorResult(result)) {\n let boundaryMatch = findNearestBoundary(state.matches, match?.route.id);\n if (!(errors && errors[boundaryMatch.route.id])) {\n errors = {\n ...errors,\n [boundaryMatch.route.id]: result.error,\n };\n }\n state.fetchers.delete(key);\n } else if (isRedirectResult(result)) {\n // Should never get here, redirects should get processed above, but we\n // keep this to type narrow to a success result in the else\n invariant(false, \"Unhandled fetcher revalidation redirect\");\n } else if (isDeferredResult(result)) {\n // Should never get here, deferred data should be awaited for fetchers\n // in resolveDeferredResults\n invariant(false, \"Unhandled fetcher deferred data\");\n } else {\n let doneFetcher = getDoneFetcher(result.data);\n state.fetchers.set(key, doneFetcher);\n }\n }\n\n return { loaderData, errors };\n}\n\nfunction mergeLoaderData(\n loaderData: RouteData,\n newLoaderData: RouteData,\n matches: AgnosticDataRouteMatch[],\n errors: RouteData | null | undefined\n): RouteData {\n let mergedLoaderData = { ...newLoaderData };\n for (let match of matches) {\n let id = match.route.id;\n if (newLoaderData.hasOwnProperty(id)) {\n if (newLoaderData[id] !== undefined) {\n mergedLoaderData[id] = newLoaderData[id];\n } else {\n // No-op - this is so we ignore existing data if we have a key in the\n // incoming object with an undefined value, which is how we unset a prior\n // loaderData if we encounter a loader error\n }\n } else if (loaderData[id] !== undefined && match.route.loader) {\n // Preserve existing keys not included in newLoaderData and where a loader\n // wasn't removed by HMR\n mergedLoaderData[id] = loaderData[id];\n }\n\n if (errors && errors.hasOwnProperty(id)) {\n // Don't keep any loader data below the boundary\n break;\n }\n }\n return mergedLoaderData;\n}\n\n// Find the nearest error boundary, looking upwards from the leaf route (or the\n// route specified by routeId) for the closest ancestor error boundary,\n// defaulting to the root match\nfunction findNearestBoundary(\n matches: AgnosticDataRouteMatch[],\n routeId?: string\n): AgnosticDataRouteMatch {\n let eligibleMatches = routeId\n ? matches.slice(0, matches.findIndex((m) => m.route.id === routeId) + 1)\n : [...matches];\n return (\n eligibleMatches.reverse().find((m) => m.route.hasErrorBoundary === true) ||\n matches[0]\n );\n}\n\nfunction getShortCircuitMatches(routes: AgnosticDataRouteObject[]): {\n matches: AgnosticDataRouteMatch[];\n route: AgnosticDataRouteObject;\n} {\n // Prefer a root layout route if present, otherwise shim in a route object\n let route = routes.find((r) => r.index || !r.path || r.path === \"/\") || {\n id: `__shim-error-route__`,\n };\n\n return {\n matches: [\n {\n params: {},\n pathname: \"\",\n pathnameBase: \"\",\n route,\n },\n ],\n route,\n };\n}\n\nfunction getInternalRouterError(\n status: number,\n {\n pathname,\n routeId,\n method,\n type,\n }: {\n pathname?: string;\n routeId?: string;\n method?: string;\n type?: \"defer-action\" | \"invalid-body\";\n } = {}\n) {\n let statusText = \"Unknown Server Error\";\n let errorMessage = \"Unknown @remix-run/router error\";\n\n if (status === 400) {\n statusText = \"Bad Request\";\n if (method && pathname && routeId) {\n errorMessage =\n `You made a ${method} request to \"${pathname}\" but ` +\n `did not provide a \\`loader\\` for route \"${routeId}\", ` +\n `so there is no way to handle the request.`;\n } else if (type === \"defer-action\") {\n errorMessage = \"defer() is not supported in actions\";\n } else if (type === \"invalid-body\") {\n errorMessage = \"Unable to encode submission body\";\n }\n } else if (status === 403) {\n statusText = \"Forbidden\";\n errorMessage = `Route \"${routeId}\" does not match URL \"${pathname}\"`;\n } else if (status === 404) {\n statusText = \"Not Found\";\n errorMessage = `No route matches URL \"${pathname}\"`;\n } else if (status === 405) {\n statusText = \"Method Not Allowed\";\n if (method && pathname && routeId) {\n errorMessage =\n `You made a ${method.toUpperCase()} request to \"${pathname}\" but ` +\n `did not provide an \\`action\\` for route \"${routeId}\", ` +\n `so there is no way to handle the request.`;\n } else if (method) {\n errorMessage = `Invalid request method \"${method.toUpperCase()}\"`;\n }\n }\n\n return new ErrorResponse(\n status || 500,\n statusText,\n new Error(errorMessage),\n true\n );\n}\n\n// Find any returned redirect errors, starting from the lowest match\nfunction findRedirect(\n results: DataResult[]\n): { result: RedirectResult; idx: number } | undefined {\n for (let i = results.length - 1; i >= 0; i--) {\n let result = results[i];\n if (isRedirectResult(result)) {\n return { result, idx: i };\n }\n }\n}\n\nfunction stripHashFromPath(path: To) {\n let parsedPath = typeof path === \"string\" ? parsePath(path) : path;\n return createPath({ ...parsedPath, hash: \"\" });\n}\n\nfunction isHashChangeOnly(a: Location, b: Location): boolean {\n if (a.pathname !== b.pathname || a.search !== b.search) {\n return false;\n }\n\n if (a.hash === \"\") {\n // /page -> /page#hash\n return b.hash !== \"\";\n } else if (a.hash === b.hash) {\n // /page#hash -> /page#hash\n return true;\n } else if (b.hash !== \"\") {\n // /page#hash -> /page#other\n return true;\n }\n\n // If the hash is removed the browser will re-perform a request to the server\n // /page#hash -> /page\n return false;\n}\n\nfunction isDeferredResult(result: DataResult): result is DeferredResult {\n return result.type === ResultType.deferred;\n}\n\nfunction isErrorResult(result: DataResult): result is ErrorResult {\n return result.type === ResultType.error;\n}\n\nfunction isRedirectResult(result?: DataResult): result is RedirectResult {\n return (result && result.type) === ResultType.redirect;\n}\n\nexport function isDeferredData(value: any): value is DeferredData {\n let deferred: DeferredData = value;\n return (\n deferred &&\n typeof deferred === \"object\" &&\n typeof deferred.data === \"object\" &&\n typeof deferred.subscribe === \"function\" &&\n typeof deferred.cancel === \"function\" &&\n typeof deferred.resolveData === \"function\"\n );\n}\n\nfunction isResponse(value: any): value is Response {\n return (\n value != null &&\n typeof value.status === \"number\" &&\n typeof value.statusText === \"string\" &&\n typeof value.headers === \"object\" &&\n typeof value.body !== \"undefined\"\n );\n}\n\nfunction isRedirectResponse(result: any): result is Response {\n if (!isResponse(result)) {\n return false;\n }\n\n let status = result.status;\n let location = result.headers.get(\"Location\");\n return status >= 300 && status <= 399 && location != null;\n}\n\nfunction isQueryRouteResponse(obj: any): obj is QueryRouteResponse {\n return (\n obj &&\n isResponse(obj.response) &&\n (obj.type === ResultType.data || obj.type === ResultType.error)\n );\n}\n\nfunction isValidMethod(method: string): method is FormMethod | V7_FormMethod {\n return validRequestMethods.has(method.toLowerCase() as FormMethod);\n}\n\nfunction isMutationMethod(\n method: string\n): method is MutationFormMethod | V7_MutationFormMethod {\n return validMutationMethods.has(method.toLowerCase() as MutationFormMethod);\n}\n\nasync function resolveDeferredResults(\n currentMatches: AgnosticDataRouteMatch[],\n matchesToLoad: (AgnosticDataRouteMatch | null)[],\n results: DataResult[],\n signals: (AbortSignal | null)[],\n isFetcher: boolean,\n currentLoaderData?: RouteData\n) {\n for (let index = 0; index < results.length; index++) {\n let result = results[index];\n let match = matchesToLoad[index];\n // If we don't have a match, then we can have a deferred result to do\n // anything with. This is for revalidating fetchers where the route was\n // removed during HMR\n if (!match) {\n continue;\n }\n\n let currentMatch = currentMatches.find(\n (m) => m.route.id === match!.route.id\n );\n let isRevalidatingLoader =\n currentMatch != null &&\n !isNewRouteInstance(currentMatch, match) &&\n (currentLoaderData && currentLoaderData[match.route.id]) !== undefined;\n\n if (isDeferredResult(result) && (isFetcher || isRevalidatingLoader)) {\n // Note: we do not have to touch activeDeferreds here since we race them\n // against the signal in resolveDeferredData and they'll get aborted\n // there if needed\n let signal = signals[index];\n invariant(\n signal,\n \"Expected an AbortSignal for revalidating fetcher deferred result\"\n );\n await resolveDeferredData(result, signal, isFetcher).then((result) => {\n if (result) {\n results[index] = result || results[index];\n }\n });\n }\n }\n}\n\nasync function resolveDeferredData(\n result: DeferredResult,\n signal: AbortSignal,\n unwrap = false\n): Promise {\n let aborted = await result.deferredData.resolveData(signal);\n if (aborted) {\n return;\n }\n\n if (unwrap) {\n try {\n return {\n type: ResultType.data,\n data: result.deferredData.unwrappedData,\n };\n } catch (e) {\n // Handle any TrackedPromise._error values encountered while unwrapping\n return {\n type: ResultType.error,\n error: e,\n };\n }\n }\n\n return {\n type: ResultType.data,\n data: result.deferredData.data,\n };\n}\n\nfunction hasNakedIndexQuery(search: string): boolean {\n return new URLSearchParams(search).getAll(\"index\").some((v) => v === \"\");\n}\n\n// Note: This should match the format exported by useMatches, so if you change\n// this please also change that :) Eventually we'll DRY this up\nfunction createUseMatchesMatch(\n match: AgnosticDataRouteMatch,\n loaderData: RouteData\n): UseMatchesMatch {\n let { route, pathname, params } = match;\n return {\n id: route.id,\n pathname,\n params,\n data: loaderData[route.id] as unknown,\n handle: route.handle as unknown,\n };\n}\n\nfunction getTargetMatch(\n matches: AgnosticDataRouteMatch[],\n location: Location | string\n) {\n let search =\n typeof location === \"string\" ? parsePath(location).search : location.search;\n if (\n matches[matches.length - 1].route.index &&\n hasNakedIndexQuery(search || \"\")\n ) {\n // Return the leaf index route when index is present\n return matches[matches.length - 1];\n }\n // Otherwise grab the deepest \"path contributing\" match (ignoring index and\n // pathless layout routes)\n let pathMatches = getPathContributingMatches(matches);\n return pathMatches[pathMatches.length - 1];\n}\n\nfunction getSubmissionFromNavigation(\n navigation: Navigation\n): Submission | undefined {\n let { formMethod, formAction, formEncType, text, formData, json } =\n navigation;\n if (!formMethod || !formAction || !formEncType) {\n return;\n }\n\n if (text != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json: undefined,\n text,\n };\n } else if (formData != null) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData,\n json: undefined,\n text: undefined,\n };\n } else if (json !== undefined) {\n return {\n formMethod,\n formAction,\n formEncType,\n formData: undefined,\n json,\n text: undefined,\n };\n }\n}\n\nfunction getLoadingNavigation(\n location: Location,\n submission?: Submission\n): NavigationStates[\"Loading\"] {\n if (submission) {\n let navigation: NavigationStates[\"Loading\"] = {\n state: \"loading\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n };\n return navigation;\n } else {\n let navigation: NavigationStates[\"Loading\"] = {\n state: \"loading\",\n location,\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n };\n return navigation;\n }\n}\n\nfunction getSubmittingNavigation(\n location: Location,\n submission: Submission\n): NavigationStates[\"Submitting\"] {\n let navigation: NavigationStates[\"Submitting\"] = {\n state: \"submitting\",\n location,\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n };\n return navigation;\n}\n\nfunction getLoadingFetcher(\n submission?: Submission,\n data?: Fetcher[\"data\"]\n): FetcherStates[\"Loading\"] {\n if (submission) {\n let fetcher: FetcherStates[\"Loading\"] = {\n state: \"loading\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data,\n \" _hasFetcherDoneAnything \": true,\n };\n return fetcher;\n } else {\n let fetcher: FetcherStates[\"Loading\"] = {\n state: \"loading\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data,\n \" _hasFetcherDoneAnything \": true,\n };\n return fetcher;\n }\n}\n\nfunction getSubmittingFetcher(\n submission: Submission,\n existingFetcher?: Fetcher\n): FetcherStates[\"Submitting\"] {\n let fetcher: FetcherStates[\"Submitting\"] = {\n state: \"submitting\",\n formMethod: submission.formMethod,\n formAction: submission.formAction,\n formEncType: submission.formEncType,\n formData: submission.formData,\n json: submission.json,\n text: submission.text,\n data: existingFetcher ? existingFetcher.data : undefined,\n \" _hasFetcherDoneAnything \": true,\n };\n return fetcher;\n}\n\nfunction getDoneFetcher(data: Fetcher[\"data\"]): FetcherStates[\"Idle\"] {\n let fetcher: FetcherStates[\"Idle\"] = {\n state: \"idle\",\n formMethod: undefined,\n formAction: undefined,\n formEncType: undefined,\n formData: undefined,\n json: undefined,\n text: undefined,\n data,\n \" _hasFetcherDoneAnything \": true,\n };\n return fetcher;\n}\n//#endregion\n", "import * as React from \"react\";\nimport type {\n AgnosticRouteMatch,\n AgnosticIndexRouteObject,\n AgnosticNonIndexRouteObject,\n History,\n Location,\n RelativeRoutingType,\n Router,\n StaticHandlerContext,\n To,\n TrackedPromise,\n LazyRouteFunction,\n} from \"@remix-run/router\";\nimport type { Action as NavigationType } from \"@remix-run/router\";\n\n// Create react-specific types from the agnostic types in @remix-run/router to\n// export from react-router\nexport interface IndexRouteObject {\n caseSensitive?: AgnosticIndexRouteObject[\"caseSensitive\"];\n path?: AgnosticIndexRouteObject[\"path\"];\n id?: AgnosticIndexRouteObject[\"id\"];\n loader?: AgnosticIndexRouteObject[\"loader\"];\n action?: AgnosticIndexRouteObject[\"action\"];\n hasErrorBoundary?: AgnosticIndexRouteObject[\"hasErrorBoundary\"];\n shouldRevalidate?: AgnosticIndexRouteObject[\"shouldRevalidate\"];\n handle?: AgnosticIndexRouteObject[\"handle\"];\n index: true;\n children?: undefined;\n element?: React.ReactNode | null;\n errorElement?: React.ReactNode | null;\n Component?: React.ComponentType | null;\n ErrorBoundary?: React.ComponentType | null;\n lazy?: LazyRouteFunction;\n}\n\nexport interface NonIndexRouteObject {\n caseSensitive?: AgnosticNonIndexRouteObject[\"caseSensitive\"];\n path?: AgnosticNonIndexRouteObject[\"path\"];\n id?: AgnosticNonIndexRouteObject[\"id\"];\n loader?: AgnosticNonIndexRouteObject[\"loader\"];\n action?: AgnosticNonIndexRouteObject[\"action\"];\n hasErrorBoundary?: AgnosticNonIndexRouteObject[\"hasErrorBoundary\"];\n shouldRevalidate?: AgnosticNonIndexRouteObject[\"shouldRevalidate\"];\n handle?: AgnosticNonIndexRouteObject[\"handle\"];\n index?: false;\n children?: RouteObject[];\n element?: React.ReactNode | null;\n errorElement?: React.ReactNode | null;\n Component?: React.ComponentType | null;\n ErrorBoundary?: React.ComponentType | null;\n lazy?: LazyRouteFunction;\n}\n\nexport type RouteObject = IndexRouteObject | NonIndexRouteObject;\n\nexport type DataRouteObject = RouteObject & {\n children?: DataRouteObject[];\n id: string;\n};\n\nexport interface RouteMatch<\n ParamKey extends string = string,\n RouteObjectType extends RouteObject = RouteObject\n> extends AgnosticRouteMatch {}\n\nexport interface DataRouteMatch extends RouteMatch {}\n\nexport interface DataRouterContextObject extends NavigationContextObject {\n router: Router;\n staticContext?: StaticHandlerContext;\n}\n\nexport const DataRouterContext =\n React.createContext(null);\nif (__DEV__) {\n DataRouterContext.displayName = \"DataRouter\";\n}\n\nexport const DataRouterStateContext = React.createContext<\n Router[\"state\"] | null\n>(null);\nif (__DEV__) {\n DataRouterStateContext.displayName = \"DataRouterState\";\n}\n\nexport const AwaitContext = React.createContext(null);\nif (__DEV__) {\n AwaitContext.displayName = \"Await\";\n}\n\nexport interface NavigateOptions {\n replace?: boolean;\n state?: any;\n preventScrollReset?: boolean;\n relative?: RelativeRoutingType;\n}\n\n/**\n * A Navigator is a \"location changer\"; it's how you get to different locations.\n *\n * Every history instance conforms to the Navigator interface, but the\n * distinction is useful primarily when it comes to the low-level API\n * where both the location and a navigator must be provided separately in order\n * to avoid \"tearing\" that may occur in a suspense-enabled app if the action\n * and/or location were to be read directly from the history instance.\n */\nexport interface Navigator {\n createHref: History[\"createHref\"];\n // Optional for backwards-compat with Router/HistoryRouter usage (edge case)\n encodeLocation?: History[\"encodeLocation\"];\n go: History[\"go\"];\n push(to: To, state?: any, opts?: NavigateOptions): void;\n replace(to: To, state?: any, opts?: NavigateOptions): void;\n}\n\ninterface NavigationContextObject {\n basename: string;\n navigator: Navigator;\n static: boolean;\n}\n\nexport const NavigationContext = React.createContext(\n null!\n);\n\nif (__DEV__) {\n NavigationContext.displayName = \"Navigation\";\n}\n\ninterface LocationContextObject {\n location: Location;\n navigationType: NavigationType;\n}\n\nexport const LocationContext = React.createContext(\n null!\n);\n\nif (__DEV__) {\n LocationContext.displayName = \"Location\";\n}\n\nexport interface RouteContextObject {\n outlet: React.ReactElement | null;\n matches: RouteMatch[];\n isDataRoute: boolean;\n}\n\nexport const RouteContext = React.createContext({\n outlet: null,\n matches: [],\n isDataRoute: false,\n});\n\nif (__DEV__) {\n RouteContext.displayName = \"Route\";\n}\n\nexport const RouteErrorContext = React.createContext(null);\n\nif (__DEV__) {\n RouteErrorContext.displayName = \"RouteError\";\n}\n", "import * as React from \"react\";\nimport type {\n Blocker,\n BlockerFunction,\n Location,\n ParamParseKey,\n Params,\n Path,\n PathMatch,\n PathPattern,\n RelativeRoutingType,\n Router as RemixRouter,\n RevalidationState,\n To,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n UNSAFE_invariant as invariant,\n isRouteErrorResponse,\n joinPaths,\n matchPath,\n matchRoutes,\n parsePath,\n resolveTo,\n stripBasename,\n IDLE_BLOCKER,\n UNSAFE_getPathContributingMatches as getPathContributingMatches,\n UNSAFE_warning as warning,\n} from \"@remix-run/router\";\n\nimport type {\n NavigateOptions,\n RouteContextObject,\n RouteMatch,\n RouteObject,\n DataRouteMatch,\n} from \"./context\";\nimport {\n DataRouterContext,\n DataRouterStateContext,\n LocationContext,\n NavigationContext,\n RouteContext,\n RouteErrorContext,\n AwaitContext,\n} from \"./context\";\n\n/**\n * Returns the full href for the given \"to\" value. This is useful for building\n * custom links that are also accessible and preserve right-click behavior.\n *\n * @see https://reactrouter.com/hooks/use-href\n */\nexport function useHref(\n to: To,\n { relative }: { relative?: RelativeRoutingType } = {}\n): string {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useHref() may be used only in the context of a component.`\n );\n\n let { basename, navigator } = React.useContext(NavigationContext);\n let { hash, pathname, search } = useResolvedPath(to, { relative });\n\n let joinedPathname = pathname;\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to creating the href. If this is a root navigation, then just use the raw\n // basename which allows the basename to have full control over the presence\n // of a trailing slash on root links\n if (basename !== \"/\") {\n joinedPathname =\n pathname === \"/\" ? basename : joinPaths([basename, pathname]);\n }\n\n return navigator.createHref({ pathname: joinedPathname, search, hash });\n}\n\n/**\n * Returns true if this component is a descendant of a .\n *\n * @see https://reactrouter.com/hooks/use-in-router-context\n */\nexport function useInRouterContext(): boolean {\n return React.useContext(LocationContext) != null;\n}\n\n/**\n * Returns the current location object, which represents the current URL in web\n * browsers.\n *\n * Note: If you're using this it may mean you're doing some of your own\n * \"routing\" in your app, and we'd like to know what your use case is. We may\n * be able to provide something higher-level to better suit your needs.\n *\n * @see https://reactrouter.com/hooks/use-location\n */\nexport function useLocation(): Location {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useLocation() may be used only in the context of a component.`\n );\n\n return React.useContext(LocationContext).location;\n}\n\n/**\n * Returns the current navigation action which describes how the router came to\n * the current location, either by a pop, push, or replace on the history stack.\n *\n * @see https://reactrouter.com/hooks/use-navigation-type\n */\nexport function useNavigationType(): NavigationType {\n return React.useContext(LocationContext).navigationType;\n}\n\n/**\n * Returns a PathMatch object if the given pattern matches the current URL.\n * This is useful for components that need to know \"active\" state, e.g.\n * .\n *\n * @see https://reactrouter.com/hooks/use-match\n */\nexport function useMatch<\n ParamKey extends ParamParseKey,\n Path extends string\n>(pattern: PathPattern | Path): PathMatch | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useMatch() may be used only in the context of a component.`\n );\n\n let { pathname } = useLocation();\n return React.useMemo(\n () => matchPath(pattern, pathname),\n [pathname, pattern]\n );\n}\n\n/**\n * The interface for the navigate() function returned from useNavigate().\n */\nexport interface NavigateFunction {\n (to: To, options?: NavigateOptions): void;\n (delta: number): void;\n}\n\nconst navigateEffectWarning =\n `You should call navigate() in a React.useEffect(), not when ` +\n `your component is first rendered.`;\n\n// Mute warnings for calls to useNavigate in SSR environments\nfunction useIsomorphicLayoutEffect(\n cb: Parameters[0]\n) {\n let isStatic = React.useContext(NavigationContext).static;\n if (!isStatic) {\n // We should be able to get rid of this once react 18.3 is released\n // See: https://github.com/facebook/react/pull/26395\n // eslint-disable-next-line react-hooks/rules-of-hooks\n React.useLayoutEffect(cb);\n }\n}\n\n/**\n * Returns an imperative method for changing the location. Used by s, but\n * may also be used by other elements to change the location.\n *\n * @see https://reactrouter.com/hooks/use-navigate\n */\nexport function useNavigate(): NavigateFunction {\n let { isDataRoute } = React.useContext(RouteContext);\n // Conditional usage is OK here because the usage of a data router is static\n // eslint-disable-next-line react-hooks/rules-of-hooks\n return isDataRoute ? useNavigateStable() : useNavigateUnstable();\n}\n\nfunction useNavigateUnstable(): NavigateFunction {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useNavigate() may be used only in the context of a component.`\n );\n\n let dataRouterContext = React.useContext(DataRouterContext);\n let { basename, navigator } = React.useContext(NavigationContext);\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n getPathContributingMatches(matches).map((match) => match.pathnameBase)\n );\n\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n\n let navigate: NavigateFunction = React.useCallback(\n (to: To | number, options: NavigateOptions = {}) => {\n warning(activeRef.current, navigateEffectWarning);\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our history listener yet\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n navigator.go(to);\n return;\n }\n\n let path = resolveTo(\n to,\n JSON.parse(routePathnamesJson),\n locationPathname,\n options.relative === \"path\"\n );\n\n // If we're operating within a basename, prepend it to the pathname prior\n // to handing off to history (but only if we're not in a data router,\n // otherwise it'll prepend the basename inside of the router).\n // If this is a root navigation, then we navigate to the raw basename\n // which allows the basename to have full control over the presence of a\n // trailing slash on root links\n if (dataRouterContext == null && basename !== \"/\") {\n path.pathname =\n path.pathname === \"/\"\n ? basename\n : joinPaths([basename, path.pathname]);\n }\n\n (!!options.replace ? navigator.replace : navigator.push)(\n path,\n options.state,\n options\n );\n },\n [\n basename,\n navigator,\n routePathnamesJson,\n locationPathname,\n dataRouterContext,\n ]\n );\n\n return navigate;\n}\n\nconst OutletContext = React.createContext(null);\n\n/**\n * Returns the context (if provided) for the child route at this level of the route\n * hierarchy.\n * @see https://reactrouter.com/hooks/use-outlet-context\n */\nexport function useOutletContext(): Context {\n return React.useContext(OutletContext) as Context;\n}\n\n/**\n * Returns the element for the child route at this level of the route\n * hierarchy. Used internally by to render child routes.\n *\n * @see https://reactrouter.com/hooks/use-outlet\n */\nexport function useOutlet(context?: unknown): React.ReactElement | null {\n let outlet = React.useContext(RouteContext).outlet;\n if (outlet) {\n return (\n {outlet}\n );\n }\n return outlet;\n}\n\n/**\n * Returns an object of key/value pairs of the dynamic params from the current\n * URL that were matched by the route path.\n *\n * @see https://reactrouter.com/hooks/use-params\n */\nexport function useParams<\n ParamsOrKey extends string | Record = string\n>(): Readonly<\n [ParamsOrKey] extends [string] ? Params : Partial\n> {\n let { matches } = React.useContext(RouteContext);\n let routeMatch = matches[matches.length - 1];\n return routeMatch ? (routeMatch.params as any) : {};\n}\n\n/**\n * Resolves the pathname of the given `to` value against the current location.\n *\n * @see https://reactrouter.com/hooks/use-resolved-path\n */\nexport function useResolvedPath(\n to: To,\n { relative }: { relative?: RelativeRoutingType } = {}\n): Path {\n let { matches } = React.useContext(RouteContext);\n let { pathname: locationPathname } = useLocation();\n\n let routePathnamesJson = JSON.stringify(\n getPathContributingMatches(matches).map((match) => match.pathnameBase)\n );\n\n return React.useMemo(\n () =>\n resolveTo(\n to,\n JSON.parse(routePathnamesJson),\n locationPathname,\n relative === \"path\"\n ),\n [to, routePathnamesJson, locationPathname, relative]\n );\n}\n\n/**\n * Returns the element of the route that matched the current location, prepared\n * with the correct context to render the remainder of the route tree. Route\n * elements in the tree must render an to render their child route's\n * element.\n *\n * @see https://reactrouter.com/hooks/use-routes\n */\nexport function useRoutes(\n routes: RouteObject[],\n locationArg?: Partial | string\n): React.ReactElement | null {\n return useRoutesImpl(routes, locationArg);\n}\n\n// Internal implementation with accept optional param for RouterProvider usage\nexport function useRoutesImpl(\n routes: RouteObject[],\n locationArg?: Partial | string,\n dataRouterState?: RemixRouter[\"state\"]\n): React.ReactElement | null {\n invariant(\n useInRouterContext(),\n // TODO: This error is probably because they somehow have 2 versions of the\n // router loaded. We can help them understand how to avoid that.\n `useRoutes() may be used only in the context of a component.`\n );\n\n let { navigator } = React.useContext(NavigationContext);\n let { matches: parentMatches } = React.useContext(RouteContext);\n let routeMatch = parentMatches[parentMatches.length - 1];\n let parentParams = routeMatch ? routeMatch.params : {};\n let parentPathname = routeMatch ? routeMatch.pathname : \"/\";\n let parentPathnameBase = routeMatch ? routeMatch.pathnameBase : \"/\";\n let parentRoute = routeMatch && routeMatch.route;\n\n if (__DEV__) {\n // You won't get a warning about 2 different under a \n // without a trailing *, but this is a best-effort warning anyway since we\n // cannot even give the warning unless they land at the parent route.\n //\n // Example:\n //\n // \n // {/* This route path MUST end with /* because otherwise\n // it will never match /blog/post/123 */}\n // } />\n // } />\n // \n //\n // function Blog() {\n // return (\n // \n // } />\n // \n // );\n // }\n let parentPath = (parentRoute && parentRoute.path) || \"\";\n warningOnce(\n parentPathname,\n !parentRoute || parentPath.endsWith(\"*\"),\n `You rendered descendant (or called \\`useRoutes()\\`) at ` +\n `\"${parentPathname}\" (under ) but the ` +\n `parent route path has no trailing \"*\". This means if you navigate ` +\n `deeper, the parent won't match anymore and therefore the child ` +\n `routes will never render.\\n\\n` +\n `Please change the parent to .`\n );\n }\n\n let locationFromContext = useLocation();\n\n let location;\n if (locationArg) {\n let parsedLocationArg =\n typeof locationArg === \"string\" ? parsePath(locationArg) : locationArg;\n\n invariant(\n parentPathnameBase === \"/\" ||\n parsedLocationArg.pathname?.startsWith(parentPathnameBase),\n `When overriding the location using \\`\\` or \\`useRoutes(routes, location)\\`, ` +\n `the location pathname must begin with the portion of the URL pathname that was ` +\n `matched by all parent routes. The current pathname base is \"${parentPathnameBase}\" ` +\n `but pathname \"${parsedLocationArg.pathname}\" was given in the \\`location\\` prop.`\n );\n\n location = parsedLocationArg;\n } else {\n location = locationFromContext;\n }\n\n let pathname = location.pathname || \"/\";\n let remainingPathname =\n parentPathnameBase === \"/\"\n ? pathname\n : pathname.slice(parentPathnameBase.length) || \"/\";\n\n let matches = matchRoutes(routes, { pathname: remainingPathname });\n\n if (__DEV__) {\n warning(\n parentRoute || matches != null,\n `No routes matched location \"${location.pathname}${location.search}${location.hash}\" `\n );\n\n warning(\n matches == null ||\n matches[matches.length - 1].route.element !== undefined ||\n matches[matches.length - 1].route.Component !== undefined,\n `Matched leaf route at location \"${location.pathname}${location.search}${location.hash}\" ` +\n `does not have an element or Component. This means it will render an with a ` +\n `null value by default resulting in an \"empty\" page.`\n );\n }\n\n let renderedMatches = _renderMatches(\n matches &&\n matches.map((match) =>\n Object.assign({}, match, {\n params: Object.assign({}, parentParams, match.params),\n pathname: joinPaths([\n parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation\n ? navigator.encodeLocation(match.pathname).pathname\n : match.pathname,\n ]),\n pathnameBase:\n match.pathnameBase === \"/\"\n ? parentPathnameBase\n : joinPaths([\n parentPathnameBase,\n // Re-encode pathnames that were decoded inside matchRoutes\n navigator.encodeLocation\n ? navigator.encodeLocation(match.pathnameBase).pathname\n : match.pathnameBase,\n ]),\n })\n ),\n parentMatches,\n dataRouterState\n );\n\n // When a user passes in a `locationArg`, the associated routes need to\n // be wrapped in a new `LocationContext.Provider` in order for `useLocation`\n // to use the scoped location instead of the global location.\n if (locationArg && renderedMatches) {\n return (\n \n {renderedMatches}\n \n );\n }\n\n return renderedMatches;\n}\n\nfunction DefaultErrorComponent() {\n let error = useRouteError();\n let message = isRouteErrorResponse(error)\n ? `${error.status} ${error.statusText}`\n : error instanceof Error\n ? error.message\n : JSON.stringify(error);\n let stack = error instanceof Error ? error.stack : null;\n let lightgrey = \"rgba(200,200,200, 0.5)\";\n let preStyles = { padding: \"0.5rem\", backgroundColor: lightgrey };\n let codeStyles = { padding: \"2px 4px\", backgroundColor: lightgrey };\n\n let devInfo = null;\n if (__DEV__) {\n console.error(\n \"Error handled by React Router default ErrorBoundary:\",\n error\n );\n\n devInfo = (\n <>\n

💿 Hey developer 👋

\n

\n You can provide a way better UX than this when your app throws errors\n by providing your own ErrorBoundary or{\" \"}\n errorElement prop on your route.\n

\n \n );\n }\n\n return (\n <>\n

Unexpected Application Error!

\n

{message}

\n {stack ?
{stack}
: null}\n {devInfo}\n \n );\n}\n\nconst defaultErrorElement = ;\n\ntype RenderErrorBoundaryProps = React.PropsWithChildren<{\n location: Location;\n revalidation: RevalidationState;\n error: any;\n component: React.ReactNode;\n routeContext: RouteContextObject;\n}>;\n\ntype RenderErrorBoundaryState = {\n location: Location;\n revalidation: RevalidationState;\n error: any;\n};\n\nexport class RenderErrorBoundary extends React.Component<\n RenderErrorBoundaryProps,\n RenderErrorBoundaryState\n> {\n constructor(props: RenderErrorBoundaryProps) {\n super(props);\n this.state = {\n location: props.location,\n revalidation: props.revalidation,\n error: props.error,\n };\n }\n\n static getDerivedStateFromError(error: any) {\n return { error: error };\n }\n\n static getDerivedStateFromProps(\n props: RenderErrorBoundaryProps,\n state: RenderErrorBoundaryState\n ) {\n // When we get into an error state, the user will likely click \"back\" to the\n // previous page that didn't have an error. Because this wraps the entire\n // application, that will have no effect--the error page continues to display.\n // This gives us a mechanism to recover from the error when the location changes.\n //\n // Whether we're in an error state or not, we update the location in state\n // so that when we are in an error state, it gets reset when a new location\n // comes in and the user recovers from the error.\n if (\n state.location !== props.location ||\n (state.revalidation !== \"idle\" && props.revalidation === \"idle\")\n ) {\n return {\n error: props.error,\n location: props.location,\n revalidation: props.revalidation,\n };\n }\n\n // If we're not changing locations, preserve the location but still surface\n // any new errors that may come through. We retain the existing error, we do\n // this because the error provided from the app state may be cleared without\n // the location changing.\n return {\n error: props.error || state.error,\n location: state.location,\n revalidation: props.revalidation || state.revalidation,\n };\n }\n\n componentDidCatch(error: any, errorInfo: any) {\n console.error(\n \"React Router caught the following error during render\",\n error,\n errorInfo\n );\n }\n\n render() {\n return this.state.error ? (\n \n \n \n ) : (\n this.props.children\n );\n }\n}\n\ninterface RenderedRouteProps {\n routeContext: RouteContextObject;\n match: RouteMatch;\n children: React.ReactNode | null;\n}\n\nfunction RenderedRoute({ routeContext, match, children }: RenderedRouteProps) {\n let dataRouterContext = React.useContext(DataRouterContext);\n\n // Track how deep we got in our render pass to emulate SSR componentDidCatch\n // in a DataStaticRouter\n if (\n dataRouterContext &&\n dataRouterContext.static &&\n dataRouterContext.staticContext &&\n (match.route.errorElement || match.route.ErrorBoundary)\n ) {\n dataRouterContext.staticContext._deepestRenderedBoundaryId = match.route.id;\n }\n\n return (\n \n {children}\n \n );\n}\n\nexport function _renderMatches(\n matches: RouteMatch[] | null,\n parentMatches: RouteMatch[] = [],\n dataRouterState: RemixRouter[\"state\"] | null = null\n): React.ReactElement | null {\n if (matches == null) {\n if (dataRouterState?.errors) {\n // Don't bail if we have data router errors so we can render them in the\n // boundary. Use the pre-matched (or shimmed) matches\n matches = dataRouterState.matches as DataRouteMatch[];\n } else {\n return null;\n }\n }\n\n let renderedMatches = matches;\n\n // If we have data errors, trim matches to the highest error boundary\n let errors = dataRouterState?.errors;\n if (errors != null) {\n let errorIndex = renderedMatches.findIndex(\n (m) => m.route.id && errors?.[m.route.id]\n );\n invariant(\n errorIndex >= 0,\n `Could not find a matching route for errors on route IDs: ${Object.keys(\n errors\n ).join(\",\")}`\n );\n renderedMatches = renderedMatches.slice(\n 0,\n Math.min(renderedMatches.length, errorIndex + 1)\n );\n }\n\n return renderedMatches.reduceRight((outlet, match, index) => {\n let error = match.route.id ? errors?.[match.route.id] : null;\n // Only data routers handle errors\n let errorElement: React.ReactNode | null = null;\n if (dataRouterState) {\n errorElement = match.route.errorElement || defaultErrorElement;\n }\n let matches = parentMatches.concat(renderedMatches.slice(0, index + 1));\n let getChildren = () => {\n let children: React.ReactNode;\n if (error) {\n children = errorElement;\n } else if (match.route.Component) {\n // Note: This is a de-optimized path since React won't re-use the\n // ReactElement since it's identity changes with each new\n // React.createElement call. We keep this so folks can use\n // `` in `` but generally `Component`\n // usage is only advised in `RouterProvider` when we can convert it to\n // `element` ahead of time.\n children = ;\n } else if (match.route.element) {\n children = match.route.element;\n } else {\n children = outlet;\n }\n return (\n \n );\n };\n // Only wrap in an error boundary within data router usages when we have an\n // ErrorBoundary/errorElement on this route. Otherwise let it bubble up to\n // an ancestor ErrorBoundary/errorElement\n return dataRouterState &&\n (match.route.ErrorBoundary || match.route.errorElement || index === 0) ? (\n \n ) : (\n getChildren()\n );\n }, null as React.ReactElement | null);\n}\n\nenum DataRouterHook {\n UseBlocker = \"useBlocker\",\n UseRevalidator = \"useRevalidator\",\n UseNavigateStable = \"useNavigate\",\n}\n\nenum DataRouterStateHook {\n UseBlocker = \"useBlocker\",\n UseLoaderData = \"useLoaderData\",\n UseActionData = \"useActionData\",\n UseRouteError = \"useRouteError\",\n UseNavigation = \"useNavigation\",\n UseRouteLoaderData = \"useRouteLoaderData\",\n UseMatches = \"useMatches\",\n UseRevalidator = \"useRevalidator\",\n UseNavigateStable = \"useNavigate\",\n UseRouteId = \"useRouteId\",\n}\n\nfunction getDataRouterConsoleError(\n hookName: DataRouterHook | DataRouterStateHook\n) {\n return `${hookName} must be used within a data router. See https://reactrouter.com/routers/picking-a-router.`;\n}\n\nfunction useDataRouterContext(hookName: DataRouterHook) {\n let ctx = React.useContext(DataRouterContext);\n invariant(ctx, getDataRouterConsoleError(hookName));\n return ctx;\n}\n\nfunction useDataRouterState(hookName: DataRouterStateHook) {\n let state = React.useContext(DataRouterStateContext);\n invariant(state, getDataRouterConsoleError(hookName));\n return state;\n}\n\nfunction useRouteContext(hookName: DataRouterStateHook) {\n let route = React.useContext(RouteContext);\n invariant(route, getDataRouterConsoleError(hookName));\n return route;\n}\n\n// Internal version with hookName-aware debugging\nfunction useCurrentRouteId(hookName: DataRouterStateHook) {\n let route = useRouteContext(hookName);\n let thisRoute = route.matches[route.matches.length - 1];\n invariant(\n thisRoute.route.id,\n `${hookName} can only be used on routes that contain a unique \"id\"`\n );\n return thisRoute.route.id;\n}\n\n/**\n * Returns the ID for the nearest contextual route\n */\nexport function useRouteId() {\n return useCurrentRouteId(DataRouterStateHook.UseRouteId);\n}\n\n/**\n * Returns the current navigation, defaulting to an \"idle\" navigation when\n * no navigation is in progress\n */\nexport function useNavigation() {\n let state = useDataRouterState(DataRouterStateHook.UseNavigation);\n return state.navigation;\n}\n\n/**\n * Returns a revalidate function for manually triggering revalidation, as well\n * as the current state of any manual revalidations\n */\nexport function useRevalidator() {\n let dataRouterContext = useDataRouterContext(DataRouterHook.UseRevalidator);\n let state = useDataRouterState(DataRouterStateHook.UseRevalidator);\n return React.useMemo(\n () => ({\n revalidate: dataRouterContext.router.revalidate,\n state: state.revalidation,\n }),\n [dataRouterContext.router.revalidate, state.revalidation]\n );\n}\n\n/**\n * Returns the active route matches, useful for accessing loaderData for\n * parent/child routes or the route \"handle\" property\n */\nexport function useMatches() {\n let { matches, loaderData } = useDataRouterState(\n DataRouterStateHook.UseMatches\n );\n return React.useMemo(\n () =>\n matches.map((match) => {\n let { pathname, params } = match;\n // Note: This structure matches that created by createUseMatchesMatch\n // in the @remix-run/router , so if you change this please also change\n // that :) Eventually we'll DRY this up\n return {\n id: match.route.id,\n pathname,\n params,\n data: loaderData[match.route.id] as unknown,\n handle: match.route.handle as unknown,\n };\n }),\n [matches, loaderData]\n );\n}\n\n/**\n * Returns the loader data for the nearest ancestor Route loader\n */\nexport function useLoaderData(): unknown {\n let state = useDataRouterState(DataRouterStateHook.UseLoaderData);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseLoaderData);\n\n if (state.errors && state.errors[routeId] != null) {\n console.error(\n `You cannot \\`useLoaderData\\` in an errorElement (routeId: ${routeId})`\n );\n return undefined;\n }\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the loaderData for the given routeId\n */\nexport function useRouteLoaderData(routeId: string): unknown {\n let state = useDataRouterState(DataRouterStateHook.UseRouteLoaderData);\n return state.loaderData[routeId];\n}\n\n/**\n * Returns the action data for the nearest ancestor Route action\n */\nexport function useActionData(): unknown {\n let state = useDataRouterState(DataRouterStateHook.UseActionData);\n\n let route = React.useContext(RouteContext);\n invariant(route, `useActionData must be used inside a RouteContext`);\n\n return Object.values(state?.actionData || {})[0];\n}\n\n/**\n * Returns the nearest ancestor Route error, which could be a loader/action\n * error or a render error. This is intended to be called from your\n * ErrorBoundary/errorElement to display a proper error message.\n */\nexport function useRouteError(): unknown {\n let error = React.useContext(RouteErrorContext);\n let state = useDataRouterState(DataRouterStateHook.UseRouteError);\n let routeId = useCurrentRouteId(DataRouterStateHook.UseRouteError);\n\n // If this was a render error, we put it in a RouteError context inside\n // of RenderErrorBoundary\n if (error) {\n return error;\n }\n\n // Otherwise look for errors from our data router state\n return state.errors?.[routeId];\n}\n\n/**\n * Returns the happy-path data from the nearest ancestor value\n */\nexport function useAsyncValue(): unknown {\n let value = React.useContext(AwaitContext);\n return value?._data;\n}\n\n/**\n * Returns the error from the nearest ancestor value\n */\nexport function useAsyncError(): unknown {\n let value = React.useContext(AwaitContext);\n return value?._error;\n}\n\nlet blockerId = 0;\n\n/**\n * Allow the application to block navigations within the SPA and present the\n * user a confirmation dialog to confirm the navigation. Mostly used to avoid\n * using half-filled form data. This does not handle hard-reloads or\n * cross-origin navigations.\n */\nexport function useBlocker(shouldBlock: boolean | BlockerFunction): Blocker {\n let { router, basename } = useDataRouterContext(DataRouterHook.UseBlocker);\n let state = useDataRouterState(DataRouterStateHook.UseBlocker);\n\n let [blockerKey, setBlockerKey] = React.useState(\"\");\n let blockerFunction = React.useCallback(\n (arg) => {\n if (typeof shouldBlock !== \"function\") {\n return !!shouldBlock;\n }\n if (basename === \"/\") {\n return shouldBlock(arg);\n }\n\n // If they provided us a function and we've got an active basename, strip\n // it from the locations we expose to the user to match the behavior of\n // useLocation\n let { currentLocation, nextLocation, historyAction } = arg;\n return shouldBlock({\n currentLocation: {\n ...currentLocation,\n pathname:\n stripBasename(currentLocation.pathname, basename) ||\n currentLocation.pathname,\n },\n nextLocation: {\n ...nextLocation,\n pathname:\n stripBasename(nextLocation.pathname, basename) ||\n nextLocation.pathname,\n },\n historyAction,\n });\n },\n [basename, shouldBlock]\n );\n\n // This effect is in charge of blocker key assignment and deletion (which is\n // tightly coupled to the key)\n React.useEffect(() => {\n let key = String(++blockerId);\n setBlockerKey(key);\n return () => router.deleteBlocker(key);\n }, [router]);\n\n // This effect handles assigning the blockerFunction. This is to handle\n // unstable blocker function identities, and happens only after the prior\n // effect so we don't get an orphaned blockerFunction in the router with a\n // key of \"\". Until then we just have the IDLE_BLOCKER.\n React.useEffect(() => {\n if (blockerKey !== \"\") {\n router.getBlocker(blockerKey, blockerFunction);\n }\n }, [router, blockerKey, blockerFunction]);\n\n // Prefer the blocker from `state` not `router.state` since DataRouterContext\n // is memoized so this ensures we update on blocker state updates\n return blockerKey && state.blockers.has(blockerKey)\n ? state.blockers.get(blockerKey)!\n : IDLE_BLOCKER;\n}\n\n/**\n * Stable version of useNavigate that is used when we are in the context of\n * a RouterProvider.\n */\nfunction useNavigateStable(): NavigateFunction {\n let { router } = useDataRouterContext(DataRouterHook.UseNavigateStable);\n let id = useCurrentRouteId(DataRouterStateHook.UseNavigateStable);\n\n let activeRef = React.useRef(false);\n useIsomorphicLayoutEffect(() => {\n activeRef.current = true;\n });\n\n let navigate: NavigateFunction = React.useCallback(\n (to: To | number, options: NavigateOptions = {}) => {\n warning(activeRef.current, navigateEffectWarning);\n\n // Short circuit here since if this happens on first render the navigate\n // is useless because we haven't wired up our router subscriber yet\n if (!activeRef.current) return;\n\n if (typeof to === \"number\") {\n router.navigate(to);\n } else {\n router.navigate(to, { fromRouteId: id, ...options });\n }\n },\n [router, id]\n );\n\n return navigate;\n}\n\nconst alreadyWarned: Record = {};\n\nfunction warningOnce(key: string, cond: boolean, message: string) {\n if (!cond && !alreadyWarned[key]) {\n alreadyWarned[key] = true;\n warning(false, message);\n }\n}\n", "import * as React from \"react\";\nimport type {\n TrackedPromise,\n InitialEntry,\n Location,\n MemoryHistory,\n Router as RemixRouter,\n To,\n LazyRouteFunction,\n RelativeRoutingType,\n RouterState,\n} from \"@remix-run/router\";\nimport {\n Action as NavigationType,\n AbortedDeferredError,\n createMemoryHistory,\n UNSAFE_invariant as invariant,\n parsePath,\n resolveTo,\n stripBasename,\n UNSAFE_warning as warning,\n UNSAFE_getPathContributingMatches as getPathContributingMatches,\n} from \"@remix-run/router\";\n\nimport type {\n DataRouteObject,\n IndexRouteObject,\n RouteMatch,\n RouteObject,\n Navigator,\n NonIndexRouteObject,\n} from \"./context\";\nimport {\n LocationContext,\n NavigationContext,\n DataRouterContext,\n DataRouterStateContext,\n AwaitContext,\n RouteContext,\n} from \"./context\";\nimport {\n useAsyncValue,\n useInRouterContext,\n useNavigate,\n useOutlet,\n useRoutes,\n _renderMatches,\n useRoutesImpl,\n useLocation,\n} from \"./hooks\";\n\nexport interface FutureConfig {\n v7_startTransition: boolean;\n}\n\nexport interface RouterProviderProps {\n fallbackElement?: React.ReactNode;\n router: RemixRouter;\n future?: FutureConfig;\n}\n\n/**\n Webpack + React 17 fails to compile on any of the following because webpack\n complains that `startTransition` doesn't exist in `React`:\n * import { startTransition } from \"react\"\n * import * as React from from \"react\";\n \"startTransition\" in React ? React.startTransition(() => setState()) : setState()\n * import * as React from from \"react\";\n \"startTransition\" in React ? React[\"startTransition\"](() => setState()) : setState()\n\n Moving it to a constant such as the following solves the Webpack/React 17 issue:\n * import * as React from from \"react\";\n const START_TRANSITION = \"startTransition\";\n START_TRANSITION in React ? React[START_TRANSITION](() => setState()) : setState()\n\n However, that introduces webpack/terser minification issues in production builds\n in React 18 where minification/obfuscation ends up removing the call of\n React.startTransition entirely from the first half of the ternary. Grabbing\n this exported reference once up front resolves that issue.\n\n See https://github.com/remix-run/react-router/issues/10579\n*/\nconst START_TRANSITION = \"startTransition\";\nconst startTransitionImpl = React[START_TRANSITION];\n\n/**\n * Given a Remix Router instance, render the appropriate UI\n */\nexport function RouterProvider({\n fallbackElement,\n router,\n future,\n}: RouterProviderProps): React.ReactElement {\n // Need to use a layout effect here so we are subscribed early enough to\n // pick up on any render-driven redirects/navigations (useEffect/)\n let [state, setStateImpl] = React.useState(router.state);\n let { v7_startTransition } = future || {};\n let setState = React.useCallback(\n (newState: RouterState) => {\n v7_startTransition && startTransitionImpl\n ? startTransitionImpl(() => setStateImpl(newState))\n : setStateImpl(newState);\n },\n [setStateImpl, v7_startTransition]\n );\n React.useLayoutEffect(() => router.subscribe(setState), [router, setState]);\n\n let navigator = React.useMemo((): Navigator => {\n return {\n createHref: router.createHref,\n encodeLocation: router.encodeLocation,\n go: (n) => router.navigate(n),\n push: (to, state, opts) =>\n router.navigate(to, {\n state,\n preventScrollReset: opts?.preventScrollReset,\n }),\n replace: (to, state, opts) =>\n router.navigate(to, {\n replace: true,\n state,\n preventScrollReset: opts?.preventScrollReset,\n }),\n };\n }, [router]);\n\n let basename = router.basename || \"/\";\n\n let dataRouterContext = React.useMemo(\n () => ({\n router,\n navigator,\n static: false,\n basename,\n }),\n [router, navigator, basename]\n );\n\n // The fragment and {null} here are important! We need them to keep React 18's\n // useId happy when we are server-rendering since we may have a \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 effects.consume(code)\n // @ts-expect-error: not null.\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 * @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 * @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", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n}\n\n/**\n * @this {TokenizeContext}\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\n ? end(code)\n : code === 45\n ? commentClose(code)\n : 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 (\n code === 45 ||\n code === 46 ||\n code === 58 ||\n code === 95 ||\n asciiAlphanumeric(code)\n ) {\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 (\n code === null ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96\n ) {\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 (\n code === null ||\n code === 34 ||\n code === 39 ||\n code === 60 ||\n code === 61 ||\n code === 96\n ) {\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)\n ? factorySpace(\n effects,\n lineEndingAfterPrefix,\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )(code)\n : 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", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 tokenize: tokenizeLabelEnd,\n resolveTo: resolveToLabelEnd,\n resolveAll: resolveAllLabelEnd\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 while (++index < events.length) {\n const token = events[index][1]\n if (\n token.type === 'labelImage' ||\n token.type === 'labelLink' ||\n token.type === 'labelEnd'\n ) {\n // Remove the marker.\n events.splice(index + 1, token.type === 'labelImage' ? 4 : 2)\n token.type = 'data'\n index++\n }\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 (\n token.type === 'link' ||\n (token.type === 'labelLink' && token._inactive)\n ) {\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 (\n events[index][0] === 'enter' &&\n (token.type === 'labelImage' || token.type === 'labelLink') &&\n !token._balanced\n ) {\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: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n }\n const label = {\n type: 'label',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[close][1].end)\n }\n const text = {\n type: 'labelText',\n start: Object.assign({}, events[open + offset + 2][1].end),\n end: Object.assign({}, events[close - 2][1].start)\n }\n media = [\n ['enter', group, context],\n ['enter', label, context]\n ]\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(\n media,\n resolveAll(\n context.parser.constructs.insideSpan.null,\n events.slice(open + offset + 4, close - 3),\n context\n )\n )\n\n // Text close, marker close, label close.\n media = push(media, [\n ['exit', text, context],\n events[close - 2],\n events[close - 1],\n ['exit', label, context]\n ])\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 * @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 (\n (self.events[index][1].type === 'labelImage' ||\n self.events[index][1].type === 'labelLink') &&\n !self.events[index][1]._balanced\n ) {\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(\n normalizeIdentifier(\n self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })\n )\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(\n resourceConstruct,\n labelEndOk,\n defined ? labelEndOk : labelEndNok\n )(code)\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(\n referenceFullConstruct,\n labelEndOk,\n defined ? referenceNotFull : labelEndNok\n )(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(\n referenceCollapsedConstruct,\n labelEndOk,\n labelEndNok\n )(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 * @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)\n ? factoryWhitespace(effects, resourceOpen)(code)\n : 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(\n effects,\n resourceDestinationAfter,\n resourceDestinationMissing,\n 'resourceDestination',\n 'resourceDestinationLiteral',\n 'resourceDestinationLiteralMarker',\n 'resourceDestinationRaw',\n 'resourceDestinationString',\n 32\n )(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)\n ? factoryWhitespace(effects, resourceBetween)(code)\n : 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(\n effects,\n resourceTitleAfter,\n nok,\n 'resourceTitle',\n 'resourceTitleMarker',\n 'resourceTitleString'\n )(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)\n ? factoryWhitespace(effects, resourceEnd)(code)\n : 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 * @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(\n self,\n effects,\n referenceFullAfter,\n referenceFullMissing,\n 'reference',\n 'referenceMarker',\n 'referenceString'\n )(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(\n normalizeIdentifier(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n )\n ? ok(code)\n : 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 * @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", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\nimport {labelEnd} from './label-end.js'\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n tokenize: tokenizeLabelStartImage,\n resolveAll: labelEnd.resolveAll\n}\n\n/**\n * @this {TokenizeContext}\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\n ? nok(code)\n : ok(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\nimport {labelEnd} from './label-end.js'\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n tokenize: tokenizeLabelStartLink,\n resolveAll: labelEnd.resolveAll\n}\n\n/**\n * @this {TokenizeContext}\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\n ? nok(code)\n : ok(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 * @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", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 * @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)\n ? factorySpace(effects, atBreak, 'whitespace')(code)\n : atBreak(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ContainerState} ContainerState\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 name: 'list',\n tokenize: tokenizeListStart,\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd\n}\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n tokenize: tokenizeListItemPrefixWhitespace,\n partial: true\n}\n\n/** @type {Construct} */\nconst indentConstruct = {\n tokenize: tokenizeIndent,\n partial: true\n}\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this\n const tail = self.events[self.events.length - 1]\n let initialSize =\n tail && tail[1].type === 'linePrefix'\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let size = 0\n return start\n\n /** @type {State} */\n function start(code) {\n const kind =\n self.containerState.type ||\n (code === 42 || code === 43 || code === 45\n ? 'listUnordered'\n : 'listOrdered')\n if (\n kind === 'listUnordered'\n ? !self.containerState.marker || code === self.containerState.marker\n : asciiDigit(code)\n ) {\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\n ? effects.check(thematicBreak, nok, atMarker)(code)\n : 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 (\n (!self.interrupt || size < 2) &&\n (self.containerState.marker\n ? code === self.containerState.marker\n : code === 41 || code === 46)\n ) {\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(\n blankLine,\n // Can\u2019t be empty when interrupting.\n self.interrupt ? nok : onBlank,\n effects.attempt(\n listItemPrefixWhitespaceConstruct,\n endOfPrefix,\n otherPrefix\n )\n )\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 =\n initialSize +\n self.sliceSerialize(effects.exit('listItemPrefix'), true).length\n return ok(code)\n }\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\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 =\n self.containerState.furtherBlankLines ||\n self.containerState.initialBlankLine\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(\n effects,\n ok,\n 'listItemIndent',\n self.containerState.size + 1\n )(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(\n effects,\n effects.attempt(list, ok, nok),\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )(code)\n }\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemIndent',\n self.containerState.size + 1\n )\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'listItemIndent' &&\n tail[2].sliceSerialize(tail[1], true).length === self.containerState.size\n ? ok(code)\n : nok(code)\n }\n}\n\n/**\n * @type {Exiter}\n * @this {TokenizeContext}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type)\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this\n\n // Always populated by defaults.\n\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemPrefixWhitespace',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4 + 1\n )\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return !markdownSpace(code) &&\n tail &&\n tail[1].type === 'listItemPrefixWhitespace'\n ? ok(code)\n : nok(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 tokenize: tokenizeSetextUnderline,\n resolveTo: resolveToSetextUnderline\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: Object.assign({}, events[text][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\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 = Object.assign({}, events[definition][1].end)\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 * @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 (\n self.events[index][1].type !== 'lineEnding' &&\n self.events[index][1].type !== 'linePrefix' &&\n self.events[index][1].type !== 'content'\n ) {\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)\n ? factorySpace(effects, after, 'lineSuffix')(code)\n : 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", "/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\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 * @type {Initializer}\n */\nfunction initializeFlow(effects) {\n const self = this\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine,\n atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(\n this.parser.constructs.flowInitial,\n afterConstruct,\n factorySpace(\n effects,\n effects.attempt(\n this.parser.constructs.flow,\n afterConstruct,\n effects.attempt(content, afterConstruct)\n ),\n 'linePrefix'\n )\n )\n )\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", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\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 * @returns {InitialConstruct}\n */\nfunction initializeFactory(field) {\n return {\n tokenize: initializeText,\n resolveAll: createResolver(\n field === 'text' ? resolveAllLineSuffixes : undefined\n )\n }\n\n /**\n * @this {TokenizeContext}\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 * @returns {boolean}\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 * @returns {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 (\n (eventIndex === events.length ||\n events[eventIndex][1].type === 'lineEnding') &&\n events[eventIndex - 1][1].type === 'data'\n ) {\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 if (size) {\n const token = {\n type:\n eventIndex === events.length || tabs || size < 2\n ? 'lineSuffix'\n : 'hardBreakTrailing',\n start: {\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size,\n _index: data.start._index + index,\n _bufferIndex: index\n ? bufferIndex\n : data.start._bufferIndex + bufferIndex\n },\n end: Object.assign({}, data.end)\n }\n data.end = Object.assign({}, token.start)\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token)\n } else {\n events.splice(\n eventIndex,\n 0,\n ['enter', token, context],\n ['exit', token, context]\n )\n eventIndex += 2\n }\n }\n eventIndex++\n }\n }\n return events\n}\n", "/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenType} TokenType\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n/**\n * @callback Restore\n * @returns {void}\n *\n * @typedef Info\n * @property {Restore} restore\n * @property {number} from\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * @param {Info} info\n * @returns {void}\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 * @param {InitialConstruct} initialize\n * @param {Omit | undefined} [from]\n * @returns {TokenizeContext}\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = Object.assign(\n from\n ? Object.assign({}, from)\n : {\n line: 1,\n column: 1,\n offset: 0\n },\n {\n _index: 0,\n _bufferIndex: -1\n }\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 consume,\n enter,\n exit,\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\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 previous: null,\n code: null,\n containerState: {},\n events: [],\n parser,\n sliceStream,\n sliceSerialize,\n now,\n defineSkip,\n write\n }\n\n /**\n * The state function.\n *\n * @type {State | void}\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 {line, column, offset, _index, _bufferIndex} = point\n return {\n line,\n column,\n offset,\n _index,\n _bufferIndex\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 {void}\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 (\n point._index === chunkIndex &&\n point._bufferIndex < chunk.length\n ) {\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 * @returns {void}\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 // @ts-expect-error Points w/ non-negative `_bufferIndex` reference\n // strings.\n if (point._bufferIndex === 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 * @param {{interrupt?: boolean | undefined} | undefined} [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 | Construct | ConstructRecord} constructs\n * @param {State} returnState\n * @param {State | undefined} [bogusState]\n * @returns {State}\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {Array} */\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)\n : 'tokenize' in constructs\n ? // @ts-expect-error Looks like a construct.\n handleListOfConstructs([constructs])\n : handleMapOfConstructs(constructs)\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * @returns {State}\n */\n function handleMapOfConstructs(map) {\n return start\n\n /** @type {State} */\n function start(code) {\n const def = 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(def) ? def : def ? [def] : []),\n ...(Array.isArray(all) ? all : all ? [all] : [])\n ]\n return handleListOfConstructs(list)(code)\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {Array} list\n * @returns {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 * @returns {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 (\n construct.name &&\n context.parser.constructs.disable.null.includes(construct.name)\n ) {\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,\n effects,\n ok,\n nok\n )(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 * @param {number} from\n * @returns {void}\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct)\n }\n if (construct.resolve) {\n splice(\n context.events,\n from,\n context.events.length - from,\n construct.resolve(context.events.slice(from), context)\n )\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 */\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 restore,\n from: startEventsIndex\n }\n\n /**\n * Restore state.\n *\n * @returns {void}\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 {void}\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 {Array} chunks\n * @param {Pick} token\n * @returns {Array}\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 } 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 {Array} chunks\n * @param {boolean | undefined} [expandTabs=false]\n * @returns {string}\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\n switch (chunk) {\n case -5: {\n value = '\\r'\n break\n }\n case -4: {\n value = '\\n'\n break\n }\n case -3: {\n value = '\\r' + '\\n'\n break\n }\n case -2: {\n value = expandTabs ? ' ' : '\\t'\n break\n }\n case -1: {\n if (!expandTabs && atTab) continue\n value = ' '\n break\n }\n default: {\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", "/**\n * @typedef {import('micromark-util-types').Extension} Extension\n */\n\nimport {\n attention,\n autolink,\n blockQuote,\n characterEscape,\n characterReference,\n codeFenced,\n codeIndented,\n codeText,\n definition,\n hardBreakEscape,\n headingAtx,\n htmlFlow,\n htmlText,\n labelEnd,\n labelStartImage,\n labelStartLink,\n lineEnding,\n list,\n setextUnderline,\n thematicBreak\n} 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", "/**\n * @typedef {import('micromark-util-types').Create} Create\n * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\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 {text, string} from './initialize/text.js'\nimport {createTokenizer} from './create-tokenizer.js'\nimport * as defaultConstructs from './constructs.js'\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * @returns {ParseContext}\n */\nexport function parse(options) {\n const settings = options || {}\n const constructs =\n /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])])\n\n /** @type {ParseContext} */\n const parser = {\n defined: [],\n lazy: {},\n constructs,\n content: create(content),\n document: create(document),\n flow: create(flow),\n string: create(string),\n text: create(text)\n }\n return parser\n\n /**\n * @param {InitialConstruct} initial\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", "/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Value} Value\n */\n\n/**\n * @callback Preprocessor\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {boolean | null | undefined} [end=false]\n * @returns {Array}\n */\n\nconst search = /[\\0\\t\\n\\r]/g\n\n/**\n * @returns {Preprocessor}\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 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\n // @ts-expect-error `Buffer` does allow an encoding.\n value = buffer + value.toString(encoding)\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 =\n 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 chunks.push(65533)\n column++\n break\n }\n case 9: {\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 chunks.push(-4)\n column = 1\n break\n }\n default: {\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}\n", "/**\n * @typedef {import('micromark-util-types').Event} Event\n */\n\nimport {subtokenize} from 'micromark-util-subtokenize'\n\n/**\n * @param {Array} events\n * @returns {Array}\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events\n}\n", "/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes\n * non-characters and control characters safe.\n *\n * @param {string} value\n * Value to decode.\n * @param {number} base\n * Numeric base.\n * @returns {string}\n * Character.\n */\nexport function decodeNumericCharacterReference(value, base) {\n const code = Number.parseInt(value, base)\n if (\n // C0 except for HT, LF, FF, CR, space.\n code < 9 ||\n code === 11 ||\n (code > 13 && code < 32) ||\n // Control character (DEL) of C0, and C1 controls.\n (code > 126 && code < 160) ||\n // Lone high surrogates and low surrogates.\n (code > 55295 && code < 57344) ||\n // Noncharacters.\n (code > 64975 && code < 65008) /* eslint-disable no-bitwise */ ||\n (code & 65535) === 65535 ||\n (code & 65535) === 65534 /* eslint-enable no-bitwise */ ||\n // Out of range\n code > 1114111\n ) {\n return '\\uFFFD'\n }\n return String.fromCharCode(code)\n}\n", "import {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'\nconst characterEscapeOrReference =\n /\\\\([!-/:-@[-`{-~])|&(#(?:\\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 * @param {string} $1\n * @param {string} $2\n * @returns {string}\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", "/**\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Value} Value\n *\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist').Point} Point\n *\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').StaticPhrasingContent} StaticPhrasingContent\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Break} Break\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('mdast').Code} Code\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('mdast').HTML} HTML\n * @typedef {import('mdast').Image} Image\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('mdast').Link} Link\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('mdast').List} List\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('mdast').Text} Text\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n * @typedef {import('mdast').ReferenceType} ReferenceType\n * @typedef {import('../index.js').CompileData} CompileData\n */\n\n/**\n * @typedef {Root | Content} Node\n * @typedef {Extract} Parent\n *\n * @typedef {Omit & {type: 'fragment', children: Array}} Fragment\n */\n\n/**\n * @callback Transform\n * Extra transform, to change the AST afterwards.\n * @param {Root} tree\n * Tree to transform.\n * @returns {Root | undefined | null | void}\n * New tree or nothing (in which case the current tree is used).\n *\n * @callback Handle\n * Handle a token.\n * @param {CompileContext} this\n * Context.\n * @param {Token} token\n * Current token.\n * @returns {void}\n * Nothing.\n *\n * @typedef {Record} Handles\n * Token types mapping to handles\n *\n * @callback OnEnterError\n * Handle the case where the `right` token is open, but it is closed (by the\n * `left` token) or because we reached the end of the document.\n * @param {Omit} this\n * Context.\n * @param {Token | undefined} left\n * Left token.\n * @param {Token} right\n * Right token.\n * @returns {void}\n * Nothing.\n *\n * @callback OnExitError\n * Handle the case where the `right` token is open but it is closed by\n * exiting the `left` token.\n * @param {Omit} this\n * Context.\n * @param {Token} left\n * Left token.\n * @param {Token} right\n * Right token.\n * @returns {void}\n * Nothing.\n *\n * @typedef {[Token, OnEnterError | undefined]} TokenTuple\n * Open token on the stack, with an optional error handler for when\n * that token isn\u2019t closed properly.\n */\n\n/**\n * @typedef Config\n * Configuration.\n *\n * We have our defaults, but extensions will add more.\n * @property {Array} canContainEols\n * Token types where line endings are used.\n * @property {Handles} enter\n * Opening handles.\n * @property {Handles} exit\n * Closing handles.\n * @property {Array} transforms\n * Tree transforms.\n *\n * @typedef {Partial} Extension\n * Change how markdown tokens from micromark are turned into mdast.\n *\n * @typedef CompileContext\n * mdast compiler context.\n * @property {Array} stack\n * Stack of nodes.\n * @property {Array} tokenStack\n * Stack of tokens.\n * @property {(key: Key) => CompileData[Key]} getData\n * Get data from the key/value store.\n * @property {(key: Key, value?: CompileData[Key]) => void} setData\n * Set data into the key/value store.\n * @property {(this: CompileContext) => void} buffer\n * Capture some of the output data.\n * @property {(this: CompileContext) => string} resume\n * Stop capturing and access the output data.\n * @property {(this: CompileContext, node: Kind, token: Token, onError?: OnEnterError) => Kind} enter\n * Enter a token.\n * @property {(this: CompileContext, token: Token, onError?: OnExitError) => Node} exit\n * Exit a token.\n * @property {TokenizeContext['sliceSerialize']} sliceSerialize\n * Get the string value of a token.\n * @property {Config} config\n * Configuration.\n *\n * @typedef FromMarkdownOptions\n * Configuration for how to build mdast.\n * @property {Array> | null | undefined} [mdastExtensions]\n * Extensions for this utility to change how tokens are turned into a tree.\n *\n * @typedef {ParseOptions & FromMarkdownOptions} Options\n * Configuration.\n */\n\n// To do: micromark: create a registry of tokens?\n// To do: next major: don\u2019t return given `Node` from `enter`.\n// To do: next major: remove setter/getter.\n\nimport {toString} from 'mdast-util-to-string'\nimport {parse} from 'micromark/lib/parse.js'\nimport {preprocess} from 'micromark/lib/preprocess.js'\nimport {postprocess} from 'micromark/lib/postprocess.js'\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 * @param value\n * Markdown to parse.\n * @param encoding\n * Character encoding for when `value` is `Buffer`.\n * @param options\n * Configuration.\n * @returns\n * mdast tree.\n */\nexport const fromMarkdown =\n /**\n * @type {(\n * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &\n * ((value: Value, options?: Options | null | undefined) => Root)\n * )}\n */\n\n /**\n * @param {Value} value\n * @param {Encoding | Options | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n */\n function (value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding\n encoding = undefined\n }\n return compiler(options)(\n postprocess(\n parse(options).document().write(preprocess()(value, encoding, true))\n )\n )\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 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 setData,\n getData\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 (\n events[index][1].type === 'listOrdered' ||\n events[index][1].type === 'listUnordered'\n ) {\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(\n Object.assign(\n {\n sliceSerialize: events[index][2].sliceSerialize\n },\n context\n ),\n events[index][1]\n )\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(\n events.length > 0\n ? events[0][1].start\n : {\n line: 1,\n column: 1,\n offset: 0\n }\n ),\n end: point(\n events.length > 0\n ? events[events.length - 2][1].end\n : {\n line: 1,\n column: 1,\n offset: 0\n }\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 if (\n event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered' ||\n event[1].type === 'blockQuote'\n ) {\n if (event[0] === 'enter') {\n containerBalance++\n } else {\n containerBalance--\n }\n atMarker = undefined\n } else if (event[1].type === 'lineEndingBlank') {\n if (event[0] === 'enter') {\n if (\n listItem &&\n !atMarker &&\n !containerBalance &&\n !firstBlankLineIndex\n ) {\n firstBlankLineIndex = index\n }\n atMarker = undefined\n }\n } else if (\n event[1].type === 'linePrefix' ||\n event[1].type === 'listItemValue' ||\n event[1].type === 'listItemMarker' ||\n event[1].type === 'listItemPrefix' ||\n event[1].type === 'listItemPrefixWhitespace'\n ) {\n // Empty.\n } else {\n atMarker = undefined\n }\n if (\n (!containerBalance &&\n event[0] === 'enter' &&\n event[1].type === 'listItemPrefix') ||\n (containerBalance === -1 &&\n event[0] === 'exit' &&\n (event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered'))\n ) {\n if (listItem) {\n let tailIndex = index\n lineIndex = undefined\n while (tailIndex--) {\n const tailEvent = events[tailIndex]\n if (\n tailEvent[1].type === 'lineEnding' ||\n tailEvent[1].type === 'lineEndingBlank'\n ) {\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 (\n tailEvent[1].type === 'linePrefix' ||\n tailEvent[1].type === 'blockQuotePrefix' ||\n tailEvent[1].type === 'blockQuotePrefixWhitespace' ||\n tailEvent[1].type === 'blockQuoteMarker' ||\n tailEvent[1].type === 'listItemIndent'\n ) {\n // Empty\n } else {\n break\n }\n }\n if (\n firstBlankLineIndex &&\n (!lineIndex || firstBlankLineIndex < lineIndex)\n ) {\n listItem._spread = true\n }\n\n // Fix position.\n listItem.end = Object.assign(\n {},\n lineIndex ? events[lineIndex][1].start : event[1].end\n )\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 listItem = {\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 // @ts-expect-error: `listItem` is most definitely defined, TS...\n events.splice(index, 0, ['enter', listItem, 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 * Set data.\n *\n * @template {keyof CompileData} Key\n * Field type.\n * @param {Key} key\n * Key of field.\n * @param {CompileData[Key]} [value]\n * New value.\n * @returns {void}\n * Nothing.\n */\n function setData(key, value) {\n data[key] = value\n }\n\n /**\n * Get data.\n *\n * @template {keyof CompileData} Key\n * Field type.\n * @param {Key} key\n * Key of field.\n * @returns {CompileData[Key]}\n * Value.\n */\n function getData(key) {\n return data[key]\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Node} create\n * Create a node.\n * @param {Handle} [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 {void}\n */\n function open(token) {\n enter.call(this, create(token), token)\n if (and) and.call(this, token)\n }\n }\n\n /**\n * @this {CompileContext}\n * @returns {void}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n })\n }\n\n /**\n * @template {Node} Kind\n * Node type.\n * @this {CompileContext}\n * Context.\n * @param {Kind} node\n * Node to enter.\n * @param {Token} token\n * Corresponding token.\n * @param {OnEnterError | undefined} [errorHandler]\n * Handle the case where this token is open, but it is closed by something else.\n * @returns {Kind}\n * The given node.\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1]\n // @ts-expect-error: Assume `Node` can exist as a child of `parent`.\n parent.children.push(node)\n this.stack.push(node)\n this.tokenStack.push([token, errorHandler])\n // @ts-expect-error: `end` will be patched later.\n node.position = {\n start: point(token.start)\n }\n return node\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle} [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 {void}\n */\n function close(token) {\n if (and) and.call(this, token)\n exit.call(this, token)\n }\n }\n\n /**\n * @this {CompileContext}\n * Context.\n * @param {Token} token\n * Corresponding token.\n * @param {OnExitError | undefined} [onExitError]\n * Handle the case where another token is open.\n * @returns {Node}\n * The closed node.\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(\n 'Cannot close `' +\n token.type +\n '` (' +\n stringifyPosition({\n start: token.start,\n end: token.end\n }) +\n '): it\u2019s not open'\n )\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 return node\n }\n\n /**\n * @this {CompileContext}\n * @returns {string}\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 setData('expectingFirstListItemValue', true)\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (getData('expectingFirstListItemValue')) {\n const ancestor = this.stack[this.stack.length - 2]\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10)\n setData('expectingFirstListItemValue')\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 (getData('flowCodeInside')) return\n this.buffer()\n setData('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 setData('flowCodeInside')\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(\n this.sliceSerialize(token)\n ).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 setData('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).charCodeAt(0) === 61 ? 1 : 2\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n setData('setextHeadingSlurpLineEnding')\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 let tail = node.children[node.children.length - 1]\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text()\n // @ts-expect-error: we\u2019ll add `end` later.\n tail.position = {\n start: point(token.start)\n }\n // @ts-expect-error: Assume `parent` accepts `text`.\n node.children.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 (getData('atHardBreak')) {\n const tail = context.children[context.children.length - 1]\n tail.position.end = point(token.end)\n setData('atHardBreak')\n return\n }\n if (\n !getData('setextHeadingSlurpLineEnding') &&\n config.canContainEols.includes(context.type)\n ) {\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 setData('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 // To do: clean.\n if (getData('inReference')) {\n /** @type {ReferenceType} */\n const referenceType = getData('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 setData('referenceType')\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 // To do: clean.\n if (getData('inReference')) {\n /** @type {ReferenceType} */\n const referenceType = getData('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 setData('referenceType')\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 setData('inReference', true)\n if (node.type === 'link') {\n /** @type {Array} */\n // @ts-expect-error: Assume static phrasing content.\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 setData('inReference')\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n setData('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(\n this.sliceSerialize(token)\n ).toLowerCase()\n setData('referenceType', 'full')\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n setData('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 = getData('characterReferenceType')\n /** @type {string} */\n let value\n if (type) {\n value = decodeNumericCharacterReference(\n data,\n type === 'characterReferenceMarkerNumeric' ? 10 : 16\n )\n setData('characterReferenceType')\n } else {\n const result = decodeNamedCharacterReference(data)\n value = result\n }\n const tail = this.stack.pop()\n tail.value += value\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 // @ts-expect-error `depth` will be set later.\n return {\n type: 'heading',\n depth: undefined,\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>} extensions\n * @returns {void}\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 {void}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key\n for (key in extension) {\n if (own.call(extension, key)) {\n if (key === 'canContainEols') {\n const right = extension[key]\n if (right) {\n combined[key].push(...right)\n }\n } else if (key === 'transforms') {\n const right = extension[key]\n if (right) {\n combined[key].push(...right)\n }\n } else if (key === 'enter' || key === 'exit') {\n const right = extension[key]\n if (right) {\n Object.assign(combined[key], right)\n }\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error(\n 'Cannot close `' +\n left.type +\n '` (' +\n stringifyPosition({\n start: left.start,\n end: left.end\n }) +\n '): a different token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is open'\n )\n } else {\n throw new Error(\n 'Cannot close document, a token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is still open'\n )\n }\n}\n", "/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * @this {import('unified').Processor}\n * @type {import('unified').Plugin<[Options?] | void[], string, Root>}\n */\nexport default function remarkParse(options) {\n /** @type {import('unified').ParserFunction} */\n const parser = (doc) => {\n // Assume options.\n const settings = /** @type {Options} */ (this.data('settings'))\n\n return fromMarkdown(\n doc,\n Object.assign({}, settings, 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: this.data('micromarkExtensions') || [],\n mdastExtensions: this.data('fromMarkdownExtensions') || []\n })\n )\n }\n\n Object.assign(this, {Parser: parser})\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Text} Text\n * @typedef {import('mdast').Break} Break\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Code} Code\n * @typedef {import('../state.js').State} State\n\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 // To do: next major, use `node.lang` w/o regex, the splitting\u2019s been going\n // on for years in remark now.\n const lang = node.lang ? node.lang.match(/^[^ \\t]+(?=[ \\t]|$)/) : null\n /** @type {Properties} */\n const properties = {}\n\n if (lang) {\n properties.className = ['language-' + lang]\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Delete} Delete\n * @typedef {import('../state.js').State} State\n\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('../state.js').State} State\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", "import {asciiAlphanumeric} from 'micromark-util-character'\nimport {encode} from 'micromark-util-encode'\n/**\n * Make a value safe for injection as a URL.\n *\n * This encodes unsafe characters with percent-encoding and skips already\n * encoded sequences (see `normalizeUri`).\n * Further unsafe characters are encoded as character references (see\n * `micromark-util-encode`).\n *\n * A regex of allowed protocols can be given, in which case the URL is\n * sanitized.\n * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or\n * `/^https?$/i` for `img[src]` (this is what `github.com` allows).\n * If the URL includes an unknown protocol (one not matched by `protocol`, such\n * as a dangerous example, `javascript:`), the value is ignored.\n *\n * @param {string | undefined} url\n *   URI to sanitize.\n * @param {RegExp | null | undefined} [protocol]\n *   Allowed protocols.\n * @returns {string}\n *   Sanitized URI.\n */\nexport function sanitizeUri(url, protocol) {\n  const value = encode(normalizeUri(url || ''))\n  if (!protocol) {\n    return value\n  }\n  const colon = value.indexOf(':')\n  const questionMark = value.indexOf('?')\n  const numberSign = value.indexOf('#')\n  const slash = value.indexOf('/')\n  if (\n    // If there is no protocol, it\u2019s relative.\n    colon < 0 ||\n    // If the first colon is after a `?`, `#`, or `/`, it\u2019s not a protocol.\n    (slash > -1 && colon > slash) ||\n    (questionMark > -1 && colon > questionMark) ||\n    (numberSign > -1 && colon > numberSign) ||\n    // It is a protocol, it should be allowed.\n    protocol.test(value.slice(0, colon))\n  ) {\n    return value\n  }\n  return ''\n}\n\n/**\n * Normalize a URL.\n *\n * Encode unsafe characters with percent-encoding, skipping already encoded\n * sequences.\n *\n * @param {string} value\n *   URI to normalize.\n * @returns {string}\n *   Normalized URI.\n */\nexport function normalizeUri(value) {\n  /** @type {Array} */\n  const result = []\n  let index = -1\n  let start = 0\n  let skip = 0\n  while (++index < value.length) {\n    const code = value.charCodeAt(index)\n    /** @type {string} */\n    let replace = ''\n\n    // A correct percent encoded value.\n    if (\n      code === 37 &&\n      asciiAlphanumeric(value.charCodeAt(index + 1)) &&\n      asciiAlphanumeric(value.charCodeAt(index + 2))\n    ) {\n      skip = 2\n    }\n    // ASCII.\n    else if (code < 128) {\n      if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {\n        replace = String.fromCharCode(code)\n      }\n    }\n    // Astral.\n    else if (code > 55295 && code < 57344) {\n      const next = value.charCodeAt(index + 1)\n\n      // A correct surrogate pair.\n      if (code < 56320 && next > 56319 && next < 57344) {\n        replace = String.fromCharCode(code, next)\n        skip = 1\n      }\n      // Lone surrogate.\n      else {\n        replace = '\\uFFFD'\n      }\n    }\n    // Unicode.\n    else {\n      replace = String.fromCharCode(code)\n    }\n    if (replace) {\n      result.push(value.slice(start, index), encodeURIComponent(replace))\n      start = index + skip + 1\n      replace = ''\n    }\n    if (skip) {\n      index += skip\n      skip = 0\n    }\n  }\n  return result.join('') + value.slice(start)\n}\n", "/**\n * @typedef {import('mdast').FootnoteReference} FootnoteReference\n * @typedef {import('hast').Element} Element\n * @typedef {import('../state.js').State} State\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 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  if (index === -1) {\n    state.footnoteOrder.push(id)\n    state.footnoteCounts[id] = 1\n    counter = state.footnoteOrder.length\n  } else {\n    state.footnoteCounts[id]++\n    counter = index + 1\n  }\n\n  const reuseCounter = state.footnoteCounts[id]\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + state.clobberPrefix + 'fn-' + safeId,\n      id:\n        state.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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Footnote} Footnote\n * @typedef {import('../state.js').State} State\n */\n\nimport {footnoteReference} from './footnote-reference.js'\n\n// To do: when both:\n// * \n// * \n// \u2026are archived, remove this (also from mdast).\n// These inline notes are not used in GFM.\n\n/**\n * Turn an mdast `footnote` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Footnote} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnote(state, node) {\n  const footnoteById = state.footnoteById\n  let no = 1\n\n  while (no in footnoteById) no++\n\n  const identifier = String(no)\n\n  footnoteById[identifier] = {\n    type: 'footnoteDefinition',\n    identifier,\n    children: [{type: 'paragraph', children: node.children}],\n    position: node.position\n  }\n\n  return footnoteReference(state, {\n    type: 'footnoteReference',\n    identifier,\n    position: node.position\n  })\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').HTML} Html\n * @typedef {import('../state.js').State} State\n * @typedef {import('../../index.js').Raw} Raw\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 {Raw | Element | null}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.dangerous) {\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  // To do: next major: return `undefined`.\n  return null\n}\n", "/**\n * @typedef {import('hast').ElementContent} ElementContent\n *\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Reference} Reference\n * @typedef {import('mdast').Root} Root\n *\n * @typedef {import('./state.js').State} State\n */\n\n/**\n * @typedef {Root | Content} Nodes\n * @typedef {Extract} References\n */\n\n// To do: next major: always return array.\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 {References} node\n *   Reference node (image, link).\n * @returns {ElementContent | 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 * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('../state.js').State} State\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 {ElementContent | Array}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const def = state.definition(node.identifier)\n\n  if (!def) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(def.url || ''), alt: node.alt}\n\n  if (def.title !== null && def.title !== undefined) {\n    properties.title = def.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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Image} Image\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Text} Text\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('../state.js').State} State\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 {ElementContent | Array}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const def = state.definition(node.identifier)\n\n  if (!def) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(def.url || '')}\n\n  if (def.title !== null && def.title !== undefined) {\n    properties.title = def.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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Link} Link\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Parent} Parent\n * @typedef {import('mdast').Root} Root\n * @typedef {import('../state.js').State} State\n */\n\n/**\n * @typedef {Root | Content} Nodes\n * @typedef {Extract} Parents\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 | null | 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 === undefined || spread === null\n    ? node.children.length > 1\n    : spread\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').List} List\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Root} HastRoot\n * @typedef {import('hast').Element} HastElement\n * @typedef {import('mdast').Root} MdastRoot\n * @typedef {import('../state.js').State} State\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 {HastRoot | HastElement}\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('../state.js').State} State\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 * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Get the starting point of `node`.\n *\n * @param node\n *   Node.\n * @returns\n *   Point.\n */\nexport const pointStart = point('start')\n\n/**\n * Get the ending point of `node`.\n *\n * @param node\n *   Node.\n * @returns\n *   Point.\n */\nexport const pointEnd = point('end')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {NodeLike | Node | null | undefined} [node]\n *   Node.\n * @returns {Position}\n *   Position.\n */\nexport function position(node) {\n  return {start: pointStart(node), end: pointEnd(node)}\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'start' | 'end'} type\n *   Side.\n * @returns\n *   Getter.\n */\nfunction point(type) {\n  return point\n\n  /**\n   * Get the point info of `node` at a bound side.\n   *\n   * @param {NodeLike | Node | null | undefined} [node]\n   * @returns {Point}\n   */\n  function point(node) {\n    const point = (node && node.position && node.position[type]) || {}\n\n    // To do: next major: don\u2019t return points when invalid.\n    return {\n      // @ts-expect-error: in practice, null is allowed.\n      line: point.line || null,\n      // @ts-expect-error: in practice, null is allowed.\n      column: point.column || null,\n      // @ts-expect-error: in practice, null is allowed.\n      offset: point.offset > -1 ? point.offset : null\n    }\n  }\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Table} Table\n * @typedef {import('../state.js').State} State\n */\n\nimport {pointStart, pointEnd} 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.line && end.line) 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 * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Parent} Parent\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').TableRow} TableRow\n * @typedef {import('../state.js').State} State\n */\n\n/**\n * @typedef {Root | Content} Nodes\n * @typedef {Extract} Parents\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 | null | 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  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(node, 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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').TableCell} TableCell\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} HastElement\n * @typedef {import('hast').Text} HastText\n * @typedef {import('mdast').Text} MdastText\n * @typedef {import('../state.js').State} State\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 {HastText | HastElement}\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n * @typedef {import('../state.js').State} State\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", "import {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 {footnote} from './footnote.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 */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  footnote,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\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  // To do: next major: return `undefined`.\n  return null\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @typedef {Record} Props\n * @typedef {null | undefined | string | Props | TestFunctionAnything | Array} Test\n *   Check for an arbitrary node, unaware of TypeScript inferral.\n *\n * @callback TestFunctionAnything\n *   Check if a node passes a test, unaware of TypeScript inferral.\n * @param {unknown} this\n *   The given context.\n * @param {Node} node\n *   A node.\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {boolean | void}\n *   Whether this node passes the test.\n */\n\n/**\n * @template {Node} Kind\n *   Node type.\n * @typedef {Kind['type'] | Partial | TestFunctionPredicate | Array | TestFunctionPredicate>} PredicateTest\n *   Check for a node that can be inferred by TypeScript.\n */\n\n/**\n * Check if a node passes a certain test.\n *\n * @template {Node} Kind\n *   Node type.\n * @callback TestFunctionPredicate\n *   Complex test function for a node that can be inferred by TypeScript.\n * @param {Node} node\n *   A node.\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {node is Kind}\n *   Whether this node passes the test.\n */\n\n/**\n * @callback AssertAnything\n *   Check that an arbitrary value is a node, unaware of TypeScript inferral.\n * @param {unknown} [node]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {boolean}\n *   Whether this is a node and passes a test.\n */\n\n/**\n * Check if a node is a node and passes a certain node test.\n *\n * @template {Node} Kind\n *   Node type.\n * @callback AssertPredicate\n *   Check that an arbitrary value is a specific node, aware of TypeScript.\n * @param {unknown} [node]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {node is Kind}\n *   Whether this is a node and passes a test.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param node\n *   Thing to check, typically `Node`.\n * @param test\n *   A check for a specific node.\n * @param index\n *   The node\u2019s position in its parent.\n * @param parent\n *   The node\u2019s parent.\n * @returns\n *   Whether `node` is a node and passes a test.\n */\nexport const is =\n  /**\n   * @type {(\n   *   (() => false) &\n   *   ((node: unknown, test: PredicateTest, index: number, parent: Parent, context?: unknown) => node is Kind) &\n   *   ((node: unknown, test: PredicateTest, index?: null | undefined, parent?: null | undefined, context?: unknown) => node is Kind) &\n   *   ((node: unknown, test: Test, index: number, parent: Parent, context?: unknown) => boolean) &\n   *   ((node: unknown, test?: Test, index?: null | undefined, parent?: null | undefined, context?: unknown) => boolean)\n   * )}\n   */\n  (\n    /**\n     * @param {unknown} [node]\n     * @param {Test} [test]\n     * @param {number | null | undefined} [index]\n     * @param {Parent | null | undefined} [parent]\n     * @param {unknown} [context]\n     * @returns {boolean}\n     */\n    // eslint-disable-next-line max-params\n    function is(node, test, index, parent, context) {\n      const check = convert(test)\n\n      if (\n        index !== undefined &&\n        index !== null &&\n        (typeof index !== 'number' ||\n          index < 0 ||\n          index === Number.POSITIVE_INFINITY)\n      ) {\n        throw new Error('Expected positive finite index')\n      }\n\n      if (\n        parent !== undefined &&\n        parent !== null &&\n        (!is(parent) || !parent.children)\n      ) {\n        throw new Error('Expected parent node')\n      }\n\n      if (\n        (parent === undefined || parent === null) !==\n        (index === undefined || index === null)\n      ) {\n        throw new Error('Expected both parent and index')\n      }\n\n      // @ts-expect-error Looks like a node.\n      return node && node.type && typeof node.type === 'string'\n        ? Boolean(check.call(context, node, index, parent))\n        : false\n    }\n  )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you\u2019re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param test\n *   *   when nullish, checks if `node` is a `Node`.\n *   *   when `string`, works like passing `(node) => node.type === test`.\n *   *   when `function` checks if function passed the node is true.\n *   *   when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n *   *   when `array`, checks if any one of the subtests pass.\n * @returns\n *   An assertion.\n */\nexport const convert =\n  /**\n   * @type {(\n   *   ((test: PredicateTest) => AssertPredicate) &\n   *   ((test?: Test) => AssertAnything)\n   * )}\n   */\n  (\n    /**\n     * @param {Test} [test]\n     * @returns {AssertAnything}\n     */\n    function (test) {\n      if (test === undefined || test === null) {\n        return ok\n      }\n\n      if (typeof test === 'string') {\n        return typeFactory(test)\n      }\n\n      if (typeof test === 'object') {\n        return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n      }\n\n      if (typeof test === 'function') {\n        return castFactory(test)\n      }\n\n      throw new Error('Expected function, string, or object as test')\n    }\n  )\n\n/**\n * @param {Array} tests\n * @returns {AssertAnything}\n */\nfunction anyFactory(tests) {\n  /** @type {Array} */\n  const checks = []\n  let index = -1\n\n  while (++index < tests.length) {\n    checks[index] = convert(tests[index])\n  }\n\n  return castFactory(any)\n\n  /**\n   * @this {unknown}\n   * @param {Array} parameters\n   * @returns {boolean}\n   */\n  function any(...parameters) {\n    let index = -1\n\n    while (++index < checks.length) {\n      if (checks[index].call(this, ...parameters)) return true\n    }\n\n    return false\n  }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {AssertAnything}\n */\nfunction propsFactory(check) {\n  return castFactory(all)\n\n  /**\n   * @param {Node} node\n   * @returns {boolean}\n   */\n  function all(node) {\n    /** @type {string} */\n    let key\n\n    for (key in check) {\n      // @ts-expect-error: hush, it sure works as an index.\n      if (node[key] !== check[key]) return false\n    }\n\n    return true\n  }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {AssertAnything}\n */\nfunction typeFactory(check) {\n  return castFactory(type)\n\n  /**\n   * @param {Node} node\n   */\n  function type(node) {\n    return node && node.type === check\n  }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunctionAnything} check\n * @returns {AssertAnything}\n */\nfunction castFactory(check) {\n  return assertion\n\n  /**\n   * @this {unknown}\n   * @param {unknown} node\n   * @param {Array} parameters\n   * @returns {boolean}\n   */\n  function assertion(node, ...parameters) {\n    return Boolean(\n      node &&\n        typeof node === 'object' &&\n        'type' in node &&\n        // @ts-expect-error: fine.\n        Boolean(check.call(this, node, ...parameters))\n    )\n  }\n}\n\nfunction ok() {\n  return true\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist-util-is').Test} Test\n */\n\n/**\n * @typedef {boolean | 'skip'} Action\n *   Union of the action types.\n *\n * @typedef {number} Index\n *   Move to the sibling at `index` next (after node itself is completely\n *   traversed).\n *\n *   Useful if mutating the tree, such as removing the node the visitor is\n *   currently on, or any of its previous siblings.\n *   Results less than 0 or greater than or equal to `children.length` stop\n *   traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n *   List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n *   Any value that can be returned from a visitor.\n */\n\n/**\n * @template {Node} [Visited=Node]\n *   Visited node type.\n * @template {Parent} [Ancestor=Parent]\n *   Ancestor type.\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform the parent of node (the last of `ancestors`).\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of an ancestor still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Array} ancestors\n *   Ancestors of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   Tree type.\n * @template {Test} [Check=string]\n *   Test type.\n * @typedef {Visitor, Check>, Extract, Parent>>} BuildVisitor\n *   Build a typed `Visitor` function from a tree and a test.\n *\n *   It will infer which values are passed as `node` and which as `parents`.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from './color.js'\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node\u2019s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @param tree\n *   Tree to traverse.\n * @param test\n *   `unist-util-is`-compatible test\n * @param visitor\n *   Handle each node.\n * @param reverse\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns\n *   Nothing.\n */\nexport const visitParents =\n  /**\n   * @type {(\n   *   ((tree: Tree, test: Check, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) &\n   *   ((tree: Tree, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void)\n   * )}\n   */\n  (\n    /**\n     * @param {Node} tree\n     * @param {Test} test\n     * @param {Visitor} visitor\n     * @param {boolean | null | undefined} [reverse]\n     * @returns {void}\n     */\n    function (tree, test, visitor, reverse) {\n      if (typeof test === 'function' && typeof visitor !== 'function') {\n        reverse = visitor\n        // @ts-expect-error no visitor given, so `visitor` is test.\n        visitor = test\n        test = null\n      }\n\n      const is = convert(test)\n      const step = reverse ? -1 : 1\n\n      factory(tree, undefined, [])()\n\n      /**\n       * @param {Node} node\n       * @param {number | undefined} index\n       * @param {Array} parents\n       */\n      function factory(node, index, parents) {\n        /** @type {Record} */\n        // @ts-expect-error: hush\n        const value = node && typeof node === 'object' ? node : {}\n\n        if (typeof value.type === 'string') {\n          const name =\n            // `hast`\n            typeof value.tagName === 'string'\n              ? value.tagName\n              : // `xast`\n              typeof value.name === 'string'\n              ? value.name\n              : undefined\n\n          Object.defineProperty(visit, 'name', {\n            value:\n              'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n          })\n        }\n\n        return visit\n\n        function visit() {\n          /** @type {ActionTuple} */\n          let result = []\n          /** @type {ActionTuple} */\n          let subresult\n          /** @type {number} */\n          let offset\n          /** @type {Array} */\n          let grandparents\n\n          if (!test || is(node, index, parents[parents.length - 1] || null)) {\n            result = toResult(visitor(node, parents))\n\n            if (result[0] === EXIT) {\n              return result\n            }\n          }\n\n          // @ts-expect-error looks like a parent.\n          if (node.children && result[0] !== SKIP) {\n            // @ts-expect-error looks like a parent.\n            offset = (reverse ? node.children.length : -1) + step\n            // @ts-expect-error looks like a parent.\n            grandparents = parents.concat(node)\n\n            // @ts-expect-error looks like a parent.\n            while (offset > -1 && offset < node.children.length) {\n              // @ts-expect-error looks like a parent.\n              subresult = factory(node.children[offset], offset, grandparents)()\n\n              if (subresult[0] === EXIT) {\n                return subresult\n              }\n\n              offset =\n                typeof subresult[1] === 'number' ? subresult[1] : offset + step\n            }\n          }\n\n          return result\n        }\n      }\n    }\n  )\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n *   Valid return values from visitors.\n * @returns {ActionTuple}\n *   Clean result.\n */\nfunction toResult(value) {\n  if (Array.isArray(value)) {\n    return value\n  }\n\n  if (typeof value === 'number') {\n    return [CONTINUE, value]\n  }\n\n  return [value]\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist-util-is').Test} Test\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * Check if `Child` can be a child of `Ancestor`.\n *\n * Returns the ancestor when `Child` can be a child of `Ancestor`, or returns\n * `never`.\n *\n * @template {Node} Ancestor\n *   Node type.\n * @template {Node} Child\n *   Node type.\n * @typedef {(\n *   Ancestor extends Parent\n *     ? Child extends Ancestor['children'][number]\n *       ? Ancestor\n *       : never\n *     : never\n * )} ParentsOf\n */\n\n/**\n * @template {Node} [Visited=Node]\n *   Visited node type.\n * @template {Parent} [Ancestor=Parent]\n *   Ancestor type.\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform `parent`.\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of `parent` still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Visited extends Node ? number | null : never} index\n *   Index of `node` in `parent`.\n * @param {Ancestor extends Node ? Ancestor | null : never} parent\n *   Parent of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n */\n\n/**\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n *\n * @template {Node} Visited\n *   Node type.\n * @template {Parent} Ancestor\n *   Parent type.\n * @typedef {Visitor>} BuildVisitorFromMatch\n */\n\n/**\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n *\n * @template {Node} Descendant\n *   Node type.\n * @template {Test} Check\n *   Test type.\n * @typedef {(\n *   BuildVisitorFromMatch<\n *     import('unist-util-visit-parents/complex-types.js').Matches,\n *     Extract\n *   >\n * )} BuildVisitorFromDescendants\n */\n\n/**\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n *\n * @template {Node} [Tree=Node]\n *   Node type.\n * @template {Test} [Check=string]\n *   Test type.\n * @typedef {(\n *   BuildVisitorFromDescendants<\n *     import('unist-util-visit-parents/complex-types.js').InclusiveDescendant,\n *     Check\n *   >\n * )} BuildVisitor\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @param tree\n *   Tree to traverse.\n * @param test\n *   `unist-util-is`-compatible test\n * @param visitor\n *   Handle each node.\n * @param reverse\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns\n *   Nothing.\n */\nexport const visit =\n  /**\n   * @type {(\n   *   ((tree: Tree, test: Check, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) &\n   *   ((tree: Tree, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void)\n   * )}\n   */\n  (\n    /**\n     * @param {Node} tree\n     * @param {Test} test\n     * @param {Visitor} visitor\n     * @param {boolean | null | undefined} [reverse]\n     * @returns {void}\n     */\n    function (tree, test, visitor, reverse) {\n      if (typeof test === 'function' && typeof visitor !== 'function') {\n        reverse = visitor\n        visitor = test\n        test = null\n      }\n\n      visitParents(tree, test, overload, reverse)\n\n      /**\n       * @param {Node} node\n       * @param {Array} parents\n       */\n      function overload(node, parents) {\n        const parent = parents[parents.length - 1]\n        return visitor(\n          node,\n          parent ? parent.children.indexOf(node) : null,\n          parent\n        )\n      }\n    }\n  )\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n", "/**\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef NodeLike\n * @property {PositionLike | null | undefined} [position]\n */\n\n/**\n * Check if `node` is generated.\n *\n * @param {NodeLike | null | undefined} [node]\n *   Node to check.\n * @returns {boolean}\n *   Whether `node` is generated (does not have positional info).\n */\nexport function generated(node) {\n  return (\n    !node ||\n    !node.position ||\n    !node.position.start ||\n    !node.position.start.line ||\n    !node.position.start.column ||\n    !node.position.end ||\n    !node.position.end.line ||\n    !node.position.end.column\n  )\n}\n", "/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Definition} Definition\n */\n\n/**\n * @typedef {Root | Content} Node\n *\n * @callback GetDefinition\n *   Get a definition by identifier.\n * @param {string | null | undefined} [identifier]\n *   Identifier of definition.\n * @returns {Definition | null}\n *   Definition corresponding to `identifier` or `null`.\n */\n\nimport {visit} from 'unist-util-visit'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Find definitions in `tree`.\n *\n * Uses CommonMark precedence, which means that earlier definitions are\n * preferred over duplicate later definitions.\n *\n * @param {Node} tree\n *   Tree to check.\n * @returns {GetDefinition}\n *   Getter.\n */\nexport function definitions(tree) {\n  /** @type {Record} */\n  const cache = Object.create(null)\n\n  if (!tree || !tree.type) {\n    throw new Error('mdast-util-definitions expected node')\n  }\n\n  visit(tree, 'definition', (definition) => {\n    const id = clean(definition.identifier)\n    if (id && !own.call(cache, id)) {\n      cache[id] = definition\n    }\n  })\n\n  return definition\n\n  /** @type {GetDefinition} */\n  function definition(identifier) {\n    const id = clean(identifier)\n    // To do: next major: return `undefined` when not found.\n    return id && own.call(cache, id) ? cache[id] : null\n  }\n}\n\n/**\n * @param {string | null | undefined} [value]\n * @returns {string}\n */\nfunction clean(value) {\n  return String(value || '').toUpperCase()\n}\n", "/**\n * @typedef {import('hast').Content} HastContent\n * @typedef {import('hast').Element} HastElement\n * @typedef {import('hast').ElementContent} HastElementContent\n * @typedef {import('hast').Properties} HastProperties\n * @typedef {import('hast').Root} HastRoot\n * @typedef {import('hast').Text} HastText\n *\n * @typedef {import('mdast').Content} MdastContent\n * @typedef {import('mdast').Definition} MdastDefinition\n * @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition\n * @typedef {import('mdast').Parent} MdastParent\n * @typedef {import('mdast').Root} MdastRoot\n */\n\n/**\n * @typedef {HastRoot | HastContent} HastNodes\n * @typedef {MdastRoot | MdastContent} MdastNodes\n * @typedef {Extract} MdastParents\n *\n * @typedef EmbeddedHastFields\n *   hast fields.\n * @property {string | null | undefined} [hName]\n *   Generate a specific element with this tag name instead.\n * @property {HastProperties | null | undefined} [hProperties]\n *   Generate an element with these properties instead.\n * @property {Array | null | undefined} [hChildren]\n *   Generate an element with this content instead.\n *\n * @typedef {Record & EmbeddedHastFields} MdastData\n *   mdast data with embedded hast fields.\n *\n * @typedef {MdastNodes & {data?: MdastData | null | undefined}} MdastNodeWithData\n *   mdast node with embedded hast data.\n *\n * @typedef PointLike\n *   Point-like value.\n * @property {number | null | undefined} [line]\n *   Line.\n * @property {number | null | undefined} [column]\n *   Column.\n * @property {number | null | undefined} [offset]\n *   Offset.\n *\n * @typedef PositionLike\n *   Position-like value.\n * @property {PointLike | null | undefined} [start]\n *   Point-like value.\n * @property {PointLike | null | undefined} [end]\n *   Point-like value.\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 | null | undefined} parent\n *   Parent of `node`.\n * @returns {HastElementContent | Array | null | undefined}\n *   hast node.\n *\n * @callback HFunctionProps\n *   Signature of `state` for when props are passed.\n * @param {MdastNodes | PositionLike | null | undefined} node\n *   mdast node or unist position.\n * @param {string} tagName\n *   HTML tag name.\n * @param {HastProperties} props\n *   Properties.\n * @param {Array | null | undefined} [children]\n *   hast content.\n * @returns {HastElement}\n *   Compiled element.\n *\n * @callback HFunctionNoProps\n *   Signature of `state` for when no props are passed.\n * @param {MdastNodes | PositionLike | null | undefined} node\n *   mdast node or unist position.\n * @param {string} tagName\n *   HTML tag name.\n * @param {Array | null | undefined} [children]\n *   hast content.\n * @returns {HastElement}\n *   Compiled element.\n *\n * @typedef HFields\n *   Info on `state`.\n * @property {boolean} dangerous\n *   Whether HTML is allowed.\n * @property {string} clobberPrefix\n *   Prefix to use to prevent DOM clobbering.\n * @property {string} footnoteLabel\n *   Label to use to introduce the footnote section.\n * @property {string} footnoteLabelTagName\n *   HTML used for the footnote label.\n * @property {HastProperties} footnoteLabelProperties\n *   Properties on the HTML tag used for the footnote label.\n * @property {string} footnoteBackLabel\n *   Label to use from backreferences back to their footnote call.\n * @property {(identifier: string) => MdastDefinition | null} definition\n *   Definition cache.\n * @property {Record} footnoteById\n *   Footnote definitions by their identifier.\n * @property {Array} footnoteOrder\n *   Identifiers of order when footnote calls first appear in tree order.\n * @property {Record} footnoteCounts\n *   Counts for how often the same footnote was called.\n * @property {Handlers} handlers\n *   Applied handlers.\n * @property {Handler} unknownHandler\n *   Handler for any none not in `passThrough` or otherwise handled.\n * @property {(from: MdastNodes, node: HastNodes) => void} patch\n *   Copy a node\u2019s positional info.\n * @property {(from: MdastNodes, to: Type) => Type | HastElement} applyData\n *   Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {(node: MdastNodes, parent: MdastParents | null | undefined) => HastElementContent | Array | null | undefined} one\n *   Transform an mdast node to hast.\n * @property {(node: MdastNodes) => Array} all\n *   Transform the children of an mdast parent to hast.\n * @property {(nodes: Array, loose?: boolean | null | undefined) => Array} wrap\n *   Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n * @property {(left: MdastNodeWithData | PositionLike | null | undefined, right: HastElementContent) => HastElementContent} augment\n *   Like `state` but lower-level and usable on non-elements.\n *   Deprecated: use `patch` and `applyData`.\n * @property {Array} passThrough\n *   List of node types to pass through untouched (except for their children).\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.\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` attribute on footnotes to prevent it from\n *   *clobbering*.\n * @property {string | null | undefined} [footnoteBackLabel='Back to content']\n *   Label to use from backreferences back to their footnote call (affects\n *   screen readers).\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n *   Label to use for the footnotes section (affects screen readers).\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n *   Properties to use on the footnote label (note that `id: 'footnote-label'`\n *   is always added as footnote calls use it with `aria-describedby` to\n *   provide an accessible label).\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n *   Tag name to use for the footnote label.\n * @property {Handlers | null | undefined} [handlers]\n *   Extra handlers for nodes.\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 * @property {Handler | null | undefined} [unknownHandler]\n *   Handler for all unknown nodes.\n *\n * @typedef {Record} Handlers\n *   Handle nodes.\n *\n * @typedef {HFunctionProps & HFunctionNoProps & HFields} State\n *   Info passed around.\n */\n\nimport {visit} from 'unist-util-visit'\nimport {position, pointStart, pointEnd} from 'unist-util-position'\nimport {generated} from 'unist-util-generated'\nimport {definitions} from 'mdast-util-definitions'\nimport {handlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\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.\n * @returns {State}\n *   `state` function.\n */\nexport function createState(tree, options) {\n  const settings = options || {}\n  const dangerous = settings.allowDangerousHtml || false\n  /** @type {Record} */\n  const footnoteById = {}\n\n  // To do: next major: add `options` to state, remove:\n  // `dangerous`, `clobberPrefix`, `footnoteLabel`, `footnoteLabelTagName`,\n  // `footnoteLabelProperties`, `footnoteBackLabel`, `passThrough`,\n  // `unknownHandler`.\n\n  // To do: next major: move to `state.options.allowDangerousHtml`.\n  state.dangerous = dangerous\n  // To do: next major: move to `state.options`.\n  state.clobberPrefix =\n    settings.clobberPrefix === undefined || settings.clobberPrefix === null\n      ? 'user-content-'\n      : settings.clobberPrefix\n  // To do: next major: move to `state.options`.\n  state.footnoteLabel = settings.footnoteLabel || 'Footnotes'\n  // To do: next major: move to `state.options`.\n  state.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'\n  // To do: next major: move to `state.options`.\n  state.footnoteLabelProperties = settings.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  // To do: next major: move to `state.options`.\n  state.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'\n  // To do: next major: move to `state.options`.\n  state.unknownHandler = settings.unknownHandler\n  // To do: next major: move to `state.options`.\n  state.passThrough = settings.passThrough\n\n  state.handlers = {...handlers, ...settings.handlers}\n\n  // To do: next major: replace utility with `definitionById` object, so we\n  // only walk once (as we need footnotes too).\n  state.definition = definitions(tree)\n  state.footnoteById = footnoteById\n  /** @type {Array} */\n  state.footnoteOrder = []\n  /** @type {Record} */\n  state.footnoteCounts = {}\n\n  state.patch = patch\n  state.applyData = applyData\n  state.one = oneBound\n  state.all = allBound\n  state.wrap = wrap\n  // To do: next major: remove `augment`.\n  state.augment = augment\n\n  visit(tree, 'footnoteDefinition', (definition) => {\n    const id = String(definition.identifier).toUpperCase()\n\n    // Mimick CM behavior of link definitions.\n    // See: .\n    if (!own.call(footnoteById, id)) {\n      footnoteById[id] = definition\n    }\n  })\n\n  // @ts-expect-error Hush, it\u2019s fine!\n  return state\n\n  /**\n   * Finalise the created `right`, a hast node, from `left`, an mdast node.\n   *\n   * @param {MdastNodeWithData | PositionLike | null | undefined} left\n   * @param {HastElementContent} right\n   * @returns {HastElementContent}\n   */\n  /* c8 ignore start */\n  // To do: next major: remove.\n  function augment(left, right) {\n    // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n    if (left && 'data' in left && left.data) {\n      /** @type {MdastData} */\n      const data = left.data\n\n      if (data.hName) {\n        if (right.type !== 'element') {\n          right = {\n            type: 'element',\n            tagName: '',\n            properties: {},\n            children: []\n          }\n        }\n\n        right.tagName = data.hName\n      }\n\n      if (right.type === 'element' && data.hProperties) {\n        right.properties = {...right.properties, ...data.hProperties}\n      }\n\n      if ('children' in right && right.children && data.hChildren) {\n        right.children = data.hChildren\n      }\n    }\n\n    if (left) {\n      const ctx = 'type' in left ? left : {position: left}\n\n      if (!generated(ctx)) {\n        // @ts-expect-error: fine.\n        right.position = {start: pointStart(ctx), end: pointEnd(ctx)}\n      }\n    }\n\n    return right\n  }\n  /* c8 ignore stop */\n\n  /**\n   * Create an element for `node`.\n   *\n   * @type {HFunctionProps}\n   */\n  /* c8 ignore start */\n  // To do: next major: remove.\n  function state(node, tagName, props, children) {\n    if (Array.isArray(props)) {\n      children = props\n      props = {}\n    }\n\n    // @ts-expect-error augmenting an element yields an element.\n    return augment(node, {\n      type: 'element',\n      tagName,\n      properties: props || {},\n      children: children || []\n    })\n  }\n  /* c8 ignore stop */\n\n  /**\n   * Transform an mdast node into a hast node.\n   *\n   * @param {MdastNodes} node\n   *   mdast node.\n   * @param {MdastParents | null | undefined} [parent]\n   *   Parent of `node`.\n   * @returns {HastElementContent | Array | null | undefined}\n   *   Resulting hast node.\n   */\n  function oneBound(node, parent) {\n    // @ts-expect-error: that\u2019s a state :)\n    return one(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 allBound(parent) {\n    // @ts-expect-error: that\u2019s a state :)\n    return all(state, parent)\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 {void}\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 {Type | HastElement}\n *   Nothing.\n */\nfunction applyData(from, to) {\n  /** @type {Type | HastElement} */\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 is likely to keep the content around (otherwise: pass\n      // `hChildren`).\n      else {\n        result = {\n          type: 'element',\n          tagName: hName,\n          properties: {},\n          children: []\n        }\n\n        // To do: next major: take the children from the `root`, or inject the\n        // raw/text/comment or so into the element?\n        // if ('children' in node) {\n        //   // @ts-expect-error: assume `children` are allowed in elements.\n        //   result.children = node.children\n        // } else {\n        //   // @ts-expect-error: assume `node` is allowed in elements.\n        //   result.children.push(node)\n        // }\n      }\n    }\n\n    if (result.type === 'element' && hProperties) {\n      result.properties = {...result.properties, ...hProperties}\n    }\n\n    if (\n      'children' in result &&\n      result.children &&\n      hChildren !== null &&\n      hChildren !== undefined\n    ) {\n      // @ts-expect-error: assume valid children are defined.\n      result.children = hChildren\n    }\n  }\n\n  return result\n}\n\n/**\n * Transform an mdast node into a hast node.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} node\n *   mdast node.\n * @param {MdastParents | null | undefined} [parent]\n *   Parent of `node`.\n * @returns {HastElementContent | Array | null | undefined}\n *   Resulting hast node.\n */\n// To do: next major: do not expose, keep bound.\nexport function one(state, node, parent) {\n  const type = node && node.type\n\n  // Fail on non-nodes.\n  if (!type) {\n    throw new Error('Expected node, got `' + node + '`')\n  }\n\n  if (own.call(state.handlers, type)) {\n    return state.handlers[type](state, node, parent)\n  }\n\n  if (state.passThrough && state.passThrough.includes(type)) {\n    // To do: next major: deep clone.\n    // @ts-expect-error: types of passed through nodes are expected to be added manually.\n    return 'children' in node ? {...node, children: all(state, node)} : node\n  }\n\n  if (state.unknownHandler) {\n    return state.unknownHandler(state, node, parent)\n  }\n\n  return defaultUnknownHandler(state, node)\n}\n\n/**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} parent\n *   mdast node to compile\n * @returns {Array}\n *   Resulting hast nodes.\n */\n// To do: next major: do not expose, keep bound.\nexport function all(state, 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 = one(state, 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 = result.value.replace(/^\\s+/, '')\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 = head.value.replace(/^\\s+/, '')\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 * Transform an unknown node.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} node\n *   Unknown mdast node.\n * @returns {HastText | HastElement}\n *   Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n  const data = node.data || {}\n  /** @type {HastText | HastElement} */\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: all(state, 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 {HastContent} Type\n *   Node type.\n * @param {Array} nodes\n *   List of nodes to wrap.\n * @param {boolean | null | undefined} [loose=false]\n *   Whether to add line endings at start and end.\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n *\n * @typedef {import('./state.js').State} State\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\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 */\nexport function footer(state) {\n  /** @type {Array} */\n  const listItems = []\n  let index = -1\n\n  while (++index < state.footnoteOrder.length) {\n    const def = state.footnoteById[state.footnoteOrder[index]]\n\n    if (!def) {\n      continue\n    }\n\n    const content = state.all(def)\n    const id = String(def.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let referenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n\n    while (++referenceIndex <= state.footnoteCounts[id]) {\n      /** @type {Element} */\n      const backReference = {\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            state.clobberPrefix +\n            'fnref-' +\n            safeId +\n            (referenceIndex > 1 ? '-' + referenceIndex : ''),\n          dataFootnoteBackref: true,\n          className: ['data-footnote-backref'],\n          ariaLabel: state.footnoteBackLabel\n        },\n        children: [{type: 'text', value: '\u21A9'}]\n      }\n\n      if (referenceIndex > 1) {\n        backReference.children.push({\n          type: 'element',\n          tagName: 'sup',\n          children: [{type: 'text', value: String(referenceIndex)}]\n        })\n      }\n\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      backReferences.push(backReference)\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: state.clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(def, 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: state.footnoteLabelTagName,\n        properties: {\n          // To do: use structured clone.\n          ...JSON.parse(JSON.stringify(state.footnoteLabelProperties)),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: state.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 * @typedef {import('hast').Content} HastContent\n * @typedef {import('hast').Root} HastRoot\n *\n * @typedef {import('mdast').Content} MdastContent\n * @typedef {import('mdast').Root} MdastRoot\n *\n * @typedef {import('./state.js').Options} Options\n */\n\n/**\n * @typedef {HastRoot | HastContent} HastNodes\n * @typedef {MdastRoot | MdastContent} MdastNodes\n */\n\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.\n * @returns {HastNodes | null | undefined}\n * hast tree.\n */\n// To do: next major: always return a single `root`.\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, null)\n const foot = footer(state)\n\n if (foot) {\n // @ts-expect-error If there\u2019s a footer, there were definitions, meaning block\n // content.\n // So assume `node` is a parent node.\n node.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n // To do: next major: always return root?\n return Array.isArray(node) ? {type: 'root', children: node} : node\n}\n", "/**\n * @typedef {import('hast').Root} HastRoot\n * @typedef {import('mdast').Root} MdastRoot\n * @typedef {import('mdast-util-to-hast').Options} Options\n * @typedef {import('unified').Processor} Processor\n *\n * @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n// Note: the `` overload doesn\u2019t seem to work :'(\n\n/**\n * Plugin that turns markdown into HTML to support rehype.\n *\n * * If a destination processor is given, that processor runs with a new HTML\n * (hast) tree (bridge-mode).\n * As the given processor runs with a hast tree, and rehype plugins support\n * hast, that means rehype plugins can be used with the given processor.\n * The hast tree is discarded in the end.\n * It\u2019s highly unlikely that you want to do this.\n * * The common case is to not pass a destination processor, in which case the\n * current processor continues running with a new HTML (hast) tree\n * (mutate-mode).\n * As the current processor continues with a hast tree, and rehype plugins\n * support hast, that means rehype plugins can be used after\n * `remark-rehype`.\n * It\u2019s likely that this is what you want to do.\n *\n * @param destination\n * Optional unified processor.\n * @param options\n * Options passed to `mdast-util-to-hast`.\n */\nconst remarkRehype =\n /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */\n (\n function (destination, options) {\n return destination && 'run' in destination\n ? bridge(destination, options)\n : mutate(destination || options)\n }\n )\n\nexport default remarkRehype\n\n/**\n * Bridge-mode.\n * Runs the destination with the new hast tree.\n *\n * @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}\n */\nfunction bridge(destination, options) {\n return (node, file, next) => {\n destination.run(toHast(node, options), file, (error) => {\n next(error)\n })\n }\n}\n\n/**\n * Mutate-mode.\n * Further plugins run on the hast tree.\n *\n * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}\n */\nfunction mutate(options) {\n // @ts-expect-error: assume a corresponding node is returned by `toHast`.\n return (node) => toHast(node, options)\n}\n", "/**\n * @typedef {import('./info.js').Info} Info\n * @typedef {Record} Properties\n * @typedef {Record} Normal\n */\n\nexport class Schema {\n /**\n * @constructor\n * @param {Properties} property\n * @param {Normal} normal\n * @param {string} [space]\n */\n constructor(property, normal, space) {\n this.property = property\n this.normal = normal\n if (space) {\n this.space = space\n }\n }\n}\n\n/** @type {Properties} */\nSchema.prototype.property = {}\n/** @type {Normal} */\nSchema.prototype.normal = {}\n/** @type {string|null} */\nSchema.prototype.space = null\n", "/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {Schema[]} definitions\n * @param {string} [space]\n * @returns {Schema}\n */\nexport function merge(definitions, space) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n let index = -1\n\n while (++index < definitions.length) {\n Object.assign(property, definitions[index].property)\n Object.assign(normal, definitions[index].normal)\n }\n\n return new Schema(property, normal, space)\n}\n", "/**\n * @param {string} value\n * @returns {string}\n */\nexport function normalize(value) {\n return value.toLowerCase()\n}\n", "export class Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n */\n constructor(property, attribute) {\n /** @type {string} */\n this.property = property\n /** @type {string} */\n this.attribute = attribute\n }\n}\n\n/** @type {string|null} */\nInfo.prototype.space = null\nInfo.prototype.boolean = false\nInfo.prototype.booleanish = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.number = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.spaceSeparated = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.defined = false\n", "let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n return 2 ** ++powers\n}\n", "import {Info} from './info.js'\nimport * as types from './types.js'\n\n/** @type {Array} */\n// @ts-expect-error: hush.\nconst checks = Object.keys(types)\n\nexport class DefinedInfo extends Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n * @param {number|null} [mask]\n * @param {string} [space]\n */\n constructor(property, attribute, mask, space) {\n let index = -1\n\n super(property, attribute)\n\n mark(this, 'space', space)\n\n if (typeof mask === 'number') {\n while (++index < checks.length) {\n const check = checks[index]\n mark(this, checks[index], (mask & types[check]) === types[check])\n }\n }\n }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @param {DefinedInfo} values\n * @param {string} key\n * @param {unknown} value\n */\nfunction mark(values, key, value) {\n if (value) {\n // @ts-expect-error: assume `value` matches the expected value of `key`.\n values[key] = value\n }\n}\n", "/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n *\n * @typedef {Record} Attributes\n *\n * @typedef {Object} Definition\n * @property {Record} properties\n * @property {(attributes: Attributes, property: string) => string} transform\n * @property {string} [space]\n * @property {Attributes} [attributes]\n * @property {Array} [mustUseProperty]\n */\n\nimport {normalize} from '../normalize.js'\nimport {Schema} from './schema.js'\nimport {DefinedInfo} from './defined-info.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {Definition} definition\n * @returns {Schema}\n */\nexport function create(definition) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n /** @type {string} */\n let prop\n\n for (prop in definition.properties) {\n if (own.call(definition.properties, prop)) {\n const value = definition.properties[prop]\n const info = new DefinedInfo(\n prop,\n definition.transform(definition.attributes || {}, prop),\n value,\n definition.space\n )\n\n if (\n definition.mustUseProperty &&\n definition.mustUseProperty.includes(prop)\n ) {\n info.mustUseProperty = true\n }\n\n property[prop] = info\n\n normal[normalize(prop)] = prop\n normal[normalize(info.attribute)] = prop\n }\n }\n\n return new Schema(property, normal, definition.space)\n}\n", "import {create} from './util/create.js'\n\nexport const xlink = create({\n space: 'xlink',\n transform(_, prop) {\n return 'xlink:' + prop.slice(5).toLowerCase()\n },\n properties: {\n xLinkActuate: null,\n xLinkArcRole: null,\n xLinkHref: null,\n xLinkRole: null,\n xLinkShow: null,\n xLinkTitle: null,\n xLinkType: null\n }\n})\n", "import {create} from './util/create.js'\n\nexport const xml = create({\n space: 'xml',\n transform(_, prop) {\n return 'xml:' + prop.slice(3).toLowerCase()\n },\n properties: {xmlLang: null, xmlBase: null, xmlSpace: null}\n})\n", "/**\n * @param {Record} attributes\n * @param {string} attribute\n * @returns {string}\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n return attribute in attributes ? attributes[attribute] : attribute\n}\n", "import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record} attributes\n * @param {string} property\n * @returns {string}\n */\nexport function caseInsensitiveTransform(attributes, property) {\n return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n", "import {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const xmlns = create({\n space: 'xmlns',\n attributes: {xmlnsxlink: 'xmlns:xlink'},\n transform: caseInsensitiveTransform,\n properties: {xmlns: null, xmlnsXLink: null}\n})\n", "import {booleanish, number, spaceSeparated} from './util/types.js'\nimport {create} from './util/create.js'\n\nexport const aria = create({\n transform(_, prop) {\n return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()\n },\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: booleanish,\n ariaAutoComplete: null,\n ariaBusy: booleanish,\n ariaChecked: booleanish,\n ariaColCount: number,\n ariaColIndex: number,\n ariaColSpan: number,\n ariaControls: spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: spaceSeparated,\n ariaDetails: null,\n ariaDisabled: booleanish,\n ariaDropEffect: spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: booleanish,\n ariaFlowTo: spaceSeparated,\n ariaGrabbed: booleanish,\n ariaHasPopup: null,\n ariaHidden: booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: spaceSeparated,\n ariaLevel: number,\n ariaLive: null,\n ariaModal: booleanish,\n ariaMultiLine: booleanish,\n ariaMultiSelectable: booleanish,\n ariaOrientation: null,\n ariaOwns: spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: number,\n ariaPressed: booleanish,\n ariaReadOnly: booleanish,\n ariaRelevant: null,\n ariaRequired: booleanish,\n ariaRoleDescription: spaceSeparated,\n ariaRowCount: number,\n ariaRowIndex: number,\n ariaRowSpan: number,\n ariaSelected: booleanish,\n ariaSetSize: number,\n ariaSort: null,\n ariaValueMax: number,\n ariaValueMin: number,\n ariaValueNow: number,\n ariaValueText: null,\n role: null\n }\n})\n", "import {\n boolean,\n overloadedBoolean,\n booleanish,\n number,\n spaceSeparated,\n commaSeparated\n} from './util/types.js'\nimport {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const html = create({\n space: 'html',\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n transform: caseInsensitiveTransform,\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: commaSeparated,\n acceptCharset: spaceSeparated,\n accessKey: spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: boolean,\n allowPaymentRequest: boolean,\n allowUserMedia: boolean,\n alt: null,\n as: null,\n async: boolean,\n autoCapitalize: null,\n autoComplete: spaceSeparated,\n autoFocus: boolean,\n autoPlay: boolean,\n capture: boolean,\n charSet: null,\n checked: boolean,\n cite: null,\n className: spaceSeparated,\n cols: number,\n colSpan: null,\n content: null,\n contentEditable: booleanish,\n controls: boolean,\n controlsList: spaceSeparated,\n coords: number | commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: boolean,\n defer: boolean,\n dir: null,\n dirName: null,\n disabled: boolean,\n download: overloadedBoolean,\n draggable: booleanish,\n encType: null,\n enterKeyHint: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: boolean,\n formTarget: null,\n headers: spaceSeparated,\n height: number,\n hidden: boolean,\n high: number,\n href: null,\n hrefLang: null,\n htmlFor: spaceSeparated,\n httpEquiv: spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: boolean,\n itemId: null,\n itemProp: spaceSeparated,\n itemRef: spaceSeparated,\n itemScope: boolean,\n itemType: spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: boolean,\n low: number,\n manifest: null,\n max: null,\n maxLength: number,\n media: null,\n method: null,\n min: null,\n minLength: number,\n multiple: boolean,\n muted: boolean,\n name: null,\n nonce: null,\n noModule: boolean,\n noValidate: boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: boolean,\n optimum: number,\n pattern: null,\n ping: spaceSeparated,\n placeholder: null,\n playsInline: boolean,\n poster: null,\n preload: null,\n readOnly: boolean,\n referrerPolicy: null,\n rel: spaceSeparated,\n required: boolean,\n reversed: boolean,\n rows: number,\n rowSpan: number,\n sandbox: spaceSeparated,\n scope: null,\n scoped: boolean,\n seamless: boolean,\n selected: boolean,\n shape: null,\n size: number,\n sizes: null,\n slot: null,\n span: number,\n spellCheck: booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: number,\n step: null,\n style: null,\n tabIndex: number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: boolean,\n useMap: null,\n value: booleanish,\n width: number,\n wrap: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: spaceSeparated, // ``. List of URIs to archives\n axis: null, // `` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `\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 effects.consume(code)\n // @ts-expect-error: not null.\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 * @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 * @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", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\nimport {factorySpace} from 'micromark-factory-space'\nimport {\n asciiAlpha,\n asciiAlphanumeric,\n markdownLineEnding,\n markdownLineEndingOrSpace,\n markdownSpace\n} from 'micromark-util-character'\n/** @type {Construct} */\nexport const htmlText = {\n name: 'htmlText',\n tokenize: tokenizeHtmlText\n}\n\n/**\n * @this {TokenizeContext}\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\n ? end(code)\n : code === 45\n ? commentClose(code)\n : 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 (\n code === 45 ||\n code === 46 ||\n code === 58 ||\n code === 95 ||\n asciiAlphanumeric(code)\n ) {\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 (\n code === null ||\n code === 60 ||\n code === 61 ||\n code === 62 ||\n code === 96\n ) {\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 (\n code === null ||\n code === 34 ||\n code === 39 ||\n code === 60 ||\n code === 61 ||\n code === 96\n ) {\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)\n ? factorySpace(\n effects,\n lineEndingAfterPrefix,\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )(code)\n : 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", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 tokenize: tokenizeLabelEnd,\n resolveTo: resolveToLabelEnd,\n resolveAll: resolveAllLabelEnd\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 while (++index < events.length) {\n const token = events[index][1]\n if (\n token.type === 'labelImage' ||\n token.type === 'labelLink' ||\n token.type === 'labelEnd'\n ) {\n // Remove the marker.\n events.splice(index + 1, token.type === 'labelImage' ? 4 : 2)\n token.type = 'data'\n index++\n }\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 (\n token.type === 'link' ||\n (token.type === 'labelLink' && token._inactive)\n ) {\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 (\n events[index][0] === 'enter' &&\n (token.type === 'labelImage' || token.type === 'labelLink') &&\n !token._balanced\n ) {\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: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\n }\n const label = {\n type: 'label',\n start: Object.assign({}, events[open][1].start),\n end: Object.assign({}, events[close][1].end)\n }\n const text = {\n type: 'labelText',\n start: Object.assign({}, events[open + offset + 2][1].end),\n end: Object.assign({}, events[close - 2][1].start)\n }\n media = [\n ['enter', group, context],\n ['enter', label, context]\n ]\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(\n media,\n resolveAll(\n context.parser.constructs.insideSpan.null,\n events.slice(open + offset + 4, close - 3),\n context\n )\n )\n\n // Text close, marker close, label close.\n media = push(media, [\n ['exit', text, context],\n events[close - 2],\n events[close - 1],\n ['exit', label, context]\n ])\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 * @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 (\n (self.events[index][1].type === 'labelImage' ||\n self.events[index][1].type === 'labelLink') &&\n !self.events[index][1]._balanced\n ) {\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(\n normalizeIdentifier(\n self.sliceSerialize({\n start: labelStart.end,\n end: self.now()\n })\n )\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(\n resourceConstruct,\n labelEndOk,\n defined ? labelEndOk : labelEndNok\n )(code)\n }\n\n // Full (`[asd][fgh]`) or collapsed (`[asd][]`) reference?\n if (code === 91) {\n return effects.attempt(\n referenceFullConstruct,\n labelEndOk,\n defined ? referenceNotFull : labelEndNok\n )(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(\n referenceCollapsedConstruct,\n labelEndOk,\n labelEndNok\n )(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 * @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)\n ? factoryWhitespace(effects, resourceOpen)(code)\n : 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(\n effects,\n resourceDestinationAfter,\n resourceDestinationMissing,\n 'resourceDestination',\n 'resourceDestinationLiteral',\n 'resourceDestinationLiteralMarker',\n 'resourceDestinationRaw',\n 'resourceDestinationString',\n 32\n )(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)\n ? factoryWhitespace(effects, resourceBetween)(code)\n : 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(\n effects,\n resourceTitleAfter,\n nok,\n 'resourceTitle',\n 'resourceTitleMarker',\n 'resourceTitleString'\n )(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)\n ? factoryWhitespace(effects, resourceEnd)(code)\n : 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 * @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(\n self,\n effects,\n referenceFullAfter,\n referenceFullMissing,\n 'reference',\n 'referenceMarker',\n 'referenceString'\n )(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(\n normalizeIdentifier(\n self.sliceSerialize(self.events[self.events.length - 1][1]).slice(1, -1)\n )\n )\n ? ok(code)\n : 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 * @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", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\nimport {labelEnd} from './label-end.js'\n\n/** @type {Construct} */\nexport const labelStartImage = {\n name: 'labelStartImage',\n tokenize: tokenizeLabelStartImage,\n resolveAll: labelEnd.resolveAll\n}\n\n/**\n * @this {TokenizeContext}\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\n ? nok(code)\n : ok(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\n */\n\nimport {labelEnd} from './label-end.js'\n\n/** @type {Construct} */\nexport const labelStartLink = {\n name: 'labelStartLink',\n tokenize: tokenizeLabelStartLink,\n resolveAll: labelEnd.resolveAll\n}\n\n/**\n * @this {TokenizeContext}\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\n ? nok(code)\n : ok(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 * @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", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 * @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)\n ? factorySpace(effects, atBreak, 'whitespace')(code)\n : atBreak(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ContainerState} ContainerState\n * @typedef {import('micromark-util-types').Exiter} Exiter\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 name: 'list',\n tokenize: tokenizeListStart,\n continuation: {\n tokenize: tokenizeListContinuation\n },\n exit: tokenizeListEnd\n}\n\n/** @type {Construct} */\nconst listItemPrefixWhitespaceConstruct = {\n tokenize: tokenizeListItemPrefixWhitespace,\n partial: true\n}\n\n/** @type {Construct} */\nconst indentConstruct = {\n tokenize: tokenizeIndent,\n partial: true\n}\n\n// To do: `markdown-rs` parses list items on their own and later stitches them\n// together.\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListStart(effects, ok, nok) {\n const self = this\n const tail = self.events[self.events.length - 1]\n let initialSize =\n tail && tail[1].type === 'linePrefix'\n ? tail[2].sliceSerialize(tail[1], true).length\n : 0\n let size = 0\n return start\n\n /** @type {State} */\n function start(code) {\n const kind =\n self.containerState.type ||\n (code === 42 || code === 43 || code === 45\n ? 'listUnordered'\n : 'listOrdered')\n if (\n kind === 'listUnordered'\n ? !self.containerState.marker || code === self.containerState.marker\n : asciiDigit(code)\n ) {\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\n ? effects.check(thematicBreak, nok, atMarker)(code)\n : 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 (\n (!self.interrupt || size < 2) &&\n (self.containerState.marker\n ? code === self.containerState.marker\n : code === 41 || code === 46)\n ) {\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(\n blankLine,\n // Can\u2019t be empty when interrupting.\n self.interrupt ? nok : onBlank,\n effects.attempt(\n listItemPrefixWhitespaceConstruct,\n endOfPrefix,\n otherPrefix\n )\n )\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 =\n initialSize +\n self.sliceSerialize(effects.exit('listItemPrefix'), true).length\n return ok(code)\n }\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\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 =\n self.containerState.furtherBlankLines ||\n self.containerState.initialBlankLine\n\n // We have a blank line.\n // Still, try to consume at most the items size.\n return factorySpace(\n effects,\n ok,\n 'listItemIndent',\n self.containerState.size + 1\n )(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(\n effects,\n effects.attempt(list, ok, nok),\n 'linePrefix',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4\n )(code)\n }\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeIndent(effects, ok, nok) {\n const self = this\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemIndent',\n self.containerState.size + 1\n )\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return tail &&\n tail[1].type === 'listItemIndent' &&\n tail[2].sliceSerialize(tail[1], true).length === self.containerState.size\n ? ok(code)\n : nok(code)\n }\n}\n\n/**\n * @type {Exiter}\n * @this {TokenizeContext}\n */\nfunction tokenizeListEnd(effects) {\n effects.exit(this.containerState.type)\n}\n\n/**\n * @type {Tokenizer}\n * @this {TokenizeContext}\n */\nfunction tokenizeListItemPrefixWhitespace(effects, ok, nok) {\n const self = this\n\n // Always populated by defaults.\n\n return factorySpace(\n effects,\n afterPrefix,\n 'listItemPrefixWhitespace',\n self.parser.constructs.disable.null.includes('codeIndented')\n ? undefined\n : 4 + 1\n )\n\n /** @type {State} */\n function afterPrefix(code) {\n const tail = self.events[self.events.length - 1]\n return !markdownSpace(code) &&\n tail &&\n tail[1].type === 'listItemPrefixWhitespace'\n ? ok(code)\n : nok(code)\n }\n}\n", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Tokenizer} Tokenizer\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 tokenize: tokenizeSetextUnderline,\n resolveTo: resolveToSetextUnderline\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: Object.assign({}, events[text][1].start),\n end: Object.assign({}, events[events.length - 1][1].end)\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 = Object.assign({}, events[definition][1].end)\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 * @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 (\n self.events[index][1].type !== 'lineEnding' &&\n self.events[index][1].type !== 'linePrefix' &&\n self.events[index][1].type !== 'content'\n ) {\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)\n ? factorySpace(effects, after, 'lineSuffix')(code)\n : 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", "/**\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\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 * @type {Initializer}\n */\nfunction initializeFlow(effects) {\n const self = this\n const initial = effects.attempt(\n // Try to parse a blank line.\n blankLine,\n atBlankEnding,\n // Try to parse initial flow (essentially, only code).\n effects.attempt(\n this.parser.constructs.flowInitial,\n afterConstruct,\n factorySpace(\n effects,\n effects.attempt(\n this.parser.constructs.flow,\n afterConstruct,\n effects.attempt(content, afterConstruct)\n ),\n 'linePrefix'\n )\n )\n )\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", "/**\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').Initializer} Initializer\n * @typedef {import('micromark-util-types').Resolver} Resolver\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\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 * @returns {InitialConstruct}\n */\nfunction initializeFactory(field) {\n return {\n tokenize: initializeText,\n resolveAll: createResolver(\n field === 'text' ? resolveAllLineSuffixes : undefined\n )\n }\n\n /**\n * @this {TokenizeContext}\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 * @returns {boolean}\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 * @returns {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 (\n (eventIndex === events.length ||\n events[eventIndex][1].type === 'lineEnding') &&\n events[eventIndex - 1][1].type === 'data'\n ) {\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 if (size) {\n const token = {\n type:\n eventIndex === events.length || tabs || size < 2\n ? 'lineSuffix'\n : 'hardBreakTrailing',\n start: {\n line: data.end.line,\n column: data.end.column - size,\n offset: data.end.offset - size,\n _index: data.start._index + index,\n _bufferIndex: index\n ? bufferIndex\n : data.start._bufferIndex + bufferIndex\n },\n end: Object.assign({}, data.end)\n }\n data.end = Object.assign({}, token.start)\n if (data.start.offset === data.end.offset) {\n Object.assign(data, token)\n } else {\n events.splice(\n eventIndex,\n 0,\n ['enter', token, context],\n ['exit', token, context]\n )\n eventIndex += 2\n }\n }\n eventIndex++\n }\n }\n return events\n}\n", "/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Construct} Construct\n * @typedef {import('micromark-util-types').ConstructRecord} ConstructRecord\n * @typedef {import('micromark-util-types').Effects} Effects\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').Point} Point\n * @typedef {import('micromark-util-types').State} State\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenType} TokenType\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n */\n\n/**\n * @callback Restore\n * @returns {void}\n *\n * @typedef Info\n * @property {Restore} restore\n * @property {number} from\n *\n * @callback ReturnHandle\n * Handle a successful run.\n * @param {Construct} construct\n * @param {Info} info\n * @returns {void}\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 * @param {InitialConstruct} initialize\n * @param {Omit | undefined} [from]\n * @returns {TokenizeContext}\n */\nexport function createTokenizer(parser, initialize, from) {\n /** @type {Point} */\n let point = Object.assign(\n from\n ? Object.assign({}, from)\n : {\n line: 1,\n column: 1,\n offset: 0\n },\n {\n _index: 0,\n _bufferIndex: -1\n }\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 consume,\n enter,\n exit,\n attempt: constructFactory(onsuccessfulconstruct),\n check: constructFactory(onsuccessfulcheck),\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 previous: null,\n code: null,\n containerState: {},\n events: [],\n parser,\n sliceStream,\n sliceSerialize,\n now,\n defineSkip,\n write\n }\n\n /**\n * The state function.\n *\n * @type {State | void}\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 {line, column, offset, _index, _bufferIndex} = point\n return {\n line,\n column,\n offset,\n _index,\n _bufferIndex\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 {void}\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 (\n point._index === chunkIndex &&\n point._bufferIndex < chunk.length\n ) {\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 * @returns {void}\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 // @ts-expect-error Points w/ non-negative `_bufferIndex` reference\n // strings.\n if (point._bufferIndex === 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 * @param {{interrupt?: boolean | undefined} | undefined} [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 | Construct | ConstructRecord} constructs\n * @param {State} returnState\n * @param {State | undefined} [bogusState]\n * @returns {State}\n */\n function hook(constructs, returnState, bogusState) {\n /** @type {Array} */\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)\n : 'tokenize' in constructs\n ? // @ts-expect-error Looks like a construct.\n handleListOfConstructs([constructs])\n : handleMapOfConstructs(constructs)\n\n /**\n * Handle a list of construct.\n *\n * @param {ConstructRecord} map\n * @returns {State}\n */\n function handleMapOfConstructs(map) {\n return start\n\n /** @type {State} */\n function start(code) {\n const def = 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(def) ? def : def ? [def] : []),\n ...(Array.isArray(all) ? all : all ? [all] : [])\n ]\n return handleListOfConstructs(list)(code)\n }\n }\n\n /**\n * Handle a list of construct.\n *\n * @param {Array} list\n * @returns {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 * @returns {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 (\n construct.name &&\n context.parser.constructs.disable.null.includes(construct.name)\n ) {\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,\n effects,\n ok,\n nok\n )(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 * @param {number} from\n * @returns {void}\n */\n function addResult(construct, from) {\n if (construct.resolveAll && !resolveAllConstructs.includes(construct)) {\n resolveAllConstructs.push(construct)\n }\n if (construct.resolve) {\n splice(\n context.events,\n from,\n context.events.length - from,\n construct.resolve(context.events.slice(from), context)\n )\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 */\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 restore,\n from: startEventsIndex\n }\n\n /**\n * Restore state.\n *\n * @returns {void}\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 {void}\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 {Array} chunks\n * @param {Pick} token\n * @returns {Array}\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 } 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 {Array} chunks\n * @param {boolean | undefined} [expandTabs=false]\n * @returns {string}\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\n switch (chunk) {\n case -5: {\n value = '\\r'\n break\n }\n case -4: {\n value = '\\n'\n break\n }\n case -3: {\n value = '\\r' + '\\n'\n break\n }\n case -2: {\n value = expandTabs ? ' ' : '\\t'\n break\n }\n case -1: {\n if (!expandTabs && atTab) continue\n value = ' '\n break\n }\n default: {\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", "/**\n * @typedef {import('micromark-util-types').Extension} Extension\n */\n\nimport {\n attention,\n autolink,\n blockQuote,\n characterEscape,\n characterReference,\n codeFenced,\n codeIndented,\n codeText,\n definition,\n hardBreakEscape,\n headingAtx,\n htmlFlow,\n htmlText,\n labelEnd,\n labelStartImage,\n labelStartLink,\n lineEnding,\n list,\n setextUnderline,\n thematicBreak\n} 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", "/**\n * @typedef {import('micromark-util-types').Create} Create\n * @typedef {import('micromark-util-types').FullNormalizedExtension} FullNormalizedExtension\n * @typedef {import('micromark-util-types').InitialConstruct} InitialConstruct\n * @typedef {import('micromark-util-types').ParseContext} ParseContext\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\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 {text, string} from './initialize/text.js'\nimport {createTokenizer} from './create-tokenizer.js'\nimport * as defaultConstructs from './constructs.js'\n\n/**\n * @param {ParseOptions | null | undefined} [options]\n * @returns {ParseContext}\n */\nexport function parse(options) {\n const settings = options || {}\n const constructs =\n /** @type {FullNormalizedExtension} */\n combineExtensions([defaultConstructs, ...(settings.extensions || [])])\n\n /** @type {ParseContext} */\n const parser = {\n defined: [],\n lazy: {},\n constructs,\n content: create(content),\n document: create(document),\n flow: create(flow),\n string: create(string),\n text: create(text)\n }\n return parser\n\n /**\n * @param {InitialConstruct} initial\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", "/**\n * @typedef {import('micromark-util-types').Chunk} Chunk\n * @typedef {import('micromark-util-types').Code} Code\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Value} Value\n */\n\n/**\n * @callback Preprocessor\n * @param {Value} value\n * @param {Encoding | null | undefined} [encoding]\n * @param {boolean | null | undefined} [end=false]\n * @returns {Array}\n */\n\nconst search = /[\\0\\t\\n\\r]/g\n\n/**\n * @returns {Preprocessor}\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 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\n // @ts-expect-error `Buffer` does allow an encoding.\n value = buffer + value.toString(encoding)\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 =\n 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 chunks.push(65533)\n column++\n break\n }\n case 9: {\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 chunks.push(-4)\n column = 1\n break\n }\n default: {\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}\n", "/**\n * @typedef {import('micromark-util-types').Event} Event\n */\n\nimport {subtokenize} from 'micromark-util-subtokenize'\n\n/**\n * @param {Array} events\n * @returns {Array}\n */\nexport function postprocess(events) {\n while (!subtokenize(events)) {\n // Empty\n }\n return events\n}\n", "/**\n * Turn the number (in string form as either hexa- or plain decimal) coming from\n * a numeric character reference into a character.\n *\n * Sort of like `String.fromCharCode(Number.parseInt(value, base))`, but makes\n * non-characters and control characters safe.\n *\n * @param {string} value\n * Value to decode.\n * @param {number} base\n * Numeric base.\n * @returns {string}\n * Character.\n */\nexport function decodeNumericCharacterReference(value, base) {\n const code = Number.parseInt(value, base)\n if (\n // C0 except for HT, LF, FF, CR, space.\n code < 9 ||\n code === 11 ||\n (code > 13 && code < 32) ||\n // Control character (DEL) of C0, and C1 controls.\n (code > 126 && code < 160) ||\n // Lone high surrogates and low surrogates.\n (code > 55295 && code < 57344) ||\n // Noncharacters.\n (code > 64975 && code < 65008) /* eslint-disable no-bitwise */ ||\n (code & 65535) === 65535 ||\n (code & 65535) === 65534 /* eslint-enable no-bitwise */ ||\n // Out of range\n code > 1114111\n ) {\n return '\\uFFFD'\n }\n return String.fromCharCode(code)\n}\n", "import {decodeNamedCharacterReference} from 'decode-named-character-reference'\nimport {decodeNumericCharacterReference} from 'micromark-util-decode-numeric-character-reference'\nconst characterEscapeOrReference =\n /\\\\([!-/:-@[-`{-~])|&(#(?:\\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 * @param {string} $1\n * @param {string} $2\n * @returns {string}\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", "/**\n * @typedef {import('micromark-util-types').Encoding} Encoding\n * @typedef {import('micromark-util-types').Event} Event\n * @typedef {import('micromark-util-types').ParseOptions} ParseOptions\n * @typedef {import('micromark-util-types').Token} Token\n * @typedef {import('micromark-util-types').TokenizeContext} TokenizeContext\n * @typedef {import('micromark-util-types').Value} Value\n *\n * @typedef {import('unist').Parent} UnistParent\n * @typedef {import('unist').Point} Point\n *\n * @typedef {import('mdast').PhrasingContent} PhrasingContent\n * @typedef {import('mdast').StaticPhrasingContent} StaticPhrasingContent\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Break} Break\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('mdast').Code} Code\n * @typedef {import('mdast').Definition} Definition\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('mdast').HTML} HTML\n * @typedef {import('mdast').Image} Image\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('mdast').Link} Link\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('mdast').List} List\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('mdast').Text} Text\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n * @typedef {import('mdast').ReferenceType} ReferenceType\n * @typedef {import('../index.js').CompileData} CompileData\n */\n\n/**\n * @typedef {Root | Content} Node\n * @typedef {Extract} Parent\n *\n * @typedef {Omit & {type: 'fragment', children: Array}} Fragment\n */\n\n/**\n * @callback Transform\n * Extra transform, to change the AST afterwards.\n * @param {Root} tree\n * Tree to transform.\n * @returns {Root | undefined | null | void}\n * New tree or nothing (in which case the current tree is used).\n *\n * @callback Handle\n * Handle a token.\n * @param {CompileContext} this\n * Context.\n * @param {Token} token\n * Current token.\n * @returns {void}\n * Nothing.\n *\n * @typedef {Record} Handles\n * Token types mapping to handles\n *\n * @callback OnEnterError\n * Handle the case where the `right` token is open, but it is closed (by the\n * `left` token) or because we reached the end of the document.\n * @param {Omit} this\n * Context.\n * @param {Token | undefined} left\n * Left token.\n * @param {Token} right\n * Right token.\n * @returns {void}\n * Nothing.\n *\n * @callback OnExitError\n * Handle the case where the `right` token is open but it is closed by\n * exiting the `left` token.\n * @param {Omit} this\n * Context.\n * @param {Token} left\n * Left token.\n * @param {Token} right\n * Right token.\n * @returns {void}\n * Nothing.\n *\n * @typedef {[Token, OnEnterError | undefined]} TokenTuple\n * Open token on the stack, with an optional error handler for when\n * that token isn\u2019t closed properly.\n */\n\n/**\n * @typedef Config\n * Configuration.\n *\n * We have our defaults, but extensions will add more.\n * @property {Array} canContainEols\n * Token types where line endings are used.\n * @property {Handles} enter\n * Opening handles.\n * @property {Handles} exit\n * Closing handles.\n * @property {Array} transforms\n * Tree transforms.\n *\n * @typedef {Partial} Extension\n * Change how markdown tokens from micromark are turned into mdast.\n *\n * @typedef CompileContext\n * mdast compiler context.\n * @property {Array} stack\n * Stack of nodes.\n * @property {Array} tokenStack\n * Stack of tokens.\n * @property {(key: Key) => CompileData[Key]} getData\n * Get data from the key/value store.\n * @property {(key: Key, value?: CompileData[Key]) => void} setData\n * Set data into the key/value store.\n * @property {(this: CompileContext) => void} buffer\n * Capture some of the output data.\n * @property {(this: CompileContext) => string} resume\n * Stop capturing and access the output data.\n * @property {(this: CompileContext, node: Kind, token: Token, onError?: OnEnterError) => Kind} enter\n * Enter a token.\n * @property {(this: CompileContext, token: Token, onError?: OnExitError) => Node} exit\n * Exit a token.\n * @property {TokenizeContext['sliceSerialize']} sliceSerialize\n * Get the string value of a token.\n * @property {Config} config\n * Configuration.\n *\n * @typedef FromMarkdownOptions\n * Configuration for how to build mdast.\n * @property {Array> | null | undefined} [mdastExtensions]\n * Extensions for this utility to change how tokens are turned into a tree.\n *\n * @typedef {ParseOptions & FromMarkdownOptions} Options\n * Configuration.\n */\n\n// To do: micromark: create a registry of tokens?\n// To do: next major: don\u2019t return given `Node` from `enter`.\n// To do: next major: remove setter/getter.\n\nimport {toString} from 'mdast-util-to-string'\nimport {parse} from 'micromark/lib/parse.js'\nimport {preprocess} from 'micromark/lib/preprocess.js'\nimport {postprocess} from 'micromark/lib/postprocess.js'\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 * @param value\n * Markdown to parse.\n * @param encoding\n * Character encoding for when `value` is `Buffer`.\n * @param options\n * Configuration.\n * @returns\n * mdast tree.\n */\nexport const fromMarkdown =\n /**\n * @type {(\n * ((value: Value, encoding: Encoding, options?: Options | null | undefined) => Root) &\n * ((value: Value, options?: Options | null | undefined) => Root)\n * )}\n */\n\n /**\n * @param {Value} value\n * @param {Encoding | Options | null | undefined} [encoding]\n * @param {Options | null | undefined} [options]\n * @returns {Root}\n */\n function (value, encoding, options) {\n if (typeof encoding !== 'string') {\n options = encoding\n encoding = undefined\n }\n return compiler(options)(\n postprocess(\n parse(options).document().write(preprocess()(value, encoding, true))\n )\n )\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 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 setData,\n getData\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 (\n events[index][1].type === 'listOrdered' ||\n events[index][1].type === 'listUnordered'\n ) {\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(\n Object.assign(\n {\n sliceSerialize: events[index][2].sliceSerialize\n },\n context\n ),\n events[index][1]\n )\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(\n events.length > 0\n ? events[0][1].start\n : {\n line: 1,\n column: 1,\n offset: 0\n }\n ),\n end: point(\n events.length > 0\n ? events[events.length - 2][1].end\n : {\n line: 1,\n column: 1,\n offset: 0\n }\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 if (\n event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered' ||\n event[1].type === 'blockQuote'\n ) {\n if (event[0] === 'enter') {\n containerBalance++\n } else {\n containerBalance--\n }\n atMarker = undefined\n } else if (event[1].type === 'lineEndingBlank') {\n if (event[0] === 'enter') {\n if (\n listItem &&\n !atMarker &&\n !containerBalance &&\n !firstBlankLineIndex\n ) {\n firstBlankLineIndex = index\n }\n atMarker = undefined\n }\n } else if (\n event[1].type === 'linePrefix' ||\n event[1].type === 'listItemValue' ||\n event[1].type === 'listItemMarker' ||\n event[1].type === 'listItemPrefix' ||\n event[1].type === 'listItemPrefixWhitespace'\n ) {\n // Empty.\n } else {\n atMarker = undefined\n }\n if (\n (!containerBalance &&\n event[0] === 'enter' &&\n event[1].type === 'listItemPrefix') ||\n (containerBalance === -1 &&\n event[0] === 'exit' &&\n (event[1].type === 'listUnordered' ||\n event[1].type === 'listOrdered'))\n ) {\n if (listItem) {\n let tailIndex = index\n lineIndex = undefined\n while (tailIndex--) {\n const tailEvent = events[tailIndex]\n if (\n tailEvent[1].type === 'lineEnding' ||\n tailEvent[1].type === 'lineEndingBlank'\n ) {\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 (\n tailEvent[1].type === 'linePrefix' ||\n tailEvent[1].type === 'blockQuotePrefix' ||\n tailEvent[1].type === 'blockQuotePrefixWhitespace' ||\n tailEvent[1].type === 'blockQuoteMarker' ||\n tailEvent[1].type === 'listItemIndent'\n ) {\n // Empty\n } else {\n break\n }\n }\n if (\n firstBlankLineIndex &&\n (!lineIndex || firstBlankLineIndex < lineIndex)\n ) {\n listItem._spread = true\n }\n\n // Fix position.\n listItem.end = Object.assign(\n {},\n lineIndex ? events[lineIndex][1].start : event[1].end\n )\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 listItem = {\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 // @ts-expect-error: `listItem` is most definitely defined, TS...\n events.splice(index, 0, ['enter', listItem, 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 * Set data.\n *\n * @template {keyof CompileData} Key\n * Field type.\n * @param {Key} key\n * Key of field.\n * @param {CompileData[Key]} [value]\n * New value.\n * @returns {void}\n * Nothing.\n */\n function setData(key, value) {\n data[key] = value\n }\n\n /**\n * Get data.\n *\n * @template {keyof CompileData} Key\n * Field type.\n * @param {Key} key\n * Key of field.\n * @returns {CompileData[Key]}\n * Value.\n */\n function getData(key) {\n return data[key]\n }\n\n /**\n * Create an opener handle.\n *\n * @param {(token: Token) => Node} create\n * Create a node.\n * @param {Handle} [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 {void}\n */\n function open(token) {\n enter.call(this, create(token), token)\n if (and) and.call(this, token)\n }\n }\n\n /**\n * @this {CompileContext}\n * @returns {void}\n */\n function buffer() {\n this.stack.push({\n type: 'fragment',\n children: []\n })\n }\n\n /**\n * @template {Node} Kind\n * Node type.\n * @this {CompileContext}\n * Context.\n * @param {Kind} node\n * Node to enter.\n * @param {Token} token\n * Corresponding token.\n * @param {OnEnterError | undefined} [errorHandler]\n * Handle the case where this token is open, but it is closed by something else.\n * @returns {Kind}\n * The given node.\n */\n function enter(node, token, errorHandler) {\n const parent = this.stack[this.stack.length - 1]\n // @ts-expect-error: Assume `Node` can exist as a child of `parent`.\n parent.children.push(node)\n this.stack.push(node)\n this.tokenStack.push([token, errorHandler])\n // @ts-expect-error: `end` will be patched later.\n node.position = {\n start: point(token.start)\n }\n return node\n }\n\n /**\n * Create a closer handle.\n *\n * @param {Handle} [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 {void}\n */\n function close(token) {\n if (and) and.call(this, token)\n exit.call(this, token)\n }\n }\n\n /**\n * @this {CompileContext}\n * Context.\n * @param {Token} token\n * Corresponding token.\n * @param {OnExitError | undefined} [onExitError]\n * Handle the case where another token is open.\n * @returns {Node}\n * The closed node.\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(\n 'Cannot close `' +\n token.type +\n '` (' +\n stringifyPosition({\n start: token.start,\n end: token.end\n }) +\n '): it\u2019s not open'\n )\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 return node\n }\n\n /**\n * @this {CompileContext}\n * @returns {string}\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 setData('expectingFirstListItemValue', true)\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onenterlistitemvalue(token) {\n if (getData('expectingFirstListItemValue')) {\n const ancestor = this.stack[this.stack.length - 2]\n ancestor.start = Number.parseInt(this.sliceSerialize(token), 10)\n setData('expectingFirstListItemValue')\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 (getData('flowCodeInside')) return\n this.buffer()\n setData('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 setData('flowCodeInside')\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(\n this.sliceSerialize(token)\n ).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 setData('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).charCodeAt(0) === 61 ? 1 : 2\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n function onexitsetextheading() {\n setData('setextHeadingSlurpLineEnding')\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 let tail = node.children[node.children.length - 1]\n if (!tail || tail.type !== 'text') {\n // Add a new text node.\n tail = text()\n // @ts-expect-error: we\u2019ll add `end` later.\n tail.position = {\n start: point(token.start)\n }\n // @ts-expect-error: Assume `parent` accepts `text`.\n node.children.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 (getData('atHardBreak')) {\n const tail = context.children[context.children.length - 1]\n tail.position.end = point(token.end)\n setData('atHardBreak')\n return\n }\n if (\n !getData('setextHeadingSlurpLineEnding') &&\n config.canContainEols.includes(context.type)\n ) {\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 setData('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 // To do: clean.\n if (getData('inReference')) {\n /** @type {ReferenceType} */\n const referenceType = getData('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 setData('referenceType')\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 // To do: clean.\n if (getData('inReference')) {\n /** @type {ReferenceType} */\n const referenceType = getData('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 setData('referenceType')\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 setData('inReference', true)\n if (node.type === 'link') {\n /** @type {Array} */\n // @ts-expect-error: Assume static phrasing content.\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 setData('inReference')\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onenterreference() {\n setData('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(\n this.sliceSerialize(token)\n ).toLowerCase()\n setData('referenceType', 'full')\n }\n\n /**\n * @this {CompileContext}\n * @type {Handle}\n */\n\n function onexitcharacterreferencemarker(token) {\n setData('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 = getData('characterReferenceType')\n /** @type {string} */\n let value\n if (type) {\n value = decodeNumericCharacterReference(\n data,\n type === 'characterReferenceMarkerNumeric' ? 10 : 16\n )\n setData('characterReferenceType')\n } else {\n const result = decodeNamedCharacterReference(data)\n value = result\n }\n const tail = this.stack.pop()\n tail.value += value\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 // @ts-expect-error `depth` will be set later.\n return {\n type: 'heading',\n depth: undefined,\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>} extensions\n * @returns {void}\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 {void}\n */\nfunction extension(combined, extension) {\n /** @type {keyof Extension} */\n let key\n for (key in extension) {\n if (own.call(extension, key)) {\n if (key === 'canContainEols') {\n const right = extension[key]\n if (right) {\n combined[key].push(...right)\n }\n } else if (key === 'transforms') {\n const right = extension[key]\n if (right) {\n combined[key].push(...right)\n }\n } else if (key === 'enter' || key === 'exit') {\n const right = extension[key]\n if (right) {\n Object.assign(combined[key], right)\n }\n }\n }\n }\n}\n\n/** @type {OnEnterError} */\nfunction defaultOnError(left, right) {\n if (left) {\n throw new Error(\n 'Cannot close `' +\n left.type +\n '` (' +\n stringifyPosition({\n start: left.start,\n end: left.end\n }) +\n '): a different token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is open'\n )\n } else {\n throw new Error(\n 'Cannot close document, a token (`' +\n right.type +\n '`, ' +\n stringifyPosition({\n start: right.start,\n end: right.end\n }) +\n ') is still open'\n )\n }\n}\n", "/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast-util-from-markdown').Options} Options\n */\n\nimport {fromMarkdown} from 'mdast-util-from-markdown'\n\n/**\n * @this {import('unified').Processor}\n * @type {import('unified').Plugin<[Options?] | void[], string, Root>}\n */\nexport default function remarkParse(options) {\n /** @type {import('unified').ParserFunction} */\n const parser = (doc) => {\n // Assume options.\n const settings = /** @type {Options} */ (this.data('settings'))\n\n return fromMarkdown(\n doc,\n Object.assign({}, settings, 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: this.data('micromarkExtensions') || [],\n mdastExtensions: this.data('fromMarkdownExtensions') || []\n })\n )\n }\n\n Object.assign(this, {Parser: parser})\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Blockquote} Blockquote\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Text} Text\n * @typedef {import('mdast').Break} Break\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Code} Code\n * @typedef {import('../state.js').State} State\n\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 // To do: next major, use `node.lang` w/o regex, the splitting\u2019s been going\n // on for years in remark now.\n const lang = node.lang ? node.lang.match(/^[^ \\t]+(?=[ \\t]|$)/) : null\n /** @type {Properties} */\n const properties = {}\n\n if (lang) {\n properties.className = ['language-' + lang]\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Delete} Delete\n * @typedef {import('../state.js').State} State\n\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Emphasis} Emphasis\n * @typedef {import('../state.js').State} State\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", "import {asciiAlphanumeric} from 'micromark-util-character'\nimport {encode} from 'micromark-util-encode'\n/**\n * Make a value safe for injection as a URL.\n *\n * This encodes unsafe characters with percent-encoding and skips already\n * encoded sequences (see `normalizeUri`).\n * Further unsafe characters are encoded as character references (see\n * `micromark-util-encode`).\n *\n * A regex of allowed protocols can be given, in which case the URL is\n * sanitized.\n * For example, `/^(https?|ircs?|mailto|xmpp)$/i` can be used for `a[href]`, or\n * `/^https?$/i` for `img[src]` (this is what `github.com` allows).\n * If the URL includes an unknown protocol (one not matched by `protocol`, such\n * as a dangerous example, `javascript:`), the value is ignored.\n *\n * @param {string | undefined} url\n *   URI to sanitize.\n * @param {RegExp | null | undefined} [protocol]\n *   Allowed protocols.\n * @returns {string}\n *   Sanitized URI.\n */\nexport function sanitizeUri(url, protocol) {\n  const value = encode(normalizeUri(url || ''))\n  if (!protocol) {\n    return value\n  }\n  const colon = value.indexOf(':')\n  const questionMark = value.indexOf('?')\n  const numberSign = value.indexOf('#')\n  const slash = value.indexOf('/')\n  if (\n    // If there is no protocol, it\u2019s relative.\n    colon < 0 ||\n    // If the first colon is after a `?`, `#`, or `/`, it\u2019s not a protocol.\n    (slash > -1 && colon > slash) ||\n    (questionMark > -1 && colon > questionMark) ||\n    (numberSign > -1 && colon > numberSign) ||\n    // It is a protocol, it should be allowed.\n    protocol.test(value.slice(0, colon))\n  ) {\n    return value\n  }\n  return ''\n}\n\n/**\n * Normalize a URL.\n *\n * Encode unsafe characters with percent-encoding, skipping already encoded\n * sequences.\n *\n * @param {string} value\n *   URI to normalize.\n * @returns {string}\n *   Normalized URI.\n */\nexport function normalizeUri(value) {\n  /** @type {Array} */\n  const result = []\n  let index = -1\n  let start = 0\n  let skip = 0\n  while (++index < value.length) {\n    const code = value.charCodeAt(index)\n    /** @type {string} */\n    let replace = ''\n\n    // A correct percent encoded value.\n    if (\n      code === 37 &&\n      asciiAlphanumeric(value.charCodeAt(index + 1)) &&\n      asciiAlphanumeric(value.charCodeAt(index + 2))\n    ) {\n      skip = 2\n    }\n    // ASCII.\n    else if (code < 128) {\n      if (!/[!#$&-;=?-Z_a-z~]/.test(String.fromCharCode(code))) {\n        replace = String.fromCharCode(code)\n      }\n    }\n    // Astral.\n    else if (code > 55295 && code < 57344) {\n      const next = value.charCodeAt(index + 1)\n\n      // A correct surrogate pair.\n      if (code < 56320 && next > 56319 && next < 57344) {\n        replace = String.fromCharCode(code, next)\n        skip = 1\n      }\n      // Lone surrogate.\n      else {\n        replace = '\\uFFFD'\n      }\n    }\n    // Unicode.\n    else {\n      replace = String.fromCharCode(code)\n    }\n    if (replace) {\n      result.push(value.slice(start, index), encodeURIComponent(replace))\n      start = index + skip + 1\n      replace = ''\n    }\n    if (skip) {\n      index += skip\n      skip = 0\n    }\n  }\n  return result.join('') + value.slice(start)\n}\n", "/**\n * @typedef {import('mdast').FootnoteReference} FootnoteReference\n * @typedef {import('hast').Element} Element\n * @typedef {import('../state.js').State} State\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 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  if (index === -1) {\n    state.footnoteOrder.push(id)\n    state.footnoteCounts[id] = 1\n    counter = state.footnoteOrder.length\n  } else {\n    state.footnoteCounts[id]++\n    counter = index + 1\n  }\n\n  const reuseCounter = state.footnoteCounts[id]\n\n  /** @type {Element} */\n  const link = {\n    type: 'element',\n    tagName: 'a',\n    properties: {\n      href: '#' + state.clobberPrefix + 'fn-' + safeId,\n      id:\n        state.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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Footnote} Footnote\n * @typedef {import('../state.js').State} State\n */\n\nimport {footnoteReference} from './footnote-reference.js'\n\n// To do: when both:\n// * \n// * \n// \u2026are archived, remove this (also from mdast).\n// These inline notes are not used in GFM.\n\n/**\n * Turn an mdast `footnote` node into hast.\n *\n * @param {State} state\n *   Info passed around.\n * @param {Footnote} node\n *   mdast node.\n * @returns {Element}\n *   hast node.\n */\nexport function footnote(state, node) {\n  const footnoteById = state.footnoteById\n  let no = 1\n\n  while (no in footnoteById) no++\n\n  const identifier = String(no)\n\n  footnoteById[identifier] = {\n    type: 'footnoteDefinition',\n    identifier,\n    children: [{type: 'paragraph', children: node.children}],\n    position: node.position\n  }\n\n  return footnoteReference(state, {\n    type: 'footnoteReference',\n    identifier,\n    position: node.position\n  })\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Heading} Heading\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').HTML} Html\n * @typedef {import('../state.js').State} State\n * @typedef {import('../../index.js').Raw} Raw\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 {Raw | Element | null}\n *   hast node.\n */\nexport function html(state, node) {\n  if (state.dangerous) {\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  // To do: next major: return `undefined`.\n  return null\n}\n", "/**\n * @typedef {import('hast').ElementContent} ElementContent\n *\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Reference} Reference\n * @typedef {import('mdast').Root} Root\n *\n * @typedef {import('./state.js').State} State\n */\n\n/**\n * @typedef {Root | Content} Nodes\n * @typedef {Extract} References\n */\n\n// To do: next major: always return array.\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 {References} node\n *   Reference node (image, link).\n * @returns {ElementContent | 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 * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').ImageReference} ImageReference\n * @typedef {import('../state.js').State} State\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 {ElementContent | Array}\n *   hast node.\n */\nexport function imageReference(state, node) {\n  const def = state.definition(node.identifier)\n\n  if (!def) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {src: normalizeUri(def.url || ''), alt: node.alt}\n\n  if (def.title !== null && def.title !== undefined) {\n    properties.title = def.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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Image} Image\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Text} Text\n * @typedef {import('mdast').InlineCode} InlineCode\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').LinkReference} LinkReference\n * @typedef {import('../state.js').State} State\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 {ElementContent | Array}\n *   hast node.\n */\nexport function linkReference(state, node) {\n  const def = state.definition(node.identifier)\n\n  if (!def) {\n    return revert(state, node)\n  }\n\n  /** @type {Properties} */\n  const properties = {href: normalizeUri(def.url || '')}\n\n  if (def.title !== null && def.title !== undefined) {\n    properties.title = def.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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Link} Link\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').ListItem} ListItem\n * @typedef {import('mdast').Parent} Parent\n * @typedef {import('mdast').Root} Root\n * @typedef {import('../state.js').State} State\n */\n\n/**\n * @typedef {Root | Content} Nodes\n * @typedef {Extract} Parents\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 | null | 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 === undefined || spread === null\n    ? node.children.length > 1\n    : spread\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').Properties} Properties\n * @typedef {import('mdast').List} List\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Paragraph} Paragraph\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Root} HastRoot\n * @typedef {import('hast').Element} HastElement\n * @typedef {import('mdast').Root} MdastRoot\n * @typedef {import('../state.js').State} State\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 {HastRoot | HastElement}\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Strong} Strong\n * @typedef {import('../state.js').State} State\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 * @typedef {import('unist').Position} Position\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Point} Point\n */\n\n/**\n * @typedef NodeLike\n * @property {string} type\n * @property {PositionLike | null | undefined} [position]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n */\n\n/**\n * Get the starting point of `node`.\n *\n * @param node\n *   Node.\n * @returns\n *   Point.\n */\nexport const pointStart = point('start')\n\n/**\n * Get the ending point of `node`.\n *\n * @param node\n *   Node.\n * @returns\n *   Point.\n */\nexport const pointEnd = point('end')\n\n/**\n * Get the positional info of `node`.\n *\n * @param {NodeLike | Node | null | undefined} [node]\n *   Node.\n * @returns {Position}\n *   Position.\n */\nexport function position(node) {\n  return {start: pointStart(node), end: pointEnd(node)}\n}\n\n/**\n * Get the positional info of `node`.\n *\n * @param {'start' | 'end'} type\n *   Side.\n * @returns\n *   Getter.\n */\nfunction point(type) {\n  return point\n\n  /**\n   * Get the point info of `node` at a bound side.\n   *\n   * @param {NodeLike | Node | null | undefined} [node]\n   * @returns {Point}\n   */\n  function point(node) {\n    const point = (node && node.position && node.position[type]) || {}\n\n    // To do: next major: don\u2019t return points when invalid.\n    return {\n      // @ts-expect-error: in practice, null is allowed.\n      line: point.line || null,\n      // @ts-expect-error: in practice, null is allowed.\n      column: point.column || null,\n      // @ts-expect-error: in practice, null is allowed.\n      offset: point.offset > -1 ? point.offset : null\n    }\n  }\n}\n", "/**\n * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').Table} Table\n * @typedef {import('../state.js').State} State\n */\n\nimport {pointStart, pointEnd} 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.line && end.line) 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 * @typedef {import('hast').Properties} Properties\n * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Parent} Parent\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').TableRow} TableRow\n * @typedef {import('../state.js').State} State\n */\n\n/**\n * @typedef {Root | Content} Nodes\n * @typedef {Extract} Parents\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 | null | 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  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(node, 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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').TableCell} TableCell\n * @typedef {import('../state.js').State} State\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 * @typedef {import('hast').Element} HastElement\n * @typedef {import('hast').Text} HastText\n * @typedef {import('mdast').Text} MdastText\n * @typedef {import('../state.js').State} State\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 {HastText | HastElement}\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 * @typedef {import('hast').Element} Element\n * @typedef {import('mdast').ThematicBreak} ThematicBreak\n * @typedef {import('../state.js').State} State\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", "import {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 {footnote} from './footnote.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 */\nexport const handlers = {\n  blockquote,\n  break: hardBreak,\n  code,\n  delete: strikethrough,\n  emphasis,\n  footnoteReference,\n  footnote,\n  heading,\n  html,\n  imageReference,\n  image,\n  inlineCode,\n  linkReference,\n  link,\n  listItem,\n  list,\n  paragraph,\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  // To do: next major: return `undefined`.\n  return null\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n */\n\n/**\n * @typedef {Record} Props\n * @typedef {null | undefined | string | Props | TestFunctionAnything | Array} Test\n *   Check for an arbitrary node, unaware of TypeScript inferral.\n *\n * @callback TestFunctionAnything\n *   Check if a node passes a test, unaware of TypeScript inferral.\n * @param {unknown} this\n *   The given context.\n * @param {Node} node\n *   A node.\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {boolean | void}\n *   Whether this node passes the test.\n */\n\n/**\n * @template {Node} Kind\n *   Node type.\n * @typedef {Kind['type'] | Partial | TestFunctionPredicate | Array | TestFunctionPredicate>} PredicateTest\n *   Check for a node that can be inferred by TypeScript.\n */\n\n/**\n * Check if a node passes a certain test.\n *\n * @template {Node} Kind\n *   Node type.\n * @callback TestFunctionPredicate\n *   Complex test function for a node that can be inferred by TypeScript.\n * @param {Node} node\n *   A node.\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {node is Kind}\n *   Whether this node passes the test.\n */\n\n/**\n * @callback AssertAnything\n *   Check that an arbitrary value is a node, unaware of TypeScript inferral.\n * @param {unknown} [node]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {boolean}\n *   Whether this is a node and passes a test.\n */\n\n/**\n * Check if a node is a node and passes a certain node test.\n *\n * @template {Node} Kind\n *   Node type.\n * @callback AssertPredicate\n *   Check that an arbitrary value is a specific node, aware of TypeScript.\n * @param {unknown} [node]\n *   Anything (typically a node).\n * @param {number | null | undefined} [index]\n *   The node\u2019s position in its parent.\n * @param {Parent | null | undefined} [parent]\n *   The node\u2019s parent.\n * @returns {node is Kind}\n *   Whether this is a node and passes a test.\n */\n\n/**\n * Check if `node` is a `Node` and whether it passes the given test.\n *\n * @param node\n *   Thing to check, typically `Node`.\n * @param test\n *   A check for a specific node.\n * @param index\n *   The node\u2019s position in its parent.\n * @param parent\n *   The node\u2019s parent.\n * @returns\n *   Whether `node` is a node and passes a test.\n */\nexport const is =\n  /**\n   * @type {(\n   *   (() => false) &\n   *   ((node: unknown, test: PredicateTest, index: number, parent: Parent, context?: unknown) => node is Kind) &\n   *   ((node: unknown, test: PredicateTest, index?: null | undefined, parent?: null | undefined, context?: unknown) => node is Kind) &\n   *   ((node: unknown, test: Test, index: number, parent: Parent, context?: unknown) => boolean) &\n   *   ((node: unknown, test?: Test, index?: null | undefined, parent?: null | undefined, context?: unknown) => boolean)\n   * )}\n   */\n  (\n    /**\n     * @param {unknown} [node]\n     * @param {Test} [test]\n     * @param {number | null | undefined} [index]\n     * @param {Parent | null | undefined} [parent]\n     * @param {unknown} [context]\n     * @returns {boolean}\n     */\n    // eslint-disable-next-line max-params\n    function is(node, test, index, parent, context) {\n      const check = convert(test)\n\n      if (\n        index !== undefined &&\n        index !== null &&\n        (typeof index !== 'number' ||\n          index < 0 ||\n          index === Number.POSITIVE_INFINITY)\n      ) {\n        throw new Error('Expected positive finite index')\n      }\n\n      if (\n        parent !== undefined &&\n        parent !== null &&\n        (!is(parent) || !parent.children)\n      ) {\n        throw new Error('Expected parent node')\n      }\n\n      if (\n        (parent === undefined || parent === null) !==\n        (index === undefined || index === null)\n      ) {\n        throw new Error('Expected both parent and index')\n      }\n\n      // @ts-expect-error Looks like a node.\n      return node && node.type && typeof node.type === 'string'\n        ? Boolean(check.call(context, node, index, parent))\n        : false\n    }\n  )\n\n/**\n * Generate an assertion from a test.\n *\n * Useful if you\u2019re going to test many nodes, for example when creating a\n * utility where something else passes a compatible test.\n *\n * The created function is a bit faster because it expects valid input only:\n * a `node`, `index`, and `parent`.\n *\n * @param test\n *   *   when nullish, checks if `node` is a `Node`.\n *   *   when `string`, works like passing `(node) => node.type === test`.\n *   *   when `function` checks if function passed the node is true.\n *   *   when `object`, checks that all keys in test are in node, and that they have (strictly) equal values.\n *   *   when `array`, checks if any one of the subtests pass.\n * @returns\n *   An assertion.\n */\nexport const convert =\n  /**\n   * @type {(\n   *   ((test: PredicateTest) => AssertPredicate) &\n   *   ((test?: Test) => AssertAnything)\n   * )}\n   */\n  (\n    /**\n     * @param {Test} [test]\n     * @returns {AssertAnything}\n     */\n    function (test) {\n      if (test === undefined || test === null) {\n        return ok\n      }\n\n      if (typeof test === 'string') {\n        return typeFactory(test)\n      }\n\n      if (typeof test === 'object') {\n        return Array.isArray(test) ? anyFactory(test) : propsFactory(test)\n      }\n\n      if (typeof test === 'function') {\n        return castFactory(test)\n      }\n\n      throw new Error('Expected function, string, or object as test')\n    }\n  )\n\n/**\n * @param {Array} tests\n * @returns {AssertAnything}\n */\nfunction anyFactory(tests) {\n  /** @type {Array} */\n  const checks = []\n  let index = -1\n\n  while (++index < tests.length) {\n    checks[index] = convert(tests[index])\n  }\n\n  return castFactory(any)\n\n  /**\n   * @this {unknown}\n   * @param {Array} parameters\n   * @returns {boolean}\n   */\n  function any(...parameters) {\n    let index = -1\n\n    while (++index < checks.length) {\n      if (checks[index].call(this, ...parameters)) return true\n    }\n\n    return false\n  }\n}\n\n/**\n * Turn an object into a test for a node with a certain fields.\n *\n * @param {Props} check\n * @returns {AssertAnything}\n */\nfunction propsFactory(check) {\n  return castFactory(all)\n\n  /**\n   * @param {Node} node\n   * @returns {boolean}\n   */\n  function all(node) {\n    /** @type {string} */\n    let key\n\n    for (key in check) {\n      // @ts-expect-error: hush, it sure works as an index.\n      if (node[key] !== check[key]) return false\n    }\n\n    return true\n  }\n}\n\n/**\n * Turn a string into a test for a node with a certain type.\n *\n * @param {string} check\n * @returns {AssertAnything}\n */\nfunction typeFactory(check) {\n  return castFactory(type)\n\n  /**\n   * @param {Node} node\n   */\n  function type(node) {\n    return node && node.type === check\n  }\n}\n\n/**\n * Turn a custom test into a test for a node that passes that test.\n *\n * @param {TestFunctionAnything} check\n * @returns {AssertAnything}\n */\nfunction castFactory(check) {\n  return assertion\n\n  /**\n   * @this {unknown}\n   * @param {unknown} node\n   * @param {Array} parameters\n   * @returns {boolean}\n   */\n  function assertion(node, ...parameters) {\n    return Boolean(\n      node &&\n        typeof node === 'object' &&\n        'type' in node &&\n        // @ts-expect-error: fine.\n        Boolean(check.call(this, node, ...parameters))\n    )\n  }\n}\n\nfunction ok() {\n  return true\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist-util-is').Test} Test\n */\n\n/**\n * @typedef {boolean | 'skip'} Action\n *   Union of the action types.\n *\n * @typedef {number} Index\n *   Move to the sibling at `index` next (after node itself is completely\n *   traversed).\n *\n *   Useful if mutating the tree, such as removing the node the visitor is\n *   currently on, or any of its previous siblings.\n *   Results less than 0 or greater than or equal to `children.length` stop\n *   traversing the parent.\n *\n * @typedef {[(Action | null | undefined | void)?, (Index | null | undefined)?]} ActionTuple\n *   List with one or two values, the first an action, the second an index.\n *\n * @typedef {Action | ActionTuple | Index | null | undefined | void} VisitorResult\n *   Any value that can be returned from a visitor.\n */\n\n/**\n * @template {Node} [Visited=Node]\n *   Visited node type.\n * @template {Parent} [Ancestor=Parent]\n *   Ancestor type.\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform the parent of node (the last of `ancestors`).\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of an ancestor still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Array} ancestors\n *   Ancestors of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n */\n\n/**\n * @template {Node} [Tree=Node]\n *   Tree type.\n * @template {Test} [Check=string]\n *   Test type.\n * @typedef {Visitor, Check>, Extract, Parent>>} BuildVisitor\n *   Build a typed `Visitor` function from a tree and a test.\n *\n *   It will infer which values are passed as `node` and which as `parents`.\n */\n\nimport {convert} from 'unist-util-is'\nimport {color} from './color.js'\n\n/**\n * Continue traversing as normal.\n */\nexport const CONTINUE = true\n\n/**\n * Stop traversing immediately.\n */\nexport const EXIT = false\n\n/**\n * Do not traverse this node\u2019s children.\n */\nexport const SKIP = 'skip'\n\n/**\n * Visit nodes, with ancestral information.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @param tree\n *   Tree to traverse.\n * @param test\n *   `unist-util-is`-compatible test\n * @param visitor\n *   Handle each node.\n * @param reverse\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns\n *   Nothing.\n */\nexport const visitParents =\n  /**\n   * @type {(\n   *   ((tree: Tree, test: Check, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) &\n   *   ((tree: Tree, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void)\n   * )}\n   */\n  (\n    /**\n     * @param {Node} tree\n     * @param {Test} test\n     * @param {Visitor} visitor\n     * @param {boolean | null | undefined} [reverse]\n     * @returns {void}\n     */\n    function (tree, test, visitor, reverse) {\n      if (typeof test === 'function' && typeof visitor !== 'function') {\n        reverse = visitor\n        // @ts-expect-error no visitor given, so `visitor` is test.\n        visitor = test\n        test = null\n      }\n\n      const is = convert(test)\n      const step = reverse ? -1 : 1\n\n      factory(tree, undefined, [])()\n\n      /**\n       * @param {Node} node\n       * @param {number | undefined} index\n       * @param {Array} parents\n       */\n      function factory(node, index, parents) {\n        /** @type {Record} */\n        // @ts-expect-error: hush\n        const value = node && typeof node === 'object' ? node : {}\n\n        if (typeof value.type === 'string') {\n          const name =\n            // `hast`\n            typeof value.tagName === 'string'\n              ? value.tagName\n              : // `xast`\n              typeof value.name === 'string'\n              ? value.name\n              : undefined\n\n          Object.defineProperty(visit, 'name', {\n            value:\n              'node (' + color(node.type + (name ? '<' + name + '>' : '')) + ')'\n          })\n        }\n\n        return visit\n\n        function visit() {\n          /** @type {ActionTuple} */\n          let result = []\n          /** @type {ActionTuple} */\n          let subresult\n          /** @type {number} */\n          let offset\n          /** @type {Array} */\n          let grandparents\n\n          if (!test || is(node, index, parents[parents.length - 1] || null)) {\n            result = toResult(visitor(node, parents))\n\n            if (result[0] === EXIT) {\n              return result\n            }\n          }\n\n          // @ts-expect-error looks like a parent.\n          if (node.children && result[0] !== SKIP) {\n            // @ts-expect-error looks like a parent.\n            offset = (reverse ? node.children.length : -1) + step\n            // @ts-expect-error looks like a parent.\n            grandparents = parents.concat(node)\n\n            // @ts-expect-error looks like a parent.\n            while (offset > -1 && offset < node.children.length) {\n              // @ts-expect-error looks like a parent.\n              subresult = factory(node.children[offset], offset, grandparents)()\n\n              if (subresult[0] === EXIT) {\n                return subresult\n              }\n\n              offset =\n                typeof subresult[1] === 'number' ? subresult[1] : offset + step\n            }\n          }\n\n          return result\n        }\n      }\n    }\n  )\n\n/**\n * Turn a return value into a clean result.\n *\n * @param {VisitorResult} value\n *   Valid return values from visitors.\n * @returns {ActionTuple}\n *   Clean result.\n */\nfunction toResult(value) {\n  if (Array.isArray(value)) {\n    return value\n  }\n\n  if (typeof value === 'number') {\n    return [CONTINUE, value]\n  }\n\n  return [value]\n}\n", "/**\n * @typedef {import('unist').Node} Node\n * @typedef {import('unist').Parent} Parent\n * @typedef {import('unist-util-is').Test} Test\n * @typedef {import('unist-util-visit-parents').VisitorResult} VisitorResult\n */\n\n/**\n * Check if `Child` can be a child of `Ancestor`.\n *\n * Returns the ancestor when `Child` can be a child of `Ancestor`, or returns\n * `never`.\n *\n * @template {Node} Ancestor\n *   Node type.\n * @template {Node} Child\n *   Node type.\n * @typedef {(\n *   Ancestor extends Parent\n *     ? Child extends Ancestor['children'][number]\n *       ? Ancestor\n *       : never\n *     : never\n * )} ParentsOf\n */\n\n/**\n * @template {Node} [Visited=Node]\n *   Visited node type.\n * @template {Parent} [Ancestor=Parent]\n *   Ancestor type.\n * @callback Visitor\n *   Handle a node (matching `test`, if given).\n *\n *   Visitors are free to transform `node`.\n *   They can also transform `parent`.\n *\n *   Replacing `node` itself, if `SKIP` is not returned, still causes its\n *   descendants to be walked (which is a bug).\n *\n *   When adding or removing previous siblings of `node` (or next siblings, in\n *   case of reverse), the `Visitor` should return a new `Index` to specify the\n *   sibling to traverse after `node` is traversed.\n *   Adding or removing next siblings of `node` (or previous siblings, in case\n *   of reverse) is handled as expected without needing to return a new `Index`.\n *\n *   Removing the children property of `parent` still results in them being\n *   traversed.\n * @param {Visited} node\n *   Found node.\n * @param {Visited extends Node ? number | null : never} index\n *   Index of `node` in `parent`.\n * @param {Ancestor extends Node ? Ancestor | null : never} parent\n *   Parent of `node`.\n * @returns {VisitorResult}\n *   What to do next.\n *\n *   An `Index` is treated as a tuple of `[CONTINUE, Index]`.\n *   An `Action` is treated as a tuple of `[Action]`.\n *\n *   Passing a tuple back only makes sense if the `Action` is `SKIP`.\n *   When the `Action` is `EXIT`, that action can be returned.\n *   When the `Action` is `CONTINUE`, `Index` can be returned.\n */\n\n/**\n * Build a typed `Visitor` function from a node and all possible parents.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n *\n * @template {Node} Visited\n *   Node type.\n * @template {Parent} Ancestor\n *   Parent type.\n * @typedef {Visitor>} BuildVisitorFromMatch\n */\n\n/**\n * Build a typed `Visitor` function from a list of descendants and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n *\n * @template {Node} Descendant\n *   Node type.\n * @template {Test} Check\n *   Test type.\n * @typedef {(\n *   BuildVisitorFromMatch<\n *     import('unist-util-visit-parents/complex-types.js').Matches,\n *     Extract\n *   >\n * )} BuildVisitorFromDescendants\n */\n\n/**\n * Build a typed `Visitor` function from a tree and a test.\n *\n * It will infer which values are passed as `node` and which as `parent`.\n *\n * @template {Node} [Tree=Node]\n *   Node type.\n * @template {Test} [Check=string]\n *   Test type.\n * @typedef {(\n *   BuildVisitorFromDescendants<\n *     import('unist-util-visit-parents/complex-types.js').InclusiveDescendant,\n *     Check\n *   >\n * )} BuildVisitor\n */\n\nimport {visitParents} from 'unist-util-visit-parents'\n\n/**\n * Visit nodes.\n *\n * This algorithm performs *depth-first* *tree traversal* in *preorder*\n * (**NLR**) or if `reverse` is given, in *reverse preorder* (**NRL**).\n *\n * You can choose for which nodes `visitor` is called by passing a `test`.\n * For complex tests, you should test yourself in `visitor`, as it will be\n * faster and will have improved type information.\n *\n * Walking the tree is an intensive task.\n * Make use of the return values of the visitor when possible.\n * Instead of walking a tree multiple times, walk it once, use `unist-util-is`\n * to check if a node matches, and then perform different operations.\n *\n * You can change the tree.\n * See `Visitor` for more info.\n *\n * @param tree\n *   Tree to traverse.\n * @param test\n *   `unist-util-is`-compatible test\n * @param visitor\n *   Handle each node.\n * @param reverse\n *   Traverse in reverse preorder (NRL) instead of the default preorder (NLR).\n * @returns\n *   Nothing.\n */\nexport const visit =\n  /**\n   * @type {(\n   *   ((tree: Tree, test: Check, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void) &\n   *   ((tree: Tree, visitor: BuildVisitor, reverse?: boolean | null | undefined) => void)\n   * )}\n   */\n  (\n    /**\n     * @param {Node} tree\n     * @param {Test} test\n     * @param {Visitor} visitor\n     * @param {boolean | null | undefined} [reverse]\n     * @returns {void}\n     */\n    function (tree, test, visitor, reverse) {\n      if (typeof test === 'function' && typeof visitor !== 'function') {\n        reverse = visitor\n        visitor = test\n        test = null\n      }\n\n      visitParents(tree, test, overload, reverse)\n\n      /**\n       * @param {Node} node\n       * @param {Array} parents\n       */\n      function overload(node, parents) {\n        const parent = parents[parents.length - 1]\n        return visitor(\n          node,\n          parent ? parent.children.indexOf(node) : null,\n          parent\n        )\n      }\n    }\n  )\n\nexport {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'\n", "/**\n * @typedef PointLike\n * @property {number | null | undefined} [line]\n * @property {number | null | undefined} [column]\n * @property {number | null | undefined} [offset]\n *\n * @typedef PositionLike\n * @property {PointLike | null | undefined} [start]\n * @property {PointLike | null | undefined} [end]\n *\n * @typedef NodeLike\n * @property {PositionLike | null | undefined} [position]\n */\n\n/**\n * Check if `node` is generated.\n *\n * @param {NodeLike | null | undefined} [node]\n *   Node to check.\n * @returns {boolean}\n *   Whether `node` is generated (does not have positional info).\n */\nexport function generated(node) {\n  return (\n    !node ||\n    !node.position ||\n    !node.position.start ||\n    !node.position.start.line ||\n    !node.position.start.column ||\n    !node.position.end ||\n    !node.position.end.line ||\n    !node.position.end.column\n  )\n}\n", "/**\n * @typedef {import('mdast').Root} Root\n * @typedef {import('mdast').Content} Content\n * @typedef {import('mdast').Definition} Definition\n */\n\n/**\n * @typedef {Root | Content} Node\n *\n * @callback GetDefinition\n *   Get a definition by identifier.\n * @param {string | null | undefined} [identifier]\n *   Identifier of definition.\n * @returns {Definition | null}\n *   Definition corresponding to `identifier` or `null`.\n */\n\nimport {visit} from 'unist-util-visit'\n\nconst own = {}.hasOwnProperty\n\n/**\n * Find definitions in `tree`.\n *\n * Uses CommonMark precedence, which means that earlier definitions are\n * preferred over duplicate later definitions.\n *\n * @param {Node} tree\n *   Tree to check.\n * @returns {GetDefinition}\n *   Getter.\n */\nexport function definitions(tree) {\n  /** @type {Record} */\n  const cache = Object.create(null)\n\n  if (!tree || !tree.type) {\n    throw new Error('mdast-util-definitions expected node')\n  }\n\n  visit(tree, 'definition', (definition) => {\n    const id = clean(definition.identifier)\n    if (id && !own.call(cache, id)) {\n      cache[id] = definition\n    }\n  })\n\n  return definition\n\n  /** @type {GetDefinition} */\n  function definition(identifier) {\n    const id = clean(identifier)\n    // To do: next major: return `undefined` when not found.\n    return id && own.call(cache, id) ? cache[id] : null\n  }\n}\n\n/**\n * @param {string | null | undefined} [value]\n * @returns {string}\n */\nfunction clean(value) {\n  return String(value || '').toUpperCase()\n}\n", "/**\n * @typedef {import('hast').Content} HastContent\n * @typedef {import('hast').Element} HastElement\n * @typedef {import('hast').ElementContent} HastElementContent\n * @typedef {import('hast').Properties} HastProperties\n * @typedef {import('hast').Root} HastRoot\n * @typedef {import('hast').Text} HastText\n *\n * @typedef {import('mdast').Content} MdastContent\n * @typedef {import('mdast').Definition} MdastDefinition\n * @typedef {import('mdast').FootnoteDefinition} MdastFootnoteDefinition\n * @typedef {import('mdast').Parent} MdastParent\n * @typedef {import('mdast').Root} MdastRoot\n */\n\n/**\n * @typedef {HastRoot | HastContent} HastNodes\n * @typedef {MdastRoot | MdastContent} MdastNodes\n * @typedef {Extract} MdastParents\n *\n * @typedef EmbeddedHastFields\n *   hast fields.\n * @property {string | null | undefined} [hName]\n *   Generate a specific element with this tag name instead.\n * @property {HastProperties | null | undefined} [hProperties]\n *   Generate an element with these properties instead.\n * @property {Array | null | undefined} [hChildren]\n *   Generate an element with this content instead.\n *\n * @typedef {Record & EmbeddedHastFields} MdastData\n *   mdast data with embedded hast fields.\n *\n * @typedef {MdastNodes & {data?: MdastData | null | undefined}} MdastNodeWithData\n *   mdast node with embedded hast data.\n *\n * @typedef PointLike\n *   Point-like value.\n * @property {number | null | undefined} [line]\n *   Line.\n * @property {number | null | undefined} [column]\n *   Column.\n * @property {number | null | undefined} [offset]\n *   Offset.\n *\n * @typedef PositionLike\n *   Position-like value.\n * @property {PointLike | null | undefined} [start]\n *   Point-like value.\n * @property {PointLike | null | undefined} [end]\n *   Point-like value.\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 | null | undefined} parent\n *   Parent of `node`.\n * @returns {HastElementContent | Array | null | undefined}\n *   hast node.\n *\n * @callback HFunctionProps\n *   Signature of `state` for when props are passed.\n * @param {MdastNodes | PositionLike | null | undefined} node\n *   mdast node or unist position.\n * @param {string} tagName\n *   HTML tag name.\n * @param {HastProperties} props\n *   Properties.\n * @param {Array | null | undefined} [children]\n *   hast content.\n * @returns {HastElement}\n *   Compiled element.\n *\n * @callback HFunctionNoProps\n *   Signature of `state` for when no props are passed.\n * @param {MdastNodes | PositionLike | null | undefined} node\n *   mdast node or unist position.\n * @param {string} tagName\n *   HTML tag name.\n * @param {Array | null | undefined} [children]\n *   hast content.\n * @returns {HastElement}\n *   Compiled element.\n *\n * @typedef HFields\n *   Info on `state`.\n * @property {boolean} dangerous\n *   Whether HTML is allowed.\n * @property {string} clobberPrefix\n *   Prefix to use to prevent DOM clobbering.\n * @property {string} footnoteLabel\n *   Label to use to introduce the footnote section.\n * @property {string} footnoteLabelTagName\n *   HTML used for the footnote label.\n * @property {HastProperties} footnoteLabelProperties\n *   Properties on the HTML tag used for the footnote label.\n * @property {string} footnoteBackLabel\n *   Label to use from backreferences back to their footnote call.\n * @property {(identifier: string) => MdastDefinition | null} definition\n *   Definition cache.\n * @property {Record} footnoteById\n *   Footnote definitions by their identifier.\n * @property {Array} footnoteOrder\n *   Identifiers of order when footnote calls first appear in tree order.\n * @property {Record} footnoteCounts\n *   Counts for how often the same footnote was called.\n * @property {Handlers} handlers\n *   Applied handlers.\n * @property {Handler} unknownHandler\n *   Handler for any none not in `passThrough` or otherwise handled.\n * @property {(from: MdastNodes, node: HastNodes) => void} patch\n *   Copy a node\u2019s positional info.\n * @property {(from: MdastNodes, to: Type) => Type | HastElement} applyData\n *   Honor the `data` of `from`, and generate an element instead of `node`.\n * @property {(node: MdastNodes, parent: MdastParents | null | undefined) => HastElementContent | Array | null | undefined} one\n *   Transform an mdast node to hast.\n * @property {(node: MdastNodes) => Array} all\n *   Transform the children of an mdast parent to hast.\n * @property {(nodes: Array, loose?: boolean | null | undefined) => Array} wrap\n *   Wrap `nodes` with line endings between each node, adds initial/final line endings when `loose`.\n * @property {(left: MdastNodeWithData | PositionLike | null | undefined, right: HastElementContent) => HastElementContent} augment\n *   Like `state` but lower-level and usable on non-elements.\n *   Deprecated: use `patch` and `applyData`.\n * @property {Array} passThrough\n *   List of node types to pass through untouched (except for their children).\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.\n * @property {string | null | undefined} [clobberPrefix='user-content-']\n *   Prefix to use before the `id` attribute on footnotes to prevent it from\n *   *clobbering*.\n * @property {string | null | undefined} [footnoteBackLabel='Back to content']\n *   Label to use from backreferences back to their footnote call (affects\n *   screen readers).\n * @property {string | null | undefined} [footnoteLabel='Footnotes']\n *   Label to use for the footnotes section (affects screen readers).\n * @property {HastProperties | null | undefined} [footnoteLabelProperties={className: ['sr-only']}]\n *   Properties to use on the footnote label (note that `id: 'footnote-label'`\n *   is always added as footnote calls use it with `aria-describedby` to\n *   provide an accessible label).\n * @property {string | null | undefined} [footnoteLabelTagName='h2']\n *   Tag name to use for the footnote label.\n * @property {Handlers | null | undefined} [handlers]\n *   Extra handlers for nodes.\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 * @property {Handler | null | undefined} [unknownHandler]\n *   Handler for all unknown nodes.\n *\n * @typedef {Record} Handlers\n *   Handle nodes.\n *\n * @typedef {HFunctionProps & HFunctionNoProps & HFields} State\n *   Info passed around.\n */\n\nimport {visit} from 'unist-util-visit'\nimport {position, pointStart, pointEnd} from 'unist-util-position'\nimport {generated} from 'unist-util-generated'\nimport {definitions} from 'mdast-util-definitions'\nimport {handlers} from './handlers/index.js'\n\nconst own = {}.hasOwnProperty\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.\n * @returns {State}\n *   `state` function.\n */\nexport function createState(tree, options) {\n  const settings = options || {}\n  const dangerous = settings.allowDangerousHtml || false\n  /** @type {Record} */\n  const footnoteById = {}\n\n  // To do: next major: add `options` to state, remove:\n  // `dangerous`, `clobberPrefix`, `footnoteLabel`, `footnoteLabelTagName`,\n  // `footnoteLabelProperties`, `footnoteBackLabel`, `passThrough`,\n  // `unknownHandler`.\n\n  // To do: next major: move to `state.options.allowDangerousHtml`.\n  state.dangerous = dangerous\n  // To do: next major: move to `state.options`.\n  state.clobberPrefix =\n    settings.clobberPrefix === undefined || settings.clobberPrefix === null\n      ? 'user-content-'\n      : settings.clobberPrefix\n  // To do: next major: move to `state.options`.\n  state.footnoteLabel = settings.footnoteLabel || 'Footnotes'\n  // To do: next major: move to `state.options`.\n  state.footnoteLabelTagName = settings.footnoteLabelTagName || 'h2'\n  // To do: next major: move to `state.options`.\n  state.footnoteLabelProperties = settings.footnoteLabelProperties || {\n    className: ['sr-only']\n  }\n  // To do: next major: move to `state.options`.\n  state.footnoteBackLabel = settings.footnoteBackLabel || 'Back to content'\n  // To do: next major: move to `state.options`.\n  state.unknownHandler = settings.unknownHandler\n  // To do: next major: move to `state.options`.\n  state.passThrough = settings.passThrough\n\n  state.handlers = {...handlers, ...settings.handlers}\n\n  // To do: next major: replace utility with `definitionById` object, so we\n  // only walk once (as we need footnotes too).\n  state.definition = definitions(tree)\n  state.footnoteById = footnoteById\n  /** @type {Array} */\n  state.footnoteOrder = []\n  /** @type {Record} */\n  state.footnoteCounts = {}\n\n  state.patch = patch\n  state.applyData = applyData\n  state.one = oneBound\n  state.all = allBound\n  state.wrap = wrap\n  // To do: next major: remove `augment`.\n  state.augment = augment\n\n  visit(tree, 'footnoteDefinition', (definition) => {\n    const id = String(definition.identifier).toUpperCase()\n\n    // Mimick CM behavior of link definitions.\n    // See: .\n    if (!own.call(footnoteById, id)) {\n      footnoteById[id] = definition\n    }\n  })\n\n  // @ts-expect-error Hush, it\u2019s fine!\n  return state\n\n  /**\n   * Finalise the created `right`, a hast node, from `left`, an mdast node.\n   *\n   * @param {MdastNodeWithData | PositionLike | null | undefined} left\n   * @param {HastElementContent} right\n   * @returns {HastElementContent}\n   */\n  /* c8 ignore start */\n  // To do: next major: remove.\n  function augment(left, right) {\n    // Handle `data.hName`, `data.hProperties, `data.hChildren`.\n    if (left && 'data' in left && left.data) {\n      /** @type {MdastData} */\n      const data = left.data\n\n      if (data.hName) {\n        if (right.type !== 'element') {\n          right = {\n            type: 'element',\n            tagName: '',\n            properties: {},\n            children: []\n          }\n        }\n\n        right.tagName = data.hName\n      }\n\n      if (right.type === 'element' && data.hProperties) {\n        right.properties = {...right.properties, ...data.hProperties}\n      }\n\n      if ('children' in right && right.children && data.hChildren) {\n        right.children = data.hChildren\n      }\n    }\n\n    if (left) {\n      const ctx = 'type' in left ? left : {position: left}\n\n      if (!generated(ctx)) {\n        // @ts-expect-error: fine.\n        right.position = {start: pointStart(ctx), end: pointEnd(ctx)}\n      }\n    }\n\n    return right\n  }\n  /* c8 ignore stop */\n\n  /**\n   * Create an element for `node`.\n   *\n   * @type {HFunctionProps}\n   */\n  /* c8 ignore start */\n  // To do: next major: remove.\n  function state(node, tagName, props, children) {\n    if (Array.isArray(props)) {\n      children = props\n      props = {}\n    }\n\n    // @ts-expect-error augmenting an element yields an element.\n    return augment(node, {\n      type: 'element',\n      tagName,\n      properties: props || {},\n      children: children || []\n    })\n  }\n  /* c8 ignore stop */\n\n  /**\n   * Transform an mdast node into a hast node.\n   *\n   * @param {MdastNodes} node\n   *   mdast node.\n   * @param {MdastParents | null | undefined} [parent]\n   *   Parent of `node`.\n   * @returns {HastElementContent | Array | null | undefined}\n   *   Resulting hast node.\n   */\n  function oneBound(node, parent) {\n    // @ts-expect-error: that\u2019s a state :)\n    return one(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 allBound(parent) {\n    // @ts-expect-error: that\u2019s a state :)\n    return all(state, parent)\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 {void}\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 {Type | HastElement}\n *   Nothing.\n */\nfunction applyData(from, to) {\n  /** @type {Type | HastElement} */\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 is likely to keep the content around (otherwise: pass\n      // `hChildren`).\n      else {\n        result = {\n          type: 'element',\n          tagName: hName,\n          properties: {},\n          children: []\n        }\n\n        // To do: next major: take the children from the `root`, or inject the\n        // raw/text/comment or so into the element?\n        // if ('children' in node) {\n        //   // @ts-expect-error: assume `children` are allowed in elements.\n        //   result.children = node.children\n        // } else {\n        //   // @ts-expect-error: assume `node` is allowed in elements.\n        //   result.children.push(node)\n        // }\n      }\n    }\n\n    if (result.type === 'element' && hProperties) {\n      result.properties = {...result.properties, ...hProperties}\n    }\n\n    if (\n      'children' in result &&\n      result.children &&\n      hChildren !== null &&\n      hChildren !== undefined\n    ) {\n      // @ts-expect-error: assume valid children are defined.\n      result.children = hChildren\n    }\n  }\n\n  return result\n}\n\n/**\n * Transform an mdast node into a hast node.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} node\n *   mdast node.\n * @param {MdastParents | null | undefined} [parent]\n *   Parent of `node`.\n * @returns {HastElementContent | Array | null | undefined}\n *   Resulting hast node.\n */\n// To do: next major: do not expose, keep bound.\nexport function one(state, node, parent) {\n  const type = node && node.type\n\n  // Fail on non-nodes.\n  if (!type) {\n    throw new Error('Expected node, got `' + node + '`')\n  }\n\n  if (own.call(state.handlers, type)) {\n    return state.handlers[type](state, node, parent)\n  }\n\n  if (state.passThrough && state.passThrough.includes(type)) {\n    // To do: next major: deep clone.\n    // @ts-expect-error: types of passed through nodes are expected to be added manually.\n    return 'children' in node ? {...node, children: all(state, node)} : node\n  }\n\n  if (state.unknownHandler) {\n    return state.unknownHandler(state, node, parent)\n  }\n\n  return defaultUnknownHandler(state, node)\n}\n\n/**\n * Transform the children of an mdast node into hast nodes.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} parent\n *   mdast node to compile\n * @returns {Array}\n *   Resulting hast nodes.\n */\n// To do: next major: do not expose, keep bound.\nexport function all(state, 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 = one(state, 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 = result.value.replace(/^\\s+/, '')\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 = head.value.replace(/^\\s+/, '')\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 * Transform an unknown node.\n *\n * @param {State} state\n *   Info passed around.\n * @param {MdastNodes} node\n *   Unknown mdast node.\n * @returns {HastText | HastElement}\n *   Resulting hast node.\n */\nfunction defaultUnknownHandler(state, node) {\n  const data = node.data || {}\n  /** @type {HastText | HastElement} */\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: all(state, 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 {HastContent} Type\n *   Node type.\n * @param {Array} nodes\n *   List of nodes to wrap.\n * @param {boolean | null | undefined} [loose=false]\n *   Whether to add line endings at start and end.\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 * @typedef {import('hast').Element} Element\n * @typedef {import('hast').ElementContent} ElementContent\n *\n * @typedef {import('./state.js').State} State\n */\n\nimport {normalizeUri} from 'micromark-util-sanitize-uri'\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 */\nexport function footer(state) {\n  /** @type {Array} */\n  const listItems = []\n  let index = -1\n\n  while (++index < state.footnoteOrder.length) {\n    const def = state.footnoteById[state.footnoteOrder[index]]\n\n    if (!def) {\n      continue\n    }\n\n    const content = state.all(def)\n    const id = String(def.identifier).toUpperCase()\n    const safeId = normalizeUri(id.toLowerCase())\n    let referenceIndex = 0\n    /** @type {Array} */\n    const backReferences = []\n\n    while (++referenceIndex <= state.footnoteCounts[id]) {\n      /** @type {Element} */\n      const backReference = {\n        type: 'element',\n        tagName: 'a',\n        properties: {\n          href:\n            '#' +\n            state.clobberPrefix +\n            'fnref-' +\n            safeId +\n            (referenceIndex > 1 ? '-' + referenceIndex : ''),\n          dataFootnoteBackref: true,\n          className: ['data-footnote-backref'],\n          ariaLabel: state.footnoteBackLabel\n        },\n        children: [{type: 'text', value: '\u21A9'}]\n      }\n\n      if (referenceIndex > 1) {\n        backReference.children.push({\n          type: 'element',\n          tagName: 'sup',\n          children: [{type: 'text', value: String(referenceIndex)}]\n        })\n      }\n\n      if (backReferences.length > 0) {\n        backReferences.push({type: 'text', value: ' '})\n      }\n\n      backReferences.push(backReference)\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: state.clobberPrefix + 'fn-' + safeId},\n      children: state.wrap(content, true)\n    }\n\n    state.patch(def, 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: state.footnoteLabelTagName,\n        properties: {\n          // To do: use structured clone.\n          ...JSON.parse(JSON.stringify(state.footnoteLabelProperties)),\n          id: 'footnote-label'\n        },\n        children: [{type: 'text', value: state.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 * @typedef {import('hast').Content} HastContent\n * @typedef {import('hast').Root} HastRoot\n *\n * @typedef {import('mdast').Content} MdastContent\n * @typedef {import('mdast').Root} MdastRoot\n *\n * @typedef {import('./state.js').Options} Options\n */\n\n/**\n * @typedef {HastRoot | HastContent} HastNodes\n * @typedef {MdastRoot | MdastContent} MdastNodes\n */\n\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.\n * @returns {HastNodes | null | undefined}\n * hast tree.\n */\n// To do: next major: always return a single `root`.\nexport function toHast(tree, options) {\n const state = createState(tree, options)\n const node = state.one(tree, null)\n const foot = footer(state)\n\n if (foot) {\n // @ts-expect-error If there\u2019s a footer, there were definitions, meaning block\n // content.\n // So assume `node` is a parent node.\n node.children.push({type: 'text', value: '\\n'}, foot)\n }\n\n // To do: next major: always return root?\n return Array.isArray(node) ? {type: 'root', children: node} : node\n}\n", "/**\n * @typedef {import('hast').Root} HastRoot\n * @typedef {import('mdast').Root} MdastRoot\n * @typedef {import('mdast-util-to-hast').Options} Options\n * @typedef {import('unified').Processor} Processor\n *\n * @typedef {import('mdast-util-to-hast')} DoNotTouchAsThisImportIncludesRawInTree\n */\n\nimport {toHast} from 'mdast-util-to-hast'\n\n// Note: the `` overload doesn\u2019t seem to work :'(\n\n/**\n * Plugin that turns markdown into HTML to support rehype.\n *\n * * If a destination processor is given, that processor runs with a new HTML\n * (hast) tree (bridge-mode).\n * As the given processor runs with a hast tree, and rehype plugins support\n * hast, that means rehype plugins can be used with the given processor.\n * The hast tree is discarded in the end.\n * It\u2019s highly unlikely that you want to do this.\n * * The common case is to not pass a destination processor, in which case the\n * current processor continues running with a new HTML (hast) tree\n * (mutate-mode).\n * As the current processor continues with a hast tree, and rehype plugins\n * support hast, that means rehype plugins can be used after\n * `remark-rehype`.\n * It\u2019s likely that this is what you want to do.\n *\n * @param destination\n * Optional unified processor.\n * @param options\n * Options passed to `mdast-util-to-hast`.\n */\nconst remarkRehype =\n /** @type {(import('unified').Plugin<[Processor, Options?]|[null|undefined, Options?]|[Options]|[], MdastRoot>)} */\n (\n function (destination, options) {\n return destination && 'run' in destination\n ? bridge(destination, options)\n : mutate(destination || options)\n }\n )\n\nexport default remarkRehype\n\n/**\n * Bridge-mode.\n * Runs the destination with the new hast tree.\n *\n * @type {import('unified').Plugin<[Processor, Options?], MdastRoot>}\n */\nfunction bridge(destination, options) {\n return (node, file, next) => {\n destination.run(toHast(node, options), file, (error) => {\n next(error)\n })\n }\n}\n\n/**\n * Mutate-mode.\n * Further plugins run on the hast tree.\n *\n * @type {import('unified').Plugin<[Options?]|void[], MdastRoot, HastRoot>}\n */\nfunction mutate(options) {\n // @ts-expect-error: assume a corresponding node is returned by `toHast`.\n return (node) => toHast(node, options)\n}\n", "/**\n * @typedef {import('./info.js').Info} Info\n * @typedef {Record} Properties\n * @typedef {Record} Normal\n */\n\nexport class Schema {\n /**\n * @constructor\n * @param {Properties} property\n * @param {Normal} normal\n * @param {string} [space]\n */\n constructor(property, normal, space) {\n this.property = property\n this.normal = normal\n if (space) {\n this.space = space\n }\n }\n}\n\n/** @type {Properties} */\nSchema.prototype.property = {}\n/** @type {Normal} */\nSchema.prototype.normal = {}\n/** @type {string|null} */\nSchema.prototype.space = null\n", "/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n */\n\nimport {Schema} from './schema.js'\n\n/**\n * @param {Schema[]} definitions\n * @param {string} [space]\n * @returns {Schema}\n */\nexport function merge(definitions, space) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n let index = -1\n\n while (++index < definitions.length) {\n Object.assign(property, definitions[index].property)\n Object.assign(normal, definitions[index].normal)\n }\n\n return new Schema(property, normal, space)\n}\n", "/**\n * @param {string} value\n * @returns {string}\n */\nexport function normalize(value) {\n return value.toLowerCase()\n}\n", "export class Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n */\n constructor(property, attribute) {\n /** @type {string} */\n this.property = property\n /** @type {string} */\n this.attribute = attribute\n }\n}\n\n/** @type {string|null} */\nInfo.prototype.space = null\nInfo.prototype.boolean = false\nInfo.prototype.booleanish = false\nInfo.prototype.overloadedBoolean = false\nInfo.prototype.number = false\nInfo.prototype.commaSeparated = false\nInfo.prototype.spaceSeparated = false\nInfo.prototype.commaOrSpaceSeparated = false\nInfo.prototype.mustUseProperty = false\nInfo.prototype.defined = false\n", "let powers = 0\n\nexport const boolean = increment()\nexport const booleanish = increment()\nexport const overloadedBoolean = increment()\nexport const number = increment()\nexport const spaceSeparated = increment()\nexport const commaSeparated = increment()\nexport const commaOrSpaceSeparated = increment()\n\nfunction increment() {\n return 2 ** ++powers\n}\n", "import {Info} from './info.js'\nimport * as types from './types.js'\n\n/** @type {Array} */\n// @ts-expect-error: hush.\nconst checks = Object.keys(types)\n\nexport class DefinedInfo extends Info {\n /**\n * @constructor\n * @param {string} property\n * @param {string} attribute\n * @param {number|null} [mask]\n * @param {string} [space]\n */\n constructor(property, attribute, mask, space) {\n let index = -1\n\n super(property, attribute)\n\n mark(this, 'space', space)\n\n if (typeof mask === 'number') {\n while (++index < checks.length) {\n const check = checks[index]\n mark(this, checks[index], (mask & types[check]) === types[check])\n }\n }\n }\n}\n\nDefinedInfo.prototype.defined = true\n\n/**\n * @param {DefinedInfo} values\n * @param {string} key\n * @param {unknown} value\n */\nfunction mark(values, key, value) {\n if (value) {\n // @ts-expect-error: assume `value` matches the expected value of `key`.\n values[key] = value\n }\n}\n", "/**\n * @typedef {import('./schema.js').Properties} Properties\n * @typedef {import('./schema.js').Normal} Normal\n *\n * @typedef {Record} Attributes\n *\n * @typedef {Object} Definition\n * @property {Record} properties\n * @property {(attributes: Attributes, property: string) => string} transform\n * @property {string} [space]\n * @property {Attributes} [attributes]\n * @property {Array} [mustUseProperty]\n */\n\nimport {normalize} from '../normalize.js'\nimport {Schema} from './schema.js'\nimport {DefinedInfo} from './defined-info.js'\n\nconst own = {}.hasOwnProperty\n\n/**\n * @param {Definition} definition\n * @returns {Schema}\n */\nexport function create(definition) {\n /** @type {Properties} */\n const property = {}\n /** @type {Normal} */\n const normal = {}\n /** @type {string} */\n let prop\n\n for (prop in definition.properties) {\n if (own.call(definition.properties, prop)) {\n const value = definition.properties[prop]\n const info = new DefinedInfo(\n prop,\n definition.transform(definition.attributes || {}, prop),\n value,\n definition.space\n )\n\n if (\n definition.mustUseProperty &&\n definition.mustUseProperty.includes(prop)\n ) {\n info.mustUseProperty = true\n }\n\n property[prop] = info\n\n normal[normalize(prop)] = prop\n normal[normalize(info.attribute)] = prop\n }\n }\n\n return new Schema(property, normal, definition.space)\n}\n", "import {create} from './util/create.js'\n\nexport const xlink = create({\n space: 'xlink',\n transform(_, prop) {\n return 'xlink:' + prop.slice(5).toLowerCase()\n },\n properties: {\n xLinkActuate: null,\n xLinkArcRole: null,\n xLinkHref: null,\n xLinkRole: null,\n xLinkShow: null,\n xLinkTitle: null,\n xLinkType: null\n }\n})\n", "import {create} from './util/create.js'\n\nexport const xml = create({\n space: 'xml',\n transform(_, prop) {\n return 'xml:' + prop.slice(3).toLowerCase()\n },\n properties: {xmlLang: null, xmlBase: null, xmlSpace: null}\n})\n", "/**\n * @param {Record} attributes\n * @param {string} attribute\n * @returns {string}\n */\nexport function caseSensitiveTransform(attributes, attribute) {\n return attribute in attributes ? attributes[attribute] : attribute\n}\n", "import {caseSensitiveTransform} from './case-sensitive-transform.js'\n\n/**\n * @param {Record} attributes\n * @param {string} property\n * @returns {string}\n */\nexport function caseInsensitiveTransform(attributes, property) {\n return caseSensitiveTransform(attributes, property.toLowerCase())\n}\n", "import {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const xmlns = create({\n space: 'xmlns',\n attributes: {xmlnsxlink: 'xmlns:xlink'},\n transform: caseInsensitiveTransform,\n properties: {xmlns: null, xmlnsXLink: null}\n})\n", "import {booleanish, number, spaceSeparated} from './util/types.js'\nimport {create} from './util/create.js'\n\nexport const aria = create({\n transform(_, prop) {\n return prop === 'role' ? prop : 'aria-' + prop.slice(4).toLowerCase()\n },\n properties: {\n ariaActiveDescendant: null,\n ariaAtomic: booleanish,\n ariaAutoComplete: null,\n ariaBusy: booleanish,\n ariaChecked: booleanish,\n ariaColCount: number,\n ariaColIndex: number,\n ariaColSpan: number,\n ariaControls: spaceSeparated,\n ariaCurrent: null,\n ariaDescribedBy: spaceSeparated,\n ariaDetails: null,\n ariaDisabled: booleanish,\n ariaDropEffect: spaceSeparated,\n ariaErrorMessage: null,\n ariaExpanded: booleanish,\n ariaFlowTo: spaceSeparated,\n ariaGrabbed: booleanish,\n ariaHasPopup: null,\n ariaHidden: booleanish,\n ariaInvalid: null,\n ariaKeyShortcuts: null,\n ariaLabel: null,\n ariaLabelledBy: spaceSeparated,\n ariaLevel: number,\n ariaLive: null,\n ariaModal: booleanish,\n ariaMultiLine: booleanish,\n ariaMultiSelectable: booleanish,\n ariaOrientation: null,\n ariaOwns: spaceSeparated,\n ariaPlaceholder: null,\n ariaPosInSet: number,\n ariaPressed: booleanish,\n ariaReadOnly: booleanish,\n ariaRelevant: null,\n ariaRequired: booleanish,\n ariaRoleDescription: spaceSeparated,\n ariaRowCount: number,\n ariaRowIndex: number,\n ariaRowSpan: number,\n ariaSelected: booleanish,\n ariaSetSize: number,\n ariaSort: null,\n ariaValueMax: number,\n ariaValueMin: number,\n ariaValueNow: number,\n ariaValueText: null,\n role: null\n }\n})\n", "import {\n boolean,\n overloadedBoolean,\n booleanish,\n number,\n spaceSeparated,\n commaSeparated\n} from './util/types.js'\nimport {create} from './util/create.js'\nimport {caseInsensitiveTransform} from './util/case-insensitive-transform.js'\n\nexport const html = create({\n space: 'html',\n attributes: {\n acceptcharset: 'accept-charset',\n classname: 'class',\n htmlfor: 'for',\n httpequiv: 'http-equiv'\n },\n transform: caseInsensitiveTransform,\n mustUseProperty: ['checked', 'multiple', 'muted', 'selected'],\n properties: {\n // Standard Properties.\n abbr: null,\n accept: commaSeparated,\n acceptCharset: spaceSeparated,\n accessKey: spaceSeparated,\n action: null,\n allow: null,\n allowFullScreen: boolean,\n allowPaymentRequest: boolean,\n allowUserMedia: boolean,\n alt: null,\n as: null,\n async: boolean,\n autoCapitalize: null,\n autoComplete: spaceSeparated,\n autoFocus: boolean,\n autoPlay: boolean,\n capture: boolean,\n charSet: null,\n checked: boolean,\n cite: null,\n className: spaceSeparated,\n cols: number,\n colSpan: null,\n content: null,\n contentEditable: booleanish,\n controls: boolean,\n controlsList: spaceSeparated,\n coords: number | commaSeparated,\n crossOrigin: null,\n data: null,\n dateTime: null,\n decoding: null,\n default: boolean,\n defer: boolean,\n dir: null,\n dirName: null,\n disabled: boolean,\n download: overloadedBoolean,\n draggable: booleanish,\n encType: null,\n enterKeyHint: null,\n form: null,\n formAction: null,\n formEncType: null,\n formMethod: null,\n formNoValidate: boolean,\n formTarget: null,\n headers: spaceSeparated,\n height: number,\n hidden: boolean,\n high: number,\n href: null,\n hrefLang: null,\n htmlFor: spaceSeparated,\n httpEquiv: spaceSeparated,\n id: null,\n imageSizes: null,\n imageSrcSet: null,\n inputMode: null,\n integrity: null,\n is: null,\n isMap: boolean,\n itemId: null,\n itemProp: spaceSeparated,\n itemRef: spaceSeparated,\n itemScope: boolean,\n itemType: spaceSeparated,\n kind: null,\n label: null,\n lang: null,\n language: null,\n list: null,\n loading: null,\n loop: boolean,\n low: number,\n manifest: null,\n max: null,\n maxLength: number,\n media: null,\n method: null,\n min: null,\n minLength: number,\n multiple: boolean,\n muted: boolean,\n name: null,\n nonce: null,\n noModule: boolean,\n noValidate: boolean,\n onAbort: null,\n onAfterPrint: null,\n onAuxClick: null,\n onBeforeMatch: null,\n onBeforePrint: null,\n onBeforeUnload: null,\n onBlur: null,\n onCancel: null,\n onCanPlay: null,\n onCanPlayThrough: null,\n onChange: null,\n onClick: null,\n onClose: null,\n onContextLost: null,\n onContextMenu: null,\n onContextRestored: null,\n onCopy: null,\n onCueChange: null,\n onCut: null,\n onDblClick: null,\n onDrag: null,\n onDragEnd: null,\n onDragEnter: null,\n onDragExit: null,\n onDragLeave: null,\n onDragOver: null,\n onDragStart: null,\n onDrop: null,\n onDurationChange: null,\n onEmptied: null,\n onEnded: null,\n onError: null,\n onFocus: null,\n onFormData: null,\n onHashChange: null,\n onInput: null,\n onInvalid: null,\n onKeyDown: null,\n onKeyPress: null,\n onKeyUp: null,\n onLanguageChange: null,\n onLoad: null,\n onLoadedData: null,\n onLoadedMetadata: null,\n onLoadEnd: null,\n onLoadStart: null,\n onMessage: null,\n onMessageError: null,\n onMouseDown: null,\n onMouseEnter: null,\n onMouseLeave: null,\n onMouseMove: null,\n onMouseOut: null,\n onMouseOver: null,\n onMouseUp: null,\n onOffline: null,\n onOnline: null,\n onPageHide: null,\n onPageShow: null,\n onPaste: null,\n onPause: null,\n onPlay: null,\n onPlaying: null,\n onPopState: null,\n onProgress: null,\n onRateChange: null,\n onRejectionHandled: null,\n onReset: null,\n onResize: null,\n onScroll: null,\n onScrollEnd: null,\n onSecurityPolicyViolation: null,\n onSeeked: null,\n onSeeking: null,\n onSelect: null,\n onSlotChange: null,\n onStalled: null,\n onStorage: null,\n onSubmit: null,\n onSuspend: null,\n onTimeUpdate: null,\n onToggle: null,\n onUnhandledRejection: null,\n onUnload: null,\n onVolumeChange: null,\n onWaiting: null,\n onWheel: null,\n open: boolean,\n optimum: number,\n pattern: null,\n ping: spaceSeparated,\n placeholder: null,\n playsInline: boolean,\n poster: null,\n preload: null,\n readOnly: boolean,\n referrerPolicy: null,\n rel: spaceSeparated,\n required: boolean,\n reversed: boolean,\n rows: number,\n rowSpan: number,\n sandbox: spaceSeparated,\n scope: null,\n scoped: boolean,\n seamless: boolean,\n selected: boolean,\n shape: null,\n size: number,\n sizes: null,\n slot: null,\n span: number,\n spellCheck: booleanish,\n src: null,\n srcDoc: null,\n srcLang: null,\n srcSet: null,\n start: number,\n step: null,\n style: null,\n tabIndex: number,\n target: null,\n title: null,\n translate: null,\n type: null,\n typeMustMatch: boolean,\n useMap: null,\n value: booleanish,\n width: number,\n wrap: null,\n\n // Legacy.\n // See: https://html.spec.whatwg.org/#other-elements,-attributes-and-apis\n align: null, // Several. Use CSS `text-align` instead,\n aLink: null, // ``. Use CSS `a:active {color}` instead\n archive: spaceSeparated, // ``. List of URIs to archives\n axis: null, // `
` and ``. Use `scope` on ``\n background: null, // ``. Use CSS `background-image` instead\n bgColor: null, // `` and table elements. Use CSS `background-color` instead\n border: number, // ``. Use CSS `border-width` instead,\n borderColor: null, // `
`. Use CSS `border-color` instead,\n bottomMargin: number, // ``\n cellPadding: null, // `
`\n cellSpacing: null, // `
`\n char: null, // Several table elements. When `align=char`, sets the character to align on\n charOff: null, // Several table elements. When `char`, offsets the alignment\n classId: null, // ``\n clear: null, // `
`. Use CSS `clear` instead\n code: null, // ``\n codeBase: null, // ``\n codeType: null, // ``\n color: null, // `` and `
`. Use CSS instead\n compact: boolean, // Lists. Use CSS to reduce space between items instead\n declare: boolean, // ``\n event: null, // `