@vuu-ui/vuu-data-react 0.8.22 → 0.8.23-debug
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/index.js +574 -446
- package/cjs/index.js.map +4 -4
- package/esm/index.js +559 -446
- package/esm/index.js.map +4 -4
- package/package.json +13 -13
- package/types/hooks/useDataSource.d.ts +2 -2
- package/types/hooks/useTypeaheadSuggestions.d.ts +3 -2
- package/LICENSE +0 -201
- package/index.css +0 -2
- package/index.css.map +0 -7
package/esm/index.js
CHANGED
|
@@ -1,447 +1,560 @@
|
|
|
1
|
-
var EE=Object.create;var Pg=Object.defineProperty;var ME=Object.getOwnPropertyDescriptor;var TE=Object.getOwnPropertyNames;var IE=Object.getPrototypeOf,LE=Object.prototype.hasOwnProperty;var PE=(t=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(t,{get:(e,n)=>(typeof require<"u"?require:e)[n]}):t)(function(t){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+t+'" is not supported')});var Wi=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var DE=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of TE(e))!LE.call(t,o)&&o!==n&&Pg(t,o,{get:()=>e[o],enumerable:!(r=ME(e,o))||r.enumerable});return t};var nd=(t,e,n)=>(n=t!=null?EE(IE(t)):{},DE(e||!t||!t.__esModule?Pg(n,"default",{value:t,enumerable:!0}):n,t));var Hg=Wi((sO,Og)=>{"use strict";var Rg=Object.getOwnPropertySymbols,BE=Object.prototype.hasOwnProperty,VE=Object.prototype.propertyIsEnumerable;function zE(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function $E(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de",Object.getOwnPropertyNames(t)[0]==="5")return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;var r=Object.getOwnPropertyNames(e).map(function(i){return e[i]});if(r.join("")!=="0123456789")return!1;var o={};return"abcdefghijklmnopqrst".split("").forEach(function(i){o[i]=i}),Object.keys(Object.assign({},o)).join("")==="abcdefghijklmnopqrst"}catch{return!1}}Og.exports=$E()?Object.assign:function(t,e){for(var n,r=zE(t),o,i=1;i<arguments.length;i++){n=Object(arguments[i]);for(var s in n)BE.call(n,s)&&(r[s]=n[s]);if(Rg){o=Rg(n);for(var l=0;l<o.length;l++)VE.call(n,o[l])&&(r[o[l]]=n[o[l]])}}return r}});var $g=Wi(fe=>{"use strict";var Oo,Gi,Wl,hd;typeof performance=="object"&&typeof performance.now=="function"?(Ng=performance,fe.unstable_now=function(){return Ng.now()}):(ld=Date,Fg=ld.now(),fe.unstable_now=function(){return ld.now()-Fg});var Ng,ld,Fg;typeof window>"u"||typeof MessageChannel!="function"?(Ro=null,ad=null,ud=function(){if(Ro!==null)try{var t=fe.unstable_now();Ro(!0,t),Ro=null}catch(e){throw setTimeout(ud,0),e}},Oo=function(t){Ro!==null?setTimeout(Oo,0,t):(Ro=t,setTimeout(ud,0))},Gi=function(t,e){ad=setTimeout(t,e)},Wl=function(){clearTimeout(ad)},fe.unstable_shouldYield=function(){return!1},hd=fe.unstable_forceFrameRate=function(){}):(Bg=window.setTimeout,Vg=window.clearTimeout,typeof console<"u"&&(zg=window.cancelAnimationFrame,typeof window.requestAnimationFrame!="function"&&console.error("This browser doesn't support requestAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills"),typeof zg!="function"&&console.error("This browser doesn't support cancelAnimationFrame. Make sure that you load a polyfill in older browsers. https://reactjs.org/link/react-polyfills")),ji=!1,qi=null,zl=-1,cd=5,dd=0,fe.unstable_shouldYield=function(){return fe.unstable_now()>=dd},hd=function(){},fe.unstable_forceFrameRate=function(t){0>t||125<t?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):cd=0<t?Math.floor(1e3/t):5},fd=new MessageChannel,$l=fd.port2,fd.port1.onmessage=function(){if(qi!==null){var t=fe.unstable_now();dd=t+cd;try{qi(!0,t)?$l.postMessage(null):(ji=!1,qi=null)}catch(e){throw $l.postMessage(null),e}}else ji=!1},Oo=function(t){qi=t,ji||(ji=!0,$l.postMessage(null))},Gi=function(t,e){zl=Bg(function(){t(fe.unstable_now())},e)},Wl=function(){Vg(zl),zl=-1});var Ro,ad,ud,Bg,Vg,zg,ji,qi,zl,cd,dd,fd,$l;function pd(t,e){var n=t.length;t.push(e);e:for(;;){var r=n-1>>>1,o=t[r];if(o!==void 0&&0<_l(o,e))t[r]=e,t[n]=o,n=r;else break e}}function sn(t){return t=t[0],t===void 0?null:t}function Kl(t){var e=t[0];if(e!==void 0){var n=t.pop();if(n!==e){t[0]=n;e:for(var r=0,o=t.length;r<o;){var i=2*(r+1)-1,s=t[i],l=i+1,a=t[l];if(s!==void 0&&0>_l(s,n))a!==void 0&&0>_l(a,s)?(t[r]=a,t[l]=n,r=l):(t[r]=s,t[i]=n,r=i);else if(a!==void 0&&0>_l(a,n))t[r]=a,t[l]=n,r=l;else break e}}return e}return null}function _l(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}var mn=[],er=[],_E=1,_t=null,nt=3,Ul=!1,Br=!1,Ji=!1;function md(t){for(var e=sn(er);e!==null;){if(e.callback===null)Kl(er);else if(e.startTime<=t)Kl(er),e.sortIndex=e.expirationTime,pd(mn,e);else break;e=sn(er)}}function gd(t){if(Ji=!1,md(t),!Br)if(sn(mn)!==null)Br=!0,Oo(vd);else{var e=sn(er);e!==null&&Gi(gd,e.startTime-t)}}function vd(t,e){Br=!1,Ji&&(Ji=!1,Wl()),Ul=!0;var n=nt;try{for(md(e),_t=sn(mn);_t!==null&&(!(_t.expirationTime>e)||t&&!fe.unstable_shouldYield());){var r=_t.callback;if(typeof r=="function"){_t.callback=null,nt=_t.priorityLevel;var o=r(_t.expirationTime<=e);e=fe.unstable_now(),typeof o=="function"?_t.callback=o:_t===sn(mn)&&Kl(mn),md(e)}else Kl(mn);_t=sn(mn)}if(_t!==null)var i=!0;else{var s=sn(er);s!==null&&Gi(gd,s.startTime-e),i=!1}return i}finally{_t=null,nt=n,Ul=!1}}var WE=hd;fe.unstable_IdlePriority=5;fe.unstable_ImmediatePriority=1;fe.unstable_LowPriority=4;fe.unstable_NormalPriority=3;fe.unstable_Profiling=null;fe.unstable_UserBlockingPriority=2;fe.unstable_cancelCallback=function(t){t.callback=null};fe.unstable_continueExecution=function(){Br||Ul||(Br=!0,Oo(vd))};fe.unstable_getCurrentPriorityLevel=function(){return nt};fe.unstable_getFirstCallbackNode=function(){return sn(mn)};fe.unstable_next=function(t){switch(nt){case 1:case 2:case 3:var e=3;break;default:e=nt}var n=nt;nt=e;try{return t()}finally{nt=n}};fe.unstable_pauseExecution=function(){};fe.unstable_requestPaint=WE;fe.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=nt;nt=t;try{return e()}finally{nt=n}};fe.unstable_scheduleCallback=function(t,e,n){var r=fe.unstable_now();switch(typeof n=="object"&&n!==null?(n=n.delay,n=typeof n=="number"&&0<n?r+n:r):n=r,t){case 1:var o=-1;break;case 2:o=250;break;case 5:o=1073741823;break;case 4:o=1e4;break;default:o=5e3}return o=n+o,t={id:_E++,callback:e,priorityLevel:t,startTime:n,expirationTime:o,sortIndex:-1},n>r?(t.sortIndex=n,pd(er,t),sn(mn)===null&&t===sn(er)&&(Ji?Wl():Ji=!0,Gi(gd,n-r))):(t.sortIndex=o,pd(mn,t),Br||Ul||(Br=!0,Oo(vd))),t};fe.unstable_wrapCallback=function(t){var e=nt;return function(){var n=nt;nt=e;try{return t.apply(this,arguments)}finally{nt=n}}}});var Wg=Wi((aO,_g)=>{"use strict";_g.exports=$g()});var Ly=Wi(Gt=>{"use strict";var Ba=PE("react"),we=Hg(),je=Wg();function V(t){for(var e="https://reactjs.org/docs/error-decoder.html?invariant="+t,n=1;n<arguments.length;n++)e+="&args[]="+encodeURIComponent(arguments[n]);return"Minified React error #"+t+"; visit "+e+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}if(!Ba)throw Error(V(227));var n0=new Set,Es={};function Jr(t,e){ti(t,e),ti(t+"Capture",e)}function ti(t,e){for(Es[t]=e,t=0;t<e.length;t++)n0.add(e[t])}var Wn=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),KE=/^[: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]*$/,Kg=Object.prototype.hasOwnProperty,Ug={},jg={};function UE(t){return Kg.call(jg,t)?!0:Kg.call(Ug,t)?!1:KE.test(t)?jg[t]=!0:(Ug[t]=!0,!1)}function jE(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 qE(t,e,n,r){if(e===null||typeof e>"u"||jE(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 ht(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 Ye={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){Ye[t]=new ht(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];Ye[e]=new ht(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){Ye[t]=new ht(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){Ye[t]=new ht(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){Ye[t]=new ht(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){Ye[t]=new ht(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){Ye[t]=new ht(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){Ye[t]=new ht(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){Ye[t]=new ht(t,5,!1,t.toLowerCase(),null,!1,!1)});var Tf=/[\-:]([a-z])/g;function If(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(Tf,If);Ye[e]=new ht(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(Tf,If);Ye[e]=new ht(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(Tf,If);Ye[e]=new ht(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){Ye[t]=new ht(t,1,!1,t.toLowerCase(),null,!1,!1)});Ye.xlinkHref=new ht("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){Ye[t]=new ht(t,1,!1,t.toLowerCase(),null,!0,!0)});function Lf(t,e,n,r){var o=Ye.hasOwnProperty(e)?Ye[e]:null,i=o!==null?o.type===0:r?!1:!(!(2<e.length)||e[0]!=="o"&&e[0]!=="O"||e[1]!=="n"&&e[1]!=="N");i||(qE(e,n,o,r)&&(n=null),r||o===null?UE(e)&&(n===null?t.removeAttribute(e):t.setAttribute(e,""+n)):o.mustUseProperty?t[o.propertyName]=n===null?o.type===3?!1:"":n:(e=o.attributeName,r=o.attributeNamespace,n===null?t.removeAttribute(e):(o=o.type,n=o===3||o===4&&n===!0?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}var Zr=Ba.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,as=60103,zr=60106,nr=60107,Pf=60108,hs=60114,Df=60109,Af=60110,Va=60112,ps=60113,ma=60120,za=60115,Rf=60116,Of=60121,Hf=60128,r0=60129,Nf=60130,zd=60131;typeof Symbol=="function"&&Symbol.for&&(ze=Symbol.for,as=ze("react.element"),zr=ze("react.portal"),nr=ze("react.fragment"),Pf=ze("react.strict_mode"),hs=ze("react.profiler"),Df=ze("react.provider"),Af=ze("react.context"),Va=ze("react.forward_ref"),ps=ze("react.suspense"),ma=ze("react.suspense_list"),za=ze("react.memo"),Rf=ze("react.lazy"),Of=ze("react.block"),ze("react.scope"),Hf=ze("react.opaque.id"),r0=ze("react.debug_trace_mode"),Nf=ze("react.offscreen"),zd=ze("react.legacy_hidden"));var ze,qg=typeof Symbol=="function"&&Symbol.iterator;function Zi(t){return t===null||typeof t!="object"?null:(t=qg&&t[qg]||t["@@iterator"],typeof t=="function"?t:null)}var yd;function us(t){if(yd===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);yd=e&&e[1]||""}return`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`+o[s].replace(" at new "," at ");while(1<=s&&0<=l);break}}}finally{bd=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?us(t):""}function GE(t){switch(t.tag){case 5:return us(t.type);case 16:return us("Lazy");case 13:return us("Suspense");case 19:return us("SuspenseList");case 0:case 2:case 15:return t=jl(t.type,!1),t;case 11:return t=jl(t.type.render,!1),t;case 22:return t=jl(t.type._render,!1),t;case 1:return t=jl(t.type,!0),t;default:return""}}function Uo(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 nr:return"Fragment";case zr:return"Portal";case hs:return"Profiler";case Pf:return"StrictMode";case ps:return"Suspense";case ma:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case Af:return(t.displayName||"Context")+".Consumer";case Df:return(t._context.displayName||"Context")+".Provider";case Va:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case za:return Uo(t.type);case Of:return Uo(t._render);case Rf:e=t._payload,t=t._init;try{return Uo(t(e))}catch{}}return null}function pr(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function o0(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function JE(t){var e=o0(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 ql(t){t._valueTracker||(t._valueTracker=JE(t))}function i0(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=o0(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function ga(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 $d(t,e){var n=e.checked;return we({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:t._wrapperState.initialChecked})}function Gg(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=pr(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 s0(t,e){e=e.checked,e!=null&&Lf(t,"checked",e,!1)}function _d(t,e){s0(t,e);var n=pr(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")?Wd(t,e.type,n):e.hasOwnProperty("defaultValue")&&Wd(t,e.type,pr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function Jg(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 Wd(t,e,n){(e!=="number"||ga(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}function ZE(t){var e="";return Ba.Children.forEach(t,function(n){n!=null&&(e+=n)}),e}function Kd(t,e){return t=we({children:void 0},e),(e=ZE(e.children))&&(t.children=e),t}function jo(t,e,n,r){if(t=t.options,e){e={};for(var o=0;o<n.length;o++)e["$"+n[o]]=!0;for(n=0;n<t.length;n++)o=e.hasOwnProperty("$"+t[n].value),t[n].selected!==o&&(t[n].selected=o),o&&r&&(t[n].defaultSelected=!0)}else{for(n=""+pr(n),e=null,o=0;o<t.length;o++){if(t[o].value===n){t[o].selected=!0,r&&(t[o].defaultSelected=!0);return}e!==null||t[o].disabled||(e=t[o])}e!==null&&(e.selected=!0)}}function Ud(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(V(91));return we({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function Zg(t,e){var n=e.value;if(n==null){if(n=e.children,e=e.defaultValue,n!=null){if(e!=null)throw Error(V(92));if(Array.isArray(n)){if(!(1>=n.length))throw Error(V(93));n=n[0]}e=n}e==null&&(e=""),n=e}t._wrapperState={initialValue:pr(n)}}function l0(t,e){var n=pr(e.value),r=pr(e.defaultValue);n!=null&&(n=""+n,n!==t.value&&(t.value=n),e.defaultValue==null&&t.defaultValue!==n&&(t.defaultValue=n)),r!=null&&(t.defaultValue=""+r)}function Yg(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}var jd={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function a0(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function qd(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?a0(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var Gl,u0=function(t){return typeof MSApp<"u"&&MSApp.execUnsafeLocalFunction?function(e,n,r,o){MSApp.execUnsafeLocalFunction(function(){return t(e,n,r,o)})}:t}(function(t,e){if(t.namespaceURI!==jd.svg||"innerHTML"in t)t.innerHTML=e;else{for(Gl=Gl||document.createElement("div"),Gl.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=Gl.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function Ms(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var ms={animationIterationCount:!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},YE=["Webkit","ms","Moz","O"];Object.keys(ms).forEach(function(t){YE.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ms[e]=ms[t]})});function c0(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||ms.hasOwnProperty(t)&&ms[t]?(""+e).trim():e+"px"}function d0(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=c0(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var QE=we({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 Gd(t,e){if(e){if(QE[t]&&(e.children!=null||e.dangerouslySetInnerHTML!=null))throw Error(V(137,t));if(e.dangerouslySetInnerHTML!=null){if(e.children!=null)throw Error(V(60));if(!(typeof e.dangerouslySetInnerHTML=="object"&&"__html"in e.dangerouslySetInnerHTML))throw Error(V(61))}if(e.style!=null&&typeof e.style!="object")throw Error(V(62))}}function Jd(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}}function Ff(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Zd=null,qo=null,Go=null;function Qg(t){if(t=zs(t)){if(typeof Zd!="function")throw Error(V(280));var e=t.stateNode;e&&(e=ja(e),Zd(t.stateNode,t.type,e))}}function f0(t){qo?Go?Go.push(t):Go=[t]:qo=t}function h0(){if(qo){var t=qo,e=Go;if(Go=qo=null,Qg(t),e)for(t=0;t<e.length;t++)Qg(e[t])}}function Bf(t,e){return t(e)}function p0(t,e,n,r,o){return t(e,n,r,o)}function Vf(){}var m0=Bf,$r=!1,xd=!1;function zf(){(qo!==null||Go!==null)&&(Vf(),h0())}function XE(t,e,n){if(xd)return t(e,n);xd=!0;try{return m0(t,e,n)}finally{xd=!1,zf()}}function Ts(t,e){var n=t.stateNode;if(n===null)return null;var r=ja(n);if(r===null)return null;n=r[e];e:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(r=!r.disabled)||(t=t.type,r=!(t==="button"||t==="input"||t==="select"||t==="textarea")),t=!r;break e;default:t=!1}if(t)return null;if(n&&typeof n!="function")throw Error(V(231,e,typeof n));return n}var Yd=!1;if(Wn)try{Ho={},Object.defineProperty(Ho,"passive",{get:function(){Yd=!0}}),window.addEventListener("test",Ho,Ho),window.removeEventListener("test",Ho,Ho)}catch{Yd=!1}var Ho;function eM(t,e,n,r,o,i,s,l,a){var u=Array.prototype.slice.call(arguments,3);try{e.apply(n,u)}catch(c){this.onError(c)}}var gs=!1,va=null,ya=!1,Qd=null,tM={onError:function(t){gs=!0,va=t}};function nM(t,e,n,r,o,i,s,l,a){gs=!1,va=null,eM.apply(tM,arguments)}function rM(t,e,n,r,o,i,s,l,a){if(nM.apply(this,arguments),gs){if(gs){var u=va;gs=!1,va=null}else throw Error(V(198));ya||(ya=!0,Qd=u)}}function Yr(t){var e=t,n=t;if(t.alternate)for(;e.return;)e=e.return;else{t=e;do e=t,e.flags&1026&&(n=e.return),t=e.return;while(t)}return e.tag===3?n:null}function g0(t){if(t.tag===13){var e=t.memoizedState;if(e===null&&(t=t.alternate,t!==null&&(e=t.memoizedState)),e!==null)return e.dehydrated}return null}function Xg(t){if(Yr(t)!==t)throw Error(V(188))}function oM(t){var e=t.alternate;if(!e){if(e=Yr(t),e===null)throw Error(V(188));return e!==t?null:t}for(var n=t,r=e;;){var o=n.return;if(o===null)break;var i=o.alternate;if(i===null){if(r=o.return,r!==null){n=r;continue}break}if(o.child===i.child){for(i=o.child;i;){if(i===n)return Xg(o),t;if(i===r)return Xg(o),e;i=i.sibling}throw Error(V(188))}if(n.return!==r.return)n=o,r=i;else{for(var s=!1,l=o.child;l;){if(l===n){s=!0,n=o,r=i;break}if(l===r){s=!0,r=o,n=i;break}l=l.sibling}if(!s){for(l=i.child;l;){if(l===n){s=!0,n=i,r=o;break}if(l===r){s=!0,r=i,n=o;break}l=l.sibling}if(!s)throw Error(V(189))}}if(n.alternate!==r)throw Error(V(190))}if(n.tag!==3)throw Error(V(188));return n.stateNode.current===n?t:e}function v0(t){if(t=oM(t),!t)return null;for(var e=t;;){if(e.tag===5||e.tag===6)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}function ev(t,e){for(var n=t.alternate;e!==null;){if(e===t||e===n)return!0;e=e.return}return!1}var y0,$f,b0,x0,Xd=!1,gn=[],sr=null,lr=null,ar=null,Is=new Map,Ls=new Map,Yi=[],tv="mousedown mouseup touchcancel touchend touchstart auxclick dblclick pointercancel pointerdown pointerup dragend dragstart drop compositionend compositionstart keydown keypress keyup input textInput copy cut paste click change contextmenu reset submit".split(" ");function ef(t,e,n,r,o){return{blockedOn:t,domEventName:e,eventSystemFlags:n|16,nativeEvent:o,targetContainers:[r]}}function nv(t,e){switch(t){case"focusin":case"focusout":sr=null;break;case"dragenter":case"dragleave":lr=null;break;case"mouseover":case"mouseout":ar=null;break;case"pointerover":case"pointerout":Is.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Ls.delete(e.pointerId)}}function Qi(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t=ef(e,n,r,o,i),e!==null&&(e=zs(e),e!==null&&$f(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function iM(t,e,n,r,o){switch(e){case"focusin":return sr=Qi(sr,t,e,n,r,o),!0;case"dragenter":return lr=Qi(lr,t,e,n,r,o),!0;case"mouseover":return ar=Qi(ar,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return Is.set(i,Qi(Is.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Ls.set(i,Qi(Ls.get(i)||null,t,e,n,r,o)),!0}return!1}function sM(t){var e=_r(t.target);if(e!==null){var n=Yr(e);if(n!==null){if(e=n.tag,e===13){if(e=g0(n),e!==null){t.blockedOn=e,x0(t.lanePriority,function(){je.unstable_runWithPriority(t.priority,function(){b0(n)})});return}}else if(e===3&&n.stateNode.hydrate){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function ia(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=Uf(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n!==null)return e=zs(n),e!==null&&$f(e),t.blockedOn=n,!1;e.shift()}return!0}function rv(t,e,n){ia(t)&&n.delete(e)}function lM(){for(Xd=!1;0<gn.length;){var t=gn[0];if(t.blockedOn!==null){t=zs(t.blockedOn),t!==null&&y0(t);break}for(var e=t.targetContainers;0<e.length;){var n=Uf(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n!==null){t.blockedOn=n;break}e.shift()}t.blockedOn===null&&gn.shift()}sr!==null&&ia(sr)&&(sr=null),lr!==null&&ia(lr)&&(lr=null),ar!==null&&ia(ar)&&(ar=null),Is.forEach(rv),Ls.forEach(rv)}function Xi(t,e){t.blockedOn===e&&(t.blockedOn=null,Xd||(Xd=!0,je.unstable_scheduleCallback(je.unstable_NormalPriority,lM)))}function w0(t){function e(o){return Xi(o,t)}if(0<gn.length){Xi(gn[0],t);for(var n=1;n<gn.length;n++){var r=gn[n];r.blockedOn===t&&(r.blockedOn=null)}}for(sr!==null&&Xi(sr,t),lr!==null&&Xi(lr,t),ar!==null&&Xi(ar,t),Is.forEach(e),Ls.forEach(e),n=0;n<Yi.length;n++)r=Yi[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<Yi.length&&(n=Yi[0],n.blockedOn===null);)sM(n),n.blockedOn===null&&Yi.shift()}function Jl(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Vo={animationend:Jl("Animation","AnimationEnd"),animationiteration:Jl("Animation","AnimationIteration"),animationstart:Jl("Animation","AnimationStart"),transitionend:Jl("Transition","TransitionEnd")},wd={},S0={};Wn&&(S0=document.createElement("div").style,"AnimationEvent"in window||(delete Vo.animationend.animation,delete Vo.animationiteration.animation,delete Vo.animationstart.animation),"TransitionEvent"in window||delete Vo.transitionend.transition);function $a(t){if(wd[t])return wd[t];if(!Vo[t])return t;var e=Vo[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in S0)return wd[t]=e[n];return t}var C0=$a("animationend"),k0=$a("animationiteration"),E0=$a("animationstart"),M0=$a("transitionend"),T0=new Map,_f=new Map,aM=["abort","abort",C0,"animationEnd",k0,"animationIteration",E0,"animationStart","canplay","canPlay","canplaythrough","canPlayThrough","durationchange","durationChange","emptied","emptied","encrypted","encrypted","ended","ended","error","error","gotpointercapture","gotPointerCapture","load","load","loadeddata","loadedData","loadedmetadata","loadedMetadata","loadstart","loadStart","lostpointercapture","lostPointerCapture","playing","playing","progress","progress","seeking","seeking","stalled","stalled","suspend","suspend","timeupdate","timeUpdate",M0,"transitionEnd","waiting","waiting"];function Wf(t,e){for(var n=0;n<t.length;n+=2){var r=t[n],o=t[n+1];o="on"+(o[0].toUpperCase()+o.slice(1)),_f.set(r,e),T0.set(r,o),Jr(o,[r])}}var uM=je.unstable_now;uM();var me=8;function Fo(t){if(1&t)return me=15,1;if(2&t)return me=14,2;if(4&t)return me=13,4;var e=24&t;return e!==0?(me=12,e):t&32?(me=11,32):(e=192&t,e!==0?(me=10,e):t&256?(me=9,256):(e=3584&t,e!==0?(me=8,e):t&4096?(me=7,4096):(e=4186112&t,e!==0?(me=6,e):(e=62914560&t,e!==0?(me=5,e):t&67108864?(me=4,67108864):t&134217728?(me=3,134217728):(e=805306368&t,e!==0?(me=2,e):1073741824&t?(me=1,1073741824):(me=8,t))))))}function cM(t){switch(t){case 99:return 15;case 98:return 10;case 97:case 96:return 8;case 95:return 2;default:return 0}}function dM(t){switch(t){case 15:case 14:return 99;case 13:case 12:case 11:case 10:return 98;case 9:case 8:case 7:case 6:case 4:case 5:return 97;case 3:case 2:case 1:return 95;case 0:return 90;default:throw Error(V(358,t))}}function Ps(t,e){var n=t.pendingLanes;if(n===0)return me=0;var r=0,o=0,i=t.expiredLanes,s=t.suspendedLanes,l=t.pingedLanes;if(i!==0)r=i,o=me=15;else if(i=n&134217727,i!==0){var a=i&~s;a!==0?(r=Fo(a),o=me):(l&=i,l!==0&&(r=Fo(l),o=me))}else i=n&~s,i!==0?(r=Fo(i),o=me):l!==0&&(r=Fo(l),o=me);if(r===0)return 0;if(r=31-mr(r),r=n&((0>r?0:1<<r)<<1)-1,e!==0&&e!==r&&!(e&s)){if(Fo(e),o<=me)return e;me=o}if(e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-mr(e),o=1<<n,r|=t[n],e&=~o;return r}function I0(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function ba(t,e){switch(t){case 15:return 1;case 14:return 2;case 12:return t=Bo(24&~e),t===0?ba(10,e):t;case 10:return t=Bo(192&~e),t===0?ba(8,e):t;case 8:return t=Bo(3584&~e),t===0&&(t=Bo(4186112&~e),t===0&&(t=512)),t;case 2:return e=Bo(805306368&~e),e===0&&(e=268435456),e}throw Error(V(358,t))}function Bo(t){return t&-t}function Sd(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function _a(t,e,n){t.pendingLanes|=e;var r=e-1;t.suspendedLanes&=r,t.pingedLanes&=r,t=t.eventTimes,e=31-mr(e),t[e]=n}var mr=Math.clz32?Math.clz32:pM,fM=Math.log,hM=Math.LN2;function pM(t){return t===0?32:31-(fM(t)/hM|0)|0}var mM=je.unstable_UserBlockingPriority,gM=je.unstable_runWithPriority,sa=!0;function vM(t,e,n,r){$r||Vf();var o=Kf,i=$r;$r=!0;try{p0(o,t,e,n,r)}finally{($r=i)||zf()}}function yM(t,e,n,r){gM(mM,Kf.bind(null,t,e,n,r))}function Kf(t,e,n,r){if(sa){var o;if((o=(e&4)===0)&&0<gn.length&&-1<tv.indexOf(t))t=ef(null,t,e,n,r),gn.push(t);else{var i=Uf(t,e,n,r);if(i===null)o&&nv(t,r);else{if(o){if(-1<tv.indexOf(t)){t=ef(i,t,e,n,r),gn.push(t);return}if(iM(i,t,e,n,r))return;nv(t,r)}$0(t,e,r,null,n)}}}}function Uf(t,e,n,r){var o=Ff(r);if(o=_r(o),o!==null){var i=Yr(o);if(i===null)o=null;else{var s=i.tag;if(s===13){if(o=g0(i),o!==null)return o;o=null}else if(s===3){if(i.stateNode.hydrate)return i.tag===3?i.stateNode.containerInfo:null;o=null}else i!==o&&(o=null)}}return $0(t,e,r,o,n),null}var rr=null,jf=null,la=null;function L0(){if(la)return la;var t,e=jf,n=e.length,r,o="value"in rr?rr.value:rr.textContent,i=o.length;for(t=0;t<n&&e[t]===o[t];t++);var s=n-t;for(r=1;r<=s&&e[n-r]===o[i-r];r++);return la=o.slice(t,1<r?1-r:void 0)}function aa(t){var e=t.keyCode;return"charCode"in t?(t=t.charCode,t===0&&e===13&&(t=13)):t=e,t===10&&(t=13),32<=t||t===13?t:0}function Zl(){return!0}function ov(){return!1}function Dt(t){function e(n,r,o,i,s){this._reactName=n,this._targetInst=o,this.type=r,this.nativeEvent=i,this.target=s,this.currentTarget=null;for(var l in t)t.hasOwnProperty(l)&&(n=t[l],this[l]=n?n(i):i[l]);return this.isDefaultPrevented=(i.defaultPrevented!=null?i.defaultPrevented:i.returnValue===!1)?Zl:ov,this.isPropagationStopped=ov,this}return we(e.prototype,{preventDefault:function(){this.defaultPrevented=!0;var n=this.nativeEvent;n&&(n.preventDefault?n.preventDefault():typeof n.returnValue!="unknown"&&(n.returnValue=!1),this.isDefaultPrevented=Zl)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Zl)},persist:function(){},isPersistent:Zl}),e}var ii={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},qf=Dt(ii),Vs=we({},ii,{view:0,detail:0}),bM=Dt(Vs),Cd,kd,es,Wa=we({},Vs,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Gf,button:0,buttons:0,relatedTarget:function(t){return t.relatedTarget===void 0?t.fromElement===t.srcElement?t.toElement:t.fromElement:t.relatedTarget},movementX:function(t){return"movementX"in t?t.movementX:(t!==es&&(es&&t.type==="mousemove"?(Cd=t.screenX-es.screenX,kd=t.screenY-es.screenY):kd=Cd=0,es=t),Cd)},movementY:function(t){return"movementY"in t?t.movementY:kd}}),iv=Dt(Wa),xM=we({},Wa,{dataTransfer:0}),wM=Dt(xM),SM=we({},Vs,{relatedTarget:0}),Ed=Dt(SM),CM=we({},ii,{animationName:0,elapsedTime:0,pseudoElement:0}),kM=Dt(CM),EM=we({},ii,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),MM=Dt(EM),TM=we({},ii,{data:0}),sv=Dt(TM),IM={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},LM={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},PM={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function DM(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=PM[t])?!!e[t]:!1}function Gf(){return DM}var AM=we({},Vs,{key:function(t){if(t.key){var e=IM[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=aa(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?LM[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Gf,charCode:function(t){return t.type==="keypress"?aa(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?aa(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),RM=Dt(AM),OM=we({},Wa,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),lv=Dt(OM),HM=we({},Vs,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Gf}),NM=Dt(HM),FM=we({},ii,{propertyName:0,elapsedTime:0,pseudoElement:0}),BM=Dt(FM),VM=we({},Wa,{deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:0,deltaMode:0}),zM=Dt(VM),$M=[9,13,27,32],Jf=Wn&&"CompositionEvent"in window,vs=null;Wn&&"documentMode"in document&&(vs=document.documentMode);var _M=Wn&&"TextEvent"in window&&!vs,P0=Wn&&(!Jf||vs&&8<vs&&11>=vs),av=" ",uv=!1;function D0(t,e){switch(t){case"keyup":return $M.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function A0(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var zo=!1;function WM(t,e){switch(t){case"compositionend":return A0(e);case"keypress":return e.which!==32?null:(uv=!0,av);case"textInput":return t=e.data,t===av&&uv?null:t;default:return null}}function KM(t,e){if(zo)return t==="compositionend"||!Jf&&D0(t,e)?(t=L0(),la=jf=rr=null,zo=!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.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return P0&&e.locale!=="ko"?null:e.data;default:return null}}var UM={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0};function cv(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!UM[t.type]:e==="textarea"}function R0(t,e,n,r){f0(r),e=xa(e,"onChange"),0<e.length&&(n=new qf("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var ys=null,Ds=null;function jM(t){B0(t,0)}function Ka(t){var e=_o(t);if(i0(e))return t}function qM(t,e){if(t==="change")return e}var O0=!1;Wn&&(Wn?(Ql="oninput"in document,Ql||(Md=document.createElement("div"),Md.setAttribute("oninput","return;"),Ql=typeof Md.oninput=="function"),Yl=Ql):Yl=!1,O0=Yl&&(!document.documentMode||9<document.documentMode));var Yl,Ql,Md;function dv(){ys&&(ys.detachEvent("onpropertychange",H0),Ds=ys=null)}function H0(t){if(t.propertyName==="value"&&Ka(Ds)){var e=[];if(R0(e,Ds,t,Ff(t)),t=jM,$r)t(e);else{$r=!0;try{Bf(t,e)}finally{$r=!1,zf()}}}}function GM(t,e,n){t==="focusin"?(dv(),ys=e,Ds=n,ys.attachEvent("onpropertychange",H0)):t==="focusout"&&dv()}function JM(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return Ka(Ds)}function ZM(t,e){if(t==="click")return Ka(e)}function YM(t,e){if(t==="input"||t==="change")return Ka(e)}function QM(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var Wt=typeof Object.is=="function"?Object.is:QM,XM=Object.prototype.hasOwnProperty;function As(t,e){if(Wt(t,e))return!0;if(typeof t!="object"||t===null||typeof e!="object"||e===null)return!1;var n=Object.keys(t),r=Object.keys(e);if(n.length!==r.length)return!1;for(r=0;r<n.length;r++)if(!XM.call(e,n[r])||!Wt(t[n[r]],e[n[r]]))return!1;return!0}function fv(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function hv(t,e){var n=fv(t);t=0;for(var r;n;){if(n.nodeType===3){if(r=t+n.textContent.length,t<=e&&r>=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=fv(n)}}function N0(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?N0(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function pv(){for(var t=window,e=ga();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=ga(t.document)}return e}function tf(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")}var e2=Wn&&"documentMode"in document&&11>=document.documentMode,$o=null,nf=null,bs=null,rf=!1;function mv(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;rf||$o==null||$o!==ga(r)||(r=$o,"selectionStart"in r&&tf(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}),bs&&As(bs,r)||(bs=r,r=xa(nf,"onSelect"),0<r.length&&(e=new qf("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=$o)))}Wf("cancel cancel click click close close contextmenu contextMenu copy copy cut cut auxclick auxClick dblclick doubleClick dragend dragEnd dragstart dragStart drop drop focusin focus focusout blur input input invalid invalid keydown keyDown keypress keyPress keyup keyUp mousedown mouseDown mouseup mouseUp paste paste pause pause play play pointercancel pointerCancel pointerdown pointerDown pointerup pointerUp ratechange rateChange reset reset seeked seeked submit submit touchcancel touchCancel touchend touchEnd touchstart touchStart volumechange volumeChange".split(" "),0);Wf("drag drag dragenter dragEnter dragexit dragExit dragleave dragLeave dragover dragOver mousemove mouseMove mouseout mouseOut mouseover mouseOver pointermove pointerMove pointerout pointerOut pointerover pointerOver scroll scroll toggle toggle touchmove touchMove wheel wheel".split(" "),1);Wf(aM,2);for(Td="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Xl=0;Xl<Td.length;Xl++)_f.set(Td[Xl],0);var Td,Xl;ti("onMouseEnter",["mouseout","mouseover"]);ti("onMouseLeave",["mouseout","mouseover"]);ti("onPointerEnter",["pointerout","pointerover"]);ti("onPointerLeave",["pointerout","pointerover"]);Jr("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));Jr("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));Jr("onBeforeInput",["compositionend","keypress","textInput","paste"]);Jr("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));Jr("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));Jr("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var cs="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),F0=new Set("cancel close invalid load scroll toggle".split(" ").concat(cs));function gv(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,rM(r,e,void 0,t),t.currentTarget=null}function B0(t,e){e=(e&4)!==0;for(var n=0;n<t.length;n++){var r=t[n],o=r.event;r=r.listeners;e:{var i=void 0;if(e)for(var s=r.length-1;0<=s;s--){var l=r[s],a=l.instance,u=l.currentTarget;if(l=l.listener,a!==i&&o.isPropagationStopped())break e;gv(o,l,u),i=a}else for(s=0;s<r.length;s++){if(l=r[s],a=l.instance,u=l.currentTarget,l=l.listener,a!==i&&o.isPropagationStopped())break e;gv(o,l,u),i=a}}}if(ya)throw t=Qd,ya=!1,Qd=null,t}function ve(t,e){var n=W0(e),r=t+"__bubble";n.has(r)||(z0(e,t,2,!1),n.add(r))}var vv="_reactListening"+Math.random().toString(36).slice(2);function V0(t){t[vv]||(t[vv]=!0,n0.forEach(function(e){F0.has(e)||yv(e,!1,t,null),yv(e,!0,t,null)}))}function yv(t,e,n,r){var o=4<arguments.length&&arguments[4]!==void 0?arguments[4]:0,i=n;if(t==="selectionchange"&&n.nodeType!==9&&(i=n.ownerDocument),r!==null&&!e&&F0.has(t)){if(t!=="scroll")return;o|=2,i=r}var s=W0(i),l=t+"__"+(e?"capture":"bubble");s.has(l)||(e&&(o|=4),z0(i,t,o,e),s.add(l))}function z0(t,e,n,r){var o=_f.get(e);switch(o===void 0?2:o){case 0:o=vM;break;case 1:o=yM;break;default:o=Kf}n=o.bind(null,e,n,t),o=void 0,!Yd||e!=="touchstart"&&e!=="touchmove"&&e!=="wheel"||(o=!0),r?o!==void 0?t.addEventListener(e,n,{capture:!0,passive:o}):t.addEventListener(e,n,!0):o!==void 0?t.addEventListener(e,n,{passive:o}):t.addEventListener(e,n,!1)}function $0(t,e,n,r,o){var i=r;if(!(e&1)&&!(e&2)&&r!==null)e:for(;;){if(r===null)return;var s=r.tag;if(s===3||s===4){var l=r.stateNode.containerInfo;if(l===o||l.nodeType===8&&l.parentNode===o)break;if(s===4)for(s=r.return;s!==null;){var a=s.tag;if((a===3||a===4)&&(a=s.stateNode.containerInfo,a===o||a.nodeType===8&&a.parentNode===o))return;s=s.return}for(;l!==null;){if(s=_r(l),s===null)return;if(a=s.tag,a===5||a===6){r=i=s;continue e}l=l.parentNode}}r=r.return}XE(function(){var u=i,c=Ff(n),f=[];e:{var d=T0.get(t);if(d!==void 0){var h=qf,g=t;switch(t){case"keypress":if(aa(n)===0)break e;case"keydown":case"keyup":h=RM;break;case"focusin":g="focus",h=Ed;break;case"focusout":g="blur",h=Ed;break;case"beforeblur":case"afterblur":h=Ed;break;case"click":if(n.button===2)break e;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":h=iv;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=wM;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=NM;break;case C0:case k0:case E0:h=kM;break;case M0:h=BM;break;case"scroll":h=bM;break;case"wheel":h=zM;break;case"copy":case"cut":case"paste":h=MM;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=lv}var v=(e&4)!==0,p=!v&&t==="scroll",m=v?d!==null?d+"Capture":null:d;v=[];for(var y=u,x;y!==null;){x=y;var b=x.stateNode;if(x.tag===5&&b!==null&&(x=b,m!==null&&(b=Ts(y,m),b!=null&&v.push(Rs(y,b,x)))),p)break;y=y.return}0<v.length&&(d=new h(d,g,null,n,c),f.push({event:d,listeners:v}))}}if(!(e&7)){e:{if(d=t==="mouseover"||t==="pointerover",h=t==="mouseout"||t==="pointerout",d&&!(e&16)&&(g=n.relatedTarget||n.fromElement)&&(_r(g)||g[si]))break e;if((h||d)&&(d=c.window===c?c:(d=c.ownerDocument)?d.defaultView||d.parentWindow:window,h?(g=n.relatedTarget||n.toElement,h=u,g=g?_r(g):null,g!==null&&(p=Yr(g),g!==p||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(v=iv,b="onMouseLeave",m="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(v=lv,b="onPointerLeave",m="onPointerEnter",y="pointer"),p=h==null?d:_o(h),x=g==null?d:_o(g),d=new v(b,y+"leave",h,n,c),d.target=p,d.relatedTarget=x,b=null,_r(c)===u&&(v=new v(m,y+"enter",g,n,c),v.target=x,v.relatedTarget=p,b=v),p=b,h&&g)t:{for(v=h,m=g,y=0,x=v;x;x=No(x))y++;for(x=0,b=m;b;b=No(b))x++;for(;0<y-x;)v=No(v),y--;for(;0<x-y;)m=No(m),x--;for(;y--;){if(v===m||m!==null&&v===m.alternate)break t;v=No(v),m=No(m)}v=null}else v=null;h!==null&&bv(f,d,h,v,!1),g!==null&&p!==null&&bv(f,p,g,v,!0)}}e:{if(d=u?_o(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var C=qM;else if(cv(d))if(O0)C=YM;else{C=JM;var w=GM}else(h=d.nodeName)&&h.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=ZM);if(C&&(C=C(t,u))){R0(f,C,n,c);break e}w&&w(t,d,u),t==="focusout"&&(w=d._wrapperState)&&w.controlled&&d.type==="number"&&Wd(d,"number",d.value)}switch(w=u?_o(u):window,t){case"focusin":(cv(w)||w.contentEditable==="true")&&($o=w,nf=u,bs=null);break;case"focusout":bs=nf=$o=null;break;case"mousedown":rf=!0;break;case"contextmenu":case"mouseup":case"dragend":rf=!1,mv(f,n,c);break;case"selectionchange":if(e2)break;case"keydown":case"keyup":mv(f,n,c)}var S;if(Jf)e:{switch(t){case"compositionstart":var E="onCompositionStart";break e;case"compositionend":E="onCompositionEnd";break e;case"compositionupdate":E="onCompositionUpdate";break e}E=void 0}else zo?D0(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(P0&&n.locale!=="ko"&&(zo||E!=="onCompositionStart"?E==="onCompositionEnd"&&zo&&(S=L0()):(rr=c,jf="value"in rr?rr.value:rr.textContent,zo=!0)),w=xa(u,E),0<w.length&&(E=new sv(E,t,null,n,c),f.push({event:E,listeners:w}),S?E.data=S:(S=A0(n),S!==null&&(E.data=S)))),(S=_M?WM(t,n):KM(t,n))&&(u=xa(u,"onBeforeInput"),0<u.length&&(c=new sv("onBeforeInput","beforeinput",null,n,c),f.push({event:c,listeners:u}),c.data=S))}B0(f,e)})}function Rs(t,e,n){return{instance:t,listener:e,currentTarget:n}}function xa(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=Ts(t,n),i!=null&&r.unshift(Rs(t,i,o)),i=Ts(t,e),i!=null&&r.push(Rs(t,i,o))),t=t.return}return r}function No(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function bv(t,e,n,r,o){for(var i=e._reactName,s=[];n!==null&&n!==r;){var l=n,a=l.alternate,u=l.stateNode;if(a!==null&&a===r)break;l.tag===5&&u!==null&&(l=u,o?(a=Ts(n,i),a!=null&&s.unshift(Rs(n,a,l))):o||(a=Ts(n,i),a!=null&&s.push(Rs(n,a,l)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}function wa(){}var Id=null,Ld=null;function _0(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function of(t,e){return t==="textarea"||t==="option"||t==="noscript"||typeof e.children=="string"||typeof e.children=="number"||typeof e.dangerouslySetInnerHTML=="object"&&e.dangerouslySetInnerHTML!==null&&e.dangerouslySetInnerHTML.__html!=null}var xv=typeof setTimeout=="function"?setTimeout:void 0,t2=typeof clearTimeout=="function"?clearTimeout:void 0;function Zf(t){t.nodeType===1?t.textContent="":t.nodeType===9&&(t=t.body,t!=null&&(t.textContent=""))}function Jo(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break}return t}function wv(t){t=t.previousSibling;for(var e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="$"||n==="$!"||n==="$?"){if(e===0)return t;e--}else n==="/$"&&e++}t=t.previousSibling}return null}var Pd=0;function n2(t){return{$$typeof:Hf,toString:t,valueOf:t}}var Ua=Math.random().toString(36).slice(2),or="__reactFiber$"+Ua,Sa="__reactProps$"+Ua,si="__reactContainer$"+Ua,Sv="__reactEvents$"+Ua;function _r(t){var e=t[or];if(e)return e;for(var n=t.parentNode;n;){if(e=n[si]||n[or]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=wv(t);t!==null;){if(n=t[or])return n;t=wv(t)}return e}t=n,n=t.parentNode}return null}function zs(t){return t=t[or]||t[si],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function _o(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(V(33))}function ja(t){return t[Sa]||null}function W0(t){var e=t[Sv];return e===void 0&&(e=t[Sv]=new Set),e}var sf=[],Wo=-1;function br(t){return{current:t}}function ye(t){0>Wo||(t.current=sf[Wo],sf[Wo]=null,Wo--)}function Pe(t,e){Wo++,sf[Wo]=t.current,t.current=e}var gr={},st=br(gr),St=br(!1),jr=gr;function ni(t,e){var n=t.type.contextTypes;if(!n)return gr;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 Ct(t){return t=t.childContextTypes,t!=null}function Ca(){ye(St),ye(st)}function Cv(t,e,n){if(st.current!==gr)throw Error(V(168));Pe(st,e),Pe(St,n)}function K0(t,e,n){var r=t.stateNode;if(t=e.childContextTypes,typeof r.getChildContext!="function")return n;r=r.getChildContext();for(var o in r)if(!(o in t))throw Error(V(108,Uo(e)||"Unknown",o));return we({},n,r)}function ua(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||gr,jr=st.current,Pe(st,t),Pe(St,St.current),!0}function kv(t,e,n){var r=t.stateNode;if(!r)throw Error(V(169));n?(t=K0(t,e,jr),r.__reactInternalMemoizedMergedChildContext=t,ye(St),ye(st),Pe(st,t)):ye(St),Pe(St,n)}var Yf=null,Ur=null,r2=je.unstable_runWithPriority,Qf=je.unstable_scheduleCallback,lf=je.unstable_cancelCallback,o2=je.unstable_shouldYield,Ev=je.unstable_requestPaint,af=je.unstable_now,i2=je.unstable_getCurrentPriorityLevel,qa=je.unstable_ImmediatePriority,U0=je.unstable_UserBlockingPriority,j0=je.unstable_NormalPriority,q0=je.unstable_LowPriority,G0=je.unstable_IdlePriority,Dd={},s2=Ev!==void 0?Ev:function(){},Bn=null,ca=null,Ad=!1,Mv=af(),ot=1e4>Mv?af:function(){return af()-Mv};function ri(){switch(i2()){case qa:return 99;case U0:return 98;case j0:return 97;case q0:return 96;case G0:return 95;default:throw Error(V(332))}}function J0(t){switch(t){case 99:return qa;case 98:return U0;case 97:return j0;case 96:return q0;case 95:return G0;default:throw Error(V(332))}}function qr(t,e){return t=J0(t),r2(t,e)}function Os(t,e,n){return t=J0(t),Qf(t,e,n)}function wn(){if(ca!==null){var t=ca;ca=null,lf(t)}Z0()}function Z0(){if(!Ad&&Bn!==null){Ad=!0;var t=0;try{var e=Bn;qr(99,function(){for(;t<e.length;t++){var n=e[t];do n=n(!0);while(n!==null)}}),Bn=null}catch(n){throw Bn!==null&&(Bn=Bn.slice(t+1)),Qf(qa,wn),n}finally{Ad=!1}}}var l2=Zr.ReactCurrentBatchConfig;function ln(t,e){if(t&&t.defaultProps){e=we({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}var ka=br(null),Ea=null,Ko=null,Ma=null;function Xf(){Ma=Ko=Ea=null}function eh(t){var e=ka.current;ye(ka),t.type._context._currentValue=e}function Y0(t,e){for(;t!==null;){var n=t.alternate;if((t.childLanes&e)===e){if(n===null||(n.childLanes&e)===e)break;n.childLanes|=e}else t.childLanes|=e,n!==null&&(n.childLanes|=e);t=t.return}}function Zo(t,e){Ea=t,Ma=Ko=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(an=!0),t.firstContext=null)}function jt(t,e){if(Ma!==t&&e!==!1&&e!==0)if((typeof e!="number"||e===1073741823)&&(Ma=t,e=1073741823),e={context:t,observedBits:e,next:null},Ko===null){if(Ea===null)throw Error(V(308));Ko=e,Ea.dependencies={lanes:0,firstContext:e,responders:null}}else Ko=Ko.next=e;return t._currentValue}var tr=!1;function th(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function Q0(t,e){t=t.updateQueue,e.updateQueue===t&&(e.updateQueue={baseState:t.baseState,firstBaseUpdate:t.firstBaseUpdate,lastBaseUpdate:t.lastBaseUpdate,shared:t.shared,effects:t.effects})}function ur(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function cr(t,e){if(t=t.updateQueue,t!==null){t=t.shared;var n=t.pending;n===null?e.next=e:(e.next=n.next,n.next=e),t.pending=e}}function Tv(t,e){var n=t.updateQueue,r=t.alternate;if(r!==null&&(r=r.updateQueue,n===r)){var o=null,i=null;if(n=n.firstBaseUpdate,n!==null){do{var s={eventTime:n.eventTime,lane:n.lane,tag:n.tag,payload:n.payload,callback:n.callback,next:null};i===null?o=i=s:i=i.next=s,n=n.next}while(n!==null);i===null?o=i=e:i=i.next=e}else o=i=e;n={baseState:r.baseState,firstBaseUpdate:o,lastBaseUpdate:i,shared:r.shared,effects:r.effects},t.updateQueue=n;return}t=n.lastBaseUpdate,t===null?n.firstBaseUpdate=e:t.next=e,n.lastBaseUpdate=e}function Hs(t,e,n,r){var o=t.updateQueue;tr=!1;var i=o.firstBaseUpdate,s=o.lastBaseUpdate,l=o.shared.pending;if(l!==null){o.shared.pending=null;var a=l,u=a.next;a.next=null,s===null?i=u:s.next=u,s=a;var c=t.alternate;if(c!==null){c=c.updateQueue;var f=c.lastBaseUpdate;f!==s&&(f===null?c.firstBaseUpdate=u:f.next=u,c.lastBaseUpdate=a)}}if(i!==null){f=o.baseState,s=0,c=u=a=null;do{l=i.lane;var d=i.eventTime;if((r&l)===l){c!==null&&(c=c.next={eventTime:d,lane:0,tag:i.tag,payload:i.payload,callback:i.callback,next:null});e:{var h=t,g=i;switch(l=e,d=n,g.tag){case 1:if(h=g.payload,typeof h=="function"){f=h.call(d,f,l);break e}f=h;break e;case 3:h.flags=h.flags&-4097|64;case 0:if(h=g.payload,l=typeof h=="function"?h.call(d,f,l):h,l==null)break e;f=we({},f,l);break e;case 2:tr=!0}}i.callback!==null&&(t.flags|=32,l=o.effects,l===null?o.effects=[i]:l.push(i))}else d={eventTime:d,lane:l,tag:i.tag,payload:i.payload,callback:i.callback,next:null},c===null?(u=c=d,a=f):c=c.next=d,s|=l;if(i=i.next,i===null){if(l=o.shared.pending,l===null)break;i=l.next,l.next=null,o.lastBaseUpdate=l,o.shared.pending=null}}while(!0);c===null&&(a=f),o.baseState=a,o.firstBaseUpdate=u,o.lastBaseUpdate=c,_s|=s,t.lanes=s,t.memoizedState=f}}function Iv(t,e,n){if(t=e.effects,e.effects=null,t!==null)for(e=0;e<t.length;e++){var r=t[e],o=r.callback;if(o!==null){if(r.callback=null,r=n,typeof o!="function")throw Error(V(191,o));o.call(r)}}}var X0=new Ba.Component().refs;function Ta(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:we({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var Ga={isMounted:function(t){return(t=t._reactInternals)?Yr(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Pt(),o=dr(t),i=ur(r,o);i.payload=e,n!=null&&(i.callback=n),cr(t,i),fr(t,o,r)},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Pt(),o=dr(t),i=ur(r,o);i.tag=1,i.payload=e,n!=null&&(i.callback=n),cr(t,i),fr(t,o,r)},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Pt(),r=dr(t),o=ur(n,r);o.tag=2,e!=null&&(o.callback=e),cr(t,o),fr(t,r,n)}};function Lv(t,e,n,r,o,i,s){return t=t.stateNode,typeof t.shouldComponentUpdate=="function"?t.shouldComponentUpdate(r,i,s):e.prototype&&e.prototype.isPureReactComponent?!As(n,r)||!As(o,i):!0}function ey(t,e,n){var r=!1,o=gr,i=e.contextType;return typeof i=="object"&&i!==null?i=jt(i):(o=Ct(e)?jr:st.current,r=e.contextTypes,i=(r=r!=null)?ni(t,o):gr),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=Ga,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function Pv(t,e,n,r){t=e.state,typeof e.componentWillReceiveProps=="function"&&e.componentWillReceiveProps(n,r),typeof e.UNSAFE_componentWillReceiveProps=="function"&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&Ga.enqueueReplaceState(e,e.state,null)}function uf(t,e,n,r){var o=t.stateNode;o.props=n,o.state=t.memoizedState,o.refs=X0,th(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=jt(i):(i=Ct(e)?jr:st.current,o.context=ni(t,i)),Hs(t,n,o,r),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(Ta(t,e,i,n),o.state=t.memoizedState),typeof e.getDerivedStateFromProps=="function"||typeof o.getSnapshotBeforeUpdate=="function"||typeof o.UNSAFE_componentWillMount!="function"&&typeof o.componentWillMount!="function"||(e=o.state,typeof o.componentWillMount=="function"&&o.componentWillMount(),typeof o.UNSAFE_componentWillMount=="function"&&o.UNSAFE_componentWillMount(),e!==o.state&&Ga.enqueueReplaceState(o,o.state,null),Hs(t,n,o,r),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4)}var ea=Array.isArray;function ts(t,e,n){if(t=n.ref,t!==null&&typeof t!="function"&&typeof t!="object"){if(n._owner){if(n=n._owner,n){if(n.tag!==1)throw Error(V(309));var r=n.stateNode}if(!r)throw Error(V(147,t));var o=""+t;return e!==null&&e.ref!==null&&typeof e.ref=="function"&&e.ref._stringRef===o?e.ref:(e=function(i){var s=r.refs;s===X0&&(s=r.refs={}),i===null?delete s[o]:s[o]=i},e._stringRef=o,e)}if(typeof t!="string")throw Error(V(284));if(!n._owner)throw Error(V(290,t))}return t}function ta(t,e){if(t.type!=="textarea")throw Error(V(31,Object.prototype.toString.call(e)==="[object Object]"?"object with keys {"+Object.keys(e).join(", ")+"}":e))}function ty(t){function e(p,m){if(t){var y=p.lastEffect;y!==null?(y.nextEffect=m,p.lastEffect=m):p.firstEffect=p.lastEffect=m,m.nextEffect=null,m.flags=8}}function n(p,m){if(!t)return null;for(;m!==null;)e(p,m),m=m.sibling;return null}function r(p,m){for(p=new Map;m!==null;)m.key!==null?p.set(m.key,m):p.set(m.index,m),m=m.sibling;return p}function o(p,m){return p=yr(p,m),p.index=0,p.sibling=null,p}function i(p,m,y){return p.index=y,t?(y=p.alternate,y!==null?(y=y.index,y<m?(p.flags=2,m):y):(p.flags=2,m)):m}function s(p){return t&&p.alternate===null&&(p.flags=2),p}function l(p,m,y,x){return m===null||m.tag!==6?(m=Fd(y,p.mode,x),m.return=p,m):(m=o(m,y),m.return=p,m)}function a(p,m,y,x){return m!==null&&m.elementType===y.type?(x=o(m,y.props),x.ref=ts(p,m,y),x.return=p,x):(x=pa(y.type,y.key,y.props,null,p.mode,x),x.ref=ts(p,m,y),x.return=p,x)}function u(p,m,y,x){return m===null||m.tag!==4||m.stateNode.containerInfo!==y.containerInfo||m.stateNode.implementation!==y.implementation?(m=Bd(y,p.mode,x),m.return=p,m):(m=o(m,y.children||[]),m.return=p,m)}function c(p,m,y,x,b){return m===null||m.tag!==7?(m=ei(y,p.mode,x,b),m.return=p,m):(m=o(m,y),m.return=p,m)}function f(p,m,y){if(typeof m=="string"||typeof m=="number")return m=Fd(""+m,p.mode,y),m.return=p,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case as:return y=pa(m.type,m.key,m.props,null,p.mode,y),y.ref=ts(p,null,m),y.return=p,y;case zr:return m=Bd(m,p.mode,y),m.return=p,m}if(ea(m)||Zi(m))return m=ei(m,p.mode,y,null),m.return=p,m;ta(p,m)}return null}function d(p,m,y,x){var b=m!==null?m.key:null;if(typeof y=="string"||typeof y=="number")return b!==null?null:l(p,m,""+y,x);if(typeof y=="object"&&y!==null){switch(y.$$typeof){case as:return y.key===b?y.type===nr?c(p,m,y.props.children,x,b):a(p,m,y,x):null;case zr:return y.key===b?u(p,m,y,x):null}if(ea(y)||Zi(y))return b!==null?null:c(p,m,y,x,null);ta(p,y)}return null}function h(p,m,y,x,b){if(typeof x=="string"||typeof x=="number")return p=p.get(y)||null,l(m,p,""+x,b);if(typeof x=="object"&&x!==null){switch(x.$$typeof){case as:return p=p.get(x.key===null?y:x.key)||null,x.type===nr?c(m,p,x.props.children,b,x.key):a(m,p,x,b);case zr:return p=p.get(x.key===null?y:x.key)||null,u(m,p,x,b)}if(ea(x)||Zi(x))return p=p.get(y)||null,c(m,p,x,b,null);ta(m,x)}return null}function g(p,m,y,x){for(var b=null,C=null,w=m,S=m=0,E=null;w!==null&&S<y.length;S++){w.index>S?(E=w,w=null):E=w.sibling;var k=d(p,w,y[S],x);if(k===null){w===null&&(w=E);break}t&&w&&k.alternate===null&&e(p,w),m=i(k,m,S),C===null?b=k:C.sibling=k,C=k,w=E}if(S===y.length)return n(p,w),b;if(w===null){for(;S<y.length;S++)w=f(p,y[S],x),w!==null&&(m=i(w,m,S),C===null?b=w:C.sibling=w,C=w);return b}for(w=r(p,w);S<y.length;S++)E=h(w,p,S,y[S],x),E!==null&&(t&&E.alternate!==null&&w.delete(E.key===null?S:E.key),m=i(E,m,S),C===null?b=E:C.sibling=E,C=E);return t&&w.forEach(function(T){return e(p,T)}),b}function v(p,m,y,x){var b=Zi(y);if(typeof b!="function")throw Error(V(150));if(y=b.call(y),y==null)throw Error(V(151));for(var C=b=null,w=m,S=m=0,E=null,k=y.next();w!==null&&!k.done;S++,k=y.next()){w.index>S?(E=w,w=null):E=w.sibling;var T=d(p,w,k.value,x);if(T===null){w===null&&(w=E);break}t&&w&&T.alternate===null&&e(p,w),m=i(T,m,S),C===null?b=T:C.sibling=T,C=T,w=E}if(k.done)return n(p,w),b;if(w===null){for(;!k.done;S++,k=y.next())k=f(p,k.value,x),k!==null&&(m=i(k,m,S),C===null?b=k:C.sibling=k,C=k);return b}for(w=r(p,w);!k.done;S++,k=y.next())k=h(w,p,S,k.value,x),k!==null&&(t&&k.alternate!==null&&w.delete(k.key===null?S:k.key),m=i(k,m,S),C===null?b=k:C.sibling=k,C=k);return t&&w.forEach(function(D){return e(p,D)}),b}return function(p,m,y,x){var b=typeof y=="object"&&y!==null&&y.type===nr&&y.key===null;b&&(y=y.props.children);var C=typeof y=="object"&&y!==null;if(C)switch(y.$$typeof){case as:e:{for(C=y.key,b=m;b!==null;){if(b.key===C){switch(b.tag){case 7:if(y.type===nr){n(p,b.sibling),m=o(b,y.props.children),m.return=p,p=m;break e}break;default:if(b.elementType===y.type){n(p,b.sibling),m=o(b,y.props),m.ref=ts(p,b,y),m.return=p,p=m;break e}}n(p,b);break}else e(p,b);b=b.sibling}y.type===nr?(m=ei(y.props.children,p.mode,x,y.key),m.return=p,p=m):(x=pa(y.type,y.key,y.props,null,p.mode,x),x.ref=ts(p,m,y),x.return=p,p=x)}return s(p);case zr:e:{for(b=y.key;m!==null;){if(m.key===b)if(m.tag===4&&m.stateNode.containerInfo===y.containerInfo&&m.stateNode.implementation===y.implementation){n(p,m.sibling),m=o(m,y.children||[]),m.return=p,p=m;break e}else{n(p,m);break}else e(p,m);m=m.sibling}m=Bd(y,p.mode,x),m.return=p,p=m}return s(p)}if(typeof y=="string"||typeof y=="number")return y=""+y,m!==null&&m.tag===6?(n(p,m.sibling),m=o(m,y),m.return=p,p=m):(n(p,m),m=Fd(y,p.mode,x),m.return=p,p=m),s(p);if(ea(y))return g(p,m,y,x);if(Zi(y))return v(p,m,y,x);if(C&&ta(p,y),typeof y>"u"&&!b)switch(p.tag){case 1:case 22:case 0:case 11:case 15:throw Error(V(152,Uo(p.type)||"Component"))}return n(p,m)}}var Ia=ty(!0),ny=ty(!1),$s={},bn=br($s),Ns=br($s),Fs=br($s);function Wr(t){if(t===$s)throw Error(V(174));return t}function cf(t,e){switch(Pe(Fs,e),Pe(Ns,t),Pe(bn,$s),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:qd(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=qd(e,t)}ye(bn),Pe(bn,e)}function oi(){ye(bn),ye(Ns),ye(Fs)}function Dv(t){Wr(Fs.current);var e=Wr(bn.current),n=qd(e,t.type);e!==n&&(Pe(Ns,t),Pe(bn,n))}function nh(t){Ns.current===t&&(ye(bn),ye(Ns))}var Le=br(0);function La(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&64)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 zn=null,ir=null,xn=!1;function ry(t,e){var n=Kt(5,null,null,0);n.elementType="DELETED",n.type="DELETED",n.stateNode=e,n.return=t,n.flags=8,t.lastEffect!==null?(t.lastEffect.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n}function Av(t,e){switch(t.tag){case 5:var n=t.type;return e=e.nodeType!==1||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e,e!==null?(t.stateNode=e,!0):!1;case 6:return e=t.pendingProps===""||e.nodeType!==3?null:e,e!==null?(t.stateNode=e,!0):!1;case 13:return!1;default:return!1}}function df(t){if(xn){var e=ir;if(e){var n=e;if(!Av(t,e)){if(e=Jo(n.nextSibling),!e||!Av(t,e)){t.flags=t.flags&-1025|2,xn=!1,zn=t;return}ry(zn,n)}zn=t,ir=Jo(e.firstChild)}else t.flags=t.flags&-1025|2,xn=!1,zn=t}}function Rv(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;zn=t}function na(t){if(t!==zn)return!1;if(!xn)return Rv(t),xn=!0,!1;var e=t.type;if(t.tag!==5||e!=="head"&&e!=="body"&&!of(e,t.memoizedProps))for(e=ir;e;)ry(t,e),e=Jo(e.nextSibling);if(Rv(t),t.tag===13){if(t=t.memoizedState,t=t!==null?t.dehydrated:null,!t)throw Error(V(317));e:{for(t=t.nextSibling,e=0;t;){if(t.nodeType===8){var n=t.data;if(n==="/$"){if(e===0){ir=Jo(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}ir=null}}else ir=zn?Jo(t.stateNode.nextSibling):null;return!0}function Rd(){ir=zn=null,xn=!1}var Yo=[];function rh(){for(var t=0;t<Yo.length;t++)Yo[t]._workInProgressVersionPrimary=null;Yo.length=0}var xs=Zr.ReactCurrentDispatcher,Ut=Zr.ReactCurrentBatchConfig,Bs=0,De=null,rt=null,Je=null,Pa=!1,ws=!1;function xt(){throw Error(V(321))}function oh(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!Wt(t[n],e[n]))return!1;return!0}function ih(t,e,n,r,o,i){if(Bs=i,De=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,xs.current=t===null||t.memoizedState===null?u2:c2,t=n(r,o),ws){i=0;do{if(ws=!1,!(25>i))throw Error(V(301));i+=1,Je=rt=null,e.updateQueue=null,xs.current=d2,t=n(r,o)}while(ws)}if(xs.current=Oa,e=rt!==null&&rt.next!==null,Bs=0,Je=rt=De=null,Pa=!1,e)throw Error(V(300));return t}function Kr(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return Je===null?De.memoizedState=Je=t:Je=Je.next=t,Je}function Qr(){if(rt===null){var t=De.alternate;t=t!==null?t.memoizedState:null}else t=rt.next;var e=Je===null?De.memoizedState:Je.next;if(e!==null)Je=e,rt=t;else{if(t===null)throw Error(V(310));rt=t,t={memoizedState:rt.memoizedState,baseState:rt.baseState,baseQueue:rt.baseQueue,queue:rt.queue,next:null},Je===null?De.memoizedState=Je=t:Je=Je.next=t}return Je}function vn(t,e){return typeof e=="function"?e(t):e}function ns(t){var e=Qr(),n=e.queue;if(n===null)throw Error(V(311));n.lastRenderedReducer=t;var r=rt,o=r.baseQueue,i=n.pending;if(i!==null){if(o!==null){var s=o.next;o.next=i.next,i.next=s}r.baseQueue=o=i,n.pending=null}if(o!==null){o=o.next,r=r.baseState;var l=s=i=null,a=o;do{var u=a.lane;if((Bs&u)===u)l!==null&&(l=l.next={lane:0,action:a.action,eagerReducer:a.eagerReducer,eagerState:a.eagerState,next:null}),r=a.eagerReducer===t?a.eagerState:t(r,a.action);else{var c={lane:u,action:a.action,eagerReducer:a.eagerReducer,eagerState:a.eagerState,next:null};l===null?(s=l=c,i=r):l=l.next=c,De.lanes|=u,_s|=u}a=a.next}while(a!==null&&a!==o);l===null?i=r:l.next=s,Wt(r,e.memoizedState)||(an=!0),e.memoizedState=r,e.baseState=i,e.baseQueue=l,n.lastRenderedState=r}return[e.memoizedState,n.dispatch]}function rs(t){var e=Qr(),n=e.queue;if(n===null)throw Error(V(311));n.lastRenderedReducer=t;var r=n.dispatch,o=n.pending,i=e.memoizedState;if(o!==null){n.pending=null;var s=o=o.next;do i=t(i,s.action),s=s.next;while(s!==o);Wt(i,e.memoizedState)||(an=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function Ov(t,e,n){var r=e._getVersion;r=r(e._source);var o=e._workInProgressVersionPrimary;if(o!==null?t=o===r:(t=t.mutableReadLanes,(t=(Bs&t)===t)&&(e._workInProgressVersionPrimary=r,Yo.push(e))),t)return n(e._source);throw Yo.push(e),Error(V(350))}function oy(t,e,n,r){var o=ft;if(o===null)throw Error(V(349));var i=e._getVersion,s=i(e._source),l=xs.current,a=l.useState(function(){return Ov(o,e,n)}),u=a[1],c=a[0];a=Je;var f=t.memoizedState,d=f.refs,h=d.getSnapshot,g=f.source;f=f.subscribe;var v=De;return t.memoizedState={refs:d,source:e,subscribe:r},l.useEffect(function(){d.getSnapshot=n,d.setSnapshot=u;var p=i(e._source);if(!Wt(s,p)){p=n(e._source),Wt(c,p)||(u(p),p=dr(v),o.mutableReadLanes|=p&o.pendingLanes),p=o.mutableReadLanes,o.entangledLanes|=p;for(var m=o.entanglements,y=p;0<y;){var x=31-mr(y),b=1<<x;m[x]|=p,y&=~b}}},[n,e,r]),l.useEffect(function(){return r(e._source,function(){var p=d.getSnapshot,m=d.setSnapshot;try{m(p(e._source));var y=dr(v);o.mutableReadLanes|=y&o.pendingLanes}catch(x){m(function(){throw x})}})},[e,r]),Wt(h,n)&&Wt(g,e)&&Wt(f,r)||(t={pending:null,dispatch:null,lastRenderedReducer:vn,lastRenderedState:c},t.dispatch=u=ah.bind(null,De,t),a.queue=t,a.baseQueue=null,c=Ov(o,e,n),a.memoizedState=a.baseState=c),c}function iy(t,e,n){var r=Qr();return oy(r,t,e,n)}function os(t){var e=Kr();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t=e.queue={pending:null,dispatch:null,lastRenderedReducer:vn,lastRenderedState:t},t=t.dispatch=ah.bind(null,De,t),[e.memoizedState,t]}function Da(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=De.updateQueue,e===null?(e={lastEffect:null},De.updateQueue=e,e.lastEffect=t.next=t):(n=e.lastEffect,n===null?e.lastEffect=t.next=t:(r=n.next,n.next=t,t.next=r,e.lastEffect=t)),t}function Hv(t){var e=Kr();return t={current:t},e.memoizedState=t}function Aa(){return Qr().memoizedState}function ff(t,e,n,r){var o=Kr();De.flags|=t,o.memoizedState=Da(1|e,n,void 0,r===void 0?null:r)}function sh(t,e,n,r){var o=Qr();r=r===void 0?null:r;var i=void 0;if(rt!==null){var s=rt.memoizedState;if(i=s.destroy,r!==null&&oh(r,s.deps)){Da(e,n,i,r);return}}De.flags|=t,o.memoizedState=Da(1|e,n,i,r)}function Nv(t,e){return ff(516,4,t,e)}function Ra(t,e){return sh(516,4,t,e)}function sy(t,e){return sh(4,2,t,e)}function ly(t,e){if(typeof e=="function")return t=t(),e(t),function(){e(null)};if(e!=null)return t=t(),e.current=t,function(){e.current=null}}function ay(t,e,n){return n=n!=null?n.concat([t]):null,sh(4,2,ly.bind(null,e,t),n)}function lh(){}function uy(t,e){var n=Qr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&oh(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function cy(t,e){var n=Qr();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&oh(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function a2(t,e){var n=ri();qr(98>n?98:n,function(){t(!0)}),qr(97<n?97:n,function(){var r=Ut.transition;Ut.transition=1;try{t(!1),e()}finally{Ut.transition=r}})}function ah(t,e,n){var r=Pt(),o=dr(t),i={lane:o,action:n,eagerReducer:null,eagerState:null,next:null},s=e.pending;if(s===null?i.next=i:(i.next=s.next,s.next=i),e.pending=i,s=t.alternate,t===De||s!==null&&s===De)ws=Pa=!0;else{if(t.lanes===0&&(s===null||s.lanes===0)&&(s=e.lastRenderedReducer,s!==null))try{var l=e.lastRenderedState,a=s(l,n);if(i.eagerReducer=s,i.eagerState=a,Wt(a,l))return}catch{}finally{}fr(t,o,r)}}var Oa={readContext:jt,useCallback:xt,useContext:xt,useEffect:xt,useImperativeHandle:xt,useLayoutEffect:xt,useMemo:xt,useReducer:xt,useRef:xt,useState:xt,useDebugValue:xt,useDeferredValue:xt,useTransition:xt,useMutableSource:xt,useOpaqueIdentifier:xt,unstable_isNewReconciler:!1},u2={readContext:jt,useCallback:function(t,e){return Kr().memoizedState=[t,e===void 0?null:e],t},useContext:jt,useEffect:Nv,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,ff(4,2,ly.bind(null,e,t),n)},useLayoutEffect:function(t,e){return ff(4,2,t,e)},useMemo:function(t,e){var n=Kr();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Kr();return e=n!==void 0?n(e):e,r.memoizedState=r.baseState=e,t=r.queue={pending:null,dispatch:null,lastRenderedReducer:t,lastRenderedState:e},t=t.dispatch=ah.bind(null,De,t),[r.memoizedState,t]},useRef:Hv,useState:os,useDebugValue:lh,useDeferredValue:function(t){var e=os(t),n=e[0],r=e[1];return Nv(function(){var o=Ut.transition;Ut.transition=1;try{r(t)}finally{Ut.transition=o}},[t]),n},useTransition:function(){var t=os(!1),e=t[0];return t=a2.bind(null,t[1]),Hv(t),[t,e]},useMutableSource:function(t,e,n){var r=Kr();return r.memoizedState={refs:{getSnapshot:e,setSnapshot:null},source:t,subscribe:n},oy(r,t,e,n)},useOpaqueIdentifier:function(){if(xn){var t=!1,e=n2(function(){throw t||(t=!0,n("r:"+(Pd++).toString(36))),Error(V(355))}),n=os(e)[1];return!(De.mode&2)&&(De.flags|=516,Da(5,function(){n("r:"+(Pd++).toString(36))},void 0,null)),e}return e="r:"+(Pd++).toString(36),os(e),e},unstable_isNewReconciler:!1},c2={readContext:jt,useCallback:uy,useContext:jt,useEffect:Ra,useImperativeHandle:ay,useLayoutEffect:sy,useMemo:cy,useReducer:ns,useRef:Aa,useState:function(){return ns(vn)},useDebugValue:lh,useDeferredValue:function(t){var e=ns(vn),n=e[0],r=e[1];return Ra(function(){var o=Ut.transition;Ut.transition=1;try{r(t)}finally{Ut.transition=o}},[t]),n},useTransition:function(){var t=ns(vn)[0];return[Aa().current,t]},useMutableSource:iy,useOpaqueIdentifier:function(){return ns(vn)[0]},unstable_isNewReconciler:!1},d2={readContext:jt,useCallback:uy,useContext:jt,useEffect:Ra,useImperativeHandle:ay,useLayoutEffect:sy,useMemo:cy,useReducer:rs,useRef:Aa,useState:function(){return rs(vn)},useDebugValue:lh,useDeferredValue:function(t){var e=rs(vn),n=e[0],r=e[1];return Ra(function(){var o=Ut.transition;Ut.transition=1;try{r(t)}finally{Ut.transition=o}},[t]),n},useTransition:function(){var t=rs(vn)[0];return[Aa().current,t]},useMutableSource:iy,useOpaqueIdentifier:function(){return rs(vn)[0]},unstable_isNewReconciler:!1},f2=Zr.ReactCurrentOwner,an=!1;function wt(t,e,n,r){e.child=t===null?ny(e,null,n,r):Ia(e,t.child,n,r)}function Fv(t,e,n,r,o){n=n.render;var i=e.ref;return Zo(e,o),r=ih(t,e,n,r,i,o),t!==null&&!an?(e.updateQueue=t.updateQueue,e.flags&=-517,t.lanes&=~o,$n(t,e,o)):(e.flags|=1,wt(t,e,r,o),e.child)}function Bv(t,e,n,r,o,i){if(t===null){var s=n.type;return typeof s=="function"&&!ph(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,dy(t,e,s,r,o,i)):(t=pa(n.type,null,r,e,e.mode,i),t.ref=e.ref,t.return=e,e.child=t)}return s=t.child,!(o&i)&&(o=s.memoizedProps,n=n.compare,n=n!==null?n:As,n(o,r)&&t.ref===e.ref)?$n(t,e,i):(e.flags|=1,t=yr(s,r),t.ref=e.ref,t.return=e,e.child=t)}function dy(t,e,n,r,o,i){if(t!==null&&As(t.memoizedProps,r)&&t.ref===e.ref)if(an=!1,(i&o)!==0)t.flags&16384&&(an=!0);else return e.lanes=t.lanes,$n(t,e,i);return hf(t,e,n,r,i)}function Od(t,e,n){var r=e.pendingProps,o=r.children,i=t!==null?t.memoizedState:null;if(r.mode==="hidden"||r.mode==="unstable-defer-without-hiding")if(!(e.mode&4))e.memoizedState={baseLanes:0},oa(e,n);else if(n&1073741824)e.memoizedState={baseLanes:0},oa(e,i!==null?i.baseLanes:n);else return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t},oa(e,t),null;else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,oa(e,r);return wt(t,e,o,n),e.child}function fy(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=128)}function hf(t,e,n,r,o){var i=Ct(n)?jr:st.current;return i=ni(e,i),Zo(e,o),n=ih(t,e,n,r,i,o),t!==null&&!an?(e.updateQueue=t.updateQueue,e.flags&=-517,t.lanes&=~o,$n(t,e,o)):(e.flags|=1,wt(t,e,n,o),e.child)}function Vv(t,e,n,r,o){if(Ct(n)){var i=!0;ua(e)}else i=!1;if(Zo(e,o),e.stateNode===null)t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2),ey(e,n,r),uf(e,n,r,o),r=!0;else if(t===null){var s=e.stateNode,l=e.memoizedProps;s.props=l;var a=s.context,u=n.contextType;typeof u=="object"&&u!==null?u=jt(u):(u=Ct(n)?jr:st.current,u=ni(e,u));var c=n.getDerivedStateFromProps,f=typeof c=="function"||typeof s.getSnapshotBeforeUpdate=="function";f||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==r||a!==u)&&Pv(e,s,r,u),tr=!1;var d=e.memoizedState;s.state=d,Hs(e,r,s,o),a=e.memoizedState,l!==r||d!==a||St.current||tr?(typeof c=="function"&&(Ta(e,n,c,r),a=e.memoizedState),(l=tr||Lv(e,n,l,r,d,a,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|=4)):(typeof s.componentDidMount=="function"&&(e.flags|=4),e.memoizedProps=r,e.memoizedState=a),s.props=r,s.state=a,s.context=u,r=l):(typeof s.componentDidMount=="function"&&(e.flags|=4),r=!1)}else{s=e.stateNode,Q0(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:ln(e.type,l),s.props=u,f=e.pendingProps,d=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=jt(a):(a=Ct(n)?jr:st.current,a=ni(e,a));var h=n.getDerivedStateFromProps;(c=typeof h=="function"||typeof s.getSnapshotBeforeUpdate=="function")||typeof s.UNSAFE_componentWillReceiveProps!="function"&&typeof s.componentWillReceiveProps!="function"||(l!==f||d!==a)&&Pv(e,s,r,a),tr=!1,d=e.memoizedState,s.state=d,Hs(e,r,s,o);var g=e.memoizedState;l!==f||d!==g||St.current||tr?(typeof h=="function"&&(Ta(e,n,h,r),g=e.memoizedState),(u=tr||Lv(e,n,u,r,d,g,a))?(c||typeof s.UNSAFE_componentWillUpdate!="function"&&typeof s.componentWillUpdate!="function"||(typeof s.componentWillUpdate=="function"&&s.componentWillUpdate(r,g,a),typeof s.UNSAFE_componentWillUpdate=="function"&&s.UNSAFE_componentWillUpdate(r,g,a)),typeof s.componentDidUpdate=="function"&&(e.flags|=4),typeof s.getSnapshotBeforeUpdate=="function"&&(e.flags|=256)):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=256),e.memoizedProps=r,e.memoizedState=g),s.props=r,s.state=g,s.context=a,r=u):(typeof s.componentDidUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=4),typeof s.getSnapshotBeforeUpdate!="function"||l===t.memoizedProps&&d===t.memoizedState||(e.flags|=256),r=!1)}return pf(t,e,n,r,i,o)}function pf(t,e,n,r,o,i){fy(t,e);var s=(e.flags&64)!==0;if(!r&&!s)return o&&kv(e,n,!1),$n(t,e,i);r=e.stateNode,f2.current=e;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=Ia(e,t.child,null,i),e.child=Ia(e,null,l,i)):wt(t,e,l,i),e.memoizedState=r.state,o&&kv(e,n,!0),e.child}function zv(t){var e=t.stateNode;e.pendingContext?Cv(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Cv(t,e.context,!1),cf(t,e.containerInfo)}var ra={dehydrated:null,retryLane:0};function $v(t,e,n){var r=e.pendingProps,o=Le.current,i=!1,s;return(s=(e.flags&64)!==0)||(s=t!==null&&t.memoizedState===null?!1:(o&2)!==0),s?(i=!0,e.flags&=-65):t!==null&&t.memoizedState===null||r.fallback===void 0||r.unstable_avoidThisFallback===!0||(o|=1),Pe(Le,o&1),t===null?(r.fallback!==void 0&&df(e),t=r.children,o=r.fallback,i?(t=_v(e,t,o,n),e.child.memoizedState={baseLanes:n},e.memoizedState=ra,t):typeof r.unstable_expectedLoadTime=="number"?(t=_v(e,t,o,n),e.child.memoizedState={baseLanes:n},e.memoizedState=ra,e.lanes=33554432,t):(n=mh({mode:"visible",children:t},e.mode,n,null),n.return=e,e.child=n)):t.memoizedState!==null?i?(r=Kv(t,e,r.children,r.fallback,n),i=e.child,o=t.child.memoizedState,i.memoizedState=o===null?{baseLanes:n}:{baseLanes:o.baseLanes|n},i.childLanes=t.childLanes&~n,e.memoizedState=ra,r):(n=Wv(t,e,r.children,n),e.memoizedState=null,n):i?(r=Kv(t,e,r.children,r.fallback,n),i=e.child,o=t.child.memoizedState,i.memoizedState=o===null?{baseLanes:n}:{baseLanes:o.baseLanes|n},i.childLanes=t.childLanes&~n,e.memoizedState=ra,r):(n=Wv(t,e,r.children,n),e.memoizedState=null,n)}function _v(t,e,n,r){var o=t.mode,i=t.child;return e={mode:"hidden",children:e},!(o&2)&&i!==null?(i.childLanes=0,i.pendingProps=e):i=mh(e,o,0,null),n=ei(n,o,r,null),i.return=t,n.return=t,i.sibling=n,t.child=i,n}function Wv(t,e,n,r){var o=t.child;return t=o.sibling,n=yr(o,{mode:"visible",children:n}),!(e.mode&2)&&(n.lanes=r),n.return=e,n.sibling=null,t!==null&&(t.nextEffect=null,t.flags=8,e.firstEffect=e.lastEffect=t),e.child=n}function Kv(t,e,n,r,o){var i=e.mode,s=t.child;t=s.sibling;var l={mode:"hidden",children:n};return!(i&2)&&e.child!==s?(n=e.child,n.childLanes=0,n.pendingProps=l,s=n.lastEffect,s!==null?(e.firstEffect=n.firstEffect,e.lastEffect=s,s.nextEffect=null):e.firstEffect=e.lastEffect=null):n=yr(s,l),t!==null?r=yr(t,r):(r=ei(r,i,o,null),r.flags|=2),r.return=e,n.return=e,n.sibling=r,e.child=n,r}function Uv(t,e){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),Y0(t.return,e)}function Hd(t,e,n,r,o,i){var s=t.memoizedState;s===null?t.memoizedState={isBackwards:e,rendering:null,renderingStartTime:0,last:r,tail:n,tailMode:o,lastEffect:i}:(s.isBackwards=e,s.rendering=null,s.renderingStartTime=0,s.last=r,s.tail=n,s.tailMode=o,s.lastEffect=i)}function jv(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(wt(t,e,r.children,n),r=Le.current,r&2)r=r&1|2,e.flags|=64;else{if(t!==null&&t.flags&64)e:for(t=e.child;t!==null;){if(t.tag===13)t.memoizedState!==null&&Uv(t,n);else if(t.tag===19)Uv(t,n);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(Pe(Le,r),!(e.mode&2))e.memoizedState=null;else switch(o){case"forwards":for(n=e.child,o=null;n!==null;)t=n.alternate,t!==null&&La(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),Hd(e,!1,o,n,i,e.lastEffect);break;case"backwards":for(n=null,o=e.child,e.child=null;o!==null;){if(t=o.alternate,t!==null&&La(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}Hd(e,!0,n,null,i,e.lastEffect);break;case"together":Hd(e,!1,null,null,void 0,e.lastEffect);break;default:e.memoizedState=null}return e.child}function $n(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),_s|=e.lanes,n&e.childLanes){if(t!==null&&e.child!==t.child)throw Error(V(153));if(e.child!==null){for(t=e.child,n=yr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=yr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}return null}var hy,mf,py,my;hy=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}};mf=function(){};py=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,Wr(bn.current);var i=null;switch(n){case"input":o=$d(t,o),r=$d(t,r),i=[];break;case"option":o=Kd(t,o),r=Kd(t,r),i=[];break;case"select":o=we({},o,{value:void 0}),r=we({},r,{value:void 0}),i=[];break;case"textarea":o=Ud(t,o),r=Ud(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=wa)}Gd(n,r);var s;n=null;for(u in o)if(!r.hasOwnProperty(u)&&o.hasOwnProperty(u)&&o[u]!=null)if(u==="style"){var l=o[u];for(s in l)l.hasOwnProperty(s)&&(n||(n={}),n[s]="")}else u!=="dangerouslySetInnerHTML"&&u!=="children"&&u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&u!=="autoFocus"&&(Es.hasOwnProperty(u)?i||(i=[]):(i=i||[]).push(u,null));for(u in r){var a=r[u];if(l=o!=null?o[u]:void 0,r.hasOwnProperty(u)&&a!==l&&(a!=null||l!=null))if(u==="style")if(l){for(s in l)!l.hasOwnProperty(s)||a&&a.hasOwnProperty(s)||(n||(n={}),n[s]="");for(s in a)a.hasOwnProperty(s)&&l[s]!==a[s]&&(n||(n={}),n[s]=a[s])}else n||(i||(i=[]),i.push(u,n)),n=a;else u==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,l=l?l.__html:void 0,a!=null&&l!==a&&(i=i||[]).push(u,a)):u==="children"?typeof a!="string"&&typeof a!="number"||(i=i||[]).push(u,""+a):u!=="suppressContentEditableWarning"&&u!=="suppressHydrationWarning"&&(Es.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&ve("scroll",t),i||l===a||(i=[])):typeof a=="object"&&a!==null&&a.$$typeof===Hf?a.toString():(i=i||[]).push(u,a))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};my=function(t,e,n,r){n!==r&&(e.flags|=4)};function is(t,e){if(!xn)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 h2(t,e,n){var r=e.pendingProps;switch(e.tag){case 2:case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return null;case 1:return Ct(e.type)&&Ca(),null;case 3:return oi(),ye(St),ye(st),rh(),r=e.stateNode,r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(na(e)?e.flags|=4:r.hydrate||(e.flags|=256)),mf(e),null;case 5:nh(e);var o=Wr(Fs.current);if(n=e.type,t!==null&&e.stateNode!=null)py(t,e,n,r,o),t.ref!==e.ref&&(e.flags|=128);else{if(!r){if(e.stateNode===null)throw Error(V(166));return null}if(t=Wr(bn.current),na(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[or]=e,r[Sa]=i,n){case"dialog":ve("cancel",r),ve("close",r);break;case"iframe":case"object":case"embed":ve("load",r);break;case"video":case"audio":for(t=0;t<cs.length;t++)ve(cs[t],r);break;case"source":ve("error",r);break;case"img":case"image":case"link":ve("error",r),ve("load",r);break;case"details":ve("toggle",r);break;case"input":Gg(r,i),ve("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},ve("invalid",r);break;case"textarea":Zg(r,i),ve("invalid",r)}Gd(n,i),t=null;for(var s in i)i.hasOwnProperty(s)&&(o=i[s],s==="children"?typeof o=="string"?r.textContent!==o&&(t=["children",o]):typeof o=="number"&&r.textContent!==""+o&&(t=["children",""+o]):Es.hasOwnProperty(s)&&o!=null&&s==="onScroll"&&ve("scroll",r));switch(n){case"input":ql(r),Jg(r,i,!0);break;case"textarea":ql(r),Yg(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=wa)}r=t,e.updateQueue=r,r!==null&&(e.flags|=4)}else{switch(s=o.nodeType===9?o:o.ownerDocument,t===jd.html&&(t=a0(n)),t===jd.html?n==="script"?(t=s.createElement("div"),t.innerHTML="<script><\/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[or]=e,t[Sa]=r,hy(t,e,!1,!1),e.stateNode=t,s=Jd(n,r),n){case"dialog":ve("cancel",t),ve("close",t),o=r;break;case"iframe":case"object":case"embed":ve("load",t),o=r;break;case"video":case"audio":for(o=0;o<cs.length;o++)ve(cs[o],t);o=r;break;case"source":ve("error",t),o=r;break;case"img":case"image":case"link":ve("error",t),ve("load",t),o=r;break;case"details":ve("toggle",t),o=r;break;case"input":Gg(t,r),o=$d(t,r),ve("invalid",t);break;case"option":o=Kd(t,r);break;case"select":t._wrapperState={wasMultiple:!!r.multiple},o=we({},r,{value:void 0}),ve("invalid",t);break;case"textarea":Zg(t,r),o=Ud(t,r),ve("invalid",t);break;default:o=r}Gd(n,o);var l=o;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?d0(t,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&u0(t,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&Ms(t,a):typeof a=="number"&&Ms(t,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(Es.hasOwnProperty(i)?a!=null&&i==="onScroll"&&ve("scroll",t):a!=null&&Lf(t,i,a,s))}switch(n){case"input":ql(t),Jg(t,r,!1);break;case"textarea":ql(t),Yg(t);break;case"option":r.value!=null&&t.setAttribute("value",""+pr(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?jo(t,!!r.multiple,i,!1):r.defaultValue!=null&&jo(t,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=wa)}_0(n,r)&&(e.flags|=4)}e.ref!==null&&(e.flags|=128)}return null;case 6:if(t&&e.stateNode!=null)my(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(V(166));n=Wr(Fs.current),Wr(bn.current),na(e)?(r=e.stateNode,n=e.memoizedProps,r[or]=e,r.nodeValue!==n&&(e.flags|=4)):(r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[or]=e,e.stateNode=r)}return null;case 13:return ye(Le),r=e.memoizedState,e.flags&64?(e.lanes=n,e):(r=r!==null,n=!1,t===null?e.memoizedProps.fallback!==void 0&&na(e):n=t.memoizedState!==null,r&&!n&&e.mode&2&&(t===null&&e.memoizedProps.unstable_avoidThisFallback!==!0||Le.current&1?Ze===0&&(Ze=3):((Ze===0||Ze===3)&&(Ze=4),ft===null||!(_s&134217727)&&!(ai&134217727)||Qo(ft,it))),(r||n)&&(e.flags|=4),null);case 4:return oi(),mf(e),t===null&&V0(e.stateNode.containerInfo),null;case 10:return eh(e),null;case 17:return Ct(e.type)&&Ca(),null;case 19:if(ye(Le),r=e.memoizedState,r===null)return null;if(i=(e.flags&64)!==0,s=r.rendering,s===null)if(i)is(r,!1);else{if(Ze!==0||t!==null&&t.flags&64)for(t=e.child;t!==null;){if(s=La(t),s!==null){for(e.flags|=64,is(r,!1),i=s.updateQueue,i!==null&&(e.updateQueue=i,e.flags|=4),r.lastEffect===null&&(e.firstEffect=null),e.lastEffect=r.lastEffect,r=n,n=e.child;n!==null;)i=n,t=r,i.flags&=2,i.nextEffect=null,i.firstEffect=null,i.lastEffect=null,s=i.alternate,s===null?(i.childLanes=0,i.lanes=t,i.child=null,i.memoizedProps=null,i.memoizedState=null,i.updateQueue=null,i.dependencies=null,i.stateNode=null):(i.childLanes=s.childLanes,i.lanes=s.lanes,i.child=s.child,i.memoizedProps=s.memoizedProps,i.memoizedState=s.memoizedState,i.updateQueue=s.updateQueue,i.type=s.type,t=s.dependencies,i.dependencies=t===null?null:{lanes:t.lanes,firstContext:t.firstContext}),n=n.sibling;return Pe(Le,Le.current&1|2),e.child}t=t.sibling}r.tail!==null&&ot()>wf&&(e.flags|=64,i=!0,is(r,!1),e.lanes=33554432)}else{if(!i)if(t=La(s),t!==null){if(e.flags|=64,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),is(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!xn)return e=e.lastEffect=r.lastEffect,e!==null&&(e.nextEffect=null),null}else 2*ot()-r.renderingStartTime>wf&&n!==1073741824&&(e.flags|=64,i=!0,is(r,!1),e.lanes=33554432);r.isBackwards?(s.sibling=e.child,e.child=s):(n=r.last,n!==null?n.sibling=s:e.child=s,r.last=s)}return r.tail!==null?(n=r.tail,r.rendering=n,r.tail=n.sibling,r.lastEffect=e.lastEffect,r.renderingStartTime=ot(),n.sibling=null,e=Le.current,Pe(Le,i?e&1|2:e&1),n):null;case 23:case 24:return hh(),t!==null&&t.memoizedState!==null!=(e.memoizedState!==null)&&r.mode!=="unstable-defer-without-hiding"&&(e.flags|=4),null}throw Error(V(156,e.tag))}function p2(t){switch(t.tag){case 1:Ct(t.type)&&Ca();var e=t.flags;return e&4096?(t.flags=e&-4097|64,t):null;case 3:if(oi(),ye(St),ye(st),rh(),e=t.flags,e&64)throw Error(V(285));return t.flags=e&-4097|64,t;case 5:return nh(t),null;case 13:return ye(Le),e=t.flags,e&4096?(t.flags=e&-4097|64,t):null;case 19:return ye(Le),null;case 4:return oi(),null;case 10:return eh(t),null;case 23:case 24:return hh(),null;default:return null}}function uh(t,e){try{var n="",r=e;do n+=GE(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
6
|
-
|
|
7
|
-
`+i.stack}return{value:t,source:e,stack:o}}function gf(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var m2=typeof WeakMap=="function"?WeakMap:Map;function gy(t,e,n){n=ur(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){Na||(Na=!0,Sf=r),gf(t,e)},n}function vy(t,e,n){n=ur(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return gf(t,e),r(o)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){typeof r!="function"&&(yn===null?yn=new Set([this]):yn.add(this),gf(t,e));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}var g2=typeof WeakSet=="function"?WeakSet:Set;function qv(t){var e=t.ref;if(e!==null)if(typeof e=="function")try{e(null)}catch(n){hr(t,n)}else e.current=null}function v2(t,e){switch(e.tag){case 0:case 11:case 15:case 22:return;case 1:if(e.flags&256&&t!==null){var n=t.memoizedProps,r=t.memoizedState;t=e.stateNode,e=t.getSnapshotBeforeUpdate(e.elementType===e.type?n:ln(e.type,n),r),t.__reactInternalSnapshotBeforeUpdate=e}return;case 3:e.flags&256&&Zf(e.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(V(163))}function y2(t,e,n){switch(n.tag){case 0:case 11:case 15:case 22:if(e=n.updateQueue,e=e!==null?e.lastEffect:null,e!==null){t=e=e.next;do{if((t.tag&3)===3){var r=t.create;t.destroy=r()}t=t.next}while(t!==e)}if(e=n.updateQueue,e=e!==null?e.lastEffect:null,e!==null){t=e=e.next;do{var o=t;r=o.next,o=o.tag,o&4&&o&1&&(My(n,t),M2(n,t)),t=r}while(t!==e)}return;case 1:t=n.stateNode,n.flags&4&&(e===null?t.componentDidMount():(r=n.elementType===n.type?e.memoizedProps:ln(n.type,e.memoizedProps),t.componentDidUpdate(r,e.memoizedState,t.__reactInternalSnapshotBeforeUpdate))),e=n.updateQueue,e!==null&&Iv(n,e,t);return;case 3:if(e=n.updateQueue,e!==null){if(t=null,n.child!==null)switch(n.child.tag){case 5:t=n.child.stateNode;break;case 1:t=n.child.stateNode}Iv(n,e,t)}return;case 5:t=n.stateNode,e===null&&n.flags&4&&_0(n.type,n.memoizedProps)&&t.focus();return;case 6:return;case 4:return;case 12:return;case 13:n.memoizedState===null&&(n=n.alternate,n!==null&&(n=n.memoizedState,n!==null&&(n=n.dehydrated,n!==null&&w0(n))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(V(163))}function Gv(t,e){for(var n=t;;){if(n.tag===5){var r=n.stateNode;if(e)r=r.style,typeof r.setProperty=="function"?r.setProperty("display","none","important"):r.display="none";else{r=n.stateNode;var o=n.memoizedProps.style;o=o!=null&&o.hasOwnProperty("display")?o.display:null,r.style.display=c0("display",o)}}else if(n.tag===6)n.stateNode.nodeValue=e?"":n.memoizedProps;else if((n.tag!==23&&n.tag!==24||n.memoizedState===null||n===t)&&n.child!==null){n.child.return=n,n=n.child;continue}if(n===t)break;for(;n.sibling===null;){if(n.return===null||n.return===t)return;n=n.return}n.sibling.return=n.return,n=n.sibling}}function Jv(t,e){if(Ur&&typeof Ur.onCommitFiberUnmount=="function")try{Ur.onCommitFiberUnmount(Yf,e)}catch{}switch(e.tag){case 0:case 11:case 14:case 15:case 22:if(t=e.updateQueue,t!==null&&(t=t.lastEffect,t!==null)){var n=t=t.next;do{var r=n,o=r.destroy;if(r=r.tag,o!==void 0)if(r&4)My(e,n);else{r=e;try{o()}catch(i){hr(r,i)}}n=n.next}while(n!==t)}break;case 1:if(qv(e),t=e.stateNode,typeof t.componentWillUnmount=="function")try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){hr(e,i)}break;case 5:qv(e);break;case 4:yy(t,e)}}function Zv(t){t.alternate=null,t.child=null,t.dependencies=null,t.firstEffect=null,t.lastEffect=null,t.memoizedProps=null,t.memoizedState=null,t.pendingProps=null,t.return=null,t.updateQueue=null}function Yv(t){return t.tag===5||t.tag===3||t.tag===4}function Qv(t){e:{for(var e=t.return;e!==null;){if(Yv(e))break e;e=e.return}throw Error(V(160))}var n=e;switch(e=n.stateNode,n.tag){case 5:var r=!1;break;case 3:e=e.containerInfo,r=!0;break;case 4:e=e.containerInfo,r=!0;break;default:throw Error(V(161))}n.flags&16&&(Ms(e,""),n.flags&=-17);e:t:for(n=t;;){for(;n.sibling===null;){if(n.return===null||Yv(n.return)){n=null;break e}n=n.return}for(n.sibling.return=n.return,n=n.sibling;n.tag!==5&&n.tag!==6&&n.tag!==18;){if(n.flags&2||n.child===null||n.tag===4)continue t;n.child.return=n,n=n.child}if(!(n.flags&2)){n=n.stateNode;break e}}r?vf(t,n,e):yf(t,n,e)}function vf(t,e,n){var r=t.tag,o=r===5||r===6;if(o)t=o?t.stateNode:t.stateNode.instance,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=wa));else if(r!==4&&(t=t.child,t!==null))for(vf(t,e,n),t=t.sibling;t!==null;)vf(t,e,n),t=t.sibling}function yf(t,e,n){var r=t.tag,o=r===5||r===6;if(o)t=o?t.stateNode:t.stateNode.instance,e?n.insertBefore(t,e):n.appendChild(t);else if(r!==4&&(t=t.child,t!==null))for(yf(t,e,n),t=t.sibling;t!==null;)yf(t,e,n),t=t.sibling}function yy(t,e){for(var n=e,r=!1,o,i;;){if(!r){r=n.return;e:for(;;){if(r===null)throw Error(V(160));switch(o=r.stateNode,r.tag){case 5:i=!1;break e;case 3:o=o.containerInfo,i=!0;break e;case 4:o=o.containerInfo,i=!0;break e}r=r.return}r=!0}if(n.tag===5||n.tag===6){e:for(var s=t,l=n,a=l;;)if(Jv(s,a),a.child!==null&&a.tag!==4)a.child.return=a,a=a.child;else{if(a===l)break e;for(;a.sibling===null;){if(a.return===null||a.return===l)break e;a=a.return}a.sibling.return=a.return,a=a.sibling}i?(s=o,l=n.stateNode,s.nodeType===8?s.parentNode.removeChild(l):s.removeChild(l)):o.removeChild(n.stateNode)}else if(n.tag===4){if(n.child!==null){o=n.stateNode.containerInfo,i=!0,n.child.return=n,n=n.child;continue}}else if(Jv(t,n),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.tag===4&&(r=!1)}n.sibling.return=n.return,n=n.sibling}}function Nd(t,e){switch(e.tag){case 0:case 11:case 14:case 15:case 22:var n=e.updateQueue;if(n=n!==null?n.lastEffect:null,n!==null){var r=n=n.next;do(r.tag&3)===3&&(t=r.destroy,r.destroy=void 0,t!==void 0&&t()),r=r.next;while(r!==n)}return;case 1:return;case 5:if(n=e.stateNode,n!=null){r=e.memoizedProps;var o=t!==null?t.memoizedProps:r;t=e.type;var i=e.updateQueue;if(e.updateQueue=null,i!==null){for(n[Sa]=r,t==="input"&&r.type==="radio"&&r.name!=null&&s0(n,r),Jd(t,o),e=Jd(t,r),o=0;o<i.length;o+=2){var s=i[o],l=i[o+1];s==="style"?d0(n,l):s==="dangerouslySetInnerHTML"?u0(n,l):s==="children"?Ms(n,l):Lf(n,s,l,e)}switch(t){case"input":_d(n,r);break;case"textarea":l0(n,r);break;case"select":t=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,i=r.value,i!=null?jo(n,!!r.multiple,i,!1):t!==!!r.multiple&&(r.defaultValue!=null?jo(n,!!r.multiple,r.defaultValue,!0):jo(n,!!r.multiple,r.multiple?[]:"",!1))}}}return;case 6:if(e.stateNode===null)throw Error(V(162));e.stateNode.nodeValue=e.memoizedProps;return;case 3:n=e.stateNode,n.hydrate&&(n.hydrate=!1,w0(n.containerInfo));return;case 12:return;case 13:e.memoizedState!==null&&(fh=ot(),Gv(e.child,!0)),Xv(e);return;case 19:Xv(e);return;case 17:return;case 23:case 24:Gv(e,e.memoizedState!==null);return}throw Error(V(163))}function Xv(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new g2),e.forEach(function(r){var o=L2.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function b2(t,e){return t!==null&&(t=t.memoizedState,t===null||t.dehydrated!==null)?(e=e.memoizedState,e!==null&&e.dehydrated===null):!1}var x2=Math.ceil,Ha=Zr.ReactCurrentDispatcher,ch=Zr.ReactCurrentOwner,re=0,ft=null,$e=null,it=0,Gr=0,bf=br(0),Ze=0,Ja=null,li=0,_s=0,ai=0,dh=0,xf=null,fh=0,wf=1/0;function ui(){wf=ot()+500}var J=null,Na=!1,Sf=null,yn=null,vr=!1,Ss=null,ds=90,Cf=[],kf=[],_n=null,Cs=0,Ef=null,da=-1,Vn=0,fa=0,ks=null,ha=!1;function Pt(){return re&48?ot():da!==-1?da:da=ot()}function dr(t){if(t=t.mode,!(t&2))return 1;if(!(t&4))return ri()===99?1:2;if(Vn===0&&(Vn=li),l2.transition!==0){fa!==0&&(fa=xf!==null?xf.pendingLanes:0),t=Vn;var e=4186112&~fa;return e&=-e,e===0&&(t=4186112&~t,e=t&-t,e===0&&(e=8192)),e}return t=ri(),re&4&&t===98?t=ba(12,Vn):(t=cM(t),t=ba(t,Vn)),t}function fr(t,e,n){if(50<Cs)throw Cs=0,Ef=null,Error(V(185));if(t=Za(t,e),t===null)return null;_a(t,e,n),t===ft&&(ai|=e,Ze===4&&Qo(t,it));var r=ri();e===1?re&8&&!(re&48)?Mf(t):(qt(t,n),re===0&&(ui(),wn())):(!(re&4)||r!==98&&r!==99||(_n===null?_n=new Set([t]):_n.add(t)),qt(t,n)),xf=t}function Za(t,e){t.lanes|=e;var n=t.alternate;for(n!==null&&(n.lanes|=e),n=t,t=t.return;t!==null;)t.childLanes|=e,n=t.alternate,n!==null&&(n.childLanes|=e),n=t,t=t.return;return n.tag===3?n.stateNode:null}function qt(t,e){for(var n=t.callbackNode,r=t.suspendedLanes,o=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var l=31-mr(s),a=1<<l,u=i[l];if(u===-1){if(!(a&r)||a&o){u=e,Fo(a);var c=me;i[l]=10<=c?u+250:6<=c?u+5e3:-1}}else u<=e&&(t.expiredLanes|=a);s&=~a}if(r=Ps(t,t===ft?it:0),e=me,r===0)n!==null&&(n!==Dd&&lf(n),t.callbackNode=null,t.callbackPriority=0);else{if(n!==null){if(t.callbackPriority===e)return;n!==Dd&&lf(n)}e===15?(n=Mf.bind(null,t),Bn===null?(Bn=[n],ca=Qf(qa,Z0)):Bn.push(n),n=Dd):e===14?n=Os(99,Mf.bind(null,t)):(n=dM(e),n=Os(n,by.bind(null,t))),t.callbackPriority=e,t.callbackNode=n}}function by(t){if(da=-1,fa=Vn=0,re&48)throw Error(V(327));var e=t.callbackNode;if(xr()&&t.callbackNode!==e)return null;var n=Ps(t,t===ft?it:0);if(n===0)return null;var r=n,o=re;re|=16;var i=Cy();(ft!==t||it!==r)&&(ui(),Xo(t,r));do try{C2();break}catch(l){Sy(t,l)}while(!0);if(Xf(),Ha.current=i,re=o,$e!==null?r=0:(ft=null,it=0,r=Ze),li&ai)Xo(t,0);else if(r!==0){if(r===2&&(re|=64,t.hydrate&&(t.hydrate=!1,Zf(t.containerInfo)),n=I0(t),n!==0&&(r=fs(t,n))),r===1)throw e=Ja,Xo(t,0),Qo(t,n),qt(t,ot()),e;switch(t.finishedWork=t.current.alternate,t.finishedLanes=n,r){case 0:case 1:throw Error(V(345));case 2:Vr(t);break;case 3:if(Qo(t,n),(n&62914560)===n&&(r=fh+500-ot(),10<r)){if(Ps(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Pt(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=xv(Vr.bind(null,t),r);break}Vr(t);break;case 4:if(Qo(t,n),(n&4186112)===n)break;for(r=t.eventTimes,o=-1;0<n;){var s=31-mr(n);i=1<<s,s=r[s],s>o&&(o=s),n&=~i}if(n=o,n=ot()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*x2(n/1960))-n,10<n){t.timeoutHandle=xv(Vr.bind(null,t),n);break}Vr(t);break;case 5:Vr(t);break;default:throw Error(V(329))}}return qt(t,ot()),t.callbackNode===e?by.bind(null,t):null}function Qo(t,e){for(e&=~dh,e&=~ai,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-mr(e),r=1<<n;t[n]=-1,e&=~r}}function Mf(t){if(re&48)throw Error(V(327));if(xr(),t===ft&&t.expiredLanes&it){var e=it,n=fs(t,e);li&ai&&(e=Ps(t,e),n=fs(t,e))}else e=Ps(t,0),n=fs(t,e);if(t.tag!==0&&n===2&&(re|=64,t.hydrate&&(t.hydrate=!1,Zf(t.containerInfo)),e=I0(t),e!==0&&(n=fs(t,e))),n===1)throw n=Ja,Xo(t,0),Qo(t,e),qt(t,ot()),n;return t.finishedWork=t.current.alternate,t.finishedLanes=e,Vr(t),qt(t,ot()),null}function w2(){if(_n!==null){var t=_n;_n=null,t.forEach(function(e){e.expiredLanes|=24&e.pendingLanes,qt(e,ot())})}wn()}function xy(t,e){var n=re;re|=1;try{return t(e)}finally{re=n,re===0&&(ui(),wn())}}function wy(t,e){var n=re;re&=-2,re|=8;try{return t(e)}finally{re=n,re===0&&(ui(),wn())}}function oa(t,e){Pe(bf,Gr),Gr|=e,li|=e}function hh(){Gr=bf.current,ye(bf)}function Xo(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,t2(n)),$e!==null)for(n=$e.return;n!==null;){var r=n;switch(r.tag){case 1:r=r.type.childContextTypes,r!=null&&Ca();break;case 3:oi(),ye(St),ye(st),rh();break;case 5:nh(r);break;case 4:oi();break;case 13:ye(Le);break;case 19:ye(Le);break;case 10:eh(r);break;case 23:case 24:hh()}n=n.return}ft=t,$e=yr(t.current,null),it=Gr=li=e,Ze=0,Ja=null,dh=ai=_s=0}function Sy(t,e){do{var n=$e;try{if(Xf(),xs.current=Oa,Pa){for(var r=De.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}Pa=!1}if(Bs=0,Je=rt=De=null,ws=!1,ch.current=null,n===null||n.return===null){Ze=1,Ja=e,$e=null;break}e:{var i=t,s=n.return,l=n,a=e;if(e=it,l.flags|=2048,l.firstEffect=l.lastEffect=null,a!==null&&typeof a=="object"&&typeof a.then=="function"){var u=a;if(!(l.mode&2)){var c=l.alternate;c?(l.updateQueue=c.updateQueue,l.memoizedState=c.memoizedState,l.lanes=c.lanes):(l.updateQueue=null,l.memoizedState=null)}var f=(Le.current&1)!==0,d=s;do{var h;if(h=d.tag===13){var g=d.memoizedState;if(g!==null)h=g.dehydrated!==null;else{var v=d.memoizedProps;h=v.fallback===void 0?!1:v.unstable_avoidThisFallback!==!0?!0:!f}}if(h){var p=d.updateQueue;if(p===null){var m=new Set;m.add(u),d.updateQueue=m}else p.add(u);if(!(d.mode&2)){if(d.flags|=64,l.flags|=16384,l.flags&=-2981,l.tag===1)if(l.alternate===null)l.tag=17;else{var y=ur(-1,1);y.tag=2,cr(l,y)}l.lanes|=1;break e}a=void 0,l=e;var x=i.pingCache;if(x===null?(x=i.pingCache=new m2,a=new Set,x.set(u,a)):(a=x.get(u),a===void 0&&(a=new Set,x.set(u,a))),!a.has(l)){a.add(l);var b=I2.bind(null,i,u,l);u.then(b,b)}d.flags|=4096,d.lanes=e;break e}d=d.return}while(d!==null);a=Error((Uo(l.type)||"A React component")+` suspended while rendering, but no fallback UI was specified.
|
|
8
|
-
|
|
9
|
-
Add a <Suspense fallback=...> component higher in the tree to provide a loading indicator or placeholder to display.`)}Ze!==5&&(Ze=2),a=uh(a,l),d=s;do{switch(d.tag){case 3:i=a,d.flags|=4096,e&=-e,d.lanes|=e;var C=gy(d,i,e);Tv(d,C);break e;case 1:i=a;var w=d.type,S=d.stateNode;if(!(d.flags&64)&&(typeof w.getDerivedStateFromError=="function"||S!==null&&typeof S.componentDidCatch=="function"&&(yn===null||!yn.has(S)))){d.flags|=4096,e&=-e,d.lanes|=e;var E=vy(d,i,e);Tv(d,E);break e}}d=d.return}while(d!==null)}Ey(n)}catch(k){e=k,$e===n&&n!==null&&($e=n=n.return);continue}break}while(!0)}function Cy(){var t=Ha.current;return Ha.current=Oa,t===null?Oa:t}function fs(t,e){var n=re;re|=16;var r=Cy();ft===t&&it===e||Xo(t,e);do try{S2();break}catch(o){Sy(t,o)}while(!0);if(Xf(),re=n,Ha.current=r,$e!==null)throw Error(V(261));return ft=null,it=0,Ze}function S2(){for(;$e!==null;)ky($e)}function C2(){for(;$e!==null&&!o2();)ky($e)}function ky(t){var e=Ty(t.alternate,t,Gr);t.memoizedProps=t.pendingProps,e===null?Ey(t):$e=e,ch.current=null}function Ey(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&2048){if(n=p2(e),n!==null){n.flags&=2047,$e=n;return}t!==null&&(t.firstEffect=t.lastEffect=null,t.flags|=2048)}else{if(n=h2(n,e,Gr),n!==null){$e=n;return}if(n=e,n.tag!==24&&n.tag!==23||n.memoizedState===null||Gr&1073741824||!(n.mode&4)){for(var r=0,o=n.child;o!==null;)r|=o.lanes|o.childLanes,o=o.sibling;n.childLanes=r}t!==null&&!(t.flags&2048)&&(t.firstEffect===null&&(t.firstEffect=e.firstEffect),e.lastEffect!==null&&(t.lastEffect!==null&&(t.lastEffect.nextEffect=e.firstEffect),t.lastEffect=e.lastEffect),1<e.flags&&(t.lastEffect!==null?t.lastEffect.nextEffect=e:t.firstEffect=e,t.lastEffect=e))}if(e=e.sibling,e!==null){$e=e;return}$e=e=t}while(e!==null);Ze===0&&(Ze=5)}function Vr(t){var e=ri();return qr(99,k2.bind(null,t,e)),null}function k2(t,e){do xr();while(Ss!==null);if(re&48)throw Error(V(327));var n=t.finishedWork;if(n===null)return null;if(t.finishedWork=null,t.finishedLanes=0,n===t.current)throw Error(V(177));t.callbackNode=null;var r=n.lanes|n.childLanes,o=r,i=t.pendingLanes&~o;t.pendingLanes=o,t.suspendedLanes=0,t.pingedLanes=0,t.expiredLanes&=o,t.mutableReadLanes&=o,t.entangledLanes&=o,o=t.entanglements;for(var s=t.eventTimes,l=t.expirationTimes;0<i;){var a=31-mr(i),u=1<<a;o[a]=0,s[a]=-1,l[a]=-1,i&=~u}if(_n!==null&&!(r&24)&&_n.has(t)&&_n.delete(t),t===ft&&($e=ft=null,it=0),1<n.flags?n.lastEffect!==null?(n.lastEffect.nextEffect=n,r=n.firstEffect):r=n:r=n.firstEffect,r!==null){if(o=re,re|=32,ch.current=null,Id=sa,s=pv(),tf(s)){if("selectionStart"in s)l={start:s.selectionStart,end:s.selectionEnd};else e:if(l=(l=s.ownerDocument)&&l.defaultView||window,(u=l.getSelection&&l.getSelection())&&u.rangeCount!==0){l=u.anchorNode,i=u.anchorOffset,a=u.focusNode,u=u.focusOffset;try{l.nodeType,a.nodeType}catch{l=null;break e}var c=0,f=-1,d=-1,h=0,g=0,v=s,p=null;t:for(;;){for(var m;v!==l||i!==0&&v.nodeType!==3||(f=c+i),v!==a||u!==0&&v.nodeType!==3||(d=c+u),v.nodeType===3&&(c+=v.nodeValue.length),(m=v.firstChild)!==null;)p=v,v=m;for(;;){if(v===s)break t;if(p===l&&++h===i&&(f=c),p===a&&++g===u&&(d=c),(m=v.nextSibling)!==null)break;v=p,p=v.parentNode}v=m}l=f===-1||d===-1?null:{start:f,end:d}}else l=null;l=l||{start:0,end:0}}else l=null;Ld={focusedElem:s,selectionRange:l},sa=!1,ks=null,ha=!1,J=r;do try{E2()}catch(k){if(J===null)throw Error(V(330));hr(J,k),J=J.nextEffect}while(J!==null);ks=null,J=r;do try{for(s=t;J!==null;){var y=J.flags;if(y&16&&Ms(J.stateNode,""),y&128){var x=J.alternate;if(x!==null){var b=x.ref;b!==null&&(typeof b=="function"?b(null):b.current=null)}}switch(y&1038){case 2:Qv(J),J.flags&=-3;break;case 6:Qv(J),J.flags&=-3,Nd(J.alternate,J);break;case 1024:J.flags&=-1025;break;case 1028:J.flags&=-1025,Nd(J.alternate,J);break;case 4:Nd(J.alternate,J);break;case 8:l=J,yy(s,l);var C=l.alternate;Zv(l),C!==null&&Zv(C)}J=J.nextEffect}}catch(k){if(J===null)throw Error(V(330));hr(J,k),J=J.nextEffect}while(J!==null);if(b=Ld,x=pv(),y=b.focusedElem,s=b.selectionRange,x!==y&&y&&y.ownerDocument&&N0(y.ownerDocument.documentElement,y)){for(s!==null&&tf(y)&&(x=s.start,b=s.end,b===void 0&&(b=x),"selectionStart"in y?(y.selectionStart=x,y.selectionEnd=Math.min(b,y.value.length)):(b=(x=y.ownerDocument||document)&&x.defaultView||window,b.getSelection&&(b=b.getSelection(),l=y.textContent.length,C=Math.min(s.start,l),s=s.end===void 0?C:Math.min(s.end,l),!b.extend&&C>s&&(l=s,s=C,C=l),l=hv(y,C),i=hv(y,s),l&&i&&(b.rangeCount!==1||b.anchorNode!==l.node||b.anchorOffset!==l.offset||b.focusNode!==i.node||b.focusOffset!==i.offset)&&(x=x.createRange(),x.setStart(l.node,l.offset),b.removeAllRanges(),C>s?(b.addRange(x),b.extend(i.node,i.offset)):(x.setEnd(i.node,i.offset),b.addRange(x)))))),x=[],b=y;b=b.parentNode;)b.nodeType===1&&x.push({element:b,left:b.scrollLeft,top:b.scrollTop});for(typeof y.focus=="function"&&y.focus(),y=0;y<x.length;y++)b=x[y],b.element.scrollLeft=b.left,b.element.scrollTop=b.top}sa=!!Id,Ld=Id=null,t.current=n,J=r;do try{for(y=t;J!==null;){var w=J.flags;if(w&36&&y2(y,J.alternate,J),w&128){x=void 0;var S=J.ref;if(S!==null){var E=J.stateNode;switch(J.tag){case 5:x=E;break;default:x=E}typeof S=="function"?S(x):S.current=x}}J=J.nextEffect}}catch(k){if(J===null)throw Error(V(330));hr(J,k),J=J.nextEffect}while(J!==null);J=null,s2(),re=o}else t.current=n;if(vr)vr=!1,Ss=t,ds=e;else for(J=r;J!==null;)e=J.nextEffect,J.nextEffect=null,J.flags&8&&(w=J,w.sibling=null,w.stateNode=null),J=e;if(r=t.pendingLanes,r===0&&(yn=null),r===1?t===Ef?Cs++:(Cs=0,Ef=t):Cs=0,n=n.stateNode,Ur&&typeof Ur.onCommitFiberRoot=="function")try{Ur.onCommitFiberRoot(Yf,n,void 0,(n.current.flags&64)===64)}catch{}if(qt(t,ot()),Na)throw Na=!1,t=Sf,Sf=null,t;return re&8||wn(),null}function E2(){for(;J!==null;){var t=J.alternate;ha||ks===null||(J.flags&8?ev(J,ks)&&(ha=!0):J.tag===13&&b2(t,J)&&ev(J,ks)&&(ha=!0));var e=J.flags;e&256&&v2(t,J),!(e&512)||vr||(vr=!0,Os(97,function(){return xr(),null})),J=J.nextEffect}}function xr(){if(ds!==90){var t=97<ds?97:ds;return ds=90,qr(t,T2)}return!1}function M2(t,e){Cf.push(e,t),vr||(vr=!0,Os(97,function(){return xr(),null}))}function My(t,e){kf.push(e,t),vr||(vr=!0,Os(97,function(){return xr(),null}))}function T2(){if(Ss===null)return!1;var t=Ss;if(Ss=null,re&48)throw Error(V(331));var e=re;re|=32;var n=kf;kf=[];for(var r=0;r<n.length;r+=2){var o=n[r],i=n[r+1],s=o.destroy;if(o.destroy=void 0,typeof s=="function")try{s()}catch(a){if(i===null)throw Error(V(330));hr(i,a)}}for(n=Cf,Cf=[],r=0;r<n.length;r+=2){o=n[r],i=n[r+1];try{var l=o.create;o.destroy=l()}catch(a){if(i===null)throw Error(V(330));hr(i,a)}}for(l=t.current.firstEffect;l!==null;)t=l.nextEffect,l.nextEffect=null,l.flags&8&&(l.sibling=null,l.stateNode=null),l=t;return re=e,wn(),!0}function e0(t,e,n){e=uh(n,e),e=gy(t,e,1),cr(t,e),e=Pt(),t=Za(t,1),t!==null&&(_a(t,1,e),qt(t,e))}function hr(t,e){if(t.tag===3)e0(t,t,e);else for(var n=t.return;n!==null;){if(n.tag===3){e0(n,t,e);break}else if(n.tag===1){var r=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&(yn===null||!yn.has(r))){t=uh(e,t);var o=vy(n,t,1);if(cr(n,o),o=Pt(),n=Za(n,1),n!==null)_a(n,1,o),qt(n,o);else if(typeof r.componentDidCatch=="function"&&(yn===null||!yn.has(r)))try{r.componentDidCatch(e,t)}catch{}break}}n=n.return}}function I2(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Pt(),t.pingedLanes|=t.suspendedLanes&n,ft===t&&(it&n)===n&&(Ze===4||Ze===3&&(it&62914560)===it&&500>ot()-fh?Xo(t,0):dh|=n),qt(t,e)}function L2(t,e){var n=t.stateNode;n!==null&&n.delete(e),e=0,e===0&&(e=t.mode,e&2?e&4?(Vn===0&&(Vn=li),e=Bo(62914560&~Vn),e===0&&(e=4194304)):e=ri()===99?1:2:e=1),n=Pt(),t=Za(t,e),t!==null&&(_a(t,e,n),qt(t,n))}var Ty;Ty=function(t,e,n){var r=e.lanes;if(t!==null)if(t.memoizedProps!==e.pendingProps||St.current)an=!0;else if(n&r)an=!!(t.flags&16384);else{switch(an=!1,e.tag){case 3:zv(e),Rd();break;case 5:Dv(e);break;case 1:Ct(e.type)&&ua(e);break;case 4:cf(e,e.stateNode.containerInfo);break;case 10:r=e.memoizedProps.value;var o=e.type._context;Pe(ka,o._currentValue),o._currentValue=r;break;case 13:if(e.memoizedState!==null)return n&e.child.childLanes?$v(t,e,n):(Pe(Le,Le.current&1),e=$n(t,e,n),e!==null?e.sibling:null);Pe(Le,Le.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&64){if(r)return jv(t,e,n);e.flags|=64}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Pe(Le,Le.current),r)break;return null;case 23:case 24:return e.lanes=0,Od(t,e,n)}return $n(t,e,n)}else an=!1;switch(e.lanes=0,e.tag){case 2:if(r=e.type,t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2),t=e.pendingProps,o=ni(e,st.current),Zo(e,n),o=ih(null,e,r,t,o,n),e.flags|=1,typeof o=="object"&&o!==null&&typeof o.render=="function"&&o.$$typeof===void 0){if(e.tag=1,e.memoizedState=null,e.updateQueue=null,Ct(r)){var i=!0;ua(e)}else i=!1;e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,th(e);var s=r.getDerivedStateFromProps;typeof s=="function"&&Ta(e,r,s,t),o.updater=Ga,e.stateNode=o,o._reactInternals=e,uf(e,r,t,n),e=pf(null,e,r,!0,i,n)}else e.tag=0,wt(null,e,o,n),e=e.child;return e;case 16:o=e.elementType;e:{switch(t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2),t=e.pendingProps,i=o._init,o=i(o._payload),e.type=o,i=e.tag=D2(o),t=ln(o,t),i){case 0:e=hf(null,e,o,t,n);break e;case 1:e=Vv(null,e,o,t,n);break e;case 11:e=Fv(null,e,o,t,n);break e;case 14:e=Bv(null,e,o,ln(o.type,t),r,n);break e}throw Error(V(306,o,""))}return e;case 0:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:ln(r,o),hf(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:ln(r,o),Vv(t,e,r,o,n);case 3:if(zv(e),r=e.updateQueue,t===null||r===null)throw Error(V(282));if(r=e.pendingProps,o=e.memoizedState,o=o!==null?o.element:null,Q0(t,e),Hs(e,r,null,n),r=e.memoizedState.element,r===o)Rd(),e=$n(t,e,n);else{if(o=e.stateNode,(i=o.hydrate)&&(ir=Jo(e.stateNode.containerInfo.firstChild),zn=e,i=xn=!0),i){if(t=o.mutableSourceEagerHydrationData,t!=null)for(o=0;o<t.length;o+=2)i=t[o],i._workInProgressVersionPrimary=t[o+1],Yo.push(i);for(n=ny(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|1024,n=n.sibling}else wt(t,e,r,n),Rd();e=e.child}return e;case 5:return Dv(e),t===null&&df(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,of(r,o)?s=null:i!==null&&of(r,i)&&(e.flags|=16),fy(t,e),wt(t,e,s,n),e.child;case 6:return t===null&&df(e),null;case 13:return $v(t,e,n);case 4:return cf(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=Ia(e,null,r,n):wt(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:ln(r,o),Fv(t,e,r,o,n);case 7:return wt(t,e,e.pendingProps,n),e.child;case 8:return wt(t,e,e.pendingProps.children,n),e.child;case 12:return wt(t,e,e.pendingProps.children,n),e.child;case 10:e:{r=e.type._context,o=e.pendingProps,s=e.memoizedProps,i=o.value;var l=e.type._context;if(Pe(ka,l._currentValue),l._currentValue=i,s!==null)if(l=s.value,i=Wt(l,i)?0:(typeof r._calculateChangedBits=="function"?r._calculateChangedBits(l,i):1073741823)|0,i===0){if(s.children===o.children&&!St.current){e=$n(t,e,n);break e}}else for(l=e.child,l!==null&&(l.return=e);l!==null;){var a=l.dependencies;if(a!==null){s=l.child;for(var u=a.firstContext;u!==null;){if(u.context===r&&u.observedBits&i){l.tag===1&&(u=ur(-1,n&-n),u.tag=2,cr(l,u)),l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),Y0(l.return,n),a.lanes|=n;break}u=u.next}}else s=l.tag===10&&l.type===e.type?null:l.child;if(s!==null)s.return=l;else for(s=l;s!==null;){if(s===e){s=null;break}if(l=s.sibling,l!==null){l.return=s.return,s=l;break}s=s.return}l=s}wt(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,i=e.pendingProps,r=i.children,Zo(e,n),o=jt(o,i.unstable_observedBits),r=r(o),e.flags|=1,wt(t,e,r,n),e.child;case 14:return o=e.type,i=ln(o,e.pendingProps),i=ln(o.type,i),Bv(t,e,o,i,r,n);case 15:return dy(t,e,e.type,e.pendingProps,r,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:ln(r,o),t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2),e.tag=1,Ct(r)?(t=!0,ua(e)):t=!1,Zo(e,n),ey(e,r,o),uf(e,r,o,n),pf(null,e,r,!0,t,n);case 19:return jv(t,e,n);case 23:return Od(t,e,n);case 24:return Od(t,e,n)}throw Error(V(156,e.tag))};function P2(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.flags=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.childLanes=this.lanes=0,this.alternate=null}function Kt(t,e,n,r){return new P2(t,e,n,r)}function ph(t){return t=t.prototype,!(!t||!t.isReactComponent)}function D2(t){if(typeof t=="function")return ph(t)?1:0;if(t!=null){if(t=t.$$typeof,t===Va)return 11;if(t===za)return 14}return 2}function yr(t,e){var n=t.alternate;return n===null?(n=Kt(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.nextEffect=null,n.firstEffect=null,n.lastEffect=null),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 pa(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")ph(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case nr:return ei(n.children,o,i,e);case r0:s=8,o|=16;break;case Pf:s=8,o|=1;break;case hs:return t=Kt(12,n,e,o|8),t.elementType=hs,t.type=hs,t.lanes=i,t;case ps:return t=Kt(13,n,e,o),t.type=ps,t.elementType=ps,t.lanes=i,t;case ma:return t=Kt(19,n,e,o),t.elementType=ma,t.lanes=i,t;case Nf:return mh(n,o,i,e);case zd:return t=Kt(24,n,e,o),t.elementType=zd,t.lanes=i,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case Df:s=10;break e;case Af:s=9;break e;case Va:s=11;break e;case za:s=14;break e;case Rf:s=16,r=null;break e;case Of:s=22;break e}throw Error(V(130,t==null?t:typeof t,""))}return e=Kt(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function ei(t,e,n,r){return t=Kt(7,t,r,e),t.lanes=n,t}function mh(t,e,n,r){return t=Kt(23,t,r,e),t.elementType=Nf,t.lanes=n,t}function Fd(t,e,n){return t=Kt(6,t,null,e),t.lanes=n,t}function Bd(t,e,n){return e=Kt(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function A2(t,e,n){this.tag=e,this.containerInfo=t,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=-1,this.pendingContext=this.context=null,this.hydrate=n,this.callbackNode=null,this.callbackPriority=0,this.eventTimes=Sd(0),this.expirationTimes=Sd(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Sd(0),this.mutableSourceEagerHydrationData=null}function R2(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:zr,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function Fa(t,e,n,r){var o=e.current,i=Pt(),s=dr(o);e:if(n){n=n._reactInternals;t:{if(Yr(n)!==n||n.tag!==1)throw Error(V(170));var l=n;do{switch(l.tag){case 3:l=l.stateNode.context;break t;case 1:if(Ct(l.type)){l=l.stateNode.__reactInternalMemoizedMergedChildContext;break t}}l=l.return}while(l!==null);throw Error(V(171))}if(n.tag===1){var a=n.type;if(Ct(a)){n=K0(n,a,l);break e}}n=l}else n=gr;return e.context===null?e.context=n:e.pendingContext=n,e=ur(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),cr(o,e),fr(o,s,i),s}function Vd(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:return t.child.stateNode;default:return t.child.stateNode}}function t0(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function gh(t,e){t0(t,e),(t=t.alternate)&&t0(t,e)}function O2(){return null}function vh(t,e,n){var r=n!=null&&n.hydrationOptions!=null&&n.hydrationOptions.mutableSources||null;if(n=new A2(t,e,n!=null&&n.hydrate===!0),e=Kt(3,null,null,e===2?7:e===1?3:0),n.current=e,e.stateNode=n,th(e),t[si]=n.current,V0(t.nodeType===8?t.parentNode:t),r)for(t=0;t<r.length;t++){e=r[t];var o=e._getVersion;o=o(e._source),n.mutableSourceEagerHydrationData==null?n.mutableSourceEagerHydrationData=[e,o]:n.mutableSourceEagerHydrationData.push(e,o)}this._internalRoot=n}vh.prototype.render=function(t){Fa(t,this._internalRoot,null,null)};vh.prototype.unmount=function(){var t=this._internalRoot,e=t.containerInfo;Fa(null,t,null,function(){e[si]=null})};function Ws(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function H2(t,e){if(e||(e=t?t.nodeType===9?t.documentElement:t.firstChild:null,e=!(!e||e.nodeType!==1||!e.hasAttribute("data-reactroot"))),!e)for(var n;n=t.lastChild;)t.removeChild(n);return new vh(t,0,e?{hydrate:!0}:void 0)}function Ya(t,e,n,r,o){var i=n._reactRootContainer;if(i){var s=i._internalRoot;if(typeof o=="function"){var l=o;o=function(){var u=Vd(s);l.call(u)}}Fa(e,s,t,o)}else{if(i=n._reactRootContainer=H2(n,r),s=i._internalRoot,typeof o=="function"){var a=o;o=function(){var u=Vd(s);a.call(u)}}wy(function(){Fa(e,s,t,o)})}return Vd(s)}y0=function(t){if(t.tag===13){var e=Pt();fr(t,4,e),gh(t,4)}};$f=function(t){if(t.tag===13){var e=Pt();fr(t,67108864,e),gh(t,67108864)}};b0=function(t){if(t.tag===13){var e=Pt(),n=dr(t);fr(t,n,e),gh(t,n)}};x0=function(t,e){return e()};Zd=function(t,e,n){switch(e){case"input":if(_d(t,n),e=n.name,n.type==="radio"&&e!=null){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var r=n[e];if(r!==t&&r.form===t.form){var o=ja(r);if(!o)throw Error(V(90));i0(r),_d(r,o)}}}break;case"textarea":l0(t,n);break;case"select":e=n.value,e!=null&&jo(t,!!n.multiple,e,!1)}};Bf=xy;p0=function(t,e,n,r,o){var i=re;re|=4;try{return qr(98,t.bind(null,e,n,r,o))}finally{re=i,re===0&&(ui(),wn())}};Vf=function(){!(re&49)&&(w2(),xr())};m0=function(t,e){var n=re;re|=2;try{return t(e)}finally{re=n,re===0&&(ui(),wn())}};function Iy(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!Ws(e))throw Error(V(200));return R2(t,e,null,n)}var N2={Events:[zs,_o,ja,f0,h0,xr,{current:!1}]},ss={findFiberByHostInstance:_r,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},F2={bundleType:ss.bundleType,version:ss.version,rendererPackageName:ss.rendererPackageName,rendererConfig:ss.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:Zr.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=v0(t),t===null?null:t.stateNode},findFiberByHostInstance:ss.findFiberByHostInstance||O2,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(ls=__REACT_DEVTOOLS_GLOBAL_HOOK__,!ls.isDisabled&&ls.supportsFiber))try{Yf=ls.inject(F2),Ur=ls}catch{}var ls;Gt.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=N2;Gt.createPortal=Iy;Gt.findDOMNode=function(t){if(t==null)return null;if(t.nodeType===1)return t;var e=t._reactInternals;if(e===void 0)throw typeof t.render=="function"?Error(V(188)):Error(V(268,Object.keys(t)));return t=v0(e),t=t===null?null:t.stateNode,t};Gt.flushSync=function(t,e){var n=re;if(n&48)return t(e);re|=1;try{if(t)return qr(99,t.bind(null,e))}finally{re=n,wn()}};Gt.hydrate=function(t,e,n){if(!Ws(e))throw Error(V(200));return Ya(null,t,e,!0,n)};Gt.render=function(t,e,n){if(!Ws(e))throw Error(V(200));return Ya(null,t,e,!1,n)};Gt.unmountComponentAtNode=function(t){if(!Ws(t))throw Error(V(40));return t._reactRootContainer?(wy(function(){Ya(null,null,t,!1,function(){t._reactRootContainer=null,t[si]=null})}),!0):!1};Gt.unstable_batchedUpdates=xy;Gt.unstable_createPortal=function(t,e){return Iy(t,e,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};Gt.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!Ws(n))throw Error(V(200));if(t==null||t._reactInternals===void 0)throw Error(V(38));return Ya(t,e,n,!1,r)};Gt.version="17.0.2"});var Qa=Wi((cO,Dy)=>{"use strict";function Py(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Py)}catch(t){console.error(t)}}Py(),Dy.exports=Ly()});import{getFullRange as Ki,metadataKeys as AE,WindowRange as RE}from"@vuu-ui/vuu-utils";import{useCallback as rd,useEffect as od,useMemo as Dg,useRef as Ui,useState as OE}from"react";var{SELECTED:id}=AE;function tO({dataSource:t,renderBufferSize:e=10}){let[,n]=OE(null),r=Ui(!0),o=Ui(!1),i=Ui(null),s=Ui([]),l=Ui({from:0,to:10}),a=Dg(()=>new sd(Ki(l.current,e)),[e]),u=rd(d=>{for(let h of d)a.add(h);s.current=a.data.slice(),o.current=!0},[a]),c=rd(d=>{d.type==="viewport-update"&&(d.size!==void 0&&a.setRowCount(d.size),d.rows?(u(d.rows),n({})):d.size!==void 0&&(s.current=a.data.slice(),o.current=!0))},[a,u]);od(()=>()=>{i.current&&(cancelAnimationFrame(i.current),i.current=null),r.current=!1},[]);let f=rd(d=>{l.current=d;let h=Ki(l.current,e);t.range=h,a.setRange(h.from,h.to)},[t,a,e]);return Dg(()=>{let{from:d,to:h}=l.current,g=Ki({from:d,to:h},e);t.range=g,a.setRange(g.from,g.to)},[t,a,e]),od(()=>{let{from:d,to:h}=Ki(l.current,e);t.subscribe({range:{from:d,to:h}},c)},[t,c,e]),od(()=>()=>{t.unsubscribe()},[t]),[s.current,a.rowCount,Ki(l.current,e),f]}var sd=class{constructor({from:e,to:n}){this.rowCount=0;this.setRowCount=e=>{e<this.data.length&&(this.data.length=e),this.rowCount=e};this.range=new RE(e,n),this.data=new Array(n-e)}add(e){let[n]=e;if(this.isWithinRange(n)){let r=n-this.range.from;this.data[r]=e,this.data[r-1]&&this.data[r-1][id]===1&&e[id]===0&&(e[id]=2),n===this.rowCount-1&&(this.data.length=r+1)}}getAtIndex(e){return this.range.isWithin(e)&&this.data[e-this.range.from]!=null?this.data[e-this.range.from]:void 0}isWithinRange(e){return this.range.isWithin(e)}setRange(e,n){if(e!==this.range.from||n!==this.range.to){let[r,o]=this.range.overlap(e,n),i=new Array(n-e);for(let s=r;s<o;s++){let l=this.getAtIndex(s);if(l){let a=s-e;i[a]=l}}this.data=i,this.range.from=e,this.range.to=n}}};import{VuuDataSource as bR}from"@vuu-ui/vuu-data-remote";import{useCallback as Fj}from"react";function Ag(t){var e,n,r="";if(typeof t=="string"||typeof t=="number")r+=t;else if(typeof t=="object")if(Array.isArray(t))for(e=0;e<t.length;e++)t[e]&&(n=Ag(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function pn(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=Ag(t))&&(r&&(r+=" "),r+=e);return r}var W=pn;var HE={},NE={},FE={};function Xn(t,e,n="component"){FE[t]=e,n==="container"?HE[t]=!0:n==="view"&&(NE[t]=!0)}var Fn=t=>(...e)=>[t,...e].join("-");import{useLayoutEffect as B2,useEffect as V2}from"react";var Ks=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?B2:V2;import{jsx as pO}from"react/jsx-runtime";import{createContext as z2,useContext as $2}from"react";var _2=z2(typeof window<"u"?window:null);function Xr(){return $2(_2)}import*as Xa from"react";import{jsx as wO}from"react/jsx-runtime";import{createContext as W2,useMemo as CO,useContext as K2}from"react";var U2=W2(null);function Ay(){return K2(U2)}import{createContext as j2,useContext as q2}from"react";var Ry=j2(!0),Oy=()=>q2(Ry),MO=Ry.Provider;var Hy,G2=(Hy=Xa.useInsertionEffect)!=null?Hy:Xa.useLayoutEffect,yh=new WeakMap;function eo({testId:t,css:e,window:n}){let r=Oy(),o=Ay();G2(()=>{var i,s;if(!n||!r)return;let l=(i=yh.get(n))!=null?i:new Map,a=(s=l.get(e))!=null?s:{styleElement:null,count:0};return a.styleElement==null?(a.styleElement=n.document.createElement("style"),a.styleElement.setAttribute("type","text/css"),a.styleElement.setAttribute("data-salt-style",t||""),a.styleElement.textContent=e,a.count=1,n.document.head.insertBefore(a.styleElement,o||n.document.head.firstChild)):(a.styleElement.textContent=e,a.count++),l.set(e,a),yh.set(n,l),()=>{let u=yh.get(n),c=u==null?void 0:u.get(e);c!=null&&c.styleElement&&(c.count--,c.count<1&&(n.document.head.removeChild(c.styleElement),c.styleElement=null,u==null||u.delete(e)))}},[t,e,n])}import{createContext as J2}from"react";function Ny(t,e){return J2(e)}import{useRef as Fy,useState as Z2,useEffect as By,useCallback as Y2,isValidElement as Q2}from"react";function Qe({controlled:t,default:e,name:n,state:r="value"}){let{current:o}=Fy(t!==void 0),[i,s]=Z2(e),l=t!==void 0?t:i,{current:a}=Fy(e);By(()=>{},[r,n,t]),By(()=>{},[JSON.stringify(e,X2)]);let u=Y2(c=>{o||s(c)},[o]);return[l,u,o]}function X2(t,e){return Q2(e)?null:e}import{jsx as t3}from"react/jsx-runtime";import{forwardRef as n3}from"react";var Vy=`/* Styles applied to the root element if variant="cta" */
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
.
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
.
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
.
|
|
33
|
-
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
.
|
|
50
|
-
|
|
51
|
-
}
|
|
52
|
-
.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
.
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
.
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
.
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
.
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
.
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
.
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
.
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
}
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
}
|
|
407
|
-
`;var Sn=Fn("saltInput"),to=f3(function({"aria-activedescendant":e,"aria-expanded":n,"aria-owns":r,className:o,disabled:i,emptyReadOnlyMarker:s="\u2014",endAdornment:l,id:a,inputProps:u={},inputRef:c,placeholder:f,readOnly:d,role:h,startAdornment:g,style:v,textAlign:p="left",value:m,defaultValue:y=m===void 0?"":void 0,validationStatus:x,variant:b="primary",...C},w){let S=Xr();eo({testId:"salt-input",css:Xy,window:S});let{a11yProps:{"aria-describedby":E,"aria-labelledby":k}={},disabled:T,readOnly:D,necessity:M,validationStatus:I}=Wy(),R={"aria-activedescendant":e,"aria-expanded":n,"aria-owns":r},A=i||T,L=d||D,H=I!=null?I:x,[O,B]=h3(!1),F=L&&!y&&!m?s:y,{"aria-describedby":N,"aria-labelledby":z,onBlur:q,onChange:Z,onFocus:j,required:U,...ue}=u,se=M?["required","asterisk"].includes(M):U,[Me,Te]=Qe({controlled:m,default:F,name:"Input",state:"value"}),Ce=Ie=>{let ge=Ie.target.value;Te(ge),Z==null||Z(Ie)},pe=Ie=>{q==null||q(Ie),B(!1)},Be=Ie=>{j==null||j(Ie),B(!0)},We={"--input-textAlign":p,...v};return d3("div",{className:pn(Sn(),Sn(b),{[Sn("focused")]:!A&&O,[Sn("disabled")]:A,[Sn("readOnly")]:L,[Sn(H||"")]:H},o),ref:w,style:We,...C,children:[g&&Us("div",{className:Sn("startAdornmentContainer"),children:g}),Us("input",{"aria-describedby":pn(E,N),"aria-labelledby":pn(k,z),className:pn(Sn("input"),u==null?void 0:u.className),disabled:A,id:a,readOnly:L,ref:c,role:h,tabIndex:A?-1:0,onBlur:pe,onChange:Ce,onFocus:A?void 0:Be,placeholder:f,value:Me,...R,...ue,required:se}),!A&&!L&&H&&Us(Qy,{status:H}),l&&Us("div",{className:Sn("endAdornmentContainer"),children:l}),Us("div",{className:Sn("activationIndicator")})]})});import{useMemo as p3}from"react";function bh(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function pt(t,e){return p3(()=>t==null&&e==null?()=>null:n=>{bh(t,n),bh(e,n)},[t,e])}import{Children as m3,isValidElement as eb}from"react";var g3=[],tu=t=>{let e=Array.isArray(t),n=e?t.length:m3.count(t);return e&&t.every(eb)?t:n===1&&!e&&eb(t)?[t]:n>1?t:g3};var nu=nd(Qa());import rH,{createElement as rb}from"react";var tb=nd(Qa());var nb=(t,e,n,r,o)=>{e.style.cssText=`left:${n}px; top:${r}px;position: absolute;`,tb.render(t,e,o)};var xh=!1,Jt=[],ob=t=>(t==null?void 0:t.type)==="menu-action",ib=t=>(t==null?void 0:t.type)==="click-away";function sb(t){if(t.key==="Esc"){if(Jt.length)ab();else if(xh){let e=document.body.querySelector(".vuuDialog");e&&nu.default.unmountComponentAtNode(e)}}}function lb(t){if(Jt.length){let e=document.body.querySelectorAll(".vuuPopup,#vuu-portal-root");for(let n=0;n<e.length;n++)if(e[n].contains(t.target))return;ab({mouseEvt:t,type:"click-away"})}}function ab(t){if(Jt.length===1)no.hidePopup(t,"anon","all");else if(Jt.length){let e=document.body.querySelectorAll(".vuuPopup");for(let n=0;n<e.length;n++)nu.default.unmountComponentAtNode(e[n]);ub("*")}}function v3(t){Jt.indexOf(t)===-1&&(Jt.push(t),xh===!1&&(window.addEventListener("keydown",sb,!0),window.addEventListener("click",lb,!0)))}function ub(t){if(Jt.length){if(t==="*")Jt.length=0;else{let e=Jt.indexOf(t);e!==-1&&Jt.splice(e,1)}Jt.length===0&&xh===!1&&(window.removeEventListener("keydown",sb,!0),window.removeEventListener("click",lb,!0))}}var y3=({children:t,position:e,style:n})=>{let r=W("hwPopup","hwPopupContainer",e);return rb("div",{className:r,style:n},t)},b3=1,no=class t{static showPopup({group:e="all",name:n="anon",left:r=0,position:o="",right:i="auto",top:s=0,width:l="auto",component:a}){if(!a)throw Error("PopupService showPopup, no component supplied");typeof a.props.onClose=="function"?t.onClose=a.props.onClose:t.onClose=void 0,v3(n),document.addEventListener("keydown",t.escapeKeyListener,!0);let u=document.body.querySelector(".vuuPopup."+e);u===null&&(u=document.createElement("div"),u.className="vuuPopup "+e,document.body.appendChild(u));let c={width:l};nb(rb(y3,{key:b3++,position:o,style:c},a),u,r,s,()=>{t.keepWithinThePage(u,i)})}static escapeKeyListener(e){e.key==="Escape"&&t.hidePopup({type:"escape",event:e})}static hidePopup(e,n="anon",r="all"){var o;if(Jt.indexOf(n)!==-1){ub(n);let i=document.body.querySelector(`.vuuPopup.${r}`);i&&nu.default.unmountComponentAtNode(i)}document.removeEventListener("keydown",t.escapeKeyListener,!0),(o=t==null?void 0:t.onClose)==null||o.call(t,e)}static keepWithinThePage(e,n="auto"){let r=e.querySelector(".vuuPopupContainer > *");if(r){let{top:o,left:i,width:s,height:l,right:a}=r.getBoundingClientRect(),u=window.innerWidth,f=window.innerHeight-(o+l);f<0&&(r.style.top=Math.round(o)+f+"px");let d=u-(i+s);if(d<0&&(r.style.left=Math.round(i)+d+"px"),typeof n=="number"&&n!==a){let h=n-a;r.style.left=i+h+"px"}}}};import{useCallback as x3,useLayoutEffect as w3,useRef as S3,useState as C3}from"react";var cb=(t,e,n,r,o,i)=>{let{bottom:s,height:l,left:a,right:u,top:c,width:f}=t.getBoundingClientRect();switch(e){case"below":return{left:a+n,top:s+r};case"right":return{left:u+n,top:c+r};case"below-center":return{left:a+f/2+n,top:s+r};case"below-right":return{left:a,minWidth:o,top:s+r};case"below-full-width":return{left:a+n,minWidth:o,top:s+r,width:f};case"center":return i?{left:f/2-i.width/2+n,top:l/2-i.height/2+r,visibility:"visible"}:{left:f/2+n,top:l/2+r,visibility:"hidden"};default:throw Error("Popup getPositionRelativeToAnchor only supported placement values are below and right")}},db=({anchorElement:t,minWidth:e,offsetLeft:n=0,offsetTop:r=0,placement:o,position:i})=>{let s=S3(null),[l,a]=C3(i);w3(()=>{if(o==="absolute"&&i)a(i);else if(t.current&&o!=="auto"){let c=s.current===null?void 0:s.current.getBoundingClientRect(),f=cb(t.current,o,n,r,e,c);a(f)}},[t,e,n,r,o,i]);let u=x3(c=>{if(s.current=c,c&&o==="center"&&t.current){let{height:f,width:d}=c.getBoundingClientRect();a(cb(t.current,o,n,r,void 0,{height:f,width:d}))}},[t,n,r,o]);return{position:l,popupRef:o==="center"?u:void 0}};import{jsx as k3}from"react/jsx-runtime";var ci=({children:t,className:e,anchorElement:n,minWidth:r,placement:o,position:i})=>{let{popupRef:s,position:l}=db({anchorElement:n,minWidth:r,placement:o,position:i});return l===void 0?null:k3("div",{className:W("vuuPortal",e),ref:s,style:l,children:t})};import{useId as sT}from"@vuu-ui/vuu-utils";import{useCallback as Pb,useRef as Th}from"react";var hb=nd(Qa());import{useThemeAttributes as E3}from"@vuu-ui/vuu-utils";import{useLayoutEffect as fb,useRef as M3,useState as T3}from"react";function I3(t){return typeof t=="function"?t():t}var L3=["vuu-dialog-portal-root","vuu-portal-root"],P3=t=>{if(Array.isArray(t))for(let e of t){let n=document.getElementById(e);if(n)return n}else return document.getElementById(t);return null},wr=({children:t,container:e=document.body,id:n=L3,onRender:r,open:o=!0,themeAttributes:i})=>{var h;let[s,l]=T3(!1),a=M3(null),u=(h=I3(e))!=null?h:document.body,[c,f,d]=E3(i);return fb(()=>{let g=P3(n);g?a.current=g:(a.current=document.createElement("div"),a.current.id=typeof n=="string"?n:n.length>0?n.at(-1):"vuu-portal-root");let v=a.current;u.contains(v)||u.appendChild(v),v.classList.add(c,f),v.dataset.mode=d,l(!0)},[n,u,c,f,d]),fb(()=>{requestAnimationFrame(()=>{r==null||r()})},[r]),o&&s&&a.current&&t?(0,hb.createPortal)(t,a.current):null};import kb,{useLayoutEffect as U3,useMemo as j3,useRef as q3}from"react";import{useId as G3}from"@vuu-ui/vuu-utils";import pb,{useCallback as D3,useMemo as A3}from"react";var wh=t=>t.type===ru||!!t.props["data-group"],R3=t=>{if(Array.isArray(t)&&Sh(t[0]))return t[0]},O3=(t,e,n,r=!1)=>{let{props:{children:o}}=t;return{childWithId:pb.cloneElement(t,{hasSeparator:r,id:`${e}`,key:e,children:n?R3(o):o}),grandChildren:n?o:void 0}},mb=(t,e)=>{let n=D3(()=>{let i=(s,l=e,a={},u={})=>{let c=a[l]=[],f=0,d=!1;return pb.Children.forEach(s,h=>{if(!Sh(h))if(h.type===gb)d=!0;else{let g=wh(h),v=`${l}-${f}`,{props:{action:p,options:m}}=h,{childWithId:y,grandChildren:x}=O3(h,v,g,d);c.push(y),x?i(x,v,a,u):u[v]={action:p,options:m},f+=1,d=!1}}),[a,u]};return i(t)},[e,t]),[r,o]=A3(()=>n(),[n]);return[r,o]};import{useCallback as ou,useMemo as _3,useRef as Ch,useState as W3}from"react";var vb=t=>t.closest("[data-root='true']")!==null,yb=(t,e)=>{var n;return t.ariaHasPopup==="true"&&((n=t.dataset)==null?void 0:n.idx)===`${e}`||t.querySelector(`:scope > [data-index='${e}'][aria-haspopup='true']`)!==null};function H3(t,...e){let n=new Set(t);for(let r of e)for(let o of r)n.add(o);return n}var N3="Enter";var F3="Delete",B3=new Set([N3,F3]),V3=new Set(["Tab"]),z3=new Set(["ArrowRight","ArrowLeft"]),bb=new Set(["Home","End","ArrowDown","ArrowUp"]),xb=new Set(["Home","End","ArrowRight","ArrowLeft"]),$3=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),OH=H3(B3,xb,bb,z3,$3,V3);var wb=({key:t},e="vertical")=>(e==="vertical"?bb:xb).has(t);import{isValidNumber as kh}from"@vuu-ui/vuu-utils";var Sb=({autoHighlightFirstItem:t=!1,count:e,defaultHighlightedIdx:n,highlightedIndex:r,onActivate:o,onHighlight:i,onCloseMenu:s,onOpenMenu:l})=>{var b;if(kh(r)&&kh(n))throw Error("useKeyboardNavigation do not pass values for both highlightedIndex and defaultHighlightedIdx");let a=kh(r),u=Ch((b=n!=null?n:r)!=null?b:t?0:-1),[,c]=W3(null),f=ou(C=>{u.current=C,i==null||i(C),c({})},[i]),d=ou(C=>{C!==u.current&&(a||f(C))},[a,f]),h=Ch(!0),g=Ch(!1),v=C=>g.current=C,p=a?r:u.current,m=ou(C=>{let w=K3(e,C.key,u.current);w!==u.current&&d(w)},[e,d]),y=ou(C=>{if(wb(C))C.preventDefault(),C.stopPropagation(),h.current=!0,m(C);else if((C.key==="ArrowRight"||C.key==="Enter")&&yb(C.target,p)){let S=C.target.querySelector(`:scope > [data-index='${p}']`);S&&(l==null||l(S,!0))}else C.key==="ArrowLeft"&&!vb(C.target)?s(p):C.key==="Enter"?(C.preventDefault(),C.stopPropagation(),o&&o(p)):C.key==="Tab"&&s(-1)},[p,m,o,s,l]),x=_3(()=>({onFocus:()=>{p===-1&&f(0)},onKeyDown:y,onMouseDownCapture:()=>{h.current=!1,v(!0)},onMouseMove:()=>{h.current&&(h.current=!1)},onMouseLeave:()=>{h.current=!0,v(!1),d(-1)}}),[y,p,f,d]);return{focusVisible:h.current?p:-1,controlledHighlighting:a,highlightedIndex:p,setHighlightedIndex:d,listProps:x,setIgnoreFocus:v}};function K3(t,e,n){return e==="ArrowUp"?n>0?n-1:n:n===null?0:n===t-1?n:n+1}import{Fragment as Q3,jsx as di}from"react/jsx-runtime";var Cb="vuuMenuList",gb=()=>di("li",{className:"vuuMenuItem-divider"}),ru=()=>null,iu=({children:t,idx:e,options:n,...r})=>di("div",{...r,children:t}),Eb=({children:t})=>di(Q3,{children:t});Eb.displayName="MenuItemLabel";iu.Label=Eb;var J3=t=>kb.isValidElement(t)&&typeof t.type!="string"&&"displayName"in t.type?t.type.displayName:void 0,Sh=t=>J3(t)==="MenuItemLabel",Z3=t=>t.props["data-icon"],Eh=({activatedByKeyboard:t,childMenuShowing:e,children:n,className:r,defaultHighlightedIdx:o,highlightedIdx:i,id:s,isRoot:l,listItemProps:a,onHighlightMenuItem:u,onActivate:c,onCloseMenu:f,openMenu:d,...h})=>{let g=G3(s),v=q3(null),p=j3(()=>new Map,[]),m=E=>{var T;let k=(T=v.current)==null?void 0:T.querySelector(`:scope > [data-index='${E}']`);k!=null&&k.id&&(c==null||c(k.id))},{focusVisible:y,highlightedIndex:x,listProps:b}=Sb({count:kb.Children.count(n),defaultHighlightedIdx:o,highlightedIndex:i,onActivate:m,onHighlight:u,onOpenMenu:d,onCloseMenu:f}),C=e==null?y:-1;U3(()=>{var E;e===void 0&&t&&((E=v.current)==null||E.focus())},[t,e]);let w=()=>x===void 0||x===-1?void 0:p.get(x);function S(){let E={...a,role:"menuitem"},k=(M,I,R)=>I?[di("span",{className:"vuuIconContainer","data-icon":R},"icon")].concat(M):M;function T(M,I,R,A){var j;let{children:L,className:H,"data-icon":O,id:B,hasSeparator:P,label:F,...N}=I.props,z=wh(I),q=z&&e===B,Z=q?`${g}-${B}`:void 0;M.push(di(iu,{...N,...E,...Y3(B,R,(j=I.key)!=null?j:B,x,C,H,P),"aria-controls":Z,"aria-haspopup":z||void 0,"aria-expanded":q||void 0,children:k(z&&F!=null?F:L,A,O)}))}let D=[];if(n.length>0){let M=n.some(Z3);n.forEach((I,R)=>{T(D,I,R,M)})}return D}return di("div",{...h,...b,"aria-activedescendant":w(),className:W(Cb,r,{[`${Cb}-childMenuShowing`]:e!==void 0}),"data-root":l||void 0,id:g,ref:v,role:"menu",children:S()})},Y3=(t,e,n,r,o,i,s)=>({id:`menuitem-${t}`,key:n!=null?n:e,"data-index":e,"data-highlighted":e===r||void 0,className:W("vuuMenuItem",i,{"vuuMenuItem-separator":s,focusVisible:o===e})});Eh.displayName="MenuList";import{useCallback as un,useMemo as X3,useRef as su,useState as eT}from"react";var Mh=t=>t==null?void 0:t.closest("[data-index],[aria-posinset]");var Tb=(t,e,n)=>t.map((r,o)=>o===t.length-1?{...r,[n]:r[n]-e}:r),tT=(t,e)=>Tb(t,e,"left"),nT=(t,e)=>Tb(t,e,"top"),rT=(t,e)=>{let[n,r]=e.slice(-2),o=document.getElementById(`${t}-${r.id}`);if(o===null)throw Error(`useCascade.flipSides element with id ${r.id} not found`);let{width:i}=o.getBoundingClientRect();return e.map(s=>s===r?{...s,left:n.left-(i-2)}:s)},oT=(t,e)=>{let[{left:n,top:r}]=e.slice(-1),{offsetWidth:o,offsetTop:i}=t;return{left:n+o,top:i+r}},Ib=(t,e)=>{let n=t.lastIndexOf("-");return t.startsWith("menuitem")?n>-1?t.slice(9,n):e:n>-1?t.slice(0,n):e},iT=t=>t.slice(9),Mb=({ariaExpanded:t,ariaHasPopup:e,id:n},r)=>{if(n.startsWith("menuitem"))return{hostMenuId:Ib(n,r),targetMenuId:iT(n),menuItemId:n,isGroup:e==="true",isOpen:t==="true"};throw Error(`getMenuItemDetails #${n} is not a menuitem`)},Lb=({id:t,onActivate:e,onMouseEnterItem:n,position:{x:r,y:o}})=>{let[,i]=eT({}),s=su([{id:t,left:r,top:o}]),l=un(w=>s.current.findIndex(S=>S.id===w)!==-1,[]),a=un(w=>{let S=d.current[w];if(S===void 0)throw Error(`getOpenMenuState no entry for menu ${w}`);return S},[]),u=un(w=>{s.current=w,i({})},[]),c=su(),f=su(),d=su({[t]:"no-popup"}),h=un((w=t,S,E=null)=>{if(w===t&&E===null)u([{id:t,left:r,top:o}]);else{d.current[w]="popup-open";let k=document.getElementById(E);if(k!==null){let{left:T,top:D}=oT(k,s.current);u(s.current.concat({id:S,left:T,top:D}))}else throw Error(`openMenu no menuItem ${E}`)}},[t,r,o,u]),g=un(w=>{if(w===t)u([]);else{let S=s.current.slice(),E=S.pop();d.current[E.id]="no-popup";let k=S.at(-1);k&&(d.current[k.id]="no-popup"),u(S)}},[t,u]),v=un(w=>{let S=s.current.slice(),E=w.slice(9),{id:k}=S.at(-1);for(;S.length>1&&!E.startsWith(k);){let T=Ib(k,t);S.pop(),d.current[k]="no-popup",d.current[T]="no-popup",{id:k}=S[S.length-1]}S.length<s.current.length&&u(S)},[t,u]),p=un(()=>{c.current&&(clearTimeout(c.current),c.current=void 0)},[]),m=un((w,S,E,k=300)=>{p(),c.current=window.setTimeout(()=>{v(E),d.current[w]="popup-open",d.current[S]="no-popup",h(w,S,E)},k)},[p,v,h]),y=un((w,S,E)=>{d.current[S]="pending-close",f.current=window.setTimeout(()=>{v(E)},400)},[v]),x=un(()=>{let{current:w}=s,S=w.at(-1),E=S?document.getElementById(S.id):void 0;if(E){let{right:k,bottom:T}=E.getBoundingClientRect(),{clientHeight:D,clientWidth:M}=document.body;if(k>M){let I=w.length>1?rT(t,w):tT(w,k-M);u(I)}else if(T>D){let I=nT(w,T-D);u(I)}typeof E.tabIndex=="number"&&E.focus()}},[t,u]),b=un((w,S=!1)=>{let{hostMenuId:E,targetMenuId:k,menuItemId:T,isGroup:D,isOpen:M}=Mb(w,t),{current:{[E]:I}}=d,R=S?0:void 0;if(I==="no-popup"&&D)d.current[E]="popup-pending",m(E,k,T,R);else if(I==="popup-pending"&&!D)d.current[E]="no-popup",clearTimeout(c.current),c.current=void 0;else if(I==="popup-pending"&&D)clearTimeout(c.current),m(E,k,T,R);else if(I==="popup-open")if(l(k)){let A=a(k);switch(v(T),A){case"pending-close":clearTimeout(f.current),f.current=void 0,d.current[k]="no-popup",p();break;default:}}else{let[A,L]=s.current.slice(-2);A.id===E&&d.current[L.id]!=="pending-close"?(y(E,L.id,T),D&&!M&&m(E,k,T,R)):A.id===E&&D&&T!==L.id&&d.current[L.id]==="pending-close"||D?m(E,k,T,R):d.current[L.id]!=="pending-close"&&v(T)}I==="pending-close"&&(p(),clearTimeout(f.current),f.current=void 0,d.current[E]="popup-open")},[p,v,a,l,t,y,m]),C=X3(()=>({onMouseEnter:w=>{let S=Mh(w.target);b(S),n(w,S.id)},onClick:w=>{let S=Mh(w.target),{isGroup:E,menuItemId:k}=Mb(S,t);E?b(S):e(k)}}),[e,n,t,b]);return{closeMenu:g,handleRender:x,listItemProps:C,openMenu:b,openMenus:s.current}};import{Fragment as aT,jsx as Ab}from"react/jsx-runtime";import{createElement as Db}from"react";var lT=()=>{},Ih=({PortalProps:t,activatedByKeyboard:e,children:n,className:r,id:o,onClose:i=()=>{},position:s={x:0,y:0},style:l,...a})=>{let u=Th(i);u.current=i;let c=sT(o),f=Th(lT),[d,h]=mb(n,c),g=Th(e),v=Pb(()=>{g.current=!1},[]),p=Pb(T=>{let D=T.slice(9),{action:M,options:I}=h[D];f.current(c),i({type:"menu-action",menuId:M,options:I})},[h,c,i]),{closeMenu:m,listItemProps:y,openMenu:x,openMenus:b,handleRender:C}=Lb({id:`${c}`,onActivate:p,onMouseEnterItem:v,position:s});f.current=m;let w=()=>{g.current=!0,m()},S=()=>{},E=b.length-1,k=T=>{if(!(T>=E)){let{id:D}=b[T+1];return D}};return Ab(aT,{children:b.map(({id:T,left:D,top:M},I,R)=>{let A=k(I);return Db(wr,{...t,key:I,onRender:C},Ab(ci,{anchorElement:{current:document.body},placement:"absolute",position:{left:D,top:M},children:Db(Eh,{...a,activatedByKeyboard:g.current,childMenuShowing:A,className:r,id:T,isRoot:I===0,key:I,listItemProps:y,onActivate:p,onHighlightMenuItem:S,onCloseMenu:w,openMenu:x,style:l,tabIndex:I===R.length-1?0:void 0},d[T])}))})})};Ih.displayName="ContextMenu";import{createContext as uT,useCallback as kN,useMemo as EN}from"react";import{jsx as TN}from"react/jsx-runtime";var Rb=uT(null);import{isGroupMenuItemDescriptor as cT,useThemeAttributes as dT}from"@vuu-ui/vuu-utils";import{cloneElement as fT,useCallback as Lh,useContext as hT,useMemo as pT}from"react";import{jsx as Ph}from"react/jsx-runtime";var Ob=(t,e)=>{let n=hT(Rb),[r,o,i]=dT(),s=pT(()=>({themeClass:r,densityClass:o,dataMode:i}),[i,o,r]),l=Lh((c,f,d)=>{let h=[];for(let g of c)h=h.concat(g(f,d));return h},[]),a=Lh((c,f,{ContextMenuProps:d,contextMenu:h,...g})=>{var p,m;if((p=c.stopPropagation)==null||p.call(c),(m=c.preventDefault)==null||m.call(c),h)return gT({x:c.clientX,y:c.clientY},h);let v=[];if(t&&v.push(t),n&&Array.isArray(n==null?void 0:n.menuBuilders)&&n.menuBuilders.length>0&&v.push(...n.menuBuilders),v.length>0){let y=l(v,f,g),x=b=>(e==null?void 0:e(b))===!0?!0:n==null?void 0:n.menuActionHandler(b);y.length&&x&&vT(c,y,x,{PortalProps:{themeAttributes:s},...d})}else console.warn("useContextMenu, no menuBuilders configured. These should be supplied via the ContextMenuProvider(s)")},[l,n,e,t,s]),u=Lh(()=>{console.log("hide context menu")},[]);return[a,u]},mT={},gT=(t,e)=>{no.showPopup({focus:!0,left:0,top:0,component:fT(e,{position:t})})},vT=(t,e,n,{position:r,...o}=mT)=>{let i=u=>{let c=(f,d)=>cT(f)?Ph(ru,{label:f.label,children:f.children.map(c)},d):Ph(iu,{action:f.action,className:f.className,"data-icon":f.icon,options:f.options,children:f.label},d);return u.map(c)},s=u=>{var c;ob(u)&&(n(u),no.hidePopup()),(c=o==null?void 0:o.onClose)==null||c.call(o,u)},l=r!=null?r:{x:t.clientX,y:t.clientY},a=Ph(Ih,{...o,onClose:s,position:l,children:i(e)});no.showPopup({left:0,top:0,component:a,focus:!0})};import{useId as yT}from"@vuu-ui/vuu-utils";import{useCallback as Dh,useRef as Hb,useState as bT}from"react";import{jsx as wT}from"react/jsx-runtime";var Ah="vuuPopupMenu",xT=t=>{if(t){let{bottom:e,left:n}=t.getBoundingClientRect();return{x:n,y:e+6}}},lu=({className:t,label:e,icon:n=e?"chevron-down":"more-vert",id:r,menuActionHandler:o,menuBuilder:i,menuLocation:s="header",menuOptions:l,onMenuClose:a,tabIndex:u=0,...c})=>{let f=Hb(null),d=Hb(!1),[h,g]=bT(!1),v=yT(r),[p]=Ob(i,o),m=Dh(b=>{console.log("menu Open ",{el:b})},[]),y=Dh(b=>{g(!1),ib(b)?b.mouseEvt.target===f.current&&(d.current=!0):requestAnimationFrame(()=>{var C;a==null||a(b),u!==-1&&((C=f.current)==null||C.focus())})},[a,u]),x=Dh(b=>{d.current?d.current=!1:(g(!0),p(b,s,{ContextMenuProps:{id:`${v}-menu`,onClose:y,openMenu:m,position:xT(f.current)},...l}))},[y,m,v,s,l,p]);return wT(Kn,{...c,"aria-controls":`${v}-menu-root`,"aria-expanded":h,"aria-haspopup":"menu",className:W(Ah,t,{[`${Ah}-withCaption`]:e!==void 0,[`${Ah}-open`]:h}),"data-icon":n,id:v,onClick:x,ref:f,tabIndex:u,variant:"secondary",children:e})};import{useLayoutEffect as ST,useState as CT}from"react";var kT=(t,e,n,r)=>{let{bottom:o,height:i,left:s,right:l,top:a,width:u}=t.getBoundingClientRect(),c=s+u/2,f=a+i/2;switch(e){case"above":return{left:c+n,top:a+r};case"below":return{left:c+n,top:o+r};case"right":return{left:l+n,top:f+n};case"left":return{left:s+n,top:f+n};default:throw Error("Tooltip getPositionRelativeToAnchor only supported placement values are left, right, below and right")}},Nb=({anchorElement:t,offsetLeft:e=0,offsetTop:n=0,placement:r})=>{let[o,i]=CT();return ST(()=>{if(t.current){let s=kT(t.current,r,e,n);i(s)}},[t,e,n,r]),o};import{jsx as Oh}from"react/jsx-runtime";var Rh="vuuTooltip",Fb=({anchorElement:t,children:e,id:n,onMouseEnter:r,onMouseLeave:o,placement:i,status:s,style:l})=>{let a=Nb({anchorElement:t,placement:i});return a===void 0?null:Oh(wr,{children:Oh("div",{className:W(Rh,{[`${Rh}-error`]:s==="error"}),"data-align":i,id:n,style:{...l,...a},children:Oh("span",{className:`${Rh}-content`,onMouseEnter:r,onMouseLeave:o,children:e})})})};import{useId as ET}from"@vuu-ui/vuu-utils";import{useCallback as ro,useRef as au,useState as MT}from"react";var Bb=({id:t,placement:e="right",tooltipContent:n})=>{let r=au(),o=au(null),i=au(),s=au(),[l,a]=MT(),u=ET(t),c=ro(m=>{var y;m.key==="Escape"&&((y=r.current)==null||y.call(r))},[]);r.current=ro(()=>{a(void 0),document.removeEventListener("keydown",c)},[c]);let f=ro(()=>{window.clearTimeout(s.current)},[]),d=ro(()=>{var m;(m=r.current)==null||m.call(r)},[]),h=ro(()=>{let{current:m}=o;m&&(a({anchorElement:o,children:n,id:`${u}-tooltip`,onMouseEnter:f,onMouseLeave:d,placement:e}),document.addEventListener("keydown",c)),i.current=void 0},[c,f,d,u,e,n]),g=ro(m=>{let y=m.target;y&&(o.current=y,i.current=window.setTimeout(h,800))},[h]),v=ro(()=>{o.current&&(i.current?(window.clearTimeout(i.current),i.current=void 0):r.current&&(s.current=window.setTimeout(r.current,200)))},[]);return{anchorProps:{"aria-describedby":`${u}-tooltip`,onMouseEnter:g,onMouseLeave:v},tooltipProps:l}};import{useMemo as JP,useState as ZP}from"react";import{useCallback as js,useState as LT}from"react";import{useCallback as F7,useContext as Vb,useEffect as B7,useRef as V7,useState as z7}from"react";import{uuid as C7}from"@vuu-ui/vuu-utils";import E7,{cloneElement as M7}from"react";import{useCallback as fi}from"react";var Zt=new Map,Yt=new Map;var hi=()=>{let t=fi((s,l)=>{let a=Yt.get(s);if(a)return l!==void 0&&a[l]!==void 0?a[l]:l!==void 0?void 0:a},[]),e=fi((s,l,a)=>{if(l===void 0)Yt.set(s,a);else if(Yt.has(s)){let u=Yt.get(s);Yt.set(s,{...u,[l]:a})}else Yt.set(s,{[l]:a})},[]),n=fi((s,l)=>{if(Yt.has(s)){if(l===void 0)Yt.delete(s);else if(Yt.get(s)[l]){let{[l]:u,...c}=Yt.get(s);Object.keys(c).length>0?Yt.set(s,c):Yt.delete(s)}}},[]),r=fi((s,l)=>{let a=Zt.get(s);if(a)return l!==void 0?a[l]:a},[]),o=fi((s,l,a)=>{if(l===void 0)Zt.set(s,a);else if(Zt.has(s)){let u=Zt.get(s);Zt.set(s,{...u,[l]:a})}else Zt.set(s,{[l]:a})},[]),i=fi((s,l)=>{if(Zt.has(s)){if(l===void 0)Zt.delete(s);else if(Zt.get(s)[l]){let{[l]:u,...c}=Zt.get(s);Object.keys(c).length>0?Zt.set(s,c):Zt.delete(s)}}},[]);return{loadSessionState:t,loadState:r,saveSessionState:e,saveState:o,purgeState:i,purgeSessionState:n}};var uu=(t,e,n=[])=>{var o,i,s;let r=(s=(o=t.props)==null?void 0:o.title)!=null?s:(i=t.props)==null?void 0:i["data-tab-title"];if(r)return r;{let l=e;do r=`Tab ${++l}`;while(n.includes(r));return r}};import{createContext as TT}from"react";var IT=t=>console.log(`dispatch ${t.type}, have you forgotten to provide a LayoutProvider ?`),Hh=TT({dispatchLayoutProvider:IT,version:-1});import{jsx as K7}from"react/jsx-runtime";var pi=()=>{let{dispatchLayoutProvider:t}=Vb(Hh);return t},zb=()=>{let{createNewChild:t}=Vb(Hh);return t};var cu=(t,e,n,r)=>{var p;let{loadSessionState:o,purgeSessionState:i,purgeState:s,saveSessionState:l}=hi(),[a,u]=LT((p=o(t,"contributions"))!=null?p:[]),c=pi(),f=js((m,y)=>{let x=a.concat([{location:m,content:y}]);l(t,"contributions",x),u(x)},[a,t,l]),d=js(()=>{i(t,"contributions"),u([])},[t,i]),h=js(()=>{let m=o(t,"data-source");m&&m.unsubscribe(),i(t),s(t),c({type:"remove",path:n})},[c,t,o,i,s,n]),g=js(async(m,y,x)=>{var C;m.stopPropagation();let b=(C=e.current)==null?void 0:C.getBoundingClientRect();return new Promise((w,S)=>{c({type:"drag-start",evt:m,path:y===void 0?n:`${n}.${y}`,dragRect:b,preDragActivity:x,dropTargets:r,resolveDragStart:w,rejectDragStart:S})})},[e,c,n,r]);return[js(async(m,y)=>{var b;let{type:x}=m;switch(x){case"maximize":case"minimize":case"restore":return c({type:x,path:(b=m.path)!=null?b:n});case"remove":return h();case"mousedown":return g(y,m.index,m.preDragActivity);case"add-toolbar-contribution":return f(m.location,m.content);case"remove-toolbar-contribution":return d();case"query":return c({type:x,path:m.path,query:m.query});default:return}},[c,n,h,g,f,d]),a]};import{useId as _P}from"@vuu-ui/vuu-utils";import yp,{forwardRef as WP,useCallback as KP,useMemo as UP,useRef as gw,useState as jP}from"react";import{useId as iI}from"@vuu-ui/vuu-utils";import{Children as sI,cloneElement as v1,forwardRef as lI,useRef as aI}from"react";var PT=/[.*+?^${}()|[\]\\]/g;function du(t){return t.replace(PT,"\\$&")}var $b=(t,e)=>Object.keys(t).reduce((r,o)=>{let i=t[o],s=e[o];return typeof i=="function"&&typeof s=="function"&&(r[o]=(...l)=>{i(...l),s(...l)}),r},{...e});import{useCallback as so,useRef as m1,useState as rI}from"react";import{cloneElement as DT,createContext as AT,useContext as RT}from"react";import{jsx as OT}from"react/jsx-runtime";var _b=AT(void 0);function Wb({children:t,collectionHook:e,...n}){return OT(_b.Provider,{value:e,children:Object.keys(n).length>0?DT(t,n):t})}function Kb(){let t=RT(_b);if(t)return t}var Ub=t=>Object.prototype.toString.call(t)==="[object Object]";function Cn(t){return typeof t=="string"?t:Ub(t)?Object.prototype.hasOwnProperty.call(t,"label")?String(t.label):(console.warn(["itemToString: you've likely forgotten to set the label prop on the item object.","You can also provide your own `itemToString` implementation."].join(`
|
|
408
|
-
`)),""):String(t)}import{useCallback as kt,useMemo as hu,useRef as pu,useState as JT,isValidElement as i1}from"react";import{isValidElement as Nh,Children as HT}from"react";var jb=t=>null;var qb=t=>null;var Fh=(t,e)=>t!==null&&Object.prototype.hasOwnProperty.call(t,e),Bh=t=>Fh(t,"header"),Gb=t=>Fh(t,"childNodes"),qs=(t,e)=>t&&Object.prototype.hasOwnProperty.call(t.props,e),Jb=t=>{if(Nh(t)){if(qs(t,"disabled"))return t.props.disabled===!0}else if(Fh(t,"disabled"))return t.disabled===!0;return!1},Zb=t=>Nh(t)&&qs(t,"focusable")?t.props.focusable:!0,Yb=(t,e,n)=>{if(t.childNodes)return t.childNodes.length;if(t.header){let r=n+1,o=0;for(;r<e.length&&!e[r].header;)o++,r++;return o}else return 0},NT=t=>{if(typeof t.props.children=="string")return t.props.children;if(t.props.title)return t.props.title;if(t.props.label)return t.props.label},Qb=t=>t.type===qb||qs(t,"data-header"),Xb=t=>t.type===jb||qs(t,"data-group"),FT=t=>qs(t,"selectable")?t.props.selectable===!0:!Xb(t)&&!Qb(t),BT=t=>{if(Xb(t)){let{props:{children:e}}=t;if(typeof e!="string")return zh(e)}},VT=(t,e)=>{let n=[];return HT.forEach(t,r=>{Nh(r)&&n.push(e(r))}),n},Vh=(t,e)=>{if(Array.isArray(t))return t.length===0&&(e!=null&&e.noChildrenLabel)?[{label:e.noChildrenLabel,value:null}]:t.map(n=>{var r,o;return{childNodes:Vh(n.childNodes,e),description:n.description,expanded:n.expanded,value:n,label:(o=(r=e==null?void 0:e.itemToString)==null?void 0:r.call(e,n))!=null?o:Cn(n)}});if(t)throw Error("list-child-items expects source to be an array")},zh=t=>{if(t)return VT(t,e=>{let{"data-id":n,disabled:r,id:o=n,"data-expanded":i,expanded:s=i}=e.props;return{childNodes:BT(e),disabled:r,expanded:s,header:Qb(e),id:o,label:NT(e),selectable:FT(e),value:e}})},zT=new Set(["/","-","."]),$T=t=>zT.has(t),$h=(t,e)=>e.startsWith(t)&&$T(e[t.length]),_T=new Set([".","/"]);function WT(t,e){return e.startsWith(t)?_T.has(e.charAt(t.length)):!1}function fu(t,e,n){let r;return t.map(i=>i.id===e?{...i,...n}:WT(i.id,e)&&i.childNodes?(r=fu(i.childNodes,e,n),{...i,childNodes:r}):i)}var KT=t=>t&&t.replace(/^\s+/g,""),_h=t=>new RegExp(`(${du(KT(t))})`,"gi"),e1=(t="",e=_h)=>(n="")=>!!n.length&&!!t.length&&n.match(e(t))!==null;function t1(t,e){return Array.isArray(t)?t.includes(e.id):t===e.id}import{isValidElement as UT,useCallback as jT,useEffect as n1,useRef as r1,useState as qT}from"react";function o1({controlled:t,default:e,name:n,state:r="value"}){let{current:o}=r1(t!==void 0),[i,s]=qT(e),l=t!==void 0?t:i,{current:a}=r1(e);n1(()=>{},[r,n,t]),n1(()=>{},[JSON.stringify(e,GT)]);let u=jT(c=>{o||s(c)},[o]);return[l,u,o]}function GT(t,e){return UT(e)?null:e}var ZT={},mu=({children:t,id:e,options:n=ZT,source:r})=>{var O,B;let{getItemId:o}=n,[,i]=JT(null),s=Kb(),l=pu([]),a=pu([]),u=hu(()=>[],[]),c=pu((O=n.filterPattern)!=null?O:""),f=(B=n.disableFilter)!=null?B:!1,{getFilterRegex:d=_h,noChildrenLabel:h,itemToString:g=Cn}=n,v=kt(()=>n.defaultExpanded||!1,[n.defaultExpanded]),p=kt((P,F,N=1,z="",q=[],Z=[],j=[])=>(P.forEach((U,ue,se)=>{var Ke,Ue;let Me=U.header&&n.collapsibleHeaders,Te=U.childNodes&&n.collapsibleHeaders===!1,Ce=!U.childNodes||U.childNodes.length===0,pe=Te||Ce&&!Me,Be=z?`${z}.${ue}`:`item-${ue}`,We=(Ke=U.id)!=null?Ke:o?o(ue):`${e}-${Be}`,Ie=pe?void 0:(Ue=U.expanded)!=null?Ue:v(),ge={...U,childNodes:void 0,count:!Te&&Ie===void 0?0:Yb(U,se,ue),description:U.description,disabled:Jb(U.value),focusable:Zb(U.value)?void 0:!1,id:We,index:F.value,expanded:Ie,level:N};if(q.push(ge),Z.push(ge),j.push(P[ue].value),F.value+=1,U.childNodes){let[et]=p(U.childNodes,F,N+1,Be,[],Z,j);ge.childNodes=et}}),[q,j,Z]),[n.collapsibleHeaders,o,e,v]),m=kt(()=>c.current&&!f?e1(c.current,d):null,[f,d]),y=kt((P,F=m(),N=[],z={value:0})=>{let q=!1;for(let Z of P)q&&!Bh(Z)||(Z.value!==null&&(F===null||F(g(Z.value)))&&(N[z.value]=Z,z.value+=1),q=!1,Bh(Z)&&Z.expanded===!1?q=!0:Gb(Z)&&Z.expanded!==!1&&Z.childNodes&&y(Z.childNodes,F,N,z));return N},[m,g]),x=hu(()=>s?u:Vh(r,{itemToString:g,noChildrenLabel:h})||zh(t)||[],[s,u,r,g,h,t]),[b,C,w]=hu(()=>s?[u,u,u]:p(x,{value:0}),[u,p,s,x]);a.current=w,hu(()=>s?u:l.current=y(b),[u,y,b,s]);let S=pu(b),E=kt((P="")=>{typeof P=="string"&&(c.current=P,l.current=y(b),i({}))},[b,y]),k=kt((P,F=b)=>{let N=F.find(z=>{var q;return z.id===P||((q=z==null?void 0:z.childNodes)==null?void 0:q.length)&&$h(z.id,P)});if((N==null?void 0:N.id)===P)return C==null?void 0:C[N.index];if(N)return k(P,N.childNodes);throw Error(`useCollectionData itemById, id ${P} not found `)},[C,b]),T=kt((P,F=b)=>{let N=F.find(q=>{var Z;return q.id===P||((Z=q==null?void 0:q.childNodes)==null?void 0:Z.length)&&$h(q.id,P)}),z=N?l.current.indexOf(N):-1;if(z!==-1)return z;throw Error(`useCollectionData indexOfItemById, id ${P} not found `)},[b]),D=kt(P=>{let F=a.current.find(N=>i1(N.value)?N.label===P:N.value===P);if(F)return F;throw Error("useCollectionData toCollectionItem, item not found ")},[]),M=kt(P=>{if(P===null)return null;if(Array.isArray(P)){let F=[];for(let N of P){let z=D(N);F.push(z)}return F}else if(P!==void 0)return D(P)},[D]),I=kt(P=>{if(P===void 0)return;let F=M(P);return Array.isArray(F)?F.map(N=>N.id):F?[F.id]:[]},[M]),R=kt(P=>{let F=N=>{let z=a.current.find(q=>i1(q.value)?q.label===N:q.value!==null&&g(q.value)===N);if(z)return z};if(P===null)return null;if(Array.isArray(P)){let N=[];for(let z of P){let q=F(z);q&&N.push(q)}return N}else if(P!==void 0)return F(P)},[g]),A=kt(P=>{for(let F of S.current)if(P===F.value)return F.id;throw Error("useCollectionData itemToId, item not found")},[]),L=kt(P=>{S.current=fu(S.current,P.id,{expanded:!1}),l.current=y(S.current),i({})},[y]),H=kt(P=>{S.current=fu(S.current,P.id,{expanded:!0}),l.current=y(S.current),i({})},[y]);return s||{collapseGroupItem:L,data:l.current,expandGroupItem:H,setFilterPattern:E,indexOfItemById:T,itemById:k,itemToId:A,toCollectionItem:D,itemToCollectionItem:M,itemToCollectionItemId:I,stringToCollectionItem:R}};import{useCallback as YT,useEffect as QT,useLayoutEffect as XT,useRef as eI}from"react";var l1=["width"],a1=["height"],oo=new Map,u1=(t,e,n)=>{switch(n){case"height":return e.height;case"clientHeight":return t.clientHeight;case"clientWidth":return t.clientWidth;case"contentHeight":return e.contentHeight;case"contentWidth":return e.contentWidth;case"scrollHeight":return Math.ceil(t.scrollHeight);case"scrollWidth":return Math.ceil(t.scrollWidth);case"width":return e.width;default:return 0}},s1=new ResizeObserver(t=>{for(let e of t){let{target:n,borderBoxSize:r,contentBoxSize:o}=e,i=oo.get(n);if(i){let[{blockSize:s,inlineSize:l}]=r,[{blockSize:a,inlineSize:u}]=o,{onResize:c,measurements:f}=i,d=!1;for(let[h,g]of Object.entries(f)){let v=u1(n,{height:s,width:l,contentHeight:a,contentWidth:u},h);v!==g&&(d=!0,f[h]=v)}d&&c&&c(f)}}});function io(t,e,n,r=!1){let o=eI(e),i=t.current,s=YT(l=>{let{width:a,height:u}=l.getBoundingClientRect(),{clientWidth:c,clientHeight:f}=l;return o.current.reduce((d,h)=>(d[h]=u1(l,{width:a,height:u,contentHeight:f,contentWidth:c},h),d),{})},[]);XT(()=>{async function l(){oo.set(i,{measurements:{}}),await document.fonts.ready;let a=oo.get(i);if(a){let u=s(i);a.measurements=u,s1.observe(i),r&&n(u)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}return i&&(oo.has(i)&&console.log("useResizeObserver attemping to observe same element twice",{target:i}),l()),()=>{i&&oo.has(i)&&(s1.unobserve(i),oo.delete(i))}},[s,i]),QT(()=>{let l=t.current,a=oo.get(l);if(a){if(o.current!==e){o.current=e;let u=s(l);a.measurements=u}a.onResize=n}},[e,s,t,n])}var c1=t=>t===void 0||t==="default"||t==="deselectable",gu=t=>t==="multiple"||(t==null?void 0:t.startsWith("extended"))===!0,d1=t=>t==="none";var Un=t=>t!==void 0&&t.length>0,f1=t=>t[0];import{useEffect as h1,useRef as tI}from"react";var nI=[],p1=({popperRef:t,rootRef:e,isOpen:n,onClose:r})=>{let o=tI(n);h1(()=>{o.current=n},[n]),h1(()=>{let[i,s]=n?[l=>{var u,c;let a=l.target;!((u=t.current)!=null&&u.contains(a))&&!((c=e.current)!=null&&c.contains(a))&&r("click-away")},l=>{l.key==="Escape"&&o.current&&(r("Escape"),l.stopPropagation())}]:nI;return i&&s&&(document.body.addEventListener("mousedown",i,!0),document.body.addEventListener("keydown",s,!0)),()=>{i&&s&&(document.body.removeEventListener("mousedown",i,!0),document.body.removeEventListener("keydown",s,!0))}},[n,r,t,e])};var oI=[],g1=({defaultIsOpen:t,disabled:e,fullWidth:n,id:r,isOpen:o,onOpenChange:i,onKeyDown:s,openKeys:l=["Enter","ArrowDown"," "],openOnFocus:a,popupComponent:u,popupWidth:c,rootRef:f,width:d})=>{var L;let h=m1(null),g=m1(null),v=so(H=>{g.current=H},[]),[p,m]=Qe({controlled:o,default:!!t,name:"useDropdown",state:"isOpen"}),[y,x]=rI({width:(L=c!=null?c:d)!=null?L:0}),b=so(()=>{m(!0),i==null||i(!0)},[i,m]),C=so(H=>{m(!1),i==null||i(!1,H)},[i,m]);p1({popperRef:g,rootRef:f,isOpen:p,onClose:C});let w=so(()=>{e||a&&(m(!0),i==null||i(!0),h.current=window.setTimeout(()=>{h.current=null},1e3))},[e,i,a,m]),S=so(H=>{if(["Enter"," "].indexOf(H.key)===-1){let O=!p;m(O),i==null||i(O)}},[p,m,i]),E=so(H=>{H.key==="Escape"&&p?(H.key==="Escape"&&(H.stopPropagation(),H.preventDefault()),C(H.key)):l.includes(H.key)&&!p?(H.preventDefault(),b()):s==null||s(H)},[C,p,s,l,b]),k=so(H=>{var O;p&&((O=g.current)!=null&&O.contains(H.relatedTarget)||C("blur"))},[C,p]),T=n!=null?n:!1;io(f,T?l1:oI,x,T);let M=`${r}-dropdown`,I={"aria-expanded":p,"aria-owns":p?M:void 0,id:`${r}-control`,onClick:e||a?void 0:S,onFocus:w,role:"listbox",onBlur:k,onKeyDown:e?void 0:E,style:{width:T?void 0:d}},R={id:M,width:y.width},A=pt(v,u.ref);return{componentProps:R,popupComponentRef:A,isOpen:p,label:"Dropdown Button",triggerProps:I}};import{jsx as y1,jsxs as uI}from"react/jsx-runtime";var vu="vuuDropdown",b1=lI(function({PopupProps:e,"aria-labelledby":n,children:r,className:o,defaultIsOpen:i,disabled:s,fullWidth:l,id:a,isOpen:u,onKeyDown:c,onOpenChange:f,openKeys:d,openOnFocus:h,placement:g="below-full-width",popupWidth:v,width:p,...m},y){let x=aI(null),b=W(vu,o,{[`${vu}-fullWidth`]:l,[`${vu}-disabled`]:s}),[C,w]=sI.toArray(r),S=iI(a),{componentProps:E,isOpen:k,popupComponentRef:T,triggerProps:D}=g1({ariaLabelledBy:n,defaultIsOpen:i,disabled:s,fullWidth:l,id:S,isOpen:u,onOpenChange:f,onKeyDown:c,openKeys:d,openOnFocus:h,popupComponent:w,popupWidth:v,rootRef:x,width:p}),M=()=>{let{id:A,role:L,...H}=D,{id:O=A,role:B=L,...P}=C.props;return v1(C,$b(P,{...H,id:O,role:B}))},I=()=>{let{id:A,width:L,...H}=E,{className:O,id:B=A,width:P,...F}=w.props;return v1(w,{...F,...H,className:W(O,`${vu}-popup-component`),id:B,ref:T,width:g.endsWith("full-width")?"auto":P!=null?P:L})},R=pt(x,y);return uI("div",{...m,className:b,id:a,ref:R,children:[M(),k&&y1(wr,{children:y1(ci,{...e,anchorElement:x,placement:g,children:I()})})]})});function cI(t,...e){let n=new Set(t);for(let r of e)for(let o of r)n.add(o);return n}var Gs="ArrowUp",Js="ArrowDown",x1="ArrowLeft",w1="ArrowRight",Wh="Enter";var Kh="Home",yu="End",Uh="PageUp",bu="PageDown",S1=" ",dI=new Set(["Enter","Delete"," "]),fI=new Set(["Tab"]),hI=new Set(["ArrowRight","ArrowLeft"]),C1=new Set([Kh,yu,Uh,bu,Js,Gs]),pI=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),mI=cI(dI,C1,hI,pI,fI),xu=t=>mI.has(t.key)?!1:t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,k1=({key:t})=>C1.has(t);import{useCallback as E1}from"react";var gI={},vI=t=>Array.isArray(t.childNodes),yI=t=>!0,bI=t=>t.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",M1=({collapsibleHeaders:t,collectionHook:e,highlightedIdx:n,onToggle:r})=>{let o=E1(l=>{if(l.key===w1||l.key===Wh){let a=e.data[n];a&&a.expanded===!1&&a.value&&(l.preventDefault(),e.expandGroupItem(a),r==null||r(a.value))}if(l.key===x1||l.key===Wh){let a=e.data[n];a&&a.expanded&&a.value&&(l.preventDefault(),e.collapseGroupItem(a),r==null||r(a.value))}},[e.collapseGroupItem,e.data,e.expandGroupItem,n]),s={onClick:E1(l=>{console.log(`useCollapsibleGroups idx=${n}`);let a=e.data[n];console.log(l.target,l.currentTarget),a&&vI(a)&&(!yI(a)||bI(l.target))&&(l.stopPropagation(),l.preventDefault(),a.expanded===!1&&a.value?(e.expandGroupItem(a),r==null||r(a.value)):a.expanded===!0&&a.value&&(e.collapseGroupItem(a),r==null||r(a.value)))},[e.collapseGroupItem,e.data,e.expandGroupItem,n]),onKeyDown:o};return t?s:gI};function xI(t){if(t){let e=t.dataset.index;if(e)return parseInt(e,10);if(e=t.ariaPosInSet)return parseInt(e,10)-1}return-1}var wI=t=>t.closest("[data-index],[aria-posinset]");var T1=t=>xI(wI(t));import{useImperativeHandle as SI,useMemo as CI}from"react";var kI={scrollToIndex:()=>{},scrollToItem:()=>{},scrollTo:()=>{}},I1=({collectionHook:t,forwardedRef:e,scrollableRef:n,scrollIntoView:r})=>{let o=CI(()=>({scrollToIndex:i=>{let s=t.data[i];s&&(r==null||r(s))},scrollToItem:i=>{let s=t.toCollectionItem(i);s&&(r==null||r(s))},scrollTo:i=>{n!=null&&n.current&&(n.current.scrollTop=i)}}),[t,r,n]);SI(e,()=>n.current?o:kI,[o,n])};import{useCallback as mi,useMemo as EI,useRef as jh,useState as MI}from"react";import{getElementByDataIndex as wu,isValidNumber as TI}from"@vuu-ui/vuu-utils";var Gh=-2;function L1(t,e,n){return e===Gs||e===yu?n>0?n-1:n:n===null?0:n===t-1?n:n+1}var qh=t=>{var n;let e=Array.isArray(t)?f1(t):void 0;if(e){let r=document.getElementById(e);if(r){let o=parseInt((n=r.dataset.index)!=null?n:"-1");if(TI(o))return o}}return-1},II=(t,e,n,r)=>t===yu?r:t===Kh?-1:e!==-1?e:n,LI=(t,e,n,r)=>{let{top:o}=e.getBoundingClientRect(),{scrollTop:i,clientHeight:s,scrollHeight:l}=t,a=n-1,u=Math.min(i+s,l-s);if(u!==i&&r<a){t.scrollTo(0,u);let c=r,f;do c+=1,f=wu(t,c,!0).getBoundingClientRect();while(f.top<o&&c<a);return c}},PI=async(t,e,n)=>{let{top:r}=e.getBoundingClientRect(),{scrollTop:o,clientHeight:i}=t,s=Math.max(o-i,0);if(s!==o&&n>0)return t.scrollTo(0,s),new Promise(l=>{requestAnimationFrame(()=>{let a=n,u;do a-=1,u=wu(t,a,!0).getBoundingClientRect();while(u.top>r&&a>0);l(a)})})},DI=t=>t!==void 0,P1=(t,e)=>{let n=wu(t,e);return DI(n)},D1=({containerRef:t,defaultHighlightedIndex:e=-1,disableHighlightOnFocus:n,highlightedIndex:r,itemCount:o,onHighlight:i,onKeyboardNavigation:s,restoreLastFocus:l,selected:a,viewportItemCount:u})=>{let c=jh(-1),[,f]=MI({}),[d,h,g]=Qe({controlled:r,default:e,name:"UseKeyboardNavigation"}),v=mi((k,T=!1)=>{i==null||i(k),h(k),T&&(c.current=k)},[i,h]),p=mi(async(k,T)=>{let D=wu(t.current,T,!0),M;if(D){let{current:I}=t;D&&I&&(M=k===bu?LI(I,D,o,T):await PI(I,D,T))}return M!=null?M:T},[t,o]),m=mi((k=Js,T=k===Js?-1:o)=>{if(o===0)return-1;{let D=k==="End",M=k==="Home",I=D||M||T===-1?-1:qh(a),R=II(k,T,I,o),A=L1(o,k,R),{current:L}=t;if(A===0&&k===Gs&&L&&!P1(L,0))return T;for(;((k===Js||M)&&A<o||(k===Gs||D)&&A>0)&&L&&!P1(L,A);)A=L1(o,k,A);return A}},[t,o,a]),y=jh(!1),x=jh(!1),b=k=>x.current=k,C=mi(()=>{if(x.current)x.current=!1;else if(y.current=!0,o===0)v(Gh);else if(d!==-1)f({});else if(l)if(c.current!==-1)v(c.current);else{let k=qh(a);v(k!==-1?k:0)}else if(Un(a)){let k=qh(a);v(k)}else n!==!0&&v(m())},[n,d,o,m,l,a,v]),w=mi(async k=>{let T=k.key===bu||k.key===Uh?await p(k.key,d):m(k.key,d);T!==d&&v(T,!0),s==null||s(k,T)},[d,m,p,s,v]),S=mi(k=>{o>0&&k1(k)?(k.preventDefault(),k.stopPropagation(),y.current=!0,w(k)):xu(k)&&(y.current=!0)},[o,w]),E=EI(()=>({onBlur:k=>{let T=k.target.closest(".vuuList"),D=k.relatedTarget;T&&!(T!=null&&T.contains(D))&&(y.current=!1,h(-1),l||(c.current=-1))},onFocus:C,onKeyDown:S,onMouseDownCapture:()=>{y.current=!1,b(!0)},onMouseMove:()=>{y.current&&(y.current=!1)},onMouseLeave:()=>{y.current=!1,b(!1),v(-1)}}),[C,S,l,h,v]);return{focusVisible:y.current?d:-1,controlledHighlighting:g,highlightedIndex:d,setHighlightedIndex:v,keyboardNavigation:y,containerProps:E,setIgnoreFocus:b}};import{getElementByDataIndex as Su,getElementDataIndex as AI,isSelectableElement as Jh}from"@vuu-ui/vuu-utils";import{useCallback as jn,useRef as RI}from"react";var OI=["Enter"," "];var A1=({containerRef:t,defaultSelected:e,disableSelection:n=!1,highlightedIndex:r,itemQuery:o,onClick:i,onSelect:s,onSelectionChange:l,selected:a,selectionStrategy:u,selectionKeys:c=OI,tabToSelect:f})=>{let d=u==="deselectable",h=u==="multiple",g=u==="extended",v=RI(-1),p=jn(M=>c.includes(M.key),[c]),[m,y]=o1({controlled:a,default:e!=null?e:[],name:"UseSelection",state:"selected"}),x=jn(M=>m.includes(M),[m]),b=jn(M=>x(M)?[]:[M],[x]),C=jn(M=>{let I=x(M)?m.filter(R=>R!==M):m.concat(M);return I.sort(),I},[x,m]),w=jn((M,I)=>{let R=I?m:[],[A]=m.slice(-1),L=A?AI(document.getElementById(A)):0,H=Math.min(M,L),O=Math.max(M,L),B=t.current,F=Array.from(B.querySelectorAll(o)).slice(H,O+1).map(z=>z.id),N=[...new Set([...R,...F])];return N.sort(),N},[t,o,m]),S=jn((M,I,R,A)=>{let{current:L}=t,{id:H}=Su(L,I,!0),O;h?O=C(H):g?A&&!R?O=C(H):R?O=w(I,A):O=[H]:d?O=b(H):O=[H],O!==m&&y(O),s==null||s(M,H),O!==m&&l&&l(M,O)},[t,h,g,d,m,s,C,w,b,y,l]),E=jn(M=>{let{current:I}=t,R=Su(I,r);Jh(R)&&(p(M)||f&&M.key==="Tab")&&(M.key!=="Tab"&&M.preventDefault(),S(M,r,!1,M.ctrlKey||M.metaKey),g&&(v.current=r))},[r,t,p,f,S,g]),k=jn((M,I)=>{if(g&&M.shiftKey){let{current:R}=t,A=Su(R,I);Jh(A)&&S(M,I,!0)}},[g,t,S]),T=jn(M=>{let{current:I}=t,R=Su(I,r);!n&&Jh(R)&&(M.preventDefault(),M.stopPropagation(),S(M,r,M.shiftKey,M.ctrlKey||M.metaKey),g&&(v.current=r)),i==null||i(M)},[t,r,n,i,S,g]);return{listHandlers:d1(u)?{onClick:i}:{onClick:T,onKeyDown:E,onKeyboardNavigation:k},selected:m,setSelected:y}};import{useCallback as R1,useRef as Zh}from"react";var O1=({disableTypeToSelect:t,highlightedIdx:e,highlightItemAtIndex:n,typeToNavigate:r,items:o,applyIncrementalSearch:i=!0})=>{let s=Zh(null),l=Zh(""),a=Zh(-1),u=R1(f=>{if(f||!i){let d=new RegExp(`^${l.current}`,"i"),h=o.findIndex(({label:g},v)=>v>a.current&&d.test(g));h===-1&&(h=o.findIndex(({label:g},v)=>v<=a.current&&d.test(g))),h!==-1&&n(h)}else l.current="",s.current=null,a.current=-1},[i,n,o]),c=R1(f=>{let d=a.current!==-1;(xu(f)||d&&f.key===S1)&&r&&(f.preventDefault(),f.stopPropagation(),(a.current===-1||f.key===l.current)&&(a.current=e),s.current!==null&&(clearTimeout(s.current),s.current=null),f.key!==l.current&&(l.current+=f.key),i&&u(!0),s.current=window.setTimeout(()=>{u()},100))},[r,i,e,u]);return{onKeyDown:t?void 0:c}};import{useCallback as gi,useRef as H1}from"react";var N1=["height"],HI=["height","scrollHeight"],NI=[],F1={containerOnly:[HI,NI],withContent:[N1,N1]},FI=t=>t?F1.containerOnly:F1.withContent,B1={current:null},BI=(t,e)=>{let{transform:n="none"}=getComputedStyle(t);if(n.startsWith("matrix")){let r=n.lastIndexOf(",");return parseInt(n.slice(r+1))}else{let r=t.offsetParent;if(r===e||e===null)return t.offsetTop;{let o=t.offsetTop;for(;r!==null&&r!==e;)o+=r.offsetTop,r=r.offsetParent;return o}}},V1=({containerRef:t,contentRef:e=B1,highlightedIdx:n=-1,indexPositions:r,stickyHeaders:o=!1})=>{let i=H1(!1),s=H1({height:0,contentHeight:0}),l=gi(v=>{i.current=!0,t.current&&(t.current.scrollTop=v),setTimeout(()=>{i.current=!1})},[]),a=gi(()=>l(0),[l]),u=gi(()=>{l(s.current.contentHeight-s.current.height)},[l]),c=gi(v=>{let p=e.current||t.current;if(v.id){let m=document.getElementById(v.id);if(m&&t.current){let{height:y}=s.current,x=m.ariaExpanded&&m.firstChild?m.firstChild:m,b=o?36:0,C=BI(x,p),w=x.offsetHeight,{scrollTop:S}=t.current,E=S+b,k=E+y-b;if(C+w>k||C<E){let T=C+w>k?S+(C+w)-k:C-b;l(T)}}}},[t,e,l,o]);Ks(()=>{let{height:v,contentHeight:p}=s.current,m=r[n];if(p>v&&m){let[y]=r,[x]=r.slice(-1);m===y?a():m===x?u():c(r[n])}},[n,r,c,u,a]);let f=gi(({height:v,scrollHeight:p})=>{typeof v=="number"&&(s.current.height=v),typeof p=="number"&&(s.current.contentHeight=p)},[]),d=gi(({height:v})=>{typeof v=="number"&&(s.current.contentHeight=v)},[]),[h,g]=FI(e===B1);return io(t,h,f,!0),io(e,g,d,!0),{isScrolling:i,scrollIntoView:c}};import{Fragment as zI,jsx as Yh}from"react/jsx-runtime";var VI=Fn("saltHighlighter"),z1=t=>{let{matchPattern:e,text:n=""}=t,r=typeof e=="string"?new RegExp(`(${du(e)})`,"gi"):e;return r===void 0?Yh(zI,{children:n}):Yh("span",{children:n.split(r).map((o,i)=>o.match(r)?Yh("strong",{className:VI("highlight"),children:o},`${i}-${o}`):o)})};import{forwardRef as W1}from"react";import{jsx as $I}from"react/jsx-runtime";var $1="vuuCheckboxIcon",_1=({checked:t=!1,disabled:e=!1,...n})=>$I("span",{...n,className:W($1,{[`${$1}-checked-${e?"disabled":"enabled"}`]:t})});import{jsx as Cu,jsxs as _I}from"react/jsx-runtime";var Zs="vuuListItem",K1=W1(function({height:e,...n},r){return Cu("div",{...n,"aria-hidden":!0,className:W(Zs,`${Zs}-proxy`),ref:r,style:{height:e}})}),U1=W1(function({children:e,className:n,disabled:r,tabIndex:o,item:i,itemHeight:s,itemTextHighlightPattern:l,label:a,selectable:u,selected:c,showCheckbox:f,style:d,...h},g){let v=W(Zs,n,{vuuDisabled:r,[`${Zs}-checkbox`]:f}),p=s!==void 0?{...d,height:s}:d;return _I("div",{className:v,...h,"aria-disabled":r||void 0,"aria-selected":c||void 0,ref:g,style:p,children:[f&&Cu(_1,{"aria-hidden":!0,checked:c}),e&&typeof e!="string"?e:l==null?Cu("span",{className:`${Zs}-textWrapper`,children:a||e}):Cu(z1,{matchPattern:l,text:a||e})]})});import{useId as LL}from"@vuu-ui/vuu-utils";import{cloneElement as PL,forwardRef as DL,isValidElement as AL,useCallback as RL,useRef as rp,useState as OL}from"react";import{useLayoutEffectSkipFirst as xL}from"@vuu-ui/vuu-utils";import{useCallback as Qs,useMemo as wL,useRef as SL}from"react";import{createContext as WI,useCallback as gB,useContext as KI,useMemo as vB}from"react";import{jsx as bB}from"react/jsx-runtime";var UI={isDragSource:void 0,isDropTarget:void 0,register:()=>{}},jI=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),qI=WI({registerDragDropParty:jI});var j1=t=>{var s,l;let{dragSources:e,dropTargets:n,onDragOut:r,onEndOfDragOperation:o,registerDragDropParty:i}=KI(qI);if(t&&(e||n)){let a=(s=e==null?void 0:e.has(t))!=null?s:!1,u=(l=n==null?void 0:n.has(t))!=null?l:!1;return{isDragSource:a,isDropTarget:u,onDragOut:r,onEndOfDragOperation:o,register:i}}else return UI};var ku=class{constructor(e,n){this.draggableElement=null;this.payload=null;this.setDraggable=e=>{this.draggableElement=e};this.initialDragElement=n,this.mouseOffset=this.getMouseOffset(e,n)}setPayload(e){this.payload=e}getMouseOffset(e,n){let{clientX:r,clientY:o}=e,i=n.getBoundingClientRect();return{x:r-i.left,y:o-i.top}}};import{dispatchCustomEvent as uL}from"@vuu-ui/vuu-utils";import{useCallback as mt,useEffect as cL,useLayoutEffect as dL,useRef as Mt,useState as fL}from"react";import{forwardRef as GI,useCallback as q1,useMemo as JI}from"react";import{jsx as Qh}from"react/jsx-runtime";var ZI=t=>t.split(" ").map(e=>`vuuDraggable-${e}`),Eu=GI(function({wrapperClassName:e,element:n,onDropped:r,onTransitionEnd:o,style:i,scale:s=1},l){let a=q1(()=>{r==null||r()},[r]),u=q1(d=>{d&&(d.innerHTML="",d.appendChild(n),s!==1&&(d.style.transform=`scale(${s},${s})`),d.addEventListener("vuu-dropped",a))},[n,a,s]),c=pt(l,u),f=JI(()=>({left:0,top:0}),[]);return Qh(wr,{children:Qh(ci,{anchorElement:{current:document.body},placement:"absolute",position:f,children:Qh("div",{className:W("vuuDraggable",...ZI(e)),ref:c,onTransitionEnd:o,style:i})})})}),Xh=t=>{let e=document.createElement("div");return e.className="vuuDraggable-spacer",t&&e.addEventListener("transitionend",()=>{t.current=!1}),e},G1=()=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicatorPosition",t},J1=t=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicator",t&&e.addEventListener("transitionend",()=>{t.current=!1}),e};var YI=["left","right"],QI=["top","bottom"],Mu=":not(.wrapped)",Z1=':not([aria-hidden="true"])',Y1=t=>{let e=t.cloneNode(!0);return e.removeAttribute("id"),e.dataset.index="-1",e},XI=(t,e="width",n=!1)=>{let r=e==="width"?"left":"top",{[e]:o,[r]:i}=t.getBoundingClientRect(),{padEnd:s=!1,padStart:l=!1}=t.dataset,a=getComputedStyle(t),[u,c]=e==="width"?YI:QI,f=l&&!n?0:parseInt(a.getPropertyValue(`margin-${u}`),10),d=s&&!n?0:parseInt(a.getPropertyValue(`margin-${c}`),10),h=o;if(parseInt(a.getPropertyValue("flex-shrink"),10)>0){let v=parseInt(a.getPropertyValue("flex-basis"),10);!isNaN(v)&&v>0&&(h=v)}return[i,f+h+d]},eL={horizontal:{CLIENT_POS:"clientX",CLIENT_SIZE:"clientWidth",CONTRA:"top",CONTRA_CLIENT_POS:"clientY",CONTRA_END:"bottom",CONTRA_POS:"y",DIMENSION:"width",END:"right",POS:"x",SCROLL_POS:"scrollLeft",SCROLL_SIZE:"scrollWidth",START:"left"},vertical:{CLIENT_POS:"clientY",CLIENT_SIZE:"clientHeight",CONTRA:"left",CONTRA_CLIENT_POS:"clientX",CONTRA_END:"right",CONTRA_POS:"x",DIMENSION:"height",END:"bottom",POS:"y",SCROLL_POS:"scrollTop",SCROLL_SIZE:"scrollHeight",START:"top"}},Et=t=>eL[t],Q1=(t,e)=>{let n=t.find(r=>r.id===e);if(n)return n},X1=(t,e)=>{t.splice(e,1);for(let n=e;n<t.length;n++)t[n].currentIndex-=1},vi=(t,e,n,r,o)=>{let i=[],{DIMENSION:s}=Et(e),l=Array.from(n?t.querySelectorAll(n):t.children),a=l.length,u=typeof(r==null?void 0:r.from)=="number"?r.atEnd?Math.max(0,r.from-1):r.from:0,c=typeof(r==null?void 0:r.to)=="number"?Math.min(r.to+2,a-1):a-1;for(let f=u;f<=c;f++){let d=l[f],[h,g]=XI(d,s),v=f===a-1,p=d.id;i.push({currentIndex:f,id:p,index:f,isDraggedItem:o===p,isLast:v,isOverflowIndicator:d.dataset.index==="overflow",element:d,start:h,end:h+g,size:g,mid:h+g/2})}return i},yi=(t,e=!1)=>{let n=t.findIndex(r=>r.isDraggedItem);if(e){let{index:r}=t[n],o=t.filter(s=>!s.isDraggedItem).reduce((s,l)=>Math.min(s,l.index),Number.MAX_SAFE_INTEGER);if(o>0&&!(r===0&&o===1))return o+n}return n},ep=(t,e)=>{let n=yi(t),r=e==="fwd"?n+1:n-1;if(r<0||r>=t.length)throw Error("switchDropTargetPosition index out of range");let o=t.at(n),i=t.at(r),s=i.size-o.size;if(e==="fwd"){let l=i.start+s,a=i.end,u={...o,start:l,mid:Math.floor(l+(a-l)/2),end:a},c=o.start,f=o.end+s,d={...i,start:c,mid:Math.floor(c+(f-c)/2),end:f};t.splice(n,2,d,u)}else{let l=i.start,a=i.end-s,u={...o,start:l,mid:Math.floor(l+(a-l)/2),end:a},c=o.start-s,f=o.end,d={...i,start:c,mid:Math.floor(c+(f-c)/2),end:f};t.splice(r,2,u,d)}},lo=(t,e,n,r)=>{let o=t.length,i=yi(t),s=t[i];if(r==="fwd"){let l=Math.round(e+n);for(let a=o-1;a>=0;a--){let u=t[a];if(l>u.mid)return s&&a<i?s:u}}else{let l=Math.round(e);for(let a=0;a<o;a++){let u=t[a];if(l<u.mid)return a>i?s:u}}throw Error("no dropTraget identified")};function ex(t,e){let{height:n,left:r,top:o,width:i}=t,{height:s,width:l}=e;return{height:Math.min(n,s),left:r,top:o,width:Math.min(i,l)}}var tx=(t,e)=>{let n=t.querySelector(`${e}:not([aria-hidden="true"])`),r=n==null?void 0:n.parentElement;return r===t?t:r==null?void 0:r.parentElement},nx=(t,e)=>{let{SCROLL_SIZE:n,CLIENT_SIZE:r}=Et(e),{[n]:o,[r]:i}=t;return o>i};import{useCallback as rx,useRef as Tu}from"react";var ox=({containerRef:t,onScrollingStopped:e,orientation:n="vertical"})=>{let r=Tu(null),o=Tu(!1),i=Tu(0),s=Tu("fwd"),l=rx((u=!1)=>{console.log("[useAutoScroll] stopScrolling"),r.current!==null&&(clearTimeout(r.current),r.current=null),o.current=!1,e==null||e(s.current,i.current,u)},[e]),a=rx((u,c,f=30)=>{let{current:d}=t;if(d){let{SCROLL_POS:h,SCROLL_SIZE:g,CLIENT_SIZE:v}=Et(n),{[h]:p,[g]:m,[v]:y}=d,x=u==="fwd"?m-y-p:p,b=Math.min(x,f);u==="fwd"?(s.current="fwd",d[h]=i.current=p+b):(s.current="bwd",d[h]=i.current=p-b),b===x?l(!0):(o.current=!0,r.current=window.setTimeout(()=>{a(u,c,f)},100))}},[t,n,l]);return{isScrolling:o,startScrolling:a,stopScrolling:l}};import{useCallback as tp,useRef as tL}from"react";var ix=({selected:t,viewportRange:e})=>{let n=tL();n.current=e;let r=tp(s=>{s.ariaSelected&&Array.isArray(t)&&t.length>1&&console.log("its a selected element, and we have a multi select")},[t]),o=tp(()=>{},[]),i=tp(()=>{},[]);return{beginDrag:r,drag:o,drop:i}};import{useCallback as bi,useRef as kn,useState as ax}from"react";import{useCallback as sx,useMemo as nL}from"react";var lx=()=>{let t=nL(()=>G1(),[]),e=sx(()=>t.remove(),[t]);return{positionDropIndicator:sx((r,o="end")=>(o==="end"?r.element.after(t):r.element.before(t),t),[t]),clearSpacer:e}};import{jsx as iL}from"react/jsx-runtime";var rL=':not([data-overflowed="true"])',oL=':not([aria-hidden="true"])',ux=({onDrop:t,orientation:e="horizontal",containerRef:n,itemQuery:r="*",selected:o,viewportRange:i})=>{let s=kn(),l=kn(null),a=kn(null),u=kn(""),c=kn(!1),f=kn(-1),d=kn([]),h=kn(!1),[g,v]=ax(!1),[p,m]=ax(),{clearSpacer:y,positionDropIndicator:x}=lx(),b=kn(),C=`:is(${r}${rL}${oL},[data-overflow-indicator])`,w=A=>d.current.findIndex(L=>L.id===A.id),S=(A,L,H)=>{A.start+=L,A.mid+=L,A.end+=L,typeof H=="number"&&(A.currentIndex+=H)},E=kn();E.current=i;let k=bi(()=>{y()},[y]),T=bi((A,L,H)=>{let{current:O}=n,{current:B}=b;if(O&&B){d.current=vi(O,e,C,E.current);let{size:P}=B,N=f.current+P/2,{current:z}=d,q=lo(z,N,P,"fwd");q&&x(H&&A==="fwd"?z[z.length-1]:q,"start")}},[n,x,C,e]),D=bi(A=>{A.ariaSelected&&Array.isArray(o)&&o.length>1&&console.log("its a selected element, and we have a multi select");let{current:L}=n;if(L&&A){let{SCROLL_SIZE:H,CLIENT_SIZE:O}=Et(e),{id:B}=A,{[H]:P,[O]:F}=L;c.current=P>F;let N=d.current=vi(L,e,C,i),z=Q1(N,B);if(z&&L){let q=w(z);X1(N,q),b.current=z;let{current:Z}=E;if(Z!=null&&Z.atEnd)for(let pe=0;pe<N.length;pe++)S(N[pe],z.size);for(let pe=q;pe<N.length;pe++)S(N[pe],-z.size,-1);let[j,U]=z.isLast?[N[N.length-1],"end"]:[N[q],"start"];a.current=j,u.current=U;let ue=x(j,U),{top:se,left:Me,width:Te}=ue.getBoundingClientRect(),Ce={top:z.isLast?Z!=null&&Z.atEnd&&!Z.atStart?se+z.size-2:se-2:se-z.size-2,left:Me,width:Te,height:2};m(iL(Eu,{wrapperClassName:"dropIndicatorContainer",style:Ce,ref:l,element:J1()}))}}},[o,n,e,C,i,x]),M=bi((A,L)=>{let{current:H}=a,{current:O}=b;if(O&&n.current){let B=e==="horizontal"?"left":"top";f.current=A;let{current:P}=d,F=lo(P,A,O.size,L);if(F&&F.index!==(H==null?void 0:H.index)){if(F.isOverflowIndicator)v(h.current=!0);else if(l.current){if(w(F)===P.length-1){let z=P[P.length-1],Z=x(z,"start").getBoundingClientRect();l.current.style[B]=`${Z.top}px`}else{let q=x(F,"start").getBoundingClientRect();l.current.style[B]=`${q.top}px`}v(h.current=!1)}a.current=F,s.current=L}}},[n,e,x]),I=bi(()=>{y();let{current:A}=b,{current:L}=a,{current:H}=u,{current:O}=E;if(A&&O&&L){let{index:B}=A,P=H==="start",{index:F,currentIndex:N}=L;a.current=null,s.current=void 0,h.current?t(B,-1,{fromIndex:B,toIndex:-1}):B<F?t(B,P?N:N+1,{fromIndex:B,toIndex:P?N:N+1}):t(B,P?F:F+1,{fromIndex:B,toIndex:P?F:F+1}),m(void 0)}v(!1)},[y,t]),R=bi(()=>{},[]);return{beginDrag:D,drag:M,drop:I,dropIndicator:p,handleScrollStart:k,handleScrollStop:T,releaseDrag:R,revealOverflowedItems:g}};import{useCallback as xi,useMemo as lL,useRef as ao,useState as aL}from"react";import{useCallback as Ys,useMemo as sL,useRef as cx}from"react";var dx=(t="horizontal")=>{let e=cx(0),n=cx(!1),r=sL(()=>[Xh(n),Xh()],[]),o=Ys((u,c="width")=>{let[f,d]=r;e.current=requestAnimationFrame(()=>{n.current=!0,f.style.cssText=`${c}: 0px`,d.style.cssText=`${c}: ${u}px`,r[0]=d,r[1]=f})},[r]),i=Ys((u=!1)=>{if(u===!0){let[c]=r,f=()=>{c.removeEventListener("transitionend",f),i()},d=t==="horizontal"?"width":"height";c.addEventListener("transitionend",f),o(0,d)}else r.forEach(c=>c.remove())},[o,t,r]),s=Ys(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),l=Ys((u,c,f,d=!1,h="static")=>{if(c){let g=t==="horizontal"?"width":"height",[v,p]=r;if(s(),d)n.current?(i(),v.style.cssText=`${g}: ${f}px`,p.style.cssText=`${g}: 0px`,h==="fwd"?(c.element.before(v),c.element.after(p)):(c.element.after(v),c.element.before(p))):h==="fwd"?c.element.after(p):c.element.before(p),o(f,g);else if(h==="static")v.style.cssText=`${g}: ${f}px`,c.element.before(v);else throw Error("useDragDisplacers currently only supports noTransition for static displacement");h!=="static"&&ep(u,h)}},[o,s,i,t,r]),a=Ys((u,c,f,d=!1,h="static")=>{let g=t==="horizontal"?"width":"height",[v,p]=r;s(),d?(n.current?(i(),v.style.cssText=`${g}: ${f}px`,p.style.cssText=`${g}: 0px`,c.element.before(v),c.element.after(p)):h==="fwd"?c.element.after(p):c.element.before(p),o(f,g)):(v.style.cssText=`${g}: ${f}px`,c.element.after(v)),h!=="static"&&ep(u,h)},[o,s,i,t,r]);return{displaceItem:l,displaceLastItem:a,clearSpacers:i}};import{dispatchMouseEvent as fx}from"@vuu-ui/vuu-utils";var hx=({onDrop:t,orientation:e="horizontal",containerRef:n,itemQuery:r="*",selected:o,viewportRange:i})=>{let s=ao(),l=ao(!1),a=ao(-1),u=ao([]),c=ao(!1),[f,d]=aL(!1),{clearSpacers:h,displaceItem:g,displaceLastItem:v}=dx(e),p=ao(),m=`:is(${r}${Mu}${Z1},.vuuOverflowContainer-OverflowIndicator)`,y=M=>u.current.findIndex(I=>I.id===M.id),x=ao();x.current=i;let b=xi(()=>{h()},[h]),C=xi((M,I,R)=>{let{current:A}=n,{current:L}=p;if(A&&L){u.current=vi(A,e,m,x.current),M==="fwd"?u.current.push(L):u.current.unshift(L);let{size:H}=L,B=a.current+H/2,{current:P}=u,F=lo(P,B,H,"fwd");if(F){let z=y(F),q=P[z];R&&M==="fwd"?v(P,P[P.length-1],H,!1,"static"):g(P,q,H,!0,"static")}}},[n,g,v,m,e]),w=xi(M=>{M.ariaSelected&&Array.isArray(o)&&o.length>1&&console.log("its a selected element, and we have a multi select");let{current:I}=n;if(I&&M){let R=I.contains(M),{SCROLL_SIZE:A,CLIENT_SIZE:L}=Et(e),{id:H}=M,{[A]:O,[L]:B}=I;l.current=O>B;let P=u.current=vi(I,e,m,i,H);if(console.log({dropTargets:P}),R){let F=yi(P),N=P[F];N&&I&&(p.current=N,(N.isLast?v:g)(P,N,N.size,!1,"static"))}else{let{top:F,height:N}=M.getBoundingClientRect(),z=lo(P,F,N,"fwd"),q=P.indexOf(z),{start:Z,end:j,mid:U}=z,ue=p.current={end:j,mid:U,start:Z,isDraggedItem:!0,isExternal:!0,size:N},se=P.indexOf(z);P.splice(se,0,ue);for(let Te=q+1;Te<P.length;Te++){let Ce=P[Te];Ce.mid+=N,Ce.end+=N,Ce.start+=N}(z.isLast?v:g)(P,z,z.size,!0,"static")}}},[n,g,v,m,e,o,i]),[S,E]=lL(()=>{let M=!1;return[A=>{if(!M){M=!0;let L=A.element.querySelector(".vuuPopupMenu");L&&fx(L,"click")}},A=>{if(M){M=!1;let L=A.element.querySelector(".vuuPopupMenu");L&&fx(L,"click")}}]},[]),k=xi((M,I)=>{let{current:R}=p;if(R&&n.current){a.current=M;let{current:A}=u,L=lo(A,M,R.size,I);if(L&&!L.isDraggedItem)if(L.isOverflowIndicator)d(c.current=!0),S(L);else{let{size:H}=R;(y(L)===A.length-1?v:g)(A,L,H,!0,I);let P=A.at(-1);E(P),d(c.current=!1)}s.current=I}},[n,g,v,E,S]),T=xi(()=>{var A;h();let{current:M}=u,I=yi(M),R=M[I];if(R)if(s.current=void 0,c.current)t(R.index,-1,{fromIndex:R.index,toIndex:-1,isExternal:R.isExternal});else{let L=yi(M,!0);t(R.index,L,{fromIndex:R.index,toIndex:L,isExternal:R.isExternal})}if(d(!1),n.current){let L=(A=n.current)==null?void 0:A.scrollTop;I<M.length&&(n.current.scrollTop=L)}},[h,n,t]),D=xi(()=>{h(!0)},[h]);return{beginDrag:w,drag:k,drop:T,handleScrollStart:b,handleScrollStop:C,releaseDrag:D,revealOverflowedItems:f}};import{jsx as yL}from"react/jsx-runtime";var hL={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},px={start:0,end:1e3,contraStart:0,contraEnd:1e3},pL=()=>hL,mL=3,gL=(t,e)=>t==null?void 0:t.closest(e),vL=(t,e)=>{let n=`:is(${e}${Mu},.vuuOverflowContainer-OverflowIndicator)`,o=Array.from(t.querySelectorAll(n)).pop();return[o,mx(o)]},wi=({allowDragDrop:t,containerRef:e,draggableClassName:n,getDragPayload:r,id:o,itemQuery:i="*",onDragStart:s,onDrop:l,onDropSettle:a,orientation:u,...c})=>{let f=Mt({start:0,end:0,contraStart:0,contraEnd:0}),[d,h]=fL({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),g=Mt(null),v=Mt(null),p=Mt(!1),m=Mt(null),y=Mt({x:0,y:0}),x=Mt({x:0,y:0}),b=Mt(null),C=Mt(null),w=Mt(-1),S=Mt(-1),E=Mt(),{isDragSource:k,isDropTarget:T,onDragOut:D,onEndOfDragOperation:M,register:I}=j1(o),R=Mt(),A=Mt(),L=mt(()=>{let{current:X}=R,{current:ee}=A;X&&ee&&(document.addEventListener("mousemove",X,!1),document.addEventListener("mouseup",ee,!1))},[]),H=mt(()=>{let{current:X}=R,{current:ee}=A;X&&ee&&(document.removeEventListener("mousemove",X,!1),document.removeEventListener("mouseup",ee,!1))},[]),O=mt((X,ee)=>{let{current:le}=e;if(le){let[G,te]=vL(le,i),{CONTRA:ce,CONTRA_END:he,DIMENSION:Y,END:oe,START:$t}=Et(u),hn=ee[Y],{[$t]:rn,[oe]:Nn}=G.getBoundingClientRect();f.current.start=X[$t],f.current.end=te?Math.max(rn,X.right-hn):p.current?X[$t]+X[Y]-hn:Nn-hn,f.current.contraStart=X[ce],f.current.contraEnd=X[he]}},[e,i,u]),B=mt(()=>{var G;let{current:X}=b;b.current=null;let{current:ee}=S,le=(G=e.current)==null?void 0:G.querySelector(`${i}[data-index="${ee}"]`);le&&le.classList.remove("vuuDropTarget-settling"),S.current=-1,a==null||a(ee),h(te=>({...te,draggable:void 0})),X&&uL(X,"vuu-dropped")},[e,i,a]),P=mt(X=>{if(C.current&&g.current){let{mouseOffset:ee}=g.current,{POS:le,SCROLL_POS:G,SCROLL_SIZE:te,CLIENT_SIZE:ce}=Et(u),{[G]:he,[te]:Y,[ce]:oe}=C.current,$t=Y-oe,hn=he<$t,rn=f.current.end,Nn=he>0&&X-ee[le]<=f.current.start,Hr=hn&&X-ee[le]>=rn;return Nn?"bwd":Hr?"fwd":""}},[C,u]),F=t===!0||t==="natural-movement"?hx:t==="drop-indicator"?ux:t==="drag-copy"?ix:pL,N=mt((X,ee,le)=>{var G;(G=E.current)==null||G.call(E,X,ee,le)},[]),{isScrolling:z,startScrolling:q,stopScrolling:Z}=ox({containerRef:C,onScrollingStopped:N,orientation:u}),j=mt((X,ee,le)=>{var G;w.current=ee,le.isExternal?l==null||l(X,ee,{...le,payload:(G=g.current)==null?void 0:G.payload}):l==null||l(X,ee,le),S.current=ee,o&&(M==null||M(o)),g.current=null},[o,l,M]),{beginDrag:U,drag:ue,drop:se,handleScrollStart:Me,handleScrollStop:Te,releaseDrag:Ce,...pe}=F({...c,containerRef:e,isDragSource:k,isDropTarget:T,itemQuery:i,onDrop:j,orientation:u});E.current=Te;let Be=mt((X,ee)=>{let{CONTRA_POS:le}=Et(u),G=y.current[le],te=k?Math.abs(G-ee):0;if(t===!0&&!k&&!T)return!1;let ce=T===!1||te-X>5;if(g.current&&ce)return D!=null&&D(o,g.current)&&(H(),Ce==null||Ce(),g.current=null),f.current=px,!0},[t,o,k,T,D,u,Ce,H]),We=mt(X=>{let{CLIENT_POS:ee,CONTRA_CLIENT_POS:le,POS:G}=Et(u),{clientX:te,clientY:ce}=X,{[ee]:he,[le]:Y}=X,oe=y.current[G],$t=Math.abs(oe-he),{current:hn}=g;if(!Be($t,Y)&&(y.current.x=te,y.current.y=ce,hn)){let{draggableElement:rn,mouseOffset:Nn}=hn;if(f.current===px&&rn){let Hr=y.current.x-Nn.x,Nr=y.current.y-Nn.y;rn.style.top=`${Nr}px`,rn.style.left=`${Hr}px`}else if($t>0&&rn){let Hr=oe<he?"fwd":"bwd",Nr=P(he),Hl=y.current[G]-Nn[G];if(Nr&&p.current&&!z.current?(Me==null||Me(),q(Nr,1)):!Nr&&z.current&&Z(),!z.current){let $i=Math.round(Math.max(f.current.start,Math.min(f.current.end,Hl))),Nl=u==="horizontal"?"left":"top";rn.style[Nl]=`${$i}px`,ue($i,Hr)}}}},[ue,Be,P,Me,z,u,q,Z]),Ie=mt(()=>{H(),g.current&&(b.current=g.current.draggableElement),se(),h(X=>({...X,draggedItemIndex:-1,isDragging:!1}))},[se,H]);R.current=We,A.current=Ie;let ge=mt(X=>{g.current=X;let{draggableElement:ee,mouseOffset:le}=X,{current:G}=e;if(G&&ee){let te=G.getBoundingClientRect(),ce=ee.getBoundingClientRect();return O(te,ce),y.current.x=ce.left+le.x,y.current.y=ce.top+le.y,U(ee),L(),!0}else return!1},[L,U,e,O]),Ke=mt(X=>{let{current:ee}=e,{current:le}=m,G=gL(le,i);if(ee&&G){let te=tx(ee,i);p.current=nx(te,u),C.current=te;let ce=ee.getBoundingClientRect(),he=G.getBoundingClientRect(),Y=g.current=new ku(X,G);O(ce,he),U(G);let{dataset:{index:oe="-1"}}=G;h({isDragging:!0,draggable:yL(Eu,{element:Y1(G),onDropped:B,onTransitionEnd:B,ref:Y.setDraggable,style:ex(he,ce),wrapperClassName:n}),draggedItemIndex:parseInt(oe)}),s==null||s(Y),L(),m.current=null}},[L,U,e,n,i,s,u,O,B]),Ue=mt(X=>{let{current:ee}=x,{CLIENT_POS:le,POS:G}=Et(u),{[le]:te}=X;if(Math.abs(te-ee[G])>mL&&e.current){v.current&&(window.clearTimeout(v.current),v.current=null),document.removeEventListener("mousemove",Ue),document.removeEventListener("mouseup",et,!1);let he={clientX:ee.x,clientY:ee.y};Ke(he)}},[e,U,u]),et=mt(()=>{v.current&&(window.clearTimeout(v.current),v.current=null),document.removeEventListener("mousemove",Ue,!1),document.removeEventListener("mouseup",et,!1)},[Ue]),Ve=mt(X=>{let{current:ee}=e;if(X.stopPropagation(),ee&&!X.defaultPrevented){let{clientX:le,clientY:G}=X;y.current.x=x.current.x=le,y.current.y=x.current.y=G,m.current=X.target;let te={clientX:le,clientY:G};document.addEventListener("mousemove",Ue,!1),document.addEventListener("mouseup",et,!1),X.persist(),v.current=window.setTimeout(()=>{document.removeEventListener("mousemove",Ue,!1),document.removeEventListener("mouseup",et,!1),Ke(te)},500)}},[e,Ke,Ue,et]),{current:bt}=b;return dL(()=>{if(bt&&e.current){let X=w.current,ee=e.current.querySelector(`${i}[data-index="${X}"]`);ee&&(ee.classList.add("vuuDropTarget-settling"),requestAnimationFrame(()=>{let{top:le,left:G}=ee.getBoundingClientRect(),te=getComputedStyle(bt),ce=parseInt(te.getPropertyValue("left")),he=parseInt(te.getPropertyValue("top"));ce!==G||he!==le?(bt.classList.add("vuuDraggable-settling"),bt.style.top=`${le}px`,bt.style.left=`${G}px`):B()}))}},[e,i,bt,B]),cL(()=>{o&&(k||T)&&I(o,t==="drop-only"?!1:ge,l)},[t,o,k,T,l,I,ge]),{...pe,...d,isScrolling:z,onMouseDown:t&&t!=="drop-only"?Ve:void 0}};import{useCallback as Iu,useEffect as bL,useRef as gx}from"react";var vx=({dataHook:t,onDrop:e,onMoveListItem:n,selected:r,setHighlightedIndex:o,setSelected:i})=>{let s=gx([]),l=gx(t);l.current=t;let a=Iu((d,h,g)=>d===h?g:d<Math.min(h,g)||d>Math.max(h,g)?d:h<d?d-1:d+1,[]),u=Iu((d,h,g)=>d.map(p=>l.current.indexOfItemById(p)).map(p=>a(p,h,g)),[a]),c=Iu((d,h,g)=>{Un(r)&&(s.current=u(r,d,h)),g.isExternal?e==null||e(d,h,g):n==null||n(d,h),o(-1)},[r,o,u,e,n]),f=Iu(d=>{o(d)},[o]);return bL(()=>{let{current:d}=s;if(Un(d)){s.current=[];let h=Array.isArray(d)?d.map(g=>t.data[g].id):t.data[d].id;s.current=[],i(h)}},[t.data,i]),{handleDrop:c,onDropSettle:f}};var Lu=({allowDragDrop:t=!1,collapsibleHeaders:e,collectionHook:n,containerRef:r,contentRef:o,defaultHighlightedIndex:i,defaultSelected:s,disabled:l,disableAriaActiveDescendant:a,disableHighlightOnFocus:u,disableTypeToSelect:c,highlightedIndex:f,id:d,label:h="",listHandlers:g,onClick:v,onDragStart:p,onDrop:m,onHighlight:y,onKeyboardNavigation:x,onKeyDown:b,onMoveListItem:C,onSelect:w,onSelectionChange:S,restoreLastFocus:E,scrollContainerRef:k,selected:T,selectionStrategy:D,selectionKeys:M,stickyHeaders:I,tabToSelect:R,viewportRange:A})=>{let L=SL(T||s),H=(G,te)=>{var ce,he;(he=(ce=se.listHandlers).onKeyboardNavigation)==null||he.call(ce,G,te),x==null||x(G,te)},O=Qs((G,te)=>{w&&te!==null&&w(G,n.itemById(te))},[n,w]),B=wL(()=>{var G,te;return k||{current:(te=(G=r.current)==null?void 0:G.querySelector(".vuuList-scrollContainer"))!=null?te:null}},[r,k]),P=Qs((G,te)=>{if(S){if(c1(D)){let[ce]=te;S(G,n.itemById(ce))}else if(gu(D)){let ce=te.map(he=>n.itemById(he));S(G,ce)}}},[n,S,D]),{highlightedIndex:F,containerProps:{onKeyDown:N,onMouseMove:z,...q},setHighlightedIndex:Z,...j}=D1({containerRef:B,defaultHighlightedIndex:i,disableHighlightOnFocus:u,highlightedIndex:f,itemCount:n.data.length,label:h,onHighlight:y,onKeyboardNavigation:H,restoreLastFocus:E,selected:L.current,viewportItemCount:10}),U=M1({collapsibleHeaders:e,highlightedIdx:F,collectionHook:n}),ue=Qs(G=>{Z(-1),p==null||p(G)},[p,Z]),se=A1({containerRef:r,defaultSelected:s,highlightedIndex:F,itemQuery:".vuuListItem",label:`${h}:useList`,onClick:v,onSelect:O,onSelectionChange:P,selected:T,selectionStrategy:D,selectionKeys:M,tabToSelect:R}),{handleDrop:Me,onDropSettle:Te}=vx({dataHook:n,onDrop:m,onMoveListItem:C,selected:se.selected,setHighlightedIndex:Z,setSelected:se.setSelected}),{setSelected:Ce}=se;xL(()=>{Un(L.current)&&Ce([])},[T,n.data,Ce]);let{onMouseDown:pe,isDragging:Be,isScrolling:We,...Ie}=wi({allowDragDrop:t,draggableClassName:"list-item",orientation:"vertical",containerRef:r,id:d,itemQuery:".vuuListItem",onDragStart:ue,onDrop:Me,onDropSettle:Te,viewportRange:A}),{onKeyDown:ge}=O1({disableTypeToSelect:c,highlightedIdx:F,highlightItemAtIndex:Z,typeToNavigate:!0,items:n.data}),Ke=Qs(G=>{var te,ce,he;G.defaultPrevented||ge==null||ge(G),N(G),G.defaultPrevented||(ce=(te=se.listHandlers).onKeyDown)==null||ce.call(te,G),G.defaultPrevented||(he=U==null?void 0:U.onKeyDown)==null||he.call(U,G),G.defaultPrevented||b==null||b(G)},[U,N,b,se.listHandlers,ge]),{isScrolling:Ue,scrollIntoView:et}=V1({containerRef:B,contentRef:o,highlightedIdx:F,indexPositions:n.data,stickyHeaders:I}),Ve=Ue.current||We.current,bt=Qs(G=>{if(!Ve&&!l&&!Be){z();let te=T1(G.target);if(te!==-1&&te!==F){let ce=n.data[te];!ce||ce.disabled?Z(-1):Z(te)}}},[Be,Ve,l,Z,z,F,n.data]),X=()=>{var G;return F===void 0||F===-1||a||(G=n.data[F])==null?void 0:G.id};L.current=se.selected;let ee={"aria-activedescendant":X(),onBlur:q.onBlur,onFocus:q.onFocus,onKeyDown:Ke,onMouseDown:pe,onMouseDownCapture:q.onMouseDownCapture,onMouseLeave:q.onMouseLeave},le=g||{onClick:se.listHandlers.onClick,onMouseMove:bt};return{focusVisible:j.focusVisible,controlledHighlighting:j.controlledHighlighting,highlightedIndex:F,keyboardNavigation:j.keyboardNavigation,listHandlers:le,listItemHeaderHandlers:U,listControlProps:ee,scrollIntoView:et,selected:se.selected,setHighlightedIndex:Z,setIgnoreFocus:j.setIgnoreFocus,setSelected:se.setSelected,...Ie}};import{useCallback as yx,useMemo as CL,useRef as kL,useState as bx}from"react";var EL=(t,e,n=0)=>t===0?0:n===0?t*e:t-1*(e+n)+e,xx=({displayedItemCount:t,getItemHeight:e,height:n,itemCount:r,itemGapSize:o,itemHeight:i=36,size:s})=>{let[l,a]=bx(i),[,u]=bx({}),c=kL(null),[f,d]=CL(()=>{let v=0,p=l!=null?l:i,m=EL(r,p,o);if(n!==void 0)return[m,void 0];let y=Math.min(t,r)||t;return typeof e=="function"?v+=Array(y).fill(0).reduce((b,C,w)=>b+e(w)+o,0)-o:v+=y*Number(p)+(y-1)*o,[m,v]},[t,e,n,r,o,i,l]),h=yx(({height:v})=>{typeof v=="number"&&a(v)},[]),g=yx(v=>{c.current=v,u({})},[]);return io(c,a1,h,!0),{computedListHeight:d,contentHeight:f,listClientHeight:s==null?void 0:s.height,listItemHeight:l,rowHeightProxyRef:g}};import{useCallback as ML,useMemo as TL,useRef as np,useState as IL}from"react";var wx=(t,e,n,r)=>{let o=Math.ceil(e/r),i=Math.floor(t/r),s=Math.ceil(i+o-1);return{atStart:i===0,atEnd:s===n-1,from:i,to:s}},Sx=({containerSize:t,itemCount:e,itemGapSize:n=0,itemSize:r,onViewportScroll:o})=>{let i=np(0),s=np(0),l=np(0),a=TL(()=>wx(l.current,t,e,r+n),[t,e,r,n]),[u,c]=IL(a);return Ks(()=>{c(a)},[a]),{onVerticalScroll:ML(d=>{let h=d.target.scrollTop;if(h!==l.current){l.current=h;let g=r+n,v=wx(h,t,e,g);(v.from!==i.current||v.to!==s.current)&&(i.current=v.from,s.current=v.to,o==null||o(v.from,v.to),c(v))}},[r,n,t,e,o]),viewportRange:u}};import{Fragment as FL,jsx as uo,jsxs as Cx}from"react/jsx-runtime";import{createElement as NL}from"react";var HL="No data to display",Sr="vuuList",kx=DL(function({ListItem:e=U1,ListPlaceholder:n,allowDragDrop:r,children:o,className:i,collapsibleHeaders:s=!1,defaultHighlightedIndex:l,defaultSelected:a,disabled:u=!1,disableFocus:c=!1,disableTypeToSelect:f,displayedItemCount:d=10,emptyMessage:h,focusVisible:g,getItemHeight:v,getItemId:p,height:m,highlightedIndex:y,id:x,itemGapSize:b=0,itemHeight:C,itemTextHighlightPattern:w,itemToString:S=Cn,listHandlers:E,maxHeight:k,maxWidth:T,minHeight:D,minWidth:M,onClick:I,onDragStart:R,onDrop:A,onMoveListItem:L,onSelect:H,onSelectionChange:O,onHighlight:B,restoreLastFocus:P,selected:F,selectionStrategy:N,checkable:z=N==="multiple",scrollingApiRef:q,selectionKeys:Z,showEmptyMessage:j=!1,source:U,style:ue,stickyHeaders:se,tabIndex:Me=0,tabToSelect:Te,...Ce},pe){var Tg,Ig;let Be=LL(x),We=rp(null),Ie=rp(null),ge=rp(null),[Ke,Ue]=OL(),et=RL(on=>{Ue(on)},[]),Ve=mu({id:Be,label:"List",source:U,children:o,options:{collapsibleHeaders:s,getItemId:p,itemToString:S}}),{listClientHeight:bt,computedListHeight:X,listItemHeight:ee,rowHeightProxyRef:le}=xx({displayedItemCount:d,getItemHeight:v,height:m,itemCount:Ve.data.length,itemGapSize:b,itemHeight:C,rootRef:We,size:Ke}),{onVerticalScroll:G,viewportRange:te}=Sx({containerSize:(Ig=(Tg=bt!=null?bt:X)!=null?Tg:Ke==null?void 0:Ke.height)!=null?Ig:0,itemCount:Ve.data.length,itemGapSize:b,itemSize:ee}),{draggable:ce,draggedItemIndex:he,dropIndicator:Y,focusVisible:oe,highlightedIndex:$t,listControlProps:hn,listHandlers:rn,listItemHeaderHandlers:Nn,scrollIntoView:Hr,selected:Nr}=Lu({allowDragDrop:r,collapsibleHeaders:s,collectionHook:Ve,containerRef:We,contentRef:ge,defaultHighlightedIndex:l,defaultSelected:Ve.itemToCollectionItemId(a),disabled:u,disableTypeToSelect:f,highlightedIndex:y,id:Be,label:"List",listHandlers:E,onClick:I,onDragStart:R,onDrop:A,onMoveListItem:L,onSelect:H,onSelectionChange:O,onHighlight:B,restoreLastFocus:P,scrollContainerRef:Ie,selected:Ve.itemToCollectionItemId(F),selectionStrategy:N,selectionKeys:Z,stickyHeaders:se,tabToSelect:Te,viewportRange:te});I1({collectionHook:Ve,forwardedRef:q,scrollableRef:We,scrollIntoView:Hr});let Hl=g!=null?g:oe,$i=function(He,It,Lt,tt){let Fr=NL(e,{...Nn,className:W(`${Sr}Header`,{focusVisible:s&&Hl===He.value}),"aria-expanded":tt,"data-index":s?He.value:void 0,"data-highlighted":He.value===$t||void 0,"data-sticky":se,"data-selectable":!1,id:It,itemHeight:Nl(He.value),key:`header-${He.value}`,label:Lt});return He.value+=1,Fr},Nl=v===void 0?()=>C:v;function bE(on,He,It){var Vl,Lg;let{disabled:Lt,value:tt,id:Fr,label:Fl}=He,Bl=AL(tt),_i={className:W((Vl=tt==null?void 0:tt.props)==null?void 0:Vl.className,{vuuHighlighted:It.value===$t,vuuFocusVisible:Hl===It.value,"vuuDraggable-dragAway":he===It.value}),disabled:Lt||u,id:Fr,item:Bl?void 0:(Lg=He==null?void 0:He.value)!=null?Lg:void 0,itemHeight:Nl(It.value),itemTextHighlightPattern:w,key:Fr,"data-index":It.value,label:Fl,role:"option",selected:t1(Nr,He),showCheckbox:z};on.push(Bl?PL(tt,_i):uo(e,{..._i})),It.value+=1}let xE=function(He,It,Lt){let{count:tt=0,id:Fr,expanded:Fl,label:Bl=""}=It[Lt.value],_i=$i(Lt,Fr,Bl,Fl),Vl=Fl!==!1?[_i].concat(Eg(It,Lt,Lt.value+tt)||[]):_i;He.push(uo("div",{role:"group",children:Vl},Fr))},Eg=(on,He={value:0},It=on.length)=>{let Lt=[];for(;He.value<It;){let tt=on[He.value];tt.header?Lt.push($i(He,tt.id,tt.label,tt.expanded===!1)):tt.childNodes?xE(Lt,on,He):bE(Lt,tt,He)}return Lt};function wE(){return h||j?uo("span",{className:`${Sr}-empty-message`,children:h!=null?h:HL}):null}let Mg=Ve.data.length===0,SE=()=>{if(Mg)wE();else{let on=Ve.data;return Eg(on)}},CE="auto",kE={"--list-borderWidth":"var(--vuuList-borderWidth, var(--salt-size-border, 0))","--list-item-gap":b?`${b}px`:void 0,"--computed-list-height":X===void 0?void 0:`${X}px`,minWidth:M,minHeight:D,maxWidth:T,maxHeight:k};return Cx(Ex,{"aria-multiselectable":N==="multiple"||N==="extended"||N==="extended-multi-range"||void 0,...Ce,...rn,...hn,className:W(Sr,i,{[`${Sr}-collapsible`]:s,[`${Sr}-contentSized`]:X!==void 0,[`${Sr}-empty`]:Mg,vuuFocusVisible:$t===Gh}),height:X!=null?X:m,id:`${Be}`,onResize:et,ref:pt(We,pe),role:"listbox",onScroll:G,style:{...ue,...kE},tabIndex:u||c?void 0:Me,children:[uo(K1,{ref:le,height:C}),Ve.data.length===0&&n!==void 0?uo(FL,{children:uo(n,{})}):uo("div",{className:`${Sr}-viewport`,ref:Ie,children:Cx("div",{className:`${Sr}-scrollingContentContainer`,ref:ge,style:{height:CE},children:[SE(),Y,ce]})})]})});import{useId as WL}from"@vuu-ui/vuu-utils";import{forwardRef as KL,useCallback as UL,useRef as jL}from"react";import{jsx as VL}from"react/jsx-runtime";var BL="vuuChevronIcon",Mx=t=>{let{direction:e,...n}=t;return VL("span",{...n,className:W(BL,e)})};import{useLayoutEffectSkipFirst as zL}from"@vuu-ui/vuu-utils";import{useCallback as gt,useRef as op,useState as $L}from"react";var _L=["Enter"],Tx=({allowBackspaceClearsSelection:t,allowFreeText:e,ariaLabel:n,collectionHook:r,defaultIsOpen:o,defaultSelected:i,defaultValue:s,onBlur:l,onFocus:a,onChange:u,onDeselect:c,onSelect:f,id:d,initialHighlightedIndex:h=-1,isOpen:g,itemCount:v,itemsToString:p,itemToString:m=Cn,listRef:y,onOpenChange:x,onSelectionChange:b,onSetSelectedText:C,selected:w,selectionKeys:S=_L,selectionStrategy:E,value:k,InputProps:T={onBlur:l,onFocus:a,onChange:u,onSelect:f}})=>{let D=gu(E),{setFilterPattern:M}=r,I=op(null),R=op(D?[]:null),A=op(!0),[L,H]=Qe({controlled:g,default:o!=null?o:!1,name:"useDropdownList"}),[O,B]=Qe({controlled:void 0,default:s!=null?s:k,name:"ComboBox",state:"value"}),[P,F]=$L(!0),N=gt(Y=>{var oe;Array.isArray(Y)||Y==null&&((oe=I.current)==null||oe.call(I,-1))},[]),z=gt((Y,oe=!0)=>{B(Y),oe&&M(Y===""?void 0:Y)},[M,B]),q=gt(Y=>{let oe=e&&O!=null?O:"";return Array.isArray(Y)?Y.length===1?oe=m(Y[0]):Y.length>1&&(oe=(p==null?void 0:p(Y))||""):Y&&(oe=m(Y)),oe!==O?(z(oe,!D),C==null||C(oe),!0):!1},[e,D,m,p,C,z,O]),Z=gt(()=>{let{current:Y}=R;q(Y)&&Y&&(Array.isArray(Y)||Y)&&(b==null||b(null,Y))},[b,q]),j=gt(()=>{if(e){let Y=O==null?void 0:O.trim(),{current:oe}=R;if(Y){if(v===0&&Y)return D?b==null||b(null,[Y]):b==null||b(null,Y),R.current=null,!0;oe&&!D&&oe&&!Array.isArray(oe)&&m(oe)}}return!1},[e,O,v,D,b,m]),U=gt((Y,oe)=>{Y&&D&&z("",!1),H(Y),x==null||x(Y,oe),!Y&&oe!=="Escape"&&(j()||Z())},[Z,D,x,j,H,z]),ue=gt((Y,oe)=>{R.current=oe,D||U(!1,"select")},[U,D]),se=gt(()=>{F(!1)},[]),{focusVisible:Me,setHighlightedIndex:Te,highlightedIndex:Ce,listControlProps:pe,listHandlers:Be,selected:We}=Lu({collectionHook:r,containerRef:y,defaultHighlightedIndex:h,defaultSelected:r.itemToCollectionItemId(i),disableAriaActiveDescendant:P,disableHighlightOnFocus:!0,disableTypeToSelect:!0,label:"combobox",onKeyboardNavigation:se,onSelectionChange:ue,selected:r.itemToCollectionItemId(w),selectionKeys:S,selectionStrategy:E,tabToSelect:!D});I.current=Te;let{onClick:Ie}=Be,ge=gt(Y=>{var oe;(oe=document.getElementById(`${d}-input`))==null||oe.focus(),Ie==null||Ie(Y)},[d,Ie]),Ke=gt(Y=>{let oe=Y.target.value;B(oe),oe&&oe.trim().length?M(oe):M(void 0),H(!0)},[M,H,B]),Ue=gt(Y=>{Y.key==="Backspace"&&t&&(R.current=null,c==null||c())},[t,c]),{onFocus:et=a}=T,{onFocus:Ve}=pe,bt=gt(Y=>{F(!1),Ve==null||Ve(Y),et==null||et(Y)},[et,Ve]),X=gt(Y=>{let oe=Y.relatedTarget;return(oe==null?void 0:oe.id)===`${d}-list`},[d]),{onBlur:ee=l}=T,{onBlur:le}=pe,G=gt(Y=>{X(Y)||(le==null||le(Y),ee==null||ee(Y),F(!0),A.current=!0)},[X,le,ee]),{onSelect:te}=T,ce=gt(Y=>{A.current?A.current=!1:F(!0),te==null||te(Y)},[te]);zL(()=>{Un(We)?N(We):Te(h)},[N,v,h,We,Te,H]);let he={...T.inputProps,"aria-label":n,autoComplete:"off",onKeyDown:Ue};return{focusVisible:Me,highlightedIndex:Ce,isOpen:L,onOpenChange:U,inputProps:{...T,id:`${d}-input`,inputProps:he,onChange:Ke,onSelect:ce,role:"combobox",value:O},listControlProps:{...pe,onBlur:G,onFocus:bt},listHandlers:{...Be,onClick:ge},selected:R.current}};import{jsx as Pu,jsxs as qL}from"react/jsx-runtime";var Ix=KL(function({InputProps:e,ListProps:n,PopupProps:r,ListItem:o,"aria-label":i,allowBackspaceClearsSelection:s,allowFreeText:l,children:a,defaultIsOpen:u,defaultSelected:c,defaultValue:f,disabled:d,disableFilter:h,onBlur:g,onFocus:v,onChange:p,onSelect:m,onSetSelectedText:y,getFilterRegex:x,id:b,initialHighlightedIndex:C=-1,isOpen:w,itemToString:S=Cn,itemsToString:E,onDeselect:k,onOpenChange:T,onSelectionChange:D,selected:M,selectionKeys:I,selectionStrategy:R,source:A,value:L,width:H=180,...O},B){let P=WL(b),F=jL(null),N=ge=>Array.isArray(ge)&&ge.length>0?ge[0]:void 0,q=((ge,Ke)=>{let Ue=ge?N(ge):Ke?N(Ke):void 0;return Ue?S(Ue):""})(M,c),Z=mu({id:P,source:A,children:a,options:{disableFilter:h,filterPattern:q,getFilterRegex:x,itemToString:S}}),{focusVisible:j,highlightedIndex:U,inputProps:{endAdornment:ue,...se},isOpen:Me,listHandlers:Te,listControlProps:Ce,onOpenChange:pe,selected:Be}=Tx({InputProps:e,allowBackspaceClearsSelection:s,allowFreeText:l,ariaLabel:i,collectionHook:Z,defaultIsOpen:u,defaultSelected:c,defaultValue:f,disabled:d,initialHighlightedIndex:C,itemCount:Z.data.length,label:O.title,listRef:F,onBlur:g,onDeselect:k,onFocus:v,onChange:p,onSelect:m,id:P,isOpen:w,itemToString:S,itemsToString:E,onOpenChange:T,onSelectionChange:D,onSetSelectedText:y,selected:M,selectionKeys:I,selectionStrategy:R,value:q}),We=UL(()=>{Me?pe(!1,"toggle"):pe(!0)},[Me,pe]);return Pu(Wb,{collectionHook:Z,children:qL(b1,{...O,PopupProps:r,id:P,isOpen:Me,onOpenChange:pe,openOnFocus:!0,ref:B,width:H,children:[Pu(to,{...se,disabled:d,...Ce,endAdornment:ue===null?null:Pu(Mx,{direction:Me?"up":"down",onClick:We})}),Pu(kx,{...n,ListItem:o,defaultSelected:void 0,focusVisible:j,highlightedIndex:U,itemTextHighlightPattern:String(se.value)||void 0,listHandlers:Te,onSelectionChange:D,ref:F,selected:Be,selectionStrategy:R,tabIndex:-1})]})})});import{useCallback as Lx,useLayoutEffect as GL,forwardRef as JL,useRef as ip}from"react";import{jsx as sp}from"react/jsx-runtime";var Du="vuuEditableLabel",Au=JL(function({className:e,defaultEditing:n,defaultValue:r,editing:o,onChange:i,onEnterEditMode:s,onExitEditMode:l,value:a,...u},c){let f=ip(null),d=ip(!1),[h,g]=Qe({controlled:a,default:r!=null?r:"",name:"EditableLabel",state:"value"}),[v,p]=Qe({controlled:o,default:n!=null?n:!1,name:"EditableLabel",state:"editing"}),m=Lx(T=>{p(d.current=T)},[p]),y=ip(h);GL(()=>{v&&f.current!==null&&(f.current.select(),f.current.focus())},[v,f]);let x=Lx(()=>{m(!0),s&&s()},[s,m]),b=({cancelEdit:T=!1,allowDeactivation:D=!1}={})=>{m(!1);let M=y.current;M!==h&&(T?g(M):y.current=h),l&&l(M,h,D,T)},C=T=>{let{value:D}=T.target;g(D),i&&i(D)},w=()=>{x()},S=()=>{d.current&&b({allowDeactivation:!0})},E=T=>{v&&T.key==="Enter"?(T.stopPropagation(),b()):T.key==="ArrowRight"||T.key==="ArrowLeft"?T.stopPropagation():T.key==="Escape"&&b({cancelEdit:!0})},k=W(Du,e,{[`${Du}-editing`]:v});return sp("div",{...u,className:k,onDoubleClick:w,"data-text":h,ref:c,children:v?sp(to,{inputProps:{className:`${Du}-input`,spellCheck:!1},value:h,onBlur:S,onChange:C,onKeyDown:E,inputRef:f,style:{padding:0},textAlign:"left",variant:"secondary"}):sp("span",{className:`${Du}-label`,children:h})})});import{forwardRef as nP}from"react";import{isValidNumber as ZL,useId as YL}from"@vuu-ui/vuu-utils";import{forwardRef as QL,useCallback as lp}from"react";import{Fragment as eP,jsx as up,jsxs as tP}from"react/jsx-runtime";var ap="vuuInput",XL={autoComplete:"off"},Px=QL(function({className:e,errorMessage:n,id:r,onCommit:o,onKeyDown:i,type:s,...l},a){let u=YL(r),{anchorProps:c,tooltipProps:f}=Bb({id:u,tooltipContent:n}),d=lp((p,m)=>{if(s==="number"){let y=parseFloat(m);if(ZL(y))o(p,y);else throw Error("Invalid value")}else s==="boolean"?o(p,!!m):o(p,m)},[o,s]),h=lp(p=>{if(p.key==="Enter"){p.preventDefault(),p.stopPropagation();let{value:m}=p.target;d(p,m)}i==null||i(p)},[d,i]),g=lp(p=>{let{value:m}=p.target;d(p,m)},[d]),v=n?up("span",{...c,className:`${ap}-errorIcon`,"data-icon":"error"}):void 0;return tP(eP,{children:[up(to,{...l,endAdornment:v,id:u,inputProps:{...XL,...l.inputProps},className:W(ap,e,{[`${ap}-errror`]:n}),onBlur:g,ref:a,onKeyDown:h}),f?up(Fb,{...f,status:"error"}):null]})});import{jsx as Dx}from"react/jsx-runtime";var cp="vuuExpandoInput",rP=()=>{},Ru=nP(function({className:e,errorMessage:n,value:r,inputProps:o,onCommit:i=rP,...s},l){return Dx("div",{className:W(cp,e,{[`${cp}-error`]:n}),"data-text":r,children:Dx(Px,{...s,errorMessage:n,inputProps:{...o,className:`${cp}-input`},onCommit:i,ref:l,style:{padding:0},textAlign:"left",value:r,variant:"secondary"})})});import{useId as SP}from"@vuu-ui/vuu-utils";import CP,{useMemo as kP,useRef as EP}from"react";import{dispatchMouseEvent as vP}from"@vuu-ui/vuu-utils";import{useCallback as At,useRef as yP}from"react";var Ax=t=>typeof t=="object"&&t!==null&&"tabIndex"in t&&typeof t.tabIndex=="number",Rx=t=>({label:"Close",location:"tab",action:"close-tab",options:t}),Ox=t=>({label:"Rename",location:"tab",action:"rename-tab",options:t});import{getElementDataIndex as oP}from"@vuu-ui/vuu-utils";var Hx=(t,e)=>{if(t){let n=t.querySelector(`[data-index]:has(${e})`);return oP(n)}return-1},dp=t=>Hx(t,'[aria-selected="true"]'),Nx=t=>Hx(t,".vuuEditableLabel-editing");import{isValidNumber as fp,MEASURES as iP}from"@vuu-ui/vuu-utils";import{useCallback as hp,useMemo as sP,useRef as Fx}from"react";var Bx=(t,e,n="horizontal")=>{let r=Fx(!1),o=hp(()=>{r.current=!0},[]),i=hp(()=>{r.current=!1},[]),s=hp(()=>{var a,u;(a=t.current)==null||a.style.setProperty("--tab-thumb-transition","none"),(u=t.current)==null||u.removeEventListener("transitionend",s)},[t]),l=Fx(-1);return sP(()=>{var c,f;let a=0,u=0;if(l.current!==-1){let d=(c=t.current)==null?void 0:c.querySelector(".vuuTab-selected"),h=(f=t.current)==null?void 0:f.querySelector(`[data-index="${e}"] .vuuTab`),{positionProp:g,sizeProp:v}=iP[n];if(d&&h&&!r.current){let{[g]:p,[v]:m}=d.getBoundingClientRect(),{[g]:y}=h.getBoundingClientRect();if(fp(p)&&fp(y)&&fp(m)){a=p-y,u=m;let b=Math.abs(a/(n==="horizontal"?1100:700));requestAnimationFrame(()=>{var C,w,S,E;(C=t.current)==null||C.style.setProperty("--tab-thumb-offset","0px"),(w=t.current)==null||w.style.setProperty("--tab-thumb-size","100%"),(S=t.current)==null||S.style.setProperty("--tab-thumb-transition",`all ${b}s ease`),(E=t.current)==null||E.addEventListener("transitionend",s)})}}}return l.current=e,r.current?{containerStyle:{"--tab-thumb-offset":"0px","--tab-thumb-size":"100%"},resumeAnimation:i,suspendAnimation:o}:{containerStyle:{"--tab-thumb-offset":`${a}px`,"--tab-thumb-size":u?`${u}px`:void 0},resumeAnimation:i,suspendAnimation:o}},[e,t,n,s,i,o])};import{dispatchMouseEvent as lP,getFocusableElement as aP}from"@vuu-ui/vuu-utils";import{useCallback as En,useRef as pp,useState as Vx}from"react";import{ArrowDown as Wx,ArrowUp as uP,ArrowLeft as cP,ArrowRight as dP,Home as zx,End as $x}from"@vuu-ui/vuu-utils";var Kx={horizontal:{[zx]:"start",[$x]:"end",[cP]:"bwd",[dP]:"fwd"},vertical:{[zx]:"start",[$x]:"end",[uP]:"bwd",[Wx]:"fwd"}},fP=(t,e="horizontal")=>Kx[e][t]!==void 0,hP=t=>t===Wx;function _x(t,e,n){return e==="start"?0:e==="end"?t-1:e==="bwd"?n>0?n-1:n:n===null?0:n===t-1?n:n+1}var pP=t=>t!==null&&!t.classList.contains("wrapped"),Ou=(t,e)=>t?t.querySelector(`[data-index="${e}"]`):null,Ux=({containerRef:t,defaultHighlightedIdx:e=-1,highlightedIdx:n,keyBoardActivation:r,orientation:o,selectedIndex:i=0})=>{let s=r==="manual",l=pp(!1),a=pp(-1),[u,c]=Vx(!1),[,f]=Vx({}),[d,h]=Qe({controlled:n,default:e,name:"UseKeyboardNavigation"}),g=En(M=>{h(a.current=M)},[h]),v=pp(!1),p=En((M,I=!1,R,A=70)=>{g(M),R===!0&&!v.current&&(v.current=!0);let L=()=>{let H=Ou(t.current,M);if(H){let O=aP(H);O==null||O.focus()}};I?L():setTimeout(L,A)},[t,g]),m=M=>{if(a.current===-1&&M.target.tabIndex!==-1){let I=Nx(t.current);I!==-1?requestAnimationFrame(()=>{g(I)}):setTimeout(()=>{a.current===-1&&i!==null&&g(i)},200)}},y=En(()=>{var M,I;return(I=(M=t.current)==null?void 0:M.querySelectorAll("[data-index]").length)!=null?I:0},[t]),x=En((M="fwd",I)=>{let R=y(),L=_x(R,M,typeof I=="number"?I:R),H=M==="start"?"fwd":M==="end"?"bwd":M;for(;(H==="fwd"&&L<R||H==="bwd"&&L>0)&&!pP(Ou(t.current,L));){let O=_x(R,H,L);if(O===L)break;L=O}return L},[t,y]),b=En((M,I=!1)=>{let R=Kx[o][M.key],A=x(R,d);A!==d?s&&p(A,!0):I&&f({})},[d,s,x,p,o]),C=En(()=>{let M=Ou(t.current,d);return M?M.querySelector(".vuuPopupMenu")!=null:!1},[t,d]),w=En(()=>{let M=Ou(t.current,d),I=M==null?void 0:M.querySelector(".vuuPopupMenu");return I&&lP(I,"click"),!1},[t,d]),S=En(M=>{y()>0&&fP(M.key,o)?(M.preventDefault(),v.current?b(M):(v.current=!0,b(M,!0))):hP(M.key)&&C()&&w()},[w,y,C,b,o]),E=(M,I)=>{g(I)},k=En(()=>{u||(c(!0),l.current?l.current=!1:v.current=!0)},[u]),T=En(()=>{u||(l.current=!0),v.current=!1},[u]);return{containerProps:{onBlur:M=>{let I=M.target.closest(".vuuTabstrip"),R=M.relatedTarget;I&&!(I!=null&&I.contains(R))&&(g(-1),c(!1))},onMouseDownCapture:T,onFocus:k,onMouseLeave:()=>{v.current=!0,g(-1),l.current=!1}},focusVisible:v.current?d:-1,focusIsWithinComponent:u,highlightedIdx:d,focusTab:p,onClick:E,onFocus:m,onKeyDown:S,setHighlightedIdx:g}};import{useCallback as Hu}from"react";var mP=["Enter"," "],gP=t=>t&&t.matches('[class*="vuuTab "]'),jx=({defaultSelected:t,highlightedIdx:e,onSelectionChange:n,selected:r})=>{let[o,i,s]=Qe({controlled:r,default:t!=null?t:0,name:"Tabstrip",state:"value"}),l=Hu(f=>mP.includes(f.key),[]),a=Hu(f=>{i(f),n==null||n(f)},[n,i]),u=Hu(f=>{let d=f.target;l(f)&&e!==o&&gP(d)&&(f.stopPropagation(),f.preventDefault(),a(e))},[l,e,o,a]),c=Hu((f,d)=>{d!==o&&a(d)},[a,o]);return{activateTab:a,isControlled:s,onClick:c,onKeyDown:u,selected:o}};var bP=new Set(["Enter"," "]),xP=t=>bP.has(t),wP=(t,e)=>t?t.querySelector(`[data-index="${e}"]`):null,qx=({activeTabIndex:t,allowDragDrop:e,animateSelectionThumb:n,containerRef:r,onActiveChange:o,onAddTab:i,onCloseTab:s,onExitEditMode:l,onMoveTab:a,orientation:u,keyBoardActivation:c})=>{let f=yP(t),{focusTab:d,highlightedIdx:h,onClick:g,onKeyDown:v,setHighlightedIdx:p,...m}=Ux({containerRef:r,keyBoardActivation:c,orientation:u,selectedIndex:f.current}),{activateTab:y,onClick:x,onKeyDown:b,selected:C}=jx({highlightedIdx:h,onSelectionChange:o,selected:t});f.current=C;let{containerStyle:w,resumeAnimation:S,suspendAnimation:E}=Bx(r,n?C:-1,u),k=At((j,U)=>{let{current:ue}=f;console.log(`useTabstrip handleDrop ${j} - ${U} ${ue}`),a==null||a(j,U);let se=-1;U!==-1&&(ue===j?se=U:j>ue&&U<=ue?se=ue+1:j<ue&&U>=ue&&(se=ue-1),se!==-1&&(E(),y(se),requestAnimationFrame(S)),d(U,!1,!1,350))},[d,a,S,y,E]),{onMouseDown:T,...D}=wi({allowDragDrop:e,containerRef:r,draggableClassName:`tabstrip-${u}`,onDrop:k,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),M=At((j,U,ue,se)=>{console.log(`handleExitEditMode ${j} ${U} ${ue} ${se}`),l==null||l(j,U,ue,se),ue||d(se,!1,!0)},[d,l]),I=At((j,U)=>{g(j,U),x(j,U)},[g,x]),R=At((j=h)=>{let U=wP(r.current,j);if(U)return U.querySelector(".vuuEditableLabel")},[r,h]),A=At((j=h)=>{let U=R(j);return U?U.classList.contains("vuuEditableLabel-editing"):!1},[R,h]),L=At((j=h)=>{let U=R(j);U&&vP(U,"dblclick")},[R,h]),H=At(j=>{v(j),j.defaultPrevented||b(j),!j.defaultPrevented&&xP(j.key)&&L()},[L,v,b]),O=At(j=>{let U=dp(r.current),ue=U>j?U-1:U===j?0:U;return E(),s==null||s(j,ue),setTimeout(()=>{S()},200),!0},[r,s,S,E]),B=At(j=>(L(j),!0),[L]),P=At(j=>{if(Ax(j.options))switch(j.menuId){case"close-tab":return O(j.options.tabIndex);case"rename-tab":return B(j.options.tabIndex);default:console.log(`tab menu action ${j.menuId}`)}return!1},[O,B]),F=At(()=>{A()?p(h):d(h)},[h,d,p,A]),N=At(j=>{let U=parseInt(j.index);isNaN(U)||y(U)},[y]),z={onFocus:m.onFocus,onKeyDown:H},q=At(()=>{i==null||i(),requestAnimationFrame(()=>{let j=dp(r.current);j!==-1&&d(j)})},[r,d,i]),Z={onClick:I,onKeyDown:H,onExitEditMode:M,onMenuAction:P,onMenuClose:F,onMouseDown:T};return{activeTabIndex:C,containerStyle:w,focusVisible:m.focusVisible,containerProps:{...m.containerProps,onSwitchWrappedItemIntoView:N},navigationProps:z,onClickAddTab:q,tabProps:Z,...D}};import{Fragment as IP,jsx as TP,jsxs as LP}from"react/jsx-runtime";import{createElement as MP}from"react";var mp="vuuTabstrip",Gx=({activeTabIndex:t,allowAddTab:e,allowCloseTab:n,allowDragDrop:r=!1,allowRenameTab:o=!1,animateSelectionThumb:i=!1,children:s,className:l,id:a,keyBoardActivation:u="manual",location:c,onActiveChange:f,onAddTab:d,onCloseTab:h,onExitEditMode:g,onMoveTab:v,orientation:p="horizontal",showTabMenuButton:m,style:y,tabClassName:x,...b})=>{let C=EP(null),{activeTabIndex:w,focusVisible:S,containerStyle:E,draggedItemIndex:k,onClickAddTab:T,tabProps:D,...M}=qx({activeTabIndex:t,allowDragDrop:r,animateSelectionThumb:i,containerRef:C,keyBoardActivation:u,onActiveChange:f,onAddTab:d,onCloseTab:h,onExitEditMode:g,onMoveTab:v,orientation:p}),I=SP(a),R=W(mp,`${mp}-${p}`,l),A=y||E?{...y,...E}:void 0,L=kP(()=>tu(s).map((H,O)=>{let{id:B=`${I}-tab-${O}`,className:P,closeable:F=n,editable:N=o,location:z,showMenuButton:q=m}=H.props,Z=O===w;return CP.cloneElement(H,{...D,...M.navigationProps,className:W(P,x),closeable:F,"data-overflow-priority":Z?"1":void 0,dragging:k===O,editable:N,focusVisible:S===O,id:B,index:O,key:O,location:W(c,z),selected:Z,showMenuButton:q,tabIndex:Z?0:-1})}).concat(e?MP(Kn,{...M.navigationProps,"aria-label":"Create Tab",className:`${mp}-addTabButton`,"data-icon":"add","data-overflow-priority":"1",key:"addButton",onClick:T,variant:"secondary",tabIndex:-1}):[]),[s,e,M.navigationProps,T,I,n,o,m,w,D,x,k,S,c]);return LP(IP,{children:[TP(Jx,{...b,...M.containerProps,className:R,height:29,id:I,orientation:p,overflowIcon:"more-horiz",ref:C,style:A,role:"tablist",children:L}),M.draggable]})};import{forwardRef as RP,useCallback as OP,useRef as Yx}from"react";import{useMemo as PP}from"react";import{jsx as AP}from"react/jsx-runtime";var DP="vuuTabMenu",Zx=({allowClose:t,allowRename:e,controlledComponentId:n,controlledComponentTitle:r,location:o,onMenuAction:i,onMenuClose:s,index:l})=>{let[a,u]=PP(()=>[(c,f)=>{let d=[];return e&&d.push(Ox(f)),t&&d.push(Rx(f)),d},{controlledComponentId:n,controlledComponentTitle:r,tabIndex:l}],[t,e,n,r,l]);return AP(lu,{className:DP,menuBuilder:a,menuActionHandler:i,menuLocation:W("tab",o),menuOptions:u,onMenuClose:s,tabIndex:-1,"aria-label":"context menu"})};import{jsx as Nu,jsxs as HP}from"react/jsx-runtime";var co="vuuTab",Qx=()=>{},Xx=RP(function({ariaControls:e,children:n,className:r,closeable:o=!1,dragging:i,editable:s=!1,editing:l,focusVisible:a,index:u=-1,label:c,location:f,onClick:d,onClose:h,onEnterEditMode:g=Qx,onExitEditMode:v=Qx,onFocus:p,onKeyUp:m,onMenuAction:y,onMenuClose:x,orientation:b,selected:C,showMenuButton:w=o||s||!!f,tabIndex:S,...E},k){if(w&&typeof y!="function")throw Error("Tab onMenuAction must be provided if showMenuButton is set");let T=Yx(null),D=Yx(null),M=pt(k,T),I=OP(O=>{l||(O.preventDefault(),d==null||d(O,u))},[l,u,d]),R=(O="",B="",P=!0)=>v(O,B,P,u),A=O=>{switch(O.key){case"Backspace":case"Delete":o&&(O.stopPropagation(),h&&h(u));break;default:m&&m(O,u)}},L=()=>s?Nu(Au,{editing:l,defaultValue:c,onEnterEditMode:g,onExitEditMode:R,ref:D},c):c,H=O=>{if(D.current){let P=D.current.querySelector(".vuuEditableLabel-input");P==null||P.focus()}p==null||p(O)};return HP("div",{...E,"aria-controls":e,"aria-selected":C,className:W(co,r,{[`${co}-closeable`]:o,"vuuDraggable-dragAway":i,[`${co}-editing`]:l,[`${co}-selected`]:C||void 0,[`${co}-vertical`]:b==="vertical",vuuFocusVisible:a}),onClick:I,onFocus:H,onKeyUp:A,ref:M,role:"tab",tabIndex:S,children:[Nu("div",{className:`${co}-main`,children:Nu("span",{className:`${co}-text`,"data-text":s?void 0:c,children:n!=null?n:L()})}),w?Nu(Zx,{allowClose:o,allowRename:s,controlledComponentId:e,controlledComponentTitle:c,location:f,onMenuAction:y,onMenuClose:x,index:u}):null]})});import{cloneElement as ew,useRef as NP,useState as tw}from"react";import{jsx as Xs}from"react/jsx-runtime";var gp="vuuHeader",nw=({className:t,contributions:e,collapsed:n,closeable:r,onEditTitle:o,orientation:i="horizontal",style:s,title:l="Untitled"})=>{let a=NP(null),[u,c]=tw(l),[f,d]=tw(!1),h=rw(),g=T=>h==null?void 0:h({type:"remove"},T),v=()=>{var T;(T=a.current)==null||T.focus()},p=T=>{T.stopPropagation()},y=W(gp,t,`${gp}-${n||i}`),x=()=>{d(!0)},b=T=>{T.key==="Enter"&&d(!0)},C=(T="",D="",M=!0,I=!1)=>{var R;d(!1),I?c(T):D!==T&&(c(D),o==null||o(D)),M===!1&&((R=a.current)==null||R.focus())},w=T=>{h==null||h({type:"mousedown"},T)},S=[],E=[],k=[];return e==null||e.forEach((T,D)=>{switch(T.location){case"pre-title":S.push(ew(T.content,{key:D}));break;default:E.push(ew(T.content,{key:D}))}}),l&&S.push(Xs(Au,{className:`${gp}-title`,editing:f,value:u,onChange:c,onMouseDownCapture:v,onEnterEditMode:x,onExitEditMode:C,onKeyDown:b,ref:a,tabIndex:0},"title")),r&&k.push(Xs(Kn,{"data-icon":"close",onClick:g,onMouseDown:p,variant:"secondary"},"close")),E.length>0&&S.push(Xs("div",{className:"vuuTooltrayProxy","data-align":"end",children:E},"contributions")),k.length>0&&S.push(Xs("div",{className:"vuuTooltrayProxy","data-align":"end",children:k},"actions")),Xs("div",{className:W("vuuToolbarProxy",y),style:s,onMouseDown:w,children:S})};import{useCallback as fo,useMemo as ow}from"react";var iw=({id:t,rootRef:e,path:n,dropTargets:r,title:o})=>{let i=pi(),{loadState:s,loadSessionState:l,purgeState:a,saveState:u,saveSessionState:c}=hi(),[f,d]=cu(t,e,n,r),h=ow(()=>{var w;return(w=s("view-title"))!=null?w:o},[s,o]),g=fo(w=>{n&&i({type:"set-title",path:n,title:w})},[i,n]),v=ow(()=>s(t),[t,s]),p=fo(w=>s(t,w),[t,s]),m=fo(w=>{a(t,w),i({type:"save"})},[t,i,a]),y=fo((w,S)=>{u(t,S,w),i({type:"save"})},[t,i,u]),x=fo(w=>l(t,w),[t,l]),b=fo((w,S)=>c(t,S,w),[t,c]),C=fo(({type:w,...S})=>{let{[w]:E}=S;y(E,w)},[y]);return{contributions:d,dispatchViewAction:f,load:p,loadSession:x,onConfigChange:C,onEditTitle:g,purge:m,restoredState:v,save:y,saveSession:b,title:h}};import{useCallback as FP,useLayoutEffect as sw,useRef as BP}from"react";var aw=["height","width"];var ho=new WeakMap,uw=(t,e,n)=>{switch(n){case"height":return e.height;case"scrollHeight":return t.scrollHeight;case"scrollWidth":return t.scrollWidth;case"width":return e.width;default:return 0}},lw=new ResizeObserver(t=>{for(let e of t){let{target:n,contentRect:r}=e,o=ho.get(n);if(o){let{onResize:i,measurements:s}=o,l=!1;for(let[a,u]of Object.entries(s)){let c=uw(n,r,a);c!==u&&(l=!0,s[a]=c)}l&&i&&i(s)}}});function cw(t,e,n,r=!1){let o=BP(e),i=FP(s=>{let l=s.getBoundingClientRect();return o.current.reduce((a,u)=>(a[u]=uw(s,l,u),a),{})},[]);sw(()=>{let s=t.current,l=!1;async function a(){ho.set(s,{measurements:{}}),l=!1;let{fonts:u}=document;if(u&&await u.ready,!l){let c=ho.get(s);if(c){let f=i(s);c.measurements=f,lw.observe(s),r&&n(f)}}}if(s){if(ho.has(s))throw Error("useResizeObserver attemping to observe same element twice");a()}return()=>{s&&ho.has(s)&&(lw.unobserve(s),ho.delete(s),l=!0)}},[t,i,r,n]),sw(()=>{let s=t.current,l=ho.get(s);if(l){if(o.current!==e){o.current=e;let a=i(s);l.measurements=a}l.onResize=n}},[e,i,t,n])}import{useCallback as dw,useRef as fw}from"react";var VP=[],hw=({mainRef:t,resize:e="responsive",rootRef:n})=>{let r=e==="defer",o=fw({}),i=fw(),s=dw(()=>{t.current&&(t.current.style.height=o.current.height+"px",t.current.style.width=o.current.width+"px"),i.current=void 0},[t]),l=dw(({height:a,width:u})=>{o.current.height=a,o.current.width=u,i.current!==null&&clearTimeout(i.current),i.current=window.setTimeout(s,40)},[s]);cw(n,r?aw:VP,l,r)};import zP,{useContext as pw}from"react";var $P={dispatch:null},Fu=zP.createContext($P),rw=()=>{var e;let t=pw(Fu);return(e=t==null?void 0:t.dispatch)!=null?e:null},mw=()=>pw(Fu);import{jsx as vp,jsxs as GP}from"react/jsx-runtime";var el="vuuView",qP=(t,e)=>t&&e?{...t,...e}:t||e,vw=WP(function(e,n){let{Header:r=nw,children:o,className:i,collapsed:s,closeable:l,"data-path":a,"data-resizeable":u,dropTargets:c,expanded:f,flexFill:d,id:h,header:g,orientation:v="horizontal",path:p=a,resize:m="responsive",resizeable:y=u,tearOut:x,style:b={},title:C,...w}=e,S=_P(h),E=gw(null),k=gw(null),[T,D]=jP(),{contributions:M,dispatchViewAction:I,load:R,loadSession:A,onConfigChange:L,onEditTitle:H,purge:O,restoredState:B,save:P,saveSession:F,title:N}=iw({id:S,rootRef:E,path:p,dropTargets:c,title:C});hw({mainRef:k,resize:m,rootRef:E});let z=KP(U=>{D(U)},[]),q=()=>yp.isValidElement(o)&&(B||T)?yp.cloneElement(o,qP(B,T)):o,Z=UP(()=>({dispatch:I,id:S,path:p,title:N,load:R,loadSession:A,onConfigChange:L,purge:O,save:P,saveSession:F,setComponentProps:z}),[I,S,R,A,L,p,O,P,F,z,N]),j=typeof g=="object"?g:{};return vp("div",{...w,className:W(el,i,{[`${el}-collapsed`]:s,[`${el}-expanded`]:f,[`${el}-resize-defer`]:m==="defer"}),"data-resizeable":y,id:S,ref:pt(n,E),style:b,tabIndex:-1,children:GP(Fu.Provider,{value:Z,children:[g?vp(r,{...j,collapsed:s,contributions:M,expanded:f,closeable:l,onEditTitle:H,orientation:v,tearOut:x,title:N}):null,vp("div",{className:`${el}-main`,ref:k,children:q()})]})})});vw.displayName="View";var Bu=yp.memo(vw);Bu.displayName="View";Xn("View",Bu,"view");import{Fragment as YP,jsx as bp,jsxs as yw}from"react/jsx-runtime";var Vu="vuuLayoutStartPanel",bw=t=>{let{dispatch:e,path:n}=mw(),[r,o]=ZP();return JP(()=>{e==null||e({type:"query",path:n,query:"PARENT_CONTAINER"}).then(s=>{(s==null?void 0:s.parentContainerId)==="main-tabs"?o("initial"):o("nested")})},[e,n]),r===void 0?null:yw("div",{...t,className:Vu,children:[r==="initial"?yw(YP,{children:[bp("header",{className:`${Vu}-title`,children:"Start by adding a table"}),bp("div",{className:`${Vu}-text`,children:"To add a table, drag any of the Vuu Tables to this area or click the button below"})]}):null,bp(Kn,{className:`${Vu}-addButton`,"data-icon":"add",variant:"cta"})]})};import{Fragment as eD,jsx as zu}from"react/jsx-runtime";var QP="vuuPlaceholder",XP=({showStartMenu:t=!0})=>zu(eD,{children:t?zu(bw,{}):null}),$u=({className:t,showStartMenu:e,...n})=>{let r=W(QP,t);return zu(Bu,{...n,className:r,"data-placeholder":!0,resizeable:!0,children:zu(XP,{showStartMenu:e})})};$u.displayName="Placeholder";Xn("Placeholder",$u);import{forwardRef as mD}from"react";import{isValidNumber as Cr}from"@vuu-ui/vuu-utils";import{useCallback as rD,useEffect as oD,useMemo as iD,useRef as sD,useState as lD}from"react";import{useCallback as tD,useEffect as xw,useRef as nD}from"react";var po=new Map,Sw=(t,e,n)=>{switch(n){case"height":return e.height;case"clientHeight":return Math.floor(t.clientHeight);case"clientWidth":return Math.floor(t.clientWidth);case"contentHeight":return e.contentHeight;case"contentWidth":return e.contentWidth;case"scrollHeight":return Math.ceil(Math.floor(t.scrollHeight));case"scrollWidth":return Math.ceil(Math.floor(t.scrollWidth));case"width":return e.width;default:return 0}},ww=new ResizeObserver(t=>{for(let e of t){let{target:n,borderBoxSize:r,contentBoxSize:o}=e,i=po.get(n);if(i){let[{blockSize:s,inlineSize:l}]=r,[{blockSize:a,inlineSize:u}]=o,{onResize:c,measurements:f}=i,d=!1;for(let[h,g]of Object.entries(f)){let v=Sw(n,{height:s,width:l,contentHeight:a,contentWidth:u},h);v!==g&&(d=!0,f[h]=v)}d&&c&&c(f)}}});function Cw(t,e,n,r=!1){let o=nD(e),i=tD(s=>{let{width:l,height:a}=s.getBoundingClientRect(),{clientWidth:u,clientHeight:c}=s,f=Math.floor(a),d=Math.floor(l);return o.current.reduce((h,g)=>(h[g]=Sw(s,{width:d,height:f,contentHeight:c,contentWidth:u},g),h),{})},[]);xw(()=>{let s=t.current;async function l(){po.set(s,{measurements:{}});let a=po.get(s);if(a){let u=i(s);a.measurements=u,ww.observe(s),r&&n(u)}else console.log("%cuseResizeObserver an target expected to be under observation wa snot found. This warrants investigation","font-weight:bold; color:red;")}return s&&(po.has(s)&&console.log("useResizeObserver attemping to observe same element twice",{target:s}),l()),()=>{s&&po.has(s)&&(ww.unobserve(s),po.delete(s))}},[i,t]),xw(()=>{let s=t.current,l=po.get(s);if(l){if(o.current!==e){o.current=e;let a=i(s);l.measurements=a}l.onResize=n}},[e,i,t,n])}var aD=["clientHeight","clientWidth"],uD=["clientWidth"],cD=["clientHeight"],dD=[],_u=t=>Number.isFinite(t),fD={height:"100%",width:"auto"},hD=(t,e)=>Cr(t)&&Cr(e)?{height:`${t}px`,width:`${e}px`}:typeof t=="string"||typeof e=="string"?{height:t!=null?t:"100%",width:e!=null?e:"auto"}:fD,pD=(t,e)=>{if(Cr(t)&&Cr(e))return{height:t,width:e}},kw=({defaultHeight:t=0,defaultWidth:e=0,height:n,onResize:r,width:o})=>{let i=sD(null),[s,l]=lD({css:hD(n,o),inner:pD(n,o),outer:{height:n!=null?n:"100%",width:o!=null?o:"auto"}}),a=typeof n=="number",u=typeof o=="number",c=a&&u?dD:a?uD:u?cD:aD;iD(()=>{l(d=>{let{inner:h,outer:g}=d;if(Cr(n)&&Cr(o)&&h&&g){let{height:v,width:p}=h,{height:m,width:y}=g;if(m!==n||y!==o){let x=Cr(m)?m-v:0,b=Cr(y)?y-p:0;return{...d,outer:{height:n,width:o},inner:{height:n-x,width:o-b}}}}return d})},[n,o]);let f=rD(({clientWidth:d,clientHeight:h})=>{let{css:g,inner:v,outer:p}=s,m=s;a&&_u(d)&&Math.floor(d)!==(v==null?void 0:v.width)?m={css:g,outer:p,inner:{width:Math.floor(d)||e,height:n}}:u&&_u(h)&&Math.floor(h)!==(v==null?void 0:v.height)?m={css:g,outer:p,inner:{height:Math.floor(h)||t,width:o}}:_u(h)&&_u(d)&&(d!==(v==null?void 0:v.width)||h!==(v==null?void 0:v.height))&&(m={css:g,outer:p,inner:{width:Math.floor(d)||e,height:Math.floor(h)||t}}),m!==s&&l(m)},[t,e,a,u,n,s,o]);return oD(()=>{s.inner&&(r==null||r(s.inner))},[r,s.inner]),Cw(i,c,f,!0),{containerRef:i,cssSize:s.css,outerSize:s.outer,innerSize:s.inner}};import{jsx as Ew}from"react/jsx-runtime";var xp="vuuMeasuredContainer",Ex=mD(function({children:e,className:n,height:r,onResize:o,style:i,width:s,...l},a){let{containerRef:u,...c}=kw({height:r,onResize:o,width:s}),{cssSize:f,innerSize:d}=c,h=d===void 0,g=()=>h?{"--measured-css-height":`${f.height}`,"--measured-css-width":`${f.width}`}:{...i,"--measured-css-height":`${f.height}`,"--measured-css-width":`${f.width}`,"--measured-px-height":`${d==null?void 0:d.height}px`,"--measured-px-width":`${d==null?void 0:d.width}px`},v=pt(u,a);return h?Ew("div",{...l,className:W(xp,`${xp}-ummeasured`),style:g(),ref:u}):Ew("div",{...l,className:W(xp,n),ref:v,style:g(),children:e})});import{useId as RD}from"@vuu-ui/vuu-utils";import OD,{forwardRef as HD}from"react";import{isValidNumber as LD,MEASURES as PD,useLayoutEffectSkipFirst as DD}from"@vuu-ui/vuu-utils";import{useCallback as Ku,useMemo as Cp,useRef as Hw,useState as AD}from"react";import{getElementByDataIndex as Mw}from"@vuu-ui/vuu-utils";var gD=".vuuOverflowContainer-item:not(.wrapped)",mx=t=>t!==null&&t.dataset.index==="overflow"&&t.parentElement!==null&&t.parentElement.classList.contains("vuuOverflowContainer-wrapContainer-overflowed"),vD=t=>t.sort((e,n)=>{let{dataset:{index:r="?"}}=e,{dataset:{index:o="?"}}=n,i=e.classList.contains("wrapped"),s=n.classList.contains("wrapped"),l=r==="overflow",a=o==="overflow";return i&&!s?1:!i&&s?-1:l?1:a?-1:parseInt(r)>parseInt(o)?1:-1}),wp=[],tl=(t,e="horizontal")=>{let n=[],r=[],o=-1,i=!1,s=vD(Array.from(t.children)),l=e==="vertical"?"top":"left";for(let a of s){let u=a,{dataset:{index:c="?",label:f="?",overflowPriority:d="0"}}=u,{[l]:h}=u.getBoundingClientRect();h<=o?(c==="overflow"?r.push(n.pop()):r.push({index:c,label:f,overflowPriority:d}),i=!0):i?r.push({index:c,label:f,overflowPriority:d}):n.push({index:c,label:f,overflowPriority:d}),o=h}return[n,r]},Tw=(t,e,n)=>{let r=!1,o=n?`${n}-overflowed`:"overflow";e.find(({index:i})=>i==="overflow")&&e.length===1&&(r=!0);for(let i of t.children){let{dataset:{index:s="?"}}=i;e.length===0||r?t.classList.remove(o):t.classList.add(o),s!=="overflow"&&e.find(l=>l.index===s)?i.classList.add("wrapped"):i.classList.remove("wrapped")}},yD=(t,{overflowPriority:e})=>Math.max(t,parseInt(e)),bD=(t,{overflowPriority:e})=>Math.min(t,parseInt(e)),Iw=t=>{var e;return t.length>1&&((e=t.at(-1))==null?void 0:e.index)==="overflow"},xD=t=>{let[e]=t;for(let n=1;n<t.length;n++){let r=t[n];parseInt(r.overflowPriority)>parseInt(e.overflowPriority)&&(e=r)}return e},Lw=(t,e)=>{var o;let n=t.reduce(bD,Number.MAX_SAFE_INTEGER);return e.reduce(yD,0)>n?!0:e.length>1&&((o=e.at(-1))==null?void 0:o.index)==="overflow"},Pw=(t,e)=>new Promise(n=>{requestAnimationFrame(()=>{let[,r]=tl(t);CD(e,r).forEach(i=>wD(t,i)),n(r)})}),Dw=(t,e,n)=>new Promise(r=>{requestAnimationFrame(()=>{let[,o]=tl(t),i=xD(o);if(i){let[s,l]=Sp(t,i);r([s,l])}else r([e,n])})}),wD=(t,e)=>{let n=Mw(t,e.index);if(n)n.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${e.index} not found`)},SD=t=>Array.from(t.querySelectorAll(".wrapped")),CD=(t,e)=>{let n=[];for(let r of e)t.find(({index:o})=>o===r.index)||n.push(r);return n},kD=(t,e)=>{SD(t).forEach(r=>{let{dataset:{index:o="?"}}=r;e.find(i=>i.index===o)||r.classList.remove("wrapped")})},Aw=t=>t.querySelector('[data-index="overflow"]'),ED=t=>t.querySelector(".wrapped"),Wu=t=>parseInt(getComputedStyle(t).getPropertyValue("width")),Rw=(t,e)=>{let{right:n}=t.getBoundingClientRect(),r=parseInt(getComputedStyle(t).getPropertyValue("padding-right")),{right:o}=e.getBoundingClientRect();return n-r-o},Ow=t=>{let e=Aw(t),n=Rw(t,e),r=Wu(e),o=ED(t);return Wu(o)<=n+r?(t.classList.remove("overflowed"),o.classList.remove("wrapped"),!0):!1},MD=(t,e)=>{let{dataset:{index:n="0",overflowPriority:r="0"}}=t,{dataset:{index:o="0",overflowPriority:i="0"}}=e;return r>i?-1:r<i?1:parseInt(n)-parseInt(o)},TD=t=>Array.from(t.querySelectorAll(gD)).sort(MD),Sp=(t,e)=>{let n=TD(t),r=Mw(t,e.index,!0),o=-1,i=n.at(o),s=Wu(i),l=Wu(r),a=Aw(t),u=Rw(t,a)+s;if(u>=l)ID(r,i);else{let{left:d}=i.getBoundingClientRect(),h=u,g=[i];for(;u<l;){o-=1,i=n.at(o),g.push(i);let{left:v}=i.getBoundingClientRect(),p=d-v;u=h+p}r==null||r.classList.remove("wrapped"),g.forEach(v=>{v.classList.add("wrapped")})}let[c,f]=tl(t);return kD(t,f),[c,f]},ID=(t,e)=>{if(!t||!e)throw Error("switchWrapOnElements, element undefined");t.classList.remove("wrapped"),e.classList.add("wrapped")};var Nw=({allowDragDrop:t=!1,itemCount:e,onMoveItem:n,onSwitchWrappedItemIntoView:r,orientation:o="horizontal"})=>{let[i,s]=AD(null),l=Hw(wp),a=Hw(null),u=Ku(x=>{var b;a.current&&((b=a.current.querySelector(".vuuOverflowContainer-OverflowIndicator button"))==null||b.setAttribute("tabindex",x))},[]),c=Ku(async()=>{if(i){let[x,b]=tl(i,o);for(Tw(i,b,"vuuOverflowContainer-wrapContainer"),Iw(b)&&(b=await Pw(i,b));Lw(x,b);)[x,b]=await Dw(i,x,b);b.length===1&&Ow(i)&&(b=wp),l.current.length===0&&b.length>0?u("0"):l.current.length>0&&b.length===0&&u("-1"),l.current=b}},[i,o,u]),f=x=>typeof x=="object"&&x!==null&&"overflowItem"in x,[d,h]=Cp(()=>[()=>{let{current:x}=l;return x.map(b=>({label:b.label,action:`activate-item-${b.index}`,options:{overflowItem:b}}))},({options:x})=>{if(i&&f(x)){let[,b]=Sp(i,x.overflowItem);l.current=b,r==null||r(x.overflowItem)}return!0}],[i,r]),g=Cp(()=>{let{sizeProp:x}=PD[o],b=0;return new ResizeObserver(C=>{for(let w of C){let{[x]:S}=w.contentRect,E=Math.round(S);LD(E)&&b!==E&&(b=E,c())}})},[c,o]);DD(()=>{c()},[c,e]),Cp(()=>{i&&g.observe(i)},[i,g]);let v=Ku(x=>{s(a.current=x)},[]),p=Ku((x,b)=>{n==null||n(x,b)},[n]),{onMouseDown:m,...y}=wi({allowDragDrop:t,containerRef:a,draggableClassName:"vuuOverflowContainer",onDrop:p,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"});return{menuActionHandler:h,menuBuilder:d,onItemMouseDown:m,rootRef:v,...y}};import{jsx as nl,jsxs as ND}from"react/jsx-runtime";var Si="vuuOverflowContainer",Fw=OD.memo(({PopupMenuProps:t,allowDragDrop:e,children:n,className:r,height:o,id:i,onMoveItem:s,onSwitchWrappedItemIntoView:l,orientation:a="horizontal",overflowIcon:u,overflowPosition:c="end"})=>{let f=tu(n),{draggable:d,draggedItemIndex:h,menuActionHandler:g,menuBuilder:v,onItemMouseDown:p,rootRef:m}=Nw({allowDragDrop:e,itemCount:f.length,onMoveItem:s,onSwitchWrappedItemIntoView:l,orientation:a}),x={"--overflow-container-height":`${a==="vertical"?"100%":`${o}px`}`},b=W(`${Si}-wrapContainer`,r,{[`${Si}-horizontal`]:a==="horizontal",[`${Si}-vertical`]:a==="vertical"}),C=f.map((S,E)=>{let{"data-align":k,"data-overflow-priority":T="0",id:D=`${i}-${E}`,label:M=`Item ${E+1}`}=S.props;return nl("div",{className:W(`${Si}-item`,{"vuuDraggable-dragAway":h===E}),"data-index":E,"data-align":k,"data-label":M,"data-overflow-priority":T,id:`${D}-wrapper`,onMouseDown:p,children:S},E)}),w=nl("div",{className:`${Si}-OverflowIndicator`,"data-index":"overflow",children:nl(lu,{...t,icon:u,menuBuilder:v,menuActionHandler:g,tabIndex:-1})},"overflow");return C.push(w),ND("div",{className:b,ref:m,style:x,children:[C,d]})});Fw.displayName="OverflowContainer.InnerContainer";var Jx=HD(function({PopupMenuProps:e,allowDragDrop:n=!1,children:r,className:o,height:i=44,id:s,onMoveItem:l,onSwitchWrappedItemIntoView:a,orientation:u,overflowIcon:c,overflowPosition:f,...d},h){let g=RD(s);return nl("div",{...d,className:W(W(o,Si)),id:g,ref:h,children:nl(Fw,{PopupMenuProps:e,allowDragDrop:n,height:i,id:g,orientation:u,overflowIcon:c,overflowPosition:f,onMoveItem:l,onSwitchWrappedItemIntoView:a,children:r})})});import{useId as FD}from"@vuu-ui/vuu-utils";import Mp,{forwardRef as BD,useCallback as VD,useRef as zD}from"react";import{jsx as Ep,jsxs as KD}from"react/jsx-runtime";var kp="vuuTabs",$D=()=>{},_D=t=>{let e=[];return Mp.Children.forEach(t,n=>{Mp.isValidElement(n)?e.push(n):console.warn("Stack has unexpected child element type")}),e},WD={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},Tp=BD(function({TabstripProps:e=WD,active:n=0,children:r,className:o,getTabIcon:i=$D,getTabLabel:s=uu,id:l,keyBoardActivation:a="manual",onAddTab:u,onMoveTab:c,onTabClose:f,onTabEdit:d,onTabSelectionChanged:h,showTabs:g="top",style:v},p){var M;let m=FD(l),y=zD([]),{allowCloseTab:x,allowRenameTab:b,className:C}=e,w=VD((I,R,A,L)=>{d==null||d(L,R)},[d]),S=()=>{var I;return Mp.isValidElement(r)?r:Array.isArray(r)&&(I=r[n])!=null?I:null},E=()=>_D(r).map((I,R)=>{let{closeable:A=x,id:L=`${m}-${R}`,"data-tab-location":H}=I.props,O=s(I,R,y.current);return y.current.push(O),Ep(Xx,{ariaControls:L,"data-icon":i(I,R),id:`${L}-tab`,index:R,label:O,location:H,closeable:A,editable:b},L)}),k=S(),T=g==="left"||g==="right",D=T?"vertical":"horizontal";return KD("div",{className:W(kp,o,{[`${kp}-horizontal`]:T}),style:v,id:m,ref:p,children:[g?Ep(Gx,{...e,activeTabIndex:(M=e==null?void 0:e.activeTabIndex)!=null?M:k===null?-1:n,allowDragDrop:e.allowDragDrop!==!1,animateSelectionThumb:!0,className:W("vuuTabHeader",C),"aria-label":"data tabs",keyBoardActivation:a,onActiveChange:h,onAddTab:u,onCloseTab:f,onExitEditMode:w,onMoveTab:c,orientation:D,children:E()}):null,Ep("div",{"aria-labelledby":`${m}-${n}`,className:`${kp}-tabPanel`,role:"tabpanel",children:k})]})});Tp.displayName="Stack";import{useId as UD}from"@vuu-ui/vuu-utils";import jD,{useCallback as Ip,useRef as qD}from"react";import{jsx as Bw}from"react/jsx-runtime";var GD=()=>Bw($u,{resizeable:!0,style:{flexGrow:1,flexShrink:0,flexBasis:0}}),Uu=t=>{var C;let e=qD(null),n=pi(),{loadState:r}=hi(),{createNewChild:o,id:i,onTabSelectionChanged:s,path:l,...a}=t,{children:u}=t,c=UD(i),[f]=cu(c,e,l),d=zb(),h=(C=o!=null?o:d)!=null?C:GD,g=w=>{l&&(n({type:"switch-tab",id:c,path:l,nextIdx:w}),s==null||s(w))},v=Ip(w=>{if(Array.isArray(u)){let{props:{"data-path":S,path:E=S}}=u[w];n({type:"remove",path:E})}},[u,n]),p=Ip(()=>{if(l){let w=jD.Children.count(u),S=h(w);n({type:"add",path:l,component:S})}},[u,h,n,l]),m=Ip((w,S)=>{l&&n({fromIndex:w,toIndex:S,path:l,type:"move-child"})},[n,l]);return Bw(Tp,{...a,id:c,getTabLabel:(w,S,E)=>{let{id:k,title:T}=w.props;return r(k,"view-title")||T||uu(w,S,E)},onMouseDown:async(w,S)=>{let E;await f({type:"mousedown",index:S,preDragActivity:async()=>new Promise(D=>{console.log("preDragActivity: Ok, gonna release the drag"),E=D})},w)&&(E==null||E(void 0))},onMoveTab:m,onAddTab:p,onTabClose:v,onTabEdit:(w,S)=>{n({type:"set-title",path:`${l}.${w}`,title:S})},onTabSelectionChanged:g,ref:e})};Uu.displayName="Stack";Xn("Stack",Uu,"container");import{useCallback as mj,useEffect as gj,useRef as vj,useState as yj}from"react";import{useMemo as oj}from"react";import{jsx as sj,jsxs as lj}from"react/jsx-runtime";import{jsx as Cj,jsxs as kj}from"react/jsx-runtime";import{getCookieValue as Tj}from"@vuu-ui/vuu-utils";import{jsx as _j,jsxs as Wj}from"react/jsx-runtime";import Zj,{useEffect as Yj,useState as Qj}from"react";import{Fragment as rq,jsx as oq,jsxs as nq}from"react/jsx-runtime";import _w,{Suspense as XD,useEffect as e6}from"react";import JD from"react";import{Fragment as ZD,jsx as Vw,jsxs as YD}from"react/jsx-runtime";var ju=class extends JD.Component{constructor(e){super(e),this.state={errorMessage:null}}static getDerivedStateFromError(e){return{errorMessage:e.message}}componentDidCatch(e,n){console.log(`error creating component at ${this.props.url}`),console.log(e,n)}render(){return this.state.errorMessage?YD(ZD,{children:[Vw("h1",{children:"An error occured while creating component."}),Vw("p",{children:this.state.errorMessage})]}):this.props.children}};import{jsx as QD}from"react/jsx-runtime";var zw=()=>QD("div",{className:"hwLoader"});var $w=async t=>{let e=new CSSStyleSheet;return fetch(t).then(n=>n.text()).then(n=>e.replace(n))};import{jsx as Gu}from"react/jsx-runtime";var qu=new Map,t6=t=>{e6(()=>()=>{qu.delete(t)},[t]),qu.has(t)||qu.set(t,_w.lazy(()=>import(t)));let e=qu.get(t);if(e)return e;throw Error(`Unable to load Lazy Feature at url ${t}`)};function n6({url:t,css:e,ComponentProps:n,...r}){e&&$w(e).then(i=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,i]});let o=t6(t);return Gu(ju,{url:t,children:Gu(XD,{fallback:Gu(zw,{}),children:Gu(o,{...r,...n})})})}var Lp=_w.memo(n6);Lp.displayName="Feature";Xn("Feature",Lp,"view");import{useEffect as TG,useMemo as IG,useState as LG}from"react";import{jsx as OG,jsxs as HG}from"react/jsx-runtime";var l6="saveLayoutPanel",AG=`${l6}-formField`;import fR,{useCallback as Jte,useContext as Zte,useEffect as Yte,useRef as Qte,useState as Xte}from"react";var Dp={layout:{type:"Stack",id:"main-tabs",props:{className:"vuuShell-mainTabs",TabstripProps:{allowAddTab:!0,allowCloseTab:!0,allowRenameTab:!0,animateSelectionThumb:!1,location:"main-tab",tabClassName:"MainTab"},preserve:!0,active:0},children:[{props:{id:"tab1",title:"Tab 1",className:"vuuShell-Placeholder"},type:"Placeholder"}]}};import{useRef as SQ}from"react";import{useCallback as _G,useRef as WG}from"react";import{Fragment as GG,jsx as jG,jsxs as qG}from"react/jsx-runtime";import{itemToString as a6}from"@vuu-ui/vuu-utils";import{forwardRef as u6,useCallback as Ju,useMemo as c6,useRef as d6,useState as f6}from"react";import{jsx as qw}from"react/jsx-runtime";var jw="vuuExpandoCombobox",h6={},rl=u6(function({className:e,InputProps:n=h6,ListProps:r,onInputChange:o,onSelectionChange:i,selectionStrategy:s,style:l,value:a="",...u},c){let[f,d]=f6(a),{itemToString:h=a6}=u,g=d6(a),v=Ju(w=>{let[S,...E]=w;return E.length?`${h(S)} + ${E.length}`:h(S)},[h]),p=Ju(w=>{let{value:S}=w.target;d(S),o==null||o(w)},[o]),m=Ju(w=>{d(w)},[]),[y,x]=c6(()=>{let{inputProps:w,...S}=n;return[{...S,className:`${jw}-Input`,endAdornment:null,inputProps:{...w,autoComplete:"off",onInput:p}},{...r,className:W("vuuMenuList",r==null?void 0:r.className),"data-mode":"light",displayedItemCount:10,itemHeight:22,maxWidth:300,minWidth:80,width:"content-width"}]},[n,p,r]),b=Ju((w,S)=>{Array.isArray(S)?i==null||i(null,S):S&&(d(h(S)),i==null||i(null,S))},[h,i]),C={minWidth:"fit-content"};return qw("div",{className:W(jw,e),"data-text":f,ref:c,style:l,children:qw(Ix,{...u,PopupProps:C,defaultValue:g.current,fullWidth:!0,ListProps:x,InputProps:y,itemsToString:v,onSelectionChange:b,onSetSelectedText:m,selectionStrategy:s})})});import{useCallback as uZ}from"react";import{forwardRef as p6,useState as m6,useCallback as Gw}from"react";import{isValidNumber as Ap}from"@vuu-ui/vuu-utils";import{jsx as v6}from"react/jsx-runtime";var g6=p6(function({InputProps:e,className:n,column:r,onInputComplete:o,value:i},s){let[l,a]=m6(Ap(i)?i.toString():""),u=Gw(f=>{let{value:d}=f.target,h=parseFloat(d);Ap(h)&&console.log("its valid"),a(d)},[]),c=Gw(f=>{if(f.key==="Enter"){let{value:d}=f.target,h=parseFloat(d);Ap(h)&&o(h)}},[o]);return v6(Ru,{...e,className:n,value:l,ref:s,onChange:u,onKeyDown:c})});import{isNumericColumn as EJ,isTextColumn as MJ}from"@vuu-ui/vuu-utils";import{forwardRef as y6,useCallback as Zu,useEffect as b6,useMemo as x6,useState as Jw}from"react";import{jsx as Yu}from"react/jsx-runtime";var w6=["Enter"," "],Zw=["No matching data"],S6=y6(function({InputProps:e={},className:n,column:r,"data-field":o,onDeselect:i,onInputComplete:s,operator:l,suggestionProvider:a=Rp,table:u,value:c},f){let[d,h]=Jw(c!=null?c:""),[g,v]=Jw([]),p=a(),m=Zu((w,S)=>s(S),[s]),y=Zu((w,S)=>s(S),[s]);b6(()=>{if(u){let w=d?[u,r.name,d]:[u,r.name];p(w).then(S=>{S.length===0&&d?v(Zw):v(S)}).catch(S=>{console.error("Error getting suggestions",S)})}},[u,r,d,p]);let x=Zu(w=>{let{value:S}=w.target;h(S)},[]),b=x6(()=>{if(l==="starts"||l==="ends"){let{inputProps:w,...S}=e;return{...S,inputProps:{...w,onKeyDown:E=>{var k;E.key==="Enter"&&d!==""?(E.stopPropagation(),E.preventDefault(),s(d)):(k=w==null?void 0:w.onKeyDown)==null||k.call(w,E)}}}}else return e},[e,s,l,d]);return Zu(()=>{if(g.length===0)return null;switch(l){case"in":return Yu(rl,{InputProps:b,className:n,"data-field":o,initialHighlightedIndex:0,source:g,onInputChange:x,onSelectionChange:y,ref:f,selectionStrategy:"multiple",selectionKeys:w6,value:c});case"starts":return Yu(rl,{InputProps:b,ListProps:{className:"vuuIllustrationsOnly",disabled:!0},allowFreeText:!0,className:n,"data-field":o,initialHighlightedIndex:0,disableFilter:g===Zw&&(d==null?void 0:d.length)>0,source:g,onInputChange:x,onSelectionChange:m,ref:f,value:c});case"ends":return Yu(Ru,{...b,className:n,"data-field":o,value:d,ref:f,onChange:x});default:return Yu(rl,{InputProps:b,allowBackspaceClearsSelection:!0,className:n,"data-field":o,initialHighlightedIndex:0,source:g,title:"value",onInputChange:x,onDeselect:i,onSelectionChange:m,ref:f,value:c})}},[l,b,n,o,g,x,y,f,c,d,i,m])()});import{getColumnByName as WJ,isMultiValueFilter as KJ,isSingleValueFilter as UJ,isValidFilterClauseOp as jJ}from"@vuu-ui/vuu-utils";import{useCallback as ZJ,useEffect as YJ,useMemo as QJ,useRef as XJ,useState as eZ}from"react";import{jsx as yZ,jsxs as bZ}from"react/jsx-runtime";import{filterAsQuery as hY,isMultiClauseFilter as pY,useId as mY}from"@vuu-ui/vuu-utils";import{useCallback as bY,useRef as xY}from"react";import{useMemo as RZ}from"react";import{jsx as VZ}from"react/jsx-runtime";import{extractFilterForColumn as KZ,isAndFilter as UZ,isInFilter as jZ,isMultiClauseFilter as qZ,isMultiValueFilter as GZ,isOrFilter as JZ,isSingleValueFilter as ZZ,partition as YZ}from"@vuu-ui/vuu-utils";import{filterValue as eY,isMultiClauseFilter as tY,isMultiValueFilter as nY,quotedStrings as rY}from"@vuu-ui/vuu-utils";import{jsx as iY,jsxs as sY}from"react/jsx-runtime";import{jsx as MY,jsxs as TY}from"react/jsx-runtime";import{dispatchMouseEvent as zY,filterAsQuery as $Y,isMultiClauseFilter as _Y}from"@vuu-ui/vuu-utils";import{useCallback as GY,useEffect as JY,useMemo as ZY,useRef as YY,useState as QY}from"react";import{useCallback as RY}from"react";import{useCallback as rQ,useMemo as oQ}from"react";import{jsx as uQ}from"react/jsx-runtime";import{jsx as RQ,jsxs as OQ}from"react/jsx-runtime";import{createElement as AQ}from"react";var de=class t{lineAt(e){if(e<0||e>this.length)throw new RangeError(`Invalid position ${e} in document of length ${this.length}`);return this.lineInner(e,!1,1,0)}line(e){if(e<1||e>this.lines)throw new RangeError(`Invalid line number ${e} in ${this.lines}-line document`);return this.lineInner(e,!0,1,0)}replace(e,n,r){let o=[];return this.decompose(0,e,o,2),r.length&&r.decompose(0,r.length,o,3),this.decompose(n,this.length,o,1),ki.from(o,this.length-(n-e)+r.length)}append(e){return this.replace(this.length,this.length,e)}slice(e,n=this.length){let r=[];return this.decompose(e,n,r,0),ki.from(r,n-e)}eq(e){if(e==this)return!0;if(e.length!=this.length||e.lines!=this.lines)return!1;let n=this.scanIdentical(e,1),r=this.length-this.scanIdentical(e,-1),o=new vo(this),i=new vo(e);for(let s=n,l=n;;){if(o.next(s),i.next(s),s=0,o.lineBreak!=i.lineBreak||o.done!=i.done||o.value!=i.value)return!1;if(l+=o.value.length,o.done||l>=r)return!0}}iter(e=1){return new vo(this,e)}iterRange(e,n=this.length){return new tc(this,e,n)}iterLines(e,n){let r;if(e==null)r=this.iter();else{n==null&&(n=this.lines+1);let o=this.line(e).from;r=this.iterRange(o,Math.max(o,n==this.lines+1?this.length:n<=1?0:this.line(n-1).to))}return new nc(r)}toString(){return this.sliceString(0)}toJSON(){let e=[];return this.flatten(e),e}constructor(){}static of(e){if(e.length==0)throw new RangeError("A document must have at least one line");return e.length==1&&!e[0]?t.empty:e.length<=32?new Rt(e):ki.from(Rt.split(e,[]))}},Rt=class t extends de{constructor(e,n=k6(e)){super(),this.text=e,this.length=n}get lines(){return this.text.length}get children(){return null}lineInner(e,n,r,o){for(let i=0;;i++){let s=this.text[i],l=o+s.length;if((n?r:l)>=e)return new Np(o,l,r,s);o=l+1,r++}}decompose(e,n,r,o){let i=e<=0&&n>=this.length?this:new t(Yw(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(o&1){let s=r.pop(),l=ec(i.text,s.text.slice(),0,i.length);if(l.length<=32)r.push(new t(l,s.length+i.length));else{let a=l.length>>1;r.push(new t(l.slice(0,a)),new t(l.slice(a)))}}else r.push(i)}replace(e,n,r){if(!(r instanceof t))return super.replace(e,n,r);let o=ec(this.text,ec(r.text,Yw(this.text,0,e)),n),i=this.length+r.length-(n-e);return o.length<=32?new t(o,i):ki.from(t.split(o,[]),i)}sliceString(e,n=this.length,r=`
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
`,this;e--}else if(o instanceof Rt){let a=o.text[s+(n<0?-1:0)];if(this.offsets[r]+=n,a.length>Math.max(0,e))return this.value=e==0?a:n>0?a.slice(e):a.slice(0,a.length-e),this;e-=a.length}else{let a=o.children[s+(n<0?-1:0)];e>a.length?(e-=a.length,this.offsets[r]+=n):(n<0&&this.offsets[r]--,this.nodes.push(a),this.offsets.push(n>0?1:(a instanceof Rt?a.text.length:a.children.length)<<1))}}}next(e=0){return e<0&&(this.nextInner(-e,-this.dir),e=this.value.length),this.nextInner(e,this.dir)}},tc=class{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new vo(e,n>r?-1:1),this.pos=n>r?e.length:0,this.from=Math.min(n,r),this.to=Math.max(n,r)}nextInner(e,n){if(n<0?this.pos<=this.from:this.pos>=this.to)return this.value="",this.done=!0,this;e+=Math.max(0,n<0?this.pos-this.to:this.from-this.pos);let r=n<0?this.pos-this.from:this.to-this.pos;e>r&&(e=r),r-=e;let{value:o}=this.cursor.next(e);return this.pos+=(o.length+e)*n,this.value=o.length<=r?o:n<0?o.slice(o.length-r):o.slice(0,r),this.done=!this.value,this}next(e=0){return e<0?e=Math.max(e,this.from-this.pos):e>0&&(e=Math.min(e,this.to-this.pos)),this.nextInner(e,this.cursor.dir)}get lineBreak(){return this.cursor.lineBreak&&this.value!=""}},nc=class{constructor(e){this.inner=e,this.afterBreak=!0,this.value="",this.done=!1}next(e=0){let{done:n,lineBreak:r,value:o}=this.inner.next(e);return n?(this.done=!0,this.value=""):r?this.afterBreak?this.value="":(this.afterBreak=!0,this.next()):(this.value=o,this.afterBreak=!1),this}get lineBreak(){return!1}};typeof Symbol<"u"&&(de.prototype[Symbol.iterator]=function(){return this.iter()},vo.prototype[Symbol.iterator]=tc.prototype[Symbol.iterator]=nc.prototype[Symbol.iterator]=function(){return this});var Np=class{constructor(e,n,r,o){this.from=e,this.to=n,this.number=r,this.text=o}get length(){return this.to-this.from}},Ei="lc,34,7n,7,7b,19,,,,2,,2,,,20,b,1c,l,g,,2t,7,2,6,2,2,,4,z,,u,r,2j,b,1m,9,9,,o,4,,9,,3,,5,17,3,3b,f,,w,1j,,,,4,8,4,,3,7,a,2,t,,1m,,,,2,4,8,,9,,a,2,q,,2,2,1l,,4,2,4,2,2,3,3,,u,2,3,,b,2,1l,,4,5,,2,4,,k,2,m,6,,,1m,,,2,,4,8,,7,3,a,2,u,,1n,,,,c,,9,,14,,3,,1l,3,5,3,,4,7,2,b,2,t,,1m,,2,,2,,3,,5,2,7,2,b,2,s,2,1l,2,,,2,4,8,,9,,a,2,t,,20,,4,,2,3,,,8,,29,,2,7,c,8,2q,,2,9,b,6,22,2,r,,,,,,1j,e,,5,,2,5,b,,10,9,,2u,4,,6,,2,2,2,p,2,4,3,g,4,d,,2,2,6,,f,,jj,3,qa,3,t,3,t,2,u,2,1s,2,,7,8,,2,b,9,,19,3,3b,2,y,,3a,3,4,2,9,,6,3,63,2,2,,1m,,,7,,,,,2,8,6,a,2,,1c,h,1r,4,1c,7,,,5,,14,9,c,2,w,4,2,2,,3,1k,,,2,3,,,3,1m,8,2,2,48,3,,d,,7,4,,6,,3,2,5i,1m,,5,ek,,5f,x,2da,3,3x,,2o,w,fe,6,2x,2,n9w,4,,a,w,2,28,2,7k,,3,,4,,p,2,5,,47,2,q,i,d,,12,8,p,b,1a,3,1c,,2,4,2,2,13,,1v,6,2,2,2,2,c,,8,,1b,,1f,,,3,2,2,5,2,,,16,2,8,,6m,,2,,4,,fn4,,kh,g,g,g,a6,2,gt,,6a,,45,5,1ae,3,,2,5,4,14,3,4,,4l,2,fx,4,ar,2,49,b,4w,,1i,f,1k,3,1d,4,2,2,1x,3,10,5,,8,1q,,c,2,1g,9,a,4,2,,2n,3,2,,,2,6,,4g,,3,8,l,2,1l,2,,,,,m,,e,7,3,5,5f,8,2,3,,,n,,29,,2,6,,,2,,,2,,2,6j,,2,4,6,2,,2,r,2,2d,8,2,,,2,2y,,,,2,6,,,2t,3,2,4,,5,77,9,,2,6t,,a,2,,,4,,40,4,2,2,4,,w,a,14,6,2,4,8,,9,6,2,3,1a,d,,2,ba,7,,6,,,2a,m,2,7,,2,,2,3e,6,3,,,2,,7,,,20,2,3,,,,9n,2,f0b,5,1n,7,t4,,1r,4,29,,f5k,2,43q,,,3,4,5,8,8,2,7,u,4,44,3,1iz,1j,4,1e,8,,e,,m,5,,f,11s,7,,h,2,7,,2,,5,79,7,c5,4,15s,7,31,7,240,5,gx7k,2o,3k,6o".split(",").map(t=>t?parseInt(t,36):1);for(let t=1;t<Ei.length;t++)Ei[t]+=Ei[t-1];function E6(t){for(let e=1;e<Ei.length;e+=2)if(Ei[e]>t)return Ei[e-1]<=t;return!1}function Qw(t){return t>=127462&&t<=127487}var Xw=8205;function ut(t,e,n=!0,r=!0){return(n?iS:M6)(t,e,r)}function iS(t,e,n){if(e==t.length)return e;e&&sS(t.charCodeAt(e))&&lS(t.charCodeAt(e-1))&&e--;let r=Mn(t,e);for(e+=yo(r);e<t.length;){let o=Mn(t,e);if(r==Xw||o==Xw||n&&E6(o))e+=yo(o),r=o;else if(Qw(o)){let i=0,s=e-2;for(;s>=0&&Qw(Mn(t,s));)i++,s-=2;if(i%2==0)break;e+=2}else break}return e}function M6(t,e,n){for(;e>0;){let r=iS(t,e-2,n);if(r<e)return r;e--}return 0}function sS(t){return t>=56320&&t<57344}function lS(t){return t>=55296&&t<56320}function Mn(t,e){let n=t.charCodeAt(e);if(!lS(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return sS(r)?(n-55296<<10)+(r-56320)+65536:n}function aS(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function yo(t){return t<65536?1:2}var Fp=/\r\n?|\n/,at=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(at||(at={})),qn=class t{constructor(e){this.sections=e}get length(){let e=0;for(let n=0;n<this.sections.length;n+=2)e+=this.sections[n];return e}get newLength(){let e=0;for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n+1];e+=r<0?this.sections[n]:r}return e}get empty(){return this.sections.length==0||this.sections.length==2&&this.sections[1]<0}iterGaps(e){for(let n=0,r=0,o=0;n<this.sections.length;){let i=this.sections[n++],s=this.sections[n++];s<0?(e(r,o,i),o+=i):o+=s,r+=i}}iterChangedRanges(e,n=!1){Bp(this,e,n)}get invertedDesc(){let e=[];for(let n=0;n<this.sections.length;){let r=this.sections[n++],o=this.sections[n++];o<0?e.push(r,o):e.push(o,r)}return new t(e)}composeDesc(e){return this.empty?e:e.empty?this:uS(this,e)}mapDesc(e,n=!1){return e.empty?this:Vp(this,e,n)}mapPos(e,n=-1,r=at.Simple){let o=0,i=0;for(let s=0;s<this.sections.length;){let l=this.sections[s++],a=this.sections[s++],u=o+l;if(a<0){if(u>e)return i+(e-o);i+=l}else{if(r!=at.Simple&&u>=e&&(r==at.TrackDel&&o<e&&u>e||r==at.TrackBefore&&o<e||r==at.TrackAfter&&u>e))return null;if(u>e||u==e&&n<0&&!l)return e==o||n<0?i:i+a;i+=a}o=u}if(e>o)throw new RangeError(`Position ${e} is out of range for changeset of length ${o}`);return i}touchesRange(e,n=e){for(let r=0,o=0;r<this.sections.length&&o<=n;){let i=this.sections[r++],s=this.sections[r++],l=o+i;if(s>=0&&o<=n&&l>=e)return o<e&&l>n?"cover":!0;o=l}return!1}toString(){let e="";for(let n=0;n<this.sections.length;){let r=this.sections[n++],o=this.sections[n++];e+=(e?" ":"")+r+(o>=0?":"+o:"")}return e}toJSON(){return this.sections}static fromJSON(e){if(!Array.isArray(e)||e.length%2||e.some(n=>typeof n!="number"))throw new RangeError("Invalid JSON representation of ChangeDesc");return new t(e)}static create(e){return new t(e)}},yt=class t extends qn{constructor(e,n){super(e),this.inserted=n}apply(e){if(this.length!=e.length)throw new RangeError("Applying change set to a document with the wrong length");return Bp(this,(n,r,o,i,s)=>e=e.replace(o,o+(r-n),s),!1),e}mapDesc(e,n=!1){return Vp(this,e,n,!0)}invert(e){let n=this.sections.slice(),r=[];for(let o=0,i=0;o<n.length;o+=2){let s=n[o],l=n[o+1];if(l>=0){n[o]=l,n[o+1]=s;let a=o>>1;for(;r.length<a;)r.push(de.empty);r.push(s?e.slice(i,i+s):de.empty)}i+=s}return new t(n,r)}compose(e){return this.empty?e:e.empty?this:uS(this,e,!0)}map(e,n=!1){return e.empty?this:Vp(this,e,n,!0)}iterChanges(e,n=!1){Bp(this,e,n)}get desc(){return qn.create(this.sections)}filter(e){let n=[],r=[],o=[],i=new bo(this);e:for(let s=0,l=0;;){let a=s==e.length?1e9:e[s++];for(;l<a||l==a&&i.len==0;){if(i.done)break e;let c=Math.min(i.len,a-l);lt(o,c,-1);let f=i.ins==-1?-1:i.off==0?i.ins:0;lt(n,c,f),f>0&&kr(r,n,i.text),i.forward(c),l+=c}let u=e[s++];for(;l<u;){if(i.done)break e;let c=Math.min(i.len,u-l);lt(n,c,-1),lt(o,c,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(c),l+=c}}return{changes:new t(n,r),filtered:qn.create(o)}}toJSON(){let e=[];for(let n=0;n<this.sections.length;n+=2){let r=this.sections[n],o=this.sections[n+1];o<0?e.push(r):o==0?e.push([r]):e.push([r].concat(this.inserted[n>>1].toJSON()))}return e}static of(e,n,r){let o=[],i=[],s=0,l=null;function a(c=!1){if(!c&&!o.length)return;s<n&<(o,n-s,-1);let f=new t(o,i);l=l?l.compose(f.map(l)):f,o=[],i=[],s=0}function u(c){if(Array.isArray(c))for(let f of c)u(f);else if(c instanceof t){if(c.length!=n)throw new RangeError(`Mismatched change set length (got ${c.length}, expected ${n})`);a(),l=l?l.compose(c.map(l)):c}else{let{from:f,to:d=f,insert:h}=c;if(f>d||f<0||d>n)throw new RangeError(`Invalid change range ${f} to ${d} (in doc of length ${n})`);let g=h?typeof h=="string"?de.of(h.split(r||Fp)):h:de.empty,v=g.length;if(f==d&&v==0)return;f<s&&a(),f>s&<(o,f-s,-1),lt(o,d-f,v),kr(i,o,g),s=d}}return u(e),a(!l),l}static empty(e){return new t(e?[e,-1]:[],[])}static fromJSON(e){if(!Array.isArray(e))throw new RangeError("Invalid JSON representation of ChangeSet");let n=[],r=[];for(let o=0;o<e.length;o++){let i=e[o];if(typeof i=="number")n.push(i,-1);else{if(!Array.isArray(i)||typeof i[0]!="number"||i.some((s,l)=>l&&typeof s!="string"))throw new RangeError("Invalid JSON representation of ChangeSet");if(i.length==1)n.push(i[0],0);else{for(;r.length<o;)r.push(de.empty);r[o]=de.of(i.slice(1)),n.push(i[0],r[o].length)}}}return new t(n,r)}static createSet(e,n){return new t(e,n)}};function lt(t,e,n,r=!1){if(e==0&&n<=0)return;let o=t.length-2;o>=0&&n<=0&&n==t[o+1]?t[o]+=e:e==0&&t[o]==0?t[o+1]+=n:r?(t[o]+=e,t[o+1]+=n):t.push(e,n)}function kr(t,e,n){if(n.length==0)return;let r=e.length-2>>1;if(r<t.length)t[t.length-1]=t[t.length-1].append(n);else{for(;t.length<r;)t.push(de.empty);t.push(n)}}function Bp(t,e,n){let r=t.inserted;for(let o=0,i=0,s=0;s<t.sections.length;){let l=t.sections[s++],a=t.sections[s++];if(a<0)o+=l,i+=l;else{let u=o,c=i,f=de.empty;for(;u+=l,c+=a,a&&r&&(f=f.append(r[s-2>>1])),!(n||s==t.sections.length||t.sections[s+1]<0);)l=t.sections[s++],a=t.sections[s++];e(o,u,i,c,f),o=u,i=c}}}function Vp(t,e,n,r=!1){let o=[],i=r?[]:null,s=new bo(t),l=new bo(e);for(let a=-1;;)if(s.ins==-1&&l.ins==-1){let u=Math.min(s.len,l.len);lt(o,u,-1),s.forward(u),l.forward(u)}else if(l.ins>=0&&(s.ins<0||a==s.i||s.off==0&&(l.len<s.len||l.len==s.len&&!n))){let u=l.len;for(lt(o,l.ins,-1);u;){let c=Math.min(s.len,u);s.ins>=0&&a<s.i&&s.len<=c&&(lt(o,0,s.ins),i&&kr(i,o,s.text),a=s.i),s.forward(c),u-=c}l.next()}else if(s.ins>=0){let u=0,c=s.len;for(;c;)if(l.ins==-1){let f=Math.min(c,l.len);u+=f,c-=f,l.forward(f)}else if(l.ins==0&&l.len<c)c-=l.len,l.next();else break;lt(o,u,a<s.i?s.ins:0),i&&a<s.i&&kr(i,o,s.text),a=s.i,s.forward(s.len-c)}else{if(s.done&&l.done)return i?yt.createSet(o,i):qn.create(o);throw new Error("Mismatched change set lengths")}}function uS(t,e,n=!1){let r=[],o=n?[]:null,i=new bo(t),s=new bo(e);for(let l=!1;;){if(i.done&&s.done)return o?yt.createSet(r,o):qn.create(r);if(i.ins==0)lt(r,i.len,0,l),i.next();else if(s.len==0&&!s.done)lt(r,0,s.ins,l),o&&kr(o,r,s.text),s.next();else{if(i.done||s.done)throw new Error("Mismatched change set lengths");{let a=Math.min(i.len2,s.len),u=r.length;if(i.ins==-1){let c=s.ins==-1?-1:s.off?0:s.ins;lt(r,a,c,l),o&&c&&kr(o,r,s.text)}else s.ins==-1?(lt(r,i.off?0:i.len,a,l),o&&kr(o,r,i.textBit(a))):(lt(r,i.off?0:i.len,s.off?0:s.ins,l),o&&!s.off&&kr(o,r,s.text));l=(i.ins>a||s.ins>=0&&s.len>a)&&(l||r.length>u),i.forward2(a),s.forward(a)}}}}var bo=class{constructor(e){this.set=e,this.i=0,this.next()}next(){let{sections:e}=this.set;this.i<e.length?(this.len=e[this.i++],this.ins=e[this.i++]):(this.len=0,this.ins=-2),this.off=0}get done(){return this.ins==-2}get len2(){return this.ins<0?this.len:this.ins}get text(){let{inserted:e}=this.set,n=this.i-2>>1;return n>=e.length?de.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?de.empty:n[r].slice(this.off,e==null?void 0:this.off+e)}forward(e){e==this.len?this.next():(this.len-=e,this.off+=e)}forward2(e){this.ins==-1?this.forward(e):e==this.ins?this.next():(this.ins-=e,this.off+=e)}},Ci=class t{constructor(e,n,r){this.from=e,this.to=n,this.flags=r}get anchor(){return this.flags&16?this.to:this.from}get head(){return this.flags&16?this.from:this.to}get empty(){return this.from==this.to}get assoc(){return this.flags&4?-1:this.flags&8?1:0}get bidiLevel(){let e=this.flags&3;return e==3?null:e}get goalColumn(){let e=this.flags>>5;return e==33554431?void 0:e}map(e,n=-1){let r,o;return this.empty?r=o=e.mapPos(this.from,n):(r=e.mapPos(this.from,1),o=e.mapPos(this.to,-1)),r==this.from&&o==this.to?this:new t(r,o,this.flags)}extend(e,n=e){if(e<=this.anchor&&n>=this.anchor)return $.range(e,n);let r=Math.abs(e-this.anchor)>Math.abs(n-this.anchor)?e:n;return $.range(this.anchor,r)}eq(e){return this.anchor==e.anchor&&this.head==e.head}toJSON(){return{anchor:this.anchor,head:this.head}}static fromJSON(e){if(!e||typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid JSON representation for SelectionRange");return $.range(e.anchor,e.head)}static create(e,n,r){return new t(e,n,r)}},$=class t{constructor(e,n){this.ranges=e,this.mainIndex=n}map(e,n=-1){return e.empty?this:t.create(this.ranges.map(r=>r.map(e,n)),this.mainIndex)}eq(e){if(this.ranges.length!=e.ranges.length||this.mainIndex!=e.mainIndex)return!1;for(let n=0;n<this.ranges.length;n++)if(!this.ranges[n].eq(e.ranges[n]))return!1;return!0}get main(){return this.ranges[this.mainIndex]}asSingle(){return this.ranges.length==1?this:new t([this.main],0)}addRange(e,n=!0){return t.create([e].concat(this.ranges),n?0:this.mainIndex+1)}replaceRange(e,n=this.mainIndex){let r=this.ranges.slice();return r[n]=e,t.create(r,this.mainIndex)}toJSON(){return{ranges:this.ranges.map(e=>e.toJSON()),main:this.mainIndex}}static fromJSON(e){if(!e||!Array.isArray(e.ranges)||typeof e.main!="number"||e.main>=e.ranges.length)throw new RangeError("Invalid JSON representation for EditorSelection");return new t(e.ranges.map(n=>Ci.fromJSON(n)),e.main)}static single(e,n=e){return new t([t.range(e,n)],0)}static create(e,n=0){if(e.length==0)throw new RangeError("A selection needs at least one range");for(let r=0,o=0;o<e.length;o++){let i=e[o];if(i.empty?i.from<=r:i.from<r)return t.normalized(e.slice(),n);r=i.to}return new t(e,n)}static cursor(e,n=0,r,o){return Ci.create(e,e,(n==0?0:n<0?4:8)|(r==null?3:Math.min(2,r))|(o!=null?o:33554431)<<5)}static range(e,n,r,o){let i=(r!=null?r:33554431)<<5|(o==null?3:Math.min(2,o));return n<e?Ci.create(n,e,24|i):Ci.create(e,n,(n>e?4:0)|i)}static normalized(e,n=0){let r=e[n];e.sort((o,i)=>o.from-i.from),n=e.indexOf(r);for(let o=1;o<e.length;o++){let i=e[o],s=e[o-1];if(i.empty?i.from<=s.to:i.from<s.to){let l=s.from,a=Math.max(i.to,s.to);o<=n&&n--,e.splice(--o,2,i.anchor>i.head?t.range(a,l):t.range(l,a))}}return new t(e,n)}};function cS(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}var qp=0,ne=class t{constructor(e,n,r,o,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=o,this.id=qp++,this.default=e([]),this.extensions=typeof i=="function"?i(this):i}static define(e={}){return new t(e.combine||(n=>n),e.compareInput||((n,r)=>n===r),e.compare||(e.combine?(n,r)=>n===r:Gp),!!e.static,e.enables)}of(e){return new Mi([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mi(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Mi(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}};function Gp(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}var Mi=class{constructor(e,n,r,o){this.dependencies=e,this.facet=n,this.type=r,this.value=o,this.id=qp++}dynamicSlot(e){var n;let r=this.value,o=this.facet.compareInput,i=this.id,s=e[i]>>1,l=this.type==2,a=!1,u=!1,c=[];for(let f of this.dependencies)f=="doc"?a=!0:f=="selection"?u=!0:((n=e[f.id])!==null&&n!==void 0?n:1)&1||c.push(e[f.id]);return{create(f){return f.values[s]=r(f),1},update(f,d){if(a&&d.docChanged||u&&(d.docChanged||d.selection)||zp(f,c)){let h=r(f);if(l?!eS(h,f.values[s],o):!o(h,f.values[s]))return f.values[s]=h,1}return 0},reconfigure:(f,d)=>{let h,g=d.config.address[i];if(g!=null){let v=sc(d,g);if(this.dependencies.every(p=>p instanceof ne?d.facet(p)===f.facet(p):p instanceof Ot?d.field(p,!1)==f.field(p,!1):!0)||(l?eS(h=r(f),v,o):o(h=r(f),v)))return f.values[s]=v,0}else h=r(f);return f.values[s]=h,1}}}};function eS(t,e,n){if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!n(t[r],e[r]))return!1;return!0}function zp(t,e){let n=!1;for(let r of e)il(t,r)&1&&(n=!0);return n}function T6(t,e,n){let r=n.map(a=>t[a.id]),o=n.map(a=>a.type),i=r.filter(a=>!(a&1)),s=t[e.id]>>1;function l(a){let u=[];for(let c=0;c<r.length;c++){let f=sc(a,r[c]);if(o[c]==2)for(let d of f)u.push(d);else u.push(f)}return e.combine(u)}return{create(a){for(let u of r)il(a,u);return a.values[s]=l(a),1},update(a,u){if(!zp(a,i))return 0;let c=l(a);return e.compare(c,a.values[s])?0:(a.values[s]=c,1)},reconfigure(a,u){let c=zp(a,r),f=u.config.facets[e.id],d=u.facet(e);if(f&&!c&&Gp(n,f))return a.values[s]=d,0;let h=l(a);return e.compare(h,d)?(a.values[s]=d,0):(a.values[s]=h,1)}}}var tS=ne.define({static:!0}),Ot=class t{constructor(e,n,r,o,i){this.id=e,this.createF=n,this.updateF=r,this.compareF=o,this.spec=i,this.provides=void 0}static define(e){let n=new t(qp++,e.create,e.update,e.compare||((r,o)=>r===o),e);return e.provide&&(n.provides=e.provide(n)),n}create(e){let n=e.facet(tS).find(r=>r.field==this);return((n==null?void 0:n.create)||this.createF)(e)}slot(e){let n=e[this.id]>>1;return{create:r=>(r.values[n]=this.create(r),1),update:(r,o)=>{let i=r.values[n],s=this.updateF(i,o);return this.compareF(i,s)?0:(r.values[n]=s,1)},reconfigure:(r,o)=>o.config.address[this.id]!=null?(r.values[n]=o.field(this),0):(r.values[n]=this.create(r),1)}}init(e){return[this,tS.of({field:this,create:e})]}get extension(){return this}},mo={lowest:4,low:3,default:2,high:1,highest:0};function ol(t){return e=>new rc(e,t)}var xo={highest:ol(mo.highest),high:ol(mo.high),default:ol(mo.default),low:ol(mo.low),lowest:ol(mo.lowest)},rc=class{constructor(e,n){this.inner=e,this.prec=n}},oc=class t{of(e){return new sl(this,e)}reconfigure(e){return t.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},sl=class{constructor(e,n){this.compartment=e,this.inner=n}},ic=class t{constructor(e,n,r,o,i,s){for(this.base=e,this.compartments=n,this.dynamicSlots=r,this.address=o,this.staticValues=i,this.facets=s,this.statusTemplate=[];this.statusTemplate.length<r.length;)this.statusTemplate.push(0)}staticFacet(e){let n=this.address[e.id];return n==null?e.default:this.staticValues[n>>1]}static resolve(e,n,r){let o=[],i=Object.create(null),s=new Map;for(let d of I6(e,n,s))d instanceof Ot?o.push(d):(i[d.facet.id]||(i[d.facet.id]=[])).push(d);let l=Object.create(null),a=[],u=[];for(let d of o)l[d.id]=u.length<<1,u.push(h=>d.slot(h));let c=r==null?void 0:r.config.facets;for(let d in i){let h=i[d],g=h[0].facet,v=c&&c[d]||[];if(h.every(p=>p.type==0))if(l[g.id]=a.length<<1|1,Gp(v,h))a.push(r.facet(g));else{let p=g.combine(h.map(m=>m.value));a.push(r&&g.compare(p,r.facet(g))?r.facet(g):p)}else{for(let p of h)p.type==0?(l[p.id]=a.length<<1|1,a.push(p.value)):(l[p.id]=u.length<<1,u.push(m=>p.dynamicSlot(m)));l[g.id]=u.length<<1,u.push(p=>T6(p,g,h))}}let f=u.map(d=>d(l));return new t(e,s,f,l,a,i)}};function I6(t,e,n){let r=[[],[],[],[],[]],o=new Map;function i(s,l){let a=o.get(s);if(a!=null){if(a<=l)return;let u=r[a].indexOf(s);u>-1&&r[a].splice(u,1),s instanceof sl&&n.delete(s.compartment)}if(o.set(s,l),Array.isArray(s))for(let u of s)i(u,l);else if(s instanceof sl){if(n.has(s.compartment))throw new RangeError("Duplicate use of compartment in extensions");let u=e.get(s.compartment)||s.inner;n.set(s.compartment,u),i(u,l)}else if(s instanceof rc)i(s.inner,s.prec);else if(s instanceof Ot)r[l].push(s),s.provides&&i(s.provides,l);else if(s instanceof Mi)r[l].push(s),s.facet.extensions&&i(s.facet.extensions,mo.default);else{let u=s.extension;if(!u)throw new Error(`Unrecognized extension value in extension set (${s}). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.`);i(u,l)}}return i(t,mo.default),r.reduce((s,l)=>s.concat(l))}function il(t,e){if(e&1)return 2;let n=e>>1,r=t.status[n];if(r==4)throw new Error("Cyclic dependency between fields and/or facets");if(r&2)return r;t.status[n]=4;let o=t.computeSlot(t,t.config.dynamicSlots[n]);return t.status[n]=2|o}function sc(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}var dS=ne.define(),fS=ne.define({combine:t=>t.some(e=>e),static:!0}),hS=ne.define({combine:t=>t.length?t[0]:void 0,static:!0}),pS=ne.define(),mS=ne.define(),gS=ne.define(),vS=ne.define({combine:t=>t.length?t[0]:!1}),Ht=class{constructor(e,n){this.type=e,this.value=n}static define(){return new lc}},lc=class{of(e){return new Ht(this,e)}},$p=class{constructor(e){this.map=e}of(e){return new Se(this,e)}},Se=class t{constructor(e,n){this.type=e,this.value=n}map(e){let n=this.type.map(this.value,e);return n===void 0?void 0:n==this.value?this:new t(this.type,n)}is(e){return this.type==e}static define(e={}){return new $p(e.map||(n=>n))}static mapEffects(e,n){if(!e.length)return e;let r=[];for(let o of e){let i=o.map(n);i&&r.push(i)}return r}};Se.reconfigure=Se.define();Se.appendConfig=Se.define();var qe=class t{constructor(e,n,r,o,i,s){this.startState=e,this.changes=n,this.selection=r,this.effects=o,this.annotations=i,this.scrollIntoView=s,this._doc=null,this._state=null,r&&cS(r,n.newLength),i.some(l=>l.type==t.time)||(this.annotations=i.concat(t.time.of(Date.now())))}static create(e,n,r,o,i,s){return new t(e,n,r,o,i,s)}get newDoc(){return this._doc||(this._doc=this.changes.apply(this.startState.doc))}get newSelection(){return this.selection||this.startState.selection.map(this.changes)}get state(){return this._state||this.startState.applyTransaction(this),this._state}annotation(e){for(let n of this.annotations)if(n.type==e)return n.value}get docChanged(){return!this.changes.empty}get reconfigured(){return this.startState.config!=this.state.config}isUserEvent(e){let n=this.annotation(t.userEvent);return!!(n&&(n==e||n.length>e.length&&n.slice(0,e.length)==e&&n[e.length]=="."))}};qe.time=Ht.define();qe.userEvent=Ht.define();qe.addToHistory=Ht.define();qe.remote=Ht.define();function L6(t,e){let n=[];for(let r=0,o=0;;){let i,s;if(r<t.length&&(o==e.length||e[o]>=t[r]))i=t[r++],s=t[r++];else if(o<e.length)i=e[o++],s=e[o++];else return n;!n.length||n[n.length-1]<i?n.push(i,s):n[n.length-1]<s&&(n[n.length-1]=s)}}function yS(t,e,n){var r;let o,i,s;return n?(o=e.changes,i=yt.empty(e.changes.length),s=t.changes.compose(e.changes)):(o=e.changes.map(t.changes),i=t.changes.mapDesc(e.changes,!0),s=t.changes.compose(o)),{changes:s,selection:e.selection?e.selection.map(i):(r=t.selection)===null||r===void 0?void 0:r.map(o),effects:Se.mapEffects(t.effects,o).concat(Se.mapEffects(e.effects,i)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function _p(t,e,n){let r=e.selection,o=Ti(e.annotations);return e.userEvent&&(o=o.concat(qe.userEvent.of(e.userEvent))),{changes:e.changes instanceof yt?e.changes:yt.of(e.changes||[],n,t.facet(hS)),selection:r&&(r instanceof $?r:$.single(r.anchor,r.head)),effects:Ti(e.effects),annotations:o,scrollIntoView:!!e.scrollIntoView}}function bS(t,e,n){let r=_p(t,e.length?e[0]:{},t.doc.length);e.length&&e[0].filter===!1&&(n=!1);for(let i=1;i<e.length;i++){e[i].filter===!1&&(n=!1);let s=!!e[i].sequential;r=yS(r,_p(t,e[i],s?r.changes.newLength:t.doc.length),s)}let o=qe.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return D6(n?P6(o):o)}function P6(t){let e=t.startState,n=!0;for(let o of e.facet(pS)){let i=o(t);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:L6(n,i))}if(n!==!0){let o,i;if(n===!1)i=t.changes.invertedDesc,o=yt.empty(e.doc.length);else{let s=t.changes.filter(n);o=s.changes,i=s.filtered.mapDesc(s.changes).invertedDesc}t=qe.create(e,o,t.selection&&t.selection.map(i),Se.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let r=e.facet(mS);for(let o=r.length-1;o>=0;o--){let i=r[o](t);i instanceof qe?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof qe?t=i[0]:t=bS(e,Ti(i),!1)}return t}function D6(t){let e=t.startState,n=e.facet(gS),r=t;for(let o=n.length-1;o>=0;o--){let i=n[o](t);i&&Object.keys(i).length&&(r=yS(r,_p(e,i,t.changes.newLength),!0))}return r==t?t:qe.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}var A6=[];function Ti(t){return t==null?A6:Array.isArray(t)?t:[t]}var vt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(vt||(vt={})),R6=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,Wp;try{Wp=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function O6(t){if(Wp)return Wp.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||R6.test(n)))return!0}return!1}function H6(t){return e=>{if(!/\S/.test(e))return vt.Space;if(O6(e))return vt.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return vt.Word;return vt.Other}}var ke=class t{constructor(e,n,r,o,i,s){this.config=e,this.doc=n,this.selection=r,this.values=o,this.status=e.statusTemplate.slice(),this.computeSlot=i,s&&(s._state=this);for(let l=0;l<this.config.dynamicSlots.length;l++)il(this,l<<1);this.computeSlot=null}field(e,n=!0){let r=this.config.address[e.id];if(r==null){if(n)throw new RangeError("Field is not present in this state");return}return il(this,r),sc(this,r)}update(...e){return bS(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:o}=n;for(let s of e.effects)s.is(oc.reconfigure)?(n&&(o=new Map,n.compartments.forEach((l,a)=>o.set(a,l)),n=null),o.set(s.value.compartment,s.value.extension)):s.is(Se.reconfigure)?(n=null,r=s.value):s.is(Se.appendConfig)&&(n=null,r=Ti(r).concat(s.value));let i;n?i=e.startState.values.slice():(n=ic.resolve(r,o,this),i=new t(n,this.doc,this.selection,n.dynamicSlots.map(()=>null),(l,a)=>a.reconfigure(l,this),null).values),new t(n,e.newDoc,e.newSelection,i,(s,l)=>l.update(s,e),e)}replaceSelection(e){return typeof e=="string"&&(e=this.toText(e)),this.changeByRange(n=>({changes:{from:n.from,to:n.to,insert:e},range:$.cursor(n.from+e.length)}))}changeByRange(e){let n=this.selection,r=e(n.ranges[0]),o=this.changes(r.changes),i=[r.range],s=Ti(r.effects);for(let l=1;l<n.ranges.length;l++){let a=e(n.ranges[l]),u=this.changes(a.changes),c=u.map(o);for(let d=0;d<l;d++)i[d]=i[d].map(c);let f=o.mapDesc(u,!0);i.push(a.range.map(f)),o=o.compose(c),s=Se.mapEffects(s,c).concat(Se.mapEffects(Ti(a.effects),f))}return{changes:o,selection:$.create(i,n.mainIndex),effects:s}}changes(e=[]){return e instanceof yt?e:yt.of(e,this.doc.length,this.facet(t.lineSeparator))}toText(e){return de.of(e.split(this.facet(t.lineSeparator)||Fp))}sliceDoc(e=0,n=this.doc.length){return this.doc.sliceString(e,n,this.lineBreak)}facet(e){let n=this.config.address[e.id];return n==null?e.default:(il(this,n),sc(this,n))}toJSON(e){let n={doc:this.sliceDoc(),selection:this.selection.toJSON()};if(e)for(let r in e){let o=e[r];o instanceof Ot&&this.config.address[o.id]!=null&&(n[r]=o.spec.toJSON(this.field(e[r]),this))}return n}static fromJSON(e,n={},r){if(!e||typeof e.doc!="string")throw new RangeError("Invalid JSON representation for EditorState");let o=[];if(r){for(let i in r)if(Object.prototype.hasOwnProperty.call(e,i)){let s=r[i],l=e[i];o.push(s.init(a=>s.spec.fromJSON(l,a)))}}return t.create({doc:e.doc,selection:$.fromJSON(e.selection),extensions:n.extensions?o.concat([n.extensions]):o})}static create(e={}){let n=ic.resolve(e.extensions||[],new Map),r=e.doc instanceof de?e.doc:de.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||Fp)),o=e.selection?e.selection instanceof $?e.selection:$.single(e.selection.anchor,e.selection.head):$.single(0);return cS(o,r.length),n.staticFacet(fS)||(o=o.asSingle()),new t(n,r,o,n.dynamicSlots.map(()=>null),(i,s)=>s.create(i),null)}get tabSize(){return this.facet(t.tabSize)}get lineBreak(){return this.facet(t.lineSeparator)||`
|
|
412
|
-
`}get readOnly(){return this.facet(vS)}phrase(e,...n){for(let r of this.facet(t.phrases))if(Object.prototype.hasOwnProperty.call(r,e)){e=r[e];break}return n.length&&(e=e.replace(/\$(\$|\d*)/g,(r,o)=>{if(o=="$")return"$";let i=+(o||1);return!i||i>n.length?r:n[i-1]})),e}languageDataAt(e,n,r=-1){let o=[];for(let i of this.facet(dS))for(let s of i(this,n,r))Object.prototype.hasOwnProperty.call(s,e)&&o.push(s[e]);return o}charCategorizer(e){return H6(this.languageDataAt("wordChars",e).join(""))}wordAt(e){let{text:n,from:r,length:o}=this.doc.lineAt(e),i=this.charCategorizer(e),s=e-r,l=e-r;for(;s>0;){let a=ut(n,s,!1);if(i(n.slice(a,s))!=vt.Word)break;s=a}for(;l<o;){let a=ut(n,l);if(i(n.slice(l,a))!=vt.Word)break;l=a}return s==l?null:$.range(s+r,l+r)}};ke.allowMultipleSelections=fS;ke.tabSize=ne.define({combine:t=>t.length?t[0]:4});ke.lineSeparator=hS;ke.readOnly=vS;ke.phrases=ne.define({compare(t,e){let n=Object.keys(t),r=Object.keys(e);return n.length==r.length&&n.every(o=>t[o]==e[o])}});ke.languageData=dS;ke.changeFilter=pS;ke.transactionFilter=mS;ke.transactionExtender=gS;oc.reconfigure=Se.define();function wo(t,e,n={}){let r={};for(let o of t)for(let i of Object.keys(o)){let s=o[i],l=r[i];if(l===void 0)r[i]=s;else if(!(l===s||s===void 0))if(Object.hasOwnProperty.call(n,i))r[i]=n[i](l,s);else throw new Error("Config merge conflict for field "+i)}for(let o in e)r[o]===void 0&&(r[o]=e[o]);return r}var cn=class{eq(e){return this==e}range(e,n=e){return ll.create(e,n,this)}};cn.prototype.startSide=cn.prototype.endSide=0;cn.prototype.point=!1;cn.prototype.mapMode=at.TrackDel;var ll=class t{constructor(e,n,r){this.from=e,this.to=n,this.value=r}static create(e,n,r){return new t(e,n,r)}};function Kp(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var Up=class t{constructor(e,n,r,o){this.from=e,this.to=n,this.value=r,this.maxPoint=o}get length(){return this.to[this.to.length-1]}findIndex(e,n,r,o=0){let i=r?this.to:this.from;for(let s=o,l=i.length;;){if(s==l)return s;let a=s+l>>1,u=i[a]-e||(r?this.value[a].endSide:this.value[a].startSide)-n;if(a==s)return u>=0?s:l;u>=0?l=a:s=a+1}}between(e,n,r,o){for(let i=this.findIndex(n,-1e9,!0),s=this.findIndex(r,1e9,!1,i);i<s;i++)if(o(this.from[i]+e,this.to[i]+e,this.value[i])===!1)return!1}map(e,n){let r=[],o=[],i=[],s=-1,l=-1;for(let a=0;a<this.value.length;a++){let u=this.value[a],c=this.from[a]+e,f=this.to[a]+e,d,h;if(c==f){let g=n.mapPos(c,u.startSide,u.mapMode);if(g==null||(d=h=g,u.startSide!=u.endSide&&(h=n.mapPos(c,u.endSide),h<d)))continue}else if(d=n.mapPos(c,u.startSide),h=n.mapPos(f,u.endSide),d>h||d==h&&u.startSide>0&&u.endSide<=0)continue;(h-d||u.endSide-u.startSide)<0||(s<0&&(s=d),u.point&&(l=Math.max(l,h-d)),r.push(u),o.push(d-s),i.push(h-s))}return{mapped:r.length?new t(o,i,r,l):null,pos:s}}},Ae=class t{constructor(e,n,r,o){this.chunkPos=e,this.chunk=n,this.nextLayer=r,this.maxPoint=o}static create(e,n,r,o){return new t(e,n,r,o)}get length(){let e=this.chunk.length-1;return e<0?0:Math.max(this.chunkEnd(e),this.nextLayer.length)}get size(){if(this.isEmpty)return 0;let e=this.nextLayer.size;for(let n of this.chunk)e+=n.value.length;return e}chunkEnd(e){return this.chunkPos[e]+this.chunk[e].length}update(e){let{add:n=[],sort:r=!1,filterFrom:o=0,filterTo:i=this.length}=e,s=e.filter;if(n.length==0&&!s)return this;if(r&&(n=n.slice().sort(Kp)),this.isEmpty)return n.length?t.of(n):this;let l=new ac(this,null,-1).goto(0),a=0,u=[],c=new Er;for(;l.value||a<n.length;)if(a<n.length&&(l.from-n[a].from||l.startSide-n[a].value.startSide)>=0){let f=n[a++];c.addInner(f.from,f.to,f.value)||u.push(f)}else l.rangeIndex==1&&l.chunkIndex<this.chunk.length&&(a==n.length||this.chunkEnd(l.chunkIndex)<n[a].from)&&(!s||o>this.chunkEnd(l.chunkIndex)||i<this.chunkPos[l.chunkIndex])&&c.addChunk(this.chunkPos[l.chunkIndex],this.chunk[l.chunkIndex])?l.nextChunk():((!s||o>l.to||i<l.from||s(l.from,l.to,l.value))&&(c.addInner(l.from,l.to,l.value)||u.push(ll.create(l.from,l.to,l.value))),l.next());return c.finishInner(this.nextLayer.isEmpty&&!u.length?t.empty:this.nextLayer.update({add:u,filter:s,filterFrom:o,filterTo:i}))}map(e){if(e.empty||this.isEmpty)return this;let n=[],r=[],o=-1;for(let s=0;s<this.chunk.length;s++){let l=this.chunkPos[s],a=this.chunk[s],u=e.touchesRange(l,l+a.length);if(u===!1)o=Math.max(o,a.maxPoint),n.push(a),r.push(e.mapPos(l));else if(u===!0){let{mapped:c,pos:f}=a.map(l,e);c&&(o=Math.max(o,c.maxPoint),n.push(c),r.push(f))}}let i=this.nextLayer.map(e);return n.length==0?i:new t(r,n,i||t.empty,o)}between(e,n,r){if(!this.isEmpty){for(let o=0;o<this.chunk.length;o++){let i=this.chunkPos[o],s=this.chunk[o];if(n>=i&&e<=i+s.length&&s.between(i,e-i,n-i,r)===!1)return}this.nextLayer.between(e,n,r)}}iter(e=0){return al.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return al.from(e).goto(n)}static compare(e,n,r,o,i=-1){let s=e.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),l=n.filter(f=>f.maxPoint>0||!f.isEmpty&&f.maxPoint>=i),a=nS(s,l,r),u=new go(s,a,i),c=new go(l,a,i);r.iterGaps((f,d,h)=>rS(u,f,c,d,h,o)),r.empty&&r.length==0&&rS(u,0,c,0,0,o)}static eq(e,n,r=0,o){o==null&&(o=999999999);let i=e.filter(c=>!c.isEmpty&&n.indexOf(c)<0),s=n.filter(c=>!c.isEmpty&&e.indexOf(c)<0);if(i.length!=s.length)return!1;if(!i.length)return!0;let l=nS(i,s),a=new go(i,l,0).goto(r),u=new go(s,l,0).goto(r);for(;;){if(a.to!=u.to||!jp(a.active,u.active)||a.point&&(!u.point||!a.point.eq(u.point)))return!1;if(a.to>o)return!0;a.next(),u.next()}}static spans(e,n,r,o,i=-1){let s=new go(e,null,i).goto(n),l=n,a=s.openStart;for(;;){let u=Math.min(s.to,r);if(s.point){let c=s.activeForPoint(s.to),f=s.pointFrom<n?c.length+1:Math.min(c.length,a);o.point(l,u,s.point,c,f,s.pointRank),a=Math.min(s.openEnd(u),c.length)}else u>l&&(o.span(l,u,s.active,a),a=s.openEnd(u));if(s.to>r)return a+(s.point&&s.to>r?1:0);l=s.to,s.next()}}static of(e,n=!1){let r=new Er;for(let o of e instanceof ll?[e]:n?N6(e):e)r.add(o.from,o.to,o.value);return r.finish()}};Ae.empty=new Ae([],[],null,-1);function N6(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(Kp(e,r)>0)return t.slice().sort(Kp);e=r}return t}Ae.empty.nextLayer=Ae.empty;var Er=class t{finishChunk(e){this.chunks.push(new Up(this.from,this.to,this.value,this.maxPoint)),this.chunkPos.push(this.chunkStart),this.chunkStart=-1,this.setMaxPoint=Math.max(this.setMaxPoint,this.maxPoint),this.maxPoint=-1,e&&(this.from=[],this.to=[],this.value=[])}constructor(){this.chunks=[],this.chunkPos=[],this.chunkStart=-1,this.last=null,this.lastFrom=-1e9,this.lastTo=-1e9,this.from=[],this.to=[],this.value=[],this.maxPoint=-1,this.setMaxPoint=-1,this.nextLayer=null}add(e,n,r){this.addInner(e,n,r)||(this.nextLayer||(this.nextLayer=new t)).add(e,n,r)}addInner(e,n,r){let o=e-this.lastTo||r.startSide-this.last.endSide;if(o<=0&&(e-this.lastFrom||r.startSide-this.last.startSide)<0)throw new Error("Ranges must be added sorted by `from` position and `startSide`");return o<0?!1:(this.from.length==250&&this.finishChunk(!0),this.chunkStart<0&&(this.chunkStart=e),this.from.push(e-this.chunkStart),this.to.push(n-this.chunkStart),this.last=r,this.lastFrom=e,this.lastTo=n,this.value.push(r),r.point&&(this.maxPoint=Math.max(this.maxPoint,n-e)),!0)}addChunk(e,n){if((e-this.lastTo||n.value[0].startSide-this.last.endSide)<0)return!1;this.from.length&&this.finishChunk(!0),this.setMaxPoint=Math.max(this.setMaxPoint,n.maxPoint),this.chunks.push(n),this.chunkPos.push(e);let r=n.value.length-1;return this.last=n.value[r],this.lastFrom=n.from[r]+e,this.lastTo=n.to[r]+e,!0}finish(){return this.finishInner(Ae.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Ae.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}};function nS(t,e,n){let r=new Map;for(let i of t)for(let s=0;s<i.chunk.length;s++)i.chunk[s].maxPoint<=0&&r.set(i.chunk[s],i.chunkPos[s]);let o=new Set;for(let i of e)for(let s=0;s<i.chunk.length;s++){let l=r.get(i.chunk[s]);l!=null&&(n?n.mapPos(l):l)==i.chunkPos[s]&&!(n!=null&&n.touchesRange(l,l+i.chunk[s].length))&&o.add(i.chunk[s])}return o}var ac=class{constructor(e,n,r,o=0){this.layer=e,this.skip=n,this.minPoint=r,this.rank=o}get startSide(){return this.value?this.value.startSide:0}get endSide(){return this.value?this.value.endSide:0}goto(e,n=-1e9){return this.chunkIndex=this.rangeIndex=0,this.gotoInner(e,n,!1),this}gotoInner(e,n,r){for(;this.chunkIndex<this.layer.chunk.length;){let o=this.layer.chunk[this.chunkIndex];if(!(this.skip&&this.skip.has(o)||this.layer.chunkEnd(this.chunkIndex)<e||o.maxPoint<this.minPoint))break;this.chunkIndex++,r=!1}if(this.chunkIndex<this.layer.chunk.length){let o=this.layer.chunk[this.chunkIndex].findIndex(e-this.layer.chunkPos[this.chunkIndex],n,!0);(!r||this.rangeIndex<o)&&this.setRangeIndex(o)}this.next()}forward(e,n){(this.to-e||this.endSide-n)<0&&this.gotoInner(e,n,!0)}next(){for(;;)if(this.chunkIndex==this.layer.chunk.length){this.from=this.to=1e9,this.value=null;break}else{let e=this.layer.chunkPos[this.chunkIndex],n=this.layer.chunk[this.chunkIndex],r=e+n.from[this.rangeIndex];if(this.from=r,this.to=e+n.to[this.rangeIndex],this.value=n.value[this.rangeIndex],this.setRangeIndex(this.rangeIndex+1),this.minPoint<0||this.value.point&&this.to-this.from>=this.minPoint)break}}setRangeIndex(e){if(e==this.layer.chunk[this.chunkIndex].value.length){if(this.chunkIndex++,this.skip)for(;this.chunkIndex<this.layer.chunk.length&&this.skip.has(this.layer.chunk[this.chunkIndex]);)this.chunkIndex++;this.rangeIndex=0}else this.rangeIndex=e}nextChunk(){this.chunkIndex++,this.rangeIndex=0,this.next()}compare(e){return this.from-e.from||this.startSide-e.startSide||this.rank-e.rank||this.to-e.to||this.endSide-e.endSide}},al=class t{constructor(e){this.heap=e}static from(e,n=null,r=-1){let o=[];for(let i=0;i<e.length;i++)for(let s=e[i];!s.isEmpty;s=s.nextLayer)s.maxPoint>=r&&o.push(new ac(s,n,r,i));return o.length==1?o[0]:new t(o)}get startSide(){return this.value?this.value.startSide:0}goto(e,n=-1e9){for(let r of this.heap)r.goto(e,n);for(let r=this.heap.length>>1;r>=0;r--)Hp(this.heap,r);return this.next(),this}forward(e,n){for(let r of this.heap)r.forward(e,n);for(let r=this.heap.length>>1;r>=0;r--)Hp(this.heap,r);(this.to-e||this.value.endSide-n)<0&&this.next()}next(){if(this.heap.length==0)this.from=this.to=1e9,this.value=null,this.rank=-1;else{let e=this.heap[0];this.from=e.from,this.to=e.to,this.value=e.value,this.rank=e.rank,e.value&&e.next(),Hp(this.heap,0)}}};function Hp(t,e){for(let n=t[e];;){let r=(e<<1)+1;if(r>=t.length)break;let o=t[r];if(r+1<t.length&&o.compare(t[r+1])>=0&&(o=t[r+1],r++),n.compare(o)<0)break;t[r]=n,t[e]=o,e=r}}var go=class{constructor(e,n,r){this.minPoint=r,this.active=[],this.activeTo=[],this.activeRank=[],this.minActive=-1,this.point=null,this.pointFrom=0,this.pointRank=0,this.to=-1e9,this.endSide=0,this.openStart=-1,this.cursor=al.from(e,n,r)}goto(e,n=-1e9){return this.cursor.goto(e,n),this.active.length=this.activeTo.length=this.activeRank.length=0,this.minActive=-1,this.to=e,this.endSide=n,this.openStart=-1,this.next(),this}forward(e,n){for(;this.minActive>-1&&(this.activeTo[this.minActive]-e||this.active[this.minActive].endSide-n)<0;)this.removeActive(this.minActive);this.cursor.forward(e,n)}removeActive(e){Qu(this.active,e),Qu(this.activeTo,e),Qu(this.activeRank,e),this.minActive=oS(this.active,this.activeTo)}addActive(e){let n=0,{value:r,to:o,rank:i}=this.cursor;for(;n<this.activeRank.length&&this.activeRank[n]<=i;)n++;Xu(this.active,n,r),Xu(this.activeTo,n,o),Xu(this.activeRank,n,i),e&&Xu(e,n,this.cursor.from),this.minActive=oS(this.active,this.activeTo)}next(){let e=this.to,n=this.point;this.point=null;let r=this.openStart<0?[]:null;for(;;){let o=this.minActive;if(o>-1&&(this.activeTo[o]-this.cursor.from||this.active[o].endSide-this.cursor.startSide)<0){if(this.activeTo[o]>e){this.to=this.activeTo[o],this.endSide=this.active[o].endSide;break}this.removeActive(o),r&&Qu(r,o)}else if(this.cursor.value)if(this.cursor.from>e){this.to=this.cursor.from,this.endSide=this.cursor.startSide;break}else{let i=this.cursor.value;if(!i.point)this.addActive(r),this.cursor.next();else if(n&&this.cursor.to==this.to&&this.cursor.from<this.cursor.to)this.cursor.next();else{this.point=i,this.pointFrom=this.cursor.from,this.pointRank=this.cursor.rank,this.to=this.cursor.to,this.endSide=i.endSide,this.cursor.next(),this.forward(this.to,this.endSide);break}}else{this.to=this.endSide=1e9;break}}if(r){this.openStart=0;for(let o=r.length-1;o>=0&&r[o]<e;o--)this.openStart++}}activeForPoint(e){if(!this.active.length)return this.active;let n=[];for(let r=this.active.length-1;r>=0&&!(this.activeRank[r]<this.pointRank);r--)(this.activeTo[r]>e||this.activeTo[r]==e&&this.active[r].endSide>=this.point.endSide)&&n.push(this.active[r]);return n.reverse()}openEnd(e){let n=0;for(let r=this.activeTo.length-1;r>=0&&this.activeTo[r]>e;r--)n++;return n}};function rS(t,e,n,r,o,i){t.goto(e),n.goto(r);let s=r+o,l=r,a=r-e;for(;;){let u=t.to+a-n.to||t.endSide-n.endSide,c=u<0?t.to+a:n.to,f=Math.min(c,s);if(t.point||n.point?t.point&&n.point&&(t.point==n.point||t.point.eq(n.point))&&jp(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,f,t.point,n.point):f>l&&!jp(t.active,n.active)&&i.compareRange(l,f,t.active,n.active),c>s)break;l=c,u<=0&&t.next(),u>=0&&n.next()}}function jp(t,e){if(t.length!=e.length)return!1;for(let n=0;n<t.length;n++)if(t[n]!=e[n]&&!t[n].eq(e[n]))return!1;return!0}function Qu(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Xu(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function oS(t,e){let n=-1,r=1e9;for(let o=0;o<e.length;o++)(e[o]-r||t[o].endSide-t[n].endSide)<0&&(n=o,r=e[o]);return n}function So(t,e,n=t.length){let r=0;for(let o=0;o<n;)t.charCodeAt(o)==9?(r+=e-r%e,o++):(r++,o=ut(t,o));return r}function xS(t,e,n,r){for(let o=0,i=0;;){if(i>=e)return o;if(o==t.length)break;i+=t.charCodeAt(o)==9?n-i%n:1,o=ut(t,o)}return r===!0?-1:t.length}var Jp="\u037C",wS=typeof Symbol>"u"?"__"+Jp:Symbol.for(Jp),Zp=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),SS=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},Qt=class{constructor(e,n){this.rules=[];let{finish:r}=n||{};function o(s){return/^@/.test(s)?[s]:s.split(/,\s*/)}function i(s,l,a,u){let c=[],f=/^@(\w+)\b/.exec(s[0]),d=f&&f[1]=="keyframes";if(f&&l==null)return a.push(s[0]+";");for(let h in l){let g=l[h];if(/&/.test(h))i(h.split(/,\s*/).map(v=>s.map(p=>v.replace(/&/,p))).reduce((v,p)=>v.concat(p)),g,a);else if(g&&typeof g=="object"){if(!f)throw new RangeError("The value of a property ("+h+") should be a primitive value.");i(o(h),g,c,d)}else g!=null&&c.push(h.replace(/_.*/,"").replace(/[A-Z]/g,v=>"-"+v.toLowerCase())+": "+g+";")}(c.length||d)&&a.push((r&&!f&&!u?s.map(r):s).join(", ")+" {"+c.join(" ")+"}")}for(let s in e)i(o(s),e[s],this.rules)}getRules(){return this.rules.join(`
|
|
413
|
-
|
|
414
|
-
`;this.styleTag.textContent=i}}};var Gn={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:"'"},Ii={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},F6=typeof navigator<"u"&&/Mac/.test(navigator.platform),B6=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(Ne=0;Ne<10;Ne++)Gn[48+Ne]=Gn[96+Ne]=String(Ne);var Ne;for(Ne=1;Ne<=24;Ne++)Gn[Ne+111]="F"+Ne;var Ne;for(Ne=65;Ne<=90;Ne++)Gn[Ne]=String.fromCharCode(Ne+32),Ii[Ne]=String.fromCharCode(Ne);var Ne;for(uc in Gn)Ii.hasOwnProperty(uc)||(Ii[uc]=Gn[uc]);var uc;function kS(t){var e=F6&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||B6&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?Ii:Gn)[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}function Sc(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function rm(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function V6(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function vc(t,e){if(!e.anchorNode)return!1;try{return rm(t,e.anchorNode)}catch{return!1}}function ml(t){return t.nodeType==3?Co(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function Cc(t,e,n,r){return n?ES(t,e,n,r,-1)||ES(t,e,n,r,1):!1}function kc(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function ES(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:Lr(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=kc(t)+(o<0?0:1),t=i}else if(t.nodeType==1){if(t=t.childNodes[e+(o<0?-1:0)],t.nodeType==1&&t.contentEditable=="false")return!1;e=o<0?Lr(t):0}else return!1}}function Lr(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Bm(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function z6(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function $6(t,e,n,r,o,i,s,l){let a=t.ownerDocument,u=a.defaultView||window;for(let c=t,f=!1;c&&!f;)if(c.nodeType==1){let d,h=c==a.body;if(h)d=z6(u);else{if(/^(fixed|sticky)$/.test(getComputedStyle(c).position)&&(f=!0),c.scrollHeight<=c.clientHeight&&c.scrollWidth<=c.clientWidth){c=c.assignedSlot||c.parentNode;continue}let p=c.getBoundingClientRect();d={left:p.left,right:p.left+c.clientWidth,top:p.top,bottom:p.top+c.clientHeight}}let g=0,v=0;if(o=="nearest")e.top<d.top?(v=-(d.top-e.top+s),n>0&&e.bottom>d.bottom+v&&(v=e.bottom-d.bottom+v+s)):e.bottom>d.bottom&&(v=e.bottom-d.bottom+s,n<0&&e.top-v<d.top&&(v=-(d.top+v-e.top+s)));else{let p=e.bottom-e.top,m=d.bottom-d.top;v=(o=="center"&&p<=m?e.top+p/2-m/2:o=="start"||o=="center"&&n<0?e.top-s:e.bottom-m+s)-d.top}if(r=="nearest"?e.left<d.left?(g=-(d.left-e.left+i),n>0&&e.right>d.right+g&&(g=e.right-d.right+g+i)):e.right>d.right&&(g=e.right-d.right+i,n<0&&e.left<d.left+g&&(g=-(d.left+g-e.left+i))):g=(r=="center"?e.left+(e.right-e.left)/2-(d.right-d.left)/2:r=="start"==l?e.left-i:e.right-(d.right-d.left)+i)-d.left,g||v)if(h)u.scrollBy(g,v);else{let p=0,m=0;if(v){let y=c.scrollTop;c.scrollTop+=v,m=c.scrollTop-y}if(g){let y=c.scrollLeft;c.scrollLeft+=g,p=c.scrollLeft-y}e={left:e.left-p,top:e.top-m,right:e.right-p,bottom:e.bottom-m},p&&Math.abs(p-g)<1&&(r="nearest"),m&&Math.abs(m-v)<1&&(o="nearest")}if(h)break;c=c.assignedSlot||c.parentNode}else if(c.nodeType==11)c=c.host;else break}function _6(t){let e=t.ownerDocument;for(let n=t.parentNode;n&&n!=e.body;)if(n.nodeType==1){if(n.scrollHeight>n.clientHeight||n.scrollWidth>n.clientWidth)return n;n=n.assignedSlot||n.parentNode}else if(n.nodeType==11)n=n.host;else break;return null}var om=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}eq(e){return this.anchorNode==e.anchorNode&&this.anchorOffset==e.anchorOffset&&this.focusNode==e.focusNode&&this.focusOffset==e.focusOffset}setRange(e){let{anchorNode:n,focusNode:r}=e;this.set(n,Math.min(e.anchorOffset,n?Lr(n):0),r,Math.min(e.focusOffset,r?Lr(r):0))}set(e,n,r,o){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=o}},Li=null;function oC(t){if(t.setActive)return t.setActive();if(Li)return t.focus(Li);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(Li==null?{get preventScroll(){return Li={preventScroll:!0},!0}}:void 0),!Li){Li=!1;for(let n=0;n<e.length;){let r=e[n++],o=e[n++],i=e[n++];r.scrollTop!=o&&(r.scrollTop=o),r.scrollLeft!=i&&(r.scrollLeft=i)}}}var MS;function Co(t,e,n=e){let r=MS||(MS=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Ai(t,e,n){let r={key:e,code:e,keyCode:n,which:n,cancelable:!0},o=new KeyboardEvent("keydown",r);o.synthetic=!0,t.dispatchEvent(o);let i=new KeyboardEvent("keyup",r);return i.synthetic=!0,t.dispatchEvent(i),o.defaultPrevented||i.defaultPrevented}function W6(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function iC(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function K6(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,Lr(n));;)if(r){if(n.nodeType!=1)return!1;let o=n.childNodes[r-1];o.contentEditable=="false"?r--:(n=o,r=Lr(n))}else{if(n==t)return!0;r=kc(n),n=n.parentNode}}function sC(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}var Tt=class t{constructor(e,n,r=!0){this.node=e,this.offset=n,this.precise=r}static before(e,n){return new t(e.parentNode,kc(e),n)}static after(e,n){return new t(e.parentNode,kc(e)+1,n)}},Vm=[],xe=class t{constructor(){this.parent=null,this.dom=null,this.flags=2}get overrideDOMText(){return null}get posAtStart(){return this.parent?this.parent.posBefore(this):0}get posAtEnd(){return this.posAtStart+this.length}posBefore(e){let n=this.posAtStart;for(let r of this.children){if(r==e)return n;n+=r.length+r.breakAfter}throw new RangeError("Invalid child in posBefore")}posAfter(e){return this.posBefore(e)+e.length}sync(e,n){if(this.flags&2){let r=this.dom,o=null,i;for(let s of this.children){if(s.flags&7){if(!s.dom&&(i=o?o.nextSibling:r.firstChild)){let l=t.get(i);(!l||!l.parent&&l.canReuseDOM(s))&&s.reuseDOM(i)}s.sync(e,n),s.flags&=-8}if(i=o?o.nextSibling:r.firstChild,n&&!n.written&&n.node==r&&i!=s.dom&&(n.written=!0),s.dom.parentNode==r)for(;i&&i!=s.dom;)i=TS(i);else r.insertBefore(s.dom,i);o=s.dom}for(i=o?o.nextSibling:r.firstChild,i&&n&&n.node==r&&(n.written=!0);i;)i=TS(i)}else if(this.flags&1)for(let r of this.children)r.flags&7&&(r.sync(e,n),r.flags&=-8)}reuseDOM(e){}localPosFromDOM(e,n){let r;if(e==this.dom)r=this.dom.childNodes[n];else{let o=Lr(e)==0?0:n==0?-1:1;for(;;){let i=e.parentNode;if(i==this.dom)break;o==0&&i.firstChild!=i.lastChild&&(e==i.firstChild?o=-1:o=1),e=i}o<0?r=e:r=e.nextSibling}if(r==this.dom.firstChild)return 0;for(;r&&!t.get(r);)r=r.nextSibling;if(!r)return this.length;for(let o=0,i=0;;o++){let s=this.children[o];if(s.dom==r)return i;i+=s.length+s.breakAfter}}domBoundsAround(e,n,r=0){let o=-1,i=-1,s=-1,l=-1;for(let a=0,u=r,c=r;a<this.children.length;a++){let f=this.children[a],d=u+f.length;if(u<e&&d>n)return f.domBoundsAround(e,n,u);if(d>=e&&o==-1&&(o=a,i=u),u>n&&f.dom.parentNode==this.dom){s=a,l=c;break}c=d,u=d+f.breakAfter}return{from:i,to:l<0?r+this.length:l,startDOM:(o?this.children[o-1].dom.nextSibling:null)||this.dom.firstChild,endDOM:s<this.children.length&&s>=0?this.children[s].dom:null}}markDirty(e=!1){this.flags|=2,this.markParentsDirty(e)}markParentsDirty(e){for(let n=this.parent;n;n=n.parent){if(e&&(n.flags|=2),n.flags&1)return;n.flags|=1,e=!1}}setParent(e){this.parent!=e&&(this.parent=e,this.flags&7&&this.markParentsDirty(!0))}setDOM(e){this.dom&&(this.dom.cmView=null),this.dom=e,e.cmView=this}get rootView(){for(let e=this;;){let n=e.parent;if(!n)return e;e=n}}replaceChildren(e,n,r=Vm){this.markDirty();for(let o=e;o<n;o++){let i=this.children[o];i.parent==this&&i.destroy()}this.children.splice(e,n-e,...r);for(let o=0;o<r.length;o++)r[o].setParent(this)}ignoreMutation(e){return!1}ignoreEvent(e){return!1}childCursor(e=this.length){return new Ec(this.children,e,this.children.length)}childPos(e,n=1){return this.childCursor().findPos(e,n)}toString(){let e=this.constructor.name.replace("View","");return e+(this.children.length?"("+this.children.join()+")":this.length?"["+(e=="Text"?this.text:this.length)+"]":"")+(this.breakAfter?"#":"")}static get(e){return e.cmView}get isEditable(){return!0}get isWidget(){return!1}get isHidden(){return!1}merge(e,n,r,o,i,s){return!1}become(e){return!1}canReuseDOM(e){return e.constructor==this.constructor&&!((this.flags|e.flags)&8)}getSide(){return 0}destroy(){this.parent=null}};xe.prototype.breakAfter=0;function TS(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var Ec=class{constructor(e,n,r){this.children=e,this.pos=n,this.i=r,this.off=0}findPos(e,n=1){for(;;){if(e>this.pos||e==this.pos&&(n>0||this.i==0||this.children[this.i-1].breakAfter))return this.off=e-this.pos,this;let r=this.children[--this.i];this.pos-=r.length+r.breakAfter}}};function lC(t,e,n,r,o,i,s,l,a){let{children:u}=t,c=u.length?u[e]:null,f=i.length?i[i.length-1]:null,d=f?f.breakAfter:s;if(!(e==r&&c&&!s&&!d&&i.length<2&&c.merge(n,o,i.length?f:null,n==0,l,a))){if(r<u.length){let h=u[r];h&&o<h.length?(e==r&&(h=h.split(o),o=0),!d&&f&&h.merge(0,o,f,!0,0,a)?i[i.length-1]=h:(o&&h.merge(0,o,null,!1,0,a),i.push(h))):h!=null&&h.breakAfter&&(f?f.breakAfter=1:s=1),r++}for(c&&(c.breakAfter=s,n>0&&(!s&&i.length&&c.merge(n,c.length,i[0],!1,l,0)?c.breakAfter=i.shift().breakAfter:(n<c.length||c.children.length&&c.children[c.children.length-1].length==0)&&c.merge(n,c.length,null,!1,l,0),e++));e<r&&i.length;)if(u[r-1].become(i[i.length-1]))r--,i.pop(),a=i.length?0:l;else if(u[e].become(i[0]))e++,i.shift(),l=i.length?0:a;else break;!i.length&&e&&r<u.length&&!u[e-1].breakAfter&&u[r].merge(0,0,u[e-1],!1,l,a)&&e--,(e<r||i.length)&&t.replaceChildren(e,r,i)}}function aC(t,e,n,r,o,i){let s=t.childCursor(),{i:l,off:a}=s.findPos(n,1),{i:u,off:c}=s.findPos(e,-1),f=e-n;for(let d of r)f+=d.length;t.length+=f,lC(t,u,c,l,a,r,0,o,i)}var Pi="\uFFFF",Mc=class{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(ke.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Pi}readRange(e,n){if(!e)return this;let r=e.parentNode;for(let o=e;;){this.findPointBefore(r,o);let i=this.text.length;this.readNode(o);let s=o.nextSibling;if(s==n)break;let l=xe.get(o),a=xe.get(s);(l&&a?l.breakAfter:(l?l.breakAfter:IS(o))||IS(s)&&(o.nodeName!="BR"||o.cmIgnore)&&this.text.length>i)&&this.lineBreak(),o=s}return this.findPointBefore(r,n),this}readTextNode(e){let n=e.nodeValue;for(let r of this.points)r.node==e&&(r.pos=this.text.length+Math.min(r.offset,n.length));for(let r=0,o=this.lineSeparator?null:/\r\n?|\n/g;;){let i=-1,s=1,l;if(this.lineSeparator?(i=n.indexOf(this.lineSeparator,r),s=this.lineSeparator.length):(l=o.exec(n))&&(i=l.index,s=l[0].length),this.append(n.slice(r,i<0?n.length:i)),i<0)break;if(this.lineBreak(),s>1)for(let a of this.points)a.node==e&&a.pos>this.text.length&&(a.pos-=s-1);r=i+s}}readNode(e){if(e.cmIgnore)return;let n=xe.get(e),r=n&&n.overrideDOMText;if(r!=null){this.findPointInside(e,r.length);for(let o=r.iter();!o.next().done;)o.lineBreak?this.lineBreak():this.append(o.value)}else e.nodeType==3?this.readTextNode(e):e.nodeName=="BR"?e.nextSibling&&this.lineBreak():e.nodeType==1&&this.readRange(e.firstChild,null)}findPointBefore(e,n){for(let r of this.points)r.node==e&&e.childNodes[r.offset]==n&&(r.pos=this.text.length)}findPointInside(e,n){for(let r of this.points)(e.nodeType==3?r.node==e:e.contains(r.node))&&(r.pos=this.text.length+Math.min(n,r.offset))}};function IS(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}var Tc=class{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}},Ft=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},im=typeof document<"u"?document:{documentElement:{style:{}}},sm=/Edge\/(\d+)/.exec(Ft.userAgent),uC=/MSIE \d/.test(Ft.userAgent),lm=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ft.userAgent),Fc=!!(uC||lm||sm),LS=!Fc&&/gecko\/(\d+)/i.test(Ft.userAgent),Qp=!Fc&&/Chrome\/(\d+)/.exec(Ft.userAgent),PS="webkitFontSmoothing"in im.documentElement.style,cC=!Fc&&/Apple Computer/.test(Ft.vendor),DS=cC&&(/Mobile\/\w+/.test(Ft.userAgent)||Ft.maxTouchPoints>2),Q={mac:DS||/Mac/.test(Ft.platform),windows:/Win/.test(Ft.platform),linux:/Linux|X11/.test(Ft.platform),ie:Fc,ie_version:uC?im.documentMode||6:lm?+lm[1]:sm?+sm[1]:0,gecko:LS,gecko_version:LS?+(/Firefox\/(\d+)/.exec(Ft.userAgent)||[0,0])[1]:0,chrome:!!Qp,chrome_version:Qp?+Qp[1]:0,ios:DS,android:/Android\b/.test(Ft.userAgent),webkit:PS,safari:cC,webkit_version:PS?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:im.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},U6=256,Jn=class t extends xe{constructor(e){super(),this.text=e}get length(){return this.text.length}createDOM(e){this.setDOM(e||document.createTextNode(this.text))}sync(e,n){this.dom||this.createDOM(),this.dom.nodeValue!=this.text&&(n&&n.node==this.dom&&(n.written=!0),this.dom.nodeValue=this.text)}reuseDOM(e){e.nodeType==3&&this.createDOM(e)}merge(e,n,r){return this.flags&8||r&&(!(r instanceof t)||this.length-(n-e)+r.length>U6||r.flags&8)?!1:(this.text=this.text.slice(0,e)+(r?r.text:"")+this.text.slice(n),this.markDirty(),!0)}split(e){let n=new t(this.text.slice(e));return this.text=this.text.slice(0,e),this.markDirty(),n.flags|=this.flags&8,n}localPosFromDOM(e,n){return e==this.dom?n:n?this.text.length:0}domAtPos(e){return new Tt(this.dom,e)}domBoundsAround(e,n,r){return{from:r,to:r+this.length,startDOM:this.dom,endDOM:this.dom.nextSibling}}coordsAt(e,n){return j6(this.dom,e,n)}},Pr=class t extends xe{constructor(e,n=[],r=0){super(),this.mark=e,this.children=n,this.length=r;for(let o of n)o.setParent(this)}setAttrs(e){if(iC(e),this.mark.class&&(e.className=this.mark.class),this.mark.attrs)for(let n in this.mark.attrs)e.setAttribute(n,this.mark.attrs[n]);return e}canReuseDOM(e){return super.canReuseDOM(e)&&!((this.flags|e.flags)&8)}reuseDOM(e){e.nodeName==this.mark.tagName.toUpperCase()&&(this.setDOM(e),this.flags|=6)}sync(e,n){this.dom?this.flags&4&&this.setAttrs(this.dom):this.setDOM(this.setAttrs(document.createElement(this.mark.tagName))),super.sync(e,n)}merge(e,n,r,o,i,s){return r&&(!(r instanceof t&&r.mark.eq(this.mark))||e&&i<=0||n<this.length&&s<=0)?!1:(aC(this,e,n,r?r.children:[],i-1,s-1),this.markDirty(),!0)}split(e){let n=[],r=0,o=-1,i=0;for(let l of this.children){let a=r+l.length;a>e&&n.push(r<e?l.split(e-r):l),o<0&&r>=e&&(o=i),r=a,i++}let s=this.length-e;return this.length=e,o>-1&&(this.children.length=o,this.markDirty()),new t(this.mark,n,s)}domAtPos(e){return dC(this,e)}coordsAt(e,n){return hC(this,e,n)}};function j6(t,e,n){let r=t.nodeValue.length;e>r&&(e=r);let o=e,i=e,s=0;e==0&&n<0||e==r&&n>=0?Q.chrome||Q.gecko||(e?(o--,s=1):i<r&&(i++,s=-1)):n<0?o--:i<r&&i++;let l=Co(t,o,i).getClientRects();if(!l.length)return null;let a=l[(s?s<0:n>=0)?0:l.length-1];return Q.safari&&!s&&a.width==0&&(a=Array.prototype.find.call(l,u=>u.width)||a),s?Bm(a,s<0):a||null}var Ic=class t extends xe{constructor(e,n,r){super(),this.widget=e,this.length=n,this.side=r,this.prevWidget=null}static create(e,n,r){return new t(e,n,r)}split(e){let n=t.create(this.widget,this.length-e,this.side);return this.length-=e,n}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}getSide(){return this.side}merge(e,n,r,o,i,s){return r&&(!(r instanceof t)||!this.widget.compare(r.widget)||e>0&&i<=0||n<this.length&&s<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}become(e){return e instanceof t&&e.side==this.side&&this.widget.constructor==e.widget.constructor?(this.widget.compare(e.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get overrideDOMText(){if(this.length==0)return de.empty;let e=this;for(;e.parent;)e=e.parent;let{view:n}=e,r=n&&n.state.doc,o=this.posAtStart;return r?r.slice(o,o+this.length):de.empty}domAtPos(e){return(this.length?e==0:this.side>0)?Tt.before(this.dom):Tt.after(this.dom,e==this.length)}domBoundsAround(){return null}coordsAt(e,n){let r=this.widget.coordsAt(this.dom,e,n);if(r)return r;let o=this.dom.getClientRects(),i=null;if(!o.length)return null;let s=this.side?this.side<0:e>0;for(let l=s?o.length-1:0;i=o[l],!(e>0?l==0:l==o.length-1||i.top<i.bottom);l+=s?-1:1);return Bm(i,!s)}get isEditable(){return!1}get isWidget(){return!0}get isHidden(){return this.widget.isHidden}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},gl=class t extends xe{constructor(e){super(),this.side=e}get length(){return 0}merge(){return!1}become(e){return e instanceof t&&e.side==this.side}split(){return new t(this.side)}sync(){if(!this.dom){let e=document.createElement("img");e.className="cm-widgetBuffer",e.setAttribute("aria-hidden","true"),this.setDOM(e)}}getSide(){return this.side}domAtPos(e){return this.side>0?Tt.before(this.dom):Tt.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return de.empty}get isHidden(){return!0}};Jn.prototype.children=Ic.prototype.children=gl.prototype.children=Vm;function dC(t,e){let n=t.dom,{children:r}=t,o=0;for(let i=0;o<r.length;o++){let s=r[o],l=i+s.length;if(!(l==i&&s.getSide()<=0)){if(e>i&&e<l&&s.dom.parentNode==n)return s.domAtPos(e-i);if(e<=i)break;i=l}}for(let i=o;i>0;i--){let s=r[i-1];if(s.dom.parentNode==n)return s.domAtPos(s.length)}for(let i=o;i<r.length;i++){let s=r[i];if(s.dom.parentNode==n)return s.domAtPos(0)}return new Tt(n,0)}function fC(t,e,n){let r,{children:o}=t;n>0&&e instanceof Pr&&o.length&&(r=o[o.length-1])instanceof Pr&&r.mark.eq(e.mark)?fC(r,e.children[0],n-1):(o.push(e),e.setParent(t)),t.length+=e.length}function hC(t,e,n){let r=null,o=-1,i=null,s=-1;function l(u,c){for(let f=0,d=0;f<u.children.length&&d<=c;f++){let h=u.children[f],g=d+h.length;g>=c&&(h.children.length?l(h,c-d):(!i||i.isHidden&&n>0)&&(g>c||d==g&&h.getSide()>0)?(i=h,s=c-d):(d<c||d==g&&h.getSide()<0&&!h.isHidden)&&(r=h,o=c-d)),d=g}}l(t,e);let a=(n<0?r:i)||r||i;return a?a.coordsAt(Math.max(0,a==r?o:s),n):q6(t)}function q6(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=ml(e);return n[n.length-1]||null}function am(t,e){for(let n in t)n=="class"&&e.class?e.class+=" "+t.class:n=="style"&&e.style?e.style+=";"+t.style:e[n]=t[n];return e}var AS=Object.create(null);function zm(t,e,n){if(t==e)return!0;t||(t=AS),e||(e=AS);let r=Object.keys(t),o=Object.keys(e);if(r.length-(n&&r.indexOf(n)>-1?1:0)!=o.length-(n&&o.indexOf(n)>-1?1:0))return!1;for(let i of r)if(i!=n&&(o.indexOf(i)==-1||t[i]!==e[i]))return!1;return!0}function um(t,e,n){let r=null;if(e)for(let o in e)n&&o in n||t.removeAttribute(r=o);if(n)for(let o in n)e&&e[o]==n[o]||t.setAttribute(r=o,n[o]);return!!r}function G6(t){let e=Object.create(null);for(let n=0;n<t.attributes.length;n++){let r=t.attributes[n];e[r.name]=r.value}return e}var Zn=class{eq(e){return!1}updateDOM(e,n){return!1}compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}get estimatedHeight(){return-1}get lineBreaks(){return 0}ignoreEvent(e){return!0}coordsAt(e,n,r){return null}get isHidden(){return!1}destroy(e){}},Oe=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Oe||(Oe={})),_e=class extends cn{constructor(e,n,r,o){super(),this.startSide=e,this.endSide=n,this.widget=r,this.spec=o}get heightRelevant(){return!1}static mark(e){return new vl(e)}static widget(e){let n=Math.max(-1e4,Math.min(1e4,e.side||0)),r=!!e.block;return n+=r&&!e.inlineOrder?n>0?3e8:-4e8:n>0?1e8:-1e8,new Dr(e,n,n,r,e.widget||null,!1)}static replace(e){let n=!!e.block,r,o;if(e.isBlockGap)r=-5e8,o=4e8;else{let{start:i,end:s}=pC(e,n);r=(i?n?-3e8:-1:5e8)-1,o=(s?n?2e8:1:-6e8)+1}return new Dr(e,r,o,n,e.widget||null,!0)}static line(e){return new yl(e)}static set(e,n=!1){return Ae.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};_e.none=Ae.empty;var vl=class t extends _e{constructor(e){let{start:n,end:r}=pC(e);super(n?-1:5e8,r?1:-6e8,null,e),this.tagName=e.tagName||"span",this.class=e.class||"",this.attrs=e.attributes||null}eq(e){var n,r;return this==e||e instanceof t&&this.tagName==e.tagName&&(this.class||((n=this.attrs)===null||n===void 0?void 0:n.class))==(e.class||((r=e.attrs)===null||r===void 0?void 0:r.class))&&zm(this.attrs,e.attrs,"class")}range(e,n=e){if(e>=n)throw new RangeError("Mark decorations may not be empty");return super.range(e,n)}};vl.prototype.point=!1;var yl=class t extends _e{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof t&&this.spec.class==e.spec.class&&zm(this.spec.attributes,e.spec.attributes)}range(e,n=e){if(n!=e)throw new RangeError("Line decoration ranges must be zero-length");return super.range(e,n)}};yl.prototype.mapMode=at.TrackBefore;yl.prototype.point=!0;var Dr=class t extends _e{constructor(e,n,r,o,i,s){super(n,r,i,e),this.block=o,this.isReplace=s,this.mapMode=o?n<=0?at.TrackBefore:at.TrackAfter:at.TrackDel}get type(){return this.startSide<this.endSide?Oe.WidgetRange:this.startSide<=0?Oe.WidgetBefore:Oe.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof t&&J6(this.widget,e.widget)&&this.block==e.block&&this.startSide==e.startSide&&this.endSide==e.endSide}range(e,n=e){if(this.isReplace&&(e>n||e==n&&this.startSide>0&&this.endSide<=0))throw new RangeError("Invalid range for replacement decoration");if(!this.isReplace&&n!=e)throw new RangeError("Widget decorations can only have zero-length ranges");return super.range(e,n)}};Dr.prototype.point=!0;function pC(t,e=!1){let{inclusiveStart:n,inclusiveEnd:r}=t;return n==null&&(n=t.inclusive),r==null&&(r=t.inclusive),{start:n!=null?n:e,end:r!=null?r:e}}function J6(t,e){return t==e||!!(t&&e&&t.compare(e))}function cm(t,e,n,r=0){let o=n.length-1;o>=0&&n[o]+r>=t?n[o]=Math.max(n[o],e):n.push(t,e)}var Nt=class t extends xe{constructor(){super(...arguments),this.children=[],this.length=0,this.prevAttrs=void 0,this.attrs=null,this.breakAfter=0}merge(e,n,r,o,i,s){if(r){if(!(r instanceof t))return!1;this.dom||r.transferDOM(this)}return o&&this.setDeco(r?r.attrs:null),aC(this,e,n,r?r.children:[],i,s),!0}split(e){let n=new t;if(n.breakAfter=this.breakAfter,this.length==0)return n;let{i:r,off:o}=this.childPos(e);o&&(n.append(this.children[r].split(o),0),this.children[r].merge(o,this.children[r].length,null,!1,0,0),r++);for(let i=r;i<this.children.length;i++)n.append(this.children[i],0);for(;r>0&&this.children[r-1].length==0;)this.children[--r].destroy();return this.children.length=r,this.markDirty(),this.length=e,n}transferDOM(e){this.dom&&(this.markDirty(),e.setDOM(this.dom),e.prevAttrs=this.prevAttrs===void 0?this.attrs:this.prevAttrs,this.prevAttrs=void 0,this.dom=null)}setDeco(e){zm(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){fC(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=am(n,this.attrs||{})),r&&(this.attrs=am({class:r},this.attrs||{}))}domAtPos(e){return dC(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(iC(this.dom),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0):(this.setDOM(document.createElement("div")),this.dom.className="cm-line",this.prevAttrs=this.attrs?null:void 0),this.prevAttrs!==void 0&&(um(this.dom,this.prevAttrs,this.attrs),this.dom.classList.add("cm-line"),this.prevAttrs=void 0),super.sync(e,n);let o=this.dom.lastChild;for(;o&&xe.get(o)instanceof Pr;)o=o.lastChild;if(!o||!this.length||o.nodeName!="BR"&&((r=xe.get(o))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(i=>i instanceof Jn))){let i=document.createElement("BR");i.cmIgnore=!0,this.dom.appendChild(i)}}measureTextSize(){if(this.children.length==0||this.length>20)return null;let e=0,n;for(let r of this.children){if(!(r instanceof Jn)||/[^ -~]/.test(r.text))return null;let o=ml(r.dom);if(o.length!=1)return null;e+=o[0].width,n=o[0].height}return e?{lineHeight:this.dom.getBoundingClientRect().height,charWidth:e/this.length,textHeight:n}:null}coordsAt(e,n){let r=hC(this,e,n);if(!this.children.length&&r&&this.parent){let{heightOracle:o}=this.parent.view.viewState,i=r.bottom-r.top;if(Math.abs(i-o.lineHeight)<2&&o.textHeight<i){let s=(i-o.textHeight)/2;return{top:r.top+s,bottom:r.bottom-s,left:r.left,right:r.left}}}return r}become(e){return!1}get type(){return Oe.Text}static find(e,n){for(let r=0,o=0;r<e.children.length;r++){let i=e.children[r],s=o+i.length;if(s>=n){if(i instanceof t)return i;if(s>n)break}o=s+i.breakAfter}return null}},bl=class t extends xe{constructor(e,n,r){super(),this.widget=e,this.length=n,this.type=r,this.breakAfter=0,this.prevWidget=null}merge(e,n,r,o,i,s){return r&&(!(r instanceof t)||!this.widget.compare(r.widget)||e>0&&i<=0||n<this.length&&s<=0)?!1:(this.length=e+(r?r.length:0)+(this.length-n),!0)}domAtPos(e){return e==0?Tt.before(this.dom):Tt.after(this.dom,e==this.length)}split(e){let n=this.length-e;this.length=e;let r=new t(this.widget,n,this.type);return r.breakAfter=this.breakAfter,r}get children(){return Vm}sync(e){(!this.dom||!this.widget.updateDOM(this.dom,e))&&(this.dom&&this.prevWidget&&this.prevWidget.destroy(this.dom),this.prevWidget=null,this.setDOM(this.widget.toDOM(e)),this.dom.contentEditable="false")}get overrideDOMText(){return this.parent?this.parent.view.state.doc.slice(this.posAtStart,this.posAtEnd):de.empty}domBoundsAround(){return null}become(e){return e instanceof t&&e.widget.constructor==this.widget.constructor?(e.widget.compare(this.widget)||this.markDirty(!0),this.dom&&!this.prevWidget&&(this.prevWidget=this.widget),this.widget=e.widget,this.length=e.length,this.type=e.type,this.breakAfter=e.breakAfter,!0):!1}ignoreMutation(){return!0}ignoreEvent(e){return this.widget.ignoreEvent(e)}get isEditable(){return!1}get isWidget(){return!0}coordsAt(e,n){return this.widget.coordsAt(this.dom,e,n)}destroy(){super.destroy(),this.dom&&this.widget.destroy(this.dom)}},fl=class t{constructor(e,n,r,o){this.doc=e,this.pos=n,this.end=r,this.disallowBlockEffectsFor=o,this.content=[],this.curLine=null,this.breakAtStart=0,this.pendingBuffer=0,this.bufferMarks=[],this.atCursorPos=!0,this.openStart=-1,this.openEnd=-1,this.text="",this.textOff=0,this.cursor=e.iter(),this.skip=n}posCovered(){if(this.content.length==0)return!this.breakAtStart&&this.doc.lineAt(this.pos).from!=this.pos;let e=this.content[this.content.length-1];return!e.breakAfter&&!(e instanceof bl&&e.type==Oe.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new Nt),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append(cc(new gl(-1),e),e.length),this.pendingBuffer=0)}addBlockWidget(e){this.flushBuffer(),this.curLine=null,this.content.push(e)}finish(e){this.pendingBuffer&&e<=this.bufferMarks.length?this.flushBuffer():this.pendingBuffer=0,this.posCovered()||this.getLine()}buildText(e,n,r){for(;e>0;){if(this.textOff==this.text.length){let{value:i,lineBreak:s,done:l}=this.cursor.next(this.skip);if(this.skip=0,l)throw new Error("Ran out of text content when drawing inline views");if(s){this.posCovered()||this.getLine(),this.content.length?this.content[this.content.length-1].breakAfter=1:this.breakAtStart=1,this.flushBuffer(),this.curLine=null,this.atCursorPos=!0,e--;continue}else this.text=i,this.textOff=0}let o=Math.min(this.text.length-this.textOff,e,512);this.flushBuffer(n.slice(n.length-r)),this.getLine().append(cc(new Jn(this.text.slice(this.textOff,this.textOff+o)),n),r),this.atCursorPos=!0,this.textOff+=o,e-=o,r=0}}span(e,n,r,o){this.buildText(n-e,r,o),this.pos=n,this.openStart<0&&(this.openStart=o)}point(e,n,r,o,i,s){if(this.disallowBlockEffectsFor[s]&&r instanceof Dr){if(r.block)throw new RangeError("Block decorations may not be specified via plugins");if(n>this.doc.lineAt(this.pos).to)throw new RangeError("Decorations that replace line breaks may not be specified via plugins")}let l=n-e;if(r instanceof Dr)if(r.block){let{type:a}=r;a==Oe.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new bl(r.widget||new Lc("div"),l,a))}else{let a=Ic.create(r.widget||new Lc("span"),l,l?0:r.startSide),u=this.atCursorPos&&!a.isEditable&&i<=o.length&&(e<n||r.startSide>0),c=!a.isEditable&&(e<n||i>o.length||r.startSide<=0),f=this.getLine();this.pendingBuffer==2&&!u&&!a.isEditable&&(this.pendingBuffer=0),this.flushBuffer(o),u&&(f.append(cc(new gl(1),o),i),i=o.length+Math.max(0,i-o.length)),f.append(cc(a,o),i),this.atCursorPos=c,this.pendingBuffer=c?e<n||i>o.length?1:2:0,this.pendingBuffer&&(this.bufferMarks=o.slice())}else this.doc.lineAt(this.pos).from==this.pos&&this.getLine().addLineDeco(r);l&&(this.textOff+l<=this.text.length?this.textOff+=l:(this.skip+=l-(this.text.length-this.textOff),this.text="",this.textOff=0),this.pos=n),this.openStart<0&&(this.openStart=i)}static build(e,n,r,o,i){let s=new t(e,n,r,i);return s.openEnd=Ae.spans(o,n,r,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}};function cc(t,e){for(let n of e)t=new Pr(n,[t],t.length);return t}var Lc=class extends Zn{constructor(e){super(),this.tag=e}eq(e){return e.tag==this.tag}toDOM(){return document.createElement(this.tag)}updateDOM(e){return e.nodeName.toLowerCase()==this.tag}get isHidden(){return!0}},mC=ne.define(),gC=ne.define(),vC=ne.define(),yC=ne.define(),dm=ne.define(),bC=ne.define(),xC=ne.define(),wC=ne.define({combine:t=>t.some(e=>e)}),SC=ne.define({combine:t=>t.some(e=>e)}),Pc=class t{constructor(e,n="nearest",r="nearest",o=5,i=5){this.range=e,this.y=n,this.x=r,this.yMargin=o,this.xMargin=i}map(e){return e.empty?this:new t(this.range.map(e),this.y,this.x,this.yMargin,this.xMargin)}},RS=Se.define({map:(t,e)=>t.map(e)});function Ln(t,e,n){let r=t.facet(yC);r.length?r[0](e):window.onerror?window.onerror(String(e),n,void 0,void 0,e):n?console.error(n+":",e):console.error(e)}var Bc=ne.define({combine:t=>t.length?t[0]:!0}),Z6=0,ul=ne.define(),Yn=class t{constructor(e,n,r,o){this.id=e,this.create=n,this.domEventHandlers=r,this.extension=o(this)}static define(e,n){let{eventHandlers:r,provide:o,decorations:i}=n||{};return new t(Z6++,e,r,s=>{let l=[ul.of(s)];return i&&l.push(xl.of(a=>{let u=a.plugin(s);return u?i(u):_e.none})),o&&l.push(o(s)),l})}static fromClass(e,n){return t.define(r=>new e(r),n)}},hl=class{constructor(e){this.spec=e,this.mustUpdate=null,this.value=null}update(e){if(this.value){if(this.mustUpdate){let n=this.mustUpdate;if(this.mustUpdate=null,this.value.update)try{this.value.update(n)}catch(r){if(Ln(n.state,r,"CodeMirror plugin crashed"),this.value.destroy)try{this.value.destroy()}catch{}this.deactivate()}}}else if(this.spec)try{this.value=this.spec.create(e)}catch(n){Ln(e.state,n,"CodeMirror plugin crashed"),this.deactivate()}return this}destroy(e){var n;if(!((n=this.value)===null||n===void 0)&&n.destroy)try{this.value.destroy()}catch(r){Ln(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},CC=ne.define(),$m=ne.define(),xl=ne.define(),_m=ne.define(),kC=ne.define();function EC(t){let e=0,n=0,r=0,o=0;for(let i of t.state.facet(kC)){let s=i(t);s&&(s.left!=null&&(e=Math.max(e,s.left)),s.right!=null&&(n=Math.max(n,s.right)),s.top!=null&&(r=Math.max(r,s.top)),s.bottom!=null&&(o=Math.max(o,s.bottom)))}return{left:e,right:n,top:r,bottom:o}}var cl=ne.define(),Pn=class t{constructor(e,n,r,o){this.fromA=e,this.toA=n,this.fromB=r,this.toB=o}join(e){return new t(Math.min(this.fromA,e.fromA),Math.max(this.toA,e.toA),Math.min(this.fromB,e.fromB),Math.max(this.toB,e.toB))}addToSet(e){let n=e.length,r=this;for(;n>0;n--){let o=e[n-1];if(!(o.fromA>r.toA)){if(o.toA<r.fromA)break;r=r.join(o),e.splice(n-1,1)}}return e.splice(n,0,r),e}static extendWithRanges(e,n){if(n.length==0)return e;let r=[];for(let o=0,i=0,s=0,l=0;;o++){let a=o==e.length?null:e[o],u=s-l,c=a?a.fromB:1e9;for(;i<n.length&&n[i]<c;){let f=n[i],d=n[i+1],h=Math.max(l,f),g=Math.min(c,d);if(h<=g&&new t(h+u,g+u,h,g).addToSet(r),d>c)break;i+=2}if(!a)return r;new t(a.fromA,a.toA,a.fromB,a.toB).addToSet(r),s=a.toA,l=a.toB}}},Dc=class t{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=yt.empty(this.startState.doc.length);for(let i of r)this.changes=this.changes.compose(i.changes);let o=[];this.changes.iterChangedRanges((i,s,l,a)=>o.push(new Pn(i,s,l,a))),this.changedRanges=o}static create(e,n,r){return new t(e,n,r)}get viewportChanged(){return(this.flags&4)>0}get heightChanged(){return(this.flags&2)>0}get geometryChanged(){return this.docChanged||(this.flags&10)>0}get focusChanged(){return(this.flags&1)>0}get docChanged(){return!this.changes.empty}get selectionSet(){return this.transactions.some(e=>e.selection)}get empty(){return this.flags==0&&this.transactions.length==0}},Re=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Re||(Re={})),fm=Re.LTR,Y6=Re.RTL;function MC(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}var Q6=MC("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),X6=MC("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),hm=Object.create(null),Tn=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);hm[e]=n,hm[n]=-e}function e4(t){return t<=247?Q6[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?X6[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:t==8204?256:1}var t4=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,Tr=class{constructor(e,n,r){this.from=e,this.to=n,this.level=r}get dir(){return this.level%2?Y6:fm}side(e,n){return this.dir==n==e?this.to:this.from}static find(e,n,r,o){let i=-1;for(let s=0;s<e.length;s++){let l=e[s];if(l.from<=n&&l.to>=n){if(l.level==r)return s;(i<0||(o!=0?o<0?l.from<n:l.to>n:e[i].level>l.level))&&(i=s)}}if(i<0)throw new RangeError("Index out of range");return i}},Ee=[];function n4(t,e){let n=t.length,r=e==fm?1:2,o=e==fm?2:1;if(!t||r==1&&!t4.test(t))return TC(n);for(let s=0,l=r,a=r;s<n;s++){let u=e4(t.charCodeAt(s));u==512?u=l:u==8&&a==4&&(u=16),Ee[s]=u==4?2:u,u&7&&(a=u),l=u}for(let s=0,l=r,a=r;s<n;s++){let u=Ee[s];if(u==128)s<n-1&&l==Ee[s+1]&&l&24?u=Ee[s]=l:Ee[s]=256;else if(u==64){let c=s+1;for(;c<n&&Ee[c]==64;)c++;let f=s&&l==8||c<n&&Ee[c]==8?a==1?1:8:256;for(let d=s;d<c;d++)Ee[d]=f;s=c-1}else u==8&&a==1&&(Ee[s]=1);l=u,u&7&&(a=u)}for(let s=0,l=0,a=0,u,c,f;s<n;s++)if(c=hm[u=t.charCodeAt(s)])if(c<0){for(let d=l-3;d>=0;d-=3)if(Tn[d+1]==-c){let h=Tn[d+2],g=h&2?r:h&4?h&1?o:r:0;g&&(Ee[s]=Ee[Tn[d]]=g),l=d;break}}else{if(Tn.length==189)break;Tn[l++]=s,Tn[l++]=u,Tn[l++]=a}else if((f=Ee[s])==2||f==1){let d=f==r;a=d?0:1;for(let h=l-3;h>=0;h-=3){let g=Tn[h+2];if(g&2)break;if(d)Tn[h+2]|=2;else{if(g&4)break;Tn[h+2]|=4}}}for(let s=0;s<n;s++)if(Ee[s]==256){let l=s+1;for(;l<n&&Ee[l]==256;)l++;let a=(s?Ee[s-1]:r)==1,u=(l<n?Ee[l]:r)==1,c=a==u?a?1:2:r;for(let f=s;f<l;f++)Ee[f]=c;s=l-1}let i=[];if(r==1)for(let s=0;s<n;){let l=s,a=Ee[s++]!=1;for(;s<n&&a==(Ee[s]!=1);)s++;if(a)for(let u=s;u>l;){let c=u,f=Ee[--u]!=2;for(;u>l&&f==(Ee[u-1]!=2);)u--;i.push(new Tr(u,c,f?2:1))}else i.push(new Tr(l,s,0))}else for(let s=0;s<n;){let l=s,a=Ee[s++]==2;for(;s<n&&a==(Ee[s]==2);)s++;i.push(new Tr(l,s,a?1:2))}return i}function TC(t){return[new Tr(0,t,0)]}var IC="";function r4(t,e,n,r,o){var i;let s=r.head-t.from,l=-1;if(s==0){if(!o||!t.length)return null;e[0].level!=n&&(s=e[0].side(!1,n),l=0)}else if(s==t.length){if(o)return null;let d=e[e.length-1];d.level!=n&&(s=d.side(!0,n),l=e.length-1)}l<0&&(l=Tr.find(e,s,(i=r.bidiLevel)!==null&&i!==void 0?i:-1,r.assoc));let a=e[l];s==a.side(o,n)&&(a=e[l+=o?1:-1],s=a.side(!o,n));let u=o==(a.dir==n),c=ut(t.text,s,u);if(IC=t.text.slice(Math.min(s,c),Math.max(s,c)),c!=a.side(o,n))return $.cursor(c+t.from,u?-1:1,a.level);let f=l==(o?e.length-1:0)?null:e[l+(o?1:-1)];return!f&&a.level!=n?$.cursor(o?t.to:t.from,o?-1:1,n):f&&f.level<a.level?$.cursor(f.side(!o,n)+t.from,o?1:-1,f.level):$.cursor(c+t.from,o?-1:1,a.level)}var Ac=class extends xe{constructor(e){super(),this.view=e,this.decorations=[],this.dynamicDecorationMap=[],this.hasComposition=null,this.markedForComposition=new Set,this.minWidth=0,this.minWidthFrom=0,this.minWidthTo=0,this.impreciseAnchor=null,this.impreciseHead=null,this.forceSelection=!1,this.lastUpdate=Date.now(),this.setDOM(e.contentDOM),this.children=[new Nt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new Pn(0,0,0,e.state.doc.length)],0,null)}get length(){return this.view.state.doc.length}update(e){let n=e.changedRanges;this.minWidth>0&&n.length&&(n.every(({fromA:l,toA:a})=>a<this.minWidthFrom||l>this.minWidthTo)?(this.minWidthFrom=e.changes.mapPos(this.minWidthFrom,1),this.minWidthTo=e.changes.mapPos(this.minWidthTo,1)):this.minWidth=this.minWidthFrom=this.minWidthTo=0);let r=this.view.inputState.composing<0?null:i4(this.view,e.changes);if(this.hasComposition){this.markedForComposition.clear();let{from:l,to:a}=this.hasComposition;n=new Pn(l,a,e.changes.mapPos(l,-1),e.changes.mapPos(a,1)).addToSet(n.slice())}this.hasComposition=r?{from:r.range.fromB,to:r.range.toB}:null,(Q.ie||Q.chrome)&&!r&&e&&e.state.doc.lines!=e.startState.doc.lines&&(this.forceSelection=!0);let o=this.decorations,i=this.updateDeco(),s=l4(o,i,e.changes);return n=Pn.extendWithRanges(n,s),!(this.flags&7)&&n.length==0?!1:(this.updateInner(n,e.startState.doc.length,r),e.transactions.length&&(this.lastUpdate=Date.now()),!0)}updateInner(e,n,r){this.view.viewState.mustMeasureContent=!0,this.updateChildren(e,n,r);let{observer:o}=this.view;o.ignore(()=>{this.dom.style.height=this.view.viewState.contentHeight+"px",this.dom.style.flexBasis=this.minWidth?this.minWidth+"px":"";let s=Q.chrome||Q.ios?{node:o.selectionRange.focusNode,written:!1}:void 0;this.sync(this.view,s),this.flags&=-8,s&&(s.written||o.selectionRange.focusNode!=s.node)&&(this.forceSelection=!0),this.dom.style.height=""}),this.markedForComposition.forEach(s=>s.flags&=-9);let i=[];if(this.view.viewport.from||this.view.viewport.to<this.view.state.doc.length)for(let s of this.children)s instanceof bl&&s.widget instanceof Rc&&i.push(s.dom);o.updateGaps(i)}updateChildren(e,n,r){let o=r?r.range.addToSet(e.slice()):e,i=this.childCursor(n);for(let s=o.length-1;;s--){let l=s>=0?o[s]:null;if(!l)break;let{fromA:a,toA:u,fromB:c,toB:f}=l,d,h,g,v;if(r&&r.range.fromB<f&&r.range.toB>c){let b=fl.build(this.view.state.doc,c,r.range.fromB,this.decorations,this.dynamicDecorationMap),C=fl.build(this.view.state.doc,r.range.toB,f,this.decorations,this.dynamicDecorationMap);h=b.breakAtStart,g=b.openStart,v=C.openEnd;let w=this.compositionView(r);C.breakAtStart?w.breakAfter=1:C.content.length&&w.merge(w.length,w.length,C.content[0],!1,C.openStart,0)&&(w.breakAfter=C.content[0].breakAfter,C.content.shift()),b.content.length&&w.merge(0,0,b.content[b.content.length-1],!0,0,b.openEnd)&&b.content.pop(),d=b.content.concat(w).concat(C.content)}else({content:d,breakAtStart:h,openStart:g,openEnd:v}=fl.build(this.view.state.doc,c,f,this.decorations,this.dynamicDecorationMap));let{i:p,off:m}=i.findPos(u,1),{i:y,off:x}=i.findPos(a,-1);lC(this,y,x,p,m,d,h,g,v)}r&&this.fixCompositionDOM(r)}compositionView(e){let n=new Jn(e.text.nodeValue);n.flags|=8;for(let{deco:o}of e.marks)n=new Pr(o,[n],n.length);let r=new Nt;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,s)=>{s.flags|=8,this.markedForComposition.add(s);let l=xe.get(i);l!=s&&(l&&(l.dom=null),s.setDOM(i))},r=this.childPos(e.range.fromB,1),o=this.children[r.i];n(e.line,o);for(let i=e.marks.length-1;i>=-1;i--)r=o.childPos(r.off,1),o=o.children[r.i],n(i>=0?e.marks[i].node:e.text,o)}updateSelection(e=!1,n=!1){(e||!this.view.observer.selectionRange.focusNode)&&this.view.observer.readSelectionRange();let r=this.view.root.activeElement,o=r==this.dom,i=!o&&vc(this.dom,this.view.observer.selectionRange)&&!(r&&this.dom.contains(r));if(!(o||n||i))return;let s=this.forceSelection;this.forceSelection=!1;let l=this.view.state.selection.main,a=this.domAtPos(l.anchor),u=l.empty?a:this.domAtPos(l.head);if(Q.gecko&&l.empty&&!this.hasComposition&&o4(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new Tt(f,0),s=!0}let c=this.view.observer.selectionRange;(s||!c.focusNode||!Cc(a.node,a.offset,c.anchorNode,c.anchorOffset)||!Cc(u.node,u.offset,c.focusNode,c.focusOffset))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(c.focusNode)&&a4(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Sc(this.view.root);if(f)if(l.empty){if(Q.gecko){let d=s4(a.node,a.offset);if(d&&d!=3){let h=PC(a.node,a.offset,d==1?1:-1);h&&(a=new Tt(h,d==1?0:h.nodeValue.length))}}f.collapse(a.node,a.offset),l.bidiLevel!=null&&c.cursorBidiLevel!=null&&(c.cursorBidiLevel=l.bidiLevel)}else if(f.extend){f.collapse(a.node,a.offset);try{f.extend(u.node,u.offset)}catch{}}else{let d=document.createRange();l.anchor>l.head&&([a,u]=[u,a]),d.setEnd(u.node,u.offset),d.setStart(a.node,a.offset),f.removeAllRanges(),f.addRange(d)}i&&this.view.root.activeElement==this.dom&&(this.dom.blur(),r&&r.focus())}),this.view.observer.setSelectionRange(a,u)),this.impreciseAnchor=a.precise?null:new Tt(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new Tt(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Sc(e.root),{anchorNode:o,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let s=Nt.find(this,n.head);if(!s)return;let l=s.posAtStart;if(n.head==l||n.head==l+s.length)return;let a=this.coordsAt(n.head,-1),u=this.coordsAt(n.head,1);if(!a||!u||a.bottom>u.top)return;let c=this.domAtPos(n.head+n.assoc);r.collapse(c.node,c.offset),r.modify("move",n.assoc<0?"forward":"backward","lineboundary"),e.observer.readSelectionRange();let f=e.observer.selectionRange;e.docView.posFromDOM(f.anchorNode,f.anchorOffset)!=n.from&&r.collapse(o,i)}nearest(e){for(let n=e;n;){let r=xe.get(n);if(r&&r.rootView==this)return r;n=n.parentNode}return null}posFromDOM(e,n){let r=this.nearest(e);if(!r)throw new RangeError("Trying to find position for a DOM position outside of the document");return r.localPosFromDOM(e,n)+r.posAtStart}domAtPos(e){let{i:n,off:r}=this.childCursor().findPos(e,-1);for(;n<this.children.length-1;){let o=this.children[n];if(r<o.length||o instanceof Nt)break;n++,r=0}return this.children[n].domAtPos(r)}coordsAt(e,n){for(let r=this.length,o=this.children.length-1;;o--){let i=this.children[o],s=r-i.breakAfter-i.length;if(e>s||e==s&&i.type!=Oe.WidgetBefore&&i.type!=Oe.WidgetAfter&&(!o||n==2||this.children[o-1].breakAfter||this.children[o-1].type==Oe.WidgetBefore&&n>-2))return i.coordsAt(e-s,n);r=s}}coordsForChar(e){let{i:n,off:r}=this.childPos(e,1),o=this.children[n];if(!(o instanceof Nt))return null;for(;o.children.length;){let{i:l,off:a}=o.childPos(r,1);for(;;l++){if(l==o.children.length)return null;if((o=o.children[l]).length)break}r=a}if(!(o instanceof Jn))return null;let i=ut(o.text,r);if(i==r)return null;let s=Co(o.dom,r,i).getClientRects();return!s.length||s[0].top>=s[0].bottom?null:s[0]}measureVisibleLineHeights(e){let n=[],{from:r,to:o}=e,i=this.view.contentDOM.clientWidth,s=i>Math.max(this.view.scrollDOM.clientWidth,this.minWidth)+1,l=-1,a=this.view.textDirection==Re.LTR;for(let u=0,c=0;c<this.children.length;c++){let f=this.children[c],d=u+f.length;if(d>o)break;if(u>=r){let h=f.dom.getBoundingClientRect();if(n.push(h.height),s){let g=f.dom.lastChild,v=g?ml(g):[];if(v.length){let p=v[v.length-1],m=a?p.right-h.left:h.right-p.left;m>l&&(l=m,this.minWidth=i,this.minWidthFrom=u,this.minWidthTo=d)}}}u=d+f.breakAfter}return n}textDirectionAt(e){let{i:n}=this.childPos(e,1);return getComputedStyle(this.children[n].dom).direction=="rtl"?Re.RTL:Re.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Nt){let s=i.measureTextSize();if(s)return s}let e=document.createElement("div"),n,r,o;return e.className="cm-line",e.style.width="99999px",e.style.position="absolute",e.textContent="abc def ghi jkl mno pqr stu",this.view.observer.ignore(()=>{this.dom.appendChild(e);let i=ml(e.firstChild)[0];n=e.getBoundingClientRect().height,r=i?i.width/27:7,o=i?i.height:n,e.remove()}),{lineHeight:n,charWidth:r,textHeight:o}}childCursor(e=this.length){let n=this.children.length;return n&&(e-=this.children[--n].length),new Ec(this.children,e,n)}computeBlockGapDeco(){let e=[],n=this.view.viewState;for(let r=0,o=0;;o++){let i=o==n.viewports.length?null:n.viewports[o],s=i?i.from-1:this.length;if(s>r){let l=n.lineBlockAt(s).bottom-n.lineBlockAt(r).top;e.push(_e.replace({widget:new Rc(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,s))}if(!i)break;r=i.to+1}return _e.set(e)}updateDeco(){let e=this.view.state.facet(xl).map((n,r)=>(this.dynamicDecorationMap[r]=typeof n=="function")?n(this.view):n);for(let n=e.length;n<e.length+3;n++)this.dynamicDecorationMap[n]=!1;return this.decorations=[...e,this.computeBlockGapDeco(),this.view.viewState.lineGapDeco]}scrollIntoView(e){let{range:n}=e,r=this.coordsAt(n.head,n.empty?n.assoc:n.head>n.anchor?-1:1),o;if(!r)return;!n.empty&&(o=this.coordsAt(n.anchor,n.anchor>n.head?-1:1))&&(r={left:Math.min(r.left,o.left),top:Math.min(r.top,o.top),right:Math.max(r.right,o.right),bottom:Math.max(r.bottom,o.bottom)});let i=EC(this.view),s={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom};$6(this.view.scrollDOM,s,n.head<n.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==Re.LTR)}};function o4(t){return t.node.nodeType==1&&t.node.firstChild&&(t.offset==0||t.node.childNodes[t.offset-1].contentEditable=="false")&&(t.offset==t.node.childNodes.length||t.node.childNodes[t.offset].contentEditable=="false")}var Rc=class extends Zn{constructor(e){super(),this.height=e}toDOM(){let e=document.createElement("div");return this.updateDOM(e),e}eq(e){return e.height==this.height}updateDOM(e){return e.style.height=this.height+"px",!0}get estimatedHeight(){return this.height}};function LC(t){let e=t.observer.selectionRange,n=e.focusNode&&PC(e.focusNode,e.focusOffset,0);if(!n)return null;let r=xe.get(n),o,i;if(r instanceof Jn)o=r.posAtStart,i=o+r.length;else e:for(let s=0,l=n;;){for(let u=l.previousSibling,c;u;u=u.previousSibling){if(c=xe.get(u)){o=i=c.posAtEnd+s;break e}let f=new Mc([],t.state);if(f.readNode(u),f.text.indexOf(Pi)>-1)return null;s+=f.text.length}if(l=l.parentNode,!l)return null;let a=xe.get(l);if(a){o=i=a.posAtStart+s;break}}return{from:o,to:i,node:n}}function i4(t,e){let n=LC(t);if(!n)return null;let{from:r,to:o,node:i}=n,s=e.mapPos(r,-1),l=e.mapPos(o,1),a=i.nodeValue;if(/[\n\r]/.test(a))return null;if(l-s!=a.length){let d=e.mapPos(r,1),h=e.mapPos(o,-1);if(h-d==a.length)s=d,l=h;else if(t.state.doc.sliceString(l-a.length,l)==a)s=l-a.length;else if(t.state.doc.sliceString(s,s+a.length)==a)l=s+a.length;else return null}let{main:u}=t.state.selection;if(t.state.doc.sliceString(s,l)!=a||s>u.head||l<u.head)return null;let c=[],f=new Pn(r,o,s,l);for(let d=i.parentNode;;d=d.parentNode){let h=xe.get(d);if(h instanceof Pr)c.push({node:d,deco:h.mark});else{if(h instanceof Nt||d.nodeName=="DIV"&&d.parentNode==t.contentDOM)return{range:f,text:i,marks:c,line:d};if(d!=t.contentDOM)c.push({node:d,deco:new vl({inclusive:!0,attributes:G6(d),tagName:d.tagName.toLowerCase()})});else return null}}}function PC(t,e,n){if(n<=0)for(let r=t,o=e;;){if(r.nodeType==3)return r;if(r.nodeType==1&&o>0)r=r.childNodes[o-1],o=Lr(r);else break}if(n>=0)for(let r=t,o=e;;){if(r.nodeType==3)return r;if(r.nodeType==1&&o<r.childNodes.length&&n>=0)r=r.childNodes[o],o=0;else break}return null}function s4(t,e){return t.nodeType!=1?0:(e&&t.childNodes[e-1].contentEditable=="false"?1:0)|(e<t.childNodes.length&&t.childNodes[e].contentEditable=="false"?2:0)}var pm=class{constructor(){this.changes=[]}compareRange(e,n){cm(e,n,this.changes)}comparePoint(e,n){cm(e,n,this.changes)}};function l4(t,e,n){let r=new pm;return Ae.compare(t,e,n,r),r.changes}function a4(t,e){for(let n=t;n&&n!=e;n=n.assignedSlot||n.parentNode)if(n.nodeType==1&&n.contentEditable=="false")return!0;return!1}function u4(t,e,n=1){let r=t.charCategorizer(e),o=t.doc.lineAt(e),i=e-o.from;if(o.length==0)return $.cursor(e);i==0?n=1:i==o.length&&(n=-1);let s=i,l=i;n<0?s=ut(o.text,i,!1):l=ut(o.text,i);let a=r(o.text.slice(s,l));for(;s>0;){let u=ut(o.text,s,!1);if(r(o.text.slice(u,s))!=a)break;s=u}for(;l<o.length;){let u=ut(o.text,l);if(r(o.text.slice(l,u))!=a)break;l=u}return $.range(s+o.from,l+o.from)}function c4(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function d4(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function Xp(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function OS(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function HS(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function mm(t,e,n){let r,o,i,s,l=!1,a,u,c,f;for(let g=t.firstChild;g;g=g.nextSibling){let v=ml(g);for(let p=0;p<v.length;p++){let m=v[p];o&&Xp(o,m)&&(m=OS(HS(m,o.bottom),o.top));let y=c4(e,m),x=d4(n,m);if(y==0&&x==0)return g.nodeType==3?NS(g,e,n):mm(g,e,n);if(!r||s>x||s==x&&i>y){r=g,o=m,i=y,s=x;let b=x?n<m.top?-1:1:y?e<m.left?-1:1:0;l=!b||(b>0?p<v.length-1:p>0)}y==0?n>m.bottom&&(!c||c.bottom<m.bottom)?(a=g,c=m):n<m.top&&(!f||f.top>m.top)&&(u=g,f=m):c&&Xp(c,m)?c=HS(c,m.bottom):f&&Xp(f,m)&&(f=OS(f,m.top))}}if(c&&c.bottom>=n?(r=a,o=c):f&&f.top<=n&&(r=u,o=f),!r)return{node:t,offset:0};let d=Math.max(o.left,Math.min(o.right,e));if(r.nodeType==3)return NS(r,d,n);if(l&&r.contentEditable!="false")return mm(r,d,n);let h=Array.prototype.indexOf.call(t.childNodes,r)+(e>=(o.left+o.right)/2?1:0);return{node:t,offset:h}}function NS(t,e,n){let r=t.nodeValue.length,o=-1,i=1e9,s=0;for(let l=0;l<r;l++){let a=Co(t,l,l+1).getClientRects();for(let u=0;u<a.length;u++){let c=a[u];if(c.top==c.bottom)continue;s||(s=e-c.left);let f=(c.top>n?c.top-n:n-c.bottom)-1;if(c.left-1<=e&&c.right+1>=e&&f<i){let d=e>=(c.left+c.right)/2,h=d;if((Q.chrome||Q.gecko)&&Co(t,l).getBoundingClientRect().left==c.right&&(h=!d),f<=0)return{node:t,offset:l+(h?1:0)};o=l+(h?1:0),i=f}}}return{node:t,offset:o>-1?o:s>0?t.nodeValue.length:0}}function DC(t,e,n,r=-1){var o,i;let s=t.contentDOM.getBoundingClientRect(),l=s.top+t.viewState.paddingTop,a,{docHeight:u}=t.viewState,{x:c,y:f}=e,d=f-l;if(d<0)return 0;if(d>u)return t.state.doc.length;for(let b=t.viewState.heightOracle.textHeight/2,C=!1;a=t.elementAtHeight(d),a.type!=Oe.Text;)for(;d=r>0?a.bottom+b:a.top-b,!(d>=0&&d<=u);){if(C)return n?null:0;C=!0,r=-r}f=l+d;let h=a.from;if(h<t.viewport.from)return t.viewport.from==0?0:n?null:FS(t,s,a,c,f);if(h>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:FS(t,s,a,c,f);let g=t.dom.ownerDocument,v=t.root.elementFromPoint?t.root:g,p=v.elementFromPoint(c,f);p&&!t.contentDOM.contains(p)&&(p=null),p||(c=Math.max(s.left+1,Math.min(s.right-1,c)),p=v.elementFromPoint(c,f),p&&!t.contentDOM.contains(p)&&(p=null));let m,y=-1;if(p&&((o=t.docView.nearest(p))===null||o===void 0?void 0:o.isEditable)!=!1){if(g.caretPositionFromPoint){let b=g.caretPositionFromPoint(c,f);b&&({offsetNode:m,offset:y}=b)}else if(g.caretRangeFromPoint){let b=g.caretRangeFromPoint(c,f);b&&({startContainer:m,startOffset:y}=b,(!t.contentDOM.contains(m)||Q.safari&&f4(m,y,c)||Q.chrome&&h4(m,y,c))&&(m=void 0))}}if(!m||!t.docView.dom.contains(m)){let b=Nt.find(t.docView,h);if(!b)return d>a.top+a.height/2?a.to:a.from;({node:m,offset:y}=mm(b.dom,c,f))}let x=t.docView.nearest(m);if(!x)return null;if(x.isWidget&&((i=x.dom)===null||i===void 0?void 0:i.nodeType)==1){let b=x.dom.getBoundingClientRect();return e.y<b.top||e.y<=b.bottom&&e.x<=(b.left+b.right)/2?x.posAtStart:x.posAtEnd}else return x.localPosFromDOM(m,y)+x.posAtStart}function FS(t,e,n,r,o){let i=Math.round((r-e.left)*t.defaultCharacterWidth);if(t.lineWrapping&&n.height>t.defaultLineHeight*1.5){let l=t.viewState.heightOracle.textHeight,a=Math.floor((o-n.top-(t.defaultLineHeight-l)*.5)/l);i+=a*t.viewState.heightOracle.lineLength}let s=t.state.sliceDoc(n.from,n.to);return n.from+xS(s,i,t.state.tabSize)}function f4(t,e,n){let r;if(t.nodeType!=3||e!=(r=t.nodeValue.length))return!1;for(let o=t.nextSibling;o;o=o.nextSibling)if(o.nodeType!=1||o.nodeName!="BR")return!1;return Co(t,r-1,r).getBoundingClientRect().left>n}function h4(t,e,n){if(e!=0)return!1;for(let o=t;;){let i=o.parentNode;if(!i||i.nodeType!=1||i.firstChild!=o)return!1;if(i.classList.contains("cm-line"))break;o=i}let r=t.nodeType==1?t.getBoundingClientRect():Co(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function gm(t,e){let n=t.lineBlockAt(e);if(Array.isArray(n.type)){for(let r of n.type)if(r.to>e||r.to==e&&(r.to==n.to||r.type==Oe.Text))return r}return n}function p4(t,e,n,r){let o=gm(t,e.head),i=!r||o.type!=Oe.Text||!(t.lineWrapping||o.widgetLineBreaks)?null:t.coordsAtPos(e.assoc<0&&e.head>o.from?e.head-1:e.head);if(i){let s=t.dom.getBoundingClientRect(),l=t.textDirectionAt(o.from),a=t.posAtCoords({x:n==(l==Re.LTR)?s.right-1:s.left+1,y:(i.top+i.bottom)/2});if(a!=null)return $.cursor(a,n?-1:1)}return $.cursor(n?o.to:o.from,n?-1:1)}function BS(t,e,n,r){let o=t.state.doc.lineAt(e.head),i=t.bidiSpans(o),s=t.textDirectionAt(o.from);for(let l=e,a=null;;){let u=r4(o,i,s,l,n),c=IC;if(!u){if(o.number==(n?t.state.doc.lines:1))return l;c=`
|
|
415
|
-
`,o=t.state.doc.line(o.number+(n?1:-1)),i=t.bidiSpans(o),u=$.cursor(n?o.from:o.to)}if(a){if(!a(c))return l}else{if(!r)return u;a=r(c)}l=u}}function m4(t,e,n){let r=t.state.charCategorizer(e),o=r(n);return i=>{let s=r(i);return o==vt.Space&&(o=s),o==s}}function g4(t,e,n,r){let o=e.head,i=n?1:-1;if(o==(n?t.state.doc.length:0))return $.cursor(o,e.assoc);let s=e.goalColumn,l,a=t.contentDOM.getBoundingClientRect(),u=t.coordsAtPos(o),c=t.documentTop;if(u)s==null&&(s=u.left-a.left),l=i<0?u.top:u.bottom;else{let h=t.viewState.lineBlockAt(o);s==null&&(s=Math.min(a.right-a.left,t.defaultCharacterWidth*(o-h.from))),l=(i<0?h.top:h.bottom)+c}let f=a.left+s,d=r!=null?r:t.viewState.heightOracle.textHeight>>1;for(let h=0;;h+=10){let g=l+(d+h)*i,v=DC(t,{x:f,y:g},!1,i);if(g<a.top||g>a.bottom||(i<0?v<o:v>o))return $.cursor(v,e.assoc,void 0,s)}}function yc(t,e,n){for(;;){let r=0;for(let o of t)o.between(e-1,e+1,(i,s,l)=>{if(e>i&&e<s){let a=r||n||(e-i<s-e?-1:1);e=a<0?i:s,r=a}});if(!r)return e}}function em(t,e,n){let r=yc(t.state.facet(_m).map(o=>o(t)),n.from,e.head>n.from?-1:1);return r==n.from?n:$.cursor(r,r<n.from?1:-1)}var vm=class{constructor(e){this.lastKeyCode=0,this.lastKeyTime=0,this.lastTouchTime=0,this.lastFocusTime=0,this.lastScrollTop=0,this.lastScrollLeft=0,this.chromeScrollHack=-1,this.pendingIOSKey=void 0,this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastEscPress=0,this.lastContextMenu=0,this.scrollHandlers=[],this.registeredEvents=[],this.customHandlers=[],this.composing=-1,this.compositionFirstChange=null,this.compositionEndedAt=0,this.compositionPendingKey=!1,this.compositionPendingChange=!1,this.mouseSelection=null;let n=(r,o)=>{this.ignoreDuringComposition(o)||o.type=="keydown"&&this.keydown(e,o)||(this.mustFlushObserver(o)&&e.observer.forceFlush(),this.runCustomHandlers(o.type,e,o)?o.preventDefault():r(e,o))};for(let r in Fe){let o=Fe[r];e.contentDOM.addEventListener(r,i=>{VS(e,i)&&n(o,i)},bm[r]),this.registeredEvents.push(r)}e.scrollDOM.addEventListener("mousedown",r=>{if(r.target==e.scrollDOM&&r.clientY>e.contentDOM.getBoundingClientRect().bottom&&(n(Fe.mousedown,r),!r.defaultPrevented&&r.button==2)){let o=e.contentDOM.style.minHeight;e.contentDOM.style.minHeight="100%",setTimeout(()=>e.contentDOM.style.minHeight=o,200)}}),e.scrollDOM.addEventListener("drop",r=>{r.target==e.scrollDOM&&r.clientY>e.contentDOM.getBoundingClientRect().bottom&&n(Fe.drop,r)}),Q.chrome&&Q.chrome_version==102&&e.scrollDOM.addEventListener("wheel",()=>{this.chromeScrollHack<0?e.contentDOM.style.pointerEvents="none":window.clearTimeout(this.chromeScrollHack),this.chromeScrollHack=setTimeout(()=>{this.chromeScrollHack=-1,e.contentDOM.style.pointerEvents=""},100)},{passive:!0}),this.notifiedFocused=e.hasFocus,Q.safari&&e.contentDOM.addEventListener("input",()=>null)}setSelectionOrigin(e){this.lastSelectionOrigin=e,this.lastSelectionTime=Date.now()}ensureHandlers(e,n){var r;let o;this.customHandlers=[];for(let i of n)if(o=(r=i.update(e).spec)===null||r===void 0?void 0:r.domEventHandlers){this.customHandlers.push({plugin:i.value,handlers:o});for(let s in o)this.registeredEvents.indexOf(s)<0&&s!="scroll"&&(this.registeredEvents.push(s),e.contentDOM.addEventListener(s,l=>{VS(e,l)&&this.runCustomHandlers(s,e,l)&&l.preventDefault()}))}}runCustomHandlers(e,n,r){for(let o of this.customHandlers){let i=o.handlers[e];if(i)try{if(i.call(o.plugin,r,n)||r.defaultPrevented)return!0}catch(s){Ln(n.state,s)}}return!1}runScrollHandlers(e,n){this.lastScrollTop=e.scrollDOM.scrollTop,this.lastScrollLeft=e.scrollDOM.scrollLeft;for(let r of this.customHandlers){let o=r.handlers.scroll;if(o)try{o.call(r.plugin,n,e)}catch(i){Ln(e.state,i)}}}keydown(e,n){if(this.lastKeyCode=n.keyCode,this.lastKeyTime=Date.now(),n.keyCode==9&&Date.now()<this.lastEscPress+2e3)return!0;if(n.keyCode!=27&&RC.indexOf(n.keyCode)<0&&(e.inputState.lastEscPress=0),Q.android&&Q.chrome&&!n.synthetic&&(n.keyCode==13||n.keyCode==8))return e.observer.delayAndroidKey(n.key,n.keyCode),!0;let r;return Q.ios&&!n.synthetic&&!n.altKey&&!n.metaKey&&((r=AC.find(o=>o.keyCode==n.keyCode))&&!n.ctrlKey||v4.indexOf(n.key)>-1&&n.ctrlKey&&!n.shiftKey)?(this.pendingIOSKey=r||n,setTimeout(()=>this.flushIOSKey(e),250),!0):!1}flushIOSKey(e){let n=this.pendingIOSKey;return n?(this.pendingIOSKey=void 0,Ai(e.contentDOM,n.key,n.keyCode)):!1}ignoreDuringComposition(e){return/^key/.test(e.type)?this.composing>0?!0:Q.safari&&!Q.ios&&this.compositionPendingKey&&Date.now()-this.compositionEndedAt<100?(this.compositionPendingKey=!1,!0):!1:!1}mustFlushObserver(e){return e.type=="keydown"&&e.keyCode!=229}startMouseSelection(e){this.mouseSelection&&this.mouseSelection.destroy(),this.mouseSelection=e}update(e){this.mouseSelection&&this.mouseSelection.update(e),e.transactions.length&&(this.lastKeyCode=this.lastSelectionTime=0)}destroy(){this.mouseSelection&&this.mouseSelection.destroy()}},AC=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],v4="dthko",RC=[16,17,18,20,91,92,224,225],dc=6;function fc(t){return Math.max(0,t)*.7+8}function y4(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}var ym=class{constructor(e,n,r,o){this.view=e,this.startEvent=n,this.style=r,this.mustSelect=o,this.scrollSpeed={x:0,y:0},this.scrolling=-1,this.lastEvent=n,this.scrollParent=_6(e.contentDOM),this.atoms=e.state.facet(_m).map(s=>s(e));let i=e.contentDOM.ownerDocument;i.addEventListener("mousemove",this.move=this.move.bind(this)),i.addEventListener("mouseup",this.up=this.up.bind(this)),this.extend=n.shiftKey,this.multiple=e.state.facet(ke.allowMultipleSelections)&&b4(e,n),this.dragging=w4(e,n)&&FC(n)==1?null:!1}start(e){this.dragging===!1&&(e.preventDefault(),this.select(e))}move(e){var n;if(e.buttons==0)return this.destroy();if(this.dragging||this.dragging==null&&y4(this.startEvent,e)<10)return;this.select(this.lastEvent=e);let r=0,o=0,i=((n=this.scrollParent)===null||n===void 0?void 0:n.getBoundingClientRect())||{left:0,top:0,right:this.view.win.innerWidth,bottom:this.view.win.innerHeight},s=EC(this.view);e.clientX-s.left<=i.left+dc?r=-fc(i.left-e.clientX):e.clientX+s.right>=i.right-dc&&(r=fc(e.clientX-i.right)),e.clientY-s.top<=i.top+dc?o=-fc(i.top-e.clientY):e.clientY+s.bottom>=i.bottom-dc&&(o=fc(e.clientY-i.bottom)),this.setScrollSpeed(r,o)}up(e){this.dragging==null&&this.select(this.lastEvent),this.dragging||e.preventDefault(),this.destroy()}destroy(){this.setScrollSpeed(0,0);let e=this.view.contentDOM.ownerDocument;e.removeEventListener("mousemove",this.move),e.removeEventListener("mouseup",this.up),this.view.inputState.mouseSelection=null}setScrollSpeed(e,n){this.scrollSpeed={x:e,y:n},e||n?this.scrolling<0&&(this.scrolling=setInterval(()=>this.scroll(),50)):this.scrolling>-1&&(clearInterval(this.scrolling),this.scrolling=-1)}scroll(){this.scrollParent?(this.scrollParent.scrollLeft+=this.scrollSpeed.x,this.scrollParent.scrollTop+=this.scrollSpeed.y):this.view.win.scrollBy(this.scrollSpeed.x,this.scrollSpeed.y),this.dragging===!1&&this.select(this.lastEvent)}skipAtoms(e){let n=null;for(let r=0;r<e.ranges.length;r++){let o=e.ranges[r],i=null;if(o.empty){let s=yc(this.atoms,o.from,0);s!=o.from&&(i=$.cursor(s,-1))}else{let s=yc(this.atoms,o.from,-1),l=yc(this.atoms,o.to,1);(s!=o.from||l!=o.to)&&(i=$.range(o.from==o.anchor?s:l,o.from==o.head?s:l))}i&&(n||(n=e.ranges.slice()),n[r]=i)}return n?$.create(n,e.mainIndex):e}select(e){let{view:n}=this,r=this.skipAtoms(this.style.get(e,this.extend,this.multiple));(this.mustSelect||!r.eq(n.state.selection)||r.main.assoc!=n.state.selection.main.assoc&&this.dragging===!1)&&this.view.dispatch({selection:r,userEvent:"select.pointer"}),this.mustSelect=!1}update(e){e.docChanged&&this.dragging&&(this.dragging=this.dragging.map(e.changes)),this.style.update(e)&&setTimeout(()=>this.select(this.lastEvent),20)}};function b4(t,e){let n=t.state.facet(mC);return n.length?n[0](e):Q.mac?e.metaKey:e.ctrlKey}function x4(t,e){let n=t.state.facet(gC);return n.length?n[0](e):Q.mac?!e.altKey:!e.ctrlKey}function w4(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Sc(t.root);if(!r||r.rangeCount==0)return!0;let o=r.getRangeAt(0).getClientRects();for(let i=0;i<o.length;i++){let s=o[i];if(s.left<=e.clientX&&s.right>=e.clientX&&s.top<=e.clientY&&s.bottom>=e.clientY)return!0}return!1}function VS(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target,r;n!=t.contentDOM;n=n.parentNode)if(!n||n.nodeType==11||(r=xe.get(n))&&r.ignoreEvent(e))return!1;return!0}var Fe=Object.create(null),bm=Object.create(null),OC=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function S4(t){let e=t.dom.parentNode;if(!e)return;let n=e.appendChild(document.createElement("textarea"));n.style.cssText="position: fixed; left: -10000px; top: 10px",n.focus(),setTimeout(()=>{t.focus(),n.remove(),HC(t,n.value)},50)}function HC(t,e){let{state:n}=t,r,o=1,i=n.toText(e),s=i.lines==n.selection.ranges.length;if(xm!=null&&n.selection.ranges.every(a=>a.empty)&&xm==i.toString()){let a=-1;r=n.changeByRange(u=>{let c=n.doc.lineAt(u.from);if(c.from==a)return{range:u};a=c.from;let f=n.toText((s?i.line(o++).text:e)+n.lineBreak);return{changes:{from:c.from,insert:f},range:$.cursor(u.from+f.length)}})}else s?r=n.changeByRange(a=>{let u=i.line(o++);return{changes:{from:a.from,to:a.to,insert:u.text},range:$.cursor(a.from+u.length)}}):r=n.replaceSelection(i);t.dispatch(r,{userEvent:"input.paste",scrollIntoView:!0})}Fe.keydown=(t,e)=>{t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now())};Fe.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};Fe.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};bm.touchstart=bm.touchmove={passive:!0};Fe.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let n=null;for(let r of t.state.facet(vC))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=E4(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new ym(t,e,n,r)),r&&t.observer.ignore(()=>oC(t.contentDOM)),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};function zS(t,e,n,r){if(r==1)return $.cursor(e,n);if(r==2)return u4(t.state,e,n);{let o=Nt.find(t.docView,e),i=t.state.doc.lineAt(o?o.posAtEnd:e),s=o?o.posAtStart:i.from,l=o?o.posAtEnd:i.to;return l<t.state.doc.length&&l==i.to&&l++,$.range(s,l)}}var NC=(t,e)=>t>=e.top&&t<=e.bottom,$S=(t,e,n)=>NC(e,n)&&t>=n.left&&t<=n.right;function C4(t,e,n,r){let o=Nt.find(t.docView,e);if(!o)return 1;let i=e-o.posAtStart;if(i==0)return 1;if(i==o.length)return-1;let s=o.coordsAt(i,-1);if(s&&$S(n,r,s))return-1;let l=o.coordsAt(i,1);return l&&$S(n,r,l)?1:s&&NC(r,s)?-1:1}function _S(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:C4(t,n,e.clientX,e.clientY)}}var k4=Q.ie&&Q.ie_version<=11,WS=null,KS=0,US=0;function FC(t){if(!k4)return t.detail;let e=WS,n=US;return WS=t,US=Date.now(),KS=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(KS+1)%3:1}function E4(t,e){let n=_S(t,e),r=FC(e),o=t.state.selection;return{update(i){i.docChanged&&(n.pos=i.changes.mapPos(n.pos),o=o.map(i.changes))},get(i,s,l){let a=_S(t,i),u,c=zS(t,a.pos,a.bias,r);if(n.pos!=a.pos&&!s){let f=zS(t,n.pos,n.bias,r),d=Math.min(f.from,c.from),h=Math.max(f.to,c.to);c=d<c.from?$.range(d,h):$.range(h,d)}return s?o.replaceRange(o.main.extend(c.from,c.to)):l&&r==1&&o.ranges.length>1&&(u=M4(o,a.pos))?u:l?o.addRange(c):$.create([c])}}}function M4(t,e){for(let n=0;n<t.ranges.length;n++){let{from:r,to:o}=t.ranges[n];if(r<=e&&o>=e)return $.create(t.ranges.slice(0,n).concat(t.ranges.slice(n+1)),t.mainIndex==n?0:t.mainIndex-(t.mainIndex>n?1:0))}return null}Fe.dragstart=(t,e)=>{let{selection:{main:n}}=t.state,{mouseSelection:r}=t.inputState;r&&(r.dragging=n),e.dataTransfer&&(e.dataTransfer.setData("Text",t.state.sliceDoc(n.from,n.to)),e.dataTransfer.effectAllowed="copyMove")};function jS(t,e,n,r){if(!n)return;let o=t.posAtCoords({x:e.clientX,y:e.clientY},!1);e.preventDefault();let{mouseSelection:i}=t.inputState,s=r&&i&&i.dragging&&x4(t,e)?{from:i.dragging.from,to:i.dragging.to}:null,l={from:o,insert:n},a=t.state.changes(s?[s,l]:l);t.focus(),t.dispatch({changes:a,selection:{anchor:a.mapPos(o,-1),head:a.mapPos(o,1)},userEvent:s?"move.drop":"input.drop"})}Fe.drop=(t,e)=>{if(!e.dataTransfer)return;if(t.state.readOnly)return e.preventDefault();let n=e.dataTransfer.files;if(n&&n.length){e.preventDefault();let r=Array(n.length),o=0,i=()=>{++o==n.length&&jS(t,e,r.filter(s=>s!=null).join(t.state.lineBreak),!1)};for(let s=0;s<n.length;s++){let l=new FileReader;l.onerror=i,l.onload=()=>{/[\x00-\x08\x0e-\x1f]{2}/.test(l.result)||(r[s]=l.result),i()},l.readAsText(n[s])}}else jS(t,e,e.dataTransfer.getData("Text"),!0)};Fe.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let n=OC?null:e.clipboardData;n?(HC(t,n.getData("text/plain")||n.getData("text/uri-text")),e.preventDefault()):S4(t)};function T4(t,e){let n=t.dom.parentNode;if(!n)return;let r=n.appendChild(document.createElement("textarea"));r.style.cssText="position: fixed; left: -10000px; top: 10px",r.value=e,r.focus(),r.selectionEnd=e.length,r.selectionStart=0,setTimeout(()=>{r.remove(),t.focus()},50)}function I4(t){let e=[],n=[],r=!1;for(let o of t.selection.ranges)o.empty||(e.push(t.sliceDoc(o.from,o.to)),n.push(o));if(!e.length){let o=-1;for(let{from:i}of t.selection.ranges){let s=t.doc.lineAt(i);s.number>o&&(e.push(s.text),n.push({from:s.from,to:Math.min(t.doc.length,s.to+1)})),o=s.number}r=!0}return{text:e.join(t.lineBreak),ranges:n,linewise:r}}var xm=null;Fe.copy=Fe.cut=(t,e)=>{let{text:n,ranges:r,linewise:o}=I4(t.state);if(!n&&!o)return;xm=o?n:null;let i=OC?null:e.clipboardData;i?(e.preventDefault(),i.clearData(),i.setData("text/plain",n)):T4(t,n),e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"})};var BC=Ht.define();function VC(t,e){let n=[];for(let r of t.facet(xC)){let o=r(t,e);o&&n.push(o)}return n?t.update({effects:n,annotations:BC.of(!0)}):null}function zC(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=VC(t.state,e);n?t.dispatch(n):t.update([])}},10)}Fe.focus=t=>{t.inputState.lastFocusTime=Date.now(),!t.scrollDOM.scrollTop&&(t.inputState.lastScrollTop||t.inputState.lastScrollLeft)&&(t.scrollDOM.scrollTop=t.inputState.lastScrollTop,t.scrollDOM.scrollLeft=t.inputState.lastScrollLeft),zC(t)};Fe.blur=t=>{t.observer.clearSelectionRange(),zC(t)};Fe.compositionstart=Fe.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)};Fe.compositionend=t=>{t.inputState.composing=-1,t.inputState.compositionEndedAt=Date.now(),t.inputState.compositionPendingKey=!0,t.inputState.compositionPendingChange=t.observer.pendingRecords().length>0,t.inputState.compositionFirstChange=null,Q.chrome&&Q.android?t.observer.flushSoon():t.inputState.compositionPendingChange?Promise.resolve().then(()=>t.observer.flush()):setTimeout(()=>{t.inputState.composing<0&&t.docView.hasComposition&&t.update([])},50)};Fe.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};Fe.beforeinput=(t,e)=>{var n;let r;if(Q.chrome&&Q.android&&(r=AC.find(o=>o.inputType==e.inputType))&&(t.observer.delayAndroidKey(r.key,r.keyCode),r.key=="Backspace"||r.key=="Delete")){let o=((n=window.visualViewport)===null||n===void 0?void 0:n.height)||0;setTimeout(()=>{var i;(((i=window.visualViewport)===null||i===void 0?void 0:i.height)||0)>o+10&&t.hasFocus&&(t.contentDOM.blur(),t.focus())},100)}};var qS=["pre-wrap","normal","pre-line","break-spaces"],wm=class{constructor(e){this.lineWrapping=e,this.doc=de.empty,this.heightSamples={},this.lineHeight=14,this.charWidth=7,this.textHeight=14,this.lineLength=30,this.heightChanged=!1}heightForGap(e,n){let r=this.doc.lineAt(n).number-this.doc.lineAt(e).number+1;return this.lineWrapping&&(r+=Math.max(0,Math.ceil((n-e-r*this.lineLength*.5)/this.lineLength))),this.lineHeight*r}heightForLine(e){return this.lineWrapping?(1+Math.max(0,Math.ceil((e-this.lineLength)/(this.lineLength-5))))*this.lineHeight:this.lineHeight}setDoc(e){return this.doc=e,this}mustRefreshForWrapping(e){return qS.indexOf(e)>-1!=this.lineWrapping}mustRefreshForHeights(e){let n=!1;for(let r=0;r<e.length;r++){let o=e[r];o<0?r++:this.heightSamples[Math.floor(o*10)]||(n=!0,this.heightSamples[Math.floor(o*10)]=!0)}return n}refresh(e,n,r,o,i,s){let l=qS.indexOf(e)>-1,a=Math.round(n)!=Math.round(this.lineHeight)||this.lineWrapping!=l;if(this.lineWrapping=l,this.lineHeight=n,this.charWidth=r,this.textHeight=o,this.lineLength=i,a){this.heightSamples={};for(let u=0;u<s.length;u++){let c=s[u];c<0?u++:this.heightSamples[Math.floor(c*10)]=!0}}return a}},Sm=class{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}},In=class t{constructor(e,n,r,o,i){this.from=e,this.length=n,this.top=r,this.height=o,this._content=i}get type(){return typeof this._content=="number"?Oe.Text:Array.isArray(this._content)?this._content:this._content.type}get to(){return this.from+this.length}get bottom(){return this.top+this.height}get widget(){return this._content instanceof Dr?this._content.widget:null}get widgetLineBreaks(){return typeof this._content=="number"?this._content:0}join(e){let n=(Array.isArray(this._content)?this._content:[this]).concat(Array.isArray(e._content)?e._content:[e]);return new t(this.from,this.length+e.length,this.top,this.height+e.height,n)}},be=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(be||(be={})),bc=.001,Bt=class t{constructor(e,n,r=2){this.length=e,this.height=n,this.flags=r}get outdated(){return(this.flags&2)>0}set outdated(e){this.flags=(e?2:0)|this.flags&-3}setHeight(e,n){this.height!=n&&(Math.abs(this.height-n)>bc&&(e.heightChanged=!0),this.height=n)}replace(e,n,r){return t.of(r)}decomposeLeft(e,n){n.push(this)}decomposeRight(e,n){n.push(this)}applyChanges(e,n,r,o){let i=this,s=r.doc;for(let l=o.length-1;l>=0;l--){let{fromA:a,toA:u,fromB:c,toB:f}=o[l],d=i.lineAt(a,be.ByPosNoHeight,r.setDoc(n),0,0),h=d.to>=u?d:i.lineAt(u,be.ByPosNoHeight,r,0,0);for(f+=h.to-u,u=h.to;l>0&&d.from<=o[l-1].toA;)a=o[l-1].fromA,c=o[l-1].fromB,l--,a<d.from&&(d=i.lineAt(a,be.ByPosNoHeight,r,0,0));c+=d.from-a,a=d.from;let g=km.build(r.setDoc(s),e,c,f);i=i.replace(a,u,g)}return i.updateHeight(r,0)}static empty(){return new Xt(0,0)}static of(e){if(e.length==1)return e[0];let n=0,r=e.length,o=0,i=0;for(;;)if(n==r)if(o>i*2){let l=e[n-1];l.break?e.splice(--n,1,l.left,null,l.right):e.splice(--n,1,l.left,l.right),r+=1+l.break,o-=l.size}else if(i>o*2){let l=e[r];l.break?e.splice(r,1,l.left,null,l.right):e.splice(r,1,l.left,l.right),r+=2+l.break,i-=l.size}else break;else if(o<i){let l=e[n++];l&&(o+=l.size)}else{let l=e[--r];l&&(i+=l.size)}let s=0;return e[n-1]==null?(s=1,n--):e[n]==null&&(s=1,r++),new Cm(t.of(e.slice(0,n)),s,t.of(e.slice(r)))}};Bt.prototype.size=1;var Oc=class extends Bt{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,o){return new In(o,this.length,r,this.height,this.deco||0)}lineAt(e,n,r,o,i){return this.blockAt(0,r,o,i)}forEachLine(e,n,r,o,i,s){e<=i+this.length&&n>=i&&s(this.blockAt(0,r,o,i))}updateHeight(e,n=0,r=!1,o){return o&&o.from<=n&&o.more&&this.setHeight(e,o.heights[o.index++]),this.outdated=!1,this}toString(){return`block(${this.length})`}},Xt=class t extends Oc{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,o){return new In(o,this.length,r,this.height,this.breaks)}replace(e,n,r){let o=r[0];return r.length==1&&(o instanceof t||o instanceof Ir&&o.flags&4)&&Math.abs(this.length-o.length)<10?(o instanceof Ir?o=new t(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):Bt.of(r)}updateHeight(e,n=0,r=!1,o){return o&&o.from<=n&&o.more?this.setHeight(e,o.heights[o.index++]):(r||this.outdated)&&this.setHeight(e,Math.max(this.widgetHeight,e.heightForLine(this.length-this.collapsed))+this.breaks*e.lineHeight),this.outdated=!1,this}toString(){return`line(${this.length}${this.collapsed?-this.collapsed:""}${this.widgetHeight?":"+this.widgetHeight:""})`}},Ir=class t extends Bt{constructor(e){super(e,0)}heightMetrics(e,n){let r=e.doc.lineAt(n).number,o=e.doc.lineAt(n+this.length).number,i=o-r+1,s,l=0;if(e.lineWrapping){let a=Math.min(this.height,e.lineHeight*i);s=a/i,this.length>i+1&&(l=(this.height-a)/(this.length-i-1))}else s=this.height/i;return{firstLine:r,lastLine:o,perLine:s,perChar:l}}blockAt(e,n,r,o){let{firstLine:i,lastLine:s,perLine:l,perChar:a}=this.heightMetrics(n,o);if(n.lineWrapping){let u=o+Math.round(Math.max(0,Math.min(1,(e-r)/this.height))*this.length),c=n.doc.lineAt(u),f=l+c.length*a,d=Math.max(r,e-f/2);return new In(c.from,c.length,d,f,0)}else{let u=Math.max(0,Math.min(s-i,Math.floor((e-r)/l))),{from:c,length:f}=n.doc.line(i+u);return new In(c,f,r+l*u,l,0)}}lineAt(e,n,r,o,i){if(n==be.ByHeight)return this.blockAt(e,r,o,i);if(n==be.ByPosNoHeight){let{from:h,to:g}=r.doc.lineAt(e);return new In(h,g-h,0,0,0)}let{firstLine:s,perLine:l,perChar:a}=this.heightMetrics(r,i),u=r.doc.lineAt(e),c=l+u.length*a,f=u.number-s,d=o+l*f+a*(u.from-i-f);return new In(u.from,u.length,Math.max(o,Math.min(d,o+this.height-c)),c,0)}forEachLine(e,n,r,o,i,s){e=Math.max(e,i),n=Math.min(n,i+this.length);let{firstLine:l,perLine:a,perChar:u}=this.heightMetrics(r,i);for(let c=e,f=o;c<=n;){let d=r.doc.lineAt(c);if(c==e){let g=d.number-l;f+=a*g+u*(e-i-g)}let h=a+u*d.length;s(new In(d.from,d.length,f,h,0)),f+=h,c=d.to+1}}replace(e,n,r){let o=this.length-n;if(o>0){let i=r[r.length-1];i instanceof t?r[r.length-1]=new t(i.length+o):r.push(null,new t(o-1))}if(e>0){let i=r[0];i instanceof t?r[0]=new t(e+i.length):r.unshift(new t(e-1),null)}return Bt.of(r)}decomposeLeft(e,n){n.push(new t(e-1),null)}decomposeRight(e,n){n.push(null,new t(this.length-e-1))}updateHeight(e,n=0,r=!1,o){let i=n+this.length;if(o&&o.from<=n+this.length&&o.more){let s=[],l=Math.max(n,o.from),a=-1;for(o.from>n&&s.push(new t(o.from-n-1).updateHeight(e,n));l<=i&&o.more;){let c=e.doc.lineAt(l).length;s.length&&s.push(null);let f=o.heights[o.index++];a==-1?a=f:Math.abs(f-a)>=bc&&(a=-2);let d=new Xt(c,f);d.outdated=!1,s.push(d),l+=c+1}l<=i&&s.push(null,new t(i-l).updateHeight(e,l));let u=Bt.of(s);return(a<0||Math.abs(u.height-this.height)>=bc||Math.abs(a-this.heightMetrics(e,n).perLine)>=bc)&&(e.heightChanged=!0),u}else(r||this.outdated)&&(this.setHeight(e,e.heightForGap(n,n+this.length)),this.outdated=!1);return this}toString(){return`gap(${this.length})`}},Cm=class extends Bt{constructor(e,n,r){super(e.length+n+r.length,e.height+r.height,n|(e.outdated||r.outdated?2:0)),this.left=e,this.right=r,this.size=e.size+r.size}get break(){return this.flags&1}blockAt(e,n,r,o){let i=r+this.left.height;return e<i?this.left.blockAt(e,n,r,o):this.right.blockAt(e,n,i,o+this.left.length+this.break)}lineAt(e,n,r,o,i){let s=o+this.left.height,l=i+this.left.length+this.break,a=n==be.ByHeight?e<s:e<l,u=a?this.left.lineAt(e,n,r,o,i):this.right.lineAt(e,n,r,s,l);if(this.break||(a?u.to<l:u.from>l))return u;let c=n==be.ByPosNoHeight?be.ByPosNoHeight:be.ByPos;return a?u.join(this.right.lineAt(l,c,r,s,l)):this.left.lineAt(l,c,r,o,i).join(u)}forEachLine(e,n,r,o,i,s){let l=o+this.left.height,a=i+this.left.length+this.break;if(this.break)e<a&&this.left.forEachLine(e,n,r,o,i,s),n>=a&&this.right.forEachLine(e,n,r,l,a,s);else{let u=this.lineAt(a,be.ByPos,r,o,i);e<u.from&&this.left.forEachLine(e,u.from-1,r,o,i,s),u.to>=e&&u.from<=n&&s(u),n>u.to&&this.right.forEachLine(u.to+1,n,r,l,a,s)}}replace(e,n,r){let o=this.left.length+this.break;if(n<o)return this.balanced(this.left.replace(e,n,r),this.right);if(e>this.left.length)return this.balanced(this.left,this.right.replace(e-o,n-o,r));let i=[];e>0&&this.decomposeLeft(e,i);let s=i.length;for(let l of r)i.push(l);if(e>0&&GS(i,s-1),n<this.length){let l=i.length;this.decomposeRight(n,i),GS(i,l)}return Bt.of(i)}decomposeLeft(e,n){let r=this.left.length;if(e<=r)return this.left.decomposeLeft(e,n);n.push(this.left),this.break&&(r++,e>=r&&n.push(null)),e>r&&this.right.decomposeLeft(e-r,n)}decomposeRight(e,n){let r=this.left.length,o=r+this.break;if(e>=o)return this.right.decomposeRight(e-o,n);e<r&&this.left.decomposeRight(e,n),this.break&&e<o&&n.push(null),n.push(this.right)}balanced(e,n){return e.size>2*n.size||n.size>2*e.size?Bt.of(this.break?[e,null,n]:[e,n]):(this.left=e,this.right=n,this.height=e.height+n.height,this.outdated=e.outdated||n.outdated,this.size=e.size+n.size,this.length=e.length+this.break+n.length,this)}updateHeight(e,n=0,r=!1,o){let{left:i,right:s}=this,l=n+i.length+this.break,a=null;return o&&o.from<=n+i.length&&o.more?a=i=i.updateHeight(e,n,r,o):i.updateHeight(e,n,r),o&&o.from<=l+s.length&&o.more?a=s=s.updateHeight(e,l,r,o):s.updateHeight(e,l,r),a?this.balanced(i,s):(this.height=this.left.height+this.right.height,this.outdated=!1,this)}toString(){return this.left+(this.break?" ":"-")+this.right}};function GS(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof Ir&&(r=t[e+1])instanceof Ir&&t.splice(e-1,3,new Ir(n.length+1+r.length))}var L4=5,km=class t{constructor(e,n){this.pos=e,this.oracle=n,this.nodes=[],this.lineStart=-1,this.lineEnd=-1,this.covering=null,this.writtenTo=e}get isCovered(){return this.covering&&this.nodes[this.nodes.length-1]==this.covering}span(e,n){if(this.lineStart>-1){let r=Math.min(n,this.lineEnd),o=this.nodes[this.nodes.length-1];o instanceof Xt?o.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new Xt(r-this.pos,-1)),this.writtenTo=r,n>r&&(this.nodes.push(null),this.writtenTo++,this.lineStart=-1)}this.pos=n}point(e,n,r){if(e<n||r.heightRelevant){let o=r.widget?r.widget.estimatedHeight:0,i=r.widget?r.widget.lineBreaks:0;o<0&&(o=this.oracle.lineHeight);let s=n-e;r.block?this.addBlock(new Oc(s,o,r)):(s||i||o>=L4)&&this.addLineDeco(o,i,s)}else n>e&&this.span(e,n);this.lineEnd>-1&&this.lineEnd<this.pos&&(this.lineEnd=this.oracle.doc.lineAt(this.pos).to)}enterLine(){if(this.lineStart>-1)return;let{from:e,to:n}=this.oracle.doc.lineAt(this.pos);this.lineStart=e,this.lineEnd=n,this.writtenTo<e&&((this.writtenTo<e-1||this.nodes[this.nodes.length-1]==null)&&this.nodes.push(this.blankContent(this.writtenTo,e-1)),this.nodes.push(null)),this.pos>e&&this.nodes.push(new Xt(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new Ir(n-e);return this.oracle.doc.lineAt(e).to==n&&(r.flags|=4),r}ensureLine(){this.enterLine();let e=this.nodes.length?this.nodes[this.nodes.length-1]:null;if(e instanceof Xt)return e;let n=new Xt(0,-1);return this.nodes.push(n),n}addBlock(e){var n;this.enterLine();let r=(n=e.deco)===null||n===void 0?void 0:n.type;r==Oe.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,r!=Oe.WidgetBefore&&(this.covering=e)}addLineDeco(e,n,r){let o=this.ensureLine();o.length+=r,o.collapsed+=r,o.widgetHeight=Math.max(o.widgetHeight,e),o.breaks+=n,this.writtenTo=this.pos=this.pos+r}finish(e){let n=this.nodes.length==0?null:this.nodes[this.nodes.length-1];this.lineStart>-1&&!(n instanceof Xt)&&!this.isCovered?this.nodes.push(new Xt(0,-1)):(this.writtenTo<this.pos||n==null)&&this.nodes.push(this.blankContent(this.writtenTo,this.pos));let r=e;for(let o of this.nodes)o instanceof Xt&&o.updateHeight(this.oracle,r),r+=o?o.length:1;return this.nodes}static build(e,n,r,o){let i=new t(r,e);return Ae.spans(n,r,o,i,0),i.finish(r)}};function P4(t,e,n){let r=new Em;return Ae.compare(t,e,n,r,0),r.changes}var Em=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,o){(e<n||r&&r.heightRelevant||o&&o.heightRelevant)&&cm(e,n,this.changes,5)}};function D4(t,e){let n=t.getBoundingClientRect(),r=t.ownerDocument,o=r.defaultView||window,i=Math.max(0,n.left),s=Math.min(o.innerWidth,n.right),l=Math.max(0,n.top),a=Math.min(o.innerHeight,n.bottom);for(let u=t.parentNode;u&&u!=r.body;)if(u.nodeType==1){let c=u,f=window.getComputedStyle(c);if((c.scrollHeight>c.clientHeight||c.scrollWidth>c.clientWidth)&&f.overflow!="visible"){let d=c.getBoundingClientRect();i=Math.max(i,d.left),s=Math.min(s,d.right),l=Math.max(l,d.top),a=u==t.parentNode?d.bottom:Math.min(a,d.bottom)}u=f.position=="absolute"||f.position=="fixed"?c.offsetParent:c.parentNode}else if(u.nodeType==11)u=u.host;else break;return{left:i-n.left,right:Math.max(i,s)-n.left,top:l-(n.top+e),bottom:Math.max(l,a)-(n.top+e)}}function A4(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}var pl=class{constructor(e,n,r){this.from=e,this.to=n,this.size=r}static same(e,n){if(e.length!=n.length)return!1;for(let r=0;r<e.length;r++){let o=e[r],i=n[r];if(o.from!=i.from||o.to!=i.to||o.size!=i.size)return!1}return!0}draw(e){return _e.replace({widget:new Mm(this.size,e)}).range(this.from,this.to)}},Mm=class extends Zn{constructor(e,n){super(),this.size=e,this.vertical=n}eq(e){return e.size==this.size&&e.vertical==this.vertical}toDOM(){let e=document.createElement("div");return this.vertical?e.style.height=this.size+"px":(e.style.width=this.size+"px",e.style.height="2px",e.style.display="inline-block"),e}get estimatedHeight(){return this.vertical?this.size:-1}},Hc=class{constructor(e){this.state=e,this.pixelViewport={left:0,right:window.innerWidth,top:0,bottom:0},this.inView=!0,this.paddingTop=0,this.paddingBottom=0,this.contentDOMWidth=0,this.contentDOMHeight=0,this.editorHeight=0,this.editorWidth=0,this.scrollTop=0,this.scrolledToBottom=!0,this.scrollAnchorPos=0,this.scrollAnchorHeight=-1,this.scaler=JS,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Re.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet($m).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new wm(n),this.stateDeco=e.facet(xl).filter(r=>typeof r!="function"),this.heightMap=Bt.empty().applyChanges(this.stateDeco,de.empty,this.heightOracle.setDoc(e.doc),[new Pn(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=_e.set(this.lineGaps.map(r=>r.draw(!1))),this.computeVisibleRanges()}updateForViewport(){let e=[this.viewport],{main:n}=this.state.selection;for(let r=0;r<=1;r++){let o=r?n.head:n.anchor;if(!e.some(({from:i,to:s})=>o>=i&&o<=s)){let{from:i,to:s}=this.lineBlockAt(o);e.push(new Di(i,s))}}this.viewports=e.sort((r,o)=>r.from-o.from),this.scaler=this.heightMap.height<=7e6?JS:new Tm(this.heightOracle,this.heightMap,this.viewports)}updateViewportLines(){this.viewportLines=[],this.heightMap.forEachLine(this.viewport.from,this.viewport.to,this.heightOracle.setDoc(this.state.doc),0,0,e=>{this.viewportLines.push(this.scaler.scale==1?e:dl(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(xl).filter(c=>typeof c!="function");let o=e.changedRanges,i=Pn.extendWithRanges(o,P4(r,this.stateDeco,e?e.changes:yt.empty(this.state.doc.length))),s=this.heightMap.height,l=this.scrolledToBottom?null:this.scrollAnchorAt(this.scrollTop);this.heightMap=this.heightMap.applyChanges(this.stateDeco,e.startState.doc,this.heightOracle.setDoc(this.state.doc),i),this.heightMap.height!=s&&(e.flags|=2),l?(this.scrollAnchorPos=e.changes.mapPos(l.from,-1),this.scrollAnchorHeight=l.top):(this.scrollAnchorPos=-1,this.scrollAnchorHeight=this.heightMap.height);let a=i.length?this.mapViewport(this.viewport,e.changes):this.viewport;(n&&(n.range.head<a.from||n.range.head>a.to)||!this.viewportIsAppropriate(a))&&(a=this.getViewport(0,n));let u=!e.changes.empty||e.flags&2||a.from!=this.viewport.from||a.to!=this.viewport.to;this.viewport=a,this.updateForViewport(),u&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(this.mapLineGaps(this.lineGaps,e.changes))),e.flags|=this.computeVisibleRanges(),n&&(this.scrollTarget=n),!this.mustEnforceCursorAssoc&&e.selectionSet&&e.view.lineWrapping&&e.state.selection.main.empty&&e.state.selection.main.assoc&&!e.state.facet(SC)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),o=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Re.RTL:Re.LTR;let s=this.heightOracle.mustRefreshForWrapping(i),l=n.getBoundingClientRect(),a=s||this.mustMeasureContent||this.contentDOMHeight!=l.height;this.contentDOMHeight=l.height,this.mustMeasureContent=!1;let u=0,c=0,f=parseInt(r.paddingTop)||0,d=parseInt(r.paddingBottom)||0;(this.paddingTop!=f||this.paddingBottom!=d)&&(this.paddingTop=f,this.paddingBottom=d,u|=10),this.editorWidth!=e.scrollDOM.clientWidth&&(o.lineWrapping&&(a=!0),this.editorWidth=e.scrollDOM.clientWidth,u|=8),this.scrollTop!=e.scrollDOM.scrollTop&&(this.scrollAnchorHeight=-1,this.scrollTop=e.scrollDOM.scrollTop),this.scrolledToBottom=sC(e.scrollDOM);let h=(this.printing?A4:D4)(n,this.paddingTop),g=h.top-this.pixelViewport.top,v=h.bottom-this.pixelViewport.bottom;this.pixelViewport=h;let p=this.pixelViewport.bottom>this.pixelViewport.top&&this.pixelViewport.right>this.pixelViewport.left;if(p!=this.inView&&(this.inView=p,p&&(a=!0)),!this.inView&&!this.scrollTarget)return 0;let m=l.width;if((this.contentDOMWidth!=m||this.editorHeight!=e.scrollDOM.clientHeight)&&(this.contentDOMWidth=l.width,this.editorHeight=e.scrollDOM.clientHeight,u|=8),a){let x=e.docView.measureVisibleLineHeights(this.viewport);if(o.mustRefreshForHeights(x)&&(s=!0),s||o.lineWrapping&&Math.abs(m-this.contentDOMWidth)>o.charWidth){let{lineHeight:b,charWidth:C,textHeight:w}=e.docView.measureTextSize();s=b>0&&o.refresh(i,b,C,w,m/C,x),s&&(e.docView.minWidth=0,u|=8)}g>0&&v>0?c=Math.max(g,v):g<0&&v<0&&(c=Math.min(g,v)),o.heightChanged=!1;for(let b of this.viewports){let C=b.from==this.viewport.from?x:e.docView.measureVisibleLineHeights(b);this.heightMap=(s?Bt.empty().applyChanges(this.stateDeco,de.empty,this.heightOracle,[new Pn(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(o,0,s,new Sm(b.from,C))}o.heightChanged&&(u|=2)}let y=!this.viewportIsAppropriate(this.viewport,c)||this.scrollTarget&&(this.scrollTarget.range.head<this.viewport.from||this.scrollTarget.range.head>this.viewport.to);return y&&(this.viewport=this.getViewport(c,this.scrollTarget)),this.updateForViewport(),(u&2||y)&&this.updateViewportLines(),(this.lineGaps.length||this.viewport.to-this.viewport.from>4e3)&&this.updateLineGaps(this.ensureLineGaps(s?[]:this.lineGaps,e)),u|=this.computeVisibleRanges(),this.mustEnforceCursorAssoc&&(this.mustEnforceCursorAssoc=!1,e.docView.enforceCursorAssoc()),u}get visibleTop(){return this.scaler.fromDOM(this.pixelViewport.top)}get visibleBottom(){return this.scaler.fromDOM(this.pixelViewport.bottom)}getViewport(e,n){let r=.5-Math.max(-.5,Math.min(.5,e/1e3/2)),o=this.heightMap,i=this.heightOracle,{visibleTop:s,visibleBottom:l}=this,a=new Di(o.lineAt(s-r*1e3,be.ByHeight,i,0,0).from,o.lineAt(l+(1-r)*1e3,be.ByHeight,i,0,0).to);if(n){let{head:u}=n.range;if(u<a.from||u>a.to){let c=Math.min(this.editorHeight,this.pixelViewport.bottom-this.pixelViewport.top),f=o.lineAt(u,be.ByPos,i,0,0),d;n.y=="center"?d=(f.top+f.bottom)/2-c/2:n.y=="start"||n.y=="nearest"&&u<a.from?d=f.top:d=f.bottom-c,a=new Di(o.lineAt(d-1e3/2,be.ByHeight,i,0,0).from,o.lineAt(d+c+1e3/2,be.ByHeight,i,0,0).to)}}return a}mapViewport(e,n){let r=n.mapPos(e.from,-1),o=n.mapPos(e.to,1);return new Di(this.heightMap.lineAt(r,be.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(o,be.ByPos,this.heightOracle,0,0).to)}viewportIsAppropriate({from:e,to:n},r=0){if(!this.inView)return!0;let{top:o}=this.heightMap.lineAt(e,be.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,be.ByPos,this.heightOracle,0,0),{visibleTop:s,visibleBottom:l}=this;return(e==0||o<=s-Math.max(10,Math.min(-r,250)))&&(n==this.state.doc.length||i>=l+Math.max(10,Math.min(r,250)))&&o>s-2*1e3&&i<l+2*1e3}mapLineGaps(e,n){if(!e.length||n.empty)return e;let r=[];for(let o of e)n.touchesRange(o.from,o.to)||r.push(new pl(n.mapPos(o.from),n.mapPos(o.to),o.size));return r}ensureLineGaps(e,n){let r=this.heightOracle.lineWrapping,o=r?1e4:2e3,i=o>>1,s=o<<1;if(this.defaultTextDirection!=Re.LTR&&!r)return[];let l=[],a=(u,c,f,d)=>{if(c-u<i)return;let h=this.state.selection.main,g=[h.from];h.empty||g.push(h.to);for(let p of g)if(p>u&&p<c){a(u,p-10,f,d),a(p+10,c,f,d);return}let v=O4(e,p=>p.from>=f.from&&p.to<=f.to&&Math.abs(p.from-u)<i&&Math.abs(p.to-c)<i&&!g.some(m=>p.from<m&&p.to>m));if(!v){if(c<f.to&&n&&r&&n.visibleRanges.some(p=>p.from<=c&&p.to>=c)){let p=n.moveToLineBoundary($.cursor(c),!1,!0).head;p>u&&(c=p)}v=new pl(u,c,this.gapSize(f,u,c,d))}l.push(v)};for(let u of this.viewportLines){if(u.length<s)continue;let c=R4(u.from,u.to,this.stateDeco);if(c.total<s)continue;let f=this.scrollTarget?this.scrollTarget.range.head:null,d,h;if(r){let g=o/this.heightOracle.lineLength*this.heightOracle.lineHeight,v,p;if(f!=null){let m=pc(c,f),y=((this.visibleBottom-this.visibleTop)/2+g)/u.height;v=m-y,p=m+y}else v=(this.visibleTop-u.top-g)/u.height,p=(this.visibleBottom-u.top+g)/u.height;d=hc(c,v),h=hc(c,p)}else{let g=c.total*this.heightOracle.charWidth,v=o*this.heightOracle.charWidth,p,m;if(f!=null){let y=pc(c,f),x=((this.pixelViewport.right-this.pixelViewport.left)/2+v)/g;p=y-x,m=y+x}else p=(this.pixelViewport.left-v)/g,m=(this.pixelViewport.right+v)/g;d=hc(c,p),h=hc(c,m)}d>u.from&&a(u.from,d,u,c),h<u.to&&a(h,u.to,u,c)}return l}gapSize(e,n,r,o){let i=pc(o,r)-pc(o,n);return this.heightOracle.lineWrapping?e.height*i:o.total*this.heightOracle.charWidth*i}updateLineGaps(e){pl.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=_e.set(e.map(n=>n.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Ae.spans(e,this.viewport.from,this.viewport.to,{span(o,i){n.push({from:o,to:i})},point(){}},20);let r=n.length!=this.visibleRanges.length||this.visibleRanges.some((o,i)=>o.from!=n[i].from||o.to!=n[i].to);return this.visibleRanges=n,r?4:0}lineBlockAt(e){return e>=this.viewport.from&&e<=this.viewport.to&&this.viewportLines.find(n=>n.from<=e&&n.to>=e)||dl(this.heightMap.lineAt(e,be.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return dl(this.heightMap.lineAt(this.scaler.fromDOM(e),be.ByHeight,this.heightOracle,0,0),this.scaler)}scrollAnchorAt(e){let n=this.lineBlockAtHeight(e+8);return n.from>=this.viewport.from||this.viewportLines[0].top-e>200?n:this.viewportLines[0]}elementAtHeight(e){return dl(this.heightMap.blockAt(this.scaler.fromDOM(e),this.heightOracle,0,0),this.scaler)}get docHeight(){return this.scaler.toDOM(this.heightMap.height)}get contentHeight(){return this.docHeight+this.paddingTop+this.paddingBottom}},Di=class{constructor(e,n){this.from=e,this.to=n}};function R4(t,e,n){let r=[],o=t,i=0;return Ae.spans(n,t,e,{span(){},point(s,l){s>o&&(r.push({from:o,to:s}),i+=s-o),o=l}},20),o<e&&(r.push({from:o,to:e}),i+=e-o),{total:i,ranges:r}}function hc({total:t,ranges:e},n){if(n<=0)return e[0].from;if(n>=1)return e[e.length-1].to;let r=Math.floor(t*n);for(let o=0;;o++){let{from:i,to:s}=e[o],l=s-i;if(r<=l)return i+r;r-=l}}function pc(t,e){let n=0;for(let{from:r,to:o}of t.ranges){if(e<=o){n+=e-r;break}n+=o-r}return n/t.total}function O4(t,e){for(let n of t)if(e(n))return n}var JS={toDOM(t){return t},fromDOM(t){return t},scale:1},Tm=class{constructor(e,n,r){let o=0,i=0,s=0;this.viewports=r.map(({from:l,to:a})=>{let u=n.lineAt(l,be.ByPos,e,0,0).top,c=n.lineAt(a,be.ByPos,e,0,0).bottom;return o+=c-u,{from:l,to:a,top:u,bottom:c,domTop:0,domBottom:0}}),this.scale=(7e6-o)/(n.height-o);for(let l of this.viewports)l.domTop=s+(l.top-i)*this.scale,s=l.domBottom=l.domTop+(l.bottom-l.top),i=l.bottom}toDOM(e){for(let n=0,r=0,o=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.top)return o+(e-r)*this.scale;if(e<=i.bottom)return i.domTop+(e-i.top);r=i.bottom,o=i.domBottom}}fromDOM(e){for(let n=0,r=0,o=0;;n++){let i=n<this.viewports.length?this.viewports[n]:null;if(!i||e<i.domTop)return r+(e-o)/this.scale;if(e<=i.domBottom)return i.top+(e-i.domTop);r=i.bottom,o=i.domBottom}}};function dl(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new In(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(o=>dl(o,e)):t._content)}var mc=ne.define({combine:t=>t.join(" ")}),Im=ne.define({combine:t=>t.indexOf(!0)>-1}),Lm=Qt.newName(),$C=Qt.newName(),_C=Qt.newName(),WC={"&light":"."+$C,"&dark":"."+_C};function Pm(t,e,n){return new Qt(e,{finish(r){return/&/.test(r)?r.replace(/&\w*/,o=>{if(o=="&")return t;if(!n||!n[o])throw new RangeError(`Unsupported selector: ${o}`);return n[o]}):t+" "+r}})}var H4=Pm("."+Lm,{"&":{position:"relative !important",boxSizing:"border-box","&.cm-focused":{outline:"1px dotted #212121"},display:"flex !important",flexDirection:"column"},".cm-scroller":{display:"flex !important",alignItems:"flex-start !important",fontFamily:"monospace",lineHeight:1.4,height:"100%",overflowX:"auto",position:"relative",zIndex:0},".cm-content":{margin:0,flexGrow:2,flexShrink:0,display:"block",whiteSpace:"pre",wordWrap:"normal",boxSizing:"border-box",padding:"4px 0",outline:"none","&[contenteditable=true]":{WebkitUserModify:"read-write-plaintext-only"}},".cm-lineWrapping":{whiteSpace_fallback:"pre-wrap",whiteSpace:"break-spaces",wordBreak:"break-word",overflowWrap:"anywhere",flexShrink:1},"&light .cm-content":{caretColor:"black"},"&dark .cm-content":{caretColor:"white"},".cm-line":{display:"block",padding:"0 2px 0 6px"},".cm-layer":{position:"absolute",left:0,top:0,contain:"size style","& > *":{position:"absolute"}},"&light .cm-selectionBackground":{background:"#d9d9d9"},"&dark .cm-selectionBackground":{background:"#222"},"&light.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#d7d4f0"},"&dark.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground":{background:"#233"},".cm-cursorLayer":{pointerEvents:"none"},"&.cm-focused > .cm-scroller > .cm-cursorLayer":{animation:"steps(1) cm-blink 1.2s infinite"},"@keyframes cm-blink":{"0%":{},"50%":{opacity:0},"100%":{}},"@keyframes cm-blink2":{"0%":{},"50%":{opacity:0},"100%":{}},".cm-cursor, .cm-dropCursor":{borderLeft:"1.2px solid black",marginLeft:"-0.6px",pointerEvents:"none"},".cm-cursor":{display:"none"},"&dark .cm-cursor":{borderLeftColor:"#444"},".cm-dropCursor":{position:"absolute"},"&.cm-focused > .cm-scroller > .cm-cursorLayer .cm-cursor":{display:"block"},"&light .cm-activeLine":{backgroundColor:"#cceeff44"},"&dark .cm-activeLine":{backgroundColor:"#99eeff33"},"&light .cm-specialChar":{color:"red"},"&dark .cm-specialChar":{color:"#f78"},".cm-gutters":{flexShrink:0,display:"flex",height:"100%",boxSizing:"border-box",insetInlineStart:0,zIndex:200},"&light .cm-gutters":{backgroundColor:"#f5f5f5",color:"#6c6c6c",borderRight:"1px solid #ddd"},"&dark .cm-gutters":{backgroundColor:"#333338",color:"#ccc"},".cm-gutter":{display:"flex !important",flexDirection:"column",flexShrink:0,boxSizing:"border-box",minHeight:"100%",overflow:"hidden"},".cm-gutterElement":{boxSizing:"border-box"},".cm-lineNumbers .cm-gutterElement":{padding:"0 3px 0 5px",minWidth:"20px",textAlign:"right",whiteSpace:"nowrap"},"&light .cm-activeLineGutter":{backgroundColor:"#e2f2ff"},"&dark .cm-activeLineGutter":{backgroundColor:"#222227"},".cm-panels":{boxSizing:"border-box",position:"sticky",left:0,right:0},"&light .cm-panels":{backgroundColor:"#f5f5f5",color:"black"},"&light .cm-panels-top":{borderBottom:"1px solid #ddd"},"&light .cm-panels-bottom":{borderTop:"1px solid #ddd"},"&dark .cm-panels":{backgroundColor:"#333338",color:"white"},".cm-tab":{display:"inline-block",overflow:"hidden",verticalAlign:"bottom"},".cm-widgetBuffer":{verticalAlign:"text-top",height:"1em",width:0,display:"inline"},".cm-placeholder":{color:"#888",display:"inline-block",verticalAlign:"top"},".cm-highlightSpace:before":{content:"attr(data-display)",position:"absolute",pointerEvents:"none",color:"#888"},".cm-highlightTab":{backgroundImage:`url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="200" height="20"><path stroke="%23888" stroke-width="1" fill="none" d="M1 10H196L190 5M190 15L196 10M197 4L197 16"/></svg>')`,backgroundSize:"auto 100%",backgroundPosition:"right 90%",backgroundRepeat:"no-repeat"},".cm-trailingSpace":{backgroundColor:"#ff332255"},".cm-button":{verticalAlign:"middle",color:"inherit",fontSize:"70%",padding:".2em 1em",borderRadius:"1px"},"&light .cm-button":{backgroundImage:"linear-gradient(#eff1f5, #d9d9df)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#b4b4b4, #d0d3d6)"}},"&dark .cm-button":{backgroundImage:"linear-gradient(#393939, #111)",border:"1px solid #888","&:active":{backgroundImage:"linear-gradient(#111, #333)"}},".cm-textfield":{verticalAlign:"middle",color:"inherit",fontSize:"70%",border:"1px solid silver",padding:".2em .5em"},"&light .cm-textfield":{backgroundColor:"white"},"&dark .cm-textfield":{border:"1px solid #555",backgroundColor:"inherit"}},WC),Dm=class{constructor(e,n,r,o){this.typeOver=o,this.bounds=null,this.text="";let{impreciseHead:i,impreciseAnchor:s}=e.docView;if(e.state.readOnly&&n>-1)this.newSel=null;else if(n>-1&&(this.bounds=e.docView.domBoundsAround(n,r,0))){let l=i||s?[]:F4(e),a=new Mc(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=B4(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!rm(e.contentDOM,l.focusNode)?e.state.selection.main.head:e.docView.posFromDOM(l.focusNode,l.focusOffset),u=s&&s.node==l.anchorNode&&s.offset==l.anchorOffset||!rm(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);this.newSel=$.single(u,a)}}};function KC(t,e){let n,{newSel:r}=e,o=t.state.selection.main,i=t.inputState.lastKeyTime>Date.now()-100?t.inputState.lastKeyCode:-1;if(e.bounds){let{from:s,to:l}=e.bounds,a=o.from,u=null;(i===8||Q.android&&e.text.length<l-s)&&(a=o.to,u="end");let c=N4(t.state.doc.sliceString(s,l,Pi),e.text,a-s,u);c&&(Q.chrome&&i==13&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==Pi+Pi&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:de.of(e.text.slice(c.from,c.toB).split(Pi))})}else r&&(!t.hasFocus&&t.state.facet(Bc)||r.main.eq(o))&&(r=null);if(!n&&!r)return!1;if(!n&&e.typeOver&&!o.empty&&r&&r.main.empty?n={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,o.to)}:n&&n.from>=o.from&&n.to<=o.to&&(n.from!=o.from||n.to!=o.to)&&o.to-o.from-(n.to-n.from)<=4?n={from:o.from,to:o.to,insert:t.state.doc.slice(o.from,n.from).append(n.insert).append(t.state.doc.slice(n.to,o.to))}:(Q.mac||Q.android)&&n&&n.from==n.to&&n.from==o.head-1&&/^\. ?$/.test(n.insert.toString())&&t.contentDOM.getAttribute("autocorrect")=="off"?(r&&n.insert.length==2&&(r=$.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:de.of([" "])}):Q.chrome&&n&&n.from==n.to&&n.from==o.head&&n.insert.toString()==`
|
|
416
|
-
`&&t.lineWrapping&&(r&&(r=$.single(r.main.anchor-1,r.main.head-1)),n={from:o.from,to:o.to,insert:de.of([" "])}),n){let s=t.state;if(Q.ios&&t.inputState.flushIOSKey(t)||Q.android&&(n.from==o.from&&n.to==o.to&&n.insert.length==1&&n.insert.lines==2&&Ai(t.contentDOM,"Enter",13)||(n.from==o.from-1&&n.to==o.to&&n.insert.length==0||i==8&&n.insert.length<n.to-n.from)&&Ai(t.contentDOM,"Backspace",8)||n.from==o.from&&n.to==o.to+1&&n.insert.length==0&&Ai(t.contentDOM,"Delete",46)))return!0;let l=n.insert.toString();if(t.state.facet(bC).some(c=>c(t,n.from,n.to,l)))return!0;t.inputState.composing>=0&&t.inputState.composing++;let a;if(n.from>=o.from&&n.to<=o.to&&n.to-n.from>=(o.to-o.from)/3&&(!r||r.main.empty&&r.main.from==n.from+n.insert.length)&&t.inputState.composing<0){let c=o.from<n.from?s.sliceDoc(o.from,n.from):"",f=o.to>n.to?s.sliceDoc(n.to,o.to):"";a=s.replaceSelection(t.state.toText(c+n.insert.sliceString(0,void 0,t.state.lineBreak)+f))}else{let c=s.changes(n),f=r&&r.main.to<=c.newLength?r.main:void 0;if(s.selection.ranges.length>1&&t.inputState.composing>=0&&n.to<=o.to&&n.to>=o.to-10){let d=t.state.sliceDoc(n.from,n.to),h=LC(t)||t.state.doc.lineAt(o.head),g=o.to-n.to,v=o.to-o.from;a=s.changeByRange(p=>{if(p.from==o.from&&p.to==o.to)return{changes:c,range:f||p.map(c)};let m=p.to-g,y=m-d.length;if(p.to-p.from!=v||t.state.sliceDoc(y,m)!=d||h&&p.to>=h.from&&p.from<=h.to)return{range:p};let x=s.changes({from:y,to:m,insert:n.insert}),b=p.to-o.to;return{changes:x,range:f?$.range(Math.max(0,f.anchor+b),Math.max(0,f.head+b)):p.map(x)}})}else a={changes:c,selection:f&&s.selection.replaceRange(f)}}let u="input.type";return(t.composing||t.inputState.compositionPendingChange&&t.inputState.compositionEndedAt>Date.now()-50)&&(t.inputState.compositionPendingChange=!1,u+=".compose",t.inputState.compositionFirstChange&&(u+=".start",t.inputState.compositionFirstChange=!1)),t.dispatch(a,{scrollIntoView:!0,userEvent:u}),!0}else if(r&&!r.main.eq(o)){let s=!1,l="select";return t.inputState.lastSelectionTime>Date.now()-50&&(t.inputState.lastSelectionOrigin=="select"&&(s=!0),l=t.inputState.lastSelectionOrigin),t.dispatch({selection:r,scrollIntoView:s,userEvent:l}),!0}else return!1}function N4(t,e,n,r){let o=Math.min(t.length,e.length),i=0;for(;i<o&&t.charCodeAt(i)==e.charCodeAt(i);)i++;if(i==o&&t.length==e.length)return null;let s=t.length,l=e.length;for(;s>0&&l>0&&t.charCodeAt(s-1)==e.charCodeAt(l-1);)s--,l--;if(r=="end"){let a=Math.max(0,i-Math.min(s,l));n-=s+a-i}if(s<i&&t.length<e.length){let a=n<=i&&n>=s?i-n:0;i-=a,l=i+(l-s),s=i}else if(l<i){let a=n<=i&&n>=l?i-n:0;i-=a,s=i+(s-l),l=i}return{from:i,toA:s,toB:l}}function F4(t){let e=[];if(t.root.activeElement!=t.contentDOM)return e;let{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}=t.observer.selectionRange;return n&&(e.push(new Tc(n,r)),(o!=n||i!=r)&&e.push(new Tc(o,i))),e}function B4(t,e){if(t.length==0)return null;let n=t[0].pos,r=t.length==2?t[1].pos:n;return n>-1&&r>-1?$.single(n+e,r+e):null}var V4={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},tm=Q.ie&&Q.ie_version<=11,Am=class{constructor(e){this.view=e,this.active=!1,this.selectionRange=new om,this.selectionChanged=!1,this.delayedFlush=-1,this.resizeTimeout=-1,this.queue=[],this.delayedAndroidKey=null,this.flushingAndroidKey=-1,this.lastChange=0,this.scrollTargets=[],this.intersection=null,this.resizeScroll=null,this.resizeContent=null,this.intersecting=!1,this.gapIntersection=null,this.gaps=[],this.parentCheck=-1,this.dom=e.contentDOM,this.observer=new MutationObserver(n=>{for(let r of n)this.queue.push(r);(Q.ie&&Q.ie_version<=11||Q.ios&&e.composing)&&n.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():this.flush()}),tm&&(this.onCharData=n=>{this.queue.push({target:n.target,type:"characterData",oldValue:n.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this),this.onResize=this.onResize.bind(this),this.onPrint=this.onPrint.bind(this),this.onScroll=this.onScroll.bind(this),typeof ResizeObserver=="function"&&(this.resizeScroll=new ResizeObserver(()=>{var n;((n=this.view.docView)===null||n===void 0?void 0:n.lastUpdate)<Date.now()-75&&this.onResize()}),this.resizeScroll.observe(e.scrollDOM),this.resizeContent=new ResizeObserver(()=>this.view.requestMeasure()),this.resizeContent.observe(e.contentDOM)),this.addWindowListeners(this.win=e.win),this.start(),typeof IntersectionObserver=="function"&&(this.intersection=new IntersectionObserver(n=>{this.parentCheck<0&&(this.parentCheck=setTimeout(this.listenForScroll.bind(this),1e3)),n.length>0&&n[n.length-1].intersectionRatio>0!=this.intersecting&&(this.intersecting=!this.intersecting,this.intersecting!=this.view.inView&&this.onScrollChanged(document.createEvent("Event")))},{threshold:[0,.001]}),this.intersection.observe(this.dom),this.gapIntersection=new IntersectionObserver(n=>{n.length>0&&n[n.length-1].intersectionRatio>0&&this.onScrollChanged(document.createEvent("Event"))},{})),this.listenForScroll(),this.readSelectionRange()}onScrollChanged(e){this.view.inputState.runScrollHandlers(this.view,e),this.intersecting&&this.view.measure()}onScroll(e){this.intersecting&&this.flush(!1),this.onScrollChanged(e)}onResize(){this.resizeTimeout<0&&(this.resizeTimeout=setTimeout(()=>{this.resizeTimeout=-1,this.view.requestMeasure()},50))}onPrint(){this.view.viewState.printing=!0,this.view.measure(),setTimeout(()=>{this.view.viewState.printing=!1,this.view.requestMeasure()},500)}updateGaps(e){if(this.gapIntersection&&(e.length!=this.gaps.length||this.gaps.some((n,r)=>n!=e[r]))){this.gapIntersection.disconnect();for(let n of e)this.gapIntersection.observe(n);this.gaps=e}}onSelectionChange(e){let n=this.selectionChanged;if(!this.readSelectionRange()||this.delayedAndroidKey)return;let{view:r}=this,o=this.selectionRange;if(r.state.facet(Bc)?r.root.activeElement!=this.dom:!vc(r.dom,o))return;let i=o.anchorNode&&r.docView.nearest(o.anchorNode);if(i&&i.ignoreEvent(e)){n||(this.selectionChanged=!1);return}(Q.ie&&Q.ie_version<=11||Q.android&&Q.chrome)&&!r.state.selection.main.empty&&o.focusNode&&Cc(o.focusNode,o.focusOffset,o.anchorNode,o.anchorOffset)?this.flushSoon():this.flush(!1)}readSelectionRange(){let{view:e}=this,n=Q.safari&&e.root.nodeType==11&&V6(this.dom.ownerDocument)==this.dom&&z4(this.view)||Sc(e.root);if(!n||this.selectionRange.eq(n))return!1;let r=vc(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&K6(this.dom,n)?(this.view.inputState.lastFocusTime=0,e.docView.updateSelection(),!1):(this.selectionRange.setRange(n),r&&(this.selectionChanged=!0),!0)}setSelectionRange(e,n){this.selectionRange.set(e.node,e.offset,n.node,n.offset),this.selectionChanged=!1}clearSelectionRange(){this.selectionRange.set(null,0,null,0)}listenForScroll(){this.parentCheck=-1;let e=0,n=null;for(let r=this.dom;r;)if(r.nodeType==1)!n&&e<this.scrollTargets.length&&this.scrollTargets[e]==r?e++:n||(n=this.scrollTargets.slice(0,e)),n&&n.push(r),r=r.assignedSlot||r.parentNode;else if(r.nodeType==11)r=r.host;else break;if(e<this.scrollTargets.length&&!n&&(n=this.scrollTargets.slice(0,e)),n){for(let r of this.scrollTargets)r.removeEventListener("scroll",this.onScroll);for(let r of this.scrollTargets=n)r.addEventListener("scroll",this.onScroll)}}ignore(e){if(!this.active)return e();try{return this.stop(),e()}finally{this.start(),this.clear()}}start(){this.active||(this.observer.observe(this.dom,V4),tm&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),tm&&this.dom.removeEventListener("DOMCharacterDataModified",this.onCharData))}clear(){this.processRecords(),this.queue.length=0,this.selectionChanged=!1}delayAndroidKey(e,n){var r;if(!this.delayedAndroidKey){let o=()=>{let i=this.delayedAndroidKey;i&&(this.clearDelayedAndroidKey(),this.view.inputState.lastKeyCode=i.keyCode,this.view.inputState.lastKeyTime=Date.now(),!this.flush()&&i.force&&Ai(this.dom,i.key,i.keyCode))};this.flushingAndroidKey=this.view.win.requestAnimationFrame(o)}(!this.delayedAndroidKey||e=="Enter")&&(this.delayedAndroidKey={key:e,keyCode:n,force:this.lastChange<Date.now()-50||!!(!((r=this.delayedAndroidKey)===null||r===void 0)&&r.force)})}clearDelayedAndroidKey(){this.win.cancelAnimationFrame(this.flushingAndroidKey),this.delayedAndroidKey=null,this.flushingAndroidKey=-1}flushSoon(){this.delayedFlush<0&&(this.delayedFlush=this.view.win.requestAnimationFrame(()=>{this.delayedFlush=-1,this.flush()}))}forceFlush(){this.delayedFlush>=0&&(this.view.win.cancelAnimationFrame(this.delayedFlush),this.delayedFlush=-1),this.flush()}pendingRecords(){for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}processRecords(){let e=this.pendingRecords();e.length&&(this.queue=[]);let n=-1,r=-1,o=!1;for(let i of e){let s=this.readMutation(i);s&&(s.typeOver&&(o=!0),n==-1?{from:n,to:r}=s:(n=Math.min(s.from,n),r=Math.max(s.to,r)))}return{from:n,to:r,typeOver:o}}readChange(){let{from:e,to:n,typeOver:r}=this.processRecords(),o=this.selectionChanged&&vc(this.dom,this.selectionRange);return e<0&&!o?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Dm(this.view,e,n,r))}flush(e=!0){if(this.delayedFlush>=0||this.delayedAndroidKey)return!1;e&&this.readSelectionRange();let n=this.readChange();if(!n)return!1;let r=this.view.state,o=KC(this.view,n);return this.view.state==r&&this.view.update([]),o}readMutation(e){let n=this.view.docView.nearest(e.target);if(!n||n.ignoreMutation(e))return null;if(n.markDirty(e.type=="attributes"),e.type=="attributes"&&(n.flags|=4),e.type=="childList"){let r=ZS(n,e.previousSibling||e.target.previousSibling,-1),o=ZS(n,e.nextSibling||e.target.nextSibling,1);return{from:r?n.posAfter(r):n.posAtStart,to:o?n.posBefore(o):n.posAtEnd,typeOver:!1}}else return e.type=="characterData"?{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue}:null}setWindow(e){e!=this.win&&(this.removeWindowListeners(this.win),this.win=e,this.addWindowListeners(this.win))}addWindowListeners(e){e.addEventListener("resize",this.onResize),e.addEventListener("beforeprint",this.onPrint),e.addEventListener("scroll",this.onScroll),e.document.addEventListener("selectionchange",this.onSelectionChange)}removeWindowListeners(e){e.removeEventListener("scroll",this.onScroll),e.removeEventListener("resize",this.onResize),e.removeEventListener("beforeprint",this.onPrint),e.document.removeEventListener("selectionchange",this.onSelectionChange)}destroy(){var e,n,r,o;this.stop(),(e=this.intersection)===null||e===void 0||e.disconnect(),(n=this.gapIntersection)===null||n===void 0||n.disconnect(),(r=this.resizeScroll)===null||r===void 0||r.disconnect(),(o=this.resizeContent)===null||o===void 0||o.disconnect();for(let i of this.scrollTargets)i.removeEventListener("scroll",this.onScroll);this.removeWindowListeners(this.win),clearTimeout(this.parentCheck),clearTimeout(this.resizeTimeout),this.win.cancelAnimationFrame(this.delayedFlush),this.win.cancelAnimationFrame(this.flushingAndroidKey)}};function ZS(t,e,n){for(;e;){let r=xe.get(e);if(r&&r.parent==t)return r;let o=e.parentNode;e=o!=t.dom?o:n>0?e.nextSibling:e.previousSibling}return null}function z4(t){let e=null;function n(a){a.preventDefault(),a.stopImmediatePropagation(),e=a.getTargetRanges()[0]}if(t.contentDOM.addEventListener("beforeinput",n,!0),t.dom.ownerDocument.execCommand("indent"),t.contentDOM.removeEventListener("beforeinput",n,!0),!e)return null;let r=e.startContainer,o=e.startOffset,i=e.endContainer,s=e.endOffset,l=t.docView.domAtPos(t.state.selection.main.anchor);return Cc(l.node,l.offset,i,s)&&([r,o,i,s]=[i,s,r,o]),{anchorNode:r,anchorOffset:o,focusNode:i,focusOffset:s}}var ie=class t{constructor(e={}){this.plugins=[],this.pluginMap=new Map,this.editorAttrs={},this.contentAttrs={},this.bidiCache=[],this.destroyed=!1,this.updateState=2,this.measureScheduled=-1,this.measureRequests=[],this.contentDOM=document.createElement("div"),this.scrollDOM=document.createElement("div"),this.scrollDOM.tabIndex=-1,this.scrollDOM.className="cm-scroller",this.scrollDOM.appendChild(this.contentDOM),this.announceDOM=document.createElement("div"),this.announceDOM.style.cssText="position: fixed; top: -10000px",this.announceDOM.setAttribute("aria-live","polite"),this.dom=document.createElement("div"),this.dom.appendChild(this.announceDOM),this.dom.appendChild(this.scrollDOM),this._dispatch=e.dispatch||(n=>this.update([n])),this.dispatch=this.dispatch.bind(this),this._root=e.root||W6(e.parent)||document,this.viewState=new Hc(e.state||ke.create(e)),this.plugins=this.state.facet(ul).map(n=>new hl(n));for(let n of this.plugins)n.update(this);this.observer=new Am(this),this.inputState=new vm(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new Ac(this),this.mountStyles(),this.updateAttrs(),this.updateState=0,this.requestMeasure(),e.parent&&e.parent.appendChild(this.dom)}get state(){return this.viewState.state}get viewport(){return this.viewState.viewport}get visibleRanges(){return this.viewState.visibleRanges}get inView(){return this.viewState.inView}get composing(){return this.inputState.composing>0}get compositionStarted(){return this.inputState.composing>=0}get root(){return this._root}get win(){return this.dom.ownerDocument.defaultView||window}dispatch(...e){let n=e.length==1&&e[0]instanceof qe?e[0]:this.state.update(...e);this._dispatch(n,this)}update(e){if(this.updateState!=0)throw new Error("Calls to EditorView.update are not allowed while an update is in progress");let n=!1,r=!1,o,i=this.state;for(let d of e){if(d.startState!=i)throw new RangeError("Trying to update state with a transaction that doesn't start from the previous state.");i=d.state}if(this.destroyed){this.viewState.state=i;return}let s=this.hasFocus,l=0,a=null;e.some(d=>d.annotation(BC))?(this.inputState.notifiedFocused=s,l=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=VC(i,s),a||(l=1));let u=this.observer.delayedAndroidKey,c=null;if(u?(this.observer.clearDelayedAndroidKey(),c=this.observer.readChange(),(c&&!this.state.doc.eq(i.doc)||!this.state.selection.eq(i.selection))&&(c=null)):this.observer.clear(),i.facet(ke.phrases)!=this.state.facet(ke.phrases))return this.setState(i);o=Dc.create(this,i,e),o.flags|=l;let f=this.viewState.scrollTarget;try{this.updateState=2;for(let d of e){if(f&&(f=f.map(d.changes)),d.scrollIntoView){let{main:h}=d.state.selection;f=new Pc(h.empty?h:$.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of d.effects)h.is(RS)&&(f=h.value)}this.viewState.update(o,f),this.bidiCache=Nc.update(this.bidiCache,o.changes),o.empty||(this.updatePlugins(o),this.inputState.update(o)),n=this.docView.update(o),this.state.facet(cl)!=this.styleModules&&this.mountStyles(),r=this.updateAttrs(),this.showAnnouncements(e),this.docView.updateSelection(n,e.some(d=>d.isUserEvent("select.pointer")))}finally{this.updateState=0}if(o.startState.facet(mc)!=o.state.facet(mc)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!o.empty)for(let d of this.state.facet(dm))d(o);(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!KC(this,c)&&u.force&&Ai(this.contentDOM,u.key,u.keyCode)})}setState(e){if(this.updateState!=0)throw new Error("Calls to EditorView.setState are not allowed while an update is in progress");if(this.destroyed){this.viewState.state=e;return}this.updateState=2;let n=this.hasFocus;try{for(let r of this.plugins)r.destroy(this);this.viewState=new Hc(e),this.plugins=e.facet(ul).map(r=>new hl(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView=new Ac(this),this.inputState.ensureHandlers(this,this.plugins),this.mountStyles(),this.updateAttrs(),this.bidiCache=[]}finally{this.updateState=0}n&&this.focus(),this.requestMeasure()}updatePlugins(e){let n=e.startState.facet(ul),r=e.state.facet(ul);if(n!=r){let o=[];for(let i of r){let s=n.indexOf(i);if(s<0)o.push(new hl(i));else{let l=this.plugins[s];l.mustUpdate=e,o.push(l)}}for(let i of this.plugins)i.mustUpdate!=e&&i.destroy(this);this.plugins=o,this.pluginMap.clear(),this.inputState.ensureHandlers(this,this.plugins)}else for(let o of this.plugins)o.mustUpdate=e;for(let o=0;o<this.plugins.length;o++)this.plugins[o].update(this)}measure(e=!0){if(this.destroyed)return;this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.measureScheduled=0,e&&this.observer.forceFlush();let n=null,r=this.scrollDOM,{scrollTop:o}=r,{scrollAnchorPos:i,scrollAnchorHeight:s}=this.viewState;o!=this.viewState.scrollTop&&(s=-1),this.viewState.scrollAnchorHeight=-1;try{for(let l=0;;l++){if(s<0)if(sC(r))i=-1,s=this.viewState.heightMap.height;else{let h=this.viewState.scrollAnchorAt(o);i=h.from,s=h.top}this.updateState=1;let a=this.viewState.measure(this);if(!a&&!this.measureRequests.length&&this.viewState.scrollTarget==null)break;if(l>5){console.warn(this.measureRequests.length?"Measure loop restarted more than 5 times":"Viewport failed to stabilize");break}let u=[];a&4||([this.measureRequests,u]=[u,this.measureRequests]);let c=u.map(h=>{try{return h.read(this)}catch(g){return Ln(this.state,g),YS}}),f=Dc.create(this,this.state,[]),d=!1;f.flags|=a,n?n.flags|=a:n=f,this.updateState=2,f.empty||(this.updatePlugins(f),this.inputState.update(f),this.updateAttrs(),d=this.docView.update(f));for(let h=0;h<u.length;h++)if(c[h]!=YS)try{let g=u[h];g.write&&g.write(c[h],this)}catch(g){Ln(this.state,g)}if(d&&this.docView.updateSelection(!0),!f.viewportChanged&&this.measureRequests.length==0){if(this.viewState.editorHeight)if(this.viewState.scrollTarget){this.docView.scrollIntoView(this.viewState.scrollTarget),this.viewState.scrollTarget=null;continue}else{let g=(i<0?this.viewState.heightMap.height:this.viewState.lineBlockAt(i).top)-s;if(g>1||g<-1){o=r.scrollTop=o+g,s=-1;continue}}break}}}finally{this.updateState=0,this.measureScheduled=-1}if(n&&!n.empty)for(let l of this.state.facet(dm))l(n)}get themeClasses(){return Lm+" "+(this.state.facet(Im)?_C:$C)+" "+this.state.facet(mc)}updateAttrs(){let e=QS(this,CC,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(Bc)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),QS(this,$m,n);let r=this.observer.ignore(()=>{let o=um(this.contentDOM,this.contentAttrs,n),i=um(this.dom,this.editorAttrs,e);return o||i});return this.editorAttrs=e,this.contentAttrs=n,r}showAnnouncements(e){let n=!0;for(let r of e)for(let o of r.effects)if(o.is(t.announce)){n&&(this.announceDOM.textContent=""),n=!1;let i=this.announceDOM.appendChild(document.createElement("div"));i.textContent=o.value}}mountStyles(){this.styleModules=this.state.facet(cl),Qt.mount(this.root,this.styleModules.concat(H4).reverse())}readMeasured(){if(this.updateState==2)throw new Error("Reading the editor layout isn't allowed during an update");this.updateState==0&&this.measureScheduled>-1&&this.measure(!1)}requestMeasure(e){if(this.measureScheduled<0&&(this.measureScheduled=this.win.requestAnimationFrame(()=>this.measure())),e){if(this.measureRequests.indexOf(e)>-1)return;if(e.key!=null){for(let n=0;n<this.measureRequests.length;n++)if(this.measureRequests[n].key===e.key){this.measureRequests[n]=e;return}}this.measureRequests.push(e)}}plugin(e){let n=this.pluginMap.get(e);return(n===void 0||n&&n.spec!=e)&&this.pluginMap.set(e,n=this.plugins.find(r=>r.spec==e)||null),n&&n.update(this).value}get documentTop(){return this.contentDOM.getBoundingClientRect().top+this.viewState.paddingTop}get documentPadding(){return{top:this.viewState.paddingTop,bottom:this.viewState.paddingBottom}}elementAtHeight(e){return this.readMeasured(),this.viewState.elementAtHeight(e)}lineBlockAtHeight(e){return this.readMeasured(),this.viewState.lineBlockAtHeight(e)}get viewportLineBlocks(){return this.viewState.viewportLines}lineBlockAt(e){return this.viewState.lineBlockAt(e)}get contentHeight(){return this.viewState.contentHeight}moveByChar(e,n,r){return em(this,e,BS(this,e,n,r))}moveByGroup(e,n){return em(this,e,BS(this,e,n,r=>m4(this,e.head,r)))}moveToLineBoundary(e,n,r=!0){return p4(this,e,n,r)}moveVertically(e,n,r){return em(this,e,g4(this,e,n,r))}domAtPos(e){return this.docView.domAtPos(e)}posAtDOM(e,n=0){return this.docView.posFromDOM(e,n)}posAtCoords(e,n=!0){return this.readMeasured(),DC(this,e,n)}coordsAtPos(e,n=1){this.readMeasured();let r=this.docView.coordsAt(e,n);if(!r||r.left==r.right)return r;let o=this.state.doc.lineAt(e),i=this.bidiSpans(o),s=i[Tr.find(i,e-o.from,-1,n)];return Bm(r,s.dir==Re.LTR==n>0)}coordsForChar(e){return this.readMeasured(),this.docView.coordsForChar(e)}get defaultCharacterWidth(){return this.viewState.heightOracle.charWidth}get defaultLineHeight(){return this.viewState.heightOracle.lineHeight}get textDirection(){return this.viewState.defaultTextDirection}textDirectionAt(e){return!this.state.facet(wC)||e<this.viewport.from||e>this.viewport.to?this.textDirection:(this.readMeasured(),this.docView.textDirectionAt(e))}get lineWrapping(){return this.viewState.heightOracle.lineWrapping}bidiSpans(e){if(e.length>$4)return TC(e.length);let n=this.textDirectionAt(e.from);for(let o of this.bidiCache)if(o.from==e.from&&o.dir==n)return o.order;let r=n4(e.text,n);return this.bidiCache.push(new Nc(e.from,e.to,n,r)),r}get hasFocus(){var e;return(this.dom.ownerDocument.hasFocus()||Q.safari&&((e=this.inputState)===null||e===void 0?void 0:e.lastContextMenu)>Date.now()-3e4)&&this.root.activeElement==this.contentDOM}focus(){this.observer.ignore(()=>{oC(this.contentDOM),this.docView.updateSelection()})}setRoot(e){this._root!=e&&(this._root=e,this.observer.setWindow((e.nodeType==9?e:e.ownerDocument).defaultView||window),this.mountStyles())}destroy(){for(let e of this.plugins)e.destroy(this);this.plugins=[],this.inputState.destroy(),this.dom.remove(),this.observer.destroy(),this.measureScheduled>-1&&this.win.cancelAnimationFrame(this.measureScheduled),this.destroyed=!0}static scrollIntoView(e,n={}){return RS.of(new Pc(typeof e=="number"?$.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}static domEventHandlers(e){return Yn.define(()=>({}),{eventHandlers:e})}static theme(e,n){let r=Qt.newName(),o=[mc.of(r),cl.of(Pm(`.${r}`,e))];return n&&n.dark&&o.push(Im.of(!0)),o}static baseTheme(e){return xo.lowest(cl.of(Pm("."+Lm,e,WC)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),o=r&&xe.get(r)||xe.get(e);return((n=o==null?void 0:o.rootView)===null||n===void 0?void 0:n.view)||null}};ie.styleModule=cl;ie.inputHandler=bC;ie.focusChangeEffect=xC;ie.perLineTextDirection=wC;ie.exceptionSink=yC;ie.updateListener=dm;ie.editable=Bc;ie.mouseSelectionStyle=vC;ie.dragMovesSelection=gC;ie.clickAddsSelectionRange=mC;ie.decorations=xl;ie.atomicRanges=_m;ie.scrollMargins=kC;ie.darkTheme=Im;ie.contentAttributes=$m;ie.editorAttributes=CC;ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"});ie.announce=Se.define();var $4=4096,YS={},Nc=class t{constructor(e,n,r,o){this.from=e,this.to=n,this.dir=r,this.order=o}static update(e,n){if(n.empty)return e;let r=[],o=e.length?e[e.length-1].dir:Re.LTR;for(let i=Math.max(0,e.length-10);i<e.length;i++){let s=e[i];s.dir==o&&!n.touchesRange(s.from,s.to)&&r.push(new t(n.mapPos(s.from,1),n.mapPos(s.to,-1),s.dir,s.order))}return r}};function QS(t,e,n){for(let r=t.state.facet(e),o=r.length-1;o>=0;o--){let i=r[o],s=typeof i=="function"?i(t):i;s&&am(s,n)}return n}var _4=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function W4(t,e){let n=t.split(/-(?!$)/),r=n[n.length-1];r=="Space"&&(r=" ");let o,i,s,l;for(let a=0;a<n.length-1;++a){let u=n[a];if(/^(cmd|meta|m)$/i.test(u))l=!0;else if(/^a(lt)?$/i.test(u))o=!0;else if(/^(c|ctrl|control)$/i.test(u))i=!0;else if(/^s(hift)?$/i.test(u))s=!0;else if(/^mod$/i.test(u))e=="mac"?l=!0:i=!0;else throw new Error("Unrecognized modifier name: "+u)}return o&&(r="Alt-"+r),i&&(r="Ctrl-"+r),l&&(r="Meta-"+r),s&&(r="Shift-"+r),r}function gc(t,e,n){return e.altKey&&(t="Alt-"+t),e.ctrlKey&&(t="Ctrl-"+t),e.metaKey&&(t="Meta-"+t),n!==!1&&e.shiftKey&&(t="Shift-"+t),t}var K4=xo.default(ie.domEventHandlers({keydown(t,e){return G4(U4(e.state),t,e,"editor")}})),Ri=ne.define({enables:K4}),XS=new WeakMap;function U4(t){let e=t.facet(Ri),n=XS.get(e);return n||XS.set(e,n=q4(e.reduce((r,o)=>r.concat(o),[]))),n}var Mr=null,j4=4e3;function q4(t,e=_4){let n=Object.create(null),r=Object.create(null),o=(s,l)=>{let a=r[s];if(a==null)r[s]=l;else if(a!=l)throw new Error("Key binding "+s+" is used both as a regular binding and as a multi-stroke prefix")},i=(s,l,a,u,c)=>{var f,d;let h=n[s]||(n[s]=Object.create(null)),g=l.split(/ (?!$)/).map(m=>W4(m,e));for(let m=1;m<g.length;m++){let y=g.slice(0,m).join(" ");o(y,!0),h[y]||(h[y]={preventDefault:!0,stopPropagation:!1,run:[x=>{let b=Mr={view:x,prefix:y,scope:s};return setTimeout(()=>{Mr==b&&(Mr=null)},j4),!0}]})}let v=g.join(" ");o(v,!1);let p=h[v]||(h[v]={preventDefault:!1,stopPropagation:!1,run:((d=(f=h._any)===null||f===void 0?void 0:f.run)===null||d===void 0?void 0:d.slice())||[]});a&&p.run.push(a),u&&(p.preventDefault=!0),c&&(p.stopPropagation=!0)};for(let s of t){let l=s.scope?s.scope.split(" "):["editor"];if(s.any)for(let u of l){let c=n[u]||(n[u]=Object.create(null));c._any||(c._any={preventDefault:!1,stopPropagation:!1,run:[]});for(let f in c)c[f].run.push(s.any)}let a=s[e]||s.key;if(a)for(let u of l)i(u,a,s.run,s.preventDefault,s.stopPropagation),s.shift&&i(u,"Shift-"+a,s.shift,s.preventDefault,s.stopPropagation)}return n}function G4(t,e,n,r){let o=kS(e),i=Mn(o,0),s=yo(i)==o.length&&o!=" ",l="",a=!1,u=!1,c=!1;Mr&&Mr.view==n&&Mr.scope==r&&(l=Mr.prefix+" ",RC.indexOf(e.keyCode)<0&&(u=!0,Mr=null));let f=new Set,d=p=>{if(p){for(let m of p.run)if(!f.has(m)&&(f.add(m),m(n,e)))return p.stopPropagation&&(c=!0),!0;p.preventDefault&&(p.stopPropagation&&(c=!0),u=!0)}return!1},h=t[r],g,v;return h&&(d(h[l+gc(o,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&(g=Gn[e.keyCode])&&g!=o?(d(h[l+gc(g,e,!0)])||e.shiftKey&&(v=Ii[e.keyCode])!=o&&v!=g&&d(h[l+gc(v,e,!1)]))&&(a=!0):s&&e.shiftKey&&d(h[l+gc(o,e,!0)])&&(a=!0),!a&&d(h._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),a}var wl=class t{constructor(e,n,r,o,i){this.className=e,this.left=n,this.top=r,this.width=o,this.height=i}draw(){let e=document.createElement("div");return e.className=this.className,this.adjust(e),e}update(e,n){return n.className!=this.className?!1:(this.adjust(e),!0)}adjust(e){e.style.left=this.left+"px",e.style.top=this.top+"px",this.width!=null&&(e.style.width=this.width+"px"),e.style.height=this.height+"px"}eq(e){return this.left==e.left&&this.top==e.top&&this.width==e.width&&this.height==e.height&&this.className==e.className}static forRange(e,n,r){if(r.empty){let o=e.coordsAtPos(r.head,r.assoc||1);if(!o)return[];let i=UC(e);return[new t(n,o.left-i.left,o.top-i.top,null,o.bottom-o.top)]}else return J4(e,n,r)}};function UC(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Re.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function eC(t,e,n){let r=$.cursor(e);return{from:Math.max(n.from,t.moveToLineBoundary(r,!1,!0).from),to:Math.min(n.to,t.moveToLineBoundary(r,!0,!0).from),type:Oe.Text}}function J4(t,e,n){if(n.to<=t.viewport.from||n.from>=t.viewport.to)return[];let r=Math.max(n.from,t.viewport.from),o=Math.min(n.to,t.viewport.to),i=t.textDirection==Re.LTR,s=t.contentDOM,l=s.getBoundingClientRect(),a=UC(t),u=s.querySelector(".cm-line"),c=u&&window.getComputedStyle(u),f=l.left+(c?parseInt(c.paddingLeft)+Math.min(0,parseInt(c.textIndent)):0),d=l.right-(c?parseInt(c.paddingRight):0),h=gm(t,r),g=gm(t,o),v=h.type==Oe.Text?h:null,p=g.type==Oe.Text?g:null;if(v&&(t.lineWrapping||h.widgetLineBreaks)&&(v=eC(t,r,v)),p&&(t.lineWrapping||g.widgetLineBreaks)&&(p=eC(t,o,p)),v&&p&&v.from==p.from)return y(x(n.from,n.to,v));{let C=v?x(n.from,null,v):b(h,!1),w=p?x(null,n.to,p):b(g,!0),S=[];return(v||h).to<(p||g).from-(v&&p?1:0)||h.widgetLineBreaks>1&&C.bottom+t.defaultLineHeight/2<w.top?S.push(m(f,C.bottom,d,w.top)):C.bottom<w.top&&t.elementAtHeight((C.bottom+w.top)/2).type==Oe.Text&&(C.bottom=w.top=(C.bottom+w.top)/2),y(C).concat(S).concat(y(w))}function m(C,w,S,E){return new wl(e,C-a.left,w-a.top-.01,S-C,E-w+.01)}function y({top:C,bottom:w,horizontal:S}){let E=[];for(let k=0;k<S.length;k+=2)E.push(m(S[k],C,S[k+1],w));return E}function x(C,w,S){let E=1e9,k=-1e9,T=[];function D(R,A,L,H,O){let B=t.coordsAtPos(R,R==S.to?-2:2),P=t.coordsAtPos(L,L==S.from?2:-2);!B||!P||(E=Math.min(B.top,P.top,E),k=Math.max(B.bottom,P.bottom,k),O==Re.LTR?T.push(i&&A?f:B.left,i&&H?d:P.right):T.push(!i&&H?f:P.left,!i&&A?d:B.right))}let M=C!=null?C:S.from,I=w!=null?w:S.to;for(let R of t.visibleRanges)if(R.to>M&&R.from<I)for(let A=Math.max(R.from,M),L=Math.min(R.to,I);;){let H=t.state.doc.lineAt(A);for(let O of t.bidiSpans(H)){let B=O.from+H.from,P=O.to+H.from;if(B>=L)break;P>A&&D(Math.max(B,A),C==null&&B<=M,Math.min(P,L),w==null&&P>=I,O.dir)}if(A=H.to+1,A>=L)break}return T.length==0&&D(M,C==null,I,w==null,t.textDirection),{top:E,bottom:k,horizontal:T}}function b(C,w){let S=l.top+(w?C.top:C.bottom);return{top:S,bottom:S,horizontal:[]}}}function Z4(t,e){return t.constructor==e.constructor&&t.eq(e)}var Rm=class{constructor(e,n){this.view=e,this.layer=n,this.drawn=[],this.measureReq={read:this.measure.bind(this),write:this.draw.bind(this)},this.dom=e.scrollDOM.appendChild(document.createElement("div")),this.dom.classList.add("cm-layer"),n.above&&this.dom.classList.add("cm-layer-above"),n.class&&this.dom.classList.add(n.class),this.dom.setAttribute("aria-hidden","true"),this.setOrder(e.state),e.requestMeasure(this.measureReq),n.mount&&n.mount(this.dom,e)}update(e){e.startState.facet(xc)!=e.state.facet(xc)&&this.setOrder(e.state),(this.layer.update(e,this.dom)||e.geometryChanged)&&e.view.requestMeasure(this.measureReq)}setOrder(e){let n=0,r=e.facet(xc);for(;n<r.length&&r[n]!=this.layer;)n++;this.dom.style.zIndex=String((this.layer.above?150:-1)-n)}measure(){return this.layer.markers(this.view)}draw(e){if(e.length!=this.drawn.length||e.some((n,r)=>!Z4(n,this.drawn[r]))){let n=this.dom.firstChild,r=0;for(let o of e)o.update&&n&&o.constructor&&this.drawn[r].constructor&&o.update(n,this.drawn[r])?(n=n.nextSibling,r++):this.dom.insertBefore(o.draw(),n);for(;n;){let o=n.nextSibling;n.remove(),n=o}this.drawn=e}}destroy(){this.layer.destroy&&this.layer.destroy(this.dom,this.view),this.dom.remove()}},xc=ne.define();function jC(t){return[Yn.define(e=>new Rm(e,t)),xc.of(t)]}var qC=!Q.ios,Sl=ne.define({combine(t){return wo(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function Wm(t={}){return[Sl.of(t),Y4,Q4,X4,SC.of(!0)]}function GC(t){return t.startState.facet(Sl)!=t.state.facet(Sl)}var Y4=jC({above:!0,markers(t){let{state:e}=t,n=e.facet(Sl),r=[];for(let o of e.selection.ranges){let i=o==e.selection.main;if(o.empty?!i||qC:n.drawRangeCursor){let s=i?"cm-cursor cm-cursor-primary":"cm-cursor cm-cursor-secondary",l=o.empty?o:$.cursor(o.head,o.head>o.anchor?-1:1);for(let a of wl.forRange(t,s,l))r.push(a)}}return r},update(t,e){t.transactions.some(r=>r.selection)&&(e.style.animationName=e.style.animationName=="cm-blink"?"cm-blink2":"cm-blink");let n=GC(t);return n&&tC(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){tC(e.state,t)},class:"cm-cursorLayer"});function tC(t,e){e.style.animationDuration=t.facet(Sl).cursorBlinkRate+"ms"}var Q4=jC({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:wl.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||GC(t)},class:"cm-selectionLayer"}),JC={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};qC&&(JC[".cm-line"].caretColor="transparent !important");var X4=xo.highest(ie.theme(JC));function nC(t,e,n,r,o){e.lastIndex=0;for(let i=t.iterRange(n,r),s=n,l;!i.next().done;s+=i.value.length)if(!i.lineBreak)for(;l=e.exec(i.value);)o(s+l.index,l)}function e5(t,e){let n=t.visibleRanges;if(n.length==1&&n[0].from==t.viewport.from&&n[0].to==t.viewport.to)return n;let r=[];for(let{from:o,to:i}of n)o=Math.max(t.state.doc.lineAt(o).from,o-e),i=Math.min(t.state.doc.lineAt(i).to,i+e),r.length&&r[r.length-1].to>=o?r[r.length-1].to=i:r.push({from:o,to:i});return r}var Om=class{constructor(e){let{regexp:n,decoration:r,decorate:o,boundary:i,maxLength:s=1e3}=e;if(!n.global)throw new RangeError("The regular expression given to MatchDecorator should have its 'g' flag set");if(this.regexp=n,o)this.addMatch=(l,a,u,c)=>o(c,u,u+l[0].length,l,a);else if(typeof r=="function")this.addMatch=(l,a,u,c)=>{let f=r(l,a,u);f&&c(u,u+l[0].length,f)};else if(r)this.addMatch=(l,a,u,c)=>c(u,u+l[0].length,r);else throw new RangeError("Either 'decorate' or 'decoration' should be provided to MatchDecorator");this.boundary=i,this.maxLength=s}createDeco(e){let n=new Er,r=n.add.bind(n);for(let{from:o,to:i}of e5(e,this.maxLength))nC(e.state.doc,this.regexp,o,i,(s,l)=>this.addMatch(l,e,s,r));return n.finish()}updateDeco(e,n){let r=1e9,o=-1;return e.docChanged&&e.changes.iterChanges((i,s,l,a)=>{a>e.view.viewport.from&&l<e.view.viewport.to&&(r=Math.min(l,r),o=Math.max(a,o))}),e.viewportChanged||o-r>1e3?this.createDeco(e.view):o>-1?this.updateRange(e.view,n.map(e.changes),r,o):n}updateRange(e,n,r,o){for(let i of e.visibleRanges){let s=Math.max(i.from,r),l=Math.min(i.to,o);if(l>s){let a=e.state.doc.lineAt(s),u=a.to<l?e.state.doc.lineAt(l):a,c=Math.max(i.from,a.from),f=Math.min(i.to,u.to);if(this.boundary){for(;s>a.from;s--)if(this.boundary.test(a.text[s-1-a.from])){c=s;break}for(;l<u.to;l++)if(this.boundary.test(u.text[l-u.from])){f=l;break}}let d=[],h,g=(v,p,m)=>d.push(m.range(v,p));if(a==u)for(this.regexp.lastIndex=c-a.from;(h=this.regexp.exec(a.text))&&h.index<f-a.from;)this.addMatch(h,e,h.index+a.from,g);else nC(e.state.doc,this.regexp,c,f,(v,p)=>this.addMatch(p,e,v,g));n=n.update({filterFrom:c,filterTo:f,filter:(v,p)=>v<c||p>f,add:d})}}return n}},Hm=/x/.unicode!=null?"gu":"g",t5=new RegExp(`[\0-\b
|
|
417
|
-
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Hm),n5={0:"null",7:"bell",8:"backspace",10:"newline",11:"vertical tab",13:"carriage return",27:"escape",8203:"zero width space",8204:"zero width non-joiner",8205:"zero width joiner",8206:"left-to-right mark",8207:"right-to-left mark",8232:"line separator",8237:"left-to-right override",8238:"right-to-left override",8294:"left-to-right isolate",8295:"right-to-left isolate",8297:"pop directional isolate",8233:"paragraph separator",65279:"zero width no-break space",65532:"object replacement"},nm=null;function r5(){var t;if(nm==null&&typeof document<"u"&&document.body){let e=document.body.style;nm=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return nm||!1}var wc=ne.define({combine(t){let e=wo(t,{render:null,specialChars:t5,addSpecialChars:null});return(e.replaceTabs=!r5())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Hm)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Hm)),e}});function Km(t={}){return[wc.of(t),o5()]}var rC=null;function o5(){return rC||(rC=Yn.fromClass(class{constructor(t){this.view=t,this.decorations=_e.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(wc)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Om({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:o}=n.state,i=Mn(e[0],0);if(i==9){let s=o.lineAt(r),l=n.state.tabSize,a=So(s.text,l,r-s.from);return _e.replace({widget:new Fm((l-a%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[i]||(this.decorationCache[i]=_e.replace({widget:new Nm(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(wc);t.startState.facet(wc)!=e?(this.decorator=this.makeDecorator(e),this.decorations=this.decorator.createDeco(t.view)):this.decorations=this.decorator.updateDeco(t,this.decorations)}},{decorations:t=>t.decorations}))}var i5="\u2022";function s5(t){return t>=32?i5:t==10?"\u2424":String.fromCharCode(9216+t)}var Nm=class extends Zn{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=s5(this.code),r=e.state.phrase("Control character")+" "+(n5[this.code]||"0x"+this.code.toString(16)),o=this.options.render&&this.options.render(this.code,r,n);if(o)return o;let i=document.createElement("span");return i.textContent=n,i.title=r,i.setAttribute("aria-label",r),i.className="cm-specialChar",i}ignoreEvent(){return!1}},Fm=class extends Zn{constructor(e){super(),this.width=e}eq(e){return e.width==this.width}toDOM(){let e=document.createElement("span");return e.textContent=" ",e.className="cm-tab",e.style.width=this.width+"px",e}ignoreEvent(){return!1}};var jQ=ie.baseTheme({".cm-tooltip":{zIndex:100,boxSizing:"border-box"},"&light .cm-tooltip":{border:"1px solid #bbb",backgroundColor:"#f5f5f5"},"&light .cm-tooltip-section:not(:first-child)":{borderTop:"1px solid #bbb"},"&dark .cm-tooltip":{backgroundColor:"#333338",color:"white"},".cm-tooltip-arrow":{height:"7px",width:`${7*2}px`,position:"absolute",zIndex:-1,overflow:"hidden","&:before, &:after":{content:"''",position:"absolute",width:0,height:0,borderLeft:"7px solid transparent",borderRight:"7px solid transparent"},".cm-tooltip-above &":{bottom:"-7px","&:before":{borderTop:"7px solid #bbb"},"&:after":{borderTop:"7px solid #f5f5f5",bottom:"1px"}},".cm-tooltip-below &":{top:"-7px","&:before":{borderBottom:"7px solid #bbb"},"&:after":{borderBottom:"7px solid #f5f5f5",top:"1px"}}},"&dark .cm-tooltip .cm-tooltip-arrow":{"&:before":{borderTopColor:"#333338",borderBottomColor:"#333338"},"&:after":{borderTopColor:"transparent",borderBottomColor:"transparent"}}});var Qn=class extends cn{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Qn.prototype.elementClass="";Qn.prototype.toDOM=void 0;Qn.prototype.mapMode=at.TrackBefore;Qn.prototype.startSide=Qn.prototype.endSide=-1;Qn.prototype.point=!0;var l5=0,Cl=class{constructor(e,n){this.from=e,this.to=n}},ae=class{constructor(e={}){this.id=l5++,this.perNode=!!e.perNode,this.deserialize=e.deserialize||(()=>{throw new Error("This node type doesn't define a deserialize function")})}add(e){if(this.perNode)throw new RangeError("Can't add per-node props to node types");return typeof e!="function"&&(e=Vt.match(e)),n=>{let r=e(n);return r===void 0?null:[this,r]}}};ae.closedBy=new ae({deserialize:t=>t.split(" ")});ae.openedBy=new ae({deserialize:t=>t.split(" ")});ae.group=new ae({deserialize:t=>t.split(" ")});ae.contextHash=new ae({perNode:!0});ae.lookAhead=new ae({perNode:!0});ae.mounted=new ae({perNode:!0});var a5=Object.create(null),Vt=class t{constructor(e,n,r,o=0){this.name=e,this.props=n,this.id=r,this.flags=o}static define(e){let n=e.props&&e.props.length?Object.create(null):a5,r=(e.top?1:0)|(e.skipped?2:0)|(e.error?4:0)|(e.name==null?8:0),o=new t(e.name||"",n,e.id,r);if(e.props){for(let i of e.props)if(Array.isArray(i)||(i=i(o)),i){if(i[0].perNode)throw new RangeError("Can't store a per-node prop on a node type");n[i[0].id]=i[1]}}return o}prop(e){return this.props[e.id]}get isTop(){return(this.flags&1)>0}get isSkipped(){return(this.flags&2)>0}get isError(){return(this.flags&4)>0}get isAnonymous(){return(this.flags&8)>0}is(e){if(typeof e=="string"){if(this.name==e)return!0;let n=this.prop(ae.group);return n?n.indexOf(e)>-1:!1}return this.id==e}static match(e){let n=Object.create(null);for(let r in e)for(let o of r.split(" "))n[o]=e[r];return r=>{for(let o=r.prop(ae.group),i=-1;i<(o?o.length:0);i++){let s=n[i<0?r.name:o[i]];if(s)return s}}}};Vt.none=new Vt("",Object.create(null),0,8);var Vc=new WeakMap,ZC=new WeakMap,Ge;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(Ge||(Ge={}));var Xe=class t{constructor(e,n,r,o,i){if(this.type=e,this.children=n,this.positions=r,this.length=o,this.props=null,i&&i.length){this.props=Object.create(null);for(let[s,l]of i)this.props[typeof s=="number"?s:s.id]=l}}toString(){let e=this.prop(ae.mounted);if(e&&!e.overlay)return e.tree.toString();let n="";for(let r of this.children){let o=r.toString();o&&(n&&(n+=","),n+=o)}return this.type.name?(/\W/.test(this.type.name)&&!this.type.isError?JSON.stringify(this.type.name):this.type.name)+(n.length?"("+n+")":""):n}cursor(e=0){return new Hi(this.topNode,e)}cursorAt(e,n=0,r=0){let o=Vc.get(this)||this.topNode,i=new Hi(o);return i.moveTo(e,n),Vc.set(this,i._tree),i}get topNode(){return new Eo(this,0,0,null)}resolve(e,n=0){let r=Oi(Vc.get(this)||this.topNode,e,n,!1);return Vc.set(this,r),r}resolveInner(e,n=0){let r=Oi(ZC.get(this)||this.topNode,e,n,!0);return ZC.set(this,r),r}iterate(e){let{enter:n,leave:r,from:o=0,to:i=this.length}=e,s=e.mode||0,l=(s&Ge.IncludeAnonymous)>0;for(let a=this.cursor(s|Ge.IncludeAnonymous);;){let u=!1;if(a.from<=i&&a.to>=o&&(!l&&a.type.isAnonymous||n(a)!==!1)){if(a.firstChild())continue;u=!0}for(;u&&r&&(l||!a.type.isAnonymous)&&r(a),!a.nextSibling();){if(!a.parent())return;u=!0}}}prop(e){return e.perNode?this.props?this.props[e.id]:void 0:this.type.prop(e)}get propValues(){let e=[];if(this.props)for(let n in this.props)e.push([+n,this.props[n]]);return e}balance(e={}){return this.children.length<=8?this:Jm(Vt.none,this.children,this.positions,0,this.children.length,0,this.length,(n,r,o)=>new t(this.type,n,r,o,this.propValues),e.makeTree||((n,r,o)=>new t(Vt.none,n,r,o)))}static build(e){return u5(e)}};Xe.empty=new Xe(Vt.none,[],[],0);var Um=class t{constructor(e,n){this.buffer=e,this.index=n}get id(){return this.buffer[this.index-4]}get start(){return this.buffer[this.index-3]}get end(){return this.buffer[this.index-2]}get size(){return this.buffer[this.index-1]}get pos(){return this.index}next(){this.index-=4}fork(){return new t(this.buffer,this.index)}},ko=class t{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return Vt.none}toString(){let e=[];for(let n=0;n<this.buffer.length;)e.push(this.childString(n)),n=this.buffer[n+3];return e.join(",")}childString(e){let n=this.buffer[e],r=this.buffer[e+3],o=this.set.types[n],i=o.name;if(/\W/.test(i)&&!o.isError&&(i=JSON.stringify(i)),e+=4,r==e)return i;let s=[];for(;e<r;)s.push(this.childString(e)),e=this.buffer[e+3];return i+"("+s.join(",")+")"}findChild(e,n,r,o,i){let{buffer:s}=this,l=-1;for(let a=e;a!=n&&!(QC(i,o,s[a+1],s[a+2])&&(l=a,r>0));a=s[a+3]);return l}slice(e,n,r){let o=this.buffer,i=new Uint16Array(n-e),s=0;for(let l=e,a=0;l<n;){i[a++]=o[l++],i[a++]=o[l++]-r;let u=i[a++]=o[l++]-r;i[a++]=o[l++]-e,s=Math.max(s,u)}return new t(i,s,this.set)}};function QC(t,e,n,r){switch(t){case-2:return n<e;case-1:return r>=e&&n<e;case 0:return n<e&&r>e;case 1:return n<=e&&r>e;case 2:return r>e;case 4:return!0}}function XC(t,e){let n=t.childBefore(e);for(;n;){let r=n.lastChild;if(!r||r.to!=n.to)break;r.type.isError&&r.from==r.to?(t=n,n=r.prevSibling):n=r}return t}function Oi(t,e,n,r){for(var o;t.from==t.to||(n<1?t.from>=e:t.from>e)||(n>-1?t.to<=e:t.to<e);){let s=!r&&t instanceof Eo&&t.index<0?null:t.parent;if(!s)return t;t=s}let i=r?0:Ge.IgnoreOverlays;if(r)for(let s=t,l=s.parent;l;s=l,l=s.parent)s instanceof Eo&&s.index<0&&((o=l.enter(e,n,i))===null||o===void 0?void 0:o.from)!=s.from&&(t=l);for(;;){let s=t.enter(e,n,i);if(!s)return t;t=s}}var Eo=class t{constructor(e,n,r,o){this._tree=e,this.from=n,this.index=r,this._parent=o}get type(){return this._tree.type}get name(){return this._tree.type.name}get to(){return this.from+this._tree.length}nextChild(e,n,r,o,i=0){for(let s=this;;){for(let{children:l,positions:a}=s._tree,u=n>0?l.length:-1;e!=u;e+=n){let c=l[e],f=a[e]+s.from;if(QC(o,r,f,f+c.length)){if(c instanceof ko){if(i&Ge.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,n,r-f,o);if(d>-1)return new kl(new jm(s,c,e,f),null,d)}else if(i&Ge.IncludeAnonymous||!c.type.isAnonymous||Gm(c)){let d;if(!(i&Ge.IgnoreMounts)&&c.props&&(d=c.prop(ae.mounted))&&!d.overlay)return new t(d.tree,f,e,s);let h=new t(c,f,e,s);return i&Ge.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(n<0?c.children.length-1:0,n,r,o)}}}if(i&Ge.IncludeAnonymous||!s.type.isAnonymous||(s.index>=0?e=s.index+n:e=n<0?-1:s._parent._tree.children.length,s=s._parent,!s))return null}}get firstChild(){return this.nextChild(0,1,0,4)}get lastChild(){return this.nextChild(this._tree.children.length-1,-1,0,4)}childAfter(e){return this.nextChild(0,1,e,2)}childBefore(e){return this.nextChild(this._tree.children.length-1,-1,e,-2)}enter(e,n,r=0){let o;if(!(r&Ge.IgnoreOverlays)&&(o=this._tree.prop(ae.mounted))&&o.overlay){let i=e-this.from;for(let{from:s,to:l}of o.overlay)if((n>0?s<=i:s<i)&&(n<0?l>=i:l>i))return new t(o.tree,o.overlay[0].from+this.from,-1,this)}return this.nextChild(0,1,e,n,r)}nextSignificantParent(){let e=this;for(;e.type.isAnonymous&&e._parent;)e=e._parent;return e}get parent(){return this._parent?this._parent.nextSignificantParent():null}get nextSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index+1,1,0,4):null}get prevSibling(){return this._parent&&this.index>=0?this._parent.nextChild(this.index-1,-1,0,4):null}cursor(e=0){return new Hi(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,n=0){return Oi(this,e,n,!1)}resolveInner(e,n=0){return Oi(this,e,n,!0)}enterUnfinishedNodesBefore(e){return XC(this,e)}getChild(e,n=null,r=null){let o=$c(this,e,n,r);return o.length?o[0]:null}getChildren(e,n=null,r=null){return $c(this,e,n,r)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return _c(this,e)}};function $c(t,e,n,r){let o=t.cursor(),i=[];if(!o.firstChild())return i;if(n!=null){for(;!o.type.is(n);)if(!o.nextSibling())return i}for(;;){if(r!=null&&o.type.is(r))return i;if(o.type.is(e)&&i.push(o.node),!o.nextSibling())return r==null?i:[]}}function _c(t,e,n=e.length-1){for(let r=t.parent;n>=0;r=r.parent){if(!r)return!1;if(!r.type.isAnonymous){if(e[n]&&e[n]!=r.name)return!1;n--}}return!0}var jm=class{constructor(e,n,r,o){this.parent=e,this.buffer=n,this.index=r,this.start=o}},kl=class t{get name(){return this.type.name}get from(){return this.context.start+this.context.buffer.buffer[this.index+1]}get to(){return this.context.start+this.context.buffer.buffer[this.index+2]}constructor(e,n,r){this.context=e,this._parent=n,this.index=r,this.type=e.buffer.set.types[e.buffer.buffer[r]]}child(e,n,r){let{buffer:o}=this.context,i=o.findChild(this.index+4,o.buffer[this.index+3],e,n-this.context.start,r);return i<0?null:new t(this.context,this,i)}get firstChild(){return this.child(1,0,4)}get lastChild(){return this.child(-1,0,4)}childAfter(e){return this.child(1,e,2)}childBefore(e){return this.child(-1,e,-2)}enter(e,n,r=0){if(r&Ge.ExcludeBuffers)return null;let{buffer:o}=this.context,i=o.findChild(this.index+4,o.buffer[this.index+3],n>0?1:-1,e-this.context.start,n);return i<0?null:new t(this.context,this,i)}get parent(){return this._parent||this.context.parent.nextSignificantParent()}externalSibling(e){return this._parent?null:this.context.parent.nextChild(this.context.index+e,e,0,4)}get nextSibling(){let{buffer:e}=this.context,n=e.buffer[this.index+3];return n<(this._parent?e.buffer[this._parent.index+3]:e.buffer.length)?new t(this.context,this._parent,n):this.externalSibling(1)}get prevSibling(){let{buffer:e}=this.context,n=this._parent?this._parent.index+4:0;return this.index==n?this.externalSibling(-1):new t(this.context,this._parent,e.findChild(n,this.index,-1,0,4))}cursor(e=0){return new Hi(this,e)}get tree(){return null}toTree(){let e=[],n=[],{buffer:r}=this.context,o=this.index+4,i=r.buffer[this.index+3];if(i>o){let s=r.buffer[this.index+1];e.push(r.slice(o,i,s)),n.push(0)}return new Xe(this.type,e,n,this.to-this.from)}resolve(e,n=0){return Oi(this,e,n,!1)}resolveInner(e,n=0){return Oi(this,e,n,!0)}enterUnfinishedNodesBefore(e){return XC(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,n=null,r=null){let o=$c(this,e,n,r);return o.length?o[0]:null}getChildren(e,n=null,r=null){return $c(this,e,n,r)}get node(){return this}matchContext(e){return _c(this,e)}},Hi=class{get name(){return this.type.name}constructor(e,n=0){if(this.mode=n,this.buffer=null,this.stack=[],this.index=0,this.bufferNode=null,e instanceof Eo)this.yieldNode(e);else{this._tree=e.context.parent,this.buffer=e.context;for(let r=e._parent;r;r=r._parent)this.stack.unshift(r.index);this.bufferNode=e,this.yieldBuf(e.index)}}yieldNode(e){return e?(this._tree=e,this.type=e.type,this.from=e.from,this.to=e.to,!0):!1}yieldBuf(e,n){this.index=e;let{start:r,buffer:o}=this.buffer;return this.type=n||o.set.types[o.buffer[e]],this.from=r+o.buffer[e+1],this.to=r+o.buffer[e+2],!0}yield(e){return e?e instanceof Eo?(this.buffer=null,this.yieldNode(e)):(this.buffer=e.context,this.yieldBuf(e.index,e.type)):!1}toString(){return this.buffer?this.buffer.buffer.childString(this.index):this._tree.toString()}enterChild(e,n,r){if(!this.buffer)return this.yield(this._tree.nextChild(e<0?this._tree._tree.children.length-1:0,e,n,r,this.mode));let{buffer:o}=this.buffer,i=o.findChild(this.index+4,o.buffer[this.index+3],e,n-this.buffer.start,r);return i<0?!1:(this.stack.push(this.index),this.yieldBuf(i))}firstChild(){return this.enterChild(1,0,4)}lastChild(){return this.enterChild(-1,0,4)}childAfter(e){return this.enterChild(1,e,2)}childBefore(e){return this.enterChild(-1,e,-2)}enter(e,n,r=this.mode){return this.buffer?r&Ge.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&Ge.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&Ge.IncludeAnonymous?this.buffer.parent:this.buffer.parent.nextSignificantParent();return this.buffer=null,this.yieldNode(e)}sibling(e){if(!this.buffer)return this._tree._parent?this.yield(this._tree.index<0?null:this._tree._parent.nextChild(this._tree.index+e,e,0,4,this.mode)):!1;let{buffer:n}=this.buffer,r=this.stack.length-1;if(e<0){let o=r<0?0:this.stack[r]+4;if(this.index!=o)return this.yieldBuf(n.findChild(o,this.index,-1,0,4))}else{let o=n.buffer[this.index+3];if(o<(r<0?n.buffer.length:n.buffer[this.stack[r]+3]))return this.yieldBuf(o)}return r<0?this.yield(this.buffer.parent.nextChild(this.buffer.index+e,e,0,4,this.mode)):!1}nextSibling(){return this.sibling(1)}prevSibling(){return this.sibling(-1)}atLastNode(e){let n,r,{buffer:o}=this;if(o){if(e>0){if(this.index<o.buffer.buffer.length)return!1}else for(let i=0;i<this.index;i++)if(o.buffer.buffer[i+3]<this.index)return!1;({index:n,parent:r}=o)}else({index:n,_parent:r}=this._tree);for(;r;{index:n,_parent:r}=r)if(n>-1)for(let i=n+e,s=e<0?-1:r._tree.children.length;i!=s;i+=e){let l=r._tree.children[i];if(this.mode&Ge.IncludeAnonymous||l instanceof ko||!l.type.isAnonymous||Gm(l))return!1}return!0}move(e,n){if(n&&this.enterChild(e,0,4))return!0;for(;;){if(this.sibling(e))return!0;if(this.atLastNode(e)||!this.parent())return!1}}next(e=!0){return this.move(1,e)}prev(e=!0){return this.move(-1,e)}moveTo(e,n=0){for(;(this.from==this.to||(n<1?this.from>=e:this.from>e)||(n>-1?this.to<=e:this.to<e))&&this.parent(););for(;this.enterChild(1,e,n););return this}get node(){if(!this.buffer)return this._tree;let e=this.bufferNode,n=null,r=0;if(e&&e.context==this.buffer)e:for(let o=this.index,i=this.stack.length;i>=0;){for(let s=e;s;s=s._parent)if(s.index==o){if(o==this.index)return s;n=s,r=i+1;break e}o=this.stack[--i]}for(let o=r;o<this.stack.length;o++)n=new kl(this.buffer,n,this.stack[o]);return this.bufferNode=new kl(this.buffer,n,this.index)}get tree(){return this.buffer?null:this._tree._tree}iterate(e,n){for(let r=0;;){let o=!1;if(this.type.isAnonymous||e(this)!==!1){if(this.firstChild()){r++;continue}this.type.isAnonymous||(o=!0)}for(;o&&n&&n(this),o=this.type.isAnonymous,!this.nextSibling();){if(!r)return;this.parent(),r--,o=!0}}}matchContext(e){if(!this.buffer)return _c(this.node,e);let{buffer:n}=this.buffer,{types:r}=n.set;for(let o=e.length-1,i=this.stack.length-1;o>=0;i--){if(i<0)return _c(this.node,e,o);let s=r[n.buffer[this.stack[i]]];if(!s.isAnonymous){if(e[o]&&e[o]!=s.name)return!1;o--}}return!0}};function Gm(t){return t.children.some(e=>e instanceof ko||!e.type.isAnonymous||Gm(e))}function u5(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:o=1024,reused:i=[],minRepeatType:s=r.types.length}=t,l=Array.isArray(n)?new Um(n,n.length):n,a=r.types,u=0,c=0;function f(b,C,w,S,E){let{id:k,start:T,end:D,size:M}=l,I=c;for(;M<0;)if(l.next(),M==-1){let O=i[k];w.push(O),S.push(T-b);return}else if(M==-3){u=k;return}else if(M==-4){c=k;return}else throw new RangeError(`Unrecognized record size: ${M}`);let R=a[k],A,L,H=T-b;if(D-T<=o&&(L=v(l.pos-C,E))){let O=new Uint16Array(L.size-L.skip),B=l.pos-L.size,P=O.length;for(;l.pos>B;)P=p(L.start,O,P);A=new ko(O,D-L.start,r),H=L.start-b}else{let O=l.pos-M;l.next();let B=[],P=[],F=k>=s?k:-1,N=0,z=D;for(;l.pos>O;)F>=0&&l.id==F&&l.size>=0?(l.end<=z-o&&(h(B,P,T,N,l.end,z,F,I),N=B.length,z=l.end),l.next()):f(T,O,B,P,F);if(F>=0&&N>0&&N<B.length&&h(B,P,T,N,T,z,F,I),B.reverse(),P.reverse(),F>-1&&N>0){let q=d(R);A=Jm(R,B,P,0,B.length,0,D-T,q,q)}else A=g(R,B,P,D-T,I-D)}w.push(A),S.push(H)}function d(b){return(C,w,S)=>{let E=0,k=C.length-1,T,D;if(k>=0&&(T=C[k])instanceof Xe){if(!k&&T.type==b&&T.length==S)return T;(D=T.prop(ae.lookAhead))&&(E=w[k]+T.length+D)}return g(b,C,w,S,E)}}function h(b,C,w,S,E,k,T,D){let M=[],I=[];for(;b.length>S;)M.push(b.pop()),I.push(C.pop()+w-E);b.push(g(r.types[T],M,I,k-E,D-k)),C.push(E-w)}function g(b,C,w,S,E=0,k){if(u){let T=[ae.contextHash,u];k=k?[T].concat(k):[T]}if(E>25){let T=[ae.lookAhead,E];k=k?[T].concat(k):[T]}return new Xe(b,C,w,S,k)}function v(b,C){let w=l.fork(),S=0,E=0,k=0,T=w.end-o,D={size:0,start:0,skip:0};e:for(let M=w.pos-b;w.pos>M;){let I=w.size;if(w.id==C&&I>=0){D.size=S,D.start=E,D.skip=k,k+=4,S+=4,w.next();continue}let R=w.pos-I;if(I<0||R<M||w.start<T)break;let A=w.id>=s?4:0,L=w.start;for(w.next();w.pos>R;){if(w.size<0)if(w.size==-3)A+=4;else break e;else w.id>=s&&(A+=4);w.next()}E=L,S+=I,k+=A}return(C<0||S==b)&&(D.size=S,D.start=E,D.skip=k),D.size>4?D:void 0}function p(b,C,w){let{id:S,start:E,end:k,size:T}=l;if(l.next(),T>=0&&S<s){let D=w;if(T>4){let M=l.pos-(T-4);for(;l.pos>M;)w=p(b,C,w)}C[--w]=D,C[--w]=k-b,C[--w]=E-b,C[--w]=S}else T==-3?u=S:T==-4&&(c=S);return w}let m=[],y=[];for(;l.pos>0;)f(t.start||0,t.bufferStart||0,m,y,-1);let x=(e=t.length)!==null&&e!==void 0?e:m.length?y[0]+m[0].length:0;return new Xe(a[t.topID],m.reverse(),y.reverse(),x)}var YC=new WeakMap;function zc(t,e){if(!t.isAnonymous||e instanceof ko||e.type!=t)return 1;let n=YC.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof Xe)){n=1;break}n+=zc(t,r)}YC.set(e,n)}return n}function Jm(t,e,n,r,o,i,s,l,a){let u=0;for(let g=r;g<o;g++)u+=zc(t,e[g]);let c=Math.ceil(u*1.5/8),f=[],d=[];function h(g,v,p,m,y){for(let x=p;x<m;){let b=x,C=v[x],w=zc(t,g[x]);for(x++;x<m;x++){let S=zc(t,g[x]);if(w+S>=c)break;w+=S}if(x==b+1){if(w>c){let S=g[b];h(S.children,S.positions,0,S.children.length,v[b]+y);continue}f.push(g[b])}else{let S=v[x-1]+g[x-1].length-C;f.push(Jm(t,g,v,b,x,C,S,null,a))}d.push(C+y-i)}}return h(e,n,r,o,0),(l||a)(f,d,s)}var Mo=class t{constructor(e,n,r,o,i=!1,s=!1){this.from=e,this.to=n,this.tree=r,this.offset=o,this.open=(i?1:0)|(s?2:0)}get openStart(){return(this.open&1)>0}get openEnd(){return(this.open&2)>0}static addTree(e,n=[],r=!1){let o=[new t(0,e.length,e,0,!1,r)];for(let i of n)i.to>e.length&&o.push(i);return o}static applyChanges(e,n,r=128){if(!n.length)return e;let o=[],i=1,s=e.length?e[0]:null;for(let l=0,a=0,u=0;;l++){let c=l<n.length?n[l]:null,f=c?c.fromA:1e9;if(f-a>=r)for(;s&&s.from<f;){let d=s;if(a>=d.from||f<=d.to||u){let h=Math.max(d.from,a)-u,g=Math.min(d.to,f)-u;d=h>=g?null:new t(h,g,d.tree,d.offset+u,l>0,!!c)}if(d&&o.push(d),s.to>f)break;s=i<e.length?e[i++]:null}if(!c)break;a=c.toA,u=c.toA-c.toB}return o}},Wc=class{startParse(e,n,r){return typeof e=="string"&&(e=new qm(e)),r=r?r.length?r.map(o=>new Cl(o.from,o.to)):[new Cl(0,0)]:[new Cl(0,e.length)],this.createParse(e,n||[],r)}parse(e,n,r){let o=this.startParse(e,n,r);for(;;){let i=o.advance();if(i)return i}}},qm=class{constructor(e){this.string=e}get length(){return this.string.length}chunk(e){return this.string.slice(e)}get lineChunks(){return!1}read(e,n){return this.string.slice(e,n)}};var JQ=new ae({perNode:!0});var c5=0,On=class t{constructor(e,n,r){this.set=e,this.base=n,this.modified=r,this.id=c5++}static define(e){if(e!=null&&e.base)throw new Error("Can not derive from a modified tag");let n=new t([],null,[]);if(n.set.push(n),e)for(let r of e.set)n.set.push(r);return n}static defineModifier(){let e=new qc;return n=>n.modified.indexOf(e)>-1?n:qc.get(n.base||n,n.modified.concat(e).sort((r,o)=>r.id-o.id))}},d5=0,qc=class t{constructor(){this.instances=[],this.id=d5++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&f5(n,l.modified));if(r)return r;let o=[],i=new On(o,e,n);for(let l of n)l.instances.push(i);let s=h5(n);for(let l of e.set)if(!l.modified.length)for(let a of s)o.push(t.get(l,a));return i}};function f5(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function h5(t){let e=[[]];for(let n=0;n<t.length;n++)for(let r=0,o=e.length;r<o;r++)e.push(e[r].concat(t[n]));return e.sort((n,r)=>r.length-n.length)}function Ml(t){let e=Object.create(null);for(let n in t){let r=t[n];Array.isArray(r)||(r=[r]);for(let o of n.split(" "))if(o){let i=[],s=2,l=o;for(let f=0;;){if(l=="..."&&f>0&&f+3==o.length){s=1;break}let d=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(l);if(!d)throw new RangeError("Invalid path: "+o);if(i.push(d[0]=="*"?"":d[0][0]=='"'?JSON.parse(d[0]):d[0]),f+=d[0].length,f==o.length)break;let h=o[f++];if(f==o.length&&h=="!"){s=0;break}if(h!="/")throw new RangeError("Invalid path: "+o);l=o.slice(f)}let a=i.length-1,u=i[a];if(!u)throw new RangeError("Invalid path: "+o);let c=new Ni(r,s,a>0?i.slice(0,a):null);e[u]=c.sort(e[u])}}return nk.add(e)}var nk=new ae,Ni=class{constructor(e,n,r,o){this.tags=e,this.mode=n,this.context=r,this.next=o}get opaque(){return this.mode==0}get inherit(){return this.mode==1}sort(e){return!e||e.depth<this.depth?(this.next=e,this):(e.next=this.sort(e.next),e)}get depth(){return this.context?this.context.length:0}};Ni.empty=new Ni([],2,null);function Xm(t,e){let n=Object.create(null);for(let i of t)if(!Array.isArray(i.tag))n[i.tag.id]=i.class;else for(let s of i.tag)n[s.id]=i.class;let{scope:r,all:o=null}=e||{};return{style:i=>{let s=o;for(let l of i)for(let a of l.set){let u=n[a.id];if(u){s=s?s+" "+u:u;break}}return s},scope:r}}function p5(t,e){let n=null;for(let r of t){let o=r.style(e);o&&(n=n?n+" "+o:o)}return n}function rk(t,e,n,r=0,o=t.length){let i=new Ym(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,o,"",i.highlighters),i.flush(o)}var Ym=class{constructor(e,n,r){this.at=e,this.highlighters=n,this.span=r,this.class=""}startSpan(e,n){n!=this.class&&(this.flush(e),e>this.at&&(this.at=e),this.class=n)}flush(e){e>this.at&&this.class&&this.span(this.at,e,this.class)}highlightRange(e,n,r,o,i){let{type:s,from:l,to:a}=e;if(l>=r||a<=n)return;s.isTop&&(i=this.highlighters.filter(h=>!h.scope||h.scope(s)));let u=o,c=m5(e)||Ni.empty,f=p5(i,c.tags);if(f&&(u&&(u+=" "),u+=f,c.mode==1&&(o+=(o?" ":"")+f)),this.startSpan(Math.max(n,l),u),c.opaque)return;let d=e.tree&&e.tree.prop(ae.mounted);if(d&&d.overlay){let h=e.node.enter(d.overlay[0].from+l,1),g=this.highlighters.filter(p=>!p.scope||p.scope(d.tree.type)),v=e.firstChild();for(let p=0,m=l;;p++){let y=p<d.overlay.length?d.overlay[p]:null,x=y?y.from+l:a,b=Math.max(n,m),C=Math.min(r,x);if(b<C&&v)for(;e.from<C&&(this.highlightRange(e,b,C,o,i),this.startSpan(Math.min(C,e.to),u),!(e.to>=x||!e.nextSibling())););if(!y||x>r)break;m=y.to+l,m>n&&(this.highlightRange(h.cursor(),Math.max(n,y.from+l),Math.min(r,m),"",g),this.startSpan(Math.min(r,m),u))}v&&e.parent()}else if(e.firstChild()){d&&(o="");do if(!(e.to<=n)){if(e.from>=r)break;this.highlightRange(e,n,r,o,i),this.startSpan(Math.min(r,e.to),u)}while(e.nextSibling());e.parent()}}};function m5(t){let e=t.type.prop(nk);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}var K=On.define,Kc=K(),Ar=K(),ek=K(Ar),tk=K(Ar),Rr=K(),Uc=K(Rr),Zm=K(Rr),Rn=K(),To=K(Rn),Dn=K(),An=K(),Qm=K(),El=K(Qm),jc=K(),_={comment:Kc,lineComment:K(Kc),blockComment:K(Kc),docComment:K(Kc),name:Ar,variableName:K(Ar),typeName:ek,tagName:K(ek),propertyName:tk,attributeName:K(tk),className:K(Ar),labelName:K(Ar),namespace:K(Ar),macroName:K(Ar),literal:Rr,string:Uc,docString:K(Uc),character:K(Uc),attributeValue:K(Uc),number:Zm,integer:K(Zm),float:K(Zm),bool:K(Rr),regexp:K(Rr),escape:K(Rr),color:K(Rr),url:K(Rr),keyword:Dn,self:K(Dn),null:K(Dn),atom:K(Dn),unit:K(Dn),modifier:K(Dn),operatorKeyword:K(Dn),controlKeyword:K(Dn),definitionKeyword:K(Dn),moduleKeyword:K(Dn),operator:An,derefOperator:K(An),arithmeticOperator:K(An),logicOperator:K(An),bitwiseOperator:K(An),compareOperator:K(An),updateOperator:K(An),definitionOperator:K(An),typeOperator:K(An),controlOperator:K(An),punctuation:Qm,separator:K(Qm),bracket:El,angleBracket:K(El),squareBracket:K(El),paren:K(El),brace:K(El),content:Rn,heading:To,heading1:K(To),heading2:K(To),heading3:K(To),heading4:K(To),heading5:K(To),heading6:K(To),contentSeparator:K(Rn),list:K(Rn),quote:K(Rn),emphasis:K(Rn),strong:K(Rn),link:K(Rn),monospace:K(Rn),strikethrough:K(Rn),inserted:K(),deleted:K(),changed:K(),invalid:K(),meta:jc,documentMeta:K(jc),annotation:K(jc),processingInstruction:K(jc),definition:On.defineModifier(),constant:On.defineModifier(),function:On.defineModifier(),standard:On.defineModifier(),local:On.defineModifier(),special:On.defineModifier()},QQ=Xm([{tag:_.link,class:"tok-link"},{tag:_.heading,class:"tok-heading"},{tag:_.emphasis,class:"tok-emphasis"},{tag:_.strong,class:"tok-strong"},{tag:_.keyword,class:"tok-keyword"},{tag:_.atom,class:"tok-atom"},{tag:_.bool,class:"tok-bool"},{tag:_.url,class:"tok-url"},{tag:_.labelName,class:"tok-labelName"},{tag:_.inserted,class:"tok-inserted"},{tag:_.deleted,class:"tok-deleted"},{tag:_.literal,class:"tok-literal"},{tag:_.string,class:"tok-string"},{tag:_.number,class:"tok-number"},{tag:[_.regexp,_.escape,_.special(_.string)],class:"tok-string2"},{tag:_.variableName,class:"tok-variableName"},{tag:_.local(_.variableName),class:"tok-variableName tok-local"},{tag:_.definition(_.variableName),class:"tok-variableName tok-definition"},{tag:_.special(_.variableName),class:"tok-variableName2"},{tag:_.definition(_.propertyName),class:"tok-propertyName tok-definition"},{tag:_.typeName,class:"tok-typeName"},{tag:_.namespace,class:"tok-namespace"},{tag:_.className,class:"tok-className"},{tag:_.macroName,class:"tok-macroName"},{tag:_.propertyName,class:"tok-propertyName"},{tag:_.operator,class:"tok-operator"},{tag:_.comment,class:"tok-comment"},{tag:_.meta,class:"tok-meta"},{tag:_.invalid,class:"tok-invalid"},{tag:_.punctuation,class:"tok-punctuation"}]);var eg,Fi=new ae;function g5(t){return ne.define({combine:t?e=>e.concat(t):void 0})}var v5=new ae,zt=class{constructor(e,n,r=[],o=""){this.data=e,this.name=o,ke.prototype.hasOwnProperty("tree")||Object.defineProperty(ke.prototype,"tree",{get(){return ct(this)}}),this.parser=n,this.extension=[Bi.of(this),ke.languageData.of((i,s,l)=>{let a=ok(i,s,l),u=a.type.prop(Fi);if(!u)return[];let c=i.facet(u),f=a.type.prop(v5);if(f){let d=a.resolve(s-a.from,l);for(let h of f)if(h.test(d,i)){let g=i.facet(h.facet);return h.type=="replace"?g:g.concat(c)}}return c})].concat(r)}isActiveAt(e,n,r=-1){return ok(e,n,r).type.prop(Fi)==this.data}findRegions(e){let n=e.facet(Bi);if((n==null?void 0:n.data)==this.data)return[{from:0,to:e.doc.length}];if(!n||!n.allowsNesting)return[];let r=[],o=(i,s)=>{if(i.prop(Fi)==this.data){r.push({from:s,to:s+i.length});return}let l=i.prop(ae.mounted);if(l){if(l.tree.prop(Fi)==this.data){if(l.overlay)for(let a of l.overlay)r.push({from:a.from+s,to:a.to+s});else r.push({from:s,to:s+i.length});return}else if(l.overlay){let a=r.length;if(o(l.tree,l.overlay[0].from+s),r.length>a)return}}for(let a=0;a<i.children.length;a++){let u=i.children[a];u instanceof Xe&&o(u,i.positions[a]+s)}};return o(ct(e),0),r}get allowsNesting(){return!0}};zt.setState=Se.define();function ok(t,e,n){let r=t.facet(Bi),o=ct(t).topNode;if(!r||r.allowsNesting)for(let i=o;i;i=i.enter(e,n,Ge.ExcludeBuffers))i.type.isTop&&(o=i);return o}var Il=class t extends zt{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=g5(e.languageData);return new t(n,e.parser.configure({props:[Fi.add(r=>r.isTop?n:void 0)]}),e.name)}configure(e,n){return new t(this.data,this.parser.configure(e),n||this.name)}get allowsNesting(){return this.parser.hasWrappers()}};function ct(t){let e=t.field(zt.state,!1);return e?e.tree:Xe.empty}var og=class{constructor(e){this.doc=e,this.cursorPos=0,this.string="",this.cursor=e.iter()}get length(){return this.doc.length}syncTo(e){return this.string=this.cursor.next(e-this.cursorPos).value,this.cursorPos=e+this.string.length,this.cursorPos-this.string.length}chunk(e){return this.syncTo(e),this.string}get lineChunks(){return!0}read(e,n){let r=this.cursorPos-this.string.length;return e<r||n>=this.cursorPos?this.doc.sliceString(e,n):this.string.slice(e-r,n-r)}},Tl=null,ig=class t{constructor(e,n,r=[],o,i,s,l,a){this.parser=e,this.state=n,this.fragments=r,this.tree=o,this.treeLen=i,this.viewport=s,this.skipped=l,this.scheduleOn=a,this.parse=null,this.tempSkipped=[]}static create(e,n,r){return new t(e,n,[],Xe.empty,0,r,[],null)}startParse(){return this.parser.startParse(new og(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=Xe.empty&&this.isDone(n!=null?n:this.state.doc.length)?(this.takeTree(),!0):this.withContext(()=>{var r;if(typeof e=="number"){let o=Date.now()+e;e=()=>Date.now()>o}for(this.parse||(this.parse=this.startParse()),n!=null&&(this.parse.stoppedAt==null||this.parse.stoppedAt>n)&&n<this.state.doc.length&&this.parse.stopAt(n);;){let o=this.parse.advance();if(o)if(this.fragments=this.withoutTempSkipped(Mo.addTree(o,this.fragments,this.parse.stoppedAt!=null)),this.treeLen=(r=this.parse.stoppedAt)!==null&&r!==void 0?r:this.state.doc.length,this.tree=o,this.parse=null,this.treeLen<(n!=null?n:this.state.doc.length))this.parse=this.startParse();else return!0;if(e())return!1}})}takeTree(){let e,n;this.parse&&(e=this.parse.parsedPos)>=this.treeLen&&((this.parse.stoppedAt==null||this.parse.stoppedAt>e)&&this.parse.stopAt(e),this.withContext(()=>{for(;!(n=this.parse.advance()););}),this.treeLen=e,this.tree=n,this.fragments=this.withoutTempSkipped(Mo.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Tl;Tl=this;try{return e()}finally{Tl=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=ik(e,n.from,n.to);return e}changes(e,n){let{fragments:r,tree:o,treeLen:i,viewport:s,skipped:l}=this;if(this.takeTree(),!e.empty){let a=[];if(e.iterChangedRanges((u,c,f,d)=>a.push({fromA:u,toA:c,fromB:f,toB:d})),r=Mo.applyChanges(r,a),o=Xe.empty,i=0,s={from:e.mapPos(s.from,-1),to:e.mapPos(s.to,1)},this.skipped.length){l=[];for(let u of this.skipped){let c=e.mapPos(u.from,1),f=e.mapPos(u.to,-1);c<f&&l.push({from:c,to:f})}}}return new t(this.parser,n,r,o,i,s,l,this.scheduleOn)}updateViewport(e){if(this.viewport.from==e.from&&this.viewport.to==e.to)return!1;this.viewport=e;let n=this.skipped.length;for(let r=0;r<this.skipped.length;r++){let{from:o,to:i}=this.skipped[r];o<e.to&&i>e.from&&(this.fragments=ik(this.fragments,o,i),this.skipped.splice(r--,1))}return this.skipped.length>=n?!1:(this.reset(),!0)}reset(){this.parse&&(this.takeTree(),this.parse=null)}skipUntilInView(e,n){this.skipped.push({from:e,to:n})}static getSkippingParser(e){return new class extends Wc{createParse(n,r,o){let i=o[0].from,s=o[o.length-1].to;return{parsedPos:i,advance(){let a=Tl;if(a){for(let u of o)a.tempSkipped.push(u);e&&(a.scheduleOn=a.scheduleOn?Promise.all([a.scheduleOn,e]):e)}return this.parsedPos=s,new Xe(Vt.none,[],[],s-i)},stoppedAt:null,stopAt(){}}}}}isDone(e){e=Math.min(e,this.state.doc.length);let n=this.fragments;return this.treeLen>=e&&n.length&&n[0].from==0&&n[0].to>=e}static get(){return Tl}};function ik(t,e,n){return Mo.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}var Ll=class t{constructor(e){this.context=e,this.tree=e.tree}apply(e){if(!e.docChanged&&this.tree==this.context.tree)return this;let n=this.context.changes(e.changes,e.state),r=this.context.treeLen==e.startState.doc.length?void 0:Math.max(e.changes.mapPos(this.context.treeLen),n.viewport.to);return n.work(20,r)||n.takeTree(),new t(n)}static init(e){let n=Math.min(3e3,e.doc.length),r=ig.create(e.facet(Bi).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new t(r)}};zt.state=Ot.define({create:Ll.init,update(t,e){for(let n of e.effects)if(n.is(zt.setState))return n.value;return e.startState.facet(Bi)!=e.state.facet(Bi)?Ll.init(e.state):t.apply(e)}});var ak=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(ak=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});var tg=typeof navigator<"u"&&(!((eg=navigator.scheduling)===null||eg===void 0)&&eg.isInputPending)?()=>navigator.scheduling.isInputPending():null,y5=Yn.fromClass(class{constructor(e){this.view=e,this.working=null,this.workScheduled=0,this.chunkEnd=-1,this.chunkBudget=-1,this.work=this.work.bind(this),this.scheduleWork()}update(e){let n=this.view.state.field(zt.state).context;(n.updateViewport(e.view.viewport)||this.view.viewport.to>n.treeLen)&&this.scheduleWork(),e.docChanged&&(this.view.hasFocus&&(this.chunkBudget+=50),this.scheduleWork()),this.checkAsyncSchedule(n)}scheduleWork(){if(this.working)return;let{state:e}=this.view,n=e.field(zt.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=ak(this.work))}work(e){this.working=null;let n=Date.now();if(this.chunkEnd<n&&(this.chunkEnd<0||this.view.hasFocus)&&(this.chunkEnd=n+3e4,this.chunkBudget=3e3),this.chunkBudget<=0)return;let{state:r,viewport:{to:o}}=this.view,i=r.field(zt.state);if(i.tree==i.context.tree&&i.context.isDone(o+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!tg?Math.max(25,e.timeRemaining()-5):1e9),l=i.context.treeLen<o&&r.doc.length>o+1e3,a=i.context.work(()=>tg&&tg()||Date.now()>s,o+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:zt.setState.of(new Ll(i.context))})),this.chunkBudget>0&&!(a&&!l)&&this.scheduleWork(),this.checkAsyncSchedule(i.context)}checkAsyncSchedule(e){e.scheduleOn&&(this.workScheduled++,e.scheduleOn.then(()=>this.scheduleWork()).catch(n=>Ln(this.view.state,n)).then(()=>this.workScheduled--),e.scheduleOn=null)}destroy(){this.working&&this.working()}isWorking(){return!!(this.working||this.workScheduled>0)}},{eventHandlers:{focus(){this.scheduleWork()}}}),Bi=ne.define({combine(t){return t.length?t[0]:null},enables:t=>[zt.state,y5,ie.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});var b5=ne.define(),Pl=ne.define({combine:t=>{if(!t.length)return" ";let e=t[0];if(!e||/\S/.test(e)||Array.from(e).some(n=>n!=e[0]))throw new Error("Invalid indent unit: "+JSON.stringify(t[0]));return e}});function Dl(t){let e=t.facet(Pl);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function Al(t,e){let n="",r=t.tabSize,o=t.facet(Pl)[0];if(o==" "){for(;e>=r;)n+=" ",e-=r;o=" "}for(let i=0;i<e;i++)n+=o;return n}function dg(t,e){t instanceof ke&&(t=new Io(t));for(let r of t.state.facet(b5)){let o=r(t,e);if(o!==void 0)return o}let n=ct(t.state);return n?w5(t,n,e):null}var Io=class{constructor(e,n={}){this.state=e,this.options=n,this.unit=Dl(e)}lineAt(e,n=1){let r=this.state.doc.lineAt(e),{simulateBreak:o,simulateDoubleBreak:i}=this.options;return o!=null&&o>=r.from&&o<=r.to?i&&o==e?{text:"",from:e}:(n<0?o<e:o<=e)?{text:r.text.slice(o-r.from),from:o}:{text:r.text.slice(0,o-r.from),from:r.from}:r}textAfterPos(e,n=1){if(this.options.simulateDoubleBreak&&e==this.options.simulateBreak)return"";let{text:r,from:o}=this.lineAt(e,n);return r.slice(e-o,Math.min(r.length,e+100-o))}column(e,n=1){let{text:r,from:o}=this.lineAt(e,n),i=this.countColumn(r,e-o),s=this.options.overrideIndentation?this.options.overrideIndentation(o):-1;return s>-1&&(i+=s-this.countColumn(r,r.search(/\S|$/))),i}countColumn(e,n=e.length){return So(e,this.state.tabSize,n)}lineIndent(e,n=1){let{text:r,from:o}=this.lineAt(e,n),i=this.options.overrideIndentation;if(i){let s=i(o);if(s>-1)return s}return this.countColumn(r,r.search(/\S|$/))}get simulatedBreak(){return this.options.simulateBreak||null}},x5=new ae;function w5(t,e,n){return uk(e.resolveInner(n).enterUnfinishedNodesBefore(n),n,t)}function S5(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function C5(t){let e=t.type.prop(x5);if(e)return e;let n=t.firstChild,r;if(n&&(r=n.type.prop(ae.closedBy))){let o=t.lastChild,i=o&&r.indexOf(o.name)>-1;return s=>T5(s,!0,1,void 0,i&&!S5(s)?o.from:void 0)}return t.parent==null?k5:null}function uk(t,e,n){for(;t;t=t.parent){let r=C5(t);if(r)return r(sg.create(n,e,t))}return null}function k5(){return 0}var sg=class t extends Io{constructor(e,n,r){super(e.state,e.options),this.base=e,this.pos=n,this.node=r}static create(e,n,r){return new t(e,n,r)}get textAfter(){return this.textAfterPos(this.pos)}get baseIndent(){return this.baseIndentFor(this.node)}baseIndentFor(e){let n=this.state.doc.lineAt(e.from);for(;;){let r=e.resolve(n.from);for(;r.parent&&r.parent.from==r.from;)r=r.parent;if(E5(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){let e=this.node.parent;return e?uk(e,this.pos,this.base):0}};function E5(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function M5(t){let e=t.node,n=e.childAfter(e.from),r=e.lastChild;if(!n)return null;let o=t.options.simulateBreak,i=t.state.doc.lineAt(n.from),s=o==null||o<=i.from?i.to:Math.min(i.to,o);for(let l=n.to;;){let a=e.childAfter(l);if(!a||a==r)return null;if(!a.type.isSkipped)return a.from<s?n:null;l=a.to}}function T5(t,e,n,r,o){let i=t.textAfter,s=i.match(/^\s*/)[0].length,l=r&&i.slice(s,s+r.length)==r||o==t.pos+s,a=e?M5(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}var Lo=class t{constructor(e,n){this.specs=e;let r;function o(l){let a=Qt.newName();return(r||(r=Object.create(null)))["."+a]=l,a}let i=typeof n.all=="string"?n.all:n.all?o(n.all):void 0,s=n.scope;this.scope=s instanceof zt?l=>l.prop(Fi)==s.data:s?l=>l==s:void 0,this.style=Xm(e.map(l=>({tag:l.tag,class:l.class||o(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new Qt(r):null,this.themeType=n.themeType}static define(e,n){return new t(e,n||{})}},lg=ne.define(),ck=ne.define({combine(t){return t.length?[t[0]]:null}});function ng(t){let e=t.facet(lg);return e.length?e:t.facet(ck)}function Rl(t,e){let n=[I5],r;return t instanceof Lo&&(t.module&&n.push(ie.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(ck.of(t)):r?n.push(lg.computeN([ie.darkTheme],o=>o.facet(ie.darkTheme)==(r=="dark")?[t]:[])):n.push(lg.of(t)),n}var ag=class{constructor(e){this.markCache=Object.create(null),this.tree=ct(e.state),this.decorations=this.buildDeco(e,ng(e.state))}update(e){let n=ct(e.state),r=ng(e.state),o=r!=ng(e.startState);n.length<e.view.viewport.to&&!o&&n.type==this.tree.type?this.decorations=this.decorations.map(e.changes):(n!=this.tree||e.viewportChanged||o)&&(this.tree=n,this.decorations=this.buildDeco(e.view,r))}buildDeco(e,n){if(!n||!this.tree.length)return _e.none;let r=new Er;for(let{from:o,to:i}of e.visibleRanges)rk(this.tree,n,(s,l,a)=>{r.add(s,l,this.markCache[a]||(this.markCache[a]=_e.mark({class:a})))},o,i);return r.finish()}},I5=xo.high(Yn.fromClass(ag,{decorations:t=>t.decorations})),fg=Lo.define([{tag:_.meta,color:"#404740"},{tag:_.link,textDecoration:"underline"},{tag:_.heading,textDecoration:"underline",fontWeight:"bold"},{tag:_.emphasis,fontStyle:"italic"},{tag:_.strong,fontWeight:"bold"},{tag:_.strikethrough,textDecoration:"line-through"},{tag:_.keyword,color:"#708"},{tag:[_.atom,_.bool,_.url,_.contentSeparator,_.labelName],color:"#219"},{tag:[_.literal,_.inserted],color:"#164"},{tag:[_.string,_.deleted],color:"#a11"},{tag:[_.regexp,_.escape,_.special(_.string)],color:"#e40"},{tag:_.definition(_.variableName),color:"#00f"},{tag:_.local(_.variableName),color:"#30a"},{tag:[_.typeName,_.namespace],color:"#085"},{tag:_.className,color:"#167"},{tag:[_.special(_.variableName),_.macroName],color:"#256"},{tag:_.definition(_.propertyName),color:"#00c"},{tag:_.comment,color:"#940"},{tag:_.invalid,color:"#f00"}]);var L5=1e4,P5="()[]{}";var D5=new ae;function ug(t,e,n){let r=t.prop(e<0?ae.openedBy:ae.closedBy);if(r)return r;if(t.name.length==1){let o=n.indexOf(t.name);if(o>-1&&o%2==(e<0?1:0))return[n[o+e]]}return null}function cg(t){let e=t.type.prop(D5);return e?e(t.node):t}function Po(t,e,n,r={}){let o=r.maxScanDistance||L5,i=r.brackets||P5,s=ct(t),l=s.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=ug(a.type,n,i);if(u&&a.from<a.to){let c=cg(a);if(c&&(n>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return A5(t,e,n,a,c,u,i)}}return R5(t,e,n,s,l.type,o,i)}function A5(t,e,n,r,o,i,s){let l=r.parent,a={from:o.from,to:o.to},u=0,c=l==null?void 0:l.cursor();if(c&&(n<0?c.childBefore(r.from):c.childAfter(r.to)))do if(n<0?c.to<=r.from:c.from>=r.to){if(u==0&&i.indexOf(c.type.name)>-1&&c.from<c.to){let f=cg(c);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(ug(c.type,n,s))u++;else if(ug(c.type,-n,s)){if(u==0){let f=cg(c);return{start:a,end:f&&f.from<f.to?{from:f.from,to:f.to}:void 0,matched:!1}}u--}}while(n<0?c.prevSibling():c.nextSibling());return{start:a,matched:!1}}function R5(t,e,n,r,o,i,s){let l=n<0?t.sliceDoc(e-1,e):t.sliceDoc(e,e+1),a=s.indexOf(l);if(a<0||a%2==0!=n>0)return null;let u={from:n<0?e-1:e,to:n>0?e+1:e},c=t.doc.iterRange(e,n>0?t.doc.length:0),f=0;for(let d=0;!c.next().done&&d<=i;){let h=c.value;n<0&&(d+=h.length);let g=e+d*n;for(let v=n>0?0:h.length-1,p=n>0?h.length:-1;v!=p;v+=n){let m=s.indexOf(h[v]);if(!(m<0||r.resolveInner(g+v,1).type!=o))if(m%2==0==n>0)f++;else{if(f==1)return{start:u,end:{from:g+v,to:g+v+1},matched:m>>1==a>>1};f--}}n>0&&(d+=h.length)}return c.done?{start:u,matched:!1}:null}var O5=Object.create(null),sk=[Vt.none];var lk=[],H5=Object.create(null);for(let[t,e]of[["variable","variableName"],["variable-2","variableName.special"],["string-2","string.special"],["def","variableName.definition"],["tag","tagName"],["attribute","attributeName"],["type","typeName"],["builtin","variableName.standard"],["qualifier","modifier"],["error","invalid"],["header","heading"],["property","propertyName"]])H5[t]=N5(O5,e);function rg(t,e){lk.indexOf(t)>-1||(lk.push(t),console.warn(e))}function N5(t,e){let n=null;for(let i of e.split(".")){let s=t[i]||_[i];s?typeof s=="function"?n?n=s(n):rg(i,`Modifier ${i} used at start of tag`):n?rg(i,`Tag ${i} used as modifier`):n=s:rg(i,`Unknown highlighting tag ${i}`)}if(!n)return 0;let r=e.replace(/ /g,"_"),o=Vt.define({id:sk.length,name:r,props:[Ml({[r]:n})]});return sk.push(o),o.id}var Gc={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Do=Se.define({map(t,e){let n=e.mapPos(t,-1,at.TrackAfter);return n==null?void 0:n}}),pg=new class extends cn{};pg.startSide=1;pg.endSide=-1;var hk=Ot.define({create(){return Ae.empty},update(t,e){if(e.selection){let n=e.state.doc.lineAt(e.selection.main.head).from,r=e.startState.doc.lineAt(e.startState.selection.main.head).from;n!=e.changes.mapPos(r,-1)&&(t=Ae.empty)}t=t.map(e.changes);for(let n of e.effects)n.is(Do)&&(t=t.update({add:[pg.range(n.value,n.value+1)]}));return t}});function pk(){return[z5,hk]}var hg="()[]{}<>";function F5(t){for(let e=0;e<hg.length;e+=2)if(hg.charCodeAt(e)==t)return hg.charAt(e+1);return aS(t<128?t:t+1)}function B5(t,e){return t.languageDataAt("closeBrackets",e)[0]||Gc}var V5=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),z5=ie.inputHandler.of((t,e,n,r)=>{if((V5?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let o=t.state.selection.main;if(r.length>2||r.length==2&&yo(Mn(r,0))==1||e!=o.from||n!=o.to)return!1;let i=$5(t.state,r);return i?(t.dispatch(i),!0):!1});function $5(t,e){let n=B5(t,t.selection.main.head),r=n.brackets||Gc.brackets;for(let o of r){let i=F5(Mn(o,0));if(e==o)return i==o?K5(t,o,r.indexOf(o+o+o)>-1,n):_5(t,o,i,n.before||Gc.before);if(e==i&&mk(t,t.selection.main.from))return W5(t,o,i)}return null}function mk(t,e){let n=!1;return t.field(hk).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function mg(t,e){let n=t.sliceString(e,e+2);return n.slice(0,yo(Mn(n,0)))}function _5(t,e,n,r){let o=null,i=t.changeByRange(s=>{if(!s.empty)return{changes:[{insert:e,from:s.from},{insert:n,from:s.to}],effects:Do.of(s.to+e.length),range:$.range(s.anchor+e.length,s.head+e.length)};let l=mg(t.doc,s.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:s.head},effects:Do.of(s.head+e.length),range:$.cursor(s.head+e.length)}:{range:o=s}});return o?null:t.update(i,{scrollIntoView:!0,userEvent:"input.type"})}function W5(t,e,n){let r=null,o=t.changeByRange(i=>i.empty&&mg(t.doc,i.head)==n?{changes:{from:i.head,to:i.head+n.length,insert:n},range:$.cursor(i.head+n.length)}:r={range:i});return r?null:t.update(o,{scrollIntoView:!0,userEvent:"input.type"})}function K5(t,e,n,r){let o=r.stringPrefixes||Gc.stringPrefixes,i=null,s=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Do.of(l.to+e.length),range:$.range(l.anchor+e.length,l.head+e.length)};let a=l.head,u=mg(t.doc,a),c;if(u==e){if(dk(t,a))return{changes:{insert:e+e,from:a},effects:Do.of(a+e.length),range:$.cursor(a+e.length)};if(mk(t,a)){let d=n&&t.sliceDoc(a,a+e.length*3)==e+e+e?e+e+e:e;return{changes:{from:a,to:a+d.length,insert:d},range:$.cursor(a+d.length)}}}else{if(n&&t.sliceDoc(a-2*e.length,a)==e+e&&(c=fk(t,a-2*e.length,o))>-1&&dk(t,c))return{changes:{insert:e+e+e+e,from:a},effects:Do.of(a+e.length),range:$.cursor(a+e.length)};if(t.charCategorizer(a)(u)!=vt.Word&&fk(t,a,o)>-1&&!U5(t,a,e,o))return{changes:{insert:e+e,from:a},effects:Do.of(a+e.length),range:$.cursor(a+e.length)}}return{range:i=l}});return i?null:t.update(s,{scrollIntoView:!0,userEvent:"input.type"})}function dk(t,e){let n=ct(t).resolveInner(e+1);return n.parent&&n.from==e}function U5(t,e,n,r){let o=ct(t).resolveInner(e,-1),i=r.reduce((s,l)=>Math.max(s,l.length),0);for(let s=0;s<5;s++){let l=t.sliceDoc(o.from,Math.min(o.to,o.from+n.length+i)),a=l.indexOf(n);if(!a||a>-1&&r.indexOf(l.slice(0,a))>-1){let c=o.firstChild;for(;c&&c.from==o.from&&c.to-c.from>n.length+a;){if(t.sliceDoc(c.to-n.length,c.to)==n)return!1;c=c.firstChild}return!0}let u=o.to==e&&o.parent;if(!u)break;o=u}return!1}function fk(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=vt.Word)return e;for(let o of n){let i=e-o.length;if(t.sliceDoc(i,e)==o&&r(t.sliceDoc(i-1,i))!=vt.Word)return i}return-1}var j5=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Sg(t.state,n.from);return r.line?q5(t):r.block?J5(t):!1};function wg(t,e){return({state:n,dispatch:r})=>{if(n.readOnly)return!1;let o=t(e,n);return o?(r(n.update(o)),!0):!1}}var q5=wg(Q5,0);var G5=wg(Ck,0);var J5=wg((t,e)=>Ck(t,e,Y5(e)),0);function Sg(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}var Ol=50;function Z5(t,{open:e,close:n},r,o){let i=t.sliceDoc(r-Ol,r),s=t.sliceDoc(o,o+Ol),l=/\s*$/.exec(i)[0].length,a=/^\s*/.exec(s)[0].length,u=i.length-l;if(i.slice(u-e.length,u)==e&&s.slice(a,a+n.length)==n)return{open:{pos:r-l,margin:l&&1},close:{pos:o+a,margin:a&&1}};let c,f;o-r<=2*Ol?c=f=t.sliceDoc(r,o):(c=t.sliceDoc(r,r+Ol),f=t.sliceDoc(o-Ol,o));let d=/^\s*/.exec(c)[0].length,h=/\s*$/.exec(f)[0].length,g=f.length-h-n.length;return c.slice(d,d+e.length)==e&&f.slice(g,g+n.length)==n?{open:{pos:r+d+e.length,margin:/\s/.test(c.charAt(d+e.length))?1:0},close:{pos:o-h-n.length,margin:/\s/.test(f.charAt(g-1))?1:0}}:null}function Y5(t){let e=[];for(let n of t.selection.ranges){let r=t.doc.lineAt(n.from),o=n.to<=r.to?r:t.doc.lineAt(n.to),i=e.length-1;i>=0&&e[i].to>r.from?e[i].to=o.to:e.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return e}function Ck(t,e,n=e.selection.ranges){let r=n.map(i=>Sg(e,i.from).block);if(!r.every(i=>i))return null;let o=n.map((i,s)=>Z5(e,r[s],i.from,i.to));if(t!=2&&!o.every(i=>i))return{changes:e.changes(n.map((i,s)=>o[s]?[]:[{from:i.from,insert:r[s].open+" "},{from:i.to,insert:" "+r[s].close}]))};if(t!=1&&o.some(i=>i)){let i=[];for(let s=0,l;s<o.length;s++)if(l=o[s]){let a=r[s],{open:u,close:c}=l;i.push({from:u.pos-a.open.length,to:u.pos+u.margin},{from:c.pos-c.margin,to:c.pos+a.close.length})}return{changes:i}}return null}function Q5(t,e,n=e.selection.ranges){let r=[],o=-1;for(let{from:i,to:s}of n){let l=r.length,a=1e9,u=Sg(e,i).line;if(u){for(let c=i;c<=s;){let f=e.doc.lineAt(c);if(f.from>o&&(i==s||s>f.from)){o=f.from;let d=/^\s*/.exec(f.text)[0].length,h=d==f.length,g=f.text.slice(d,d+u.length)==u?d:-1;d<f.text.length&&d<a&&(a=d),r.push({line:f,comment:g,token:u,indent:d,empty:h,single:!1})}c=f.to+1}if(a<1e9)for(let c=l;c<r.length;c++)r[c].indent<r[c].line.text.length&&(r[c].indent=a);r.length==l+1&&(r[l].single=!0)}}if(t!=2&&r.some(i=>i.comment<0&&(!i.empty||i.single))){let i=[];for(let{line:l,token:a,indent:u,empty:c,single:f}of r)(f||!c)&&i.push({from:l.from+u,insert:a+" "});let s=e.changes(i);return{changes:s,selection:e.selection.map(s,1)}}else if(t!=1&&r.some(i=>i.comment>=0)){let i=[];for(let{line:s,comment:l,token:a}of r)if(l>=0){let u=s.from+l,c=u+a.length;s.text[c-s.from]==" "&&c++,i.push({from:u,to:c})}return{changes:i}}return null}var vg=Ht.define(),X5=Ht.define(),eA=ne.define(),kk=ne.define({combine(t){return wo(t,{minDepth:100,newGroupDelay:500,joinToEvent:(e,n)=>n},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,n)=>(r,o)=>e(r,o)||n(r,o)})}});function tA(t){let e=0;return t.iterChangedRanges((n,r)=>e=r),e}var Ek=Ot.define({create(){return Ao.empty},update(t,e){let n=e.state.facet(kk),r=e.annotation(vg);if(r){let a=e.docChanged?$.single(tA(e.changes)):void 0,u=dn.fromTransaction(e,a),c=r.side,f=c==0?t.undone:t.done;return u?f=Zc(f,f.length,n.minDepth,u):f=Lk(f,e.startState.selection),new Ao(c==0?r.rest:f,c==0?f:r.rest)}let o=e.annotation(X5);if((o=="full"||o=="before")&&(t=t.isolate()),e.annotation(qe.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=dn.fromTransaction(e),s=e.annotation(qe.time),l=e.annotation(qe.userEvent);return i?t=t.addChanges(i,s,l,n,e):e.selection&&(t=t.addSelection(e.startState.selection,s,l,n.newGroupDelay)),(o=="full"||o=="after")&&(t=t.isolate()),t},toJSON(t){return{done:t.done.map(e=>e.toJSON()),undone:t.undone.map(e=>e.toJSON())}},fromJSON(t){return new Ao(t.done.map(dn.fromJSON),t.undone.map(dn.fromJSON))}});function Mk(t={}){return[Ek,kk.of(t),ie.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?Tk:e.inputType=="historyRedo"?yg:null;return r?(e.preventDefault(),r(n)):!1}})]}function Yc(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let o=n.field(Ek,!1);if(!o)return!1;let i=o.pop(t,n,e);return i?(r(i),!0):!1}}var Tk=Yc(0,!1),yg=Yc(1,!1),nA=Yc(0,!0),rA=Yc(1,!0);var dn=class t{constructor(e,n,r,o,i){this.changes=e,this.effects=n,this.mapped=r,this.startSelection=o,this.selectionsAfter=i}setSelAfter(e){return new t(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,n,r;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(n=this.mapped)===null||n===void 0?void 0:n.toJSON(),startSelection:(r=this.startSelection)===null||r===void 0?void 0:r.toJSON(),selectionsAfter:this.selectionsAfter.map(o=>o.toJSON())}}static fromJSON(e){return new t(e.changes&&yt.fromJSON(e.changes),[],e.mapped&&qn.fromJSON(e.mapped),e.startSelection&&$.fromJSON(e.startSelection),e.selectionsAfter.map($.fromJSON))}static fromTransaction(e,n){let r=en;for(let o of e.startState.facet(eA)){let i=o(e);i.length&&(r=r.concat(i))}return!r.length&&e.changes.empty?null:new t(e.changes.invert(e.startState.doc),r,void 0,n||e.startState.selection,en)}static selection(e){return new t(void 0,en,void 0,void 0,e)}};function Zc(t,e,n,r){let o=e+1>n+20?e-n-1:0,i=t.slice(o,e);return i.push(r),i}function oA(t,e){let n=[],r=!1;return t.iterChangedRanges((o,i)=>n.push(o,i)),e.iterChangedRanges((o,i,s,l)=>{for(let a=0;a<n.length;){let u=n[a++],c=n[a++];l>=u&&s<=c&&(r=!0)}}),r}function iA(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function Ik(t,e){return t.length?e.length?t.concat(e):t:e}var en=[],sA=200;function Lk(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-sA));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),Zc(t,t.length-1,1e9,n.setSelAfter(r)))}else return[dn.selection([e])]}function lA(t){let e=t[t.length-1],n=t.slice();return n[t.length-1]=e.setSelAfter(e.selectionsAfter.slice(0,e.selectionsAfter.length-1)),n}function gg(t,e){if(!t.length)return t;let n=t.length,r=en;for(;n;){let o=aA(t[n-1],e,r);if(o.changes&&!o.changes.empty||o.effects.length){let i=t.slice(0,n);return i[n-1]=o,i}else e=o.mapped,n--,r=o.selectionsAfter}return r.length?[dn.selection(r)]:en}function aA(t,e,n){let r=Ik(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):en,n);if(!t.changes)return dn.selection(r);let o=t.changes.map(e),i=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(i):i;return new dn(o,Se.mapEffects(t.effects,e),s,t.startSelection.map(i),r)}var uA=/^(input\.type|delete)($|\.)/,Ao=class t{constructor(e,n,r=0,o=void 0){this.done=e,this.undone=n,this.prevTime=r,this.prevUserEvent=o}isolate(){return this.prevTime?new t(this.done,this.undone):this}addChanges(e,n,r,o,i){let s=this.done,l=s[s.length-1];return l&&l.changes&&!l.changes.empty&&e.changes&&(!r||uA.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<o.newGroupDelay&&o.joinToEvent(i,oA(l.changes,e.changes))||r=="input.type.compose")?s=Zc(s,s.length-1,o.minDepth,new dn(e.changes.compose(l.changes),Ik(e.effects,l.effects),l.mapped,l.startSelection,en)):s=Zc(s,s.length,o.minDepth,e),new t(s,en,n,r)}addSelection(e,n,r,o){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:en;return i.length>0&&n-this.prevTime<o&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&iA(i[i.length-1],e)?this:new t(Lk(this.done,e),this.undone,n,r)}addMapping(e){return new t(gg(this.done,e),gg(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,n,r){let o=e==0?this.done:this.undone;if(o.length==0)return null;let i=o[o.length-1];if(r&&i.selectionsAfter.length)return n.update({selection:i.selectionsAfter[i.selectionsAfter.length-1],annotations:vg.of({side:e,rest:lA(o)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let s=o.length==1?en:o.slice(0,o.length-1);return i.mapped&&(s=gg(s,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:vg.of({side:e,rest:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Ao.empty=new Ao(en,en);var Pk=[{key:"Mod-z",run:Tk,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:yg,preventDefault:!0},{linux:"Ctrl-Shift-z",run:yg,preventDefault:!0},{key:"Mod-u",run:nA,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:rA,preventDefault:!0}];function Vi(t,e){return $.create(t.ranges.map(e),t.mainIndex)}function Hn(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function fn({state:t,dispatch:e},n){let r=Vi(t.selection,n);return r.eq(t.selection)?!1:(e(Hn(t,r)),!0)}function Qc(t,e){return $.cursor(e?t.to:t.from)}function Dk(t,e){return fn(t,n=>n.empty?t.moveByChar(n,e):Qc(n,e))}function dt(t){return t.textDirectionAt(t.state.selection.main.head)==Re.LTR}var Ak=t=>Dk(t,!dt(t)),Rk=t=>Dk(t,dt(t));function Ok(t,e){return fn(t,n=>n.empty?t.moveByGroup(n,e):Qc(n,e))}var cA=t=>Ok(t,!dt(t)),dA=t=>Ok(t,dt(t));function fA(t,e,n){if(e.type.prop(n))return!0;let r=e.to-e.from;return r&&(r>2||/[^\s,.;:]/.test(t.sliceDoc(e.from,e.to)))||e.firstChild}function Xc(t,e,n){let r=ct(t).resolveInner(e.head),o=n?ae.closedBy:ae.openedBy;for(let a=e.head;;){let u=n?r.childAfter(a):r.childBefore(a);if(!u)break;fA(t,u,o)?r=u:a=n?u.to:u.from}let i=r.type.prop(o),s,l;return i&&(s=n?Po(t,r.from,1):Po(t,r.to,-1))&&s.matched?l=n?s.end.to:s.end.from:l=n?r.to:r.from,$.cursor(l,n?-1:1)}var hA=t=>fn(t,e=>Xc(t.state,e,!dt(t))),pA=t=>fn(t,e=>Xc(t.state,e,dt(t)));function Hk(t,e){return fn(t,n=>{if(!n.empty)return Qc(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}var Nk=t=>Hk(t,!1),Fk=t=>Hk(t,!0);function Bk(t){let e=t.scrollDOM.clientHeight<t.scrollDOM.scrollHeight-2,n=0,r=0,o;if(e){for(let i of t.state.facet(ie.scrollMargins)){let s=i(t);s!=null&&s.top&&(n=Math.max(s==null?void 0:s.top,n)),s!=null&&s.bottom&&(r=Math.max(s==null?void 0:s.bottom,r))}o=t.scrollDOM.clientHeight-n-r}else o=(t.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:n,marginBottom:r,selfScroll:e,height:Math.max(t.defaultLineHeight,o-5)}}function Vk(t,e){let n=Bk(t),{state:r}=t,o=Vi(r.selection,s=>s.empty?t.moveVertically(s,e,n.height):Qc(s,e));if(o.eq(r.selection))return!1;let i;if(n.selfScroll){let s=t.coordsAtPos(r.selection.main.head),l=t.scrollDOM.getBoundingClientRect(),a=l.top+n.marginTop,u=l.bottom-n.marginBottom;s&&s.top>a&&s.bottom<u&&(i=ie.scrollIntoView(o.main.head,{y:"start",yMargin:s.top-a}))}return t.dispatch(Hn(r,o),{effects:i}),!0}var gk=t=>Vk(t,!1),bg=t=>Vk(t,!0);function Or(t,e,n){let r=t.lineBlockAt(e.head),o=t.moveToLineBoundary(e,n);if(o.head==e.head&&o.head!=(n?r.to:r.from)&&(o=t.moveToLineBoundary(e,n,!1)),!n&&o.head==r.from&&r.length){let i=/^\s*/.exec(t.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;i&&e.head!=r.from+i&&(o=$.cursor(r.from+i))}return o}var mA=t=>fn(t,e=>Or(t,e,!0)),gA=t=>fn(t,e=>Or(t,e,!1)),vA=t=>fn(t,e=>Or(t,e,!dt(t))),yA=t=>fn(t,e=>Or(t,e,dt(t))),bA=t=>fn(t,e=>$.cursor(t.lineBlockAt(e.head).from,1)),xA=t=>fn(t,e=>$.cursor(t.lineBlockAt(e.head).to,-1));function wA(t,e,n){let r=!1,o=Vi(t.selection,i=>{let s=Po(t,i.head,-1)||Po(t,i.head,1)||i.head>0&&Po(t,i.head-1,1)||i.head<t.doc.length&&Po(t,i.head+1,-1);if(!s||!s.end)return i;r=!0;let l=s.start.from==i.head?s.end.to:s.end.from;return n?$.range(i.anchor,l):$.cursor(l)});return r?(e(Hn(t,o)),!0):!1}var SA=({state:t,dispatch:e})=>wA(t,e,!1);function tn(t,e){let n=Vi(t.state.selection,r=>{let o=e(r);return $.range(r.anchor,o.head,o.goalColumn,o.bidiLevel||void 0)});return n.eq(t.state.selection)?!1:(t.dispatch(Hn(t.state,n)),!0)}function zk(t,e){return tn(t,n=>t.moveByChar(n,e))}var $k=t=>zk(t,!dt(t)),_k=t=>zk(t,dt(t));function Wk(t,e){return tn(t,n=>t.moveByGroup(n,e))}var CA=t=>Wk(t,!dt(t)),kA=t=>Wk(t,dt(t));var EA=t=>tn(t,e=>Xc(t.state,e,!dt(t))),MA=t=>tn(t,e=>Xc(t.state,e,dt(t)));function Kk(t,e){return tn(t,n=>t.moveVertically(n,e))}var Uk=t=>Kk(t,!1),jk=t=>Kk(t,!0);function qk(t,e){return tn(t,n=>t.moveVertically(n,e,Bk(t).height))}var vk=t=>qk(t,!1),yk=t=>qk(t,!0),TA=t=>tn(t,e=>Or(t,e,!0)),IA=t=>tn(t,e=>Or(t,e,!1)),LA=t=>tn(t,e=>Or(t,e,!dt(t))),PA=t=>tn(t,e=>Or(t,e,dt(t))),DA=t=>tn(t,e=>$.cursor(t.lineBlockAt(e.head).from)),AA=t=>tn(t,e=>$.cursor(t.lineBlockAt(e.head).to)),bk=({state:t,dispatch:e})=>(e(Hn(t,{anchor:0})),!0),xk=({state:t,dispatch:e})=>(e(Hn(t,{anchor:t.doc.length})),!0),wk=({state:t,dispatch:e})=>(e(Hn(t,{anchor:t.selection.main.anchor,head:0})),!0),Sk=({state:t,dispatch:e})=>(e(Hn(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),RA=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),OA=({state:t,dispatch:e})=>{let n=td(t).map(({from:r,to:o})=>$.range(r,Math.min(o+1,t.doc.length)));return e(t.update({selection:$.create(n),userEvent:"select"})),!0},HA=({state:t,dispatch:e})=>{let n=Vi(t.selection,r=>{var o;let i=ct(t).resolveInner(r.head,1);for(;!(i.from<r.from&&i.to>=r.to||i.to>r.to&&i.from<=r.from||!(!((o=i.parent)===null||o===void 0)&&o.parent));)i=i.parent;return $.range(i.to,i.from)});return e(Hn(t,n)),!0},NA=({state:t,dispatch:e})=>{let n=t.selection,r=null;return n.ranges.length>1?r=$.create([n.main]):n.main.empty||(r=$.create([$.cursor(n.main.head)])),r?(e(Hn(t,r)),!0):!1};function ed(t,e){if(t.state.readOnly)return!1;let n="delete.selection",{state:r}=t,o=r.changeByRange(i=>{let{from:s,to:l}=i;if(s==l){let a=e(s);a<s?(n="delete.backward",a=Jc(t,a,!1)):a>s&&(n="delete.forward",a=Jc(t,a,!0)),s=Math.min(s,a),l=Math.max(l,a)}else s=Jc(t,s,!1),l=Jc(t,l,!0);return s==l?{range:i}:{changes:{from:s,to:l},range:$.cursor(s)}});return o.changes.empty?!1:(t.dispatch(r.update(o,{scrollIntoView:!0,userEvent:n,effects:n=="delete.selection"?ie.announce.of(r.phrase("Selection deleted")):void 0})),!0)}function Jc(t,e,n){if(t instanceof ie)for(let r of t.state.facet(ie.atomicRanges).map(o=>o(t)))r.between(e,e,(o,i)=>{o<e&&i>e&&(e=n?i:o)});return e}var Gk=(t,e)=>ed(t,n=>{let{state:r}=t,o=r.doc.lineAt(n),i,s;if(!e&&n>o.from&&n<o.from+200&&!/[^ \t]/.test(i=o.text.slice(0,n-o.from))){if(i[i.length-1]==" ")return n-1;let l=So(i,r.tabSize),a=l%Dl(r)||Dl(r);for(let u=0;u<a&&i[i.length-1-u]==" ";u++)n--;s=n}else s=ut(o.text,n-o.from,e,e)+o.from,s==n&&o.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);return s}),xg=t=>Gk(t,!1),Jk=t=>Gk(t,!0),Zk=(t,e)=>ed(t,n=>{let r=n,{state:o}=t,i=o.doc.lineAt(r),s=o.charCategorizer(r);for(let l=null;;){if(r==(e?i.to:i.from)){r==n&&i.number!=(e?o.doc.lines:1)&&(r+=e?1:-1);break}let a=ut(i.text,r-i.from,e)+i.from,u=i.text.slice(Math.min(r,a)-i.from,Math.max(r,a)-i.from),c=s(u);if(l!=null&&c!=l)break;(u!=" "||r!=n)&&(l=c),r=a}return r}),Yk=t=>Zk(t,!1),FA=t=>Zk(t,!0),Qk=t=>ed(t,e=>{let n=t.lineBlockAt(e).to;return e<n?n:Math.min(t.state.doc.length,e+1)}),BA=t=>ed(t,e=>{let n=t.lineBlockAt(e).from;return e>n?n:Math.max(0,e-1)});var VA=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:de.of(["",""])},range:$.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},zA=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>{if(!r.empty||r.from==0||r.from==t.doc.length)return{range:r};let o=r.from,i=t.doc.lineAt(o),s=o==i.from?o-1:ut(i.text,o-i.from,!1)+i.from,l=o==i.to?o+1:ut(i.text,o-i.from,!0)+i.from;return{changes:{from:s,to:l,insert:t.doc.slice(o,l).append(t.doc.slice(s,o))},range:$.cursor(l)}});return n.changes.empty?!1:(e(t.update(n,{scrollIntoView:!0,userEvent:"move.character"})),!0)};function td(t){let e=[],n=-1;for(let r of t.selection.ranges){let o=t.doc.lineAt(r.from),i=t.doc.lineAt(r.to);if(!r.empty&&r.to==i.from&&(i=t.doc.lineAt(r.to-1)),n>=o.number){let s=e[e.length-1];s.to=i.to,s.ranges.push(r)}else e.push({from:o.from,to:i.to,ranges:[r]});n=i.number+1}return e}function Xk(t,e,n){if(t.readOnly)return!1;let r=[],o=[];for(let i of td(t)){if(n?i.to==t.doc.length:i.from==0)continue;let s=t.doc.lineAt(n?i.to+1:i.from-1),l=s.length+1;if(n){r.push({from:i.to,to:s.to},{from:i.from,insert:s.text+t.lineBreak});for(let a of i.ranges)o.push($.range(Math.min(t.doc.length,a.anchor+l),Math.min(t.doc.length,a.head+l)))}else{r.push({from:s.from,to:i.from},{from:i.to,insert:t.lineBreak+s.text});for(let a of i.ranges)o.push($.range(a.anchor-l,a.head-l))}}return r.length?(e(t.update({changes:r,scrollIntoView:!0,selection:$.create(o,t.selection.mainIndex),userEvent:"move.line"})),!0):!1}var $A=({state:t,dispatch:e})=>Xk(t,e,!1),_A=({state:t,dispatch:e})=>Xk(t,e,!0);function eE(t,e,n){if(t.readOnly)return!1;let r=[];for(let o of td(t))n?r.push({from:o.from,insert:t.doc.slice(o.from,o.to)+t.lineBreak}):r.push({from:o.to,insert:t.lineBreak+t.doc.slice(o.from,o.to)});return e(t.update({changes:r,scrollIntoView:!0,userEvent:"input.copyline"})),!0}var WA=({state:t,dispatch:e})=>eE(t,e,!1),KA=({state:t,dispatch:e})=>eE(t,e,!0),UA=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(td(e).map(({from:o,to:i})=>(o>0?o--:i<e.doc.length&&i++,{from:o,to:i}))),r=Vi(e.selection,o=>t.moveVertically(o,!0)).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function jA(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=ct(t).resolveInner(e),r=n.childBefore(e),o=n.childAfter(e),i;return r&&o&&r.to<=e&&o.from>=e&&(i=r.type.prop(ae.closedBy))&&i.indexOf(o.name)>-1&&t.doc.lineAt(r.to).from==t.doc.lineAt(o.from).from?{from:r.to,to:o.from}:null}var qA=tE(!1),GA=tE(!0);function tE(t){return({state:e,dispatch:n})=>{if(e.readOnly)return!1;let r=e.changeByRange(o=>{let{from:i,to:s}=o,l=e.doc.lineAt(i),a=!t&&i==s&&jA(e,i);t&&(i=s=(s<=l.to?l:e.doc.lineAt(s)).to);let u=new Io(e,{simulateBreak:i,simulateDoubleBreak:!!a}),c=dg(u,i);for(c==null&&(c=/^\s*/.exec(e.doc.lineAt(i).text)[0].length);s<l.to&&/\s/.test(l.text[s-l.from]);)s++;a?{from:i,to:s}=a:i>l.from&&i<l.from+100&&!/\S/.test(l.text.slice(0,i))&&(i=l.from);let f=["",Al(e,c)];return a&&f.push(Al(e,u.lineIndent(l.from,-1))),{changes:{from:i,to:s,insert:de.of(f)},range:$.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Cg(t,e){let n=-1;return t.changeByRange(r=>{let o=[];for(let s=r.from;s<=r.to;){let l=t.doc.lineAt(s);l.number>n&&(r.empty||r.to>l.from)&&(e(l,o,r),n=l.number),s=l.to+1}let i=t.changes(o);return{changes:o,range:$.range(i.mapPos(r.anchor,1),i.mapPos(r.head,1))}})}var JA=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Io(t,{overrideIndentation:i=>{let s=n[i];return s==null?-1:s}}),o=Cg(t,(i,s,l)=>{let a=dg(r,i.from);if(a==null)return;/\S/.test(i.text)||(a=0);let u=/^\s*/.exec(i.text)[0],c=Al(t,a);(u!=c||l.from<i.from+u.length)&&(n[i.from]=a,s.push({from:i.from,to:i.from+u.length,insert:c}))});return o.changes.empty||e(t.update(o,{userEvent:"indent"})),!0},ZA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Cg(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Pl)})}),{userEvent:"input.indent"})),!0),YA=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Cg(t,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let i=So(o,t.tabSize),s=0,l=Al(t,Math.max(0,i-Dl(t)));for(;s<o.length&&s<l.length&&o.charCodeAt(s)==l.charCodeAt(s);)s++;r.push({from:n.from+s,to:n.from+o.length,insert:l.slice(s)})}),{userEvent:"delete.dedent"})),!0);var QA=[{key:"Ctrl-b",run:Ak,shift:$k,preventDefault:!0},{key:"Ctrl-f",run:Rk,shift:_k},{key:"Ctrl-p",run:Nk,shift:Uk},{key:"Ctrl-n",run:Fk,shift:jk},{key:"Ctrl-a",run:bA,shift:DA},{key:"Ctrl-e",run:xA,shift:AA},{key:"Ctrl-d",run:Jk},{key:"Ctrl-h",run:xg},{key:"Ctrl-k",run:Qk},{key:"Ctrl-Alt-h",run:Yk},{key:"Ctrl-o",run:VA},{key:"Ctrl-t",run:zA},{key:"Ctrl-v",run:bg}],XA=[{key:"ArrowLeft",run:Ak,shift:$k,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:cA,shift:CA,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:vA,shift:LA,preventDefault:!0},{key:"ArrowRight",run:Rk,shift:_k,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:dA,shift:kA,preventDefault:!0},{mac:"Cmd-ArrowRight",run:yA,shift:PA,preventDefault:!0},{key:"ArrowUp",run:Nk,shift:Uk,preventDefault:!0},{mac:"Cmd-ArrowUp",run:bk,shift:wk},{mac:"Ctrl-ArrowUp",run:gk,shift:vk},{key:"ArrowDown",run:Fk,shift:jk,preventDefault:!0},{mac:"Cmd-ArrowDown",run:xk,shift:Sk},{mac:"Ctrl-ArrowDown",run:bg,shift:yk},{key:"PageUp",run:gk,shift:vk},{key:"PageDown",run:bg,shift:yk},{key:"Home",run:gA,shift:IA,preventDefault:!0},{key:"Mod-Home",run:bk,shift:wk},{key:"End",run:mA,shift:TA,preventDefault:!0},{key:"Mod-End",run:xk,shift:Sk},{key:"Enter",run:qA},{key:"Mod-a",run:RA},{key:"Backspace",run:xg,shift:xg},{key:"Delete",run:Jk},{key:"Mod-Backspace",mac:"Alt-Backspace",run:Yk},{key:"Mod-Delete",mac:"Alt-Delete",run:FA},{mac:"Mod-Backspace",run:BA},{mac:"Mod-Delete",run:Qk}].concat(QA.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),kg=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:hA,shift:EA},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:pA,shift:MA},{key:"Alt-ArrowUp",run:$A},{key:"Shift-Alt-ArrowUp",run:WA},{key:"Alt-ArrowDown",run:_A},{key:"Shift-Alt-ArrowDown",run:KA},{key:"Escape",run:NA},{key:"Mod-Enter",run:GA},{key:"Alt-l",mac:"Ctrl-l",run:OA},{key:"Mod-i",run:HA,preventDefault:!0},{key:"Mod-[",run:YA},{key:"Mod-]",run:ZA},{key:"Mod-Alt-\\",run:JA},{key:"Shift-Mod-k",run:UA},{key:"Shift-Mod-\\",run:SA},{key:"Mod-/",run:j5},{key:"Alt-A",run:G5}].concat(XA);var eR=[...kg,...Pk],tR=[Km(),Mk(),Wm(),pk(),Rl(fg,{fallback:!0}),Ri.of(eR)];import{isNumericColumn as RX}from"@vuu-ui/vuu-utils";var nE=[{label:"=",boost:10,type:"operator"},{label:"!=",boost:9,type:"operator"}],nR=[...nE,{label:"in",boost:6,type:"operator"},{label:"starts",boost:5,type:"operator"},{label:"ends",boost:4,type:"operator"}],rR=[...nE,{label:">",boost:8,type:"operator"},{label:"<",boost:7,type:"operator"}];import{walkTree as gee}from"@vuu-ui/vuu-filter-parser";import{useEffect as xee,useMemo as wee,useRef as See}from"react";import{parser as sR}from"@vuu-ui/vuu-filter-parser";var UX=Il.define({name:"VuuFilterQuery",parser:sR.configure({props:[Ml({Identifier:_.variableName,String:_.string,Or:_.emphasis,Operator:_.operator})]})});var lR=Lo.define([{tag:_.variableName,color:"var(--vuuFilterEditor-variableColor)"},{tag:_.comment,color:"green",fontStyle:"italic"}]),aR=Rl(lR);var uR=ie.theme({"&":{color:"var(--vuuFilterEditor-color)",backgroundColor:"var(--vuuFilterEditor-background)",fontSize:"var(--vuuFilterEditor-fontSize)"},".cm-content":{caretColor:"var(--vuuFilterEditor-cursorColor)",padding:0},".cm-line":{lineHeight:"var(--vuuFilterEditor-lineHeight)"},"&.cm-focused .cm-cursor":{borderLeftColor:"var(--vuuFilterEditor-cursorColor)"},"&.cm-focused .cm-selectionBackground, ::selection":{backgroundColor:"var(--vuuFilterEditor-selectionBackground)"},".cm-selectionBackground, ::selection":{backgroundColor:"var(--vuuFilterEditor-selectionBackground)"},".cm-scroller":{fontFamily:"var(--vuuFilterEditor-fontFamily)"},".cm-tooltip":{background:"var(--vuuFilterEditor-tooltipBackground)",border:"var(--vuuFilterEditor-tooltipBorder)",borderRadius:"4px",boxShadow:"var(--vuuFilterEditor-tooltipElevation)","&.cm-tooltip-autocomplete > ul":{fontFamily:"var(--vuuFilterEditor-fontFamily)",fontSize:"var(--vuuFilterEditor-fontSize)",maxHeight:"240px"},"&.cm-tooltip-autocomplete > ul > li":{alignItems:"center",display:"flex",height:"var(--vuuFilterEditor-suggestion-height)",padding:"0 3px",lineHeight:"var(--vuuFilterEditor-suggestion-height)"},"&.cm-tooltip-autocomplete li[aria-selected]":{background:"var(--vuuFilterEditor-suggestion-selectedBackground)",color:"var(--vuuFilterEditor-suggestion-selectedColor)"}},".cm-completionIcon":{height:"18px",flex:"0 0 16px"},".cm-completionLabel":{flex:"1 1 auto"},".cm-completionIcon-filter":{position:"relative","&:after":{background:"var(--salt-text-secondary-foreground)",content:"''","-webkit-mask":"var(--svg-filter) center center/13px 13px","-webkit-mask-repeat":"no-repeat",position:"absolute",height:"18px",left:"0px",top:"0px",width:"16px"}}},{dark:!1});import{useCallback as see}from"react";import{jsx as Bee,jsxs as Vee}from"react/jsx-runtime";import{useCallback as ete,useRef as tte}from"react";import{createEl as _ee}from"@vuu-ui/vuu-utils";import{formatDate as Ete,getUniqueId as Mte}from"@vuu-ui/vuu-utils";import{useCallback as Ote,useMemo as Hte}from"react";import{jsx as Vte}from"react/jsx-runtime";import{jsx as ine}from"react/jsx-runtime";var rne=fR.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:Dp,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}});import{jsx as dne,jsxs as fne}from"react/jsx-runtime";import{Fragment as Sne,jsx as wne,jsxs as Cne}from"react/jsx-runtime";import{memo as hR}from"react";import{jsx as nn,jsxs as zi}from"react/jsx-runtime";var rE=hR(()=>zi("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[zi("g",{clipPath:"url(#clip0_217_6990)",children:[nn("path",{d:"M39.8642 15.5509L35.9196 7.58974L34.3369 6.85464L24.6235 22.0825L39.1628 30.618L42.3152 25.6347L39.8642 15.5509Z",fill:"url(#paint0_linear_217_6990)"}),nn("path",{d:"M42.6246 24.8716C41.9199 25.9157 40.9625 26.824 39.767 27.4905C38.424 28.2396 36.9563 28.597 35.5081 28.597C32.7541 28.597 30.0715 27.3094 28.4466 24.9855L15.772 3.90967L15.7655 3.9206C13.3615 0.137431 8.25372 -1.13143 4.24754 1.10507C0.178173 3.37435 -1.20852 8.39359 1.14854 12.3125L18.3445 40.9095C19.1108 42.1846 20.1816 43.1834 21.4144 43.8764C21.4241 43.8826 21.4338 43.8889 21.4435 43.8951C21.4484 43.8982 21.4549 43.9013 21.4597 43.9045C22.0332 44.2228 22.6423 44.471 23.2725 44.6536C23.3194 44.6677 23.368 44.6817 23.415 44.6942C23.6418 44.7551 23.8702 44.8097 24.1019 44.8534C24.1456 44.8612 24.1894 44.8659 24.2331 44.8737C24.4194 44.9049 24.6073 44.9314 24.7952 44.9501C24.8698 44.9579 24.9443 44.9658 25.0188 44.9704C25.2342 44.9876 25.4497 44.9985 25.6668 45.0001C25.6781 45.0001 25.6895 45.0001 25.6992 45.0001C25.7024 45.0001 25.704 45.0001 25.7073 45.0001C25.7105 45.0001 25.7121 45.0001 25.7154 45.0001C25.9503 45.0001 26.1868 44.9876 26.4217 44.9689C26.4751 44.9642 26.5286 44.9595 26.5837 44.9533C26.8137 44.9299 27.0438 44.9002 27.2738 44.8596C27.277 44.8596 27.2803 44.8596 27.2835 44.8596C27.5362 44.8144 27.7889 44.7551 28.0384 44.6864C28.0546 44.6817 28.0692 44.677 28.0854 44.6723C28.4483 44.5709 28.8063 44.4445 29.1594 44.2931C29.1659 44.29 29.174 44.2868 29.1805 44.2837C29.4494 44.1682 29.7151 44.0418 29.9759 43.8967C30.24 43.75 30.491 43.5908 30.7308 43.4206C30.9398 43.2739 31.1407 43.1179 31.3367 42.9524C31.5748 42.7495 31.8 42.5373 32.009 42.3141C32.1661 42.1471 32.3168 41.9723 32.4609 41.7913C32.5079 41.732 32.5517 41.6711 32.5954 41.6118C32.6942 41.4807 32.7882 41.3465 32.8789 41.2091C32.9259 41.1373 32.9728 41.0671 33.0182 40.9953C33.036 40.9672 33.0555 40.9407 33.0717 40.9126L42.7153 24.8763H42.6214L42.6246 24.8716Z",fill:"url(#paint1_linear_217_6990)"}),nn("path",{d:"M42.8402 16.4218L42.1112 15.2232L38.9636 9.58433L37.504 7.19644C37.2286 6.56123 36.579 6.11331 35.8176 6.11331C34.8083 6.11331 33.9919 6.90147 33.9919 7.87223C33.9919 8.20154 34.0907 8.50432 34.2543 8.76808L34.2349 8.78056L39.9048 18.0808C40.5884 19.2186 40.7715 20.5437 40.4199 21.8141C40.0684 23.0845 39.226 24.1458 38.045 24.806C37.2675 25.2398 36.3846 25.4693 35.4936 25.4693C33.6727 25.4693 31.9766 24.5281 31.0662 23.0143L22.9161 9.63271H22.9323L19.4899 3.90958L19.4834 3.92051C19.4235 3.8253 19.3538 3.73947 19.2907 3.64738L19.1935 3.48663C19.1935 3.48663 19.1854 3.49131 19.1821 3.49443C17.5654 1.27666 14.9799 0.0390178 12.3118 0.00936427V0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.961 26.8255 41.9168 25.9156 42.6231 24.8731H42.717L42.6846 24.9261C43.1366 24.2347 43.4833 23.4731 43.7068 22.6615C44.2916 20.5452 43.9871 18.3352 42.8369 16.4234L42.8402 16.4218Z",fill:"#F37880"}),zi("g",{opacity:"0.86",children:[nn("path",{d:"M34.2332 8.78212L39.9031 18.0824C40.5868 19.2202 40.7698 20.5452 40.4183 21.8156C40.2044 22.5897 39.8059 23.2858 39.2616 23.8617C39.9744 23.2343 40.4879 22.4243 40.7423 21.5035C41.0938 20.2331 40.9107 18.908 40.2271 17.7703L34.5572 8.46998L34.5767 8.4575C34.413 8.19374 34.3142 7.89096 34.3142 7.56165C34.3142 7.15586 34.4584 6.78285 34.6982 6.48476C34.2672 6.80626 33.9902 7.30881 33.9902 7.87379C33.9902 8.2031 34.0891 8.50588 34.2527 8.76964L34.2332 8.78212Z",fill:"white"}),nn("path",{d:"M42.6917 24.9169L42.6863 24.9256C42.6863 24.9256 42.6899 24.9187 42.6935 24.9152C42.6935 24.9152 42.6935 24.9152 42.6935 24.9169H42.6917Z",fill:"white"}),nn("path",{d:"M40.0911 27.1798C38.7481 27.9289 37.2804 28.2863 35.8322 28.2863C33.0782 28.2863 30.3955 26.9988 28.7707 24.6749L16.0961 3.59744L16.0896 3.60837C14.9281 1.78077 13.1364 0.543128 11.1422 0H7.91199V0.02185C10.9851 -0.184164 14.0582 1.23296 15.7656 3.92051L15.7721 3.90958L28.4451 24.987C30.0699 27.3093 32.7542 28.5985 35.5066 28.5985C36.9548 28.5985 38.4225 28.2426 39.7655 27.4919C40.4815 27.0924 41.1084 26.6055 41.6511 26.0561C41.1862 26.479 40.6662 26.8583 40.0894 27.1798H40.0911Z",fill:"white"})]})]}),zi("defs",{children:[zi("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[nn("stop",{stopColor:"#4906A5"}),nn("stop",{offset:"1",stopColor:"#D3423A"})]}),zi("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[nn("stop",{stopColor:"#7C06A5"}),nn("stop",{offset:"1",stopColor:"#D3423A"})]}),nn("clipPath",{id:"clip0_217_6990",children:nn("rect",{width:"44",height:"45",fill:"white"})})]})]}));rE.displayName="VuuLogo";import{useThemeAttributes as Qne}from"@vuu-ui/vuu-utils";import{useCallback as rre,useState as ore}from"react";import{jsx as $ne,jsxs as _ne}from"react/jsx-runtime";import{jsx as ure,jsxs as cre}from"react/jsx-runtime";import{VuuDataSource as vre}from"@vuu-ui/vuu-data-remote";import{buildColumnMap as bre,hasAction as xre,isErrorResponse as wre,isValidNumber as Sre,shallowEquals as Cre}from"@vuu-ui/vuu-utils";import{useCallback as Lre,useEffect as Pre,useMemo as Dre,useRef as Are,useState as Rre}from"react";import{jsx as Nre,jsxs as Fre}from"react/jsx-runtime";import{connectToServer as Goe}from"@vuu-ui/vuu-data-remote";import{logger as pR,ThemeProvider as Xoe,useThemeAttributes as eie}from"@vuu-ui/vuu-utils";import{useCallback as iie,useEffect as sie,useRef as lie}from"react";import{useCallback as Ure,useMemo as jre}from"react";import{jsx as Jre,jsxs as Zre}from"react/jsx-runtime";import{useMemo as ioe}from"react";import{jsx as uoe}from"react/jsx-runtime";import{jsx as yoe,jsxs as boe}from"react/jsx-runtime";import{useCallback as koe,useRef as Eoe,useState as Moe}from"react";import{jsx as Ioe,jsxs as Loe}from"react/jsx-runtime";import{jsx as gie,jsxs as vie}from"react/jsx-runtime";typeof Uu!="function"&&console.warn("StackLayout module not loaded, will be unsbale to deserialize from layout JSON");var{error:pie}=pR("Shell");import{createContext as mR,useContext as gR}from"react";import{jsx as kie}from"react/jsx-runtime";var vR={},yR=mR(vR);var oE=()=>gR(yR);import{useCallback as Aie}from"react";import{jsx as Hie,jsxs as Nie}from"react/jsx-runtime";import{buildColumnMap as xR,isLookupRenderer as wR,isTypeDescriptor as SR}from"@vuu-ui/vuu-utils";import{useMemo as iE,useState as CR}from"react";var sE=[],lE=new Map,kR=({labelColumn:t,table:e,valueColumn:n})=>{let r=`${e.module}:${e.table}`,o=lE.get(r);if(o)return o;{let i=new Promise(s=>{let l=[n,t],a=xR(l),u=new bR({bufferSize:0,table:e});u.subscribe({columns:l,range:{from:0,to:100}},c=>{if(c.type==="viewport-update"&&c.rows){let f=c.rows.map(d=>({value:d[a[n]],label:d[a[t]]}));s(f),u.unsubscribe()}})});return lE.set(r,i),i}},aE=(t,e)=>{var n;return e===void 0?null:(n=t.find(r=>r.value===e))!=null?n:null},ER=({name:t,type:e})=>{if(SR(e)&&wR(e.renderer))return e.renderer.lookup;throw Error(`useLookupValues column ${t} is not configured to use lookup values`)},ose=(t,e)=>{let n=ER(t),{getLookupValues:r}=oE(),o=iE(()=>{var u;let a=(u=r==null?void 0:r(n.table))!=null?u:sE;return{initialValue:aE(a,e),values:a}},[r,e,n.table]),[{initialValue:i,values:s},l]=CR(o);return iE(()=>{s===sE&&kR(n).then(a=>l({initialValue:aE(a,e),values:a}))},[s,n,e]),{initialValue:i,values:s}};import{useCallback as MR,useEffect as TR,useState as IR}from"react";import{ConnectionManager as uE}from"@vuu-ui/vuu-data-remote";var ase=()=>{let[t,e]=IR("disconnected"),n=MR(({status:r})=>{e(r)},[]);return TR(()=>(uE.on("connection-status",n),()=>{uE.removeListener("connection-status",n)}),[n]),t};import{useCallback as LR,useEffect as PR,useState as DR}from"react";import{ConnectionManager as cE}from"@vuu-ui/vuu-data-remote";var fse=()=>{let[t,e]=DR(0),n=LR(({messages:r})=>{e(r.messagesLength)},[]);return PR(()=>(cE.on("connection-metrics",n),()=>{cE.removeListener("connection-metrics",n)}),[n]),t};import{useCallback as AR}from"react";import{makeRpcCall as RR}from"@vuu-ui/vuu-data-remote";var dE={type:"RPC_CALL",service:"TypeAheadRpcHandler"},cR=(t,e,n="",r=[])=>n!==""&&!r.includes(n.toLowerCase())?[t,e,n]:[t,e],Rp=()=>AR(async t=>{let e=t.length===2?{method:"getUniqueFieldValues",params:t,...dE}:{method:"getUniqueFieldValuesStartingWith",params:t,...dE};return RR(e)},[]);import{getFilterPredicate as fE}from"@vuu-ui/vuu-filter-parser";import{getRowRecord as OR,isGroupMenuItemDescriptor as HR,metadataKeys as NR}from"@vuu-ui/vuu-utils";import{useCallback as hE}from"react";var wse="addRowsFromInstruments",{KEY:pE}=NR,FR={},BR=t=>"rpcName"in t,VR=t=>"menus"in t,zR=t=>t.name==="ROOT",mE=t=>t.context==="cell",$R=t=>t.context==="row",_R=t=>t.context==="selected-rows",WR=(t,e,n=0)=>{switch(t){case"grid":return e==="selected-rows"?n>0:!0;case"header":return e==="grid";default:return!1}},KR=(t,e,n,r,o)=>{if(t==="cell"||t==="row")return fE(o,r)(e);if(t==="selected-rows"){if(n.length===0)return!1;{let i=fE(o,r);return n.every(i)}}return!0},UR=t=>{let{rpcName:e}=t;return mE(t)?{field:t.field,rowKey:t.rowKey,rpcName:e,value:t.value,type:"VIEW_PORT_MENU_CELL_RPC"}:$R(t)?{rowKey:t.rowKey,row:t.row,rpcName:e,type:"VIEW_PORT_MENU_ROW_RPC"}:_R(t)?{rpcName:e,type:"VIEW_PORT_MENUS_SELECT_RPC"}:{rpcName:e,type:"VIEW_PORT_MENU_TABLE_RPC"}},jR=t=>["grid","header","filter"].includes(t),qR=({filter:t})=>typeof t=="string"&&t.length>0,GR=(t,e)=>{switch(t.context){case"cell":return{...t,field:e.columnName,rowKey:e.row[pE],value:e.row[e.columnMap[e.columnName]]};case"row":return{...t,row:OR(e.row,e.columnMap),rowKey:e.row[pE]};default:return t}},gE=(t,e,n)=>{var r;return VR(t)?t.menus.some(o=>gE(o,e,n)):WR(e,t.context,(r=n.selectedRows)==null?void 0:r.length)?e==="grid"&&qR(t)?KR(t.context,n.row,n.selectedRows,t.filter,n.columnMap):mE(t)&&t.field!=="*"?t.field===n.columnName:!0:!1},vE=(t,e,n)=>{if(gE(t,e,n)){if(BR(t))return{label:t.name,action:"MENU_RPC_CALL",options:GR(t,n)};{let r=t.menus.map(o=>vE(o,e,n)).filter(o=>o!==void 0);if(r.length>0)return{label:t.name,children:r}}}},Sse=({clientSideMenuActionHandler:t,dataSource:e,menuActionConfig:n=FR,onRpcResponse:r})=>{let o=hE((s,l)=>{let{links:a,menu:u}=e,{visualLink:c}=n,f=[];if(s==="grid"&&a&&!c&&a.forEach(d=>{let{link:h,label:g}=d,v=g||h.toTable;f.push({label:`Link to ${v}`,action:"link-table",options:d})}),u&&jR(s)){let d=vE(u,s,l);zR(u)&&HR(d)?f.push(...d.children):d&&f.push(d)}return f},[e,n]),i=hE(({menuId:s,options:l})=>{if(t!=null&&t(s,l))return!0;if(s==="MENU_RPC_CALL"){let a=UR(l);return e.menuRpcCall(a).then(u=>{r&&u&&r&&r(u)}),!0}else{if(s==="link-table")return e.visualLink=l,!0;console.log(`useViewServer handleMenuAction, can't handle action type ${s}`)}return!1},[t,e,r]);return{buildViewserverMenuOptions:o,handleMenuAction:i}};import{getServerAPI as yE}from"@vuu-ui/vuu-data-remote";import{useCallback as JR,useEffect as ZR,useState as YR}from"react";var Mse=()=>{let[t,e]=YR(),n=JR(r=>{let o=new Map;return r.forEach(i=>{o.set(i.table.table,i)}),o},[]);return ZR(()=>{async function r(){console.log("GET TABLE LIST");let o=await yE(),{tables:i}=await o.getTableList(),s=n(await Promise.all(i.map(l=>o.getTableSchema(l))));e(s)}r()},[n]),t},Tse=t=>yE().then(e=>e.getTableSchema(t));export{sd as MovingWindow,wse as addRowsFromInstruments,cR as getTypeaheadParams,Tse as getVuuTableSchema,tO as useDataSource,ose as useLookupValues,fse as useServerConnectionQuality,ase as useServerConnectionStatus,Rp as useTypeaheadSuggestions,Sse as useVuuMenuActions,Mse as useVuuTables};
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
(
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
1
|
+
// src/hooks/useDataSource.ts
|
|
2
|
+
import { getFullRange, metadataKeys, WindowRange } from "@vuu-ui/vuu-utils";
|
|
3
|
+
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
var { SELECTED } = metadataKeys;
|
|
5
|
+
function useDataSource({
|
|
6
|
+
dataSource,
|
|
7
|
+
renderBufferSize = 10
|
|
8
|
+
}) {
|
|
9
|
+
const [, forceUpdate] = useState(null);
|
|
10
|
+
const isMounted = useRef(true);
|
|
11
|
+
const hasUpdated = useRef(false);
|
|
12
|
+
const rafHandle = useRef(null);
|
|
13
|
+
const data = useRef([]);
|
|
14
|
+
const rangeRef = useRef({ from: 0, to: 10 });
|
|
15
|
+
const dataWindow = useMemo(
|
|
16
|
+
() => new MovingWindow(getFullRange(rangeRef.current, renderBufferSize)),
|
|
17
|
+
[renderBufferSize]
|
|
18
|
+
);
|
|
19
|
+
const setData = useCallback(
|
|
20
|
+
(updates) => {
|
|
21
|
+
for (const row of updates) {
|
|
22
|
+
dataWindow.add(row);
|
|
23
|
+
}
|
|
24
|
+
data.current = dataWindow.data.slice();
|
|
25
|
+
hasUpdated.current = true;
|
|
26
|
+
},
|
|
27
|
+
[dataWindow]
|
|
28
|
+
);
|
|
29
|
+
const datasourceMessageHandler = useCallback(
|
|
30
|
+
(message) => {
|
|
31
|
+
if (message.type === "viewport-update") {
|
|
32
|
+
if (message.size !== void 0) {
|
|
33
|
+
dataWindow.setRowCount(message.size);
|
|
34
|
+
}
|
|
35
|
+
if (message.rows) {
|
|
36
|
+
setData(message.rows);
|
|
37
|
+
forceUpdate({});
|
|
38
|
+
} else if (message.size !== void 0) {
|
|
39
|
+
data.current = dataWindow.data.slice();
|
|
40
|
+
hasUpdated.current = true;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
[dataWindow, setData]
|
|
45
|
+
);
|
|
46
|
+
useEffect(
|
|
47
|
+
() => () => {
|
|
48
|
+
if (rafHandle.current) {
|
|
49
|
+
cancelAnimationFrame(rafHandle.current);
|
|
50
|
+
rafHandle.current = null;
|
|
51
|
+
}
|
|
52
|
+
isMounted.current = false;
|
|
53
|
+
},
|
|
54
|
+
[]
|
|
55
|
+
);
|
|
56
|
+
const setRange = useCallback(
|
|
57
|
+
(range) => {
|
|
58
|
+
rangeRef.current = range;
|
|
59
|
+
const fullRange = getFullRange(rangeRef.current, renderBufferSize);
|
|
60
|
+
dataSource.range = fullRange;
|
|
61
|
+
dataWindow.setRange(fullRange.from, fullRange.to);
|
|
62
|
+
},
|
|
63
|
+
[dataSource, dataWindow, renderBufferSize]
|
|
64
|
+
);
|
|
65
|
+
useMemo(() => {
|
|
66
|
+
const { from, to } = rangeRef.current;
|
|
67
|
+
const fullRange = getFullRange({ from, to }, renderBufferSize);
|
|
68
|
+
dataSource.range = fullRange;
|
|
69
|
+
dataWindow.setRange(fullRange.from, fullRange.to);
|
|
70
|
+
}, [dataSource, dataWindow, renderBufferSize]);
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const { from, to } = getFullRange(rangeRef.current, renderBufferSize);
|
|
73
|
+
dataSource.subscribe(
|
|
74
|
+
{
|
|
75
|
+
range: { from, to }
|
|
76
|
+
},
|
|
77
|
+
datasourceMessageHandler
|
|
78
|
+
);
|
|
79
|
+
}, [dataSource, datasourceMessageHandler, renderBufferSize]);
|
|
80
|
+
useEffect(
|
|
81
|
+
() => () => {
|
|
82
|
+
dataSource.unsubscribe();
|
|
83
|
+
},
|
|
84
|
+
[dataSource]
|
|
85
|
+
);
|
|
86
|
+
return [
|
|
87
|
+
data.current,
|
|
88
|
+
dataWindow.rowCount,
|
|
89
|
+
getFullRange(rangeRef.current, renderBufferSize),
|
|
90
|
+
setRange
|
|
91
|
+
];
|
|
92
|
+
}
|
|
93
|
+
var MovingWindow = class {
|
|
94
|
+
constructor({ from, to }) {
|
|
95
|
+
this.rowCount = 0;
|
|
96
|
+
this.setRowCount = (rowCount) => {
|
|
97
|
+
if (rowCount < this.data.length) {
|
|
98
|
+
this.data.length = rowCount;
|
|
99
|
+
}
|
|
100
|
+
this.rowCount = rowCount;
|
|
101
|
+
};
|
|
102
|
+
this.range = new WindowRange(from, to);
|
|
103
|
+
this.data = new Array(to - from);
|
|
104
|
+
}
|
|
105
|
+
add(data) {
|
|
106
|
+
const [index] = data;
|
|
107
|
+
if (this.isWithinRange(index)) {
|
|
108
|
+
const internalIndex = index - this.range.from;
|
|
109
|
+
this.data[internalIndex] = data;
|
|
110
|
+
if (this.data[internalIndex - 1]) {
|
|
111
|
+
if (this.data[internalIndex - 1][SELECTED] === 1 && data[SELECTED] === 0) {
|
|
112
|
+
data[SELECTED] = 2;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (index === this.rowCount - 1) {
|
|
116
|
+
this.data.length = internalIndex + 1;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
getAtIndex(index) {
|
|
121
|
+
return this.range.isWithin(index) && this.data[index - this.range.from] != null ? this.data[index - this.range.from] : void 0;
|
|
122
|
+
}
|
|
123
|
+
isWithinRange(index) {
|
|
124
|
+
return this.range.isWithin(index);
|
|
125
|
+
}
|
|
126
|
+
setRange(from, to) {
|
|
127
|
+
if (from !== this.range.from || to !== this.range.to) {
|
|
128
|
+
const [overlapFrom, overlapTo] = this.range.overlap(from, to);
|
|
129
|
+
const newData = new Array(to - from);
|
|
130
|
+
for (let i = overlapFrom; i < overlapTo; i++) {
|
|
131
|
+
const data = this.getAtIndex(i);
|
|
132
|
+
if (data) {
|
|
133
|
+
const index = i - from;
|
|
134
|
+
newData[index] = data;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
this.data = newData;
|
|
138
|
+
this.range.from = from;
|
|
139
|
+
this.range.to = to;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
// src/hooks/useLookupValues.ts
|
|
145
|
+
import { VuuDataSource } from "@vuu-ui/vuu-data-remote";
|
|
146
|
+
import { useShellContext } from "@vuu-ui/vuu-shell";
|
|
147
|
+
import {
|
|
148
|
+
buildColumnMap,
|
|
149
|
+
isLookupRenderer,
|
|
150
|
+
isTypeDescriptor
|
|
151
|
+
} from "@vuu-ui/vuu-utils";
|
|
152
|
+
import { useMemo as useMemo2, useState as useState2 } from "react";
|
|
153
|
+
var NO_VALUES = [];
|
|
154
|
+
var lookupValueMap = /* @__PURE__ */ new Map();
|
|
155
|
+
var loadLookupValues = ({
|
|
156
|
+
labelColumn,
|
|
157
|
+
table,
|
|
158
|
+
valueColumn
|
|
159
|
+
}) => {
|
|
160
|
+
const tableKey = `${table.module}:${table.table}`;
|
|
161
|
+
const lookupValues = lookupValueMap.get(tableKey);
|
|
162
|
+
if (lookupValues) {
|
|
163
|
+
return lookupValues;
|
|
164
|
+
} else {
|
|
165
|
+
const promise = new Promise((resolve) => {
|
|
166
|
+
const columns = [valueColumn, labelColumn];
|
|
167
|
+
const columnMap = buildColumnMap(columns);
|
|
168
|
+
const dataSource = new VuuDataSource({
|
|
169
|
+
bufferSize: 0,
|
|
170
|
+
table
|
|
171
|
+
});
|
|
172
|
+
dataSource.subscribe(
|
|
173
|
+
{
|
|
174
|
+
columns,
|
|
175
|
+
range: { from: 0, to: 100 }
|
|
176
|
+
},
|
|
177
|
+
(message) => {
|
|
178
|
+
if (message.type === "viewport-update") {
|
|
179
|
+
if (message.rows) {
|
|
180
|
+
const listOptions = message.rows.map((row) => ({
|
|
181
|
+
value: row[columnMap[valueColumn]],
|
|
182
|
+
label: row[columnMap[labelColumn]]
|
|
183
|
+
}));
|
|
184
|
+
resolve(listOptions);
|
|
185
|
+
dataSource.unsubscribe();
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
lookupValueMap.set(tableKey, promise);
|
|
192
|
+
return promise;
|
|
193
|
+
}
|
|
194
|
+
};
|
|
195
|
+
var getSelectedOption = (values, selectedValue) => {
|
|
196
|
+
var _a;
|
|
197
|
+
if (selectedValue === void 0) {
|
|
198
|
+
return null;
|
|
199
|
+
}
|
|
200
|
+
return (_a = values.find((option) => option.value === selectedValue)) != null ? _a : null;
|
|
201
|
+
};
|
|
202
|
+
var getLookupDetails = ({ name, type }) => {
|
|
203
|
+
if (isTypeDescriptor(type) && isLookupRenderer(type.renderer)) {
|
|
204
|
+
return type.renderer.lookup;
|
|
205
|
+
} else {
|
|
206
|
+
throw Error(
|
|
207
|
+
`useLookupValues column ${name} is not configured to use lookup values`
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
};
|
|
211
|
+
var useLookupValues = (column, initialValueProp) => {
|
|
212
|
+
const lookupDetails = getLookupDetails(column);
|
|
213
|
+
const { getLookupValues } = useShellContext();
|
|
214
|
+
const initialState = useMemo2(() => {
|
|
215
|
+
var _a;
|
|
216
|
+
const values2 = (_a = getLookupValues == null ? void 0 : getLookupValues(lookupDetails.table)) != null ? _a : NO_VALUES;
|
|
217
|
+
return {
|
|
218
|
+
initialValue: getSelectedOption(values2, initialValueProp),
|
|
219
|
+
values: values2
|
|
220
|
+
};
|
|
221
|
+
}, [getLookupValues, initialValueProp, lookupDetails.table]);
|
|
222
|
+
const [{ initialValue, values }, setLookupState] = useState2(initialState);
|
|
223
|
+
useMemo2(() => {
|
|
224
|
+
if (values === NO_VALUES) {
|
|
225
|
+
loadLookupValues(lookupDetails).then(
|
|
226
|
+
(values2) => setLookupState({
|
|
227
|
+
initialValue: getSelectedOption(values2, initialValueProp),
|
|
228
|
+
values: values2
|
|
229
|
+
})
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
}, [values, lookupDetails, initialValueProp]);
|
|
233
|
+
return {
|
|
234
|
+
initialValue,
|
|
235
|
+
values
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
// src/hooks/useServerConnectionStatus.ts
|
|
240
|
+
import { useCallback as useCallback2, useEffect as useEffect2, useState as useState3 } from "react";
|
|
241
|
+
import { ConnectionManager } from "@vuu-ui/vuu-data-remote";
|
|
242
|
+
var useServerConnectionStatus = () => {
|
|
243
|
+
const [connectionStatus, setConnectionStatus] = useState3("disconnected");
|
|
244
|
+
const handleStatusChange = useCallback2(
|
|
245
|
+
({ status }) => {
|
|
246
|
+
setConnectionStatus(status);
|
|
247
|
+
},
|
|
248
|
+
[]
|
|
249
|
+
);
|
|
250
|
+
useEffect2(() => {
|
|
251
|
+
ConnectionManager.on("connection-status", handleStatusChange);
|
|
252
|
+
return () => {
|
|
253
|
+
ConnectionManager.removeListener("connection-status", handleStatusChange);
|
|
254
|
+
};
|
|
255
|
+
}, [handleStatusChange]);
|
|
256
|
+
return connectionStatus;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
// src/hooks/useServerConnectionQuality.ts
|
|
260
|
+
import { useCallback as useCallback3, useEffect as useEffect3, useState as useState4 } from "react";
|
|
261
|
+
import { ConnectionManager as ConnectionManager2 } from "@vuu-ui/vuu-data-remote";
|
|
262
|
+
var useServerConnectionQuality = () => {
|
|
263
|
+
const [messagesPerSecond, setMessagesPerSecond] = useState4(0);
|
|
264
|
+
const handleConnectivityMessage = useCallback3(({ messages }) => {
|
|
265
|
+
setMessagesPerSecond(messages.messagesLength);
|
|
266
|
+
}, []);
|
|
267
|
+
useEffect3(() => {
|
|
268
|
+
ConnectionManager2.on("connection-metrics", handleConnectivityMessage);
|
|
269
|
+
return () => {
|
|
270
|
+
ConnectionManager2.removeListener(
|
|
271
|
+
"connection-metrics",
|
|
272
|
+
handleConnectivityMessage
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
}, [handleConnectivityMessage]);
|
|
276
|
+
return messagesPerSecond;
|
|
277
|
+
};
|
|
278
|
+
|
|
279
|
+
// src/hooks/useTypeaheadSuggestions.ts
|
|
280
|
+
import { makeRpcCall } from "@vuu-ui/vuu-data-remote";
|
|
281
|
+
import { useCallback as useCallback4 } from "react";
|
|
282
|
+
var TYPEAHEAD_MESSAGE_CONSTANTS = {
|
|
283
|
+
type: "RPC_CALL",
|
|
284
|
+
service: "TypeAheadRpcHandler"
|
|
285
|
+
};
|
|
286
|
+
var getTypeaheadParams = (table, column, text = "", selectedValues = []) => {
|
|
287
|
+
if (text !== "" && !selectedValues.includes(text.toLowerCase())) {
|
|
288
|
+
return [table, column, text];
|
|
289
|
+
}
|
|
290
|
+
return [table, column];
|
|
291
|
+
};
|
|
292
|
+
var useTypeaheadSuggestions = () => useCallback4(async (params) => {
|
|
293
|
+
const rpcMessage = params.length === 2 ? {
|
|
294
|
+
method: "getUniqueFieldValues",
|
|
295
|
+
params,
|
|
296
|
+
...TYPEAHEAD_MESSAGE_CONSTANTS
|
|
297
|
+
} : {
|
|
298
|
+
method: "getUniqueFieldValuesStartingWith",
|
|
299
|
+
params,
|
|
300
|
+
...TYPEAHEAD_MESSAGE_CONSTANTS
|
|
301
|
+
};
|
|
302
|
+
return makeRpcCall(rpcMessage);
|
|
303
|
+
}, []);
|
|
304
|
+
|
|
305
|
+
// src/hooks/useVuuMenuActions.ts
|
|
306
|
+
import { getFilterPredicate } from "@vuu-ui/vuu-filter-parser";
|
|
307
|
+
import {
|
|
308
|
+
getRowRecord,
|
|
309
|
+
isGroupMenuItemDescriptor,
|
|
310
|
+
metadataKeys as metadataKeys2
|
|
311
|
+
} from "@vuu-ui/vuu-utils";
|
|
312
|
+
import { useCallback as useCallback5 } from "react";
|
|
313
|
+
var addRowsFromInstruments = "addRowsFromInstruments";
|
|
314
|
+
var { KEY } = metadataKeys2;
|
|
315
|
+
var NO_CONFIG = {};
|
|
316
|
+
var isMenuItem = (menu) => "rpcName" in menu;
|
|
317
|
+
var isGroupMenuItem = (menu) => "menus" in menu;
|
|
318
|
+
var isRoot = (menu) => menu.name === "ROOT";
|
|
319
|
+
var isCellMenu = (options) => options.context === "cell";
|
|
320
|
+
var isRowMenu = (options) => options.context === "row";
|
|
321
|
+
var isSelectionMenu = (options) => options.context === "selected-rows";
|
|
322
|
+
var vuuContextCompatibleWithTableLocation = (uiLocation, vuuContext, selectedRowCount = 0) => {
|
|
323
|
+
switch (uiLocation) {
|
|
324
|
+
case "grid":
|
|
325
|
+
if (vuuContext === "selected-rows") {
|
|
326
|
+
return selectedRowCount > 0;
|
|
327
|
+
} else {
|
|
328
|
+
return true;
|
|
329
|
+
}
|
|
330
|
+
case "header":
|
|
331
|
+
return vuuContext === "grid";
|
|
332
|
+
default:
|
|
333
|
+
return false;
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
var gridRowMeetsFilterCriteria = (context, row, selectedRows, filter, columnMap) => {
|
|
337
|
+
if (context === "cell" || context === "row") {
|
|
338
|
+
const filterPredicate = getFilterPredicate(columnMap, filter);
|
|
339
|
+
return filterPredicate(row);
|
|
340
|
+
} else if (context === "selected-rows") {
|
|
341
|
+
if (selectedRows.length === 0) {
|
|
342
|
+
return false;
|
|
343
|
+
} else {
|
|
344
|
+
const filterPredicate = getFilterPredicate(columnMap, filter);
|
|
345
|
+
return selectedRows.every(filterPredicate);
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
return true;
|
|
349
|
+
};
|
|
350
|
+
var getMenuRpcRequest = (options) => {
|
|
351
|
+
const { rpcName } = options;
|
|
352
|
+
if (isCellMenu(options)) {
|
|
353
|
+
return {
|
|
354
|
+
field: options.field,
|
|
355
|
+
rowKey: options.rowKey,
|
|
356
|
+
rpcName,
|
|
357
|
+
value: options.value,
|
|
358
|
+
type: "VIEW_PORT_MENU_CELL_RPC"
|
|
359
|
+
};
|
|
360
|
+
} else if (isRowMenu(options)) {
|
|
361
|
+
return {
|
|
362
|
+
rowKey: options.rowKey,
|
|
363
|
+
row: options.row,
|
|
364
|
+
rpcName,
|
|
365
|
+
type: "VIEW_PORT_MENU_ROW_RPC"
|
|
366
|
+
};
|
|
367
|
+
} else if (isSelectionMenu(options)) {
|
|
368
|
+
return {
|
|
369
|
+
rpcName,
|
|
370
|
+
type: "VIEW_PORT_MENUS_SELECT_RPC"
|
|
371
|
+
};
|
|
372
|
+
} else {
|
|
373
|
+
return {
|
|
374
|
+
rpcName,
|
|
375
|
+
type: "VIEW_PORT_MENU_TABLE_RPC"
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
};
|
|
379
|
+
var isTableLocation = (location) => ["grid", "header", "filter"].includes(location);
|
|
380
|
+
var hasFilter = ({ filter }) => typeof filter === "string" && filter.length > 0;
|
|
381
|
+
var getMenuItemOptions = (menu, options) => {
|
|
382
|
+
switch (menu.context) {
|
|
383
|
+
case "cell":
|
|
384
|
+
return {
|
|
385
|
+
...menu,
|
|
386
|
+
field: options.columnName,
|
|
387
|
+
rowKey: options.row[KEY],
|
|
388
|
+
value: options.row[options.columnMap[options.columnName]]
|
|
389
|
+
};
|
|
390
|
+
case "row":
|
|
391
|
+
return {
|
|
392
|
+
...menu,
|
|
393
|
+
row: getRowRecord(options.row, options.columnMap),
|
|
394
|
+
rowKey: options.row[KEY]
|
|
395
|
+
};
|
|
396
|
+
default:
|
|
397
|
+
return menu;
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
var menuShouldBeRenderedInThisContext = (menuItem, tableLocation, options) => {
|
|
401
|
+
var _a;
|
|
402
|
+
if (isGroupMenuItem(menuItem)) {
|
|
403
|
+
return menuItem.menus.some(
|
|
404
|
+
(childMenu) => menuShouldBeRenderedInThisContext(childMenu, tableLocation, options)
|
|
405
|
+
);
|
|
406
|
+
}
|
|
407
|
+
if (!vuuContextCompatibleWithTableLocation(
|
|
408
|
+
tableLocation,
|
|
409
|
+
menuItem.context,
|
|
410
|
+
(_a = options.selectedRows) == null ? void 0 : _a.length
|
|
411
|
+
)) {
|
|
412
|
+
return false;
|
|
413
|
+
}
|
|
414
|
+
if (tableLocation === "grid" && hasFilter(menuItem)) {
|
|
415
|
+
return gridRowMeetsFilterCriteria(
|
|
416
|
+
menuItem.context,
|
|
417
|
+
options.row,
|
|
418
|
+
options.selectedRows,
|
|
419
|
+
menuItem.filter,
|
|
420
|
+
options.columnMap
|
|
421
|
+
);
|
|
422
|
+
}
|
|
423
|
+
if (isCellMenu(menuItem) && menuItem.field !== "*") {
|
|
424
|
+
return menuItem.field === options.columnName;
|
|
425
|
+
}
|
|
426
|
+
return true;
|
|
427
|
+
};
|
|
428
|
+
var buildMenuDescriptor = (menu, tableLocation, options) => {
|
|
429
|
+
if (menuShouldBeRenderedInThisContext(menu, tableLocation, options)) {
|
|
430
|
+
if (isMenuItem(menu)) {
|
|
431
|
+
return {
|
|
432
|
+
label: menu.name,
|
|
433
|
+
action: "MENU_RPC_CALL",
|
|
434
|
+
options: getMenuItemOptions(menu, options)
|
|
435
|
+
};
|
|
436
|
+
} else {
|
|
437
|
+
const children = menu.menus.map(
|
|
438
|
+
(childMenu) => buildMenuDescriptor(childMenu, tableLocation, options)
|
|
439
|
+
).filter(
|
|
440
|
+
(childMenu) => childMenu !== void 0
|
|
441
|
+
);
|
|
442
|
+
if (children.length > 0) {
|
|
443
|
+
return {
|
|
444
|
+
label: menu.name,
|
|
445
|
+
children
|
|
446
|
+
};
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
var useVuuMenuActions = ({
|
|
452
|
+
clientSideMenuActionHandler,
|
|
453
|
+
dataSource,
|
|
454
|
+
menuActionConfig = NO_CONFIG,
|
|
455
|
+
onRpcResponse
|
|
456
|
+
}) => {
|
|
457
|
+
const buildViewserverMenuOptions = useCallback5(
|
|
458
|
+
(location, options) => {
|
|
459
|
+
const { links, menu } = dataSource;
|
|
460
|
+
const { visualLink } = menuActionConfig;
|
|
461
|
+
const descriptors = [];
|
|
462
|
+
if (location === "grid" && links && !visualLink) {
|
|
463
|
+
links.forEach((linkDescriptor) => {
|
|
464
|
+
const { link, label: linkLabel } = linkDescriptor;
|
|
465
|
+
const label = linkLabel ? linkLabel : link.toTable;
|
|
466
|
+
descriptors.push({
|
|
467
|
+
label: `Link to ${label}`,
|
|
468
|
+
action: "link-table",
|
|
469
|
+
options: linkDescriptor
|
|
470
|
+
});
|
|
471
|
+
});
|
|
472
|
+
}
|
|
473
|
+
if (menu && isTableLocation(location)) {
|
|
474
|
+
const menuDescriptor = buildMenuDescriptor(
|
|
475
|
+
menu,
|
|
476
|
+
location,
|
|
477
|
+
options
|
|
478
|
+
);
|
|
479
|
+
if (isRoot(menu) && isGroupMenuItemDescriptor(menuDescriptor)) {
|
|
480
|
+
descriptors.push(...menuDescriptor.children);
|
|
481
|
+
} else if (menuDescriptor) {
|
|
482
|
+
descriptors.push(menuDescriptor);
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
return descriptors;
|
|
486
|
+
},
|
|
487
|
+
[dataSource, menuActionConfig]
|
|
488
|
+
);
|
|
489
|
+
const handleMenuAction = useCallback5(
|
|
490
|
+
({ menuId, options }) => {
|
|
491
|
+
if (clientSideMenuActionHandler == null ? void 0 : clientSideMenuActionHandler(menuId, options)) {
|
|
492
|
+
return true;
|
|
493
|
+
} else if (menuId === "MENU_RPC_CALL") {
|
|
494
|
+
const rpcRequest = getMenuRpcRequest(options);
|
|
495
|
+
dataSource.menuRpcCall(rpcRequest).then((rpcResponse) => {
|
|
496
|
+
if (onRpcResponse && rpcResponse) {
|
|
497
|
+
onRpcResponse && onRpcResponse(rpcResponse);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
return true;
|
|
501
|
+
} else if (menuId === "link-table") {
|
|
502
|
+
return dataSource.visualLink = options, true;
|
|
503
|
+
} else {
|
|
504
|
+
console.log(
|
|
505
|
+
`useViewServer handleMenuAction, can't handle action type ${menuId}`
|
|
506
|
+
);
|
|
507
|
+
}
|
|
508
|
+
return false;
|
|
509
|
+
},
|
|
510
|
+
[clientSideMenuActionHandler, dataSource, onRpcResponse]
|
|
511
|
+
);
|
|
512
|
+
return {
|
|
513
|
+
buildViewserverMenuOptions,
|
|
514
|
+
handleMenuAction
|
|
515
|
+
};
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
// src/hooks/useVuuTables.ts
|
|
519
|
+
import { getServerAPI } from "@vuu-ui/vuu-data-remote";
|
|
520
|
+
import { useCallback as useCallback6, useEffect as useEffect4, useState as useState5 } from "react";
|
|
521
|
+
var useVuuTables = () => {
|
|
522
|
+
const [tables, setTables] = useState5();
|
|
523
|
+
const buildTables = useCallback6((schemas) => {
|
|
524
|
+
const vuuTables = /* @__PURE__ */ new Map();
|
|
525
|
+
schemas.forEach((schema) => {
|
|
526
|
+
vuuTables.set(schema.table.table, schema);
|
|
527
|
+
});
|
|
528
|
+
return vuuTables;
|
|
529
|
+
}, []);
|
|
530
|
+
useEffect4(() => {
|
|
531
|
+
async function fetchTableMetadata() {
|
|
532
|
+
console.log("GET TABLE LIST");
|
|
533
|
+
const server = await getServerAPI();
|
|
534
|
+
const { tables: tables2 } = await server.getTableList();
|
|
535
|
+
const tableSchemas = buildTables(
|
|
536
|
+
await Promise.all(
|
|
537
|
+
tables2.map((vuuTable) => server.getTableSchema(vuuTable))
|
|
538
|
+
)
|
|
539
|
+
);
|
|
540
|
+
setTables(tableSchemas);
|
|
541
|
+
}
|
|
542
|
+
fetchTableMetadata();
|
|
543
|
+
}, [buildTables]);
|
|
544
|
+
return tables;
|
|
545
|
+
};
|
|
546
|
+
var getVuuTableSchema = (table) => getServerAPI().then((server) => server.getTableSchema(table));
|
|
547
|
+
export {
|
|
548
|
+
MovingWindow,
|
|
549
|
+
addRowsFromInstruments,
|
|
550
|
+
getTypeaheadParams,
|
|
551
|
+
getVuuTableSchema,
|
|
552
|
+
useDataSource,
|
|
553
|
+
useLookupValues,
|
|
554
|
+
useServerConnectionQuality,
|
|
555
|
+
useServerConnectionStatus,
|
|
556
|
+
useTypeaheadSuggestions,
|
|
557
|
+
useVuuMenuActions,
|
|
558
|
+
useVuuTables
|
|
559
|
+
};
|
|
447
560
|
//# sourceMappingURL=index.js.map
|