@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/cjs/index.js
CHANGED
|
@@ -1,447 +1,575 @@
|
|
|
1
|
-
"use strict";var r2=Object.create;var du=Object.defineProperty;var o2=Object.getOwnPropertyDescriptor;var i2=Object.getOwnPropertyNames;var s2=Object.getPrototypeOf,l2=Object.prototype.hasOwnProperty;var sl=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports),a2=(t,e)=>{for(var n in e)du(t,n,{get:e[n],enumerable:!0})},Xv=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of i2(e))!l2.call(t,o)&&o!==n&&du(t,o,{get:()=>e[o],enumerable:!(r=o2(e,o))||r.enumerable});return t};var et=(t,e,n)=>(n=t!=null?r2(s2(t)):{},Xv(e||!t||!t.__esModule?du(n,"default",{value:t,enumerable:!0}):n,t)),u2=t=>Xv(du({},"__esModule",{value:!0}),t);var r0=sl((_5,n0)=>{"use strict";var t0=Object.getOwnPropertySymbols,p2=Object.prototype.hasOwnProperty,m2=Object.prototype.propertyIsEnumerable;function g2(t){if(t==null)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}function v2(){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}}n0.exports=v2()?Object.assign:function(t,e){for(var n,r=g2(t),o,i=1;i<arguments.length;i++){n=Object(arguments[i]);for(var s in n)p2.call(n,s)&&(r[s]=n[s]);if(t0){o=t0(n);for(var l=0;l<o.length;l++)m2.call(n,o[l])&&(r[o[l]]=n[o[l]])}}return r}});var u0=sl(he=>{"use strict";var Bi,ul,gu,Wf;typeof performance=="object"&&typeof performance.now=="function"?(o0=performance,he.unstable_now=function(){return o0.now()}):(Ff=Date,i0=Ff.now(),he.unstable_now=function(){return Ff.now()-i0});var o0,Ff,i0;typeof window>"u"||typeof MessageChannel!="function"?(Fi=null,Bf=null,Vf=function(){if(Fi!==null)try{var t=he.unstable_now();Fi(!0,t),Fi=null}catch(e){throw setTimeout(Vf,0),e}},Bi=function(t){Fi!==null?setTimeout(Bi,0,t):(Fi=t,setTimeout(Vf,0))},ul=function(t,e){Bf=setTimeout(t,e)},gu=function(){clearTimeout(Bf)},he.unstable_shouldYield=function(){return!1},Wf=he.unstable_forceFrameRate=function(){}):(s0=window.setTimeout,l0=window.clearTimeout,typeof console<"u"&&(a0=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 a0!="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")),ll=!1,al=null,hu=-1,zf=5,$f=0,he.unstable_shouldYield=function(){return he.unstable_now()>=$f},Wf=function(){},he.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"):zf=0<t?Math.floor(1e3/t):5},_f=new MessageChannel,pu=_f.port2,_f.port1.onmessage=function(){if(al!==null){var t=he.unstable_now();$f=t+zf;try{al(!0,t)?pu.postMessage(null):(ll=!1,al=null)}catch(e){throw pu.postMessage(null),e}}else ll=!1},Bi=function(t){al=t,ll||(ll=!0,pu.postMessage(null))},ul=function(t,e){hu=s0(function(){t(he.unstable_now())},e)},gu=function(){l0(hu),hu=-1});var Fi,Bf,Vf,s0,l0,a0,ll,al,hu,zf,$f,_f,pu;function Kf(t,e){var n=t.length;t.push(e);e:for(;;){var r=n-1>>>1,o=t[r];if(o!==void 0&&0<mu(o,e))t[r]=e,t[n]=o,n=r;else break e}}function En(t){return t=t[0],t===void 0?null:t}function vu(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>mu(s,n))a!==void 0&&0>mu(a,s)?(t[r]=a,t[l]=n,r=l):(t[r]=s,t[i]=n,r=i);else if(a!==void 0&&0>mu(a,n))t[r]=a,t[l]=n,r=l;else break e}}return e}return null}function mu(t,e){var n=t.sortIndex-e.sortIndex;return n!==0?n:t.id-e.id}var Bn=[],Hr=[],y2=1,sn=null,ft=3,yu=!1,Lo=!1,cl=!1;function Uf(t){for(var e=En(Hr);e!==null;){if(e.callback===null)vu(Hr);else if(e.startTime<=t)vu(Hr),e.sortIndex=e.expirationTime,Kf(Bn,e);else break;e=En(Hr)}}function jf(t){if(cl=!1,Uf(t),!Lo)if(En(Bn)!==null)Lo=!0,Bi(qf);else{var e=En(Hr);e!==null&&ul(jf,e.startTime-t)}}function qf(t,e){Lo=!1,cl&&(cl=!1,gu()),yu=!0;var n=ft;try{for(Uf(e),sn=En(Bn);sn!==null&&(!(sn.expirationTime>e)||t&&!he.unstable_shouldYield());){var r=sn.callback;if(typeof r=="function"){sn.callback=null,ft=sn.priorityLevel;var o=r(sn.expirationTime<=e);e=he.unstable_now(),typeof o=="function"?sn.callback=o:sn===En(Bn)&&vu(Bn),Uf(e)}else vu(Bn);sn=En(Bn)}if(sn!==null)var i=!0;else{var s=En(Hr);s!==null&&ul(jf,s.startTime-e),i=!1}return i}finally{sn=null,ft=n,yu=!1}}var b2=Wf;he.unstable_IdlePriority=5;he.unstable_ImmediatePriority=1;he.unstable_LowPriority=4;he.unstable_NormalPriority=3;he.unstable_Profiling=null;he.unstable_UserBlockingPriority=2;he.unstable_cancelCallback=function(t){t.callback=null};he.unstable_continueExecution=function(){Lo||yu||(Lo=!0,Bi(qf))};he.unstable_getCurrentPriorityLevel=function(){return ft};he.unstable_getFirstCallbackNode=function(){return En(Bn)};he.unstable_next=function(t){switch(ft){case 1:case 2:case 3:var e=3;break;default:e=ft}var n=ft;ft=e;try{return t()}finally{ft=n}};he.unstable_pauseExecution=function(){};he.unstable_requestPaint=b2;he.unstable_runWithPriority=function(t,e){switch(t){case 1:case 2:case 3:case 4:case 5:break;default:t=3}var n=ft;ft=t;try{return e()}finally{ft=n}};he.unstable_scheduleCallback=function(t,e,n){var r=he.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:y2++,callback:e,priorityLevel:t,startTime:n,expirationTime:o,sortIndex:-1},n>r?(t.sortIndex=n,Kf(Hr,t),En(Bn)===null&&t===En(Hr)&&(cl?gu():cl=!0,ul(jf,n-r))):(t.sortIndex=o,Kf(Bn,t),Lo||yu||(Lo=!0,Bi(qf))),t};he.unstable_wrapCallback=function(t){var e=ft;return function(){var n=ft;ft=e;try{return t.apply(this,arguments)}finally{ft=n}}}});var d0=sl((K5,c0)=>{"use strict";c0.exports=u0()});var Yb=sl(fn=>{"use strict";var dc=require("react"),Ce=r0(),tt=d0();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(!dc)throw Error(V(227));var ky=new Set,zl={};function zo(t,e){is(t,e),is(t+"Capture",e)}function is(t,e){for(zl[t]=e,t=0;t<e.length;t++)ky.add(e[t])}var yr=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),x2=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,f0=Object.prototype.hasOwnProperty,h0={},p0={};function w2(t){return f0.call(p0,t)?!0:f0.call(h0,t)?!1:x2.test(t)?p0[t]=!0:(h0[t]=!0,!1)}function S2(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 C2(t,e,n,r){if(e===null||typeof e>"u"||S2(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 kt(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 lt={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){lt[t]=new kt(t,0,!1,t,null,!1,!1)});[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];lt[e]=new kt(e,1,!1,t[1],null,!1,!1)});["contentEditable","draggable","spellCheck","value"].forEach(function(t){lt[t]=new kt(t,2,!1,t.toLowerCase(),null,!1,!1)});["autoReverse","externalResourcesRequired","focusable","preserveAlpha"].forEach(function(t){lt[t]=new kt(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){lt[t]=new kt(t,3,!1,t.toLowerCase(),null,!1,!1)});["checked","multiple","muted","selected"].forEach(function(t){lt[t]=new kt(t,3,!0,t,null,!1,!1)});["capture","download"].forEach(function(t){lt[t]=new kt(t,4,!1,t,null,!1,!1)});["cols","rows","size","span"].forEach(function(t){lt[t]=new kt(t,6,!1,t,null,!1,!1)});["rowSpan","start"].forEach(function(t){lt[t]=new kt(t,5,!1,t.toLowerCase(),null,!1,!1)});var np=/[\-:]([a-z])/g;function rp(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(np,rp);lt[e]=new kt(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(np,rp);lt[e]=new kt(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(np,rp);lt[e]=new kt(e,1,!1,t,"http://www.w3.org/XML/1998/namespace",!1,!1)});["tabIndex","crossOrigin"].forEach(function(t){lt[t]=new kt(t,1,!1,t.toLowerCase(),null,!1,!1)});lt.xlinkHref=new kt("xlinkHref",1,!1,"xlink:href","http://www.w3.org/1999/xlink",!0,!1);["src","href","action","formAction"].forEach(function(t){lt[t]=new kt(t,1,!1,t.toLowerCase(),null,!0,!0)});function op(t,e,n,r){var o=lt.hasOwnProperty(e)?lt[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||(C2(e,n,o,r)&&(n=null),r||o===null?w2(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 $o=dc.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,Cl=60103,Do=60106,Fr=60107,ip=60108,Il=60114,sp=60109,lp=60110,fc=60112,Ll=60113,_u=60120,hc=60115,ap=60116,up=60121,cp=60128,Ey=60129,dp=60130,gh=60131;typeof Symbol=="function"&&Symbol.for&&(qe=Symbol.for,Cl=qe("react.element"),Do=qe("react.portal"),Fr=qe("react.fragment"),ip=qe("react.strict_mode"),Il=qe("react.profiler"),sp=qe("react.provider"),lp=qe("react.context"),fc=qe("react.forward_ref"),Ll=qe("react.suspense"),_u=qe("react.suspense_list"),hc=qe("react.memo"),ap=qe("react.lazy"),up=qe("react.block"),qe("react.scope"),cp=qe("react.opaque.id"),Ey=qe("react.debug_trace_mode"),dp=qe("react.offscreen"),gh=qe("react.legacy_hidden"));var qe,m0=typeof Symbol=="function"&&Symbol.iterator;function dl(t){return t===null||typeof t!="object"?null:(t=m0&&t[m0]||t["@@iterator"],typeof t=="function"?t:null)}var Gf;function kl(t){if(Gf===void 0)try{throw Error()}catch(n){var e=n.stack.trim().match(/\n( *(at )?)/);Gf=e&&e[1]||""}return`
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
`+o[s].replace(" at new "," at ");while(1<=s&&0<=l);break}}}finally{Jf=!1,Error.prepareStackTrace=n}return(t=t?t.displayName||t.name:"")?kl(t):""}function k2(t){switch(t.tag){case 5:return kl(t.type);case 16:return kl("Lazy");case 13:return kl("Suspense");case 19:return kl("SuspenseList");case 0:case 2:case 15:return t=bu(t.type,!1),t;case 11:return t=bu(t.type.render,!1),t;case 22:return t=bu(t.type._render,!1),t;case 1:return t=bu(t.type,!0),t;default:return""}}function Ji(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 Fr:return"Fragment";case Do:return"Portal";case Il:return"Profiler";case ip:return"StrictMode";case Ll:return"Suspense";case _u:return"SuspenseList"}if(typeof t=="object")switch(t.$$typeof){case lp:return(t.displayName||"Context")+".Consumer";case sp:return(t._context.displayName||"Context")+".Provider";case fc:var e=t.render;return e=e.displayName||e.name||"",t.displayName||(e!==""?"ForwardRef("+e+")":"ForwardRef");case hc:return Ji(t.type);case up:return Ji(t._render);case ap:e=t._payload,t=t._init;try{return Ji(t(e))}catch{}}return null}function Jr(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function My(t){var e=t.type;return(t=t.nodeName)&&t.toLowerCase()==="input"&&(e==="checkbox"||e==="radio")}function E2(t){var e=My(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 xu(t){t._valueTracker||(t._valueTracker=E2(t))}function Ty(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=My(t)?t.checked?"true":"false":t.value),t=r,t!==n?(e.setValue(t),!0):!1}function Wu(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 vh(t,e){var n=e.checked;return Ce({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:n!=null?n:t._wrapperState.initialChecked})}function g0(t,e){var n=e.defaultValue==null?"":e.defaultValue,r=e.checked!=null?e.checked:e.defaultChecked;n=Jr(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 Iy(t,e){e=e.checked,e!=null&&op(t,"checked",e,!1)}function yh(t,e){Iy(t,e);var n=Jr(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")?bh(t,e.type,n):e.hasOwnProperty("defaultValue")&&bh(t,e.type,Jr(e.defaultValue)),e.checked==null&&e.defaultChecked!=null&&(t.defaultChecked=!!e.defaultChecked)}function v0(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 bh(t,e,n){(e!=="number"||Wu(t.ownerDocument)!==t)&&(n==null?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}function M2(t){var e="";return dc.Children.forEach(t,function(n){n!=null&&(e+=n)}),e}function xh(t,e){return t=Ce({children:void 0},e),(e=M2(e.children))&&(t.children=e),t}function Zi(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=""+Jr(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 wh(t,e){if(e.dangerouslySetInnerHTML!=null)throw Error(V(91));return Ce({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function y0(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:Jr(n)}}function Ly(t,e){var n=Jr(e.value),r=Jr(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 b0(t){var e=t.textContent;e===t._wrapperState.initialValue&&e!==""&&e!==null&&(t.value=e)}var Sh={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"};function Py(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 Ch(t,e){return t==null||t==="http://www.w3.org/1999/xhtml"?Py(e):t==="http://www.w3.org/2000/svg"&&e==="foreignObject"?"http://www.w3.org/1999/xhtml":t}var wu,Dy=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!==Sh.svg||"innerHTML"in t)t.innerHTML=e;else{for(wu=wu||document.createElement("div"),wu.innerHTML="<svg>"+e.valueOf().toString()+"</svg>",e=wu.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}});function $l(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&n.nodeType===3){n.nodeValue=e;return}}t.textContent=e}var Pl={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},T2=["Webkit","ms","Moz","O"];Object.keys(Pl).forEach(function(t){T2.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),Pl[e]=Pl[t]})});function Ay(t,e,n){return e==null||typeof e=="boolean"||e===""?"":n||typeof e!="number"||e===0||Pl.hasOwnProperty(t)&&Pl[t]?(""+e).trim():e+"px"}function Ry(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=n.indexOf("--")===0,o=Ay(n,e[n],r);n==="float"&&(n="cssFloat"),r?t.setProperty(n,o):t[n]=o}}var I2=Ce({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 kh(t,e){if(e){if(I2[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 Eh(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 fp(t){return t=t.target||t.srcElement||window,t.correspondingUseElement&&(t=t.correspondingUseElement),t.nodeType===3?t.parentNode:t}var Mh=null,Yi=null,Qi=null;function x0(t){if(t=ta(t)){if(typeof Mh!="function")throw Error(V(280));var e=t.stateNode;e&&(e=bc(e),Mh(t.stateNode,t.type,e))}}function Oy(t){Yi?Qi?Qi.push(t):Qi=[t]:Yi=t}function Hy(){if(Yi){var t=Yi,e=Qi;if(Qi=Yi=null,x0(t),e)for(t=0;t<e.length;t++)x0(e[t])}}function hp(t,e){return t(e)}function Ny(t,e,n,r,o){return t(e,n,r,o)}function pp(){}var Fy=hp,Ao=!1,Zf=!1;function mp(){(Yi!==null||Qi!==null)&&(pp(),Hy())}function L2(t,e,n){if(Zf)return t(e,n);Zf=!0;try{return Fy(t,e,n)}finally{Zf=!1,mp()}}function _l(t,e){var n=t.stateNode;if(n===null)return null;var r=bc(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 Th=!1;if(yr)try{Vi={},Object.defineProperty(Vi,"passive",{get:function(){Th=!0}}),window.addEventListener("test",Vi,Vi),window.removeEventListener("test",Vi,Vi)}catch{Th=!1}var Vi;function P2(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 Dl=!1,Ku=null,Uu=!1,Ih=null,D2={onError:function(t){Dl=!0,Ku=t}};function A2(t,e,n,r,o,i,s,l,a){Dl=!1,Ku=null,P2.apply(D2,arguments)}function R2(t,e,n,r,o,i,s,l,a){if(A2.apply(this,arguments),Dl){if(Dl){var u=Ku;Dl=!1,Ku=null}else throw Error(V(198));Uu||(Uu=!0,Ih=u)}}function _o(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 By(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 w0(t){if(_o(t)!==t)throw Error(V(188))}function O2(t){var e=t.alternate;if(!e){if(e=_o(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 w0(o),t;if(i===r)return w0(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 Vy(t){if(t=O2(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 S0(t,e){for(var n=t.alternate;e!==null;){if(e===t||e===n)return!0;e=e.return}return!1}var zy,gp,$y,_y,Lh=!1,Vn=[],$r=null,_r=null,Wr=null,Wl=new Map,Kl=new Map,fl=[],C0="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 Ph(t,e,n,r,o){return{blockedOn:t,domEventName:e,eventSystemFlags:n|16,nativeEvent:o,targetContainers:[r]}}function k0(t,e){switch(t){case"focusin":case"focusout":$r=null;break;case"dragenter":case"dragleave":_r=null;break;case"mouseover":case"mouseout":Wr=null;break;case"pointerover":case"pointerout":Wl.delete(e.pointerId);break;case"gotpointercapture":case"lostpointercapture":Kl.delete(e.pointerId)}}function hl(t,e,n,r,o,i){return t===null||t.nativeEvent!==i?(t=Ph(e,n,r,o,i),e!==null&&(e=ta(e),e!==null&&gp(e)),t):(t.eventSystemFlags|=r,e=t.targetContainers,o!==null&&e.indexOf(o)===-1&&e.push(o),t)}function H2(t,e,n,r,o){switch(e){case"focusin":return $r=hl($r,t,e,n,r,o),!0;case"dragenter":return _r=hl(_r,t,e,n,r,o),!0;case"mouseover":return Wr=hl(Wr,t,e,n,r,o),!0;case"pointerover":var i=o.pointerId;return Wl.set(i,hl(Wl.get(i)||null,t,e,n,r,o)),!0;case"gotpointercapture":return i=o.pointerId,Kl.set(i,hl(Kl.get(i)||null,t,e,n,r,o)),!0}return!1}function N2(t){var e=Ro(t.target);if(e!==null){var n=_o(e);if(n!==null){if(e=n.tag,e===13){if(e=By(n),e!==null){t.blockedOn=e,_y(t.lanePriority,function(){tt.unstable_runWithPriority(t.priority,function(){$y(n)})});return}}else if(e===3&&n.stateNode.hydrate){t.blockedOn=n.tag===3?n.stateNode.containerInfo:null;return}}}t.blockedOn=null}function Au(t){if(t.blockedOn!==null)return!1;for(var e=t.targetContainers;0<e.length;){var n=xp(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n!==null)return e=ta(n),e!==null&&gp(e),t.blockedOn=n,!1;e.shift()}return!0}function E0(t,e,n){Au(t)&&n.delete(e)}function F2(){for(Lh=!1;0<Vn.length;){var t=Vn[0];if(t.blockedOn!==null){t=ta(t.blockedOn),t!==null&&zy(t);break}for(var e=t.targetContainers;0<e.length;){var n=xp(t.domEventName,t.eventSystemFlags,e[0],t.nativeEvent);if(n!==null){t.blockedOn=n;break}e.shift()}t.blockedOn===null&&Vn.shift()}$r!==null&&Au($r)&&($r=null),_r!==null&&Au(_r)&&(_r=null),Wr!==null&&Au(Wr)&&(Wr=null),Wl.forEach(E0),Kl.forEach(E0)}function pl(t,e){t.blockedOn===e&&(t.blockedOn=null,Lh||(Lh=!0,tt.unstable_scheduleCallback(tt.unstable_NormalPriority,F2)))}function Wy(t){function e(o){return pl(o,t)}if(0<Vn.length){pl(Vn[0],t);for(var n=1;n<Vn.length;n++){var r=Vn[n];r.blockedOn===t&&(r.blockedOn=null)}}for($r!==null&&pl($r,t),_r!==null&&pl(_r,t),Wr!==null&&pl(Wr,t),Wl.forEach(e),Kl.forEach(e),n=0;n<fl.length;n++)r=fl[n],r.blockedOn===t&&(r.blockedOn=null);for(;0<fl.length&&(n=fl[0],n.blockedOn===null);)N2(n),n.blockedOn===null&&fl.shift()}function Su(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n}var Wi={animationend:Su("Animation","AnimationEnd"),animationiteration:Su("Animation","AnimationIteration"),animationstart:Su("Animation","AnimationStart"),transitionend:Su("Transition","TransitionEnd")},Yf={},Ky={};yr&&(Ky=document.createElement("div").style,"AnimationEvent"in window||(delete Wi.animationend.animation,delete Wi.animationiteration.animation,delete Wi.animationstart.animation),"TransitionEvent"in window||delete Wi.transitionend.transition);function pc(t){if(Yf[t])return Yf[t];if(!Wi[t])return t;var e=Wi[t],n;for(n in e)if(e.hasOwnProperty(n)&&n in Ky)return Yf[t]=e[n];return t}var Uy=pc("animationend"),jy=pc("animationiteration"),qy=pc("animationstart"),Gy=pc("transitionend"),Jy=new Map,vp=new Map,B2=["abort","abort",Uy,"animationEnd",jy,"animationIteration",qy,"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",Gy,"transitionEnd","waiting","waiting"];function yp(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)),vp.set(r,e),Jy.set(r,o),zo(o,[r])}}var V2=tt.unstable_now;V2();var ve=8;function $i(t){if(1&t)return ve=15,1;if(2&t)return ve=14,2;if(4&t)return ve=13,4;var e=24&t;return e!==0?(ve=12,e):t&32?(ve=11,32):(e=192&t,e!==0?(ve=10,e):t&256?(ve=9,256):(e=3584&t,e!==0?(ve=8,e):t&4096?(ve=7,4096):(e=4186112&t,e!==0?(ve=6,e):(e=62914560&t,e!==0?(ve=5,e):t&67108864?(ve=4,67108864):t&134217728?(ve=3,134217728):(e=805306368&t,e!==0?(ve=2,e):1073741824&t?(ve=1,1073741824):(ve=8,t))))))}function z2(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 $2(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 Ul(t,e){var n=t.pendingLanes;if(n===0)return ve=0;var r=0,o=0,i=t.expiredLanes,s=t.suspendedLanes,l=t.pingedLanes;if(i!==0)r=i,o=ve=15;else if(i=n&134217727,i!==0){var a=i&~s;a!==0?(r=$i(a),o=ve):(l&=i,l!==0&&(r=$i(l),o=ve))}else i=n&~s,i!==0?(r=$i(i),o=ve):l!==0&&(r=$i(l),o=ve);if(r===0)return 0;if(r=31-Zr(r),r=n&((0>r?0:1<<r)<<1)-1,e!==0&&e!==r&&!(e&s)){if($i(e),o<=ve)return e;ve=o}if(e=t.entangledLanes,e!==0)for(t=t.entanglements,e&=r;0<e;)n=31-Zr(e),o=1<<n,r|=t[n],e&=~o;return r}function Zy(t){return t=t.pendingLanes&-1073741825,t!==0?t:t&1073741824?1073741824:0}function ju(t,e){switch(t){case 15:return 1;case 14:return 2;case 12:return t=_i(24&~e),t===0?ju(10,e):t;case 10:return t=_i(192&~e),t===0?ju(8,e):t;case 8:return t=_i(3584&~e),t===0&&(t=_i(4186112&~e),t===0&&(t=512)),t;case 2:return e=_i(805306368&~e),e===0&&(e=268435456),e}throw Error(V(358,t))}function _i(t){return t&-t}function Qf(t){for(var e=[],n=0;31>n;n++)e.push(t);return e}function mc(t,e,n){t.pendingLanes|=e;var r=e-1;t.suspendedLanes&=r,t.pingedLanes&=r,t=t.eventTimes,e=31-Zr(e),t[e]=n}var Zr=Math.clz32?Math.clz32:K2,_2=Math.log,W2=Math.LN2;function K2(t){return t===0?32:31-(_2(t)/W2|0)|0}var U2=tt.unstable_UserBlockingPriority,j2=tt.unstable_runWithPriority,Ru=!0;function q2(t,e,n,r){Ao||pp();var o=bp,i=Ao;Ao=!0;try{Ny(o,t,e,n,r)}finally{(Ao=i)||mp()}}function G2(t,e,n,r){j2(U2,bp.bind(null,t,e,n,r))}function bp(t,e,n,r){if(Ru){var o;if((o=(e&4)===0)&&0<Vn.length&&-1<C0.indexOf(t))t=Ph(null,t,e,n,r),Vn.push(t);else{var i=xp(t,e,n,r);if(i===null)o&&k0(t,r);else{if(o){if(-1<C0.indexOf(t)){t=Ph(i,t,e,n,r),Vn.push(t);return}if(H2(i,t,e,n,r))return;k0(t,r)}ub(t,e,r,null,n)}}}}function xp(t,e,n,r){var o=fp(r);if(o=Ro(o),o!==null){var i=_o(o);if(i===null)o=null;else{var s=i.tag;if(s===13){if(o=By(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 ub(t,e,r,o,n),null}var Br=null,wp=null,Ou=null;function Yy(){if(Ou)return Ou;var t,e=wp,n=e.length,r,o="value"in Br?Br.value:Br.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 Ou=o.slice(t,1<r?1-r:void 0)}function Hu(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 Cu(){return!0}function M0(){return!1}function Ut(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)?Cu:M0,this.isPropagationStopped=M0,this}return Ce(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=Cu)},stopPropagation:function(){var n=this.nativeEvent;n&&(n.stopPropagation?n.stopPropagation():typeof n.cancelBubble!="unknown"&&(n.cancelBubble=!0),this.isPropagationStopped=Cu)},persist:function(){},isPersistent:Cu}),e}var us={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Sp=Ut(us),ea=Ce({},us,{view:0,detail:0}),J2=Ut(ea),Xf,eh,ml,gc=Ce({},ea,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:Cp,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!==ml&&(ml&&t.type==="mousemove"?(Xf=t.screenX-ml.screenX,eh=t.screenY-ml.screenY):eh=Xf=0,ml=t),Xf)},movementY:function(t){return"movementY"in t?t.movementY:eh}}),T0=Ut(gc),Z2=Ce({},gc,{dataTransfer:0}),Y2=Ut(Z2),Q2=Ce({},ea,{relatedTarget:0}),th=Ut(Q2),X2=Ce({},us,{animationName:0,elapsedTime:0,pseudoElement:0}),e3=Ut(X2),t3=Ce({},us,{clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),n3=Ut(t3),r3=Ce({},us,{data:0}),I0=Ut(r3),o3={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},i3={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"},s3={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function l3(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):(t=s3[t])?!!e[t]:!1}function Cp(){return l3}var a3=Ce({},ea,{key:function(t){if(t.key){var e=o3[t.key]||t.key;if(e!=="Unidentified")return e}return t.type==="keypress"?(t=Hu(t),t===13?"Enter":String.fromCharCode(t)):t.type==="keydown"||t.type==="keyup"?i3[t.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:Cp,charCode:function(t){return t.type==="keypress"?Hu(t):0},keyCode:function(t){return t.type==="keydown"||t.type==="keyup"?t.keyCode:0},which:function(t){return t.type==="keypress"?Hu(t):t.type==="keydown"||t.type==="keyup"?t.keyCode:0}}),u3=Ut(a3),c3=Ce({},gc,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),L0=Ut(c3),d3=Ce({},ea,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:Cp}),f3=Ut(d3),h3=Ce({},us,{propertyName:0,elapsedTime:0,pseudoElement:0}),p3=Ut(h3),m3=Ce({},gc,{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}),g3=Ut(m3),v3=[9,13,27,32],kp=yr&&"CompositionEvent"in window,Al=null;yr&&"documentMode"in document&&(Al=document.documentMode);var y3=yr&&"TextEvent"in window&&!Al,Qy=yr&&(!kp||Al&&8<Al&&11>=Al),P0=" ",D0=!1;function Xy(t,e){switch(t){case"keyup":return v3.indexOf(e.keyCode)!==-1;case"keydown":return e.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function eb(t){return t=t.detail,typeof t=="object"&&"data"in t?t.data:null}var Ki=!1;function b3(t,e){switch(t){case"compositionend":return eb(e);case"keypress":return e.which!==32?null:(D0=!0,P0);case"textInput":return t=e.data,t===P0&&D0?null:t;default:return null}}function x3(t,e){if(Ki)return t==="compositionend"||!kp&&Xy(t,e)?(t=Yy(),Ou=wp=Br=null,Ki=!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 Qy&&e.locale!=="ko"?null:e.data;default:return null}}var w3={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 A0(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e==="input"?!!w3[t.type]:e==="textarea"}function tb(t,e,n,r){Oy(r),e=qu(e,"onChange"),0<e.length&&(n=new Sp("onChange","change",null,n,r),t.push({event:n,listeners:e}))}var Rl=null,jl=null;function S3(t){sb(t,0)}function vc(t){var e=ji(t);if(Ty(e))return t}function C3(t,e){if(t==="change")return e}var nb=!1;yr&&(yr?(Eu="oninput"in document,Eu||(nh=document.createElement("div"),nh.setAttribute("oninput","return;"),Eu=typeof nh.oninput=="function"),ku=Eu):ku=!1,nb=ku&&(!document.documentMode||9<document.documentMode));var ku,Eu,nh;function R0(){Rl&&(Rl.detachEvent("onpropertychange",rb),jl=Rl=null)}function rb(t){if(t.propertyName==="value"&&vc(jl)){var e=[];if(tb(e,jl,t,fp(t)),t=S3,Ao)t(e);else{Ao=!0;try{hp(t,e)}finally{Ao=!1,mp()}}}}function k3(t,e,n){t==="focusin"?(R0(),Rl=e,jl=n,Rl.attachEvent("onpropertychange",rb)):t==="focusout"&&R0()}function E3(t){if(t==="selectionchange"||t==="keyup"||t==="keydown")return vc(jl)}function M3(t,e){if(t==="click")return vc(e)}function T3(t,e){if(t==="input"||t==="change")return vc(e)}function I3(t,e){return t===e&&(t!==0||1/t===1/e)||t!==t&&e!==e}var ln=typeof Object.is=="function"?Object.is:I3,L3=Object.prototype.hasOwnProperty;function ql(t,e){if(ln(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(!L3.call(e,n[r])||!ln(t[n[r]],e[n[r]]))return!1;return!0}function O0(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function H0(t,e){var n=O0(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=O0(n)}}function ob(t,e){return t&&e?t===e?!0:t&&t.nodeType===3?!1:e&&e.nodeType===3?ob(t,e.parentNode):"contains"in t?t.contains(e):t.compareDocumentPosition?!!(t.compareDocumentPosition(e)&16):!1:!1}function N0(){for(var t=window,e=Wu();e instanceof t.HTMLIFrameElement;){try{var n=typeof e.contentWindow.location.href=="string"}catch{n=!1}if(n)t=e.contentWindow;else break;e=Wu(t.document)}return e}function Dh(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 P3=yr&&"documentMode"in document&&11>=document.documentMode,Ui=null,Ah=null,Ol=null,Rh=!1;function F0(t,e,n){var r=n.window===n?n.document:n.nodeType===9?n:n.ownerDocument;Rh||Ui==null||Ui!==Wu(r)||(r=Ui,"selectionStart"in r&&Dh(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}),Ol&&ql(Ol,r)||(Ol=r,r=qu(Ah,"onSelect"),0<r.length&&(e=new Sp("onSelect","select",null,e,n),t.push({event:e,listeners:r}),e.target=Ui)))}yp("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);yp("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);yp(B2,2);for(rh="change selectionchange textInput compositionstart compositionend compositionupdate".split(" "),Mu=0;Mu<rh.length;Mu++)vp.set(rh[Mu],0);var rh,Mu;is("onMouseEnter",["mouseout","mouseover"]);is("onMouseLeave",["mouseout","mouseover"]);is("onPointerEnter",["pointerout","pointerover"]);is("onPointerLeave",["pointerout","pointerover"]);zo("onChange","change click focusin focusout input keydown keyup selectionchange".split(" "));zo("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" "));zo("onBeforeInput",["compositionend","keypress","textInput","paste"]);zo("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" "));zo("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" "));zo("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var El="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),ib=new Set("cancel close invalid load scroll toggle".split(" ").concat(El));function B0(t,e,n){var r=t.type||"unknown-event";t.currentTarget=n,R2(r,e,void 0,t),t.currentTarget=null}function sb(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;B0(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;B0(o,l,u),i=a}}}if(Uu)throw t=Ih,Uu=!1,Ih=null,t}function be(t,e){var n=db(e),r=t+"__bubble";n.has(r)||(ab(e,t,2,!1),n.add(r))}var V0="_reactListening"+Math.random().toString(36).slice(2);function lb(t){t[V0]||(t[V0]=!0,ky.forEach(function(e){ib.has(e)||z0(e,!1,t,null),z0(e,!0,t,null)}))}function z0(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&&ib.has(t)){if(t!=="scroll")return;o|=2,i=r}var s=db(i),l=t+"__"+(e?"capture":"bubble");s.has(l)||(e&&(o|=4),ab(i,t,o,e),s.add(l))}function ab(t,e,n,r){var o=vp.get(e);switch(o===void 0?2:o){case 0:o=q2;break;case 1:o=G2;break;default:o=bp}n=o.bind(null,e,n,t),o=void 0,!Th||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 ub(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=Ro(l),s===null)return;if(a=s.tag,a===5||a===6){r=i=s;continue e}l=l.parentNode}}r=r.return}L2(function(){var u=i,c=fp(n),f=[];e:{var d=Jy.get(t);if(d!==void 0){var h=Sp,g=t;switch(t){case"keypress":if(Hu(n)===0)break e;case"keydown":case"keyup":h=u3;break;case"focusin":g="focus",h=th;break;case"focusout":g="blur",h=th;break;case"beforeblur":case"afterblur":h=th;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=T0;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":h=Y2;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":h=f3;break;case Uy:case jy:case qy:h=e3;break;case Gy:h=p3;break;case"scroll":h=J2;break;case"wheel":h=g3;break;case"copy":case"cut":case"paste":h=n3;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":h=L0}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=_l(y,m),b!=null&&v.push(Gl(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)&&(Ro(g)||g[cs]))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?Ro(g):null,g!==null&&(p=_o(g),g!==p||g.tag!==5&&g.tag!==6)&&(g=null)):(h=null,g=u),h!==g)){if(v=T0,b="onMouseLeave",m="onMouseEnter",y="mouse",(t==="pointerout"||t==="pointerover")&&(v=L0,b="onPointerLeave",m="onPointerEnter",y="pointer"),p=h==null?d:ji(h),x=g==null?d:ji(g),d=new v(b,y+"leave",h,n,c),d.target=p,d.relatedTarget=x,b=null,Ro(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=zi(x))y++;for(x=0,b=m;b;b=zi(b))x++;for(;0<y-x;)v=zi(v),y--;for(;0<x-y;)m=zi(m),x--;for(;y--;){if(v===m||m!==null&&v===m.alternate)break t;v=zi(v),m=zi(m)}v=null}else v=null;h!==null&&$0(f,d,h,v,!1),g!==null&&p!==null&&$0(f,p,g,v,!0)}}e:{if(d=u?ji(u):window,h=d.nodeName&&d.nodeName.toLowerCase(),h==="select"||h==="input"&&d.type==="file")var C=C3;else if(A0(d))if(nb)C=T3;else{C=E3;var w=k3}else(h=d.nodeName)&&h.toLowerCase()==="input"&&(d.type==="checkbox"||d.type==="radio")&&(C=M3);if(C&&(C=C(t,u))){tb(f,C,n,c);break e}w&&w(t,d,u),t==="focusout"&&(w=d._wrapperState)&&w.controlled&&d.type==="number"&&bh(d,"number",d.value)}switch(w=u?ji(u):window,t){case"focusin":(A0(w)||w.contentEditable==="true")&&(Ui=w,Ah=u,Ol=null);break;case"focusout":Ol=Ah=Ui=null;break;case"mousedown":Rh=!0;break;case"contextmenu":case"mouseup":case"dragend":Rh=!1,F0(f,n,c);break;case"selectionchange":if(P3)break;case"keydown":case"keyup":F0(f,n,c)}var S;if(kp)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 Ki?Xy(t,n)&&(E="onCompositionEnd"):t==="keydown"&&n.keyCode===229&&(E="onCompositionStart");E&&(Qy&&n.locale!=="ko"&&(Ki||E!=="onCompositionStart"?E==="onCompositionEnd"&&Ki&&(S=Yy()):(Br=c,wp="value"in Br?Br.value:Br.textContent,Ki=!0)),w=qu(u,E),0<w.length&&(E=new I0(E,t,null,n,c),f.push({event:E,listeners:w}),S?E.data=S:(S=eb(n),S!==null&&(E.data=S)))),(S=y3?b3(t,n):x3(t,n))&&(u=qu(u,"onBeforeInput"),0<u.length&&(c=new I0("onBeforeInput","beforeinput",null,n,c),f.push({event:c,listeners:u}),c.data=S))}sb(f,e)})}function Gl(t,e,n){return{instance:t,listener:e,currentTarget:n}}function qu(t,e){for(var n=e+"Capture",r=[];t!==null;){var o=t,i=o.stateNode;o.tag===5&&i!==null&&(o=i,i=_l(t,n),i!=null&&r.unshift(Gl(t,i,o)),i=_l(t,e),i!=null&&r.push(Gl(t,i,o))),t=t.return}return r}function zi(t){if(t===null)return null;do t=t.return;while(t&&t.tag!==5);return t||null}function $0(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=_l(n,i),a!=null&&s.unshift(Gl(n,a,l))):o||(a=_l(n,i),a!=null&&s.push(Gl(n,a,l)))),n=n.return}s.length!==0&&t.push({event:e,listeners:s})}function Gu(){}var oh=null,ih=null;function cb(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function Oh(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 _0=typeof setTimeout=="function"?setTimeout:void 0,D3=typeof clearTimeout=="function"?clearTimeout:void 0;function Ep(t){t.nodeType===1?t.textContent="":t.nodeType===9&&(t=t.body,t!=null&&(t.textContent=""))}function Xi(t){for(;t!=null;t=t.nextSibling){var e=t.nodeType;if(e===1||e===3)break}return t}function W0(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 sh=0;function A3(t){return{$$typeof:cp,toString:t,valueOf:t}}var yc=Math.random().toString(36).slice(2),Vr="__reactFiber$"+yc,Ju="__reactProps$"+yc,cs="__reactContainer$"+yc,K0="__reactEvents$"+yc;function Ro(t){var e=t[Vr];if(e)return e;for(var n=t.parentNode;n;){if(e=n[cs]||n[Vr]){if(n=e.alternate,e.child!==null||n!==null&&n.child!==null)for(t=W0(t);t!==null;){if(n=t[Vr])return n;t=W0(t)}return e}t=n,n=t.parentNode}return null}function ta(t){return t=t[Vr]||t[cs],!t||t.tag!==5&&t.tag!==6&&t.tag!==13&&t.tag!==3?null:t}function ji(t){if(t.tag===5||t.tag===6)return t.stateNode;throw Error(V(33))}function bc(t){return t[Ju]||null}function db(t){var e=t[K0];return e===void 0&&(e=t[K0]=new Set),e}var Hh=[],qi=-1;function eo(t){return{current:t}}function xe(t){0>qi||(t.current=Hh[qi],Hh[qi]=null,qi--)}function Ae(t,e){qi++,Hh[qi]=t.current,t.current=e}var Yr={},gt=eo(Yr),Ht=eo(!1),Fo=Yr;function ss(t,e){var n=t.type.contextTypes;if(!n)return Yr;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 Nt(t){return t=t.childContextTypes,t!=null}function Zu(){xe(Ht),xe(gt)}function U0(t,e,n){if(gt.current!==Yr)throw Error(V(168));Ae(gt,e),Ae(Ht,n)}function fb(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,Ji(e)||"Unknown",o));return Ce({},n,r)}function Nu(t){return t=(t=t.stateNode)&&t.__reactInternalMemoizedMergedChildContext||Yr,Fo=gt.current,Ae(gt,t),Ae(Ht,Ht.current),!0}function j0(t,e,n){var r=t.stateNode;if(!r)throw Error(V(169));n?(t=fb(t,e,Fo),r.__reactInternalMemoizedMergedChildContext=t,xe(Ht),xe(gt),Ae(gt,t)):xe(Ht),Ae(Ht,n)}var Mp=null,No=null,R3=tt.unstable_runWithPriority,Tp=tt.unstable_scheduleCallback,Nh=tt.unstable_cancelCallback,O3=tt.unstable_shouldYield,q0=tt.unstable_requestPaint,Fh=tt.unstable_now,H3=tt.unstable_getCurrentPriorityLevel,xc=tt.unstable_ImmediatePriority,hb=tt.unstable_UserBlockingPriority,pb=tt.unstable_NormalPriority,mb=tt.unstable_LowPriority,gb=tt.unstable_IdlePriority,lh={},N3=q0!==void 0?q0:function(){},hr=null,Fu=null,ah=!1,G0=Fh(),pt=1e4>G0?Fh:function(){return Fh()-G0};function ls(){switch(H3()){case xc:return 99;case hb:return 98;case pb:return 97;case mb:return 96;case gb:return 95;default:throw Error(V(332))}}function vb(t){switch(t){case 99:return xc;case 98:return hb;case 97:return pb;case 96:return mb;case 95:return gb;default:throw Error(V(332))}}function Bo(t,e){return t=vb(t),R3(t,e)}function Jl(t,e,n){return t=vb(t),Tp(t,e,n)}function Kn(){if(Fu!==null){var t=Fu;Fu=null,Nh(t)}yb()}function yb(){if(!ah&&hr!==null){ah=!0;var t=0;try{var e=hr;Bo(99,function(){for(;t<e.length;t++){var n=e[t];do n=n(!0);while(n!==null)}}),hr=null}catch(n){throw hr!==null&&(hr=hr.slice(t+1)),Tp(xc,Kn),n}finally{ah=!1}}}var F3=$o.ReactCurrentBatchConfig;function Mn(t,e){if(t&&t.defaultProps){e=Ce({},e),t=t.defaultProps;for(var n in t)e[n]===void 0&&(e[n]=t[n]);return e}return e}var Yu=eo(null),Qu=null,Gi=null,Xu=null;function Ip(){Xu=Gi=Qu=null}function Lp(t){var e=Yu.current;xe(Yu),t.type._context._currentValue=e}function bb(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 es(t,e){Qu=t,Xu=Gi=null,t=t.dependencies,t!==null&&t.firstContext!==null&&(t.lanes&e&&(Tn=!0),t.firstContext=null)}function cn(t,e){if(Xu!==t&&e!==!1&&e!==0)if((typeof e!="number"||e===1073741823)&&(Xu=t,e=1073741823),e={context:t,observedBits:e,next:null},Gi===null){if(Qu===null)throw Error(V(308));Gi=e,Qu.dependencies={lanes:0,firstContext:e,responders:null}}else Gi=Gi.next=e;return t._currentValue}var Nr=!1;function Pp(t){t.updateQueue={baseState:t.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null},effects:null}}function xb(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 Kr(t,e){return{eventTime:t,lane:e,tag:0,payload:null,callback:null,next:null}}function Ur(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 J0(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 Zl(t,e,n,r){var o=t.updateQueue;Nr=!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=Ce({},f,l);break e;case 2:Nr=!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,ra|=s,t.lanes=s,t.memoizedState=f}}function Z0(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 wb=new dc.Component().refs;function ec(t,e,n,r){e=t.memoizedState,n=n(r,e),n=n==null?e:Ce({},e,n),t.memoizedState=n,t.lanes===0&&(t.updateQueue.baseState=n)}var wc={isMounted:function(t){return(t=t._reactInternals)?_o(t)===t:!1},enqueueSetState:function(t,e,n){t=t._reactInternals;var r=Kt(),o=jr(t),i=Kr(r,o);i.payload=e,n!=null&&(i.callback=n),Ur(t,i),qr(t,o,r)},enqueueReplaceState:function(t,e,n){t=t._reactInternals;var r=Kt(),o=jr(t),i=Kr(r,o);i.tag=1,i.payload=e,n!=null&&(i.callback=n),Ur(t,i),qr(t,o,r)},enqueueForceUpdate:function(t,e){t=t._reactInternals;var n=Kt(),r=jr(t),o=Kr(n,r);o.tag=2,e!=null&&(o.callback=e),Ur(t,o),qr(t,r,n)}};function Y0(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?!ql(n,r)||!ql(o,i):!0}function Sb(t,e,n){var r=!1,o=Yr,i=e.contextType;return typeof i=="object"&&i!==null?i=cn(i):(o=Nt(e)?Fo:gt.current,r=e.contextTypes,i=(r=r!=null)?ss(t,o):Yr),e=new e(n,i),t.memoizedState=e.state!==null&&e.state!==void 0?e.state:null,e.updater=wc,t.stateNode=e,e._reactInternals=t,r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=o,t.__reactInternalMemoizedMaskedChildContext=i),e}function Q0(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&&wc.enqueueReplaceState(e,e.state,null)}function Bh(t,e,n,r){var o=t.stateNode;o.props=n,o.state=t.memoizedState,o.refs=wb,Pp(t);var i=e.contextType;typeof i=="object"&&i!==null?o.context=cn(i):(i=Nt(e)?Fo:gt.current,o.context=ss(t,i)),Zl(t,n,o,r),o.state=t.memoizedState,i=e.getDerivedStateFromProps,typeof i=="function"&&(ec(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&&wc.enqueueReplaceState(o,o.state,null),Zl(t,n,o,r),o.state=t.memoizedState),typeof o.componentDidMount=="function"&&(t.flags|=4)}var Tu=Array.isArray;function gl(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===wb&&(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 Iu(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 Cb(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=Xr(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=hh(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=gl(p,m,y),x.return=p,x):(x=$u(y.type,y.key,y.props,null,p.mode,x),x.ref=gl(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=ph(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=os(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=hh(""+m,p.mode,y),m.return=p,m;if(typeof m=="object"&&m!==null){switch(m.$$typeof){case Cl:return y=$u(m.type,m.key,m.props,null,p.mode,y),y.ref=gl(p,null,m),y.return=p,y;case Do:return m=ph(m,p.mode,y),m.return=p,m}if(Tu(m)||dl(m))return m=os(m,p.mode,y,null),m.return=p,m;Iu(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 Cl:return y.key===b?y.type===Fr?c(p,m,y.props.children,x,b):a(p,m,y,x):null;case Do:return y.key===b?u(p,m,y,x):null}if(Tu(y)||dl(y))return b!==null?null:c(p,m,y,x,null);Iu(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 Cl:return p=p.get(x.key===null?y:x.key)||null,x.type===Fr?c(m,p,x.props.children,b,x.key):a(m,p,x,b);case Do:return p=p.get(x.key===null?y:x.key)||null,u(m,p,x,b)}if(Tu(x)||dl(x))return p=p.get(y)||null,c(m,p,x,b,null);Iu(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=dl(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===Fr&&y.key===null;b&&(y=y.props.children);var C=typeof y=="object"&&y!==null;if(C)switch(y.$$typeof){case Cl:e:{for(C=y.key,b=m;b!==null;){if(b.key===C){switch(b.tag){case 7:if(y.type===Fr){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=gl(p,b,y),m.return=p,p=m;break e}}n(p,b);break}else e(p,b);b=b.sibling}y.type===Fr?(m=os(y.props.children,p.mode,x,y.key),m.return=p,p=m):(x=$u(y.type,y.key,y.props,null,p.mode,x),x.ref=gl(p,m,y),x.return=p,p=x)}return s(p);case Do: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=ph(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=hh(y,p.mode,x),m.return=p,p=m),s(p);if(Tu(y))return g(p,m,y,x);if(dl(y))return v(p,m,y,x);if(C&&Iu(p,y),typeof y>"u"&&!b)switch(p.tag){case 1:case 22:case 0:case 11:case 15:throw Error(V(152,Ji(p.type)||"Component"))}return n(p,m)}}var tc=Cb(!0),kb=Cb(!1),na={},_n=eo(na),Yl=eo(na),Ql=eo(na);function Oo(t){if(t===na)throw Error(V(174));return t}function Vh(t,e){switch(Ae(Ql,e),Ae(Yl,t),Ae(_n,na),t=e.nodeType,t){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:Ch(null,"");break;default:t=t===8?e.parentNode:e,e=t.namespaceURI||null,t=t.tagName,e=Ch(e,t)}xe(_n),Ae(_n,e)}function as(){xe(_n),xe(Yl),xe(Ql)}function X0(t){Oo(Ql.current);var e=Oo(_n.current),n=Ch(e,t.type);e!==n&&(Ae(Yl,t),Ae(_n,n))}function Dp(t){Yl.current===t&&(xe(_n),xe(Yl))}var De=eo(0);function nc(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 mr=null,zr=null,Wn=!1;function Eb(t,e){var n=an(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 ey(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 zh(t){if(Wn){var e=zr;if(e){var n=e;if(!ey(t,e)){if(e=Xi(n.nextSibling),!e||!ey(t,e)){t.flags=t.flags&-1025|2,Wn=!1,mr=t;return}Eb(mr,n)}mr=t,zr=Xi(e.firstChild)}else t.flags=t.flags&-1025|2,Wn=!1,mr=t}}function ty(t){for(t=t.return;t!==null&&t.tag!==5&&t.tag!==3&&t.tag!==13;)t=t.return;mr=t}function Lu(t){if(t!==mr)return!1;if(!Wn)return ty(t),Wn=!0,!1;var e=t.type;if(t.tag!==5||e!=="head"&&e!=="body"&&!Oh(e,t.memoizedProps))for(e=zr;e;)Eb(t,e),e=Xi(e.nextSibling);if(ty(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){zr=Xi(t.nextSibling);break e}e--}else n!=="$"&&n!=="$!"&&n!=="$?"||e++}t=t.nextSibling}zr=null}}else zr=mr?Xi(t.stateNode.nextSibling):null;return!0}function uh(){zr=mr=null,Wn=!1}var ts=[];function Ap(){for(var t=0;t<ts.length;t++)ts[t]._workInProgressVersionPrimary=null;ts.length=0}var Hl=$o.ReactCurrentDispatcher,un=$o.ReactCurrentBatchConfig,Xl=0,Oe=null,ht=null,it=null,rc=!1,Nl=!1;function Rt(){throw Error(V(321))}function Rp(t,e){if(e===null)return!1;for(var n=0;n<e.length&&n<t.length;n++)if(!ln(t[n],e[n]))return!1;return!0}function Op(t,e,n,r,o,i){if(Xl=i,Oe=e,e.memoizedState=null,e.updateQueue=null,e.lanes=0,Hl.current=t===null||t.memoizedState===null?V3:z3,t=n(r,o),Nl){i=0;do{if(Nl=!1,!(25>i))throw Error(V(301));i+=1,it=ht=null,e.updateQueue=null,Hl.current=$3,t=n(r,o)}while(Nl)}if(Hl.current=lc,e=ht!==null&&ht.next!==null,Xl=0,it=ht=Oe=null,rc=!1,e)throw Error(V(300));return t}function Ho(){var t={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return it===null?Oe.memoizedState=it=t:it=it.next=t,it}function Wo(){if(ht===null){var t=Oe.alternate;t=t!==null?t.memoizedState:null}else t=ht.next;var e=it===null?Oe.memoizedState:it.next;if(e!==null)it=e,ht=t;else{if(t===null)throw Error(V(310));ht=t,t={memoizedState:ht.memoizedState,baseState:ht.baseState,baseQueue:ht.baseQueue,queue:ht.queue,next:null},it===null?Oe.memoizedState=it=t:it=it.next=t}return it}function zn(t,e){return typeof e=="function"?e(t):e}function vl(t){var e=Wo(),n=e.queue;if(n===null)throw Error(V(311));n.lastRenderedReducer=t;var r=ht,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((Xl&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,Oe.lanes|=u,ra|=u}a=a.next}while(a!==null&&a!==o);l===null?i=r:l.next=s,ln(r,e.memoizedState)||(Tn=!0),e.memoizedState=r,e.baseState=i,e.baseQueue=l,n.lastRenderedState=r}return[e.memoizedState,n.dispatch]}function yl(t){var e=Wo(),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);ln(i,e.memoizedState)||(Tn=!0),e.memoizedState=i,e.baseQueue===null&&(e.baseState=i),n.lastRenderedState=i}return[i,r]}function ny(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=(Xl&t)===t)&&(e._workInProgressVersionPrimary=r,ts.push(e))),t)return n(e._source);throw ts.push(e),Error(V(350))}function Mb(t,e,n,r){var o=Ct;if(o===null)throw Error(V(349));var i=e._getVersion,s=i(e._source),l=Hl.current,a=l.useState(function(){return ny(o,e,n)}),u=a[1],c=a[0];a=it;var f=t.memoizedState,d=f.refs,h=d.getSnapshot,g=f.source;f=f.subscribe;var v=Oe;return t.memoizedState={refs:d,source:e,subscribe:r},l.useEffect(function(){d.getSnapshot=n,d.setSnapshot=u;var p=i(e._source);if(!ln(s,p)){p=n(e._source),ln(c,p)||(u(p),p=jr(v),o.mutableReadLanes|=p&o.pendingLanes),p=o.mutableReadLanes,o.entangledLanes|=p;for(var m=o.entanglements,y=p;0<y;){var x=31-Zr(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=jr(v);o.mutableReadLanes|=y&o.pendingLanes}catch(x){m(function(){throw x})}})},[e,r]),ln(h,n)&&ln(g,e)&&ln(f,r)||(t={pending:null,dispatch:null,lastRenderedReducer:zn,lastRenderedState:c},t.dispatch=u=Fp.bind(null,Oe,t),a.queue=t,a.baseQueue=null,c=ny(o,e,n),a.memoizedState=a.baseState=c),c}function Tb(t,e,n){var r=Wo();return Mb(r,t,e,n)}function bl(t){var e=Ho();return typeof t=="function"&&(t=t()),e.memoizedState=e.baseState=t,t=e.queue={pending:null,dispatch:null,lastRenderedReducer:zn,lastRenderedState:t},t=t.dispatch=Fp.bind(null,Oe,t),[e.memoizedState,t]}function oc(t,e,n,r){return t={tag:t,create:e,destroy:n,deps:r,next:null},e=Oe.updateQueue,e===null?(e={lastEffect:null},Oe.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 ry(t){var e=Ho();return t={current:t},e.memoizedState=t}function ic(){return Wo().memoizedState}function $h(t,e,n,r){var o=Ho();Oe.flags|=t,o.memoizedState=oc(1|e,n,void 0,r===void 0?null:r)}function Hp(t,e,n,r){var o=Wo();r=r===void 0?null:r;var i=void 0;if(ht!==null){var s=ht.memoizedState;if(i=s.destroy,r!==null&&Rp(r,s.deps)){oc(e,n,i,r);return}}Oe.flags|=t,o.memoizedState=oc(1|e,n,i,r)}function oy(t,e){return $h(516,4,t,e)}function sc(t,e){return Hp(516,4,t,e)}function Ib(t,e){return Hp(4,2,t,e)}function Lb(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 Pb(t,e,n){return n=n!=null?n.concat([t]):null,Hp(4,2,Lb.bind(null,e,t),n)}function Np(){}function Db(t,e){var n=Wo();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Rp(e,r[1])?r[0]:(n.memoizedState=[t,e],t)}function Ab(t,e){var n=Wo();e=e===void 0?null:e;var r=n.memoizedState;return r!==null&&e!==null&&Rp(e,r[1])?r[0]:(t=t(),n.memoizedState=[t,e],t)}function B3(t,e){var n=ls();Bo(98>n?98:n,function(){t(!0)}),Bo(97<n?97:n,function(){var r=un.transition;un.transition=1;try{t(!1),e()}finally{un.transition=r}})}function Fp(t,e,n){var r=Kt(),o=jr(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===Oe||s!==null&&s===Oe)Nl=rc=!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,ln(a,l))return}catch{}finally{}qr(t,o,r)}}var lc={readContext:cn,useCallback:Rt,useContext:Rt,useEffect:Rt,useImperativeHandle:Rt,useLayoutEffect:Rt,useMemo:Rt,useReducer:Rt,useRef:Rt,useState:Rt,useDebugValue:Rt,useDeferredValue:Rt,useTransition:Rt,useMutableSource:Rt,useOpaqueIdentifier:Rt,unstable_isNewReconciler:!1},V3={readContext:cn,useCallback:function(t,e){return Ho().memoizedState=[t,e===void 0?null:e],t},useContext:cn,useEffect:oy,useImperativeHandle:function(t,e,n){return n=n!=null?n.concat([t]):null,$h(4,2,Lb.bind(null,e,t),n)},useLayoutEffect:function(t,e){return $h(4,2,t,e)},useMemo:function(t,e){var n=Ho();return e=e===void 0?null:e,t=t(),n.memoizedState=[t,e],t},useReducer:function(t,e,n){var r=Ho();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=Fp.bind(null,Oe,t),[r.memoizedState,t]},useRef:ry,useState:bl,useDebugValue:Np,useDeferredValue:function(t){var e=bl(t),n=e[0],r=e[1];return oy(function(){var o=un.transition;un.transition=1;try{r(t)}finally{un.transition=o}},[t]),n},useTransition:function(){var t=bl(!1),e=t[0];return t=B3.bind(null,t[1]),ry(t),[t,e]},useMutableSource:function(t,e,n){var r=Ho();return r.memoizedState={refs:{getSnapshot:e,setSnapshot:null},source:t,subscribe:n},Mb(r,t,e,n)},useOpaqueIdentifier:function(){if(Wn){var t=!1,e=A3(function(){throw t||(t=!0,n("r:"+(sh++).toString(36))),Error(V(355))}),n=bl(e)[1];return!(Oe.mode&2)&&(Oe.flags|=516,oc(5,function(){n("r:"+(sh++).toString(36))},void 0,null)),e}return e="r:"+(sh++).toString(36),bl(e),e},unstable_isNewReconciler:!1},z3={readContext:cn,useCallback:Db,useContext:cn,useEffect:sc,useImperativeHandle:Pb,useLayoutEffect:Ib,useMemo:Ab,useReducer:vl,useRef:ic,useState:function(){return vl(zn)},useDebugValue:Np,useDeferredValue:function(t){var e=vl(zn),n=e[0],r=e[1];return sc(function(){var o=un.transition;un.transition=1;try{r(t)}finally{un.transition=o}},[t]),n},useTransition:function(){var t=vl(zn)[0];return[ic().current,t]},useMutableSource:Tb,useOpaqueIdentifier:function(){return vl(zn)[0]},unstable_isNewReconciler:!1},$3={readContext:cn,useCallback:Db,useContext:cn,useEffect:sc,useImperativeHandle:Pb,useLayoutEffect:Ib,useMemo:Ab,useReducer:yl,useRef:ic,useState:function(){return yl(zn)},useDebugValue:Np,useDeferredValue:function(t){var e=yl(zn),n=e[0],r=e[1];return sc(function(){var o=un.transition;un.transition=1;try{r(t)}finally{un.transition=o}},[t]),n},useTransition:function(){var t=yl(zn)[0];return[ic().current,t]},useMutableSource:Tb,useOpaqueIdentifier:function(){return yl(zn)[0]},unstable_isNewReconciler:!1},_3=$o.ReactCurrentOwner,Tn=!1;function Ot(t,e,n,r){e.child=t===null?kb(e,null,n,r):tc(e,t.child,n,r)}function iy(t,e,n,r,o){n=n.render;var i=e.ref;return es(e,o),r=Op(t,e,n,r,i,o),t!==null&&!Tn?(e.updateQueue=t.updateQueue,e.flags&=-517,t.lanes&=~o,gr(t,e,o)):(e.flags|=1,Ot(t,e,r,o),e.child)}function sy(t,e,n,r,o,i){if(t===null){var s=n.type;return typeof s=="function"&&!Wp(s)&&s.defaultProps===void 0&&n.compare===null&&n.defaultProps===void 0?(e.tag=15,e.type=s,Rb(t,e,s,r,o,i)):(t=$u(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:ql,n(o,r)&&t.ref===e.ref)?gr(t,e,i):(e.flags|=1,t=Xr(s,r),t.ref=e.ref,t.return=e,e.child=t)}function Rb(t,e,n,r,o,i){if(t!==null&&ql(t.memoizedProps,r)&&t.ref===e.ref)if(Tn=!1,(i&o)!==0)t.flags&16384&&(Tn=!0);else return e.lanes=t.lanes,gr(t,e,i);return _h(t,e,n,r,i)}function ch(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},Du(e,n);else if(n&1073741824)e.memoizedState={baseLanes:0},Du(e,i!==null?i.baseLanes:n);else return t=i!==null?i.baseLanes|n:n,e.lanes=e.childLanes=1073741824,e.memoizedState={baseLanes:t},Du(e,t),null;else i!==null?(r=i.baseLanes|n,e.memoizedState=null):r=n,Du(e,r);return Ot(t,e,o,n),e.child}function Ob(t,e){var n=e.ref;(t===null&&n!==null||t!==null&&t.ref!==n)&&(e.flags|=128)}function _h(t,e,n,r,o){var i=Nt(n)?Fo:gt.current;return i=ss(e,i),es(e,o),n=Op(t,e,n,r,i,o),t!==null&&!Tn?(e.updateQueue=t.updateQueue,e.flags&=-517,t.lanes&=~o,gr(t,e,o)):(e.flags|=1,Ot(t,e,n,o),e.child)}function ly(t,e,n,r,o){if(Nt(n)){var i=!0;Nu(e)}else i=!1;if(es(e,o),e.stateNode===null)t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2),Sb(e,n,r),Bh(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=cn(u):(u=Nt(n)?Fo:gt.current,u=ss(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)&&Q0(e,s,r,u),Nr=!1;var d=e.memoizedState;s.state=d,Zl(e,r,s,o),a=e.memoizedState,l!==r||d!==a||Ht.current||Nr?(typeof c=="function"&&(ec(e,n,c,r),a=e.memoizedState),(l=Nr||Y0(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,xb(t,e),l=e.memoizedProps,u=e.type===e.elementType?l:Mn(e.type,l),s.props=u,f=e.pendingProps,d=s.context,a=n.contextType,typeof a=="object"&&a!==null?a=cn(a):(a=Nt(n)?Fo:gt.current,a=ss(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)&&Q0(e,s,r,a),Nr=!1,d=e.memoizedState,s.state=d,Zl(e,r,s,o);var g=e.memoizedState;l!==f||d!==g||Ht.current||Nr?(typeof h=="function"&&(ec(e,n,h,r),g=e.memoizedState),(u=Nr||Y0(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 Wh(t,e,n,r,i,o)}function Wh(t,e,n,r,o,i){Ob(t,e);var s=(e.flags&64)!==0;if(!r&&!s)return o&&j0(e,n,!1),gr(t,e,i);r=e.stateNode,_3.current=e;var l=s&&typeof n.getDerivedStateFromError!="function"?null:r.render();return e.flags|=1,t!==null&&s?(e.child=tc(e,t.child,null,i),e.child=tc(e,null,l,i)):Ot(t,e,l,i),e.memoizedState=r.state,o&&j0(e,n,!0),e.child}function ay(t){var e=t.stateNode;e.pendingContext?U0(t,e.pendingContext,e.pendingContext!==e.context):e.context&&U0(t,e.context,!1),Vh(t,e.containerInfo)}var Pu={dehydrated:null,retryLane:0};function uy(t,e,n){var r=e.pendingProps,o=De.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),Ae(De,o&1),t===null?(r.fallback!==void 0&&zh(e),t=r.children,o=r.fallback,i?(t=cy(e,t,o,n),e.child.memoizedState={baseLanes:n},e.memoizedState=Pu,t):typeof r.unstable_expectedLoadTime=="number"?(t=cy(e,t,o,n),e.child.memoizedState={baseLanes:n},e.memoizedState=Pu,e.lanes=33554432,t):(n=Kp({mode:"visible",children:t},e.mode,n,null),n.return=e,e.child=n)):t.memoizedState!==null?i?(r=fy(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=Pu,r):(n=dy(t,e,r.children,n),e.memoizedState=null,n):i?(r=fy(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=Pu,r):(n=dy(t,e,r.children,n),e.memoizedState=null,n)}function cy(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=Kp(e,o,0,null),n=os(n,o,r,null),i.return=t,n.return=t,i.sibling=n,t.child=i,n}function dy(t,e,n,r){var o=t.child;return t=o.sibling,n=Xr(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 fy(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=Xr(s,l),t!==null?r=Xr(t,r):(r=os(r,i,o,null),r.flags|=2),r.return=e,n.return=e,n.sibling=r,e.child=n,r}function hy(t,e){t.lanes|=e;var n=t.alternate;n!==null&&(n.lanes|=e),bb(t.return,e)}function dh(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 py(t,e,n){var r=e.pendingProps,o=r.revealOrder,i=r.tail;if(Ot(t,e,r.children,n),r=De.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&&hy(t,n);else if(t.tag===19)hy(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(Ae(De,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&&nc(t)===null&&(o=n),n=n.sibling;n=o,n===null?(o=e.child,e.child=null):(o=n.sibling,n.sibling=null),dh(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&&nc(t)===null){e.child=o;break}t=o.sibling,o.sibling=n,n=o,o=t}dh(e,!0,n,null,i,e.lastEffect);break;case"together":dh(e,!1,null,null,void 0,e.lastEffect);break;default:e.memoizedState=null}return e.child}function gr(t,e,n){if(t!==null&&(e.dependencies=t.dependencies),ra|=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=Xr(t,t.pendingProps),e.child=n,n.return=e;t.sibling!==null;)t=t.sibling,n=n.sibling=Xr(t,t.pendingProps),n.return=e;n.sibling=null}return e.child}return null}var Hb,Kh,Nb,Fb;Hb=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}};Kh=function(){};Nb=function(t,e,n,r){var o=t.memoizedProps;if(o!==r){t=e.stateNode,Oo(_n.current);var i=null;switch(n){case"input":o=vh(t,o),r=vh(t,r),i=[];break;case"option":o=xh(t,o),r=xh(t,r),i=[];break;case"select":o=Ce({},o,{value:void 0}),r=Ce({},r,{value:void 0}),i=[];break;case"textarea":o=wh(t,o),r=wh(t,r),i=[];break;default:typeof o.onClick!="function"&&typeof r.onClick=="function"&&(t.onclick=Gu)}kh(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"&&(zl.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"&&(zl.hasOwnProperty(u)?(a!=null&&u==="onScroll"&&be("scroll",t),i||l===a||(i=[])):typeof a=="object"&&a!==null&&a.$$typeof===cp?a.toString():(i=i||[]).push(u,a))}n&&(i=i||[]).push("style",n);var u=i;(e.updateQueue=u)&&(e.flags|=4)}};Fb=function(t,e,n,r){n!==r&&(e.flags|=4)};function xl(t,e){if(!Wn)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 W3(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 Nt(e.type)&&Zu(),null;case 3:return as(),xe(Ht),xe(gt),Ap(),r=e.stateNode,r.pendingContext&&(r.context=r.pendingContext,r.pendingContext=null),(t===null||t.child===null)&&(Lu(e)?e.flags|=4:r.hydrate||(e.flags|=256)),Kh(e),null;case 5:Dp(e);var o=Oo(Ql.current);if(n=e.type,t!==null&&e.stateNode!=null)Nb(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=Oo(_n.current),Lu(e)){r=e.stateNode,n=e.type;var i=e.memoizedProps;switch(r[Vr]=e,r[Ju]=i,n){case"dialog":be("cancel",r),be("close",r);break;case"iframe":case"object":case"embed":be("load",r);break;case"video":case"audio":for(t=0;t<El.length;t++)be(El[t],r);break;case"source":be("error",r);break;case"img":case"image":case"link":be("error",r),be("load",r);break;case"details":be("toggle",r);break;case"input":g0(r,i),be("invalid",r);break;case"select":r._wrapperState={wasMultiple:!!i.multiple},be("invalid",r);break;case"textarea":y0(r,i),be("invalid",r)}kh(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]):zl.hasOwnProperty(s)&&o!=null&&s==="onScroll"&&be("scroll",r));switch(n){case"input":xu(r),v0(r,i,!0);break;case"textarea":xu(r),b0(r);break;case"select":case"option":break;default:typeof i.onClick=="function"&&(r.onclick=Gu)}r=t,e.updateQueue=r,r!==null&&(e.flags|=4)}else{switch(s=o.nodeType===9?o:o.ownerDocument,t===Sh.html&&(t=Py(n)),t===Sh.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[Vr]=e,t[Ju]=r,Hb(t,e,!1,!1),e.stateNode=t,s=Eh(n,r),n){case"dialog":be("cancel",t),be("close",t),o=r;break;case"iframe":case"object":case"embed":be("load",t),o=r;break;case"video":case"audio":for(o=0;o<El.length;o++)be(El[o],t);o=r;break;case"source":be("error",t),o=r;break;case"img":case"image":case"link":be("error",t),be("load",t),o=r;break;case"details":be("toggle",t),o=r;break;case"input":g0(t,r),o=vh(t,r),be("invalid",t);break;case"option":o=xh(t,r);break;case"select":t._wrapperState={wasMultiple:!!r.multiple},o=Ce({},r,{value:void 0}),be("invalid",t);break;case"textarea":y0(t,r),o=wh(t,r),be("invalid",t);break;default:o=r}kh(n,o);var l=o;for(i in l)if(l.hasOwnProperty(i)){var a=l[i];i==="style"?Ry(t,a):i==="dangerouslySetInnerHTML"?(a=a?a.__html:void 0,a!=null&&Dy(t,a)):i==="children"?typeof a=="string"?(n!=="textarea"||a!=="")&&$l(t,a):typeof a=="number"&&$l(t,""+a):i!=="suppressContentEditableWarning"&&i!=="suppressHydrationWarning"&&i!=="autoFocus"&&(zl.hasOwnProperty(i)?a!=null&&i==="onScroll"&&be("scroll",t):a!=null&&op(t,i,a,s))}switch(n){case"input":xu(t),v0(t,r,!1);break;case"textarea":xu(t),b0(t);break;case"option":r.value!=null&&t.setAttribute("value",""+Jr(r.value));break;case"select":t.multiple=!!r.multiple,i=r.value,i!=null?Zi(t,!!r.multiple,i,!1):r.defaultValue!=null&&Zi(t,!!r.multiple,r.defaultValue,!0);break;default:typeof o.onClick=="function"&&(t.onclick=Gu)}cb(n,r)&&(e.flags|=4)}e.ref!==null&&(e.flags|=128)}return null;case 6:if(t&&e.stateNode!=null)Fb(t,e,t.memoizedProps,r);else{if(typeof r!="string"&&e.stateNode===null)throw Error(V(166));n=Oo(Ql.current),Oo(_n.current),Lu(e)?(r=e.stateNode,n=e.memoizedProps,r[Vr]=e,r.nodeValue!==n&&(e.flags|=4)):(r=(n.nodeType===9?n:n.ownerDocument).createTextNode(r),r[Vr]=e,e.stateNode=r)}return null;case 13:return xe(De),r=e.memoizedState,e.flags&64?(e.lanes=n,e):(r=r!==null,n=!1,t===null?e.memoizedProps.fallback!==void 0&&Lu(e):n=t.memoizedState!==null,r&&!n&&e.mode&2&&(t===null&&e.memoizedProps.unstable_avoidThisFallback!==!0||De.current&1?st===0&&(st=3):((st===0||st===3)&&(st=4),Ct===null||!(ra&134217727)&&!(fs&134217727)||ns(Ct,mt))),(r||n)&&(e.flags|=4),null);case 4:return as(),Kh(e),t===null&&lb(e.stateNode.containerInfo),null;case 10:return Lp(e),null;case 17:return Nt(e.type)&&Zu(),null;case 19:if(xe(De),r=e.memoizedState,r===null)return null;if(i=(e.flags&64)!==0,s=r.rendering,s===null)if(i)xl(r,!1);else{if(st!==0||t!==null&&t.flags&64)for(t=e.child;t!==null;){if(s=nc(t),s!==null){for(e.flags|=64,xl(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 Ae(De,De.current&1|2),e.child}t=t.sibling}r.tail!==null&&pt()>Zh&&(e.flags|=64,i=!0,xl(r,!1),e.lanes=33554432)}else{if(!i)if(t=nc(s),t!==null){if(e.flags|=64,i=!0,n=t.updateQueue,n!==null&&(e.updateQueue=n,e.flags|=4),xl(r,!0),r.tail===null&&r.tailMode==="hidden"&&!s.alternate&&!Wn)return e=e.lastEffect=r.lastEffect,e!==null&&(e.nextEffect=null),null}else 2*pt()-r.renderingStartTime>Zh&&n!==1073741824&&(e.flags|=64,i=!0,xl(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=pt(),n.sibling=null,e=De.current,Ae(De,i?e&1|2:e&1),n):null;case 23:case 24:return _p(),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 K3(t){switch(t.tag){case 1:Nt(t.type)&&Zu();var e=t.flags;return e&4096?(t.flags=e&-4097|64,t):null;case 3:if(as(),xe(Ht),xe(gt),Ap(),e=t.flags,e&64)throw Error(V(285));return t.flags=e&-4097|64,t;case 5:return Dp(t),null;case 13:return xe(De),e=t.flags,e&4096?(t.flags=e&-4097|64,t):null;case 19:return xe(De),null;case 4:return as(),null;case 10:return Lp(t),null;case 23:case 24:return _p(),null;default:return null}}function Bp(t,e){try{var n="",r=e;do n+=k2(r),r=r.return;while(r);var o=n}catch(i){o=`
|
|
6
|
-
|
|
7
|
-
`+i.stack}return{value:t,source:e,stack:o}}function Uh(t,e){try{console.error(e.value)}catch(n){setTimeout(function(){throw n})}}var U3=typeof WeakMap=="function"?WeakMap:Map;function Bb(t,e,n){n=Kr(-1,n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){uc||(uc=!0,Yh=r),Uh(t,e)},n}function Vb(t,e,n){n=Kr(-1,n),n.tag=3;var r=t.type.getDerivedStateFromError;if(typeof r=="function"){var o=e.value;n.payload=function(){return Uh(t,e),r(o)}}var i=t.stateNode;return i!==null&&typeof i.componentDidCatch=="function"&&(n.callback=function(){typeof r!="function"&&($n===null?$n=new Set([this]):$n.add(this),Uh(t,e));var s=e.stack;this.componentDidCatch(e.value,{componentStack:s!==null?s:""})}),n}var j3=typeof WeakSet=="function"?WeakSet:Set;function my(t){var e=t.ref;if(e!==null)if(typeof e=="function")try{e(null)}catch(n){Gr(t,n)}else e.current=null}function q3(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:Mn(e.type,n),r),t.__reactInternalSnapshotBeforeUpdate=e}return;case 3:e.flags&256&&Ep(e.stateNode.containerInfo);return;case 5:case 6:case 4:case 17:return}throw Error(V(163))}function G3(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&&(Gb(n,t),nT(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:Mn(n.type,e.memoizedProps),t.componentDidUpdate(r,e.memoizedState,t.__reactInternalSnapshotBeforeUpdate))),e=n.updateQueue,e!==null&&Z0(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}Z0(n,e,t)}return;case 5:t=n.stateNode,e===null&&n.flags&4&&cb(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&&Wy(n))));return;case 19:case 17:case 20:case 21:case 23:case 24:return}throw Error(V(163))}function gy(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=Ay("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 vy(t,e){if(No&&typeof No.onCommitFiberUnmount=="function")try{No.onCommitFiberUnmount(Mp,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)Gb(e,n);else{r=e;try{o()}catch(i){Gr(r,i)}}n=n.next}while(n!==t)}break;case 1:if(my(e),t=e.stateNode,typeof t.componentWillUnmount=="function")try{t.props=e.memoizedProps,t.state=e.memoizedState,t.componentWillUnmount()}catch(i){Gr(e,i)}break;case 5:my(e);break;case 4:zb(t,e)}}function yy(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 by(t){return t.tag===5||t.tag===3||t.tag===4}function xy(t){e:{for(var e=t.return;e!==null;){if(by(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&&($l(e,""),n.flags&=-17);e:t:for(n=t;;){for(;n.sibling===null;){if(n.return===null||by(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?jh(t,n,e):qh(t,n,e)}function jh(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=Gu));else if(r!==4&&(t=t.child,t!==null))for(jh(t,e,n),t=t.sibling;t!==null;)jh(t,e,n),t=t.sibling}function qh(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(qh(t,e,n),t=t.sibling;t!==null;)qh(t,e,n),t=t.sibling}function zb(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(vy(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(vy(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 fh(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[Ju]=r,t==="input"&&r.type==="radio"&&r.name!=null&&Iy(n,r),Eh(t,o),e=Eh(t,r),o=0;o<i.length;o+=2){var s=i[o],l=i[o+1];s==="style"?Ry(n,l):s==="dangerouslySetInnerHTML"?Dy(n,l):s==="children"?$l(n,l):op(n,s,l,e)}switch(t){case"input":yh(n,r);break;case"textarea":Ly(n,r);break;case"select":t=n._wrapperState.wasMultiple,n._wrapperState.wasMultiple=!!r.multiple,i=r.value,i!=null?Zi(n,!!r.multiple,i,!1):t!==!!r.multiple&&(r.defaultValue!=null?Zi(n,!!r.multiple,r.defaultValue,!0):Zi(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,Wy(n.containerInfo));return;case 12:return;case 13:e.memoizedState!==null&&($p=pt(),gy(e.child,!0)),wy(e);return;case 19:wy(e);return;case 17:return;case 23:case 24:gy(e,e.memoizedState!==null);return}throw Error(V(163))}function wy(t){var e=t.updateQueue;if(e!==null){t.updateQueue=null;var n=t.stateNode;n===null&&(n=t.stateNode=new j3),e.forEach(function(r){var o=iT.bind(null,t,r);n.has(r)||(n.add(r),r.then(o,o))})}}function J3(t,e){return t!==null&&(t=t.memoizedState,t===null||t.dehydrated!==null)?(e=e.memoizedState,e!==null&&e.dehydrated===null):!1}var Z3=Math.ceil,ac=$o.ReactCurrentDispatcher,Vp=$o.ReactCurrentOwner,re=0,Ct=null,Ge=null,mt=0,Vo=0,Gh=eo(0),st=0,Sc=null,ds=0,ra=0,fs=0,zp=0,Jh=null,$p=0,Zh=1/0;function hs(){Zh=pt()+500}var J=null,uc=!1,Yh=null,$n=null,Qr=!1,Fl=null,Ml=90,Qh=[],Xh=[],vr=null,Bl=0,ep=null,Bu=-1,pr=0,Vu=0,Vl=null,zu=!1;function Kt(){return re&48?pt():Bu!==-1?Bu:Bu=pt()}function jr(t){if(t=t.mode,!(t&2))return 1;if(!(t&4))return ls()===99?1:2;if(pr===0&&(pr=ds),F3.transition!==0){Vu!==0&&(Vu=Jh!==null?Jh.pendingLanes:0),t=pr;var e=4186112&~Vu;return e&=-e,e===0&&(t=4186112&~t,e=t&-t,e===0&&(e=8192)),e}return t=ls(),re&4&&t===98?t=ju(12,pr):(t=z2(t),t=ju(t,pr)),t}function qr(t,e,n){if(50<Bl)throw Bl=0,ep=null,Error(V(185));if(t=Cc(t,e),t===null)return null;mc(t,e,n),t===Ct&&(fs|=e,st===4&&ns(t,mt));var r=ls();e===1?re&8&&!(re&48)?tp(t):(dn(t,n),re===0&&(hs(),Kn())):(!(re&4)||r!==98&&r!==99||(vr===null?vr=new Set([t]):vr.add(t)),dn(t,n)),Jh=t}function Cc(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 dn(t,e){for(var n=t.callbackNode,r=t.suspendedLanes,o=t.pingedLanes,i=t.expirationTimes,s=t.pendingLanes;0<s;){var l=31-Zr(s),a=1<<l,u=i[l];if(u===-1){if(!(a&r)||a&o){u=e,$i(a);var c=ve;i[l]=10<=c?u+250:6<=c?u+5e3:-1}}else u<=e&&(t.expiredLanes|=a);s&=~a}if(r=Ul(t,t===Ct?mt:0),e=ve,r===0)n!==null&&(n!==lh&&Nh(n),t.callbackNode=null,t.callbackPriority=0);else{if(n!==null){if(t.callbackPriority===e)return;n!==lh&&Nh(n)}e===15?(n=tp.bind(null,t),hr===null?(hr=[n],Fu=Tp(xc,yb)):hr.push(n),n=lh):e===14?n=Jl(99,tp.bind(null,t)):(n=$2(e),n=Jl(n,$b.bind(null,t))),t.callbackPriority=e,t.callbackNode=n}}function $b(t){if(Bu=-1,Vu=pr=0,re&48)throw Error(V(327));var e=t.callbackNode;if(to()&&t.callbackNode!==e)return null;var n=Ul(t,t===Ct?mt:0);if(n===0)return null;var r=n,o=re;re|=16;var i=Ub();(Ct!==t||mt!==r)&&(hs(),rs(t,r));do try{X3();break}catch(l){Kb(t,l)}while(!0);if(Ip(),ac.current=i,re=o,Ge!==null?r=0:(Ct=null,mt=0,r=st),ds&fs)rs(t,0);else if(r!==0){if(r===2&&(re|=64,t.hydrate&&(t.hydrate=!1,Ep(t.containerInfo)),n=Zy(t),n!==0&&(r=Tl(t,n))),r===1)throw e=Sc,rs(t,0),ns(t,n),dn(t,pt()),e;switch(t.finishedWork=t.current.alternate,t.finishedLanes=n,r){case 0:case 1:throw Error(V(345));case 2:Po(t);break;case 3:if(ns(t,n),(n&62914560)===n&&(r=$p+500-pt(),10<r)){if(Ul(t,0)!==0)break;if(o=t.suspendedLanes,(o&n)!==n){Kt(),t.pingedLanes|=t.suspendedLanes&o;break}t.timeoutHandle=_0(Po.bind(null,t),r);break}Po(t);break;case 4:if(ns(t,n),(n&4186112)===n)break;for(r=t.eventTimes,o=-1;0<n;){var s=31-Zr(n);i=1<<s,s=r[s],s>o&&(o=s),n&=~i}if(n=o,n=pt()-n,n=(120>n?120:480>n?480:1080>n?1080:1920>n?1920:3e3>n?3e3:4320>n?4320:1960*Z3(n/1960))-n,10<n){t.timeoutHandle=_0(Po.bind(null,t),n);break}Po(t);break;case 5:Po(t);break;default:throw Error(V(329))}}return dn(t,pt()),t.callbackNode===e?$b.bind(null,t):null}function ns(t,e){for(e&=~zp,e&=~fs,t.suspendedLanes|=e,t.pingedLanes&=~e,t=t.expirationTimes;0<e;){var n=31-Zr(e),r=1<<n;t[n]=-1,e&=~r}}function tp(t){if(re&48)throw Error(V(327));if(to(),t===Ct&&t.expiredLanes&mt){var e=mt,n=Tl(t,e);ds&fs&&(e=Ul(t,e),n=Tl(t,e))}else e=Ul(t,0),n=Tl(t,e);if(t.tag!==0&&n===2&&(re|=64,t.hydrate&&(t.hydrate=!1,Ep(t.containerInfo)),e=Zy(t),e!==0&&(n=Tl(t,e))),n===1)throw n=Sc,rs(t,0),ns(t,e),dn(t,pt()),n;return t.finishedWork=t.current.alternate,t.finishedLanes=e,Po(t),dn(t,pt()),null}function Y3(){if(vr!==null){var t=vr;vr=null,t.forEach(function(e){e.expiredLanes|=24&e.pendingLanes,dn(e,pt())})}Kn()}function _b(t,e){var n=re;re|=1;try{return t(e)}finally{re=n,re===0&&(hs(),Kn())}}function Wb(t,e){var n=re;re&=-2,re|=8;try{return t(e)}finally{re=n,re===0&&(hs(),Kn())}}function Du(t,e){Ae(Gh,Vo),Vo|=e,ds|=e}function _p(){Vo=Gh.current,xe(Gh)}function rs(t,e){t.finishedWork=null,t.finishedLanes=0;var n=t.timeoutHandle;if(n!==-1&&(t.timeoutHandle=-1,D3(n)),Ge!==null)for(n=Ge.return;n!==null;){var r=n;switch(r.tag){case 1:r=r.type.childContextTypes,r!=null&&Zu();break;case 3:as(),xe(Ht),xe(gt),Ap();break;case 5:Dp(r);break;case 4:as();break;case 13:xe(De);break;case 19:xe(De);break;case 10:Lp(r);break;case 23:case 24:_p()}n=n.return}Ct=t,Ge=Xr(t.current,null),mt=Vo=ds=e,st=0,Sc=null,zp=fs=ra=0}function Kb(t,e){do{var n=Ge;try{if(Ip(),Hl.current=lc,rc){for(var r=Oe.memoizedState;r!==null;){var o=r.queue;o!==null&&(o.pending=null),r=r.next}rc=!1}if(Xl=0,it=ht=Oe=null,Nl=!1,Vp.current=null,n===null||n.return===null){st=1,Sc=e,Ge=null;break}e:{var i=t,s=n.return,l=n,a=e;if(e=mt,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=(De.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=Kr(-1,1);y.tag=2,Ur(l,y)}l.lanes|=1;break e}a=void 0,l=e;var x=i.pingCache;if(x===null?(x=i.pingCache=new U3,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=oT.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((Ji(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.`)}st!==5&&(st=2),a=Bp(a,l),d=s;do{switch(d.tag){case 3:i=a,d.flags|=4096,e&=-e,d.lanes|=e;var C=Bb(d,i,e);J0(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"&&($n===null||!$n.has(S)))){d.flags|=4096,e&=-e,d.lanes|=e;var E=Vb(d,i,e);J0(d,E);break e}}d=d.return}while(d!==null)}qb(n)}catch(k){e=k,Ge===n&&n!==null&&(Ge=n=n.return);continue}break}while(!0)}function Ub(){var t=ac.current;return ac.current=lc,t===null?lc:t}function Tl(t,e){var n=re;re|=16;var r=Ub();Ct===t&&mt===e||rs(t,e);do try{Q3();break}catch(o){Kb(t,o)}while(!0);if(Ip(),re=n,ac.current=r,Ge!==null)throw Error(V(261));return Ct=null,mt=0,st}function Q3(){for(;Ge!==null;)jb(Ge)}function X3(){for(;Ge!==null&&!O3();)jb(Ge)}function jb(t){var e=Jb(t.alternate,t,Vo);t.memoizedProps=t.pendingProps,e===null?qb(t):Ge=e,Vp.current=null}function qb(t){var e=t;do{var n=e.alternate;if(t=e.return,e.flags&2048){if(n=K3(e),n!==null){n.flags&=2047,Ge=n;return}t!==null&&(t.firstEffect=t.lastEffect=null,t.flags|=2048)}else{if(n=W3(n,e,Vo),n!==null){Ge=n;return}if(n=e,n.tag!==24&&n.tag!==23||n.memoizedState===null||Vo&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){Ge=e;return}Ge=e=t}while(e!==null);st===0&&(st=5)}function Po(t){var e=ls();return Bo(99,eT.bind(null,t,e)),null}function eT(t,e){do to();while(Fl!==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-Zr(i),u=1<<a;o[a]=0,s[a]=-1,l[a]=-1,i&=~u}if(vr!==null&&!(r&24)&&vr.has(t)&&vr.delete(t),t===Ct&&(Ge=Ct=null,mt=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,Vp.current=null,oh=Ru,s=N0(),Dh(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;ih={focusedElem:s,selectionRange:l},Ru=!1,Vl=null,zu=!1,J=r;do try{tT()}catch(k){if(J===null)throw Error(V(330));Gr(J,k),J=J.nextEffect}while(J!==null);Vl=null,J=r;do try{for(s=t;J!==null;){var y=J.flags;if(y&16&&$l(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:xy(J),J.flags&=-3;break;case 6:xy(J),J.flags&=-3,fh(J.alternate,J);break;case 1024:J.flags&=-1025;break;case 1028:J.flags&=-1025,fh(J.alternate,J);break;case 4:fh(J.alternate,J);break;case 8:l=J,zb(s,l);var C=l.alternate;yy(l),C!==null&&yy(C)}J=J.nextEffect}}catch(k){if(J===null)throw Error(V(330));Gr(J,k),J=J.nextEffect}while(J!==null);if(b=ih,x=N0(),y=b.focusedElem,s=b.selectionRange,x!==y&&y&&y.ownerDocument&&ob(y.ownerDocument.documentElement,y)){for(s!==null&&Dh(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=H0(y,C),i=H0(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}Ru=!!oh,ih=oh=null,t.current=n,J=r;do try{for(y=t;J!==null;){var w=J.flags;if(w&36&&G3(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));Gr(J,k),J=J.nextEffect}while(J!==null);J=null,N3(),re=o}else t.current=n;if(Qr)Qr=!1,Fl=t,Ml=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&&($n=null),r===1?t===ep?Bl++:(Bl=0,ep=t):Bl=0,n=n.stateNode,No&&typeof No.onCommitFiberRoot=="function")try{No.onCommitFiberRoot(Mp,n,void 0,(n.current.flags&64)===64)}catch{}if(dn(t,pt()),uc)throw uc=!1,t=Yh,Yh=null,t;return re&8||Kn(),null}function tT(){for(;J!==null;){var t=J.alternate;zu||Vl===null||(J.flags&8?S0(J,Vl)&&(zu=!0):J.tag===13&&J3(t,J)&&S0(J,Vl)&&(zu=!0));var e=J.flags;e&256&&q3(t,J),!(e&512)||Qr||(Qr=!0,Jl(97,function(){return to(),null})),J=J.nextEffect}}function to(){if(Ml!==90){var t=97<Ml?97:Ml;return Ml=90,Bo(t,rT)}return!1}function nT(t,e){Qh.push(e,t),Qr||(Qr=!0,Jl(97,function(){return to(),null}))}function Gb(t,e){Xh.push(e,t),Qr||(Qr=!0,Jl(97,function(){return to(),null}))}function rT(){if(Fl===null)return!1;var t=Fl;if(Fl=null,re&48)throw Error(V(331));var e=re;re|=32;var n=Xh;Xh=[];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));Gr(i,a)}}for(n=Qh,Qh=[],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));Gr(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,Kn(),!0}function Sy(t,e,n){e=Bp(n,e),e=Bb(t,e,1),Ur(t,e),e=Kt(),t=Cc(t,1),t!==null&&(mc(t,1,e),dn(t,e))}function Gr(t,e){if(t.tag===3)Sy(t,t,e);else for(var n=t.return;n!==null;){if(n.tag===3){Sy(n,t,e);break}else if(n.tag===1){var r=n.stateNode;if(typeof n.type.getDerivedStateFromError=="function"||typeof r.componentDidCatch=="function"&&($n===null||!$n.has(r))){t=Bp(e,t);var o=Vb(n,t,1);if(Ur(n,o),o=Kt(),n=Cc(n,1),n!==null)mc(n,1,o),dn(n,o);else if(typeof r.componentDidCatch=="function"&&($n===null||!$n.has(r)))try{r.componentDidCatch(e,t)}catch{}break}}n=n.return}}function oT(t,e,n){var r=t.pingCache;r!==null&&r.delete(e),e=Kt(),t.pingedLanes|=t.suspendedLanes&n,Ct===t&&(mt&n)===n&&(st===4||st===3&&(mt&62914560)===mt&&500>pt()-$p?rs(t,0):zp|=n),dn(t,e)}function iT(t,e){var n=t.stateNode;n!==null&&n.delete(e),e=0,e===0&&(e=t.mode,e&2?e&4?(pr===0&&(pr=ds),e=_i(62914560&~pr),e===0&&(e=4194304)):e=ls()===99?1:2:e=1),n=Kt(),t=Cc(t,e),t!==null&&(mc(t,e,n),dn(t,n))}var Jb;Jb=function(t,e,n){var r=e.lanes;if(t!==null)if(t.memoizedProps!==e.pendingProps||Ht.current)Tn=!0;else if(n&r)Tn=!!(t.flags&16384);else{switch(Tn=!1,e.tag){case 3:ay(e),uh();break;case 5:X0(e);break;case 1:Nt(e.type)&&Nu(e);break;case 4:Vh(e,e.stateNode.containerInfo);break;case 10:r=e.memoizedProps.value;var o=e.type._context;Ae(Yu,o._currentValue),o._currentValue=r;break;case 13:if(e.memoizedState!==null)return n&e.child.childLanes?uy(t,e,n):(Ae(De,De.current&1),e=gr(t,e,n),e!==null?e.sibling:null);Ae(De,De.current&1);break;case 19:if(r=(n&e.childLanes)!==0,t.flags&64){if(r)return py(t,e,n);e.flags|=64}if(o=e.memoizedState,o!==null&&(o.rendering=null,o.tail=null,o.lastEffect=null),Ae(De,De.current),r)break;return null;case 23:case 24:return e.lanes=0,ch(t,e,n)}return gr(t,e,n)}else Tn=!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=ss(e,gt.current),es(e,n),o=Op(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,Nt(r)){var i=!0;Nu(e)}else i=!1;e.memoizedState=o.state!==null&&o.state!==void 0?o.state:null,Pp(e);var s=r.getDerivedStateFromProps;typeof s=="function"&&ec(e,r,s,t),o.updater=wc,e.stateNode=o,o._reactInternals=e,Bh(e,r,t,n),e=Wh(null,e,r,!0,i,n)}else e.tag=0,Ot(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=lT(o),t=Mn(o,t),i){case 0:e=_h(null,e,o,t,n);break e;case 1:e=ly(null,e,o,t,n);break e;case 11:e=iy(null,e,o,t,n);break e;case 14:e=sy(null,e,o,Mn(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:Mn(r,o),_h(t,e,r,o,n);case 1:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Mn(r,o),ly(t,e,r,o,n);case 3:if(ay(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,xb(t,e),Zl(e,r,null,n),r=e.memoizedState.element,r===o)uh(),e=gr(t,e,n);else{if(o=e.stateNode,(i=o.hydrate)&&(zr=Xi(e.stateNode.containerInfo.firstChild),mr=e,i=Wn=!0),i){if(t=o.mutableSourceEagerHydrationData,t!=null)for(o=0;o<t.length;o+=2)i=t[o],i._workInProgressVersionPrimary=t[o+1],ts.push(i);for(n=kb(e,null,r,n),e.child=n;n;)n.flags=n.flags&-3|1024,n=n.sibling}else Ot(t,e,r,n),uh();e=e.child}return e;case 5:return X0(e),t===null&&zh(e),r=e.type,o=e.pendingProps,i=t!==null?t.memoizedProps:null,s=o.children,Oh(r,o)?s=null:i!==null&&Oh(r,i)&&(e.flags|=16),Ob(t,e),Ot(t,e,s,n),e.child;case 6:return t===null&&zh(e),null;case 13:return uy(t,e,n);case 4:return Vh(e,e.stateNode.containerInfo),r=e.pendingProps,t===null?e.child=tc(e,null,r,n):Ot(t,e,r,n),e.child;case 11:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Mn(r,o),iy(t,e,r,o,n);case 7:return Ot(t,e,e.pendingProps,n),e.child;case 8:return Ot(t,e,e.pendingProps.children,n),e.child;case 12:return Ot(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(Ae(Yu,l._currentValue),l._currentValue=i,s!==null)if(l=s.value,i=ln(l,i)?0:(typeof r._calculateChangedBits=="function"?r._calculateChangedBits(l,i):1073741823)|0,i===0){if(s.children===o.children&&!Ht.current){e=gr(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=Kr(-1,n&-n),u.tag=2,Ur(l,u)),l.lanes|=n,u=l.alternate,u!==null&&(u.lanes|=n),bb(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}Ot(t,e,o.children,n),e=e.child}return e;case 9:return o=e.type,i=e.pendingProps,r=i.children,es(e,n),o=cn(o,i.unstable_observedBits),r=r(o),e.flags|=1,Ot(t,e,r,n),e.child;case 14:return o=e.type,i=Mn(o,e.pendingProps),i=Mn(o.type,i),sy(t,e,o,i,r,n);case 15:return Rb(t,e,e.type,e.pendingProps,r,n);case 17:return r=e.type,o=e.pendingProps,o=e.elementType===r?o:Mn(r,o),t!==null&&(t.alternate=null,e.alternate=null,e.flags|=2),e.tag=1,Nt(r)?(t=!0,Nu(e)):t=!1,es(e,n),Sb(e,r,o),Bh(e,r,o,n),Wh(null,e,r,!0,t,n);case 19:return py(t,e,n);case 23:return ch(t,e,n);case 24:return ch(t,e,n)}throw Error(V(156,e.tag))};function sT(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 an(t,e,n,r){return new sT(t,e,n,r)}function Wp(t){return t=t.prototype,!(!t||!t.isReactComponent)}function lT(t){if(typeof t=="function")return Wp(t)?1:0;if(t!=null){if(t=t.$$typeof,t===fc)return 11;if(t===hc)return 14}return 2}function Xr(t,e){var n=t.alternate;return n===null?(n=an(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 $u(t,e,n,r,o,i){var s=2;if(r=t,typeof t=="function")Wp(t)&&(s=1);else if(typeof t=="string")s=5;else e:switch(t){case Fr:return os(n.children,o,i,e);case Ey:s=8,o|=16;break;case ip:s=8,o|=1;break;case Il:return t=an(12,n,e,o|8),t.elementType=Il,t.type=Il,t.lanes=i,t;case Ll:return t=an(13,n,e,o),t.type=Ll,t.elementType=Ll,t.lanes=i,t;case _u:return t=an(19,n,e,o),t.elementType=_u,t.lanes=i,t;case dp:return Kp(n,o,i,e);case gh:return t=an(24,n,e,o),t.elementType=gh,t.lanes=i,t;default:if(typeof t=="object"&&t!==null)switch(t.$$typeof){case sp:s=10;break e;case lp:s=9;break e;case fc:s=11;break e;case hc:s=14;break e;case ap:s=16,r=null;break e;case up:s=22;break e}throw Error(V(130,t==null?t:typeof t,""))}return e=an(s,n,e,o),e.elementType=t,e.type=r,e.lanes=i,e}function os(t,e,n,r){return t=an(7,t,r,e),t.lanes=n,t}function Kp(t,e,n,r){return t=an(23,t,r,e),t.elementType=dp,t.lanes=n,t}function hh(t,e,n){return t=an(6,t,null,e),t.lanes=n,t}function ph(t,e,n){return e=an(4,t.children!==null?t.children:[],t.key,e),e.lanes=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function aT(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=Qf(0),this.expirationTimes=Qf(-1),this.entangledLanes=this.finishedLanes=this.mutableReadLanes=this.expiredLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=Qf(0),this.mutableSourceEagerHydrationData=null}function uT(t,e,n){var r=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Do,key:r==null?null:""+r,children:t,containerInfo:e,implementation:n}}function cc(t,e,n,r){var o=e.current,i=Kt(),s=jr(o);e:if(n){n=n._reactInternals;t:{if(_o(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(Nt(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(Nt(a)){n=fb(n,a,l);break e}}n=l}else n=Yr;return e.context===null?e.context=n:e.pendingContext=n,e=Kr(i,s),e.payload={element:t},r=r===void 0?null:r,r!==null&&(e.callback=r),Ur(o,e),qr(o,s,i),s}function mh(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 Cy(t,e){if(t=t.memoizedState,t!==null&&t.dehydrated!==null){var n=t.retryLane;t.retryLane=n!==0&&n<e?n:e}}function Up(t,e){Cy(t,e),(t=t.alternate)&&Cy(t,e)}function cT(){return null}function jp(t,e,n){var r=n!=null&&n.hydrationOptions!=null&&n.hydrationOptions.mutableSources||null;if(n=new aT(t,e,n!=null&&n.hydrate===!0),e=an(3,null,null,e===2?7:e===1?3:0),n.current=e,e.stateNode=n,Pp(e),t[cs]=n.current,lb(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}jp.prototype.render=function(t){cc(t,this._internalRoot,null,null)};jp.prototype.unmount=function(){var t=this._internalRoot,e=t.containerInfo;cc(null,t,null,function(){e[cs]=null})};function oa(t){return!(!t||t.nodeType!==1&&t.nodeType!==9&&t.nodeType!==11&&(t.nodeType!==8||t.nodeValue!==" react-mount-point-unstable "))}function dT(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 jp(t,0,e?{hydrate:!0}:void 0)}function kc(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=mh(s);l.call(u)}}cc(e,s,t,o)}else{if(i=n._reactRootContainer=dT(n,r),s=i._internalRoot,typeof o=="function"){var a=o;o=function(){var u=mh(s);a.call(u)}}Wb(function(){cc(e,s,t,o)})}return mh(s)}zy=function(t){if(t.tag===13){var e=Kt();qr(t,4,e),Up(t,4)}};gp=function(t){if(t.tag===13){var e=Kt();qr(t,67108864,e),Up(t,67108864)}};$y=function(t){if(t.tag===13){var e=Kt(),n=jr(t);qr(t,n,e),Up(t,n)}};_y=function(t,e){return e()};Mh=function(t,e,n){switch(e){case"input":if(yh(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=bc(r);if(!o)throw Error(V(90));Ty(r),yh(r,o)}}}break;case"textarea":Ly(t,n);break;case"select":e=n.value,e!=null&&Zi(t,!!n.multiple,e,!1)}};hp=_b;Ny=function(t,e,n,r,o){var i=re;re|=4;try{return Bo(98,t.bind(null,e,n,r,o))}finally{re=i,re===0&&(hs(),Kn())}};pp=function(){!(re&49)&&(Y3(),to())};Fy=function(t,e){var n=re;re|=2;try{return t(e)}finally{re=n,re===0&&(hs(),Kn())}};function Zb(t,e){var n=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!oa(e))throw Error(V(200));return uT(t,e,null,n)}var fT={Events:[ta,ji,bc,Oy,Hy,to,{current:!1}]},wl={findFiberByHostInstance:Ro,bundleType:0,version:"17.0.2",rendererPackageName:"react-dom"},hT={bundleType:wl.bundleType,version:wl.version,rendererPackageName:wl.rendererPackageName,rendererConfig:wl.rendererConfig,overrideHookState:null,overrideHookStateDeletePath:null,overrideHookStateRenamePath:null,overrideProps:null,overridePropsDeletePath:null,overridePropsRenamePath:null,setSuspenseHandler:null,scheduleUpdate:null,currentDispatcherRef:$o.ReactCurrentDispatcher,findHostInstanceByFiber:function(t){return t=Vy(t),t===null?null:t.stateNode},findFiberByHostInstance:wl.findFiberByHostInstance||cT,findHostInstancesForRefresh:null,scheduleRefresh:null,scheduleRoot:null,setRefreshHandler:null,getCurrentFiber:null};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"&&(Sl=__REACT_DEVTOOLS_GLOBAL_HOOK__,!Sl.isDisabled&&Sl.supportsFiber))try{Mp=Sl.inject(hT),No=Sl}catch{}var Sl;fn.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED=fT;fn.createPortal=Zb;fn.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=Vy(e),t=t===null?null:t.stateNode,t};fn.flushSync=function(t,e){var n=re;if(n&48)return t(e);re|=1;try{if(t)return Bo(99,t.bind(null,e))}finally{re=n,Kn()}};fn.hydrate=function(t,e,n){if(!oa(e))throw Error(V(200));return kc(null,t,e,!0,n)};fn.render=function(t,e,n){if(!oa(e))throw Error(V(200));return kc(null,t,e,!1,n)};fn.unmountComponentAtNode=function(t){if(!oa(t))throw Error(V(40));return t._reactRootContainer?(Wb(function(){kc(null,null,t,!1,function(){t._reactRootContainer=null,t[cs]=null})}),!0):!1};fn.unstable_batchedUpdates=_b;fn.unstable_createPortal=function(t,e){return Zb(t,e,2<arguments.length&&arguments[2]!==void 0?arguments[2]:null)};fn.unstable_renderSubtreeIntoContainer=function(t,e,n,r){if(!oa(n))throw Error(V(200));if(t==null||t._reactInternals===void 0)throw Error(V(38));return kc(t,e,n,!1,r)};fn.version="17.0.2"});var Ec=sl((j5,Xb)=>{"use strict";function Qb(){if(!(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u"||typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE!="function"))try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(Qb)}catch(t){console.error(t)}}Qb(),Xb.exports=Yb()});var N5={};a2(N5,{MovingWindow:()=>fu,addRowsFromInstruments:()=>x5,getTypeaheadParams:()=>CM,getVuuTableSchema:()=>H5,useDataSource:()=>c2,useLookupValues:()=>v5,useServerConnectionQuality:()=>b5,useServerConnectionStatus:()=>y5,useTypeaheadSuggestions:()=>Md,useVuuMenuActions:()=>R5,useVuuTables:()=>O5});module.exports=u2(N5);var Nn=require("@vuu-ui/vuu-utils"),je=require("react"),{SELECTED:Nf}=Nn.metadataKeys;function c2({dataSource:t,renderBufferSize:e=10}){let[,n]=(0,je.useState)(null),r=(0,je.useRef)(!0),o=(0,je.useRef)(!1),i=(0,je.useRef)(null),s=(0,je.useRef)([]),l=(0,je.useRef)({from:0,to:10}),a=(0,je.useMemo)(()=>new fu((0,Nn.getFullRange)(l.current,e)),[e]),u=(0,je.useCallback)(d=>{for(let h of d)a.add(h);s.current=a.data.slice(),o.current=!0},[a]),c=(0,je.useCallback)(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]);(0,je.useEffect)(()=>()=>{i.current&&(cancelAnimationFrame(i.current),i.current=null),r.current=!1},[]);let f=(0,je.useCallback)(d=>{l.current=d;let h=(0,Nn.getFullRange)(l.current,e);t.range=h,a.setRange(h.from,h.to)},[t,a,e]);return(0,je.useMemo)(()=>{let{from:d,to:h}=l.current,g=(0,Nn.getFullRange)({from:d,to:h},e);t.range=g,a.setRange(g.from,g.to)},[t,a,e]),(0,je.useEffect)(()=>{let{from:d,to:h}=(0,Nn.getFullRange)(l.current,e);t.subscribe({range:{from:d,to:h}},c)},[t,c,e]),(0,je.useEffect)(()=>()=>{t.unsubscribe()},[t]),[s.current,a.rowCount,(0,Nn.getFullRange)(l.current,e),f]}var fu=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 Nn.WindowRange(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][Nf]===1&&e[Nf]===0&&(e[Nf]=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}}};var WM=require("@vuu-ui/vuu-data-remote");var GL=require("react");function e0(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=e0(t[e]))&&(r&&(r+=" "),r+=n);else for(e in t)t[e]&&(r&&(r+=" "),r+=e);return r}function Fn(){for(var t,e,n=0,r="";n<arguments.length;)(t=arguments[n++])&&(e=e0(t))&&(r&&(r+=" "),r+=e);return r}var W=Fn;var d2={},f2={},h2={};function Or(t,e,n="component"){h2[t]=e,n==="container"?d2[t]=!0:n==="view"&&(f2[t]=!0)}var fr=t=>(...e)=>[t,...e].join("-");var Mc=require("react"),ia=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u"?Mc.useLayoutEffect:Mc.useEffect;var pT=require("react/jsx-runtime"),Tc=require("react"),mT=(0,Tc.createContext)(typeof window<"u"?window:null);function Ko(){return(0,Tc.useContext)(mT)}var Lc=et(require("react"));var gT=require("react/jsx-runtime"),sa=require("react"),vT=(0,sa.createContext)(null);function e1(){return(0,sa.useContext)(vT)}var Ic=require("react"),t1=(0,Ic.createContext)(!0),n1=()=>(0,Ic.useContext)(t1),X5=t1.Provider;var r1,yT=(r1=Lc.useInsertionEffect)!=null?r1:Lc.useLayoutEffect,qp=new WeakMap;function Uo({testId:t,css:e,window:n}){let r=n1(),o=e1();yT(()=>{var i,s;if(!n||!r)return;let l=(i=qp.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),qp.set(n,l),()=>{let u=qp.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])}var o1=require("react");function i1(t,e){return(0,o1.createContext)(e)}var hn=require("react");function at({controlled:t,default:e,name:n,state:r="value"}){let{current:o}=(0,hn.useRef)(t!==void 0),[i,s]=(0,hn.useState)(e),l=t!==void 0?t:i,{current:a}=(0,hn.useRef)(e);(0,hn.useEffect)(()=>{},[r,n,t]),(0,hn.useEffect)(()=>{},[JSON.stringify(e,bT)]);let u=(0,hn.useCallback)(c=>{o||s(c)},[o]);return[l,u,o]}function bT(t,e){return(0,hn.isValidElement)(e)?null:e}var a1=require("react/jsx-runtime"),u1=require("react");var s1=`/* 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 Un=fr("saltInput"),jo=(0,Dc.forwardRef)(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=Ko();Uo({testId:"salt-input",css:k1,window:S});let{a11yProps:{"aria-describedby":E,"aria-labelledby":k}={},disabled:T,readOnly:D,necessity:M,validationStatus:I}=f1(),R={"aria-activedescendant":e,"aria-expanded":n,"aria-owns":r},A=i||T,L=d||D,H=I!=null?I:x,[O,B]=(0,Dc.useState)(!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,[Ie,Le]=at({controlled:m,default:F,name:"Input",state:"value"}),Ee=Pe=>{let ye=Pe.target.value;Le(ye),Z==null||Z(Pe)},ge=Pe=>{q==null||q(Pe),B(!1)},Ke=Pe=>{j==null||j(Pe),B(!0)},Ye={"--input-textAlign":p,...v};return(0,no.jsxs)("div",{className:Fn(Un(),Un(b),{[Un("focused")]:!A&&O,[Un("disabled")]:A,[Un("readOnly")]:L,[Un(H||"")]:H},o),ref:w,style:Ye,...C,children:[g&&(0,no.jsx)("div",{className:Un("startAdornmentContainer"),children:g}),(0,no.jsx)("input",{"aria-describedby":Fn(E,N),"aria-labelledby":Fn(k,z),className:Fn(Un("input"),u==null?void 0:u.className),disabled:A,id:a,readOnly:L,ref:c,role:h,tabIndex:A?-1:0,onBlur:ge,onChange:Ee,onFocus:A?void 0:Ke,placeholder:f,value:Ie,...R,...ue,required:se}),!A&&!L&&H&&(0,no.jsx)(C1,{status:H}),l&&(0,no.jsx)("div",{className:Un("endAdornmentContainer"),children:l}),(0,no.jsx)("div",{className:Un("activationIndicator")})]})});var E1=require("react");function Yp(t,e){typeof t=="function"?t(e):t&&(t.current=e)}function Et(t,e){return(0,E1.useMemo)(()=>t==null&&e==null?()=>null:n=>{Yp(t,n),Yp(e,n)},[t,e])}var aa=require("react"),ST=[],Ac=t=>{let e=Array.isArray(t),n=e?t.length:aa.Children.count(t);return e&&t.every(aa.isValidElement)?t:n===1&&!e&&(0,aa.isValidElement)(t)?[t]:n>1?t:ST};var Rc=et(require("react")),Oc=et(Ec());var M1=et(Ec());var T1=(t,e,n,r,o)=>{e.style.cssText=`left:${n}px; top:${r}px;position: absolute;`,M1.render(t,e,o)};var Qp=!1,pn=[],I1=t=>(t==null?void 0:t.type)==="menu-action",L1=t=>(t==null?void 0:t.type)==="click-away";function P1(t){if(t.key==="Esc"){if(pn.length)A1();else if(Qp){let e=document.body.querySelector(".vuuDialog");e&&Oc.default.unmountComponentAtNode(e)}}}function D1(t){if(pn.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;A1({mouseEvt:t,type:"click-away"})}}function A1(t){if(pn.length===1)qo.hidePopup(t,"anon","all");else if(pn.length){let e=document.body.querySelectorAll(".vuuPopup");for(let n=0;n<e.length;n++)Oc.default.unmountComponentAtNode(e[n]);R1("*")}}function CT(t){pn.indexOf(t)===-1&&(pn.push(t),Qp===!1&&(window.addEventListener("keydown",P1,!0),window.addEventListener("click",D1,!0)))}function R1(t){if(pn.length){if(t==="*")pn.length=0;else{let e=pn.indexOf(t);e!==-1&&pn.splice(e,1)}pn.length===0&&Qp===!1&&(window.removeEventListener("keydown",P1,!0),window.removeEventListener("click",D1,!0))}}var kT=({children:t,position:e,style:n})=>{let r=W("hwPopup","hwPopupContainer",e);return(0,Rc.createElement)("div",{className:r,style:n},t)},ET=1,qo=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,CT(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};T1((0,Rc.createElement)(kT,{key:ET++,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(pn.indexOf(n)!==-1){R1(n);let i=document.body.querySelector(`.vuuPopup.${r}`);i&&Oc.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"}}}};var ro=require("react"),O1=(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")}},H1=({anchorElement:t,minWidth:e,offsetLeft:n=0,offsetTop:r=0,placement:o,position:i})=>{let s=(0,ro.useRef)(null),[l,a]=(0,ro.useState)(i);(0,ro.useLayoutEffect)(()=>{if(o==="absolute"&&i)a(i);else if(t.current&&o!=="auto"){let c=s.current===null?void 0:s.current.getBoundingClientRect(),f=O1(t.current,o,n,r,e,c);a(f)}},[t,e,n,r,o,i]);let u=(0,ro.useCallback)(c=>{if(s.current=c,c&&o==="center"&&t.current){let{height:f,width:d}=c.getBoundingClientRect();a(O1(t.current,o,n,r,void 0,{height:f,width:d}))}},[t,n,r,o]);return{position:l,popupRef:o==="center"?u:void 0}};var N1=require("react/jsx-runtime"),ps=({children:t,className:e,anchorElement:n,minWidth:r,placement:o,position:i})=>{let{popupRef:s,position:l}=H1({anchorElement:n,minWidth:r,placement:o,position:i});return l===void 0?null:(0,N1.jsx)("div",{className:W("vuuPortal",e),ref:s,style:l,children:t})};var ex=require("@vuu-ui/vuu-utils"),Zo=require("react");var F1=require("@vuu-ui/vuu-utils"),Go=require("react"),B1=et(Ec());function MT(t){return typeof t=="function"?t():t}var TT=["vuu-dialog-portal-root","vuu-portal-root"],IT=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},oo=({children:t,container:e=document.body,id:n=TT,onRender:r,open:o=!0,themeAttributes:i})=>{var h;let[s,l]=(0,Go.useState)(!1),a=(0,Go.useRef)(null),u=(h=MT(e))!=null?h:document.body,[c,f,d]=(0,F1.useThemeAttributes)(i);return(0,Go.useLayoutEffect)(()=>{let g=IT(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]),(0,Go.useLayoutEffect)(()=>{requestAnimationFrame(()=>{r==null||r()})},[r]),o&&s&&a.current&&t?(0,B1.createPortal)(t,a.current):null};var wr=et(require("react")),G1=require("@vuu-ui/vuu-utils");var Jo=et(require("react"));var Xp=t=>t.type===Hc||!!t.props["data-group"],LT=t=>{if(Array.isArray(t)&&em(t[0]))return t[0]},PT=(t,e,n,r=!1)=>{let{props:{children:o}}=t;return{childWithId:Jo.default.cloneElement(t,{hasSeparator:r,id:`${e}`,key:e,children:n?LT(o):o}),grandChildren:n?o:void 0}},V1=(t,e)=>{let n=(0,Jo.useCallback)(()=>{let i=(s,l=e,a={},u={})=>{let c=a[l]=[],f=0,d=!1;return Jo.default.Children.forEach(s,h=>{if(!em(h))if(h.type===z1)d=!0;else{let g=Xp(h),v=`${l}-${f}`,{props:{action:p,options:m}}=h,{childWithId:y,grandChildren:x}=PT(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]=(0,Jo.useMemo)(()=>n(),[n]);return[r,o]};var jt=require("react");var $1=t=>t.closest("[data-root='true']")!==null,_1=(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 DT(t,...e){let n=new Set(t);for(let r of e)for(let o of r)n.add(o);return n}var AT="Enter";var RT="Delete",OT=new Set([AT,RT]),HT=new Set(["Tab"]),NT=new Set(["ArrowRight","ArrowLeft"]),W1=new Set(["Home","End","ArrowDown","ArrowUp"]),K1=new Set(["Home","End","ArrowRight","ArrowLeft"]),FT=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),NR=DT(OT,K1,W1,NT,FT,HT);var U1=({key:t},e="vertical")=>(e==="vertical"?W1:K1).has(t);var Nc=require("@vuu-ui/vuu-utils"),j1=({autoHighlightFirstItem:t=!1,count:e,defaultHighlightedIdx:n,highlightedIndex:r,onActivate:o,onHighlight:i,onCloseMenu:s,onOpenMenu:l})=>{var b;if((0,Nc.isValidNumber)(r)&&(0,Nc.isValidNumber)(n))throw Error("useKeyboardNavigation do not pass values for both highlightedIndex and defaultHighlightedIdx");let a=(0,Nc.isValidNumber)(r),u=(0,jt.useRef)((b=n!=null?n:r)!=null?b:t?0:-1),[,c]=(0,jt.useState)(null),f=(0,jt.useCallback)(C=>{u.current=C,i==null||i(C),c({})},[i]),d=(0,jt.useCallback)(C=>{C!==u.current&&(a||f(C))},[a,f]),h=(0,jt.useRef)(!0),g=(0,jt.useRef)(!1),v=C=>g.current=C,p=a?r:u.current,m=(0,jt.useCallback)(C=>{let w=BT(e,C.key,u.current);w!==u.current&&d(w)},[e,d]),y=(0,jt.useCallback)(C=>{if(U1(C))C.preventDefault(),C.stopPropagation(),h.current=!0,m(C);else if((C.key==="ArrowRight"||C.key==="Enter")&&_1(C.target,p)){let S=C.target.querySelector(`:scope > [data-index='${p}']`);S&&(l==null||l(S,!0))}else C.key==="ArrowLeft"&&!$1(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=(0,jt.useMemo)(()=>({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 BT(t,e,n){return e==="ArrowUp"?n>0?n-1:n:n===null?0:n===t-1?n:n+1}var xr=require("react/jsx-runtime"),q1="vuuMenuList",z1=()=>(0,xr.jsx)("li",{className:"vuuMenuItem-divider"}),Hc=()=>null,Fc=({children:t,idx:e,options:n,...r})=>(0,xr.jsx)("div",{...r,children:t}),J1=({children:t})=>(0,xr.jsx)(xr.Fragment,{children:t});J1.displayName="MenuItemLabel";Fc.Label=J1;var VT=t=>wr.default.isValidElement(t)&&typeof t.type!="string"&&"displayName"in t.type?t.type.displayName:void 0,em=t=>VT(t)==="MenuItemLabel",zT=t=>t.props["data-icon"],tm=({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=(0,G1.useId)(s),v=(0,wr.useRef)(null),p=(0,wr.useMemo)(()=>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}=j1({count:wr.default.Children.count(n),defaultHighlightedIdx:o,highlightedIndex:i,onActivate:m,onHighlight:u,onOpenMenu:d,onCloseMenu:f}),C=e==null?y:-1;(0,wr.useLayoutEffect)(()=>{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?[(0,xr.jsx)("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=Xp(I),q=z&&e===B,Z=q?`${g}-${B}`:void 0;M.push((0,xr.jsx)(Fc,{...N,...E,...$T(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(zT);n.forEach((I,R)=>{T(D,I,R,M)})}return D}return(0,xr.jsx)("div",{...h,...b,"aria-activedescendant":w(),className:W(q1,r,{[`${q1}-childMenuShowing`]:e!==void 0}),"data-root":l||void 0,id:g,ref:v,role:"menu",children:S()})},$T=(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})});tm.displayName="MenuList";var He=require("react");var nm=t=>t==null?void 0:t.closest("[data-index],[aria-posinset]");var Y1=(t,e,n)=>t.map((r,o)=>o===t.length-1?{...r,[n]:r[n]-e}:r),_T=(t,e)=>Y1(t,e,"left"),WT=(t,e)=>Y1(t,e,"top"),KT=(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)},UT=(t,e)=>{let[{left:n,top:r}]=e.slice(-1),{offsetWidth:o,offsetTop:i}=t;return{left:n+o,top:i+r}},Q1=(t,e)=>{let n=t.lastIndexOf("-");return t.startsWith("menuitem")?n>-1?t.slice(9,n):e:n>-1?t.slice(0,n):e},jT=t=>t.slice(9),Z1=({ariaExpanded:t,ariaHasPopup:e,id:n},r)=>{if(n.startsWith("menuitem"))return{hostMenuId:Q1(n,r),targetMenuId:jT(n),menuItemId:n,isGroup:e==="true",isOpen:t==="true"};throw Error(`getMenuItemDetails #${n} is not a menuitem`)},X1=({id:t,onActivate:e,onMouseEnterItem:n,position:{x:r,y:o}})=>{let[,i]=(0,He.useState)({}),s=(0,He.useRef)([{id:t,left:r,top:o}]),l=(0,He.useCallback)(w=>s.current.findIndex(S=>S.id===w)!==-1,[]),a=(0,He.useCallback)(w=>{let S=d.current[w];if(S===void 0)throw Error(`getOpenMenuState no entry for menu ${w}`);return S},[]),u=(0,He.useCallback)(w=>{s.current=w,i({})},[]),c=(0,He.useRef)(),f=(0,He.useRef)(),d=(0,He.useRef)({[t]:"no-popup"}),h=(0,He.useCallback)((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}=UT(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=(0,He.useCallback)(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=(0,He.useCallback)(w=>{let S=s.current.slice(),E=w.slice(9),{id:k}=S.at(-1);for(;S.length>1&&!E.startsWith(k);){let T=Q1(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=(0,He.useCallback)(()=>{c.current&&(clearTimeout(c.current),c.current=void 0)},[]),m=(0,He.useCallback)((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=(0,He.useCallback)((w,S,E)=>{d.current[S]="pending-close",f.current=window.setTimeout(()=>{v(E)},400)},[v]),x=(0,He.useCallback)(()=>{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?KT(t,w):_T(w,k-M);u(I)}else if(T>D){let I=WT(w,T-D);u(I)}typeof E.tabIndex=="number"&&E.focus()}},[t,u]),b=(0,He.useCallback)((w,S=!1)=>{let{hostMenuId:E,targetMenuId:k,menuItemId:T,isGroup:D,isOpen:M}=Z1(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=(0,He.useMemo)(()=>({onMouseEnter:w=>{let S=nm(w.target);b(S),n(w,S.id)},onClick:w=>{let S=nm(w.target),{isGroup:E,menuItemId:k}=Z1(S,t);E?b(S):e(k)}}),[e,n,t,b]);return{closeMenu:g,handleRender:x,listItemProps:C,openMenu:b,openMenus:s.current}};var ua=require("react/jsx-runtime"),rm=require("react"),qT=()=>{},om=({PortalProps:t,activatedByKeyboard:e,children:n,className:r,id:o,onClose:i=()=>{},position:s={x:0,y:0},style:l,...a})=>{let u=(0,Zo.useRef)(i);u.current=i;let c=(0,ex.useId)(o),f=(0,Zo.useRef)(qT),[d,h]=V1(n,c),g=(0,Zo.useRef)(e),v=(0,Zo.useCallback)(()=>{g.current=!1},[]),p=(0,Zo.useCallback)(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}=X1({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(0,ua.jsx)(ua.Fragment,{children:b.map(({id:T,left:D,top:M},I,R)=>{let A=k(I);return(0,rm.createElement)(oo,{...t,key:I,onRender:C},(0,ua.jsx)(ps,{anchorElement:{current:document.body},placement:"absolute",position:{left:D,top:M},children:(0,rm.createElement)(tm,{...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])}))})})};om.displayName="ContextMenu";var Bc=require("react"),GT=require("react/jsx-runtime"),tx=(0,Bc.createContext)(null);var zc=require("@vuu-ui/vuu-utils"),jn=require("react");var Vc=require("react/jsx-runtime"),nx=(t,e)=>{let n=(0,jn.useContext)(tx),[r,o,i]=(0,zc.useThemeAttributes)(),s=(0,jn.useMemo)(()=>({themeClass:r,densityClass:o,dataMode:i}),[i,o,r]),l=(0,jn.useCallback)((c,f,d)=>{let h=[];for(let g of c)h=h.concat(g(f,d));return h},[]),a=(0,jn.useCallback)((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 ZT({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&&YT(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=(0,jn.useCallback)(()=>{console.log("hide context menu")},[]);return[a,u]},JT={},ZT=(t,e)=>{qo.showPopup({focus:!0,left:0,top:0,component:(0,jn.cloneElement)(e,{position:t})})},YT=(t,e,n,{position:r,...o}=JT)=>{let i=u=>{let c=(f,d)=>(0,zc.isGroupMenuItemDescriptor)(f)?(0,Vc.jsx)(Hc,{label:f.label,children:f.children.map(c)},d):(0,Vc.jsx)(Fc,{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;I1(u)&&(n(u),qo.hidePopup()),(c=o==null?void 0:o.onClose)==null||c.call(o,u)},l=r!=null?r:{x:t.clientX,y:t.clientY},a=(0,Vc.jsx)(om,{...o,onClose:s,position:l,children:i(e)});qo.showPopup({left:0,top:0,component:a,focus:!0})};var rx=require("@vuu-ui/vuu-utils");var Sr=require("react");var ox=require("react/jsx-runtime"),im="vuuPopupMenu",QT=t=>{if(t){let{bottom:e,left:n}=t.getBoundingClientRect();return{x:n,y:e+6}}},$c=({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=(0,Sr.useRef)(null),d=(0,Sr.useRef)(!1),[h,g]=(0,Sr.useState)(!1),v=(0,rx.useId)(r),[p]=nx(i,o),m=(0,Sr.useCallback)(b=>{console.log("menu Open ",{el:b})},[]),y=(0,Sr.useCallback)(b=>{g(!1),L1(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=(0,Sr.useCallback)(b=>{d.current?d.current=!1:(g(!0),p(b,s,{ContextMenuProps:{id:`${v}-menu`,onClose:y,openMenu:m,position:QT(f.current)},...l}))},[y,m,v,s,l,p]);return(0,ox.jsx)(br,{...c,"aria-controls":`${v}-menu-root`,"aria-expanded":h,"aria-haspopup":"menu",className:W(im,t,{[`${im}-withCaption`]:e!==void 0,[`${im}-open`]:h}),"data-icon":n,id:v,onClick:x,ref:f,tabIndex:u,variant:"secondary",children:e})};var _c=require("react"),XT=(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")}},ix=({anchorElement:t,offsetLeft:e=0,offsetTop:n=0,placement:r})=>{let[o,i]=(0,_c.useState)();return(0,_c.useLayoutEffect)(()=>{if(t.current){let s=XT(t.current,r,e,n);i(s)}},[t,e,n,r]),o};var Wc=require("react/jsx-runtime"),sm="vuuTooltip",sx=({anchorElement:t,children:e,id:n,onMouseEnter:r,onMouseLeave:o,placement:i,status:s,style:l})=>{let a=ix({anchorElement:t,placement:i});return a===void 0?null:(0,Wc.jsx)(oo,{children:(0,Wc.jsx)("div",{className:W(sm,{[`${sm}-error`]:s==="error"}),"data-align":i,id:n,style:{...l,...a},children:(0,Wc.jsx)("span",{className:`${sm}-content`,onMouseEnter:r,onMouseLeave:o,children:e})})})};var lx=require("@vuu-ui/vuu-utils"),Mt=require("react"),ax=({id:t,placement:e="right",tooltipContent:n})=>{let r=(0,Mt.useRef)(),o=(0,Mt.useRef)(null),i=(0,Mt.useRef)(),s=(0,Mt.useRef)(),[l,a]=(0,Mt.useState)(),u=(0,lx.useId)(t),c=(0,Mt.useCallback)(m=>{var y;m.key==="Escape"&&((y=r.current)==null||y.call(r))},[]);r.current=(0,Mt.useCallback)(()=>{a(void 0),document.removeEventListener("keydown",c)},[c]);let f=(0,Mt.useCallback)(()=>{window.clearTimeout(s.current)},[]),d=(0,Mt.useCallback)(()=>{var m;(m=r.current)==null||m.call(r)},[]),h=(0,Mt.useCallback)(()=>{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=(0,Mt.useCallback)(m=>{let y=m.target;y&&(o.current=y,i.current=window.setTimeout(h,800))},[h]),v=(0,Mt.useCallback)(()=>{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}};var gd=require("react");var io=require("react");var Qo=require("react");var eI=require("@vuu-ui/vuu-utils"),ux=et(require("react"));var Yo=require("react"),mn=new Map,gn=new Map;var ms=()=>{let t=(0,Yo.useCallback)((s,l)=>{let a=gn.get(s);if(a)return l!==void 0&&a[l]!==void 0?a[l]:l!==void 0?void 0:a},[]),e=(0,Yo.useCallback)((s,l,a)=>{if(l===void 0)gn.set(s,a);else if(gn.has(s)){let u=gn.get(s);gn.set(s,{...u,[l]:a})}else gn.set(s,{[l]:a})},[]),n=(0,Yo.useCallback)((s,l)=>{if(gn.has(s)){if(l===void 0)gn.delete(s);else if(gn.get(s)[l]){let{[l]:u,...c}=gn.get(s);Object.keys(c).length>0?gn.set(s,c):gn.delete(s)}}},[]),r=(0,Yo.useCallback)((s,l)=>{let a=mn.get(s);if(a)return l!==void 0?a[l]:a},[]),o=(0,Yo.useCallback)((s,l,a)=>{if(l===void 0)mn.set(s,a);else if(mn.has(s)){let u=mn.get(s);mn.set(s,{...u,[l]:a})}else mn.set(s,{[l]:a})},[]),i=(0,Yo.useCallback)((s,l)=>{if(mn.has(s)){if(l===void 0)mn.delete(s);else if(mn.get(s)[l]){let{[l]:u,...c}=mn.get(s);Object.keys(c).length>0?mn.set(s,c):mn.delete(s)}}},[]);return{loadSessionState:t,loadState:r,saveSessionState:e,saveState:o,purgeState:i,purgeSessionState:n}};var Kc=(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}};var cx=require("react"),tI=t=>console.log(`dispatch ${t.type}, have you forgotten to provide a LayoutProvider ?`),lm=(0,cx.createContext)({dispatchLayoutProvider:tI,version:-1});var nI=require("react/jsx-runtime");var gs=()=>{let{dispatchLayoutProvider:t}=(0,Qo.useContext)(lm);return t},dx=()=>{let{createNewChild:t}=(0,Qo.useContext)(lm);return t};var Uc=(t,e,n,r)=>{var p;let{loadSessionState:o,purgeSessionState:i,purgeState:s,saveSessionState:l}=ms(),[a,u]=(0,io.useState)((p=o(t,"contributions"))!=null?p:[]),c=gs(),f=(0,io.useCallback)((m,y)=>{let x=a.concat([{location:m,content:y}]);l(t,"contributions",x),u(x)},[a,t,l]),d=(0,io.useCallback)(()=>{i(t,"contributions"),u([])},[t,i]),h=(0,io.useCallback)(()=>{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=(0,io.useCallback)(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[(0,io.useCallback)(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]};var kS=require("@vuu-ui/vuu-utils");var Lt=et(require("react"));var Bx=require("@vuu-ui/vuu-utils");var kr=require("react");var rI=/[.*+?^${}()|[\]\\]/g;function jc(t){return t.replace(rI,"\\$&")}var fx=(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});var qt=require("react");var vs=require("react"),gx=require("react/jsx-runtime"),hx=(0,vs.createContext)(void 0);function px({children:t,collectionHook:e,...n}){return(0,gx.jsx)(hx.Provider,{value:e,children:Object.keys(n).length>0?(0,vs.cloneElement)(t,n):t})}function mx(){let t=(0,vs.useContext)(hx);if(t)return t}var vx=t=>Object.prototype.toString.call(t)==="[object Object]";function qn(t){return typeof t=="string"?t:vx(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)}var pe=require("react");var ys=require("react");var yx=t=>null;var bx=t=>null;var am=(t,e)=>t!==null&&Object.prototype.hasOwnProperty.call(t,e),um=t=>am(t,"header"),xx=t=>am(t,"childNodes"),ca=(t,e)=>t&&Object.prototype.hasOwnProperty.call(t.props,e),wx=t=>{if((0,ys.isValidElement)(t)){if(ca(t,"disabled"))return t.props.disabled===!0}else if(am(t,"disabled"))return t.disabled===!0;return!1},Sx=t=>(0,ys.isValidElement)(t)&&ca(t,"focusable")?t.props.focusable:!0,Cx=(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},oI=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},kx=t=>t.type===bx||ca(t,"data-header"),Ex=t=>t.type===yx||ca(t,"data-group"),iI=t=>ca(t,"selectable")?t.props.selectable===!0:!Ex(t)&&!kx(t),sI=t=>{if(Ex(t)){let{props:{children:e}}=t;if(typeof e!="string")return dm(e)}},lI=(t,e)=>{let n=[];return ys.Children.forEach(t,r=>{(0,ys.isValidElement)(r)&&n.push(e(r))}),n},cm=(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:cm(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:qn(n)}});if(t)throw Error("list-child-items expects source to be an array")},dm=t=>{if(t)return lI(t,e=>{let{"data-id":n,disabled:r,id:o=n,"data-expanded":i,expanded:s=i}=e.props;return{childNodes:sI(e),disabled:r,expanded:s,header:kx(e),id:o,label:oI(e),selectable:iI(e),value:e}})},aI=new Set(["/","-","."]),uI=t=>aI.has(t),fm=(t,e)=>e.startsWith(t)&&uI(e[t.length]),cI=new Set([".","/"]);function dI(t,e){return e.startsWith(t)?cI.has(e.charAt(t.length)):!1}function qc(t,e,n){let r;return t.map(i=>i.id===e?{...i,...n}:dI(i.id,e)&&i.childNodes?(r=qc(i.childNodes,e,n),{...i,childNodes:r}):i)}var fI=t=>t&&t.replace(/^\s+/g,""),hm=t=>new RegExp(`(${jc(fI(t))})`,"gi"),Mx=(t="",e=hm)=>(n="")=>!!n.length&&!!t.length&&n.match(e(t))!==null;function Tx(t,e){return Array.isArray(t)?t.includes(e.id):t===e.id}var vn=require("react");function Ix({controlled:t,default:e,name:n,state:r="value"}){let{current:o}=(0,vn.useRef)(t!==void 0),[i,s]=(0,vn.useState)(e),l=t!==void 0?t:i,{current:a}=(0,vn.useRef)(e);(0,vn.useEffect)(()=>{},[r,n,t]),(0,vn.useEffect)(()=>{},[JSON.stringify(e,hI)]);let u=(0,vn.useCallback)(c=>{o||s(c)},[o]);return[l,u,o]}function hI(t,e){return(0,vn.isValidElement)(e)?null:e}var pI={},Gc=({children:t,id:e,options:n=pI,source:r})=>{var O,B;let{getItemId:o}=n,[,i]=(0,pe.useState)(null),s=mx(),l=(0,pe.useRef)([]),a=(0,pe.useRef)([]),u=(0,pe.useMemo)(()=>[],[]),c=(0,pe.useRef)((O=n.filterPattern)!=null?O:""),f=(B=n.disableFilter)!=null?B:!1,{getFilterRegex:d=hm,noChildrenLabel:h,itemToString:g=qn}=n,v=(0,pe.useCallback)(()=>n.defaultExpanded||!1,[n.defaultExpanded]),p=(0,pe.useCallback)((P,F,N=1,z="",q=[],Z=[],j=[])=>(P.forEach((U,ue,se)=>{var Qe,Xe;let Ie=U.header&&n.collapsibleHeaders,Le=U.childNodes&&n.collapsibleHeaders===!1,Ee=!U.childNodes||U.childNodes.length===0,ge=Le||Ee&&!Ie,Ke=z?`${z}.${ue}`:`item-${ue}`,Ye=(Qe=U.id)!=null?Qe:o?o(ue):`${e}-${Ke}`,Pe=ge?void 0:(Xe=U.expanded)!=null?Xe:v(),ye={...U,childNodes:void 0,count:!Le&&Pe===void 0?0:Cx(U,se,ue),description:U.description,disabled:wx(U.value),focusable:Sx(U.value)?void 0:!1,id:Ye,index:F.value,expanded:Pe,level:N};if(q.push(ye),Z.push(ye),j.push(P[ue].value),F.value+=1,U.childNodes){let[ct]=p(U.childNodes,F,N+1,Ke,[],Z,j);ye.childNodes=ct}}),[q,j,Z]),[n.collapsibleHeaders,o,e,v]),m=(0,pe.useCallback)(()=>c.current&&!f?Mx(c.current,d):null,[f,d]),y=(0,pe.useCallback)((P,F=m(),N=[],z={value:0})=>{let q=!1;for(let Z of P)q&&!um(Z)||(Z.value!==null&&(F===null||F(g(Z.value)))&&(N[z.value]=Z,z.value+=1),q=!1,um(Z)&&Z.expanded===!1?q=!0:xx(Z)&&Z.expanded!==!1&&Z.childNodes&&y(Z.childNodes,F,N,z));return N},[m,g]),x=(0,pe.useMemo)(()=>s?u:cm(r,{itemToString:g,noChildrenLabel:h})||dm(t)||[],[s,u,r,g,h,t]),[b,C,w]=(0,pe.useMemo)(()=>s?[u,u,u]:p(x,{value:0}),[u,p,s,x]);a.current=w,(0,pe.useMemo)(()=>s?u:l.current=y(b),[u,y,b,s]);let S=(0,pe.useRef)(b),E=(0,pe.useCallback)((P="")=>{typeof P=="string"&&(c.current=P,l.current=y(b),i({}))},[b,y]),k=(0,pe.useCallback)((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)&&fm(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=(0,pe.useCallback)((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)&&fm(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=(0,pe.useCallback)(P=>{let F=a.current.find(N=>(0,pe.isValidElement)(N.value)?N.label===P:N.value===P);if(F)return F;throw Error("useCollectionData toCollectionItem, item not found ")},[]),M=(0,pe.useCallback)(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=(0,pe.useCallback)(P=>{if(P===void 0)return;let F=M(P);return Array.isArray(F)?F.map(N=>N.id):F?[F.id]:[]},[M]),R=(0,pe.useCallback)(P=>{let F=N=>{let z=a.current.find(q=>(0,pe.isValidElement)(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=(0,pe.useCallback)(P=>{for(let F of S.current)if(P===F.value)return F.id;throw Error("useCollectionData itemToId, item not found")},[]),L=(0,pe.useCallback)(P=>{S.current=qc(S.current,P.id,{expanded:!1}),l.current=y(S.current),i({})},[y]),H=(0,pe.useCallback)(P=>{S.current=qc(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}};var so=require("react");var Px=["width"],Dx=["height"],Xo=new Map,Ax=(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}},Lx=new ResizeObserver(t=>{for(let e of t){let{target:n,borderBoxSize:r,contentBoxSize:o}=e,i=Xo.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=Ax(n,{height:s,width:l,contentHeight:a,contentWidth:u},h);v!==g&&(d=!0,f[h]=v)}d&&c&&c(f)}}});function ei(t,e,n,r=!1){let o=(0,so.useRef)(e),i=t.current,s=(0,so.useCallback)(l=>{let{width:a,height:u}=l.getBoundingClientRect(),{clientWidth:c,clientHeight:f}=l;return o.current.reduce((d,h)=>(d[h]=Ax(l,{width:a,height:u,contentHeight:f,contentWidth:c},h),d),{})},[]);(0,so.useLayoutEffect)(()=>{async function l(){Xo.set(i,{measurements:{}}),await document.fonts.ready;let a=Xo.get(i);if(a){let u=s(i);a.measurements=u,Lx.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&&(Xo.has(i)&&console.log("useResizeObserver attemping to observe same element twice",{target:i}),l()),()=>{i&&Xo.has(i)&&(Lx.unobserve(i),Xo.delete(i))}},[s,i]),(0,so.useEffect)(()=>{let l=t.current,a=Xo.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 Rx=t=>t===void 0||t==="default"||t==="deselectable",Jc=t=>t==="multiple"||(t==null?void 0:t.startsWith("extended"))===!0,Ox=t=>t==="none";var Cr=t=>t!==void 0&&t.length>0,Hx=t=>t[0];var da=require("react"),mI=[],Nx=({popperRef:t,rootRef:e,isOpen:n,onClose:r})=>{let o=(0,da.useRef)(n);(0,da.useEffect)(()=>{o.current=n},[n]),(0,da.useEffect)(()=>{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())}]:mI;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 gI=[],Fx=({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=(0,qt.useRef)(null),g=(0,qt.useRef)(null),v=(0,qt.useCallback)(H=>{g.current=H},[]),[p,m]=at({controlled:o,default:!!t,name:"useDropdown",state:"isOpen"}),[y,x]=(0,qt.useState)({width:(L=c!=null?c:d)!=null?L:0}),b=(0,qt.useCallback)(()=>{m(!0),i==null||i(!0)},[i,m]),C=(0,qt.useCallback)(H=>{m(!1),i==null||i(!1,H)},[i,m]);Nx({popperRef:g,rootRef:f,isOpen:p,onClose:C});let w=(0,qt.useCallback)(()=>{e||a&&(m(!0),i==null||i(!0),h.current=window.setTimeout(()=>{h.current=null},1e3))},[e,i,a,m]),S=(0,qt.useCallback)(H=>{if(["Enter"," "].indexOf(H.key)===-1){let O=!p;m(O),i==null||i(O)}},[p,m,i]),E=(0,qt.useCallback)(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=(0,qt.useCallback)(H=>{var O;p&&((O=g.current)!=null&&O.contains(H.relatedTarget)||C("blur"))},[C,p]),T=n!=null?n:!1;ei(f,T?Px:gI,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=Et(v,u.ref);return{componentProps:R,popupComponentRef:A,isOpen:p,label:"Dropdown Button",triggerProps:I}};var fa=require("react/jsx-runtime"),Zc="vuuDropdown",Vx=(0,kr.forwardRef)(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=(0,kr.useRef)(null),b=W(Zc,o,{[`${Zc}-fullWidth`]:l,[`${Zc}-disabled`]:s}),[C,w]=kr.Children.toArray(r),S=(0,Bx.useId)(a),{componentProps:E,isOpen:k,popupComponentRef:T,triggerProps:D}=Fx({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(0,kr.cloneElement)(C,fx(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(0,kr.cloneElement)(w,{...F,...H,className:W(O,`${Zc}-popup-component`),id:B,ref:T,width:g.endsWith("full-width")?"auto":P!=null?P:L})},R=Et(x,y);return(0,fa.jsxs)("div",{...m,className:b,id:a,ref:R,children:[M(),k&&(0,fa.jsx)(oo,{children:(0,fa.jsx)(ps,{...e,anchorElement:x,placement:g,children:I()})})]})});function vI(t,...e){let n=new Set(t);for(let r of e)for(let o of r)n.add(o);return n}var ha="ArrowUp",pa="ArrowDown",zx="ArrowLeft",$x="ArrowRight",pm="Enter";var mm="Home",Yc="End",gm="PageUp",Qc="PageDown",_x=" ",yI=new Set(["Enter","Delete"," "]),bI=new Set(["Tab"]),xI=new Set(["ArrowRight","ArrowLeft"]),Wx=new Set([mm,Yc,gm,Qc,pa,ha]),wI=new Set(["F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"]),SI=vI(yI,Wx,xI,wI,bI),Xc=t=>SI.has(t.key)?!1:t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey,Kx=({key:t})=>Wx.has(t);var vm=require("react");var CI={},kI=t=>Array.isArray(t.childNodes),EI=t=>!0,MI=t=>t.closest("[data-toggle],[aria-expanded]").dataset.toggle==="true",Ux=({collapsibleHeaders:t,collectionHook:e,highlightedIdx:n,onToggle:r})=>{let o=(0,vm.useCallback)(l=>{if(l.key===$x||l.key===pm){let a=e.data[n];a&&a.expanded===!1&&a.value&&(l.preventDefault(),e.expandGroupItem(a),r==null||r(a.value))}if(l.key===zx||l.key===pm){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:(0,vm.useCallback)(l=>{console.log(`useCollapsibleGroups idx=${n}`);let a=e.data[n];console.log(l.target,l.currentTarget),a&&kI(a)&&(!EI(a)||MI(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:CI};function TI(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 II=t=>t.closest("[data-index],[aria-posinset]");var jx=t=>TI(II(t));var ed=require("react"),LI={scrollToIndex:()=>{},scrollToItem:()=>{},scrollTo:()=>{}},qx=({collectionHook:t,forwardedRef:e,scrollableRef:n,scrollIntoView:r})=>{let o=(0,ed.useMemo)(()=>({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]);(0,ed.useImperativeHandle)(e,()=>n.current?o:LI,[o,n])};var Tt=require("react");var ti=require("@vuu-ui/vuu-utils"),bm=-2;function Gx(t,e,n){return e===ha||e===Yc?n>0?n-1:n:n===null?0:n===t-1?n:n+1}var ym=t=>{var n;let e=Array.isArray(t)?Hx(t):void 0;if(e){let r=document.getElementById(e);if(r){let o=parseInt((n=r.dataset.index)!=null?n:"-1");if((0,ti.isValidNumber)(o))return o}}return-1},PI=(t,e,n,r)=>t===Yc?r:t===mm?-1:e!==-1?e:n,DI=(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=(0,ti.getElementByDataIndex)(t,c,!0).getBoundingClientRect();while(f.top<o&&c<a);return c}},AI=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=(0,ti.getElementByDataIndex)(t,a,!0).getBoundingClientRect();while(u.top>r&&a>0);l(a)})})},RI=t=>t!==void 0,Jx=(t,e)=>{let n=(0,ti.getElementByDataIndex)(t,e);return RI(n)},Zx=({containerRef:t,defaultHighlightedIndex:e=-1,disableHighlightOnFocus:n,highlightedIndex:r,itemCount:o,onHighlight:i,onKeyboardNavigation:s,restoreLastFocus:l,selected:a,viewportItemCount:u})=>{let c=(0,Tt.useRef)(-1),[,f]=(0,Tt.useState)({}),[d,h,g]=at({controlled:r,default:e,name:"UseKeyboardNavigation"}),v=(0,Tt.useCallback)((k,T=!1)=>{i==null||i(k),h(k),T&&(c.current=k)},[i,h]),p=(0,Tt.useCallback)(async(k,T)=>{let D=(0,ti.getElementByDataIndex)(t.current,T,!0),M;if(D){let{current:I}=t;D&&I&&(M=k===Qc?DI(I,D,o,T):await AI(I,D,T))}return M!=null?M:T},[t,o]),m=(0,Tt.useCallback)((k=pa,T=k===pa?-1:o)=>{if(o===0)return-1;{let D=k==="End",M=k==="Home",I=D||M||T===-1?-1:ym(a),R=PI(k,T,I,o),A=Gx(o,k,R),{current:L}=t;if(A===0&&k===ha&&L&&!Jx(L,0))return T;for(;((k===pa||M)&&A<o||(k===ha||D)&&A>0)&&L&&!Jx(L,A);)A=Gx(o,k,A);return A}},[t,o,a]),y=(0,Tt.useRef)(!1),x=(0,Tt.useRef)(!1),b=k=>x.current=k,C=(0,Tt.useCallback)(()=>{if(x.current)x.current=!1;else if(y.current=!0,o===0)v(bm);else if(d!==-1)f({});else if(l)if(c.current!==-1)v(c.current);else{let k=ym(a);v(k!==-1?k:0)}else if(Cr(a)){let k=ym(a);v(k)}else n!==!0&&v(m())},[n,d,o,m,l,a,v]),w=(0,Tt.useCallback)(async k=>{let T=k.key===Qc||k.key===gm?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=(0,Tt.useCallback)(k=>{o>0&&Kx(k)?(k.preventDefault(),k.stopPropagation(),y.current=!0,w(k)):Xc(k)&&(y.current=!0)},[o,w]),E=(0,Tt.useMemo)(()=>({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}};var In=require("@vuu-ui/vuu-utils"),yn=require("react");var OI=["Enter"," "];var Yx=({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=(0,yn.useRef)(-1),p=(0,yn.useCallback)(M=>c.includes(M.key),[c]),[m,y]=Ix({controlled:a,default:e!=null?e:[],name:"UseSelection",state:"selected"}),x=(0,yn.useCallback)(M=>m.includes(M),[m]),b=(0,yn.useCallback)(M=>x(M)?[]:[M],[x]),C=(0,yn.useCallback)(M=>{let I=x(M)?m.filter(R=>R!==M):m.concat(M);return I.sort(),I},[x,m]),w=(0,yn.useCallback)((M,I)=>{let R=I?m:[],[A]=m.slice(-1),L=A?(0,In.getElementDataIndex)(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=(0,yn.useCallback)((M,I,R,A)=>{let{current:L}=t,{id:H}=(0,In.getElementByDataIndex)(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=(0,yn.useCallback)(M=>{let{current:I}=t,R=(0,In.getElementByDataIndex)(I,r);(0,In.isSelectableElement)(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=(0,yn.useCallback)((M,I)=>{if(g&&M.shiftKey){let{current:R}=t,A=(0,In.getElementByDataIndex)(R,I);(0,In.isSelectableElement)(A)&&S(M,I,!0)}},[g,t,S]),T=(0,yn.useCallback)(M=>{let{current:I}=t,R=(0,In.getElementByDataIndex)(I,r);!n&&(0,In.isSelectableElement)(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:Ox(u)?{onClick:i}:{onClick:T,onKeyDown:E,onKeyboardNavigation:k},selected:m,setSelected:y}};var ni=require("react");var Qx=({disableTypeToSelect:t,highlightedIdx:e,highlightItemAtIndex:n,typeToNavigate:r,items:o,applyIncrementalSearch:i=!0})=>{let s=(0,ni.useRef)(null),l=(0,ni.useRef)(""),a=(0,ni.useRef)(-1),u=(0,ni.useCallback)(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=(0,ni.useCallback)(f=>{let d=a.current!==-1;(Xc(f)||d&&f.key===_x)&&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}};var Gn=require("react");var Xx=["height"],HI=["height","scrollHeight"],NI=[],ew={containerOnly:[HI,NI],withContent:[Xx,Xx]},FI=t=>t?ew.containerOnly:ew.withContent,tw={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}}},nw=({containerRef:t,contentRef:e=tw,highlightedIdx:n=-1,indexPositions:r,stickyHeaders:o=!1})=>{let i=(0,Gn.useRef)(!1),s=(0,Gn.useRef)({height:0,contentHeight:0}),l=(0,Gn.useCallback)(v=>{i.current=!0,t.current&&(t.current.scrollTop=v),setTimeout(()=>{i.current=!1})},[]),a=(0,Gn.useCallback)(()=>l(0),[l]),u=(0,Gn.useCallback)(()=>{l(s.current.contentHeight-s.current.height)},[l]),c=(0,Gn.useCallback)(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]);ia(()=>{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=(0,Gn.useCallback)(({height:v,scrollHeight:p})=>{typeof v=="number"&&(s.current.height=v),typeof p=="number"&&(s.current.contentHeight=p)},[]),d=(0,Gn.useCallback)(({height:v})=>{typeof v=="number"&&(s.current.contentHeight=v)},[]),[h,g]=FI(e===tw);return ei(t,h,f,!0),ei(e,g,d,!0),{isScrolling:i,scrollIntoView:c}};var bs=require("react/jsx-runtime"),VI=fr("saltHighlighter"),rw=t=>{let{matchPattern:e,text:n=""}=t,r=typeof e=="string"?new RegExp(`(${jc(e)})`,"gi"):e;return r===void 0?(0,bs.jsx)(bs.Fragment,{children:n}):(0,bs.jsx)("span",{children:n.split(r).map((o,i)=>o.match(r)?(0,bs.jsx)("strong",{className:VI("highlight"),children:o},`${i}-${o}`):o)})};var xm=require("react");var sw=require("react/jsx-runtime"),ow="vuuCheckboxIcon",iw=({checked:t=!1,disabled:e=!1,...n})=>(0,sw.jsx)("span",{...n,className:W(ow,{[`${ow}-checked-${e?"disabled":"enabled"}`]:t})});var ri=require("react/jsx-runtime"),ma="vuuListItem",lw=(0,xm.forwardRef)(function({height:e,...n},r){return(0,ri.jsx)("div",{...n,"aria-hidden":!0,className:W(ma,`${ma}-proxy`),ref:r,style:{height:e}})}),aw=(0,xm.forwardRef)(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(ma,n,{vuuDisabled:r,[`${ma}-checkbox`]:f}),p=s!==void 0?{...d,height:s}:d;return(0,ri.jsxs)("div",{className:v,...h,"aria-disabled":r||void 0,"aria-selected":c||void 0,ref:g,style:p,children:[f&&(0,ri.jsx)(iw,{"aria-hidden":!0,checked:c}),e&&typeof e!="string"?e:l==null?(0,ri.jsx)("span",{className:`${ma}-textWrapper`,children:a||e}):(0,ri.jsx)(rw,{matchPattern:l,text:a||e})]})});var Hw=require("@vuu-ui/vuu-utils");var Bt=require("react");var Dw=require("@vuu-ui/vuu-utils"),Zn=require("react");var xs=require("react");var WI=require("react/jsx-runtime"),zI={isDragSource:void 0,isDropTarget:void 0,register:()=>{}},$I=()=>console.log("have you forgotten to provide a DragDrop Provider ?"),_I=(0,xs.createContext)({registerDragDropParty:$I});var uw=t=>{var s,l;let{dragSources:e,dropTargets:n,onDragOut:r,onEndOfDragOperation:o,registerDragDropParty:i}=(0,xs.useContext)(_I);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 zI};var td=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}}};var Tw=require("@vuu-ui/vuu-utils"),ce=require("react");var oi=require("react");var nd=require("react/jsx-runtime"),KI=t=>t.split(" ").map(e=>`vuuDraggable-${e}`),rd=(0,oi.forwardRef)(function({wrapperClassName:e,element:n,onDropped:r,onTransitionEnd:o,style:i,scale:s=1},l){let a=(0,oi.useCallback)(()=>{r==null||r()},[r]),u=(0,oi.useCallback)(d=>{d&&(d.innerHTML="",d.appendChild(n),s!==1&&(d.style.transform=`scale(${s},${s})`),d.addEventListener("vuu-dropped",a))},[n,a,s]),c=Et(l,u),f=(0,oi.useMemo)(()=>({left:0,top:0}),[]);return(0,nd.jsx)(oo,{children:(0,nd.jsx)(ps,{anchorElement:{current:document.body},placement:"absolute",position:f,children:(0,nd.jsx)("div",{className:W("vuuDraggable",...KI(e)),ref:c,onTransitionEnd:o,style:i})})})}),wm=t=>{let e=document.createElement("div");return e.className="vuuDraggable-spacer",t&&e.addEventListener("transitionend",()=>{t.current=!1}),e},cw=()=>{let t=document.createElement("div");return t.className="vuuDraggable-dropIndicatorPosition",t},dw=t=>{let e=document.createElement("div");return e.className="vuuDraggable-dropIndicator",t&&e.addEventListener("transitionend",()=>{t.current=!1}),e};var UI=["left","right"],jI=["top","bottom"],od=":not(.wrapped)",fw=':not([aria-hidden="true"])',hw=t=>{let e=t.cloneNode(!0);return e.removeAttribute("id"),e.dataset.index="-1",e},qI=(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"?UI:jI,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]},GI={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"}},Ft=t=>GI[t],pw=(t,e)=>{let n=t.find(r=>r.id===e);if(n)return n},mw=(t,e)=>{t.splice(e,1);for(let n=e;n<t.length;n++)t[n].currentIndex-=1},ws=(t,e,n,r,o)=>{let i=[],{DIMENSION:s}=Ft(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]=qI(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},Ss=(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},Sm=(t,e)=>{let n=Ss(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)}},ii=(t,e,n,r)=>{let o=t.length,i=Ss(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 gw(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 vw=(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},yw=(t,e)=>{let{SCROLL_SIZE:n,CLIENT_SIZE:r}=Ft(e),{[n]:o,[r]:i}=t;return o>i};var lo=require("react");var bw=({containerRef:t,onScrollingStopped:e,orientation:n="vertical"})=>{let r=(0,lo.useRef)(null),o=(0,lo.useRef)(!1),i=(0,lo.useRef)(0),s=(0,lo.useRef)("fwd"),l=(0,lo.useCallback)((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=(0,lo.useCallback)((u,c,f=30)=>{let{current:d}=t;if(d){let{SCROLL_POS:h,SCROLL_SIZE:g,CLIENT_SIZE:v}=Ft(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}};var Cs=require("react"),xw=({selected:t,viewportRange:e})=>{let n=(0,Cs.useRef)();n.current=e;let r=(0,Cs.useCallback)(s=>{s.ariaSelected&&Array.isArray(t)&&t.length>1&&console.log("its a selected element, and we have a multi select")},[t]),o=(0,Cs.useCallback)(()=>{},[]),i=(0,Cs.useCallback)(()=>{},[]);return{beginDrag:r,drag:o,drop:i}};var Ne=require("react");var ga=require("react");var ww=()=>{let t=(0,ga.useMemo)(()=>cw(),[]),e=(0,ga.useCallback)(()=>t.remove(),[t]);return{positionDropIndicator:(0,ga.useCallback)((r,o="end")=>(o==="end"?r.element.after(t):r.element.before(t),t),[t]),clearSpacer:e}};var Cw=require("react/jsx-runtime"),JI=':not([data-overflowed="true"])',ZI=':not([aria-hidden="true"])',Sw=({onDrop:t,orientation:e="horizontal",containerRef:n,itemQuery:r="*",selected:o,viewportRange:i})=>{let s=(0,Ne.useRef)(),l=(0,Ne.useRef)(null),a=(0,Ne.useRef)(null),u=(0,Ne.useRef)(""),c=(0,Ne.useRef)(!1),f=(0,Ne.useRef)(-1),d=(0,Ne.useRef)([]),h=(0,Ne.useRef)(!1),[g,v]=(0,Ne.useState)(!1),[p,m]=(0,Ne.useState)(),{clearSpacer:y,positionDropIndicator:x}=ww(),b=(0,Ne.useRef)(),C=`:is(${r}${JI}${ZI},[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=(0,Ne.useRef)();E.current=i;let k=(0,Ne.useCallback)(()=>{y()},[y]),T=(0,Ne.useCallback)((A,L,H)=>{let{current:O}=n,{current:B}=b;if(O&&B){d.current=ws(O,e,C,E.current);let{size:P}=B,N=f.current+P/2,{current:z}=d,q=ii(z,N,P,"fwd");q&&x(H&&A==="fwd"?z[z.length-1]:q,"start")}},[n,x,C,e]),D=(0,Ne.useCallback)(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}=Ft(e),{id:B}=A,{[H]:P,[O]:F}=L;c.current=P>F;let N=d.current=ws(L,e,C,i),z=pw(N,B);if(z&&L){let q=w(z);mw(N,q),b.current=z;let{current:Z}=E;if(Z!=null&&Z.atEnd)for(let ge=0;ge<N.length;ge++)S(N[ge],z.size);for(let ge=q;ge<N.length;ge++)S(N[ge],-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:Ie,width:Le}=ue.getBoundingClientRect(),Ee={top:z.isLast?Z!=null&&Z.atEnd&&!Z.atStart?se+z.size-2:se-2:se-z.size-2,left:Ie,width:Le,height:2};m((0,Cw.jsx)(rd,{wrapperClassName:"dropIndicatorContainer",style:Ee,ref:l,element:dw()}))}}},[o,n,e,C,i,x]),M=(0,Ne.useCallback)((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=ii(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=(0,Ne.useCallback)(()=>{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=(0,Ne.useCallback)(()=>{},[]);return{beginDrag:D,drag:M,drop:I,dropIndicator:p,handleScrollStart:k,handleScrollStop:T,releaseDrag:R,revealOverflowedItems:g}};var Je=require("react");var Ln=require("react");var kw=(t="horizontal")=>{let e=(0,Ln.useRef)(0),n=(0,Ln.useRef)(!1),r=(0,Ln.useMemo)(()=>[wm(n),wm()],[]),o=(0,Ln.useCallback)((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=(0,Ln.useCallback)((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=(0,Ln.useCallback)(()=>{e.current&&(cancelAnimationFrame(e.current),e.current=0)},[]),l=(0,Ln.useCallback)((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"&&Sm(u,h)}},[o,s,i,t,r]),a=(0,Ln.useCallback)((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"&&Sm(u,h)},[o,s,i,t,r]);return{displaceItem:l,displaceLastItem:a,clearSpacers:i}};var Cm=require("@vuu-ui/vuu-utils");var Ew=({onDrop:t,orientation:e="horizontal",containerRef:n,itemQuery:r="*",selected:o,viewportRange:i})=>{let s=(0,Je.useRef)(),l=(0,Je.useRef)(!1),a=(0,Je.useRef)(-1),u=(0,Je.useRef)([]),c=(0,Je.useRef)(!1),[f,d]=(0,Je.useState)(!1),{clearSpacers:h,displaceItem:g,displaceLastItem:v}=kw(e),p=(0,Je.useRef)(),m=`:is(${r}${od}${fw},.vuuOverflowContainer-OverflowIndicator)`,y=M=>u.current.findIndex(I=>I.id===M.id),x=(0,Je.useRef)();x.current=i;let b=(0,Je.useCallback)(()=>{h()},[h]),C=(0,Je.useCallback)((M,I,R)=>{let{current:A}=n,{current:L}=p;if(A&&L){u.current=ws(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=ii(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=(0,Je.useCallback)(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}=Ft(e),{id:H}=M,{[A]:O,[L]:B}=I;l.current=O>B;let P=u.current=ws(I,e,m,i,H);if(console.log({dropTargets:P}),R){let F=Ss(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=ii(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 Le=q+1;Le<P.length;Le++){let Ee=P[Le];Ee.mid+=N,Ee.end+=N,Ee.start+=N}(z.isLast?v:g)(P,z,z.size,!0,"static")}}},[n,g,v,m,e,o,i]),[S,E]=(0,Je.useMemo)(()=>{let M=!1;return[A=>{if(!M){M=!0;let L=A.element.querySelector(".vuuPopupMenu");L&&(0,Cm.dispatchMouseEvent)(L,"click")}},A=>{if(M){M=!1;let L=A.element.querySelector(".vuuPopupMenu");L&&(0,Cm.dispatchMouseEvent)(L,"click")}}]},[]),k=(0,Je.useCallback)((M,I)=>{let{current:R}=p;if(R&&n.current){a.current=M;let{current:A}=u,L=ii(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=(0,Je.useCallback)(()=>{var A;h();let{current:M}=u,I=Ss(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=Ss(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=(0,Je.useCallback)(()=>{h(!0)},[h]);return{beginDrag:w,drag:k,drop:T,handleScrollStart:b,handleScrollStop:C,releaseDrag:D,revealOverflowedItems:f}};var Iw=require("react/jsx-runtime"),YI={beginDrag:()=>{},drag:()=>{},draggableRef:{current:null},drop:()=>{},isDragging:!1,isScrolling:!1,handleScrollStart:()=>{},handleScrollStop:()=>{},revealOverflowedItems:!1},Mw={start:0,end:1e3,contraStart:0,contraEnd:1e3},QI=()=>YI,XI=3,eL=(t,e)=>t==null?void 0:t.closest(e),tL=(t,e)=>{let n=`:is(${e}${od},.vuuOverflowContainer-OverflowIndicator)`,o=Array.from(t.querySelectorAll(n)).pop();return[o,Lw(o)]},ks=({allowDragDrop:t,containerRef:e,draggableClassName:n,getDragPayload:r,id:o,itemQuery:i="*",onDragStart:s,onDrop:l,onDropSettle:a,orientation:u,...c})=>{let f=(0,ce.useRef)({start:0,end:0,contraStart:0,contraEnd:0}),[d,h]=(0,ce.useState)({draggable:void 0,draggedItemIndex:-1,isDragging:!1}),g=(0,ce.useRef)(null),v=(0,ce.useRef)(null),p=(0,ce.useRef)(!1),m=(0,ce.useRef)(null),y=(0,ce.useRef)({x:0,y:0}),x=(0,ce.useRef)({x:0,y:0}),b=(0,ce.useRef)(null),C=(0,ce.useRef)(null),w=(0,ce.useRef)(-1),S=(0,ce.useRef)(-1),E=(0,ce.useRef)(),{isDragSource:k,isDropTarget:T,onDragOut:D,onEndOfDragOperation:M,register:I}=uw(o),R=(0,ce.useRef)(),A=(0,ce.useRef)(),L=(0,ce.useCallback)(()=>{let{current:X}=R,{current:ee}=A;X&&ee&&(document.addEventListener("mousemove",X,!1),document.addEventListener("mouseup",ee,!1))},[]),H=(0,ce.useCallback)(()=>{let{current:X}=R,{current:ee}=A;X&&ee&&(document.removeEventListener("mousemove",X,!1),document.removeEventListener("mouseup",ee,!1))},[]),O=(0,ce.useCallback)((X,ee)=>{let{current:le}=e;if(le){let[G,te]=tL(le,i),{CONTRA:de,CONTRA_END:me,DIMENSION:Y,END:oe,START:on}=Ft(u),Hn=ee[Y],{[on]:Cn,[oe]:dr}=G.getBoundingClientRect();f.current.start=X[on],f.current.end=te?Math.max(Cn,X.right-Hn):p.current?X[on]+X[Y]-Hn:dr-Hn,f.current.contraStart=X[de],f.current.contraEnd=X[me]}},[e,i,u]),B=(0,ce.useCallback)(()=>{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&&(0,Tw.dispatchCustomEvent)(X,"vuu-dropped")},[e,i,a]),P=(0,ce.useCallback)(X=>{if(C.current&&g.current){let{mouseOffset:ee}=g.current,{POS:le,SCROLL_POS:G,SCROLL_SIZE:te,CLIENT_SIZE:de}=Ft(u),{[G]:me,[te]:Y,[de]:oe}=C.current,on=Y-oe,Hn=me<on,Cn=f.current.end,dr=me>0&&X-ee[le]<=f.current.start,Mo=Hn&&X-ee[le]>=Cn;return dr?"bwd":Mo?"fwd":""}},[C,u]),F=t===!0||t==="natural-movement"?Ew:t==="drop-indicator"?Sw:t==="drag-copy"?xw:QI,N=(0,ce.useCallback)((X,ee,le)=>{var G;(G=E.current)==null||G.call(E,X,ee,le)},[]),{isScrolling:z,startScrolling:q,stopScrolling:Z}=bw({containerRef:C,onScrollingStopped:N,orientation:u}),j=(0,ce.useCallback)((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:Ie,handleScrollStop:Le,releaseDrag:Ee,...ge}=F({...c,containerRef:e,isDragSource:k,isDropTarget:T,itemQuery:i,onDrop:j,orientation:u});E.current=Le;let Ke=(0,ce.useCallback)((X,ee)=>{let{CONTRA_POS:le}=Ft(u),G=y.current[le],te=k?Math.abs(G-ee):0;if(t===!0&&!k&&!T)return!1;let de=T===!1||te-X>5;if(g.current&&de)return D!=null&&D(o,g.current)&&(H(),Ee==null||Ee(),g.current=null),f.current=Mw,!0},[t,o,k,T,D,u,Ee,H]),Ye=(0,ce.useCallback)(X=>{let{CLIENT_POS:ee,CONTRA_CLIENT_POS:le,POS:G}=Ft(u),{clientX:te,clientY:de}=X,{[ee]:me,[le]:Y}=X,oe=y.current[G],on=Math.abs(oe-me),{current:Hn}=g;if(!Ke(on,Y)&&(y.current.x=te,y.current.y=de,Hn)){let{draggableElement:Cn,mouseOffset:dr}=Hn;if(f.current===Mw&&Cn){let Mo=y.current.x-dr.x,To=y.current.y-dr.y;Cn.style.top=`${To}px`,Cn.style.left=`${Mo}px`}else if(on>0&&Cn){let Mo=oe<me?"fwd":"bwd",To=P(me),su=y.current[G]-dr[G];if(To&&p.current&&!z.current?(Ie==null||Ie(),q(To,1)):!To&&z.current&&Z(),!z.current){let ol=Math.round(Math.max(f.current.start,Math.min(f.current.end,su))),lu=u==="horizontal"?"left":"top";Cn.style[lu]=`${ol}px`,ue(ol,Mo)}}}},[ue,Ke,P,Ie,z,u,q,Z]),Pe=(0,ce.useCallback)(()=>{H(),g.current&&(b.current=g.current.draggableElement),se(),h(X=>({...X,draggedItemIndex:-1,isDragging:!1}))},[se,H]);R.current=Ye,A.current=Pe;let ye=(0,ce.useCallback)(X=>{g.current=X;let{draggableElement:ee,mouseOffset:le}=X,{current:G}=e;if(G&&ee){let te=G.getBoundingClientRect(),de=ee.getBoundingClientRect();return O(te,de),y.current.x=de.left+le.x,y.current.y=de.top+le.y,U(ee),L(),!0}else return!1},[L,U,e,O]),Qe=(0,ce.useCallback)(X=>{let{current:ee}=e,{current:le}=m,G=eL(le,i);if(ee&&G){let te=vw(ee,i);p.current=yw(te,u),C.current=te;let de=ee.getBoundingClientRect(),me=G.getBoundingClientRect(),Y=g.current=new td(X,G);O(de,me),U(G);let{dataset:{index:oe="-1"}}=G;h({isDragging:!0,draggable:(0,Iw.jsx)(rd,{element:hw(G),onDropped:B,onTransitionEnd:B,ref:Y.setDraggable,style:gw(me,de),wrapperClassName:n}),draggedItemIndex:parseInt(oe)}),s==null||s(Y),L(),m.current=null}},[L,U,e,n,i,s,u,O,B]),Xe=(0,ce.useCallback)(X=>{let{current:ee}=x,{CLIENT_POS:le,POS:G}=Ft(u),{[le]:te}=X;if(Math.abs(te-ee[G])>XI&&e.current){v.current&&(window.clearTimeout(v.current),v.current=null),document.removeEventListener("mousemove",Xe),document.removeEventListener("mouseup",ct,!1);let me={clientX:ee.x,clientY:ee.y};Qe(me)}},[e,U,u]),ct=(0,ce.useCallback)(()=>{v.current&&(window.clearTimeout(v.current),v.current=null),document.removeEventListener("mousemove",Xe,!1),document.removeEventListener("mouseup",ct,!1)},[Xe]),Ue=(0,ce.useCallback)(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",Xe,!1),document.addEventListener("mouseup",ct,!1),X.persist(),v.current=window.setTimeout(()=>{document.removeEventListener("mousemove",Xe,!1),document.removeEventListener("mouseup",ct,!1),Qe(te)},500)}},[e,Qe,Xe,ct]),{current:At}=b;return(0,ce.useLayoutEffect)(()=>{if(At&&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(At),de=parseInt(te.getPropertyValue("left")),me=parseInt(te.getPropertyValue("top"));de!==G||me!==le?(At.classList.add("vuuDraggable-settling"),At.style.top=`${le}px`,At.style.left=`${G}px`):B()}))}},[e,i,At,B]),(0,ce.useEffect)(()=>{o&&(k||T)&&I(o,t==="drop-only"?!1:ye,l)},[t,o,k,T,l,I,ye]),{...ge,...d,isScrolling:z,onMouseDown:t&&t!=="drop-only"?Ue:void 0}};var Jn=require("react");var Pw=({dataHook:t,onDrop:e,onMoveListItem:n,selected:r,setHighlightedIndex:o,setSelected:i})=>{let s=(0,Jn.useRef)([]),l=(0,Jn.useRef)(t);l.current=t;let a=(0,Jn.useCallback)((d,h,g)=>d===h?g:d<Math.min(h,g)||d>Math.max(h,g)?d:h<d?d-1:d+1,[]),u=(0,Jn.useCallback)((d,h,g)=>d.map(p=>l.current.indexOfItemById(p)).map(p=>a(p,h,g)),[a]),c=(0,Jn.useCallback)((d,h,g)=>{Cr(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=(0,Jn.useCallback)(d=>{o(d)},[o]);return(0,Jn.useEffect)(()=>{let{current:d}=s;if(Cr(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 id=({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=(0,Zn.useRef)(T||s),H=(G,te)=>{var de,me;(me=(de=se.listHandlers).onKeyboardNavigation)==null||me.call(de,G,te),x==null||x(G,te)},O=(0,Zn.useCallback)((G,te)=>{w&&te!==null&&w(G,n.itemById(te))},[n,w]),B=(0,Zn.useMemo)(()=>{var G,te;return k||{current:(te=(G=r.current)==null?void 0:G.querySelector(".vuuList-scrollContainer"))!=null?te:null}},[r,k]),P=(0,Zn.useCallback)((G,te)=>{if(S){if(Rx(D)){let[de]=te;S(G,n.itemById(de))}else if(Jc(D)){let de=te.map(me=>n.itemById(me));S(G,de)}}},[n,S,D]),{highlightedIndex:F,containerProps:{onKeyDown:N,onMouseMove:z,...q},setHighlightedIndex:Z,...j}=Zx({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=Ux({collapsibleHeaders:e,highlightedIdx:F,collectionHook:n}),ue=(0,Zn.useCallback)(G=>{Z(-1),p==null||p(G)},[p,Z]),se=Yx({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:Ie,onDropSettle:Le}=Pw({dataHook:n,onDrop:m,onMoveListItem:C,selected:se.selected,setHighlightedIndex:Z,setSelected:se.setSelected}),{setSelected:Ee}=se;(0,Dw.useLayoutEffectSkipFirst)(()=>{Cr(L.current)&&Ee([])},[T,n.data,Ee]);let{onMouseDown:ge,isDragging:Ke,isScrolling:Ye,...Pe}=ks({allowDragDrop:t,draggableClassName:"list-item",orientation:"vertical",containerRef:r,id:d,itemQuery:".vuuListItem",onDragStart:ue,onDrop:Ie,onDropSettle:Le,viewportRange:A}),{onKeyDown:ye}=Qx({disableTypeToSelect:c,highlightedIdx:F,highlightItemAtIndex:Z,typeToNavigate:!0,items:n.data}),Qe=(0,Zn.useCallback)(G=>{var te,de,me;G.defaultPrevented||ye==null||ye(G),N(G),G.defaultPrevented||(de=(te=se.listHandlers).onKeyDown)==null||de.call(te,G),G.defaultPrevented||(me=U==null?void 0:U.onKeyDown)==null||me.call(U,G),G.defaultPrevented||b==null||b(G)},[U,N,b,se.listHandlers,ye]),{isScrolling:Xe,scrollIntoView:ct}=nw({containerRef:B,contentRef:o,highlightedIdx:F,indexPositions:n.data,stickyHeaders:I}),Ue=Xe.current||Ye.current,At=(0,Zn.useCallback)(G=>{if(!Ue&&!l&&!Ke){z();let te=jx(G.target);if(te!==-1&&te!==F){let de=n.data[te];!de||de.disabled?Z(-1):Z(te)}}},[Ke,Ue,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:Qe,onMouseDown:ge,onMouseDownCapture:q.onMouseDownCapture,onMouseLeave:q.onMouseLeave},le=g||{onClick:se.listHandlers.onClick,onMouseMove:At};return{focusVisible:j.focusVisible,controlledHighlighting:j.controlledHighlighting,highlightedIndex:F,keyboardNavigation:j.keyboardNavigation,listHandlers:le,listItemHeaderHandlers:U,listControlProps:ee,scrollIntoView:ct,selected:se.selected,setHighlightedIndex:Z,setIgnoreFocus:j.setIgnoreFocus,setSelected:se.setSelected,...Pe}};var Yn=require("react");var nL=(t,e,n=0)=>t===0?0:n===0?t*e:t-1*(e+n)+e,Aw=({displayedItemCount:t,getItemHeight:e,height:n,itemCount:r,itemGapSize:o,itemHeight:i=36,size:s})=>{let[l,a]=(0,Yn.useState)(i),[,u]=(0,Yn.useState)({}),c=(0,Yn.useRef)(null),[f,d]=(0,Yn.useMemo)(()=>{let v=0,p=l!=null?l:i,m=nL(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=(0,Yn.useCallback)(({height:v})=>{typeof v=="number"&&a(v)},[]),g=(0,Yn.useCallback)(v=>{c.current=v,u({})},[]);return ei(c,Dx,h,!0),{computedListHeight:d,contentHeight:f,listClientHeight:s==null?void 0:s.height,listItemHeight:l,rowHeightProxyRef:g}};var Qn=require("react"),Rw=(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}},Ow=({containerSize:t,itemCount:e,itemGapSize:n=0,itemSize:r,onViewportScroll:o})=>{let i=(0,Qn.useRef)(0),s=(0,Qn.useRef)(0),l=(0,Qn.useRef)(0),a=(0,Qn.useMemo)(()=>Rw(l.current,t,e,r+n),[t,e,r,n]),[u,c]=(0,Qn.useState)(a);return ia(()=>{c(a)},[a]),{onVerticalScroll:(0,Qn.useCallback)(d=>{let h=d.target.scrollTop;if(h!==l.current){l.current=h;let g=r+n,v=Rw(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}};var Gt=require("react/jsx-runtime"),Fw=require("react"),rL="No data to display",ao="vuuList",Nw=(0,Bt.forwardRef)(function({ListItem:e=aw,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=qn,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:Ie=0,tabToSelect:Le,...Ee},ge){var Zv,Yv;let Ke=(0,Hw.useId)(x),Ye=(0,Bt.useRef)(null),Pe=(0,Bt.useRef)(null),ye=(0,Bt.useRef)(null),[Qe,Xe]=(0,Bt.useState)(),ct=(0,Bt.useCallback)(kn=>{Xe(kn)},[]),Ue=Gc({id:Ke,label:"List",source:U,children:o,options:{collapsibleHeaders:s,getItemId:p,itemToString:S}}),{listClientHeight:At,computedListHeight:X,listItemHeight:ee,rowHeightProxyRef:le}=Aw({displayedItemCount:d,getItemHeight:v,height:m,itemCount:Ue.data.length,itemGapSize:b,itemHeight:C,rootRef:Ye,size:Qe}),{onVerticalScroll:G,viewportRange:te}=Ow({containerSize:(Yv=(Zv=At!=null?At:X)!=null?Zv:Qe==null?void 0:Qe.height)!=null?Yv:0,itemCount:Ue.data.length,itemGapSize:b,itemSize:ee}),{draggable:de,draggedItemIndex:me,dropIndicator:Y,focusVisible:oe,highlightedIndex:on,listControlProps:Hn,listHandlers:Cn,listItemHeaderHandlers:dr,scrollIntoView:Mo,selected:To}=id({allowDragDrop:r,collapsibleHeaders:s,collectionHook:Ue,containerRef:Ye,contentRef:ye,defaultHighlightedIndex:l,defaultSelected:Ue.itemToCollectionItemId(a),disabled:u,disableTypeToSelect:f,highlightedIndex:y,id:Ke,label:"List",listHandlers:E,onClick:I,onDragStart:R,onDrop:A,onMoveListItem:L,onSelect:H,onSelectionChange:O,onHighlight:B,restoreLastFocus:P,scrollContainerRef:Pe,selected:Ue.itemToCollectionItemId(F),selectionStrategy:N,selectionKeys:Z,stickyHeaders:se,tabToSelect:Le,viewportRange:te});qx({collectionHook:Ue,forwardedRef:q,scrollableRef:Ye,scrollIntoView:Mo});let su=g!=null?g:oe,ol=function(ze,_t,Wt,dt){let Io=(0,Fw.createElement)(e,{...dr,className:W(`${ao}Header`,{focusVisible:s&&su===ze.value}),"aria-expanded":dt,"data-index":s?ze.value:void 0,"data-highlighted":ze.value===on||void 0,"data-sticky":se,"data-selectable":!1,id:_t,itemHeight:lu(ze.value),key:`header-${ze.value}`,label:Wt});return ze.value+=1,Io},lu=v===void 0?()=>C:v;function YM(kn,ze,_t){var cu,Qv;let{disabled:Wt,value:dt,id:Io,label:au}=ze,uu=(0,Bt.isValidElement)(dt),il={className:W((cu=dt==null?void 0:dt.props)==null?void 0:cu.className,{vuuHighlighted:_t.value===on,vuuFocusVisible:su===_t.value,"vuuDraggable-dragAway":me===_t.value}),disabled:Wt||u,id:Io,item:uu?void 0:(Qv=ze==null?void 0:ze.value)!=null?Qv:void 0,itemHeight:lu(_t.value),itemTextHighlightPattern:w,key:Io,"data-index":_t.value,label:au,role:"option",selected:Tx(To,ze),showCheckbox:z};kn.push(uu?(0,Bt.cloneElement)(dt,il):(0,Gt.jsx)(e,{...il})),_t.value+=1}let QM=function(ze,_t,Wt){let{count:dt=0,id:Io,expanded:au,label:uu=""}=_t[Wt.value],il=ol(Wt,Io,uu,au),cu=au!==!1?[il].concat(Gv(_t,Wt,Wt.value+dt)||[]):il;ze.push((0,Gt.jsx)("div",{role:"group",children:cu},Io))},Gv=(kn,ze={value:0},_t=kn.length)=>{let Wt=[];for(;ze.value<_t;){let dt=kn[ze.value];dt.header?Wt.push(ol(ze,dt.id,dt.label,dt.expanded===!1)):dt.childNodes?QM(Wt,kn,ze):YM(Wt,dt,ze)}return Wt};function XM(){return h||j?(0,Gt.jsx)("span",{className:`${ao}-empty-message`,children:h!=null?h:rL}):null}let Jv=Ue.data.length===0,e2=()=>{if(Jv)XM();else{let kn=Ue.data;return Gv(kn)}},t2="auto",n2={"--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(0,Gt.jsxs)(Bw,{"aria-multiselectable":N==="multiple"||N==="extended"||N==="extended-multi-range"||void 0,...Ee,...Cn,...Hn,className:W(ao,i,{[`${ao}-collapsible`]:s,[`${ao}-contentSized`]:X!==void 0,[`${ao}-empty`]:Jv,vuuFocusVisible:on===bm}),height:X!=null?X:m,id:`${Ke}`,onResize:ct,ref:Et(Ye,ge),role:"listbox",onScroll:G,style:{...ue,...n2},tabIndex:u||c?void 0:Ie,children:[(0,Gt.jsx)(lw,{ref:le,height:C}),Ue.data.length===0&&n!==void 0?(0,Gt.jsx)(Gt.Fragment,{children:(0,Gt.jsx)(n,{})}):(0,Gt.jsx)("div",{className:`${ao}-viewport`,ref:Pe,children:(0,Gt.jsxs)("div",{className:`${ao}-scrollingContentContainer`,ref:ye,style:{height:t2},children:[e2(),Y,de]})})]})});var Ww=require("@vuu-ui/vuu-utils");var Es=require("react");var zw=require("react/jsx-runtime"),oL="vuuChevronIcon",Vw=t=>{let{direction:e,...n}=t;return(0,zw.jsx)("span",{...n,className:W(oL,e)})};var $w=require("@vuu-ui/vuu-utils");var Re=require("react");var iL=["Enter"],_w=({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=qn,listRef:y,onOpenChange:x,onSelectionChange:b,onSetSelectedText:C,selected:w,selectionKeys:S=iL,selectionStrategy:E,value:k,InputProps:T={onBlur:l,onFocus:a,onChange:u,onSelect:f}})=>{let D=Jc(E),{setFilterPattern:M}=r,I=(0,Re.useRef)(null),R=(0,Re.useRef)(D?[]:null),A=(0,Re.useRef)(!0),[L,H]=at({controlled:g,default:o!=null?o:!1,name:"useDropdownList"}),[O,B]=at({controlled:void 0,default:s!=null?s:k,name:"ComboBox",state:"value"}),[P,F]=(0,Re.useState)(!0),N=(0,Re.useCallback)(Y=>{var oe;Array.isArray(Y)||Y==null&&((oe=I.current)==null||oe.call(I,-1))},[]),z=(0,Re.useCallback)((Y,oe=!0)=>{B(Y),oe&&M(Y===""?void 0:Y)},[M,B]),q=(0,Re.useCallback)(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=(0,Re.useCallback)(()=>{let{current:Y}=R;q(Y)&&Y&&(Array.isArray(Y)||Y)&&(b==null||b(null,Y))},[b,q]),j=(0,Re.useCallback)(()=>{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=(0,Re.useCallback)((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=(0,Re.useCallback)((Y,oe)=>{R.current=oe,D||U(!1,"select")},[U,D]),se=(0,Re.useCallback)(()=>{F(!1)},[]),{focusVisible:Ie,setHighlightedIndex:Le,highlightedIndex:Ee,listControlProps:ge,listHandlers:Ke,selected:Ye}=id({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=Le;let{onClick:Pe}=Ke,ye=(0,Re.useCallback)(Y=>{var oe;(oe=document.getElementById(`${d}-input`))==null||oe.focus(),Pe==null||Pe(Y)},[d,Pe]),Qe=(0,Re.useCallback)(Y=>{let oe=Y.target.value;B(oe),oe&&oe.trim().length?M(oe):M(void 0),H(!0)},[M,H,B]),Xe=(0,Re.useCallback)(Y=>{Y.key==="Backspace"&&t&&(R.current=null,c==null||c())},[t,c]),{onFocus:ct=a}=T,{onFocus:Ue}=ge,At=(0,Re.useCallback)(Y=>{F(!1),Ue==null||Ue(Y),ct==null||ct(Y)},[ct,Ue]),X=(0,Re.useCallback)(Y=>{let oe=Y.relatedTarget;return(oe==null?void 0:oe.id)===`${d}-list`},[d]),{onBlur:ee=l}=T,{onBlur:le}=ge,G=(0,Re.useCallback)(Y=>{X(Y)||(le==null||le(Y),ee==null||ee(Y),F(!0),A.current=!0)},[X,le,ee]),{onSelect:te}=T,de=(0,Re.useCallback)(Y=>{A.current?A.current=!1:F(!0),te==null||te(Y)},[te]);(0,$w.useLayoutEffectSkipFirst)(()=>{Cr(Ye)?N(Ye):Le(h)},[N,v,h,Ye,Le,H]);let me={...T.inputProps,"aria-label":n,autoComplete:"off",onKeyDown:Xe};return{focusVisible:Ie,highlightedIndex:Ee,isOpen:L,onOpenChange:U,inputProps:{...T,id:`${d}-input`,inputProps:me,onChange:Qe,onSelect:de,role:"combobox",value:O},listControlProps:{...ge,onBlur:G,onFocus:At},listHandlers:{...Ke,onClick:ye},selected:R.current}};var si=require("react/jsx-runtime"),Kw=(0,Es.forwardRef)(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=qn,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=(0,Ww.useId)(b),F=(0,Es.useRef)(null),N=ye=>Array.isArray(ye)&&ye.length>0?ye[0]:void 0,q=((ye,Qe)=>{let Xe=ye?N(ye):Qe?N(Qe):void 0;return Xe?S(Xe):""})(M,c),Z=Gc({id:P,source:A,children:a,options:{disableFilter:h,filterPattern:q,getFilterRegex:x,itemToString:S}}),{focusVisible:j,highlightedIndex:U,inputProps:{endAdornment:ue,...se},isOpen:Ie,listHandlers:Le,listControlProps:Ee,onOpenChange:ge,selected:Ke}=_w({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}),Ye=(0,Es.useCallback)(()=>{Ie?ge(!1,"toggle"):ge(!0)},[Ie,ge]);return(0,si.jsx)(px,{collectionHook:Z,children:(0,si.jsxs)(Vx,{...O,PopupProps:r,id:P,isOpen:Ie,onOpenChange:ge,openOnFocus:!0,ref:B,width:H,children:[(0,si.jsx)(jo,{...se,disabled:d,...Ee,endAdornment:ue===null?null:(0,si.jsx)(Vw,{direction:Ie?"up":"down",onClick:Ye})}),(0,si.jsx)(Nw,{...n,ListItem:o,defaultSelected:void 0,focusVisible:j,highlightedIndex:U,itemTextHighlightPattern:String(se.value)||void 0,listHandlers:Le,onSelectionChange:D,ref:F,selected:Ke,selectionStrategy:R,tabIndex:-1})]})})});var Pn=require("react");var ld=require("react/jsx-runtime"),sd="vuuEditableLabel",ad=(0,Pn.forwardRef)(function({className:e,defaultEditing:n,defaultValue:r,editing:o,onChange:i,onEnterEditMode:s,onExitEditMode:l,value:a,...u},c){let f=(0,Pn.useRef)(null),d=(0,Pn.useRef)(!1),[h,g]=at({controlled:a,default:r!=null?r:"",name:"EditableLabel",state:"value"}),[v,p]=at({controlled:o,default:n!=null?n:!1,name:"EditableLabel",state:"editing"}),m=(0,Pn.useCallback)(T=>{p(d.current=T)},[p]),y=(0,Pn.useRef)(h);(0,Pn.useLayoutEffect)(()=>{v&&f.current!==null&&(f.current.select(),f.current.focus())},[v,f]);let x=(0,Pn.useCallback)(()=>{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(sd,e,{[`${sd}-editing`]:v});return(0,ld.jsx)("div",{...u,className:k,onDoubleClick:w,"data-text":h,ref:c,children:v?(0,ld.jsx)(jo,{inputProps:{className:`${sd}-input`,spellCheck:!1},value:h,onBlur:S,onChange:C,onKeyDown:E,inputRef:f,style:{padding:0},textAlign:"left",variant:"secondary"}):(0,ld.jsx)("span",{className:`${sd}-label`,children:h})})});var jw=require("react");var ud=require("@vuu-ui/vuu-utils");var Ms=require("react");var uo=require("react/jsx-runtime"),km="vuuInput",sL={autoComplete:"off"},Uw=(0,Ms.forwardRef)(function({className:e,errorMessage:n,id:r,onCommit:o,onKeyDown:i,type:s,...l},a){let u=(0,ud.useId)(r),{anchorProps:c,tooltipProps:f}=ax({id:u,tooltipContent:n}),d=(0,Ms.useCallback)((p,m)=>{if(s==="number"){let y=parseFloat(m);if((0,ud.isValidNumber)(y))o(p,y);else throw Error("Invalid value")}else s==="boolean"?o(p,!!m):o(p,m)},[o,s]),h=(0,Ms.useCallback)(p=>{if(p.key==="Enter"){p.preventDefault(),p.stopPropagation();let{value:m}=p.target;d(p,m)}i==null||i(p)},[d,i]),g=(0,Ms.useCallback)(p=>{let{value:m}=p.target;d(p,m)},[d]),v=n?(0,uo.jsx)("span",{...c,className:`${km}-errorIcon`,"data-icon":"error"}):void 0;return(0,uo.jsxs)(uo.Fragment,{children:[(0,uo.jsx)(jo,{...l,endAdornment:v,id:u,inputProps:{...sL,...l.inputProps},className:W(km,e,{[`${km}-errror`]:n}),onBlur:g,ref:a,onKeyDown:h}),f?(0,uo.jsx)(sx,{...f,status:"error"}):null]})});var Mm=require("react/jsx-runtime"),Em="vuuExpandoInput",lL=()=>{},cd=(0,jw.forwardRef)(function({className:e,errorMessage:n,value:r,inputProps:o,onCommit:i=lL,...s},l){return(0,Mm.jsx)("div",{className:W(Em,e,{[`${Em}-error`]:n}),"data-text":r,children:(0,Mm.jsx)(Uw,{...s,errorMessage:n,inputProps:{...o,className:`${Em}-input`},onCommit:i,ref:l,style:{padding:0},textAlign:"left",value:r,variant:"secondary"})})});var sS=require("@vuu-ui/vuu-utils");var Is=et(require("react"));var oS=require("@vuu-ui/vuu-utils"),vt=require("react");var qw=t=>typeof t=="object"&&t!==null&&"tabIndex"in t&&typeof t.tabIndex=="number",Gw=t=>({label:"Close",location:"tab",action:"close-tab",options:t}),Jw=t=>({label:"Rename",location:"tab",action:"rename-tab",options:t});var Zw=require("@vuu-ui/vuu-utils"),Yw=(t,e)=>{if(t){let n=t.querySelector(`[data-index]:has(${e})`);return(0,Zw.getElementDataIndex)(n)}return-1},Tm=t=>Yw(t,'[aria-selected="true"]'),Qw=t=>Yw(t,".vuuEditableLabel-editing");var Ts=require("@vuu-ui/vuu-utils"),Er=require("react"),Xw=(t,e,n="horizontal")=>{let r=(0,Er.useRef)(!1),o=(0,Er.useCallback)(()=>{r.current=!0},[]),i=(0,Er.useCallback)(()=>{r.current=!1},[]),s=(0,Er.useCallback)(()=>{var a,u;(a=t.current)==null||a.style.setProperty("--tab-thumb-transition","none"),(u=t.current)==null||u.removeEventListener("transitionend",s)},[t]),l=(0,Er.useRef)(-1);return(0,Er.useMemo)(()=>{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}=Ts.MEASURES[n];if(d&&h&&!r.current){let{[g]:p,[v]:m}=d.getBoundingClientRect(),{[g]:y}=h.getBoundingClientRect();if((0,Ts.isValidNumber)(p)&&(0,Ts.isValidNumber)(y)&&(0,Ts.isValidNumber)(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])};var fd=require("@vuu-ui/vuu-utils"),nt=require("react"),It=require("@vuu-ui/vuu-utils");var tS={horizontal:{[It.Home]:"start",[It.End]:"end",[It.ArrowLeft]:"bwd",[It.ArrowRight]:"fwd"},vertical:{[It.Home]:"start",[It.End]:"end",[It.ArrowUp]:"bwd",[It.ArrowDown]:"fwd"}},aL=(t,e="horizontal")=>tS[e][t]!==void 0,uL=t=>t===It.ArrowDown;function eS(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 cL=t=>t!==null&&!t.classList.contains("wrapped"),dd=(t,e)=>t?t.querySelector(`[data-index="${e}"]`):null,nS=({containerRef:t,defaultHighlightedIdx:e=-1,highlightedIdx:n,keyBoardActivation:r,orientation:o,selectedIndex:i=0})=>{let s=r==="manual",l=(0,nt.useRef)(!1),a=(0,nt.useRef)(-1),[u,c]=(0,nt.useState)(!1),[,f]=(0,nt.useState)({}),[d,h]=at({controlled:n,default:e,name:"UseKeyboardNavigation"}),g=(0,nt.useCallback)(M=>{h(a.current=M)},[h]),v=(0,nt.useRef)(!1),p=(0,nt.useCallback)((M,I=!1,R,A=70)=>{g(M),R===!0&&!v.current&&(v.current=!0);let L=()=>{let H=dd(t.current,M);if(H){let O=(0,fd.getFocusableElement)(H);O==null||O.focus()}};I?L():setTimeout(L,A)},[t,g]),m=M=>{if(a.current===-1&&M.target.tabIndex!==-1){let I=Qw(t.current);I!==-1?requestAnimationFrame(()=>{g(I)}):setTimeout(()=>{a.current===-1&&i!==null&&g(i)},200)}},y=(0,nt.useCallback)(()=>{var M,I;return(I=(M=t.current)==null?void 0:M.querySelectorAll("[data-index]").length)!=null?I:0},[t]),x=(0,nt.useCallback)((M="fwd",I)=>{let R=y(),L=eS(R,M,typeof I=="number"?I:R),H=M==="start"?"fwd":M==="end"?"bwd":M;for(;(H==="fwd"&&L<R||H==="bwd"&&L>0)&&!cL(dd(t.current,L));){let O=eS(R,H,L);if(O===L)break;L=O}return L},[t,y]),b=(0,nt.useCallback)((M,I=!1)=>{let R=tS[o][M.key],A=x(R,d);A!==d?s&&p(A,!0):I&&f({})},[d,s,x,p,o]),C=(0,nt.useCallback)(()=>{let M=dd(t.current,d);return M?M.querySelector(".vuuPopupMenu")!=null:!1},[t,d]),w=(0,nt.useCallback)(()=>{let M=dd(t.current,d),I=M==null?void 0:M.querySelector(".vuuPopupMenu");return I&&(0,fd.dispatchMouseEvent)(I,"click"),!1},[t,d]),S=(0,nt.useCallback)(M=>{y()>0&&aL(M.key,o)?(M.preventDefault(),v.current?b(M):(v.current=!0,b(M,!0))):uL(M.key)&&C()&&w()},[w,y,C,b,o]),E=(M,I)=>{g(I)},k=(0,nt.useCallback)(()=>{u||(c(!0),l.current?l.current=!1:v.current=!0)},[u]),T=(0,nt.useCallback)(()=>{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}};var va=require("react"),dL=["Enter"," "],fL=t=>t&&t.matches('[class*="vuuTab "]'),rS=({defaultSelected:t,highlightedIdx:e,onSelectionChange:n,selected:r})=>{let[o,i,s]=at({controlled:r,default:t!=null?t:0,name:"Tabstrip",state:"value"}),l=(0,va.useCallback)(f=>dL.includes(f.key),[]),a=(0,va.useCallback)(f=>{i(f),n==null||n(f)},[n,i]),u=(0,va.useCallback)(f=>{let d=f.target;l(f)&&e!==o&&fL(d)&&(f.stopPropagation(),f.preventDefault(),a(e))},[l,e,o,a]),c=(0,va.useCallback)((f,d)=>{d!==o&&a(d)},[a,o]);return{activateTab:a,isControlled:s,onClick:c,onKeyDown:u,selected:o}};var hL=new Set(["Enter"," "]),pL=t=>hL.has(t),mL=(t,e)=>t?t.querySelector(`[data-index="${e}"]`):null,iS=({activeTabIndex:t,allowDragDrop:e,animateSelectionThumb:n,containerRef:r,onActiveChange:o,onAddTab:i,onCloseTab:s,onExitEditMode:l,onMoveTab:a,orientation:u,keyBoardActivation:c})=>{let f=(0,vt.useRef)(t),{focusTab:d,highlightedIdx:h,onClick:g,onKeyDown:v,setHighlightedIdx:p,...m}=nS({containerRef:r,keyBoardActivation:c,orientation:u,selectedIndex:f.current}),{activateTab:y,onClick:x,onKeyDown:b,selected:C}=rS({highlightedIdx:h,onSelectionChange:o,selected:t});f.current=C;let{containerStyle:w,resumeAnimation:S,suspendAnimation:E}=Xw(r,n?C:-1,u),k=(0,vt.useCallback)((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}=ks({allowDragDrop:e,containerRef:r,draggableClassName:`tabstrip-${u}`,onDrop:k,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"}),M=(0,vt.useCallback)((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=(0,vt.useCallback)((j,U)=>{g(j,U),x(j,U)},[g,x]),R=(0,vt.useCallback)((j=h)=>{let U=mL(r.current,j);if(U)return U.querySelector(".vuuEditableLabel")},[r,h]),A=(0,vt.useCallback)((j=h)=>{let U=R(j);return U?U.classList.contains("vuuEditableLabel-editing"):!1},[R,h]),L=(0,vt.useCallback)((j=h)=>{let U=R(j);U&&(0,oS.dispatchMouseEvent)(U,"dblclick")},[R,h]),H=(0,vt.useCallback)(j=>{v(j),j.defaultPrevented||b(j),!j.defaultPrevented&&pL(j.key)&&L()},[L,v,b]),O=(0,vt.useCallback)(j=>{let U=Tm(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=(0,vt.useCallback)(j=>(L(j),!0),[L]),P=(0,vt.useCallback)(j=>{if(qw(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=(0,vt.useCallback)(()=>{A()?p(h):d(h)},[h,d,p,A]),N=(0,vt.useCallback)(j=>{let U=parseInt(j.index);isNaN(U)||y(U)},[y]),z={onFocus:m.onFocus,onKeyDown:H},q=(0,vt.useCallback)(()=>{i==null||i(),requestAnimationFrame(()=>{let j=Tm(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}};var Ls=require("react/jsx-runtime"),aS=require("react"),Im="vuuTabstrip",lS=({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=(0,Is.useRef)(null),{activeTabIndex:w,focusVisible:S,containerStyle:E,draggedItemIndex:k,onClickAddTab:T,tabProps:D,...M}=iS({activeTabIndex:t,allowDragDrop:r,animateSelectionThumb:i,containerRef:C,keyBoardActivation:u,onActiveChange:f,onAddTab:d,onCloseTab:h,onExitEditMode:g,onMoveTab:v,orientation:p}),I=(0,sS.useId)(a),R=W(Im,`${Im}-${p}`,l),A=y||E?{...y,...E}:void 0,L=(0,Is.useMemo)(()=>Ac(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 Is.default.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?(0,aS.createElement)(br,{...M.navigationProps,"aria-label":"Create Tab",className:`${Im}-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(0,Ls.jsxs)(Ls.Fragment,{children:[(0,Ls.jsx)(uS,{...b,...M.containerProps,className:R,height:29,id:I,orientation:p,overflowIcon:"more-horiz",ref:C,style:A,role:"tablist",children:L}),M.draggable]})};var ui=require("react");var cS=require("react");var fS=require("react/jsx-runtime"),gL="vuuTabMenu",dS=({allowClose:t,allowRename:e,controlledComponentId:n,controlledComponentTitle:r,location:o,onMenuAction:i,onMenuClose:s,index:l})=>{let[a,u]=(0,cS.useMemo)(()=>[(c,f)=>{let d=[];return e&&d.push(Jw(f)),t&&d.push(Gw(f)),d},{controlledComponentId:n,controlledComponentTitle:r,tabIndex:l}],[t,e,n,r,l]);return(0,fS.jsx)($c,{className:gL,menuBuilder:a,menuActionHandler:i,menuLocation:W("tab",o),menuOptions:u,onMenuClose:s,tabIndex:-1,"aria-label":"context menu"})};var ai=require("react/jsx-runtime"),li="vuuTab",hS=()=>{},pS=(0,ui.forwardRef)(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=hS,onExitEditMode:v=hS,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=(0,ui.useRef)(null),D=(0,ui.useRef)(null),M=Et(k,T),I=(0,ui.useCallback)(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?(0,ai.jsx)(ad,{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(0,ai.jsxs)("div",{...E,"aria-controls":e,"aria-selected":C,className:W(li,r,{[`${li}-closeable`]:o,"vuuDraggable-dragAway":i,[`${li}-editing`]:l,[`${li}-selected`]:C||void 0,[`${li}-vertical`]:b==="vertical",vuuFocusVisible:a}),onClick:I,onFocus:H,onKeyUp:A,ref:M,role:"tab",tabIndex:S,children:[(0,ai.jsx)("div",{className:`${li}-main`,children:(0,ai.jsx)("span",{className:`${li}-text`,"data-text":s?void 0:c,children:n!=null?n:L()})}),w?(0,ai.jsx)(dS,{allowClose:o,allowRename:s,controlledComponentId:e,controlledComponentTitle:c,location:f,onMenuAction:y,onMenuClose:x,index:u}):null]})});var co=require("react");var Ps=require("react/jsx-runtime"),Lm="vuuHeader",mS=({className:t,contributions:e,collapsed:n,closeable:r,onEditTitle:o,orientation:i="horizontal",style:s,title:l="Untitled"})=>{let a=(0,co.useRef)(null),[u,c]=(0,co.useState)(l),[f,d]=(0,co.useState)(!1),h=gS(),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(Lm,t,`${Lm}-${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((0,co.cloneElement)(T.content,{key:D}));break;default:E.push((0,co.cloneElement)(T.content,{key:D}))}}),l&&S.push((0,Ps.jsx)(ad,{className:`${Lm}-title`,editing:f,value:u,onChange:c,onMouseDownCapture:v,onEnterEditMode:x,onExitEditMode:C,onKeyDown:b,ref:a,tabIndex:0},"title")),r&&k.push((0,Ps.jsx)(br,{"data-icon":"close",onClick:g,onMouseDown:p,variant:"secondary"},"close")),E.length>0&&S.push((0,Ps.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:E},"contributions")),k.length>0&&S.push((0,Ps.jsx)("div",{className:"vuuTooltrayProxy","data-align":"end",children:k},"actions")),(0,Ps.jsx)("div",{className:W("vuuToolbarProxy",y),style:s,onMouseDown:w,children:S})};var Dn=require("react");var vS=({id:t,rootRef:e,path:n,dropTargets:r,title:o})=>{let i=gs(),{loadState:s,loadSessionState:l,purgeState:a,saveState:u,saveSessionState:c}=ms(),[f,d]=Uc(t,e,n,r),h=(0,Dn.useMemo)(()=>{var w;return(w=s("view-title"))!=null?w:o},[s,o]),g=(0,Dn.useCallback)(w=>{n&&i({type:"set-title",path:n,title:w})},[i,n]),v=(0,Dn.useMemo)(()=>s(t),[t,s]),p=(0,Dn.useCallback)(w=>s(t,w),[t,s]),m=(0,Dn.useCallback)(w=>{a(t,w),i({type:"save"})},[t,i,a]),y=(0,Dn.useCallback)((w,S)=>{u(t,S,w),i({type:"save"})},[t,i,u]),x=(0,Dn.useCallback)(w=>l(t,w),[t,l]),b=(0,Dn.useCallback)((w,S)=>c(t,S,w),[t,c]),C=(0,Dn.useCallback)(({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}};var di=require("react"),bS=["height","width"];var ci=new WeakMap,xS=(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}},yS=new ResizeObserver(t=>{for(let e of t){let{target:n,contentRect:r}=e,o=ci.get(n);if(o){let{onResize:i,measurements:s}=o,l=!1;for(let[a,u]of Object.entries(s)){let c=xS(n,r,a);c!==u&&(l=!0,s[a]=c)}l&&i&&i(s)}}});function wS(t,e,n,r=!1){let o=(0,di.useRef)(e),i=(0,di.useCallback)(s=>{let l=s.getBoundingClientRect();return o.current.reduce((a,u)=>(a[u]=xS(s,l,u),a),{})},[]);(0,di.useLayoutEffect)(()=>{let s=t.current,l=!1;async function a(){ci.set(s,{measurements:{}}),l=!1;let{fonts:u}=document;if(u&&await u.ready,!l){let c=ci.get(s);if(c){let f=i(s);c.measurements=f,yS.observe(s),r&&n(f)}}}if(s){if(ci.has(s))throw Error("useResizeObserver attemping to observe same element twice");a()}return()=>{s&&ci.has(s)&&(yS.unobserve(s),ci.delete(s),l=!0)}},[t,i,r,n]),(0,di.useLayoutEffect)(()=>{let s=t.current,l=ci.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 Ds=require("react"),vL=[],SS=({mainRef:t,resize:e="responsive",rootRef:n})=>{let r=e==="defer",o=(0,Ds.useRef)({}),i=(0,Ds.useRef)(),s=(0,Ds.useCallback)(()=>{t.current&&(t.current.style.height=o.current.height+"px",t.current.style.width=o.current.width+"px"),i.current=void 0},[t]),l=(0,Ds.useCallback)(({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]);wS(n,r?bS:vL,l,r)};var ya=et(require("react")),yL={dispatch:null},hd=ya.default.createContext(yL),gS=()=>{var e;let t=(0,ya.useContext)(hd);return(e=t==null?void 0:t.dispatch)!=null?e:null},CS=()=>(0,ya.useContext)(hd);var As=require("react/jsx-runtime"),ba="vuuView",bL=(t,e)=>t&&e?{...t,...e}:t||e,ES=(0,Lt.forwardRef)(function(e,n){let{Header:r=mS,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=(0,kS.useId)(h),E=(0,Lt.useRef)(null),k=(0,Lt.useRef)(null),[T,D]=(0,Lt.useState)(),{contributions:M,dispatchViewAction:I,load:R,loadSession:A,onConfigChange:L,onEditTitle:H,purge:O,restoredState:B,save:P,saveSession:F,title:N}=vS({id:S,rootRef:E,path:p,dropTargets:c,title:C});SS({mainRef:k,resize:m,rootRef:E});let z=(0,Lt.useCallback)(U=>{D(U)},[]),q=()=>Lt.default.isValidElement(o)&&(B||T)?Lt.default.cloneElement(o,bL(B,T)):o,Z=(0,Lt.useMemo)(()=>({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(0,As.jsx)("div",{...w,className:W(ba,i,{[`${ba}-collapsed`]:s,[`${ba}-expanded`]:f,[`${ba}-resize-defer`]:m==="defer"}),"data-resizeable":y,id:S,ref:Et(n,E),style:b,tabIndex:-1,children:(0,As.jsxs)(hd.Provider,{value:Z,children:[g?(0,As.jsx)(r,{...j,collapsed:s,contributions:M,expanded:f,closeable:l,onEditTitle:H,orientation:v,tearOut:x,title:N}):null,(0,As.jsx)("div",{className:`${ba}-main`,ref:k,children:q()})]})})});ES.displayName="View";var pd=Lt.default.memo(ES);pd.displayName="View";Or("View",pd,"view");var Mr=require("react/jsx-runtime"),md="vuuLayoutStartPanel",MS=t=>{let{dispatch:e,path:n}=CS(),[r,o]=(0,gd.useState)();return(0,gd.useMemo)(()=>{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:(0,Mr.jsxs)("div",{...t,className:md,children:[r==="initial"?(0,Mr.jsxs)(Mr.Fragment,{children:[(0,Mr.jsx)("header",{className:`${md}-title`,children:"Start by adding a table"}),(0,Mr.jsx)("div",{className:`${md}-text`,children:"To add a table, drag any of the Vuu Tables to this area or click the button below"})]}):null,(0,Mr.jsx)(br,{className:`${md}-addButton`,"data-icon":"add",variant:"cta"})]})};var fi=require("react/jsx-runtime"),xL="vuuPlaceholder",wL=({showStartMenu:t=!0})=>(0,fi.jsx)(fi.Fragment,{children:t?(0,fi.jsx)(MS,{}):null}),vd=({className:t,showStartMenu:e,...n})=>{let r=W(xL,t);return(0,fi.jsx)(pd,{...n,className:r,"data-placeholder":!0,resizeable:!0,children:(0,fi.jsx)(wL,{showStartMenu:e})})};vd.displayName="Placeholder";Or("Placeholder",vd);var DS=require("react");var Tr=require("@vuu-ui/vuu-utils"),Xn=require("react");var pi=require("react");var hi=new Map,IS=(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}},TS=new ResizeObserver(t=>{for(let e of t){let{target:n,borderBoxSize:r,contentBoxSize:o}=e,i=hi.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=IS(n,{height:s,width:l,contentHeight:a,contentWidth:u},h);v!==g&&(d=!0,f[h]=v)}d&&c&&c(f)}}});function LS(t,e,n,r=!1){let o=(0,pi.useRef)(e),i=(0,pi.useCallback)(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]=IS(s,{width:d,height:f,contentHeight:c,contentWidth:u},g),h),{})},[]);(0,pi.useEffect)(()=>{let s=t.current;async function l(){hi.set(s,{measurements:{}});let a=hi.get(s);if(a){let u=i(s);a.measurements=u,TS.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&&(hi.has(s)&&console.log("useResizeObserver attemping to observe same element twice",{target:s}),l()),()=>{s&&hi.has(s)&&(TS.unobserve(s),hi.delete(s))}},[i,t]),(0,pi.useEffect)(()=>{let s=t.current,l=hi.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 SL=["clientHeight","clientWidth"],CL=["clientWidth"],kL=["clientHeight"],EL=[],yd=t=>Number.isFinite(t),ML={height:"100%",width:"auto"},TL=(t,e)=>(0,Tr.isValidNumber)(t)&&(0,Tr.isValidNumber)(e)?{height:`${t}px`,width:`${e}px`}:typeof t=="string"||typeof e=="string"?{height:t!=null?t:"100%",width:e!=null?e:"auto"}:ML,IL=(t,e)=>{if((0,Tr.isValidNumber)(t)&&(0,Tr.isValidNumber)(e))return{height:t,width:e}},PS=({defaultHeight:t=0,defaultWidth:e=0,height:n,onResize:r,width:o})=>{let i=(0,Xn.useRef)(null),[s,l]=(0,Xn.useState)({css:TL(n,o),inner:IL(n,o),outer:{height:n!=null?n:"100%",width:o!=null?o:"auto"}}),a=typeof n=="number",u=typeof o=="number",c=a&&u?EL:a?CL:u?kL:SL;(0,Xn.useMemo)(()=>{l(d=>{let{inner:h,outer:g}=d;if((0,Tr.isValidNumber)(n)&&(0,Tr.isValidNumber)(o)&&h&&g){let{height:v,width:p}=h,{height:m,width:y}=g;if(m!==n||y!==o){let x=(0,Tr.isValidNumber)(m)?m-v:0,b=(0,Tr.isValidNumber)(y)?y-p:0;return{...d,outer:{height:n,width:o},inner:{height:n-x,width:o-b}}}}return d})},[n,o]);let f=(0,Xn.useCallback)(({clientWidth:d,clientHeight:h})=>{let{css:g,inner:v,outer:p}=s,m=s;a&&yd(d)&&Math.floor(d)!==(v==null?void 0:v.width)?m={css:g,outer:p,inner:{width:Math.floor(d)||e,height:n}}:u&&yd(h)&&Math.floor(h)!==(v==null?void 0:v.height)?m={css:g,outer:p,inner:{height:Math.floor(h)||t,width:o}}:yd(h)&&yd(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(0,Xn.useEffect)(()=>{s.inner&&(r==null||r(s.inner))},[r,s.inner]),LS(i,c,f,!0),{containerRef:i,cssSize:s.css,outerSize:s.outer,innerSize:s.inner}};var Dm=require("react/jsx-runtime"),Pm="vuuMeasuredContainer",Bw=(0,DS.forwardRef)(function({children:e,className:n,height:r,onResize:o,style:i,width:s,...l},a){let{containerRef:u,...c}=PS({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=Et(u,a);return h?(0,Dm.jsx)("div",{...l,className:W(Pm,`${Pm}-ummeasured`),style:g(),ref:u}):(0,Dm.jsx)("div",{...l,className:W(Pm,n),ref:v,style:g(),children:e})});var $S=require("@vuu-ui/vuu-utils");var xd=et(require("react"));var Rs=require("@vuu-ui/vuu-utils"),Vt=require("react");var Am=require("@vuu-ui/vuu-utils"),LL=".vuuOverflowContainer-item:not(.wrapped)",Lw=t=>t!==null&&t.dataset.index==="overflow"&&t.parentElement!==null&&t.parentElement.classList.contains("vuuOverflowContainer-wrapContainer-overflowed"),PL=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}),Rm=[],xa=(t,e="horizontal")=>{let n=[],r=[],o=-1,i=!1,s=PL(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]},AS=(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")}},DL=(t,{overflowPriority:e})=>Math.max(t,parseInt(e)),AL=(t,{overflowPriority:e})=>Math.min(t,parseInt(e)),RS=t=>{var e;return t.length>1&&((e=t.at(-1))==null?void 0:e.index)==="overflow"},RL=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},OS=(t,e)=>{var o;let n=t.reduce(AL,Number.MAX_SAFE_INTEGER);return e.reduce(DL,0)>n?!0:e.length>1&&((o=e.at(-1))==null?void 0:o.index)==="overflow"},HS=(t,e)=>new Promise(n=>{requestAnimationFrame(()=>{let[,r]=xa(t);NL(e,r).forEach(i=>OL(t,i)),n(r)})}),NS=(t,e,n)=>new Promise(r=>{requestAnimationFrame(()=>{let[,o]=xa(t),i=RL(o);if(i){let[s,l]=Om(t,i);r([s,l])}else r([e,n])})}),OL=(t,e)=>{let n=(0,Am.getElementByDataIndex)(t,e.index);if(n)n.classList.add("wrapped");else throw Error(`markElementAsWrapped element item with index ${e.index} not found`)},HL=t=>Array.from(t.querySelectorAll(".wrapped")),NL=(t,e)=>{let n=[];for(let r of e)t.find(({index:o})=>o===r.index)||n.push(r);return n},FL=(t,e)=>{HL(t).forEach(r=>{let{dataset:{index:o="?"}}=r;e.find(i=>i.index===o)||r.classList.remove("wrapped")})},FS=t=>t.querySelector('[data-index="overflow"]'),BL=t=>t.querySelector(".wrapped"),bd=t=>parseInt(getComputedStyle(t).getPropertyValue("width")),BS=(t,e)=>{let{right:n}=t.getBoundingClientRect(),r=parseInt(getComputedStyle(t).getPropertyValue("padding-right")),{right:o}=e.getBoundingClientRect();return n-r-o},VS=t=>{let e=FS(t),n=BS(t,e),r=bd(e),o=BL(t);return bd(o)<=n+r?(t.classList.remove("overflowed"),o.classList.remove("wrapped"),!0):!1},VL=(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)},zL=t=>Array.from(t.querySelectorAll(LL)).sort(VL),Om=(t,e)=>{let n=zL(t),r=(0,Am.getElementByDataIndex)(t,e.index,!0),o=-1,i=n.at(o),s=bd(i),l=bd(r),a=FS(t),u=BS(t,a)+s;if(u>=l)$L(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]=xa(t);return FL(t,f),[c,f]},$L=(t,e)=>{if(!t||!e)throw Error("switchWrapOnElements, element undefined");t.classList.remove("wrapped"),e.classList.add("wrapped")};var zS=({allowDragDrop:t=!1,itemCount:e,onMoveItem:n,onSwitchWrappedItemIntoView:r,orientation:o="horizontal"})=>{let[i,s]=(0,Vt.useState)(null),l=(0,Vt.useRef)(Rm),a=(0,Vt.useRef)(null),u=(0,Vt.useCallback)(x=>{var b;a.current&&((b=a.current.querySelector(".vuuOverflowContainer-OverflowIndicator button"))==null||b.setAttribute("tabindex",x))},[]),c=(0,Vt.useCallback)(async()=>{if(i){let[x,b]=xa(i,o);for(AS(i,b,"vuuOverflowContainer-wrapContainer"),RS(b)&&(b=await HS(i,b));OS(x,b);)[x,b]=await NS(i,x,b);b.length===1&&VS(i)&&(b=Rm),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]=(0,Vt.useMemo)(()=>[()=>{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]=Om(i,x.overflowItem);l.current=b,r==null||r(x.overflowItem)}return!0}],[i,r]),g=(0,Vt.useMemo)(()=>{let{sizeProp:x}=Rs.MEASURES[o],b=0;return new ResizeObserver(C=>{for(let w of C){let{[x]:S}=w.contentRect,E=Math.round(S);(0,Rs.isValidNumber)(E)&&b!==E&&(b=E,c())}})},[c,o]);(0,Rs.useLayoutEffectSkipFirst)(()=>{c()},[c,e]),(0,Vt.useMemo)(()=>{i&&g.observe(i)},[i,g]);let v=(0,Vt.useCallback)(x=>{s(a.current=x)},[]),p=(0,Vt.useCallback)((x,b)=>{n==null||n(x,b)},[n]),{onMouseDown:m,...y}=ks({allowDragDrop:t,containerRef:a,draggableClassName:"vuuOverflowContainer",onDrop:p,orientation:"horizontal",itemQuery:".vuuOverflowContainer-item"});return{menuActionHandler:h,menuBuilder:d,onItemMouseDown:m,rootRef:v,...y}};var fo=require("react/jsx-runtime"),Os="vuuOverflowContainer",_S=xd.default.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=Ac(n),{draggable:d,draggedItemIndex:h,menuActionHandler:g,menuBuilder:v,onItemMouseDown:p,rootRef:m}=zS({allowDragDrop:e,itemCount:f.length,onMoveItem:s,onSwitchWrappedItemIntoView:l,orientation:a}),x={"--overflow-container-height":`${a==="vertical"?"100%":`${o}px`}`},b=W(`${Os}-wrapContainer`,r,{[`${Os}-horizontal`]:a==="horizontal",[`${Os}-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(0,fo.jsx)("div",{className:W(`${Os}-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=(0,fo.jsx)("div",{className:`${Os}-OverflowIndicator`,"data-index":"overflow",children:(0,fo.jsx)($c,{...t,icon:u,menuBuilder:v,menuActionHandler:g,tabIndex:-1})},"overflow");return C.push(w),(0,fo.jsxs)("div",{className:b,ref:m,style:x,children:[C,d]})});_S.displayName="OverflowContainer.InnerContainer";var uS=(0,xd.forwardRef)(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=(0,$S.useId)(s);return(0,fo.jsx)("div",{...d,className:W(W(o,Os)),id:g,ref:h,children:(0,fo.jsx)(_S,{PopupMenuProps:e,allowDragDrop:n,height:i,id:g,orientation:u,overflowIcon:c,overflowPosition:f,onMoveItem:l,onSwitchWrappedItemIntoView:a,children:r})})});var WS=require("@vuu-ui/vuu-utils");var er=et(require("react"));var Hs=require("react/jsx-runtime"),Hm="vuuTabs",_L=()=>{},WL=t=>{let e=[];return er.default.Children.forEach(t,n=>{er.default.isValidElement(n)?e.push(n):console.warn("Stack has unexpected child element type")}),e},KL={allowAddTab:!1,allowCloseTab:!1,allowRenameTab:!1},Nm=(0,er.forwardRef)(function({TabstripProps:e=KL,active:n=0,children:r,className:o,getTabIcon:i=_L,getTabLabel:s=Kc,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=(0,WS.useId)(l),y=(0,er.useRef)([]),{allowCloseTab:x,allowRenameTab:b,className:C}=e,w=(0,er.useCallback)((I,R,A,L)=>{d==null||d(L,R)},[d]),S=()=>{var I;return er.default.isValidElement(r)?r:Array.isArray(r)&&(I=r[n])!=null?I:null},E=()=>WL(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),(0,Hs.jsx)(pS,{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(0,Hs.jsxs)("div",{className:W(Hm,o,{[`${Hm}-horizontal`]:T}),style:v,id:m,ref:p,children:[g?(0,Hs.jsx)(lS,{...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,(0,Hs.jsx)("div",{"aria-labelledby":`${m}-${n}`,className:`${Hm}-tabPanel`,role:"tabpanel",children:k})]})});Nm.displayName="Stack";var KS=require("@vuu-ui/vuu-utils"),ho=et(require("react"));var Fm=require("react/jsx-runtime"),UL=()=>(0,Fm.jsx)(vd,{resizeable:!0,style:{flexGrow:1,flexShrink:0,flexBasis:0}}),wd=t=>{var C;let e=(0,ho.useRef)(null),n=gs(),{loadState:r}=ms(),{createNewChild:o,id:i,onTabSelectionChanged:s,path:l,...a}=t,{children:u}=t,c=(0,KS.useId)(i),[f]=Uc(c,e,l),d=dx(),h=(C=o!=null?o:d)!=null?C:UL,g=w=>{l&&(n({type:"switch-tab",id:c,path:l,nextIdx:w}),s==null||s(w))},v=(0,ho.useCallback)(w=>{if(Array.isArray(u)){let{props:{"data-path":S,path:E=S}}=u[w];n({type:"remove",path:E})}},[u,n]),p=(0,ho.useCallback)(()=>{if(l){let w=ho.default.Children.count(u),S=h(w);n({type:"add",path:l,component:S})}},[u,h,n,l]),m=(0,ho.useCallback)((w,S)=>{l&&n({fromIndex:w,toIndex:S,path:l,type:"move-child"})},[n,l]);return(0,Fm.jsx)(Nm,{...a,id:c,getTabLabel:(w,S,E)=>{let{id:k,title:T}=w.props;return r(k,"view-title")||T||Kc(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})};wd.displayName="Stack";Or("Stack",wd,"container");var Sd=require("react");var jL=require("react"),US=require("react/jsx-runtime");var jS=require("react/jsx-runtime");var qL=require("@vuu-ui/vuu-utils");var qS=require("react/jsx-runtime");var Bm=et(require("react"));var Vm=require("react/jsx-runtime");var gi=et(require("react"));var GS=et(require("react")),mi=require("react/jsx-runtime"),Cd=class extends GS.default.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?(0,mi.jsxs)(mi.Fragment,{children:[(0,mi.jsx)("h1",{children:"An error occured while creating component."}),(0,mi.jsx)("p",{children:this.state.errorMessage})]}):this.props.children}};var ZS=require("react/jsx-runtime"),JS=()=>(0,ZS.jsx)("div",{className:"hwLoader"});var YS=async t=>{let e=new CSSStyleSheet;return fetch(t).then(n=>n.text()).then(n=>e.replace(n))};var wa=require("react/jsx-runtime"),kd=new Map,JL=t=>{(0,gi.useEffect)(()=>()=>{kd.delete(t)},[t]),kd.has(t)||kd.set(t,gi.default.lazy(()=>import(t)));let e=kd.get(t);if(e)return e;throw Error(`Unable to load Lazy Feature at url ${t}`)};function ZL({url:t,css:e,ComponentProps:n,...r}){e&&YS(e).then(i=>{document.adoptedStyleSheets=[...document.adoptedStyleSheets,i]});let o=JL(t);return(0,wa.jsx)(Cd,{url:t,children:(0,wa.jsx)(gi.Suspense,{fallback:(0,wa.jsx)(JS,{}),children:(0,wa.jsx)(o,{...r,...n})})})}var zm=gi.default.memo(ZL);zm.displayName="Feature";Or("Feature",zm,"view");var _m=require("react");var tC=require("react/jsx-runtime"),tP="saveLayoutPanel",c_=`${tP}-formField`;var Ni=et(require("react"));var Wm={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"}]}};var fP=require("react");var nC=require("react");var Km=require("react/jsx-runtime");var oC=require("@vuu-ui/vuu-utils");var Jt=require("react");var Um=require("react/jsx-runtime"),rC="vuuExpandoCombobox",nP={},Sa=(0,Jt.forwardRef)(function({className:e,InputProps:n=nP,ListProps:r,onInputChange:o,onSelectionChange:i,selectionStrategy:s,style:l,value:a="",...u},c){let[f,d]=(0,Jt.useState)(a),{itemToString:h=oC.itemToString}=u,g=(0,Jt.useRef)(a),v=(0,Jt.useCallback)(w=>{let[S,...E]=w;return E.length?`${h(S)} + ${E.length}`:h(S)},[h]),p=(0,Jt.useCallback)(w=>{let{value:S}=w.target;d(S),o==null||o(w)},[o]),m=(0,Jt.useCallback)(w=>{d(w)},[]),[y,x]=(0,Jt.useMemo)(()=>{let{inputProps:w,...S}=n;return[{...S,className:`${rC}-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=(0,Jt.useCallback)((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(0,Um.jsx)("div",{className:W(rC,e),"data-text":f,ref:c,style:l,children:(0,Um.jsx)(Kw,{...u,PopupProps:C,defaultValue:g.current,fullWidth:!0,ListProps:x,InputProps:y,itemsToString:v,onSelectionChange:b,onSetSelectedText:m,selectionStrategy:s})})});var sP=require("react");var vi=require("react");var Ed=require("@vuu-ui/vuu-utils"),iC=require("react/jsx-runtime"),rP=(0,vi.forwardRef)(function({InputProps:e,className:n,column:r,onInputComplete:o,value:i},s){let[l,a]=(0,vi.useState)((0,Ed.isValidNumber)(i)?i.toString():""),u=(0,vi.useCallback)(f=>{let{value:d}=f.target,h=parseFloat(d);(0,Ed.isValidNumber)(h)&&console.log("its valid"),a(d)},[]),c=(0,vi.useCallback)(f=>{if(f.key==="Enter"){let{value:d}=f.target,h=parseFloat(d);(0,Ed.isValidNumber)(h)&&o(h)}},[o]);return(0,iC.jsx)(cd,{...e,className:n,value:l,ref:s,onChange:u,onKeyDown:c})});var sC=require("@vuu-ui/vuu-utils");var zt=require("react");var Ca=require("react/jsx-runtime"),oP=["Enter"," "],lC=["No matching data"],iP=(0,zt.forwardRef)(function({InputProps:e={},className:n,column:r,"data-field":o,onDeselect:i,onInputComplete:s,operator:l,suggestionProvider:a=Md,table:u,value:c},f){let[d,h]=(0,zt.useState)(c!=null?c:""),[g,v]=(0,zt.useState)([]),p=a(),m=(0,zt.useCallback)((w,S)=>s(S),[s]),y=(0,zt.useCallback)((w,S)=>s(S),[s]);(0,zt.useEffect)(()=>{if(u){let w=d?[u,r.name,d]:[u,r.name];p(w).then(S=>{S.length===0&&d?v(lC):v(S)}).catch(S=>{console.error("Error getting suggestions",S)})}},[u,r,d,p]);let x=(0,zt.useCallback)(w=>{let{value:S}=w.target;h(S)},[]),b=(0,zt.useMemo)(()=>{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(0,zt.useCallback)(()=>{if(g.length===0)return null;switch(l){case"in":return(0,Ca.jsx)(Sa,{InputProps:b,className:n,"data-field":o,initialHighlightedIndex:0,source:g,onInputChange:x,onSelectionChange:y,ref:f,selectionStrategy:"multiple",selectionKeys:oP,value:c});case"starts":return(0,Ca.jsx)(Sa,{InputProps:b,ListProps:{className:"vuuIllustrationsOnly",disabled:!0},allowFreeText:!0,className:n,"data-field":o,initialHighlightedIndex:0,disableFilter:g===lC&&(d==null?void 0:d.length)>0,source:g,onInputChange:x,onSelectionChange:m,ref:f,value:c});case"ends":return(0,Ca.jsx)(cd,{...b,className:n,"data-field":o,value:d,ref:f,onChange:x});default:return(0,Ca.jsx)(Sa,{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])()});var Td=require("@vuu-ui/vuu-utils"),ka=require("react");var aC=require("react/jsx-runtime");var jm=require("@vuu-ui/vuu-utils");var cC=require("react");var lP=require("react");var aP=require("react/jsx-runtime");var po=require("@vuu-ui/vuu-utils");var Id=require("@vuu-ui/vuu-utils"),uC=require("react/jsx-runtime");var dC=require("react/jsx-runtime");var Gm=require("@vuu-ui/vuu-utils"),Ea=require("react");var cP=require("react");var fC=require("react");var dP=require("react/jsx-runtime");var hC=require("react/jsx-runtime"),hP=require("react");var fe=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),Fs.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),Fs.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 xi(this),i=new xi(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 xi(this,e)}iterRange(e,n=this.length){return new Ad(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 Rd(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 Zt(e):Fs.from(Zt.split(e,[]))}},Zt=class t extends fe{constructor(e,n=pP(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 Zm(o,l,r,s);o=l+1,r++}}decompose(e,n,r,o){let i=e<=0&&n>=this.length?this:new t(pC(this.text,e,n),Math.min(n,this.length)-Math.max(0,e));if(o&1){let s=r.pop(),l=Dd(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=Dd(this.text,Dd(r.text,pC(this.text,0,e)),n),i=this.length+r.length-(n-e);return o.length<=32?new t(o,i):Fs.from(t.split(o,[]),i)}sliceString(e,n=this.length,r=`
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
`,this;e--}else if(o instanceof Zt){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 Zt?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)}},Ad=class{constructor(e,n,r){this.value="",this.done=!1,this.cursor=new xi(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!=""}},Rd=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"&&(fe.prototype[Symbol.iterator]=function(){return this.iter()},xi.prototype[Symbol.iterator]=Ad.prototype[Symbol.iterator]=Rd.prototype[Symbol.iterator]=function(){return this});var Zm=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}},Bs="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<Bs.length;t++)Bs[t]+=Bs[t-1];function mP(t){for(let e=1;e<Bs.length;e+=2)if(Bs[e]>t)return Bs[e-1]<=t;return!1}function mC(t){return t>=127462&&t<=127487}var gC=8205;function xt(t,e,n=!0,r=!0){return(n?SC:gP)(t,e,r)}function SC(t,e,n){if(e==t.length)return e;e&&CC(t.charCodeAt(e))&&kC(t.charCodeAt(e-1))&&e--;let r=tr(t,e);for(e+=wi(r);e<t.length;){let o=tr(t,e);if(r==gC||o==gC||n&&mP(o))e+=wi(o),r=o;else if(mC(o)){let i=0,s=e-2;for(;s>=0&&mC(tr(t,s));)i++,s-=2;if(i%2==0)break;e+=2}else break}return e}function gP(t,e,n){for(;e>0;){let r=SC(t,e-2,n);if(r<e)return r;e--}return 0}function CC(t){return t>=56320&&t<57344}function kC(t){return t>=55296&&t<56320}function tr(t,e){let n=t.charCodeAt(e);if(!kC(n)||e+1==t.length)return n;let r=t.charCodeAt(e+1);return CC(r)?(n-55296<<10)+(r-56320)+65536:n}function EC(t){return t<=65535?String.fromCharCode(t):(t-=65536,String.fromCharCode((t>>10)+55296,(t&1023)+56320))}function wi(t){return t<65536?1:2}var Ym=/\r\n?|\n/,bt=function(t){return t[t.Simple=0]="Simple",t[t.TrackDel=1]="TrackDel",t[t.TrackBefore=2]="TrackBefore",t[t.TrackAfter=3]="TrackAfter",t}(bt||(bt={})),Ir=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){Qm(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:MC(this,e)}mapDesc(e,n=!1){return e.empty?this:Xm(this,e,n)}mapPos(e,n=-1,r=bt.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!=bt.Simple&&u>=e&&(r==bt.TrackDel&&o<e&&u>e||r==bt.TrackBefore&&o<e||r==bt.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)}},Dt=class t extends Ir{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 Qm(this,(n,r,o,i,s)=>e=e.replace(o,o+(r-n),s),!1),e}mapDesc(e,n=!1){return Xm(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(fe.empty);r.push(s?e.slice(i,i+s):fe.empty)}i+=s}return new t(n,r)}compose(e){return this.empty?e:e.empty?this:MC(this,e,!0)}map(e,n=!1){return e.empty?this:Xm(this,e,n,!0)}iterChanges(e,n=!1){Qm(this,e,n)}get desc(){return Ir.create(this.sections)}filter(e){let n=[],r=[],o=[],i=new Si(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);yt(o,c,-1);let f=i.ins==-1?-1:i.off==0?i.ins:0;yt(n,c,f),f>0&&mo(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);yt(n,c,-1),yt(o,c,i.ins==-1?-1:i.off==0?i.ins:0),i.forward(c),l+=c}}return{changes:new t(n,r),filtered:Ir.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&&yt(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"?fe.of(h.split(r||Ym)):h:fe.empty,v=g.length;if(f==d&&v==0)return;f<s&&a(),f>s&&yt(o,f-s,-1),yt(o,d-f,v),mo(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(fe.empty);r[o]=fe.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 yt(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 mo(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(fe.empty);t.push(n)}}function Qm(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=fe.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 Xm(t,e,n,r=!1){let o=[],i=r?[]:null,s=new Si(t),l=new Si(e);for(let a=-1;;)if(s.ins==-1&&l.ins==-1){let u=Math.min(s.len,l.len);yt(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(yt(o,l.ins,-1);u;){let c=Math.min(s.len,u);s.ins>=0&&a<s.i&&s.len<=c&&(yt(o,0,s.ins),i&&mo(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;yt(o,u,a<s.i?s.ins:0),i&&a<s.i&&mo(i,o,s.text),a=s.i,s.forward(s.len-c)}else{if(s.done&&l.done)return i?Dt.createSet(o,i):Ir.create(o);throw new Error("Mismatched change set lengths")}}function MC(t,e,n=!1){let r=[],o=n?[]:null,i=new Si(t),s=new Si(e);for(let l=!1;;){if(i.done&&s.done)return o?Dt.createSet(r,o):Ir.create(r);if(i.ins==0)yt(r,i.len,0,l),i.next();else if(s.len==0&&!s.done)yt(r,0,s.ins,l),o&&mo(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;yt(r,a,c,l),o&&c&&mo(o,r,s.text)}else s.ins==-1?(yt(r,i.off?0:i.len,a,l),o&&mo(o,r,i.textBit(a))):(yt(r,i.off?0:i.len,s.off?0:s.ins,l),o&&!s.off&&mo(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 Si=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?fe.empty:e[n]}textBit(e){let{inserted:n}=this.set,r=this.i-2>>1;return r>=n.length&&!e?fe.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)}},Ns=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=>Ns.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 Ns.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?Ns.create(n,e,24|i):Ns.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 TC(t,e){for(let n of t.ranges)if(n.to>e)throw new RangeError("Selection points outside of document")}var lg=0,ne=class t{constructor(e,n,r,o,i){this.combine=e,this.compareInput=n,this.compare=r,this.isStatic=o,this.id=lg++,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:ag),!!e.static,e.enables)}of(e){return new Vs([],this,0,e)}compute(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Vs(e,this,1,n)}computeN(e,n){if(this.isStatic)throw new Error("Can't compute a static facet");return new Vs(e,this,2,n)}from(e,n){return n||(n=r=>r),this.compute([e],r=>n(r.field(e)))}};function ag(t,e){return t==e||t.length==e.length&&t.every((n,r)=>n===e[r])}var Vs=class{constructor(e,n,r,o){this.dependencies=e,this.facet=n,this.type=r,this.value=o,this.id=lg++}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)||eg(f,c)){let h=r(f);if(l?!vC(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=Fd(d,g);if(this.dependencies.every(p=>p instanceof ne?d.facet(p)===f.facet(p):p instanceof Yt?d.field(p,!1)==f.field(p,!1):!0)||(l?vC(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 vC(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 eg(t,e){let n=!1;for(let r of e)Ta(t,r)&1&&(n=!0);return n}function vP(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=Fd(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)Ta(a,u);return a.values[s]=l(a),1},update(a,u){if(!eg(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=eg(a,r),f=u.config.facets[e.id],d=u.facet(e);if(f&&!c&&ag(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 yC=ne.define({static:!0}),Yt=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(lg++,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(yC).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,yC.of({field:this,create:e})]}get extension(){return this}},yi={lowest:4,low:3,default:2,high:1,highest:0};function Ma(t){return e=>new Od(e,t)}var Ci={highest:Ma(yi.highest),high:Ma(yi.high),default:Ma(yi.default),low:Ma(yi.low),lowest:Ma(yi.lowest)},Od=class{constructor(e,n){this.inner=e,this.prec=n}},Hd=class t{of(e){return new Ia(this,e)}reconfigure(e){return t.reconfigure.of({compartment:this,extension:e})}get(e){return e.config.compartments.get(this)}},Ia=class{constructor(e,n){this.compartment=e,this.inner=n}},Nd=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 yP(e,n,s))d instanceof Yt?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,ag(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=>vP(p,g,h))}}let f=u.map(d=>d(l));return new t(e,s,f,l,a,i)}};function yP(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 Ia&&n.delete(s.compartment)}if(o.set(s,l),Array.isArray(s))for(let u of s)i(u,l);else if(s instanceof Ia){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 Od)i(s.inner,s.prec);else if(s instanceof Yt)r[l].push(s),s.provides&&i(s.provides,l);else if(s instanceof Vs)r[l].push(s),s.facet.extensions&&i(s.facet.extensions,yi.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,yi.default),r.reduce((s,l)=>s.concat(l))}function Ta(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 Fd(t,e){return e&1?t.config.staticValues[e>>1]:t.values[e>>1]}var IC=ne.define(),LC=ne.define({combine:t=>t.some(e=>e),static:!0}),PC=ne.define({combine:t=>t.length?t[0]:void 0,static:!0}),DC=ne.define(),AC=ne.define(),RC=ne.define(),OC=ne.define({combine:t=>t.length?t[0]:!1}),Qt=class{constructor(e,n){this.type=e,this.value=n}static define(){return new Bd}},Bd=class{of(e){return new Qt(this,e)}},tg=class{constructor(e){this.map=e}of(e){return new ke(this,e)}},ke=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 tg(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}};ke.reconfigure=ke.define();ke.appendConfig=ke.define();var rt=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&&TC(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]=="."))}};rt.time=Qt.define();rt.userEvent=Qt.define();rt.addToHistory=Qt.define();rt.remote=Qt.define();function bP(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 HC(t,e,n){var r;let o,i,s;return n?(o=e.changes,i=Dt.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:ke.mapEffects(t.effects,o).concat(ke.mapEffects(e.effects,i)),annotations:t.annotations.length?t.annotations.concat(e.annotations):e.annotations,scrollIntoView:t.scrollIntoView||e.scrollIntoView}}function ng(t,e,n){let r=e.selection,o=zs(e.annotations);return e.userEvent&&(o=o.concat(rt.userEvent.of(e.userEvent))),{changes:e.changes instanceof Dt?e.changes:Dt.of(e.changes||[],n,t.facet(PC)),selection:r&&(r instanceof $?r:$.single(r.anchor,r.head)),effects:zs(e.effects),annotations:o,scrollIntoView:!!e.scrollIntoView}}function NC(t,e,n){let r=ng(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=HC(r,ng(t,e[i],s?r.changes.newLength:t.doc.length),s)}let o=rt.create(t,r.changes,r.selection,r.effects,r.annotations,r.scrollIntoView);return wP(n?xP(o):o)}function xP(t){let e=t.startState,n=!0;for(let o of e.facet(DC)){let i=o(t);if(i===!1){n=!1;break}Array.isArray(i)&&(n=n===!0?i:bP(n,i))}if(n!==!0){let o,i;if(n===!1)i=t.changes.invertedDesc,o=Dt.empty(e.doc.length);else{let s=t.changes.filter(n);o=s.changes,i=s.filtered.mapDesc(s.changes).invertedDesc}t=rt.create(e,o,t.selection&&t.selection.map(i),ke.mapEffects(t.effects,i),t.annotations,t.scrollIntoView)}let r=e.facet(AC);for(let o=r.length-1;o>=0;o--){let i=r[o](t);i instanceof rt?t=i:Array.isArray(i)&&i.length==1&&i[0]instanceof rt?t=i[0]:t=NC(e,zs(i),!1)}return t}function wP(t){let e=t.startState,n=e.facet(RC),r=t;for(let o=n.length-1;o>=0;o--){let i=n[o](t);i&&Object.keys(i).length&&(r=HC(r,ng(e,i,t.changes.newLength),!0))}return r==t?t:rt.create(e,t.changes,t.selection,r.effects,r.annotations,r.scrollIntoView)}var SP=[];function zs(t){return t==null?SP:Array.isArray(t)?t:[t]}var Pt=function(t){return t[t.Word=0]="Word",t[t.Space=1]="Space",t[t.Other=2]="Other",t}(Pt||(Pt={})),CP=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/,rg;try{rg=new RegExp("[\\p{Alphabetic}\\p{Number}_]","u")}catch{}function kP(t){if(rg)return rg.test(t);for(let e=0;e<t.length;e++){let n=t[e];if(/\w/.test(n)||n>"\x80"&&(n.toUpperCase()!=n.toLowerCase()||CP.test(n)))return!0}return!1}function EP(t){return e=>{if(!/\S/.test(e))return Pt.Space;if(kP(e))return Pt.Word;for(let n=0;n<t.length;n++)if(e.indexOf(t[n])>-1)return Pt.Word;return Pt.Other}}var Me=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++)Ta(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 Ta(this,r),Fd(this,r)}update(...e){return NC(this,e,!0)}applyTransaction(e){let n=this.config,{base:r,compartments:o}=n;for(let s of e.effects)s.is(Hd.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(ke.reconfigure)?(n=null,r=s.value):s.is(ke.appendConfig)&&(n=null,r=zs(r).concat(s.value));let i;n?i=e.startState.values.slice():(n=Nd.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=zs(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=ke.mapEffects(s,c).concat(ke.mapEffects(zs(a.effects),f))}return{changes:o,selection:$.create(i,n.mainIndex),effects:s}}changes(e=[]){return e instanceof Dt?e:Dt.of(e,this.doc.length,this.facet(t.lineSeparator))}toText(e){return fe.of(e.split(this.facet(t.lineSeparator)||Ym))}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:(Ta(this,n),Fd(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 Yt&&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=Nd.resolve(e.extensions||[],new Map),r=e.doc instanceof fe?e.doc:fe.of((e.doc||"").split(n.staticFacet(t.lineSeparator)||Ym)),o=e.selection?e.selection instanceof $?e.selection:$.single(e.selection.anchor,e.selection.head):$.single(0);return TC(o,r.length),n.staticFacet(LC)||(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(OC)}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(IC))for(let s of i(this,n,r))Object.prototype.hasOwnProperty.call(s,e)&&o.push(s[e]);return o}charCategorizer(e){return EP(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=xt(n,s,!1);if(i(n.slice(a,s))!=Pt.Word)break;s=a}for(;l<o;){let a=xt(n,l);if(i(n.slice(l,a))!=Pt.Word)break;l=a}return s==l?null:$.range(s+r,l+r)}};Me.allowMultipleSelections=LC;Me.tabSize=ne.define({combine:t=>t.length?t[0]:4});Me.lineSeparator=PC;Me.readOnly=OC;Me.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])}});Me.languageData=IC;Me.changeFilter=DC;Me.transactionFilter=AC;Me.transactionExtender=RC;Hd.reconfigure=ke.define();function ki(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 An=class{eq(e){return this==e}range(e,n=e){return La.create(e,n,this)}};An.prototype.startSide=An.prototype.endSide=0;An.prototype.point=!1;An.prototype.mapMode=bt.TrackDel;var La=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 og(t,e){return t.from-e.from||t.value.startSide-e.value.startSide}var ig=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}}},Fe=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(og)),this.isEmpty)return n.length?t.of(n):this;let l=new Vd(this,null,-1).goto(0),a=0,u=[],c=new go;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(La.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 Pa.from([this]).goto(e)}get isEmpty(){return this.nextLayer==this}static iter(e,n=0){return Pa.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=bC(s,l,r),u=new bi(s,a,i),c=new bi(l,a,i);r.iterGaps((f,d,h)=>xC(u,f,c,d,h,o)),r.empty&&r.length==0&&xC(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=bC(i,s),a=new bi(i,l,0).goto(r),u=new bi(s,l,0).goto(r);for(;;){if(a.to!=u.to||!sg(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 bi(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 go;for(let o of e instanceof La?[e]:n?MP(e):e)r.add(o.from,o.to,o.value);return r.finish()}};Fe.empty=new Fe([],[],null,-1);function MP(t){if(t.length>1)for(let e=t[0],n=1;n<t.length;n++){let r=t[n];if(og(e,r)>0)return t.slice().sort(og);e=r}return t}Fe.empty.nextLayer=Fe.empty;var go=class t{finishChunk(e){this.chunks.push(new ig(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(Fe.empty)}finishInner(e){if(this.from.length&&this.finishChunk(!1),this.chunks.length==0)return e;let n=Fe.create(this.chunkPos,this.chunks,this.nextLayer?this.nextLayer.finishInner(e):e,this.setMaxPoint);return this.from=null,n}};function bC(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 Vd=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}},Pa=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 Vd(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--)Jm(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--)Jm(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(),Jm(this.heap,0)}}};function Jm(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 bi=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=Pa.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){Ld(this.active,e),Ld(this.activeTo,e),Ld(this.activeRank,e),this.minActive=wC(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++;Pd(this.active,n,r),Pd(this.activeTo,n,o),Pd(this.activeRank,n,i),e&&Pd(e,n,this.cursor.from),this.minActive=wC(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&&Ld(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 xC(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))&&sg(t.activeForPoint(t.to),n.activeForPoint(n.to))||i.comparePoint(l,f,t.point,n.point):f>l&&!sg(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 sg(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 Ld(t,e){for(let n=e,r=t.length-1;n<r;n++)t[n]=t[n+1];t.pop()}function Pd(t,e,n){for(let r=t.length-1;r>=e;r--)t[r+1]=t[r];t[e]=n}function wC(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 Ei(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=xt(t,o));return r}function FC(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=xt(t,o)}return r===!0?-1:t.length}var ug="\u037C",BC=typeof Symbol>"u"?"__"+ug:Symbol.for(ug),cg=typeof Symbol>"u"?"__styleSet"+Math.floor(Math.random()*1e8):Symbol("styleSet"),VC=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{},bn=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 Lr={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:"'"},$s={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},TP=typeof navigator<"u"&&/Mac/.test(navigator.platform),IP=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for($e=0;$e<10;$e++)Lr[48+$e]=Lr[96+$e]=String($e);var $e;for($e=1;$e<=24;$e++)Lr[$e+111]="F"+$e;var $e;for($e=65;$e<=90;$e++)Lr[$e]=String.fromCharCode($e+32),$s[$e]=String.fromCharCode($e);var $e;for(zd in Lr)$s.hasOwnProperty(zd)||($s[zd]=Lr[zd]);var zd;function $C(t){var e=TP&&t.metaKey&&t.shiftKey&&!t.ctrlKey&&!t.altKey||IP&&t.shiftKey&&t.key&&t.key.length==1||t.key=="Unidentified",n=!e&&t.key||(t.shiftKey?$s:Lr)[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 Xd(t){let e;return t.nodeType==11?e=t.getSelection?t:t.ownerDocument:e=t,e.getSelection()}function vg(t,e){return e?t==e||t.contains(e.nodeType!=1?e.parentNode:e):!1}function LP(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function Gd(t,e){if(!e.anchorNode)return!1;try{return vg(t,e.anchorNode)}catch{return!1}}function Fa(t){return t.nodeType==3?Mi(t,0,t.nodeValue.length).getClientRects():t.nodeType==1?t.getClientRects():[]}function ef(t,e,n,r){return n?_C(t,e,n,r,-1)||_C(t,e,n,r,1):!1}function tf(t){for(var e=0;;e++)if(t=t.previousSibling,!t)return e}function _C(t,e,n,r,o){for(;;){if(t==n&&e==r)return!0;if(e==(o<0?0:xo(t))){if(t.nodeName=="DIV")return!1;let i=t.parentNode;if(!i||i.nodeType!=1)return!1;e=tf(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?xo(t):0}else return!1}}function xo(t){return t.nodeType==3?t.nodeValue.length:t.childNodes.length}function Qg(t,e){let n=e?t.left:t.right;return{left:n,right:n,top:t.top,bottom:t.bottom}}function PP(t){return{left:0,right:t.innerWidth,top:0,bottom:t.innerHeight}}function DP(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=PP(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 AP(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 yg=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?xo(n):0),r,Math.min(e.focusOffset,r?xo(r):0))}set(e,n,r,o){this.anchorNode=e,this.anchorOffset=n,this.focusNode=r,this.focusOffset=o}},_s=null;function wk(t){if(t.setActive)return t.setActive();if(_s)return t.focus(_s);let e=[];for(let n=t;n&&(e.push(n,n.scrollTop,n.scrollLeft),n!=n.ownerDocument);n=n.parentNode);if(t.focus(_s==null?{get preventScroll(){return _s={preventScroll:!0},!0}}:void 0),!_s){_s=!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 WC;function Mi(t,e,n=e){let r=WC||(WC=document.createRange());return r.setEnd(t,n),r.setStart(t,e),r}function Us(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 RP(t){for(;t;){if(t&&(t.nodeType==9||t.nodeType==11&&t.host))return t;t=t.assignedSlot||t.parentNode}return null}function Sk(t){for(;t.attributes.length;)t.removeAttributeNode(t.attributes[0])}function OP(t,e){let n=e.focusNode,r=e.focusOffset;if(!n||e.anchorNode!=n||e.anchorOffset!=r)return!1;for(r=Math.min(r,xo(n));;)if(r){if(n.nodeType!=1)return!1;let o=n.childNodes[r-1];o.contentEditable=="false"?r--:(n=o,r=xo(n))}else{if(n==t)return!0;r=tf(n),n=n.parentNode}}function Ck(t){return t.scrollTop>Math.max(1,t.scrollHeight-t.clientHeight-4)}var $t=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,tf(e),n)}static after(e,n){return new t(e.parentNode,tf(e)+1,n)}},Xg=[],Se=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=KC(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=KC(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=xo(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=Xg){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 nf(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}};Se.prototype.breakAfter=0;function KC(t){let e=t.nextSibling;return t.parentNode.removeChild(t),e}var nf=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 kk(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 Ek(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,kk(t,u,c,l,a,r,0,o,i)}var Ws="\uFFFF",rf=class{constructor(e,n){this.points=e,this.text="",this.lineSeparator=n.facet(Me.lineSeparator)}append(e){this.text+=e}lineBreak(){this.text+=Ws}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=Se.get(o),a=Se.get(s);(l&&a?l.breakAfter:(l?l.breakAfter:UC(o))||UC(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=Se.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 UC(t){return t.nodeType==1&&/^(DIV|P|LI|UL|OL|BLOCKQUOTE|DD|DT|H\d|SECTION|PRE)$/.test(t.nodeName)}var of=class{constructor(e,n){this.node=e,this.offset=n,this.pos=-1}},en=typeof navigator<"u"?navigator:{userAgent:"",vendor:"",platform:""},bg=typeof document<"u"?document:{documentElement:{style:{}}},xg=/Edge\/(\d+)/.exec(en.userAgent),Mk=/MSIE \d/.test(en.userAgent),wg=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(en.userAgent),mf=!!(Mk||wg||xg),jC=!mf&&/gecko\/(\d+)/i.test(en.userAgent),fg=!mf&&/Chrome\/(\d+)/.exec(en.userAgent),qC="webkitFontSmoothing"in bg.documentElement.style,Tk=!mf&&/Apple Computer/.test(en.vendor),GC=Tk&&(/Mobile\/\w+/.test(en.userAgent)||en.maxTouchPoints>2),Q={mac:GC||/Mac/.test(en.platform),windows:/Win/.test(en.platform),linux:/Linux|X11/.test(en.platform),ie:mf,ie_version:Mk?bg.documentMode||6:wg?+wg[1]:xg?+xg[1]:0,gecko:jC,gecko_version:jC?+(/Firefox\/(\d+)/.exec(en.userAgent)||[0,0])[1]:0,chrome:!!fg,chrome_version:fg?+fg[1]:0,ios:GC,android:/Android\b/.test(en.userAgent),webkit:qC,safari:Tk,webkit_version:qC?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0,tabSize:bg.documentElement.style.tabSize!=null?"tab-size":"-moz-tab-size"},HP=256,Pr=class t extends Se{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>HP||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 $t(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 NP(this.dom,e,n)}},wo=class t extends Se{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(Sk(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:(Ek(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 Ik(this,e)}coordsAt(e,n){return Pk(this,e,n)}};function NP(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=Mi(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?Qg(a,s<0):a||null}var sf=class t extends Se{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 fe.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):fe.empty}domAtPos(e){return(this.length?e==0:this.side>0)?$t.before(this.dom):$t.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 Qg(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)}},Ba=class t extends Se{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?$t.before(this.dom):$t.after(this.dom)}localPosFromDOM(){return 0}domBoundsAround(){return null}coordsAt(e){return this.dom.getBoundingClientRect()}get overrideDOMText(){return fe.empty}get isHidden(){return!0}};Pr.prototype.children=sf.prototype.children=Ba.prototype.children=Xg;function Ik(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 $t(n,0)}function Lk(t,e,n){let r,{children:o}=t;n>0&&e instanceof wo&&o.length&&(r=o[o.length-1])instanceof wo&&r.mark.eq(e.mark)?Lk(r,e.children[0],n-1):(o.push(e),e.setParent(t)),t.length+=e.length}function Pk(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):FP(t)}function FP(t){let e=t.dom.lastChild;if(!e)return t.dom.getBoundingClientRect();let n=Fa(e);return n[n.length-1]||null}function Sg(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 JC=Object.create(null);function ev(t,e,n){if(t==e)return!0;t||(t=JC),e||(e=JC);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 Cg(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 BP(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 Dr=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){}},Ve=function(t){return t[t.Text=0]="Text",t[t.WidgetBefore=1]="WidgetBefore",t[t.WidgetAfter=2]="WidgetAfter",t[t.WidgetRange=3]="WidgetRange",t}(Ve||(Ve={})),Ze=class extends An{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 Va(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 So(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}=Dk(e,n);r=(i?n?-3e8:-1:5e8)-1,o=(s?n?2e8:1:-6e8)+1}return new So(e,r,o,n,e.widget||null,!0)}static line(e){return new za(e)}static set(e,n=!1){return Fe.of(e,n)}hasHeight(){return this.widget?this.widget.estimatedHeight>-1:!1}};Ze.none=Fe.empty;var Va=class t extends Ze{constructor(e){let{start:n,end:r}=Dk(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))&&ev(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)}};Va.prototype.point=!1;var za=class t extends Ze{constructor(e){super(-2e8,-2e8,null,e)}eq(e){return e instanceof t&&this.spec.class==e.spec.class&&ev(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)}};za.prototype.mapMode=bt.TrackBefore;za.prototype.point=!0;var So=class t extends Ze{constructor(e,n,r,o,i,s){super(n,r,i,e),this.block=o,this.isReplace=s,this.mapMode=o?n<=0?bt.TrackBefore:bt.TrackAfter:bt.TrackDel}get type(){return this.startSide<this.endSide?Ve.WidgetRange:this.startSide<=0?Ve.WidgetBefore:Ve.WidgetAfter}get heightRelevant(){return this.block||!!this.widget&&(this.widget.estimatedHeight>=5||this.widget.lineBreaks>0)}eq(e){return e instanceof t&&VP(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)}};So.prototype.point=!0;function Dk(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 VP(t,e){return t==e||!!(t&&e&&t.compare(e))}function kg(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 Xt=class t extends Se{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),Ek(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){ev(this.attrs,e)||(this.dom&&(this.prevAttrs=this.attrs,this.markDirty()),this.attrs=e)}append(e,n){Lk(this,e,n)}addLineDeco(e){let n=e.spec.attributes,r=e.spec.class;n&&(this.attrs=Sg(n,this.attrs||{})),r&&(this.attrs=Sg({class:r},this.attrs||{}))}domAtPos(e){return Ik(this,e)}reuseDOM(e){e.nodeName=="DIV"&&(this.setDOM(e),this.flags|=6)}sync(e,n){var r;this.dom?this.flags&4&&(Sk(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&&(Cg(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&&Se.get(o)instanceof wo;)o=o.lastChild;if(!o||!this.length||o.nodeName!="BR"&&((r=Se.get(o))===null||r===void 0?void 0:r.isEditable)==!1&&(!Q.ios||!this.children.some(i=>i instanceof Pr))){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 Pr)||/[^ -~]/.test(r.text))return null;let o=Fa(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=Pk(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 Ve.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}},$a=class t extends Se{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?$t.before(this.dom):$t.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 Xg}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):fe.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)}},Oa=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 $a&&e.type==Ve.WidgetBefore)}getLine(){return this.curLine||(this.content.push(this.curLine=new Xt),this.atCursorPos=!0),this.curLine}flushBuffer(e=this.bufferMarks){this.pendingBuffer&&(this.curLine.append($d(new Ba(-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($d(new Pr(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 So){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 So)if(r.block){let{type:a}=r;a==Ve.WidgetAfter&&!this.posCovered()&&this.getLine(),this.addBlockWidget(new $a(r.widget||new lf("div"),l,a))}else{let a=sf.create(r.widget||new lf("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($d(new Ba(1),o),i),i=o.length+Math.max(0,i-o.length)),f.append($d(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=Fe.spans(o,n,r,s),s.openStart<0&&(s.openStart=s.openEnd),s.finish(s.openEnd),s}};function $d(t,e){for(let n of e)t=new wo(n,[t],t.length);return t}var lf=class extends Dr{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}},Ak=ne.define(),Rk=ne.define(),Ok=ne.define(),Hk=ne.define(),Eg=ne.define(),Nk=ne.define(),Fk=ne.define(),Bk=ne.define({combine:t=>t.some(e=>e)}),Vk=ne.define({combine:t=>t.some(e=>e)}),af=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)}},ZC=ke.define({map:(t,e)=>t.map(e)});function or(t,e,n){let r=t.facet(Hk);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 gf=ne.define({combine:t=>t.length?t[0]:!0}),zP=0,Da=ne.define(),Ar=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(zP++,e,r,s=>{let l=[Da.of(s)];return i&&l.push(_a.of(a=>{let u=a.plugin(s);return u?i(u):Ze.none})),o&&l.push(o(s)),l})}static fromClass(e,n){return t.define(r=>new e(r),n)}},Ha=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(or(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){or(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){or(e.state,r,"CodeMirror plugin crashed")}}deactivate(){this.spec=this.value=null}},zk=ne.define(),tv=ne.define(),_a=ne.define(),nv=ne.define(),$k=ne.define();function _k(t){let e=0,n=0,r=0,o=0;for(let i of t.state.facet($k)){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 Aa=ne.define(),ir=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}}},uf=class t{constructor(e,n,r){this.view=e,this.state=n,this.transactions=r,this.flags=0,this.startState=e.state,this.changes=Dt.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 ir(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}},Be=function(t){return t[t.LTR=0]="LTR",t[t.RTL=1]="RTL",t}(Be||(Be={})),Mg=Be.LTR,$P=Be.RTL;function Wk(t){let e=[];for(let n=0;n<t.length;n++)e.push(1<<+t[n]);return e}var _P=Wk("88888888888888888888888888888888888666888888787833333333337888888000000000000000000000000008888880000000000000000000000000088888888888888888888888888888888888887866668888088888663380888308888800000000000000000000000800000000000000000000000000000008"),WP=Wk("4444448826627288999999999992222222222222222222222222222222222222222222222229999999999999999999994444444444644222822222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222222999999949999999229989999223333333333"),Tg=Object.create(null),nr=[];for(let t of["()","[]","{}"]){let e=t.charCodeAt(0),n=t.charCodeAt(1);Tg[e]=n,Tg[n]=-e}function KP(t){return t<=247?_P[t]:1424<=t&&t<=1524?2:1536<=t&&t<=1785?WP[t-1536]:1774<=t&&t<=2220?4:8192<=t&&t<=8203?256:64336<=t&&t<=65023?4:t==8204?256:1}var UP=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac\ufb50-\ufdff]/,yo=class{constructor(e,n,r){this.from=e,this.to=n,this.level=r}get dir(){return this.level%2?$P:Mg}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}},Te=[];function jP(t,e){let n=t.length,r=e==Mg?1:2,o=e==Mg?2:1;if(!t||r==1&&!UP.test(t))return Kk(n);for(let s=0,l=r,a=r;s<n;s++){let u=KP(t.charCodeAt(s));u==512?u=l:u==8&&a==4&&(u=16),Te[s]=u==4?2:u,u&7&&(a=u),l=u}for(let s=0,l=r,a=r;s<n;s++){let u=Te[s];if(u==128)s<n-1&&l==Te[s+1]&&l&24?u=Te[s]=l:Te[s]=256;else if(u==64){let c=s+1;for(;c<n&&Te[c]==64;)c++;let f=s&&l==8||c<n&&Te[c]==8?a==1?1:8:256;for(let d=s;d<c;d++)Te[d]=f;s=c-1}else u==8&&a==1&&(Te[s]=1);l=u,u&7&&(a=u)}for(let s=0,l=0,a=0,u,c,f;s<n;s++)if(c=Tg[u=t.charCodeAt(s)])if(c<0){for(let d=l-3;d>=0;d-=3)if(nr[d+1]==-c){let h=nr[d+2],g=h&2?r:h&4?h&1?o:r:0;g&&(Te[s]=Te[nr[d]]=g),l=d;break}}else{if(nr.length==189)break;nr[l++]=s,nr[l++]=u,nr[l++]=a}else if((f=Te[s])==2||f==1){let d=f==r;a=d?0:1;for(let h=l-3;h>=0;h-=3){let g=nr[h+2];if(g&2)break;if(d)nr[h+2]|=2;else{if(g&4)break;nr[h+2]|=4}}}for(let s=0;s<n;s++)if(Te[s]==256){let l=s+1;for(;l<n&&Te[l]==256;)l++;let a=(s?Te[s-1]:r)==1,u=(l<n?Te[l]:r)==1,c=a==u?a?1:2:r;for(let f=s;f<l;f++)Te[f]=c;s=l-1}let i=[];if(r==1)for(let s=0;s<n;){let l=s,a=Te[s++]!=1;for(;s<n&&a==(Te[s]!=1);)s++;if(a)for(let u=s;u>l;){let c=u,f=Te[--u]!=2;for(;u>l&&f==(Te[u-1]!=2);)u--;i.push(new yo(u,c,f?2:1))}else i.push(new yo(l,s,0))}else for(let s=0;s<n;){let l=s,a=Te[s++]==2;for(;s<n&&a==(Te[s]==2);)s++;i.push(new yo(l,s,a?1:2))}return i}function Kk(t){return[new yo(0,t,0)]}var Uk="";function qP(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=yo.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=xt(t.text,s,u);if(Uk=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 cf=class extends Se{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 Xt],this.children[0].setParent(this),this.updateDeco(),this.updateInner([new ir(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:JP(this.view,e.changes);if(this.hasComposition){this.markedForComposition.clear();let{from:l,to:a}=this.hasComposition;n=new ir(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=YP(o,i,e.changes);return n=ir.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 $a&&s.widget instanceof df&&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=Oa.build(this.view.state.doc,c,r.range.fromB,this.decorations,this.dynamicDecorationMap),C=Oa.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}=Oa.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);kk(this,y,x,p,m,d,h,g,v)}r&&this.fixCompositionDOM(r)}compositionView(e){let n=new Pr(e.text.nodeValue);n.flags|=8;for(let{deco:o}of e.marks)n=new wo(o,[n],n.length);let r=new Xt;return r.append(n,0),r}fixCompositionDOM(e){let n=(i,s)=>{s.flags|=8,this.markedForComposition.add(s);let l=Se.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&&Gd(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&&GP(a)){let f=document.createTextNode("");this.view.observer.ignore(()=>a.node.insertBefore(f,a.node.childNodes[a.offset]||null)),a=u=new $t(f,0),s=!0}let c=this.view.observer.selectionRange;(s||!c.focusNode||!ef(a.node,a.offset,c.anchorNode,c.anchorOffset)||!ef(u.node,u.offset,c.focusNode,c.focusOffset))&&(this.view.observer.ignore(()=>{Q.android&&Q.chrome&&this.dom.contains(c.focusNode)&&QP(c.focusNode,this.dom)&&(this.dom.blur(),this.dom.focus({preventScroll:!0}));let f=Xd(this.view.root);if(f)if(l.empty){if(Q.gecko){let d=ZP(a.node,a.offset);if(d&&d!=3){let h=qk(a.node,a.offset,d==1?1:-1);h&&(a=new $t(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 $t(c.anchorNode,c.anchorOffset),this.impreciseHead=u.precise?null:new $t(c.focusNode,c.focusOffset)}enforceCursorAssoc(){if(this.hasComposition)return;let{view:e}=this,n=e.state.selection.main,r=Xd(e.root),{anchorNode:o,anchorOffset:i}=e.observer.selectionRange;if(!r||!n.empty||!n.assoc||!r.modify)return;let s=Xt.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=Se.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 Xt)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!=Ve.WidgetBefore&&i.type!=Ve.WidgetAfter&&(!o||n==2||this.children[o-1].breakAfter||this.children[o-1].type==Ve.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 Xt))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 Pr))return null;let i=xt(o.text,r);if(i==r)return null;let s=Mi(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==Be.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?Fa(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"?Be.RTL:Be.LTR}measureTextSize(){for(let i of this.children)if(i instanceof Xt){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=Fa(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 nf(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(Ze.replace({widget:new df(l),block:!0,inclusive:!0,isBlockGap:!0}).range(r,s))}if(!i)break;r=i.to+1}return Ze.set(e)}updateDeco(){let e=this.view.state.facet(_a).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=_k(this.view),s={left:r.left-i.left,top:r.top-i.top,right:r.right+i.right,bottom:r.bottom+i.bottom};DP(this.view.scrollDOM,s,n.head<n.anchor?-1:1,e.x,e.y,e.xMargin,e.yMargin,this.view.textDirection==Be.LTR)}};function GP(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 df=class extends Dr{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 jk(t){let e=t.observer.selectionRange,n=e.focusNode&&qk(e.focusNode,e.focusOffset,0);if(!n)return null;let r=Se.get(n),o,i;if(r instanceof Pr)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=Se.get(u)){o=i=c.posAtEnd+s;break e}let f=new rf([],t.state);if(f.readNode(u),f.text.indexOf(Ws)>-1)return null;s+=f.text.length}if(l=l.parentNode,!l)return null;let a=Se.get(l);if(a){o=i=a.posAtStart+s;break}}return{from:o,to:i,node:n}}function JP(t,e){let n=jk(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 ir(r,o,s,l);for(let d=i.parentNode;;d=d.parentNode){let h=Se.get(d);if(h instanceof wo)c.push({node:d,deco:h.mark});else{if(h instanceof Xt||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 Va({inclusive:!0,attributes:BP(d),tagName:d.tagName.toLowerCase()})});else return null}}}function qk(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=xo(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 ZP(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 Ig=class{constructor(){this.changes=[]}compareRange(e,n){kg(e,n,this.changes)}comparePoint(e,n){kg(e,n,this.changes)}};function YP(t,e,n){let r=new Ig;return Fe.compare(t,e,n,r),r.changes}function QP(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 XP(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=xt(o.text,i,!1):l=xt(o.text,i);let a=r(o.text.slice(s,l));for(;s>0;){let u=xt(o.text,s,!1);if(r(o.text.slice(u,s))!=a)break;s=u}for(;l<o.length;){let u=xt(o.text,l);if(r(o.text.slice(l,u))!=a)break;l=u}return $.range(s+o.from,l+o.from)}function eD(t,e){return e.left>t?e.left-t:Math.max(0,t-e.right)}function tD(t,e){return e.top>t?e.top-t:Math.max(0,t-e.bottom)}function hg(t,e){return t.top<e.bottom-1&&t.bottom>e.top+1}function YC(t,e){return e<t.top?{top:e,left:t.left,right:t.right,bottom:t.bottom}:t}function QC(t,e){return e>t.bottom?{top:t.top,left:t.left,right:t.right,bottom:e}:t}function Lg(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=Fa(g);for(let p=0;p<v.length;p++){let m=v[p];o&&hg(o,m)&&(m=YC(QC(m,o.bottom),o.top));let y=eD(e,m),x=tD(n,m);if(y==0&&x==0)return g.nodeType==3?XC(g,e,n):Lg(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&&hg(c,m)?c=QC(c,m.bottom):f&&hg(f,m)&&(f=YC(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 XC(r,d,n);if(l&&r.contentEditable!="false")return Lg(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 XC(t,e,n){let r=t.nodeValue.length,o=-1,i=1e9,s=0;for(let l=0;l<r;l++){let a=Mi(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)&&Mi(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 Gk(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!=Ve.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:ek(t,s,a,c,f);if(h>t.viewport.to)return t.viewport.to==t.state.doc.length?t.state.doc.length:n?null:ek(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&&nD(m,y,c)||Q.chrome&&rD(m,y,c))&&(m=void 0))}}if(!m||!t.docView.dom.contains(m)){let b=Xt.find(t.docView,h);if(!b)return d>a.top+a.height/2?a.to:a.from;({node:m,offset:y}=Lg(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 ek(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+FC(s,i,t.state.tabSize)}function nD(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 Mi(t,r-1,r).getBoundingClientRect().left>n}function rD(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():Mi(t,0,Math.max(t.nodeValue.length,1)).getBoundingClientRect();return n-r.left>5}function Pg(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==Ve.Text))return r}return n}function oD(t,e,n,r){let o=Pg(t,e.head),i=!r||o.type!=Ve.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==Be.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 tk(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=qP(o,i,s,l,n),c=Uk;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 iD(t,e,n){let r=t.state.charCategorizer(e),o=r(n);return i=>{let s=r(i);return o==Pt.Space&&(o=s),o==s}}function sD(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=Gk(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 Jd(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 pg(t,e,n){let r=Jd(t.state.facet(nv).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 Dg=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 _e){let o=_e[r];e.contentDOM.addEventListener(r,i=>{nk(e,i)&&n(o,i)},Rg[r]),this.registeredEvents.push(r)}e.scrollDOM.addEventListener("mousedown",r=>{if(r.target==e.scrollDOM&&r.clientY>e.contentDOM.getBoundingClientRect().bottom&&(n(_e.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(_e.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=>{nk(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){or(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){or(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&&Zk.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=Jk.find(o=>o.keyCode==n.keyCode))&&!n.ctrlKey||lD.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,Us(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()}},Jk=[{key:"Backspace",keyCode:8,inputType:"deleteContentBackward"},{key:"Enter",keyCode:13,inputType:"insertParagraph"},{key:"Enter",keyCode:13,inputType:"insertLineBreak"},{key:"Delete",keyCode:46,inputType:"deleteContentForward"}],lD="dthko",Zk=[16,17,18,20,91,92,224,225],_d=6;function Wd(t){return Math.max(0,t)*.7+8}function aD(t,e){return Math.max(Math.abs(t.clientX-e.clientX),Math.abs(t.clientY-e.clientY))}var Ag=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=AP(e.contentDOM),this.atoms=e.state.facet(nv).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(Me.allowMultipleSelections)&&uD(e,n),this.dragging=dD(e,n)&&eE(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&&aD(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=_k(this.view);e.clientX-s.left<=i.left+_d?r=-Wd(i.left-e.clientX):e.clientX+s.right>=i.right-_d&&(r=Wd(e.clientX-i.right)),e.clientY-s.top<=i.top+_d?o=-Wd(i.top-e.clientY):e.clientY+s.bottom>=i.bottom-_d&&(o=Wd(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=Jd(this.atoms,o.from,0);s!=o.from&&(i=$.cursor(s,-1))}else{let s=Jd(this.atoms,o.from,-1),l=Jd(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 uD(t,e){let n=t.state.facet(Ak);return n.length?n[0](e):Q.mac?e.metaKey:e.ctrlKey}function cD(t,e){let n=t.state.facet(Rk);return n.length?n[0](e):Q.mac?!e.altKey:!e.ctrlKey}function dD(t,e){let{main:n}=t.state.selection;if(n.empty)return!1;let r=Xd(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 nk(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=Se.get(n))&&r.ignoreEvent(e))return!1;return!0}var _e=Object.create(null),Rg=Object.create(null),Yk=Q.ie&&Q.ie_version<15||Q.ios&&Q.webkit_version<604;function fD(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(),Qk(t,n.value)},50)}function Qk(t,e){let{state:n}=t,r,o=1,i=n.toText(e),s=i.lines==n.selection.ranges.length;if(Og!=null&&n.selection.ranges.every(a=>a.empty)&&Og==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})}_e.keydown=(t,e)=>{t.inputState.setSelectionOrigin("select"),e.keyCode==27&&(t.inputState.lastEscPress=Date.now())};_e.touchstart=(t,e)=>{t.inputState.lastTouchTime=Date.now(),t.inputState.setSelectionOrigin("select.pointer")};_e.touchmove=t=>{t.inputState.setSelectionOrigin("select.pointer")};Rg.touchstart=Rg.touchmove={passive:!0};_e.mousedown=(t,e)=>{if(t.observer.flush(),t.inputState.lastTouchTime>Date.now()-2e3)return;let n=null;for(let r of t.state.facet(Ok))if(n=r(t,e),n)break;if(!n&&e.button==0&&(n=mD(t,e)),n){let r=!t.hasFocus;t.inputState.startMouseSelection(new Ag(t,e,n,r)),r&&t.observer.ignore(()=>wk(t.contentDOM)),t.inputState.mouseSelection&&t.inputState.mouseSelection.start(e)}};function rk(t,e,n,r){if(r==1)return $.cursor(e,n);if(r==2)return XP(t.state,e,n);{let o=Xt.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 Xk=(t,e)=>t>=e.top&&t<=e.bottom,ok=(t,e,n)=>Xk(e,n)&&t>=n.left&&t<=n.right;function hD(t,e,n,r){let o=Xt.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&&ok(n,r,s))return-1;let l=o.coordsAt(i,1);return l&&ok(n,r,l)?1:s&&Xk(r,s)?-1:1}function ik(t,e){let n=t.posAtCoords({x:e.clientX,y:e.clientY},!1);return{pos:n,bias:hD(t,n,e.clientX,e.clientY)}}var pD=Q.ie&&Q.ie_version<=11,sk=null,lk=0,ak=0;function eE(t){if(!pD)return t.detail;let e=sk,n=ak;return sk=t,ak=Date.now(),lk=!e||n>Date.now()-400&&Math.abs(e.clientX-t.clientX)<2&&Math.abs(e.clientY-t.clientY)<2?(lk+1)%3:1}function mD(t,e){let n=ik(t,e),r=eE(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=ik(t,i),u,c=rk(t,a.pos,a.bias,r);if(n.pos!=a.pos&&!s){let f=rk(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=gD(o,a.pos))?u:l?o.addRange(c):$.create([c])}}}function gD(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}_e.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 uk(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&&cD(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"})}_e.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&&uk(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 uk(t,e,e.dataTransfer.getData("Text"),!0)};_e.paste=(t,e)=>{if(t.state.readOnly)return e.preventDefault();t.observer.flush();let n=Yk?null:e.clipboardData;n?(Qk(t,n.getData("text/plain")||n.getData("text/uri-text")),e.preventDefault()):fD(t)};function vD(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 yD(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 Og=null;_e.copy=_e.cut=(t,e)=>{let{text:n,ranges:r,linewise:o}=yD(t.state);if(!n&&!o)return;Og=o?n:null;let i=Yk?null:e.clipboardData;i?(e.preventDefault(),i.clearData(),i.setData("text/plain",n)):vD(t,n),e.type=="cut"&&!t.state.readOnly&&t.dispatch({changes:r,scrollIntoView:!0,userEvent:"delete.cut"})};var tE=Qt.define();function nE(t,e){let n=[];for(let r of t.facet(Fk)){let o=r(t,e);o&&n.push(o)}return n?t.update({effects:n,annotations:tE.of(!0)}):null}function rE(t){setTimeout(()=>{let e=t.hasFocus;if(e!=t.inputState.notifiedFocused){let n=nE(t.state,e);n?t.dispatch(n):t.update([])}},10)}_e.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),rE(t)};_e.blur=t=>{t.observer.clearSelectionRange(),rE(t)};_e.compositionstart=_e.compositionupdate=t=>{t.inputState.compositionFirstChange==null&&(t.inputState.compositionFirstChange=!0),t.inputState.composing<0&&(t.inputState.composing=0)};_e.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)};_e.contextmenu=t=>{t.inputState.lastContextMenu=Date.now()};_e.beforeinput=(t,e)=>{var n;let r;if(Q.chrome&&Q.android&&(r=Jk.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 ck=["pre-wrap","normal","pre-line","break-spaces"],Hg=class{constructor(e){this.lineWrapping=e,this.doc=fe.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 ck.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=ck.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}},Ng=class{constructor(e,n){this.from=e,this.heights=n,this.index=0}get more(){return this.index<this.heights.length}},rr=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"?Ve.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 So?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)}},we=function(t){return t[t.ByPos=0]="ByPos",t[t.ByHeight=1]="ByHeight",t[t.ByPosNoHeight=2]="ByPosNoHeight",t}(we||(we={})),Zd=.001,tn=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)>Zd&&(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,we.ByPosNoHeight,r.setDoc(n),0,0),h=d.to>=u?d:i.lineAt(u,we.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,we.ByPosNoHeight,r,0,0));c+=d.from-a,a=d.from;let g=Bg.build(r.setDoc(s),e,c,f);i=i.replace(a,u,g)}return i.updateHeight(r,0)}static empty(){return new xn(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 Fg(t.of(e.slice(0,n)),s,t.of(e.slice(r)))}};tn.prototype.size=1;var ff=class extends tn{constructor(e,n,r){super(e,n),this.deco=r}blockAt(e,n,r,o){return new rr(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})`}},xn=class t extends ff{constructor(e,n){super(e,n,null),this.collapsed=0,this.widgetHeight=0,this.breaks=0}blockAt(e,n,r,o){return new rr(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 bo&&o.flags&4)&&Math.abs(this.length-o.length)<10?(o instanceof bo?o=new t(o.length,this.height):o.height=this.height,this.outdated||(o.outdated=!1),o):tn.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:""})`}},bo=class t extends tn{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 rr(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 rr(c,f,r+l*u,l,0)}}lineAt(e,n,r,o,i){if(n==we.ByHeight)return this.blockAt(e,r,o,i);if(n==we.ByPosNoHeight){let{from:h,to:g}=r.doc.lineAt(e);return new rr(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 rr(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 rr(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 tn.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)>=Zd&&(a=-2);let d=new xn(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=tn.of(s);return(a<0||Math.abs(u.height-this.height)>=Zd||Math.abs(a-this.heightMetrics(e,n).perLine)>=Zd)&&(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})`}},Fg=class extends tn{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==we.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==we.ByPosNoHeight?we.ByPosNoHeight:we.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,we.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&&dk(i,s-1),n<this.length){let l=i.length;this.decomposeRight(n,i),dk(i,l)}return tn.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?tn.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 dk(t,e){let n,r;t[e]==null&&(n=t[e-1])instanceof bo&&(r=t[e+1])instanceof bo&&t.splice(e-1,3,new bo(n.length+1+r.length))}var bD=5,Bg=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 xn?o.length+=r-this.pos:(r>this.pos||!this.isCovered)&&this.nodes.push(new xn(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 ff(s,o,r)):(s||i||o>=bD)&&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 xn(this.pos-e,-1)),this.writtenTo=this.pos}blankContent(e,n){let r=new bo(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 xn)return e;let n=new xn(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==Ve.WidgetAfter&&!this.isCovered&&this.ensureLine(),this.nodes.push(e),this.writtenTo=this.pos=this.pos+e.length,r!=Ve.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 xn)&&!this.isCovered?this.nodes.push(new xn(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 xn&&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 Fe.spans(n,r,o,i,0),i.finish(r)}};function xD(t,e,n){let r=new Vg;return Fe.compare(t,e,n,r,0),r.changes}var Vg=class{constructor(){this.changes=[]}compareRange(){}comparePoint(e,n,r,o){(e<n||r&&r.heightRelevant||o&&o.heightRelevant)&&kg(e,n,this.changes,5)}};function wD(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 SD(t,e){let n=t.getBoundingClientRect();return{left:0,right:n.right-n.left,top:e,bottom:n.bottom-(n.top+e)}}var Na=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 Ze.replace({widget:new zg(this.size,e)}).range(this.from,this.to)}},zg=class extends Dr{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}},hf=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=fk,this.scrollTarget=null,this.printing=!1,this.mustMeasureContent=!0,this.defaultTextDirection=Be.LTR,this.visibleRanges=[],this.mustEnforceCursorAssoc=!1;let n=e.facet(tv).some(r=>typeof r!="function"&&r.class=="cm-lineWrapping");this.heightOracle=new Hg(n),this.stateDeco=e.facet(_a).filter(r=>typeof r!="function"),this.heightMap=tn.empty().applyChanges(this.stateDeco,fe.empty,this.heightOracle.setDoc(e.doc),[new ir(0,0,0,e.doc.length)]),this.viewport=this.getViewport(0,null),this.updateViewportLines(),this.updateForViewport(),this.lineGaps=this.ensureLineGaps([]),this.lineGapDeco=Ze.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 Ks(i,s))}}this.viewports=e.sort((r,o)=>r.from-o.from),this.scaler=this.heightMap.height<=7e6?fk:new $g(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:Ra(e,this.scaler))})}update(e,n=null){this.state=e.state;let r=this.stateDeco;this.stateDeco=this.state.facet(_a).filter(c=>typeof c!="function");let o=e.changedRanges,i=ir.extendWithRanges(o,xD(r,this.stateDeco,e?e.changes:Dt.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(Vk)&&(this.mustEnforceCursorAssoc=!0)}measure(e){let n=e.contentDOM,r=window.getComputedStyle(n),o=this.heightOracle,i=r.whiteSpace;this.defaultTextDirection=r.direction=="rtl"?Be.RTL:Be.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=Ck(e.scrollDOM);let h=(this.printing?SD:wD)(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?tn.empty().applyChanges(this.stateDeco,fe.empty,this.heightOracle,[new ir(0,0,0,e.state.doc.length)]):this.heightMap).updateHeight(o,0,s,new Ng(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 Ks(o.lineAt(s-r*1e3,we.ByHeight,i,0,0).from,o.lineAt(l+(1-r)*1e3,we.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,we.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 Ks(o.lineAt(d-1e3/2,we.ByHeight,i,0,0).from,o.lineAt(d+c+1e3/2,we.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 Ks(this.heightMap.lineAt(r,we.ByPos,this.heightOracle,0,0).from,this.heightMap.lineAt(o,we.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,we.ByPos,this.heightOracle,0,0),{bottom:i}=this.heightMap.lineAt(n,we.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 Na(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!=Be.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=kD(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 Na(u,c,this.gapSize(f,u,c,d))}l.push(v)};for(let u of this.viewportLines){if(u.length<s)continue;let c=CD(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=Ud(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=Kd(c,v),h=Kd(c,p)}else{let g=c.total*this.heightOracle.charWidth,v=o*this.heightOracle.charWidth,p,m;if(f!=null){let y=Ud(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=Kd(c,p),h=Kd(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=Ud(o,r)-Ud(o,n);return this.heightOracle.lineWrapping?e.height*i:o.total*this.heightOracle.charWidth*i}updateLineGaps(e){Na.same(e,this.lineGaps)||(this.lineGaps=e,this.lineGapDeco=Ze.set(e.map(n=>n.draw(this.heightOracle.lineWrapping))))}computeVisibleRanges(){let e=this.stateDeco;this.lineGaps.length&&(e=e.concat(this.lineGapDeco));let n=[];Fe.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)||Ra(this.heightMap.lineAt(e,we.ByPos,this.heightOracle,0,0),this.scaler)}lineBlockAtHeight(e){return Ra(this.heightMap.lineAt(this.scaler.fromDOM(e),we.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 Ra(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}},Ks=class{constructor(e,n){this.from=e,this.to=n}};function CD(t,e,n){let r=[],o=t,i=0;return Fe.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 Kd({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 Ud(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 kD(t,e){for(let n of t)if(e(n))return n}var fk={toDOM(t){return t},fromDOM(t){return t},scale:1},$g=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,we.ByPos,e,0,0).top,c=n.lineAt(a,we.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 Ra(t,e){if(e.scale==1)return t;let n=e.toDOM(t.top),r=e.toDOM(t.bottom);return new rr(t.from,t.length,n,r-n,Array.isArray(t._content)?t._content.map(o=>Ra(o,e)):t._content)}var jd=ne.define({combine:t=>t.join(" ")}),_g=ne.define({combine:t=>t.indexOf(!0)>-1}),Wg=bn.newName(),oE=bn.newName(),iE=bn.newName(),sE={"&light":"."+oE,"&dark":"."+iE};function Kg(t,e,n){return new bn(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 ED=Kg("."+Wg,{"&":{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"}},sE),Ug=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?[]:TD(e),a=new rf(l,e.state);a.readRange(this.bounds.startDOM,this.bounds.endDOM),this.text=a.text,this.newSel=ID(l,this.bounds.from)}else{let l=e.observer.selectionRange,a=i&&i.node==l.focusNode&&i.offset==l.focusOffset||!vg(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||!vg(e.contentDOM,l.anchorNode)?e.state.selection.main.anchor:e.docView.posFromDOM(l.anchorNode,l.anchorOffset);this.newSel=$.single(u,a)}}};function lE(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=MD(t.state.doc.sliceString(s,l,Ws),e.text,a-s,u);c&&(Q.chrome&&i==13&&c.toB==c.from+2&&e.text.slice(c.from,c.toB)==Ws+Ws&&c.toB--,n={from:s+c.from,to:s+c.toA,insert:fe.of(e.text.slice(c.from,c.toB).split(Ws))})}else r&&(!t.hasFocus&&t.state.facet(gf)||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:fe.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:fe.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&&Us(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)&&Us(t.contentDOM,"Backspace",8)||n.from==o.from&&n.to==o.to+1&&n.insert.length==0&&Us(t.contentDOM,"Delete",46)))return!0;let l=n.insert.toString();if(t.state.facet(Nk).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=jk(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 MD(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 TD(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 of(n,r)),(o!=n||i!=r)&&e.push(new of(o,i))),e}function ID(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 LD={childList:!0,characterData:!0,subtree:!0,attributes:!0,characterDataOldValue:!0},mg=Q.ie&&Q.ie_version<=11,jg=class{constructor(e){this.view=e,this.active=!1,this.selectionRange=new yg,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()}),mg&&(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(gf)?r.root.activeElement!=this.dom:!Gd(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&&ef(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&&LP(this.dom.ownerDocument)==this.dom&&PD(this.view)||Xd(e.root);if(!n||this.selectionRange.eq(n))return!1;let r=Gd(this.dom,n);return r&&!this.selectionChanged&&e.inputState.lastFocusTime>Date.now()-200&&e.inputState.lastTouchTime<Date.now()-300&&OP(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,LD),mg&&this.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.active=!0)}stop(){this.active&&(this.active=!1,this.observer.disconnect(),mg&&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&&Us(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&&Gd(this.dom,this.selectionRange);return e<0&&!o?null:(e>-1&&(this.lastChange=Date.now()),this.view.inputState.lastFocusTime=0,this.selectionChanged=!1,new Ug(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=lE(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=hk(n,e.previousSibling||e.target.previousSibling,-1),o=hk(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 hk(t,e,n){for(;e;){let r=Se.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 PD(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 ef(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||RP(e.parent)||document,this.viewState=new hf(e.state||Me.create(e)),this.plugins=this.state.facet(Da).map(n=>new Ha(n));for(let n of this.plugins)n.update(this);this.observer=new jg(this),this.inputState=new Dg(this),this.inputState.ensureHandlers(this,this.plugins),this.docView=new cf(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 rt?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(tE))?(this.inputState.notifiedFocused=s,l=1):s!=this.inputState.notifiedFocused&&(this.inputState.notifiedFocused=s,a=nE(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(Me.phrases)!=this.state.facet(Me.phrases))return this.setState(i);o=uf.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 af(h.empty?h:$.cursor(h.head,h.head>h.anchor?-1:1))}for(let h of d.effects)h.is(ZC)&&(f=h.value)}this.viewState.update(o,f),this.bidiCache=pf.update(this.bidiCache,o.changes),o.empty||(this.updatePlugins(o),this.inputState.update(o)),n=this.docView.update(o),this.state.facet(Aa)!=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(jd)!=o.state.facet(jd)&&(this.viewState.mustMeasureContent=!0),(n||r||f||this.viewState.mustEnforceCursorAssoc||this.viewState.mustMeasureContent)&&this.requestMeasure(),!o.empty)for(let d of this.state.facet(Eg))d(o);(a||c)&&Promise.resolve().then(()=>{a&&this.state==a.startState&&this.dispatch(a),c&&!lE(this,c)&&u.force&&Us(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 hf(e),this.plugins=e.facet(Da).map(r=>new Ha(r)),this.pluginMap.clear();for(let r of this.plugins)r.update(this);this.docView=new cf(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(Da),r=e.state.facet(Da);if(n!=r){let o=[];for(let i of r){let s=n.indexOf(i);if(s<0)o.push(new Ha(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(Ck(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 or(this.state,g),pk}}),f=uf.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]!=pk)try{let g=u[h];g.write&&g.write(c[h],this)}catch(g){or(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(Eg))l(n)}get themeClasses(){return Wg+" "+(this.state.facet(_g)?iE:oE)+" "+this.state.facet(jd)}updateAttrs(){let e=mk(this,zk,{class:"cm-editor"+(this.hasFocus?" cm-focused ":" ")+this.themeClasses}),n={spellcheck:"false",autocorrect:"off",autocapitalize:"off",translate:"no",contenteditable:this.state.facet(gf)?"true":"false",class:"cm-content",style:`${Q.tabSize}: ${this.state.tabSize}`,role:"textbox","aria-multiline":"true"};this.state.readOnly&&(n["aria-readonly"]="true"),mk(this,tv,n);let r=this.observer.ignore(()=>{let o=Cg(this.contentDOM,this.contentAttrs,n),i=Cg(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(Aa),bn.mount(this.root,this.styleModules.concat(ED).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 pg(this,e,tk(this,e,n,r))}moveByGroup(e,n){return pg(this,e,tk(this,e,n,r=>iD(this,e.head,r)))}moveToLineBoundary(e,n,r=!0){return oD(this,e,n,r)}moveVertically(e,n,r){return pg(this,e,sD(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(),Gk(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[yo.find(i,e-o.from,-1,n)];return Qg(r,s.dir==Be.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(Bk)||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>DD)return Kk(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=jP(e.text,n);return this.bidiCache.push(new pf(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(()=>{wk(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 ZC.of(new af(typeof e=="number"?$.cursor(e):e,n.y,n.x,n.yMargin,n.xMargin))}static domEventHandlers(e){return Ar.define(()=>({}),{eventHandlers:e})}static theme(e,n){let r=bn.newName(),o=[jd.of(r),Aa.of(Kg(`.${r}`,e))];return n&&n.dark&&o.push(_g.of(!0)),o}static baseTheme(e){return Ci.lowest(Aa.of(Kg("."+Wg,e,sE)))}static findFromDOM(e){var n;let r=e.querySelector(".cm-content"),o=r&&Se.get(r)||Se.get(e);return((n=o==null?void 0:o.rootView)===null||n===void 0?void 0:n.view)||null}};ie.styleModule=Aa;ie.inputHandler=Nk;ie.focusChangeEffect=Fk;ie.perLineTextDirection=Bk;ie.exceptionSink=Hk;ie.updateListener=Eg;ie.editable=gf;ie.mouseSelectionStyle=Ok;ie.dragMovesSelection=Rk;ie.clickAddsSelectionRange=Ak;ie.decorations=_a;ie.atomicRanges=nv;ie.scrollMargins=$k;ie.darkTheme=_g;ie.contentAttributes=tv;ie.editorAttributes=zk;ie.lineWrapping=ie.contentAttributes.of({class:"cm-lineWrapping"});ie.announce=ke.define();var DD=4096,pk={},pf=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:Be.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 mk(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&&Sg(s,n)}return n}var AD=Q.mac?"mac":Q.windows?"win":Q.linux?"linux":"key";function RD(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 qd(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 OD=Ci.default(ie.domEventHandlers({keydown(t,e){return BD(HD(e.state),t,e,"editor")}})),js=ne.define({enables:OD}),gk=new WeakMap;function HD(t){let e=t.facet(js),n=gk.get(e);return n||gk.set(e,n=FD(e.reduce((r,o)=>r.concat(o),[]))),n}var vo=null,ND=4e3;function FD(t,e=AD){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=>RD(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=vo={view:x,prefix:y,scope:s};return setTimeout(()=>{vo==b&&(vo=null)},ND),!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 BD(t,e,n,r){let o=$C(e),i=tr(o,0),s=wi(i)==o.length&&o!=" ",l="",a=!1,u=!1,c=!1;vo&&vo.view==n&&vo.scope==r&&(l=vo.prefix+" ",Zk.indexOf(e.keyCode)<0&&(u=!0,vo=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+qd(o,e,!s)])?a=!0:s&&(e.altKey||e.metaKey||e.ctrlKey)&&!(Q.windows&&e.ctrlKey&&e.altKey)&&(g=Lr[e.keyCode])&&g!=o?(d(h[l+qd(g,e,!0)])||e.shiftKey&&(v=$s[e.keyCode])!=o&&v!=g&&d(h[l+qd(v,e,!1)]))&&(a=!0):s&&e.shiftKey&&d(h[l+qd(o,e,!0)])&&(a=!0),!a&&d(h._any)&&(a=!0)),u&&(a=!0),a&&c&&e.stopPropagation(),a}var Wa=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=aE(e);return[new t(n,o.left-i.left,o.top-i.top,null,o.bottom-o.top)]}else return VD(e,n,r)}};function aE(t){let e=t.scrollDOM.getBoundingClientRect();return{left:(t.textDirection==Be.LTR?e.left:e.right-t.scrollDOM.clientWidth)-t.scrollDOM.scrollLeft,top:e.top-t.scrollDOM.scrollTop}}function vk(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:Ve.Text}}function VD(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==Be.LTR,s=t.contentDOM,l=s.getBoundingClientRect(),a=aE(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=Pg(t,r),g=Pg(t,o),v=h.type==Ve.Text?h:null,p=g.type==Ve.Text?g:null;if(v&&(t.lineWrapping||h.widgetLineBreaks)&&(v=vk(t,r,v)),p&&(t.lineWrapping||g.widgetLineBreaks)&&(p=vk(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==Ve.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 Wa(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==Be.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 zD(t,e){return t.constructor==e.constructor&&t.eq(e)}var qg=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(Yd)!=e.state.facet(Yd)&&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(Yd);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)=>!zD(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()}},Yd=ne.define();function uE(t){return[Ar.define(e=>new qg(e,t)),Yd.of(t)]}var cE=!Q.ios,Ka=ne.define({combine(t){return ki(t,{cursorBlinkRate:1200,drawRangeCursor:!0},{cursorBlinkRate:(e,n)=>Math.min(e,n),drawRangeCursor:(e,n)=>e||n})}});function rv(t={}){return[Ka.of(t),$D,_D,WD,Vk.of(!0)]}function dE(t){return t.startState.facet(Ka)!=t.state.facet(Ka)}var $D=uE({above:!0,markers(t){let{state:e}=t,n=e.facet(Ka),r=[];for(let o of e.selection.ranges){let i=o==e.selection.main;if(o.empty?!i||cE: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 Wa.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=dE(t);return n&&yk(t.state,e),t.docChanged||t.selectionSet||n},mount(t,e){yk(e.state,t)},class:"cm-cursorLayer"});function yk(t,e){e.style.animationDuration=t.facet(Ka).cursorBlinkRate+"ms"}var _D=uE({above:!1,markers(t){return t.state.selection.ranges.map(e=>e.empty?[]:Wa.forRange(t,"cm-selectionBackground",e)).reduce((e,n)=>e.concat(n))},update(t,e){return t.docChanged||t.selectionSet||t.viewportChanged||dE(t)},class:"cm-selectionLayer"}),fE={".cm-line":{"& ::selection":{backgroundColor:"transparent !important"},"&::selection":{backgroundColor:"transparent !important"}}};cE&&(fE[".cm-line"].caretColor="transparent !important");var WD=Ci.highest(ie.theme(fE));function bk(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 KD(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 Gg=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 go,r=n.add.bind(n);for(let{from:o,to:i}of KD(e,this.maxLength))bk(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 bk(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}},Jg=/x/.unicode!=null?"gu":"g",UD=new RegExp(`[\0-\b
|
|
417
|
-
-\x7F-\x9F\xAD\u061C\u200B\u200E\u200F\u2028\u2029\u202D\u202E\u2066\u2067\u2069\uFEFF\uFFF9-\uFFFC]`,Jg),jD={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"},gg=null;function qD(){var t;if(gg==null&&typeof document<"u"&&document.body){let e=document.body.style;gg=((t=e.tabSize)!==null&&t!==void 0?t:e.MozTabSize)!=null}return gg||!1}var Qd=ne.define({combine(t){let e=ki(t,{render:null,specialChars:UD,addSpecialChars:null});return(e.replaceTabs=!qD())&&(e.specialChars=new RegExp(" |"+e.specialChars.source,Jg)),e.addSpecialChars&&(e.specialChars=new RegExp(e.specialChars.source+"|"+e.addSpecialChars.source,Jg)),e}});function ov(t={}){return[Qd.of(t),GD()]}var xk=null;function GD(){return xk||(xk=Ar.fromClass(class{constructor(t){this.view=t,this.decorations=Ze.none,this.decorationCache=Object.create(null),this.decorator=this.makeDecorator(t.state.facet(Qd)),this.decorations=this.decorator.createDeco(t)}makeDecorator(t){return new Gg({regexp:t.specialChars,decoration:(e,n,r)=>{let{doc:o}=n.state,i=tr(e[0],0);if(i==9){let s=o.lineAt(r),l=n.state.tabSize,a=Ei(s.text,l,r-s.from);return Ze.replace({widget:new Yg((l-a%l)*this.view.defaultCharacterWidth)})}return this.decorationCache[i]||(this.decorationCache[i]=Ze.replace({widget:new Zg(t,i)}))},boundary:t.replaceTabs?void 0:/[^]/})}update(t){let e=t.state.facet(Qd);t.startState.facet(Qd)!=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 JD="\u2022";function ZD(t){return t>=32?JD:t==10?"\u2424":String.fromCharCode(9216+t)}var Zg=class extends Dr{constructor(e,n){super(),this.options=e,this.code=n}eq(e){return e.code==this.code}toDOM(e){let n=ZD(this.code),r=e.state.phrase("Control character")+" "+(jD[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}},Yg=class extends Dr{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 zK=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 Rr=class extends An{compare(e){return this==e||this.constructor==e.constructor&&this.eq(e)}eq(e){return!1}destroy(e){}};Rr.prototype.elementClass="";Rr.prototype.toDOM=void 0;Rr.prototype.mapMode=bt.TrackBefore;Rr.prototype.startSide=Rr.prototype.endSide=-1;Rr.prototype.point=!0;var YD=0,Ua=class{constructor(e,n){this.from=e,this.to=n}},ae=class{constructor(e={}){this.id=YD++,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=nn.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 QD=Object.create(null),nn=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):QD,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}}}};nn.none=new nn("",Object.create(null),0,8);var vf=new WeakMap,hE=new WeakMap,ot;(function(t){t[t.ExcludeBuffers=1]="ExcludeBuffers",t[t.IncludeAnonymous=2]="IncludeAnonymous",t[t.IgnoreMounts=4]="IgnoreMounts",t[t.IgnoreOverlays=8]="IgnoreOverlays"})(ot||(ot={}));var ut=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 Gs(this.topNode,e)}cursorAt(e,n=0,r=0){let o=vf.get(this)||this.topNode,i=new Gs(o);return i.moveTo(e,n),vf.set(this,i._tree),i}get topNode(){return new Ii(this,0,0,null)}resolve(e,n=0){let r=qs(vf.get(this)||this.topNode,e,n,!1);return vf.set(this,r),r}resolveInner(e,n=0){let r=qs(hE.get(this)||this.topNode,e,n,!0);return hE.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&ot.IncludeAnonymous)>0;for(let a=this.cursor(s|ot.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:uv(nn.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(nn.none,n,r,o)))}static build(e){return XD(e)}};ut.empty=new ut(nn.none,[],[],0);var iv=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)}},Ti=class t{constructor(e,n,r){this.buffer=e,this.length=n,this.set=r}get type(){return nn.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&&!(mE(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 mE(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 gE(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 qs(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 Ii&&t.index<0?null:t.parent;if(!s)return t;t=s}let i=r?0:ot.IgnoreOverlays;if(r)for(let s=t,l=s.parent;l;s=l,l=s.parent)s instanceof Ii&&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 Ii=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(mE(o,r,f,f+c.length)){if(c instanceof Ti){if(i&ot.ExcludeBuffers)continue;let d=c.findChild(0,c.buffer.length,n,r-f,o);if(d>-1)return new ja(new sv(s,c,e,f),null,d)}else if(i&ot.IncludeAnonymous||!c.type.isAnonymous||av(c)){let d;if(!(i&ot.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&ot.IncludeAnonymous||!h.type.isAnonymous?h:h.nextChild(n<0?c.children.length-1:0,n,r,o)}}}if(i&ot.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&ot.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 Gs(this,e)}get tree(){return this._tree}toTree(){return this._tree}resolve(e,n=0){return qs(this,e,n,!1)}resolveInner(e,n=0){return qs(this,e,n,!0)}enterUnfinishedNodesBefore(e){return gE(this,e)}getChild(e,n=null,r=null){let o=bf(this,e,n,r);return o.length?o[0]:null}getChildren(e,n=null,r=null){return bf(this,e,n,r)}toString(){return this._tree.toString()}get node(){return this}matchContext(e){return xf(this,e)}};function bf(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 xf(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 sv=class{constructor(e,n,r,o){this.parent=e,this.buffer=n,this.index=r,this.start=o}},ja=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&ot.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 Gs(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 ut(this.type,e,n,this.to-this.from)}resolve(e,n=0){return qs(this,e,n,!1)}resolveInner(e,n=0){return qs(this,e,n,!0)}enterUnfinishedNodesBefore(e){return gE(this,e)}toString(){return this.context.buffer.childString(this.index)}getChild(e,n=null,r=null){let o=bf(this,e,n,r);return o.length?o[0]:null}getChildren(e,n=null,r=null){return bf(this,e,n,r)}get node(){return this}matchContext(e){return xf(this,e)}},Gs=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 Ii)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 Ii?(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&ot.ExcludeBuffers?!1:this.enterChild(1,e,n):this.yield(this._tree.enter(e,n,r))}parent(){if(!this.buffer)return this.yieldNode(this.mode&ot.IncludeAnonymous?this._tree._parent:this._tree.parent);if(this.stack.length)return this.yieldBuf(this.stack.pop());let e=this.mode&ot.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&ot.IncludeAnonymous||l instanceof Ti||!l.type.isAnonymous||av(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 ja(this.buffer,n,this.stack[o]);return this.bufferNode=new ja(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 xf(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 xf(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 av(t){return t.children.some(e=>e instanceof Ti||!e.type.isAnonymous||av(e))}function XD(t){var e;let{buffer:n,nodeSet:r,maxBufferLength:o=1024,reused:i=[],minRepeatType:s=r.types.length}=t,l=Array.isArray(n)?new iv(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 Ti(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=uv(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 ut){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 ut(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 ut(a[t.topID],m.reverse(),y.reverse(),x)}var pE=new WeakMap;function yf(t,e){if(!t.isAnonymous||e instanceof Ti||e.type!=t)return 1;let n=pE.get(e);if(n==null){n=1;for(let r of e.children){if(r.type!=t||!(r instanceof ut)){n=1;break}n+=yf(t,r)}pE.set(e,n)}return n}function uv(t,e,n,r,o,i,s,l,a){let u=0;for(let g=r;g<o;g++)u+=yf(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=yf(t,g[x]);for(x++;x<m;x++){let S=yf(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(uv(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 Li=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}},wf=class{startParse(e,n,r){return typeof e=="string"&&(e=new lv(e)),r=r?r.length?r.map(o=>new Ua(o.from,o.to)):[new Ua(0,0)]:[new Ua(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}}},lv=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 WK=new ae({perNode:!0});var e6=0,ur=class t{constructor(e,n,r){this.set=e,this.base=n,this.modified=r,this.id=e6++}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 Ef;return n=>n.modified.indexOf(e)>-1?n:Ef.get(n.base||n,n.modified.concat(e).sort((r,o)=>r.id-o.id))}},t6=0,Ef=class t{constructor(){this.instances=[],this.id=t6++}static get(e,n){if(!n.length)return e;let r=n[0].instances.find(l=>l.base==e&&n6(n,l.modified));if(r)return r;let o=[],i=new ur(o,e,n);for(let l of n)l.instances.push(i);let s=r6(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 n6(t,e){return t.length==e.length&&t.every((n,r)=>n==e[r])}function r6(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 Ga(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 Js(r,s,a>0?i.slice(0,a):null);e[u]=c.sort(e[u])}}return bE.add(e)}var bE=new ae,Js=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}};Js.empty=new Js([],2,null);function hv(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 o6(t,e){let n=null;for(let r of t){let o=r.style(e);o&&(n=n?n+" "+o:o)}return n}function xE(t,e,n,r=0,o=t.length){let i=new dv(r,Array.isArray(e)?e:[e],n);i.highlightRange(t.cursor(),r,o,"",i.highlighters),i.flush(o)}var dv=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=i6(e)||Js.empty,f=o6(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 i6(t){let e=t.type.prop(bE);for(;e&&e.context&&!t.matchContext(e.context);)e=e.next;return e||null}var K=ur.define,Sf=K(),Co=K(),vE=K(Co),yE=K(Co),ko=K(),Cf=K(ko),cv=K(ko),ar=K(),Pi=K(ar),sr=K(),lr=K(),fv=K(),qa=K(fv),kf=K(),_={comment:Sf,lineComment:K(Sf),blockComment:K(Sf),docComment:K(Sf),name:Co,variableName:K(Co),typeName:vE,tagName:K(vE),propertyName:yE,attributeName:K(yE),className:K(Co),labelName:K(Co),namespace:K(Co),macroName:K(Co),literal:ko,string:Cf,docString:K(Cf),character:K(Cf),attributeValue:K(Cf),number:cv,integer:K(cv),float:K(cv),bool:K(ko),regexp:K(ko),escape:K(ko),color:K(ko),url:K(ko),keyword:sr,self:K(sr),null:K(sr),atom:K(sr),unit:K(sr),modifier:K(sr),operatorKeyword:K(sr),controlKeyword:K(sr),definitionKeyword:K(sr),moduleKeyword:K(sr),operator:lr,derefOperator:K(lr),arithmeticOperator:K(lr),logicOperator:K(lr),bitwiseOperator:K(lr),compareOperator:K(lr),updateOperator:K(lr),definitionOperator:K(lr),typeOperator:K(lr),controlOperator:K(lr),punctuation:fv,separator:K(fv),bracket:qa,angleBracket:K(qa),squareBracket:K(qa),paren:K(qa),brace:K(qa),content:ar,heading:Pi,heading1:K(Pi),heading2:K(Pi),heading3:K(Pi),heading4:K(Pi),heading5:K(Pi),heading6:K(Pi),contentSeparator:K(ar),list:K(ar),quote:K(ar),emphasis:K(ar),strong:K(ar),link:K(ar),monospace:K(ar),strikethrough:K(ar),inserted:K(),deleted:K(),changed:K(),invalid:K(),meta:kf,documentMeta:K(kf),annotation:K(kf),processingInstruction:K(kf),definition:ur.defineModifier(),constant:ur.defineModifier(),function:ur.defineModifier(),standard:ur.defineModifier(),local:ur.defineModifier(),special:ur.defineModifier()},jK=hv([{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 pv,Zs=new ae;function s6(t){return ne.define({combine:t?e=>e.concat(t):void 0})}var l6=new ae,rn=class{constructor(e,n,r=[],o=""){this.data=e,this.name=o,Me.prototype.hasOwnProperty("tree")||Object.defineProperty(Me.prototype,"tree",{get(){return wt(this)}}),this.parser=n,this.extension=[Ys.of(this),Me.languageData.of((i,s,l)=>{let a=wE(i,s,l),u=a.type.prop(Zs);if(!u)return[];let c=i.facet(u),f=a.type.prop(l6);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 wE(e,n,r).type.prop(Zs)==this.data}findRegions(e){let n=e.facet(Ys);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(Zs)==this.data){r.push({from:s,to:s+i.length});return}let l=i.prop(ae.mounted);if(l){if(l.tree.prop(Zs)==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 ut&&o(u,i.positions[a]+s)}};return o(wt(e),0),r}get allowsNesting(){return!0}};rn.setState=ke.define();function wE(t,e,n){let r=t.facet(Ys),o=wt(t).topNode;if(!r||r.allowsNesting)for(let i=o;i;i=i.enter(e,n,ot.ExcludeBuffers))i.type.isTop&&(o=i);return o}var Za=class t extends rn{constructor(e,n,r){super(e,n,[],r),this.parser=n}static define(e){let n=s6(e.languageData);return new t(n,e.parser.configure({props:[Zs.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 wt(t){let e=t.field(rn.state,!1);return e?e.tree:ut.empty}var yv=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)}},Ja=null,bv=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,[],ut.empty,0,r,[],null)}startParse(){return this.parser.startParse(new yv(this.state.doc),this.fragments)}work(e,n){return n!=null&&n>=this.state.doc.length&&(n=void 0),this.tree!=ut.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(Li.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(Li.addTree(this.tree,this.fragments,!0)),this.parse=null)}withContext(e){let n=Ja;Ja=this;try{return e()}finally{Ja=n}}withoutTempSkipped(e){for(let n;n=this.tempSkipped.pop();)e=SE(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=Li.applyChanges(r,a),o=ut.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=SE(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 wf{createParse(n,r,o){let i=o[0].from,s=o[o.length-1].to;return{parsedPos:i,advance(){let a=Ja;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 ut(nn.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 Ja}};function SE(t,e,n){return Li.applyChanges(t,[{fromA:e,toA:n,fromB:e,toB:n}])}var Ya=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=bv.create(e.facet(Ys).parser,e,{from:0,to:n});return r.work(20,n)||r.takeTree(),new t(r)}};rn.state=Yt.define({create:Ya.init,update(t,e){for(let n of e.effects)if(n.is(rn.setState))return n.value;return e.startState.facet(Ys)!=e.state.facet(Ys)?Ya.init(e.state):t.apply(e)}});var EE=t=>{let e=setTimeout(()=>t(),500);return()=>clearTimeout(e)};typeof requestIdleCallback<"u"&&(EE=t=>{let e=-1,n=setTimeout(()=>{e=requestIdleCallback(t,{timeout:400})},100);return()=>e<0?clearTimeout(n):cancelIdleCallback(e)});var mv=typeof navigator<"u"&&(!((pv=navigator.scheduling)===null||pv===void 0)&&pv.isInputPending)?()=>navigator.scheduling.isInputPending():null,a6=Ar.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(rn.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(rn.state);(n.tree!=n.context.tree||!n.context.isDone(e.doc.length))&&(this.working=EE(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(rn.state);if(i.tree==i.context.tree&&i.context.isDone(o+1e5))return;let s=Date.now()+Math.min(this.chunkBudget,100,e&&!mv?Math.max(25,e.timeRemaining()-5):1e9),l=i.context.treeLen<o&&r.doc.length>o+1e3,a=i.context.work(()=>mv&&mv()||Date.now()>s,o+(l?0:1e5));this.chunkBudget-=Date.now()-n,(a||this.chunkBudget<=0)&&(i.context.takeTree(),this.view.dispatch({effects:rn.setState.of(new Ya(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=>or(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()}}}),Ys=ne.define({combine(t){return t.length?t[0]:null},enables:t=>[rn.state,a6,ie.contentAttributes.compute([t],e=>{let n=e.facet(t);return n&&n.name?{"data-language":n.name}:{}})]});var u6=ne.define(),Qa=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 Xa(t){let e=t.facet(Qa);return e.charCodeAt(0)==9?t.tabSize*e.length:e.length}function eu(t,e){let n="",r=t.tabSize,o=t.facet(Qa)[0];if(o==" "){for(;e>=r;)n+=" ",e-=r;o=" "}for(let i=0;i<e;i++)n+=o;return n}function Ev(t,e){t instanceof Me&&(t=new Di(t));for(let r of t.state.facet(u6)){let o=r(t,e);if(o!==void 0)return o}let n=wt(t.state);return n?d6(t,n,e):null}var Di=class{constructor(e,n={}){this.state=e,this.options=n,this.unit=Xa(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 Ei(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}},c6=new ae;function d6(t,e,n){return ME(e.resolveInner(n).enterUnfinishedNodesBefore(n),n,t)}function f6(t){return t.pos==t.options.simulateBreak&&t.options.simulateDoubleBreak}function h6(t){let e=t.type.prop(c6);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=>v6(s,!0,1,void 0,i&&!f6(s)?o.from:void 0)}return t.parent==null?p6:null}function ME(t,e,n){for(;t;t=t.parent){let r=h6(t);if(r)return r(xv.create(n,e,t))}return null}function p6(){return 0}var xv=class t extends Di{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(m6(r,e))break;n=this.state.doc.lineAt(r.from)}return this.lineIndent(n.from)}continue(){let e=this.node.parent;return e?ME(e,this.pos,this.base):0}};function m6(t,e){for(let n=e;n;n=n.parent)if(t==n)return!0;return!1}function g6(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 v6(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?g6(t):null;return a?l?t.column(a.from):t.column(a.to):t.baseIndent+(l?0:t.unit*n)}var Ai=class t{constructor(e,n){this.specs=e;let r;function o(l){let a=bn.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 rn?l=>l.prop(Zs)==s.data:s?l=>l==s:void 0,this.style=hv(e.map(l=>({tag:l.tag,class:l.class||o(Object.assign({},l,{tag:null}))})),{all:i}).style,this.module=r?new bn(r):null,this.themeType=n.themeType}static define(e,n){return new t(e,n||{})}},wv=ne.define(),TE=ne.define({combine(t){return t.length?[t[0]]:null}});function gv(t){let e=t.facet(wv);return e.length?e:t.facet(TE)}function tu(t,e){let n=[y6],r;return t instanceof Ai&&(t.module&&n.push(ie.styleModule.of(t.module)),r=t.themeType),e!=null&&e.fallback?n.push(TE.of(t)):r?n.push(wv.computeN([ie.darkTheme],o=>o.facet(ie.darkTheme)==(r=="dark")?[t]:[])):n.push(wv.of(t)),n}var Sv=class{constructor(e){this.markCache=Object.create(null),this.tree=wt(e.state),this.decorations=this.buildDeco(e,gv(e.state))}update(e){let n=wt(e.state),r=gv(e.state),o=r!=gv(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 Ze.none;let r=new go;for(let{from:o,to:i}of e.visibleRanges)xE(this.tree,n,(s,l,a)=>{r.add(s,l,this.markCache[a]||(this.markCache[a]=Ze.mark({class:a})))},o,i);return r.finish()}},y6=Ci.high(Ar.fromClass(Sv,{decorations:t=>t.decorations})),Mv=Ai.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 b6=1e4,x6="()[]{}";var w6=new ae;function Cv(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 kv(t){let e=t.type.prop(w6);return e?e(t.node):t}function Ri(t,e,n,r={}){let o=r.maxScanDistance||b6,i=r.brackets||x6,s=wt(t),l=s.resolveInner(e,n);for(let a=l;a;a=a.parent){let u=Cv(a.type,n,i);if(u&&a.from<a.to){let c=kv(a);if(c&&(n>0?e>=c.from&&e<c.to:e>c.from&&e<=c.to))return S6(t,e,n,a,c,u,i)}}return C6(t,e,n,s,l.type,o,i)}function S6(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=kv(c);return{start:a,end:f?{from:f.from,to:f.to}:void 0,matched:!0}}else if(Cv(c.type,n,s))u++;else if(Cv(c.type,-n,s)){if(u==0){let f=kv(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 C6(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 k6=Object.create(null),CE=[nn.none];var kE=[],E6=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"]])E6[t]=M6(k6,e);function vv(t,e){kE.indexOf(t)>-1||(kE.push(t),console.warn(e))}function M6(t,e){let n=null;for(let i of e.split(".")){let s=t[i]||_[i];s?typeof s=="function"?n?n=s(n):vv(i,`Modifier ${i} used at start of tag`):n?vv(i,`Tag ${i} used as modifier`):n=s:vv(i,`Unknown highlighting tag ${i}`)}if(!n)return 0;let r=e.replace(/ /g,"_"),o=nn.define({id:CE.length,name:r,props:[Ga({[r]:n})]});return CE.push(o),o.id}var Mf={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]},Oi=ke.define({map(t,e){let n=e.mapPos(t,-1,bt.TrackAfter);return n==null?void 0:n}}),Iv=new class extends An{};Iv.startSide=1;Iv.endSide=-1;var PE=Yt.define({create(){return Fe.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=Fe.empty)}t=t.map(e.changes);for(let n of e.effects)n.is(Oi)&&(t=t.update({add:[Iv.range(n.value,n.value+1)]}));return t}});function DE(){return[P6,PE]}var Tv="()[]{}<>";function T6(t){for(let e=0;e<Tv.length;e+=2)if(Tv.charCodeAt(e)==t)return Tv.charAt(e+1);return EC(t<128?t:t+1)}function I6(t,e){return t.languageDataAt("closeBrackets",e)[0]||Mf}var L6=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent),P6=ie.inputHandler.of((t,e,n,r)=>{if((L6?t.composing:t.compositionStarted)||t.state.readOnly)return!1;let o=t.state.selection.main;if(r.length>2||r.length==2&&wi(tr(r,0))==1||e!=o.from||n!=o.to)return!1;let i=D6(t.state,r);return i?(t.dispatch(i),!0):!1});function D6(t,e){let n=I6(t,t.selection.main.head),r=n.brackets||Mf.brackets;for(let o of r){let i=T6(tr(o,0));if(e==o)return i==o?O6(t,o,r.indexOf(o+o+o)>-1,n):A6(t,o,i,n.before||Mf.before);if(e==i&&AE(t,t.selection.main.from))return R6(t,o,i)}return null}function AE(t,e){let n=!1;return t.field(PE).between(0,t.doc.length,r=>{r==e&&(n=!0)}),n}function Lv(t,e){let n=t.sliceString(e,e+2);return n.slice(0,wi(tr(n,0)))}function A6(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:Oi.of(s.to+e.length),range:$.range(s.anchor+e.length,s.head+e.length)};let l=Lv(t.doc,s.head);return!l||/\s/.test(l)||r.indexOf(l)>-1?{changes:{insert:e+n,from:s.head},effects:Oi.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 R6(t,e,n){let r=null,o=t.changeByRange(i=>i.empty&&Lv(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 O6(t,e,n,r){let o=r.stringPrefixes||Mf.stringPrefixes,i=null,s=t.changeByRange(l=>{if(!l.empty)return{changes:[{insert:e,from:l.from},{insert:e,from:l.to}],effects:Oi.of(l.to+e.length),range:$.range(l.anchor+e.length,l.head+e.length)};let a=l.head,u=Lv(t.doc,a),c;if(u==e){if(IE(t,a))return{changes:{insert:e+e,from:a},effects:Oi.of(a+e.length),range:$.cursor(a+e.length)};if(AE(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=LE(t,a-2*e.length,o))>-1&&IE(t,c))return{changes:{insert:e+e+e+e,from:a},effects:Oi.of(a+e.length),range:$.cursor(a+e.length)};if(t.charCategorizer(a)(u)!=Pt.Word&&LE(t,a,o)>-1&&!H6(t,a,e,o))return{changes:{insert:e+e,from:a},effects:Oi.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 IE(t,e){let n=wt(t).resolveInner(e+1);return n.parent&&n.from==e}function H6(t,e,n,r){let o=wt(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 LE(t,e,n){let r=t.charCategorizer(e);if(r(t.sliceDoc(e-1,e))!=Pt.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))!=Pt.Word)return i}return-1}var N6=t=>{let{state:e}=t,n=e.doc.lineAt(e.selection.main.from),r=Nv(t.state,n.from);return r.line?F6(t):r.block?V6(t):!1};function Hv(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 F6=Hv(_6,0);var B6=Hv(zE,0);var V6=Hv((t,e)=>zE(t,e,$6(e)),0);function Nv(t,e){let n=t.languageDataAt("commentTokens",e);return n.length?n[0]:{}}var nu=50;function z6(t,{open:e,close:n},r,o){let i=t.sliceDoc(r-nu,r),s=t.sliceDoc(o,o+nu),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*nu?c=f=t.sliceDoc(r,o):(c=t.sliceDoc(r,r+nu),f=t.sliceDoc(o-nu,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 $6(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 zE(t,e,n=e.selection.ranges){let r=n.map(i=>Nv(e,i.from).block);if(!r.every(i=>i))return null;let o=n.map((i,s)=>z6(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 _6(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=Nv(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 Dv=Qt.define(),W6=Qt.define(),K6=ne.define(),$E=ne.define({combine(t){return ki(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 U6(t){let e=0;return t.iterChangedRanges((n,r)=>e=r),e}var _E=Yt.define({create(){return Hi.empty},update(t,e){let n=e.state.facet($E),r=e.annotation(Dv);if(r){let a=e.docChanged?$.single(U6(e.changes)):void 0,u=Rn.fromTransaction(e,a),c=r.side,f=c==0?t.undone:t.done;return u?f=If(f,f.length,n.minDepth,u):f=jE(f,e.startState.selection),new Hi(c==0?r.rest:f,c==0?f:r.rest)}let o=e.annotation(W6);if((o=="full"||o=="before")&&(t=t.isolate()),e.annotation(rt.addToHistory)===!1)return e.changes.empty?t:t.addMapping(e.changes.desc);let i=Rn.fromTransaction(e),s=e.annotation(rt.time),l=e.annotation(rt.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 Hi(t.done.map(Rn.fromJSON),t.undone.map(Rn.fromJSON))}});function WE(t={}){return[_E,$E.of(t),ie.domEventHandlers({beforeinput(e,n){let r=e.inputType=="historyUndo"?KE:e.inputType=="historyRedo"?Av:null;return r?(e.preventDefault(),r(n)):!1}})]}function Lf(t,e){return function({state:n,dispatch:r}){if(!e&&n.readOnly)return!1;let o=n.field(_E,!1);if(!o)return!1;let i=o.pop(t,n,e);return i?(r(i),!0):!1}}var KE=Lf(0,!1),Av=Lf(1,!1),j6=Lf(0,!0),q6=Lf(1,!0);var Rn=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&&Dt.fromJSON(e.changes),[],e.mapped&&Ir.fromJSON(e.mapped),e.startSelection&&$.fromJSON(e.startSelection),e.selectionsAfter.map($.fromJSON))}static fromTransaction(e,n){let r=wn;for(let o of e.startState.facet(K6)){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,wn)}static selection(e){return new t(void 0,wn,void 0,void 0,e)}};function If(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 G6(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 J6(t,e){return t.ranges.length==e.ranges.length&&t.ranges.filter((n,r)=>n.empty!=e.ranges[r].empty).length===0}function UE(t,e){return t.length?e.length?t.concat(e):t:e}var wn=[],Z6=200;function jE(t,e){if(t.length){let n=t[t.length-1],r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-Z6));return r.length&&r[r.length-1].eq(e)?t:(r.push(e),If(t,t.length-1,1e9,n.setSelAfter(r)))}else return[Rn.selection([e])]}function Y6(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 Pv(t,e){if(!t.length)return t;let n=t.length,r=wn;for(;n;){let o=Q6(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?[Rn.selection(r)]:wn}function Q6(t,e,n){let r=UE(t.selectionsAfter.length?t.selectionsAfter.map(l=>l.map(e)):wn,n);if(!t.changes)return Rn.selection(r);let o=t.changes.map(e),i=e.mapDesc(t.changes,!0),s=t.mapped?t.mapped.composeDesc(i):i;return new Rn(o,ke.mapEffects(t.effects,e),s,t.startSelection.map(i),r)}var X6=/^(input\.type|delete)($|\.)/,Hi=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||X6.test(r))&&(!l.selectionsAfter.length&&n-this.prevTime<o.newGroupDelay&&o.joinToEvent(i,G6(l.changes,e.changes))||r=="input.type.compose")?s=If(s,s.length-1,o.minDepth,new Rn(e.changes.compose(l.changes),UE(e.effects,l.effects),l.mapped,l.startSelection,wn)):s=If(s,s.length,o.minDepth,e),new t(s,wn,n,r)}addSelection(e,n,r,o){let i=this.done.length?this.done[this.done.length-1].selectionsAfter:wn;return i.length>0&&n-this.prevTime<o&&r==this.prevUserEvent&&r&&/^select($|\.)/.test(r)&&J6(i[i.length-1],e)?this:new t(jE(this.done,e),this.undone,n,r)}addMapping(e){return new t(Pv(this.done,e),Pv(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:Dv.of({side:e,rest:Y6(o)}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:!0});if(i.changes){let s=o.length==1?wn:o.slice(0,o.length-1);return i.mapped&&(s=Pv(s,i.mapped)),n.update({changes:i.changes,selection:i.startSelection,effects:i.effects,annotations:Dv.of({side:e,rest:s}),filter:!1,userEvent:e==0?"undo":"redo",scrollIntoView:!0})}else return null}};Hi.empty=new Hi(wn,wn);var qE=[{key:"Mod-z",run:KE,preventDefault:!0},{key:"Mod-y",mac:"Mod-Shift-z",run:Av,preventDefault:!0},{linux:"Ctrl-Shift-z",run:Av,preventDefault:!0},{key:"Mod-u",run:j6,preventDefault:!0},{key:"Alt-u",mac:"Mod-Shift-u",run:q6,preventDefault:!0}];function Qs(t,e){return $.create(t.ranges.map(e),t.mainIndex)}function cr(t,e){return t.update({selection:e,scrollIntoView:!0,userEvent:"select"})}function On({state:t,dispatch:e},n){let r=Qs(t.selection,n);return r.eq(t.selection)?!1:(e(cr(t,r)),!0)}function Pf(t,e){return $.cursor(e?t.to:t.from)}function GE(t,e){return On(t,n=>n.empty?t.moveByChar(n,e):Pf(n,e))}function St(t){return t.textDirectionAt(t.state.selection.main.head)==Be.LTR}var JE=t=>GE(t,!St(t)),ZE=t=>GE(t,St(t));function YE(t,e){return On(t,n=>n.empty?t.moveByGroup(n,e):Pf(n,e))}var e4=t=>YE(t,!St(t)),t4=t=>YE(t,St(t));function n4(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 Df(t,e,n){let r=wt(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;n4(t,u,o)?r=u:a=n?u.to:u.from}let i=r.type.prop(o),s,l;return i&&(s=n?Ri(t,r.from,1):Ri(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 r4=t=>On(t,e=>Df(t.state,e,!St(t))),o4=t=>On(t,e=>Df(t.state,e,St(t)));function QE(t,e){return On(t,n=>{if(!n.empty)return Pf(n,e);let r=t.moveVertically(n,e);return r.head!=n.head?r:t.moveToLineBoundary(n,e)})}var XE=t=>QE(t,!1),eM=t=>QE(t,!0);function tM(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 nM(t,e){let n=tM(t),{state:r}=t,o=Qs(r.selection,s=>s.empty?t.moveVertically(s,e,n.height):Pf(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(cr(r,o),{effects:i}),!0}var RE=t=>nM(t,!1),Rv=t=>nM(t,!0);function Eo(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 i4=t=>On(t,e=>Eo(t,e,!0)),s4=t=>On(t,e=>Eo(t,e,!1)),l4=t=>On(t,e=>Eo(t,e,!St(t))),a4=t=>On(t,e=>Eo(t,e,St(t))),u4=t=>On(t,e=>$.cursor(t.lineBlockAt(e.head).from,1)),c4=t=>On(t,e=>$.cursor(t.lineBlockAt(e.head).to,-1));function d4(t,e,n){let r=!1,o=Qs(t.selection,i=>{let s=Ri(t,i.head,-1)||Ri(t,i.head,1)||i.head>0&&Ri(t,i.head-1,1)||i.head<t.doc.length&&Ri(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(cr(t,o)),!0):!1}var f4=({state:t,dispatch:e})=>d4(t,e,!1);function Sn(t,e){let n=Qs(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(cr(t.state,n)),!0)}function rM(t,e){return Sn(t,n=>t.moveByChar(n,e))}var oM=t=>rM(t,!St(t)),iM=t=>rM(t,St(t));function sM(t,e){return Sn(t,n=>t.moveByGroup(n,e))}var h4=t=>sM(t,!St(t)),p4=t=>sM(t,St(t));var m4=t=>Sn(t,e=>Df(t.state,e,!St(t))),g4=t=>Sn(t,e=>Df(t.state,e,St(t)));function lM(t,e){return Sn(t,n=>t.moveVertically(n,e))}var aM=t=>lM(t,!1),uM=t=>lM(t,!0);function cM(t,e){return Sn(t,n=>t.moveVertically(n,e,tM(t).height))}var OE=t=>cM(t,!1),HE=t=>cM(t,!0),v4=t=>Sn(t,e=>Eo(t,e,!0)),y4=t=>Sn(t,e=>Eo(t,e,!1)),b4=t=>Sn(t,e=>Eo(t,e,!St(t))),x4=t=>Sn(t,e=>Eo(t,e,St(t))),w4=t=>Sn(t,e=>$.cursor(t.lineBlockAt(e.head).from)),S4=t=>Sn(t,e=>$.cursor(t.lineBlockAt(e.head).to)),NE=({state:t,dispatch:e})=>(e(cr(t,{anchor:0})),!0),FE=({state:t,dispatch:e})=>(e(cr(t,{anchor:t.doc.length})),!0),BE=({state:t,dispatch:e})=>(e(cr(t,{anchor:t.selection.main.anchor,head:0})),!0),VE=({state:t,dispatch:e})=>(e(cr(t,{anchor:t.selection.main.anchor,head:t.doc.length})),!0),C4=({state:t,dispatch:e})=>(e(t.update({selection:{anchor:0,head:t.doc.length},userEvent:"select"})),!0),k4=({state:t,dispatch:e})=>{let n=Rf(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},E4=({state:t,dispatch:e})=>{let n=Qs(t.selection,r=>{var o;let i=wt(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(cr(t,n)),!0},M4=({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(cr(t,r)),!0):!1};function Af(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=Tf(t,a,!1)):a>s&&(n="delete.forward",a=Tf(t,a,!0)),s=Math.min(s,a),l=Math.max(l,a)}else s=Tf(t,s,!1),l=Tf(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 Tf(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 dM=(t,e)=>Af(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=Ei(i,r.tabSize),a=l%Xa(r)||Xa(r);for(let u=0;u<a&&i[i.length-1-u]==" ";u++)n--;s=n}else s=xt(o.text,n-o.from,e,e)+o.from,s==n&&o.number!=(e?r.doc.lines:1)&&(s+=e?1:-1);return s}),Ov=t=>dM(t,!1),fM=t=>dM(t,!0),hM=(t,e)=>Af(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=xt(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}),pM=t=>hM(t,!1),T4=t=>hM(t,!0),mM=t=>Af(t,e=>{let n=t.lineBlockAt(e).to;return e<n?n:Math.min(t.state.doc.length,e+1)}),I4=t=>Af(t,e=>{let n=t.lineBlockAt(e).from;return e>n?n:Math.max(0,e-1)});var L4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=t.changeByRange(r=>({changes:{from:r.from,to:r.to,insert:fe.of(["",""])},range:$.cursor(r.from)}));return e(t.update(n,{scrollIntoView:!0,userEvent:"input"})),!0},P4=({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:xt(i.text,o-i.from,!1)+i.from,l=o==i.to?o+1:xt(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 Rf(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 gM(t,e,n){if(t.readOnly)return!1;let r=[],o=[];for(let i of Rf(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 D4=({state:t,dispatch:e})=>gM(t,e,!1),A4=({state:t,dispatch:e})=>gM(t,e,!0);function vM(t,e,n){if(t.readOnly)return!1;let r=[];for(let o of Rf(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 R4=({state:t,dispatch:e})=>vM(t,e,!1),O4=({state:t,dispatch:e})=>vM(t,e,!0),H4=t=>{if(t.state.readOnly)return!1;let{state:e}=t,n=e.changes(Rf(e).map(({from:o,to:i})=>(o>0?o--:i<e.doc.length&&i++,{from:o,to:i}))),r=Qs(e.selection,o=>t.moveVertically(o,!0)).map(n);return t.dispatch({changes:n,selection:r,scrollIntoView:!0,userEvent:"delete.line"}),!0};function N4(t,e){if(/\(\)|\[\]|\{\}/.test(t.sliceDoc(e-1,e+1)))return{from:e,to:e};let n=wt(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 F4=yM(!1),B4=yM(!0);function yM(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&&N4(e,i);t&&(i=s=(s<=l.to?l:e.doc.lineAt(s)).to);let u=new Di(e,{simulateBreak:i,simulateDoubleBreak:!!a}),c=Ev(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=["",eu(e,c)];return a&&f.push(eu(e,u.lineIndent(l.from,-1))),{changes:{from:i,to:s,insert:fe.of(f)},range:$.cursor(i+1+f[1].length)}});return n(e.update(r,{scrollIntoView:!0,userEvent:"input"})),!0}}function Fv(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 V4=({state:t,dispatch:e})=>{if(t.readOnly)return!1;let n=Object.create(null),r=new Di(t,{overrideIndentation:i=>{let s=n[i];return s==null?-1:s}}),o=Fv(t,(i,s,l)=>{let a=Ev(r,i.from);if(a==null)return;/\S/.test(i.text)||(a=0);let u=/^\s*/.exec(i.text)[0],c=eu(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},z4=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Fv(t,(n,r)=>{r.push({from:n.from,insert:t.facet(Qa)})}),{userEvent:"input.indent"})),!0),$4=({state:t,dispatch:e})=>t.readOnly?!1:(e(t.update(Fv(t,(n,r)=>{let o=/^\s*/.exec(n.text)[0];if(!o)return;let i=Ei(o,t.tabSize),s=0,l=eu(t,Math.max(0,i-Xa(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 _4=[{key:"Ctrl-b",run:JE,shift:oM,preventDefault:!0},{key:"Ctrl-f",run:ZE,shift:iM},{key:"Ctrl-p",run:XE,shift:aM},{key:"Ctrl-n",run:eM,shift:uM},{key:"Ctrl-a",run:u4,shift:w4},{key:"Ctrl-e",run:c4,shift:S4},{key:"Ctrl-d",run:fM},{key:"Ctrl-h",run:Ov},{key:"Ctrl-k",run:mM},{key:"Ctrl-Alt-h",run:pM},{key:"Ctrl-o",run:L4},{key:"Ctrl-t",run:P4},{key:"Ctrl-v",run:Rv}],W4=[{key:"ArrowLeft",run:JE,shift:oM,preventDefault:!0},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:e4,shift:h4,preventDefault:!0},{mac:"Cmd-ArrowLeft",run:l4,shift:b4,preventDefault:!0},{key:"ArrowRight",run:ZE,shift:iM,preventDefault:!0},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:t4,shift:p4,preventDefault:!0},{mac:"Cmd-ArrowRight",run:a4,shift:x4,preventDefault:!0},{key:"ArrowUp",run:XE,shift:aM,preventDefault:!0},{mac:"Cmd-ArrowUp",run:NE,shift:BE},{mac:"Ctrl-ArrowUp",run:RE,shift:OE},{key:"ArrowDown",run:eM,shift:uM,preventDefault:!0},{mac:"Cmd-ArrowDown",run:FE,shift:VE},{mac:"Ctrl-ArrowDown",run:Rv,shift:HE},{key:"PageUp",run:RE,shift:OE},{key:"PageDown",run:Rv,shift:HE},{key:"Home",run:s4,shift:y4,preventDefault:!0},{key:"Mod-Home",run:NE,shift:BE},{key:"End",run:i4,shift:v4,preventDefault:!0},{key:"Mod-End",run:FE,shift:VE},{key:"Enter",run:F4},{key:"Mod-a",run:C4},{key:"Backspace",run:Ov,shift:Ov},{key:"Delete",run:fM},{key:"Mod-Backspace",mac:"Alt-Backspace",run:pM},{key:"Mod-Delete",mac:"Alt-Delete",run:T4},{mac:"Mod-Backspace",run:I4},{mac:"Mod-Delete",run:mM}].concat(_4.map(t=>({mac:t.key,run:t.run,shift:t.shift}))),Bv=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:r4,shift:m4},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:o4,shift:g4},{key:"Alt-ArrowUp",run:D4},{key:"Shift-Alt-ArrowUp",run:R4},{key:"Alt-ArrowDown",run:A4},{key:"Shift-Alt-ArrowDown",run:O4},{key:"Escape",run:M4},{key:"Mod-Enter",run:B4},{key:"Alt-l",mac:"Ctrl-l",run:k4},{key:"Mod-i",run:E4,preventDefault:!0},{key:"Mod-[",run:$4},{key:"Mod-]",run:z4},{key:"Mod-Alt-\\",run:V4},{key:"Shift-Mod-k",run:H4},{key:"Shift-Mod-\\",run:f4},{key:"Mod-/",run:N6},{key:"Alt-A",run:B6}].concat(W4);var K4=[...Bv,...qE],U4=[ov(),WE(),rv(),DE(),tu(Mv,{fallback:!0}),js.of(K4)];var j4=require("@vuu-ui/vuu-utils");var bM=[{label:"=",boost:10,type:"operator"},{label:"!=",boost:9,type:"operator"}],q4=[...bM,{label:"in",boost:6,type:"operator"},{label:"starts",boost:5,type:"operator"},{label:"ends",boost:4,type:"operator"}],G4=[...bM,{label:">",boost:8,type:"operator"},{label:"<",boost:7,type:"operator"}];var t5=require("@vuu-ui/vuu-filter-parser");var Vv=require("react");var xM=require("@vuu-ui/vuu-filter-parser"),NU=Za.define({name:"VuuFilterQuery",parser:xM.parser.configure({props:[Ga({Identifier:_.variableName,String:_.string,Or:_.emphasis,Operator:_.operator})]})});var Y4=Ai.define([{tag:_.variableName,color:"var(--vuuFilterEditor-variableColor)"},{tag:_.comment,color:"green",fontStyle:"italic"}]),Q4=tu(Y4);var X4=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});var e5=require("react");var wM=require("react/jsx-runtime");var SM=require("react");var n5=require("@vuu-ui/vuu-utils");var kM=require("@vuu-ui/vuu-utils");var EM=require("react");var r5=require("react/jsx-runtime");var i5=require("react/jsx-runtime");var yq=Ni.default.createContext({getApplicationSettings:()=>{},layoutMetadata:[],saveLayout:()=>{},applicationJson:Wm,saveApplicationLayout:()=>{},saveApplicationSettings:()=>{},loadLayoutById:()=>{}});var MM=require("react/jsx-runtime");var zv=require("react/jsx-runtime");var TM=require("react"),We=require("react/jsx-runtime"),IM=(0,TM.memo)(()=>(0,We.jsxs)("svg",{width:"44",height:"45",viewBox:"0 0 44 45",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,We.jsxs)("g",{clipPath:"url(#clip0_217_6990)",children:[(0,We.jsx)("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)"}),(0,We.jsx)("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)"}),(0,We.jsx)("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"}),(0,We.jsxs)("g",{opacity:"0.86",children:[(0,We.jsx)("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"}),(0,We.jsx)("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"}),(0,We.jsx)("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"})]})]}),(0,We.jsxs)("defs",{children:[(0,We.jsxs)("linearGradient",{id:"paint0_linear_217_6990",x1:"24.6235",y1:"18.7363",x2:"42.3152",y2:"18.7363",gradientUnits:"userSpaceOnUse",children:[(0,We.jsx)("stop",{stopColor:"#4906A5"}),(0,We.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,We.jsxs)("linearGradient",{id:"paint1_linear_217_6990",x1:"-2.35794e-05",y1:"22.5009",x2:"42.7186",y2:"22.5009",gradientUnits:"userSpaceOnUse",children:[(0,We.jsx)("stop",{stopColor:"#7C06A5"}),(0,We.jsx)("stop",{offset:"1",stopColor:"#D3423A"})]}),(0,We.jsx)("clipPath",{id:"clip0_217_6990",children:(0,We.jsx)("rect",{width:"44",height:"45",fill:"white"})})]})]}));IM.displayName="VuuLogo";var s5=require("@vuu-ui/vuu-utils");var PM=require("react");var LM=require("react/jsx-runtime");var DM=require("react/jsx-runtime");var l5=require("@vuu-ui/vuu-data-remote"),ru=require("@vuu-ui/vuu-utils");var ou=require("react");var AM=require("react/jsx-runtime");var c5=require("@vuu-ui/vuu-data-remote");var Of=require("@vuu-ui/vuu-utils");var _v=require("react");var RM=require("react");var OM=require("react/jsx-runtime");var a5=require("react");var u5=require("react/jsx-runtime");var HM=require("react/jsx-runtime");var $v=require("react"),NM=require("react/jsx-runtime");var FM=require("react/jsx-runtime");typeof wd!="function"&&console.warn("StackLayout module not loaded, will be unsbale to deserialize from layout JSON");var{error:mJ}=(0,Of.logger)("Shell");var Hf=require("react"),h5=require("react/jsx-runtime"),d5={},f5=(0,Hf.createContext)(d5);var BM=()=>(0,Hf.useContext)(f5);var p5=require("react");var VM=require("react/jsx-runtime");var Xs=require("@vuu-ui/vuu-utils"),iu=require("react"),zM=[],$M=new Map,m5=({labelColumn:t,table:e,valueColumn:n})=>{let r=`${e.module}:${e.table}`,o=$M.get(r);if(o)return o;{let i=new Promise(s=>{let l=[n,t],a=(0,Xs.buildColumnMap)(l),u=new WM.VuuDataSource({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 $M.set(r,i),i}},_M=(t,e)=>{var n;return e===void 0?null:(n=t.find(r=>r.value===e))!=null?n:null},g5=({name:t,type:e})=>{if((0,Xs.isTypeDescriptor)(e)&&(0,Xs.isLookupRenderer)(e.renderer))return e.renderer.lookup;throw Error(`useLookupValues column ${t} is not configured to use lookup values`)},v5=(t,e)=>{let n=g5(t),{getLookupValues:r}=BM(),o=(0,iu.useMemo)(()=>{var u;let a=(u=r==null?void 0:r(n.table))!=null?u:zM;return{initialValue:_M(a,e),values:a}},[r,e,n.table]),[{initialValue:i,values:s},l]=(0,iu.useState)(o);return(0,iu.useMemo)(()=>{s===zM&&m5(n).then(a=>l({initialValue:_M(a,e),values:a}))},[s,n,e]),{initialValue:i,values:s}};var el=require("react"),Wv=require("@vuu-ui/vuu-data-remote"),y5=()=>{let[t,e]=(0,el.useState)("disconnected"),n=(0,el.useCallback)(({status:r})=>{e(r)},[]);return(0,el.useEffect)(()=>(Wv.ConnectionManager.on("connection-status",n),()=>{Wv.ConnectionManager.removeListener("connection-status",n)}),[n]),t};var tl=require("react"),Kv=require("@vuu-ui/vuu-data-remote"),b5=()=>{let[t,e]=(0,tl.useState)(0),n=(0,tl.useCallback)(({messages:r})=>{e(r.messagesLength)},[]);return(0,tl.useEffect)(()=>(Kv.ConnectionManager.on("connection-metrics",n),()=>{Kv.ConnectionManager.removeListener("connection-metrics",n)}),[n]),t};var UM=require("react"),jM=require("@vuu-ui/vuu-data-remote"),KM={type:"RPC_CALL",service:"TypeAheadRpcHandler"},CM=(t,e,n="",r=[])=>n!==""&&!r.includes(n.toLowerCase())?[t,e,n]:[t,e],Md=()=>(0,UM.useCallback)(async t=>{let e=t.length===2?{method:"getUniqueFieldValues",params:t,...KM}:{method:"getUniqueFieldValuesStartingWith",params:t,...KM};return(0,jM.makeRpcCall)(e)},[]);var Uv=require("@vuu-ui/vuu-filter-parser"),nl=require("@vuu-ui/vuu-utils"),jv=require("react"),x5="addRowsFromInstruments",{KEY:qM}=nl.metadataKeys,w5={},S5=t=>"rpcName"in t,C5=t=>"menus"in t,k5=t=>t.name==="ROOT",GM=t=>t.context==="cell",E5=t=>t.context==="row",M5=t=>t.context==="selected-rows",T5=(t,e,n=0)=>{switch(t){case"grid":return e==="selected-rows"?n>0:!0;case"header":return e==="grid";default:return!1}},I5=(t,e,n,r,o)=>{if(t==="cell"||t==="row")return(0,Uv.getFilterPredicate)(o,r)(e);if(t==="selected-rows"){if(n.length===0)return!1;{let i=(0,Uv.getFilterPredicate)(o,r);return n.every(i)}}return!0},L5=t=>{let{rpcName:e}=t;return GM(t)?{field:t.field,rowKey:t.rowKey,rpcName:e,value:t.value,type:"VIEW_PORT_MENU_CELL_RPC"}:E5(t)?{rowKey:t.rowKey,row:t.row,rpcName:e,type:"VIEW_PORT_MENU_ROW_RPC"}:M5(t)?{rpcName:e,type:"VIEW_PORT_MENUS_SELECT_RPC"}:{rpcName:e,type:"VIEW_PORT_MENU_TABLE_RPC"}},P5=t=>["grid","header","filter"].includes(t),D5=({filter:t})=>typeof t=="string"&&t.length>0,A5=(t,e)=>{switch(t.context){case"cell":return{...t,field:e.columnName,rowKey:e.row[qM],value:e.row[e.columnMap[e.columnName]]};case"row":return{...t,row:(0,nl.getRowRecord)(e.row,e.columnMap),rowKey:e.row[qM]};default:return t}},JM=(t,e,n)=>{var r;return C5(t)?t.menus.some(o=>JM(o,e,n)):T5(e,t.context,(r=n.selectedRows)==null?void 0:r.length)?e==="grid"&&D5(t)?I5(t.context,n.row,n.selectedRows,t.filter,n.columnMap):GM(t)&&t.field!=="*"?t.field===n.columnName:!0:!1},ZM=(t,e,n)=>{if(JM(t,e,n)){if(S5(t))return{label:t.name,action:"MENU_RPC_CALL",options:A5(t,n)};{let r=t.menus.map(o=>ZM(o,e,n)).filter(o=>o!==void 0);if(r.length>0)return{label:t.name,children:r}}}},R5=({clientSideMenuActionHandler:t,dataSource:e,menuActionConfig:n=w5,onRpcResponse:r})=>{let o=(0,jv.useCallback)((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&&P5(s)){let d=ZM(u,s,l);k5(u)&&(0,nl.isGroupMenuItemDescriptor)(d)?f.push(...d.children):d&&f.push(d)}return f},[e,n]),i=(0,jv.useCallback)(({menuId:s,options:l})=>{if(t!=null&&t(s,l))return!0;if(s==="MENU_RPC_CALL"){let a=L5(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}};var qv=require("@vuu-ui/vuu-data-remote"),rl=require("react"),O5=()=>{let[t,e]=(0,rl.useState)(),n=(0,rl.useCallback)(r=>{let o=new Map;return r.forEach(i=>{o.set(i.table.table,i)}),o},[]);return(0,rl.useEffect)(()=>{async function r(){console.log("GET TABLE LIST");let o=await(0,qv.getServerAPI)(),{tables:i}=await o.getTableList(),s=n(await Promise.all(i.map(l=>o.getTableSchema(l))));e(s)}r()},[n]),t},H5=t=>(0,qv.getServerAPI)().then(e=>e.getTableSchema(t));
|
|
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
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var src_exports = {};
|
|
22
|
+
__export(src_exports, {
|
|
23
|
+
MovingWindow: () => MovingWindow,
|
|
24
|
+
addRowsFromInstruments: () => addRowsFromInstruments,
|
|
25
|
+
getTypeaheadParams: () => getTypeaheadParams,
|
|
26
|
+
getVuuTableSchema: () => getVuuTableSchema,
|
|
27
|
+
useDataSource: () => useDataSource,
|
|
28
|
+
useLookupValues: () => useLookupValues,
|
|
29
|
+
useServerConnectionQuality: () => useServerConnectionQuality,
|
|
30
|
+
useServerConnectionStatus: () => useServerConnectionStatus,
|
|
31
|
+
useTypeaheadSuggestions: () => useTypeaheadSuggestions,
|
|
32
|
+
useVuuMenuActions: () => useVuuMenuActions,
|
|
33
|
+
useVuuTables: () => useVuuTables
|
|
34
|
+
});
|
|
35
|
+
module.exports = __toCommonJS(src_exports);
|
|
36
|
+
|
|
37
|
+
// src/hooks/useDataSource.ts
|
|
38
|
+
var import_vuu_utils = require("@vuu-ui/vuu-utils");
|
|
39
|
+
var import_react = require("react");
|
|
40
|
+
var { SELECTED } = import_vuu_utils.metadataKeys;
|
|
41
|
+
function useDataSource({
|
|
42
|
+
dataSource,
|
|
43
|
+
renderBufferSize = 10
|
|
44
|
+
}) {
|
|
45
|
+
const [, forceUpdate] = (0, import_react.useState)(null);
|
|
46
|
+
const isMounted = (0, import_react.useRef)(true);
|
|
47
|
+
const hasUpdated = (0, import_react.useRef)(false);
|
|
48
|
+
const rafHandle = (0, import_react.useRef)(null);
|
|
49
|
+
const data = (0, import_react.useRef)([]);
|
|
50
|
+
const rangeRef = (0, import_react.useRef)({ from: 0, to: 10 });
|
|
51
|
+
const dataWindow = (0, import_react.useMemo)(
|
|
52
|
+
() => new MovingWindow((0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize)),
|
|
53
|
+
[renderBufferSize]
|
|
54
|
+
);
|
|
55
|
+
const setData = (0, import_react.useCallback)(
|
|
56
|
+
(updates) => {
|
|
57
|
+
for (const row of updates) {
|
|
58
|
+
dataWindow.add(row);
|
|
59
|
+
}
|
|
60
|
+
data.current = dataWindow.data.slice();
|
|
61
|
+
hasUpdated.current = true;
|
|
62
|
+
},
|
|
63
|
+
[dataWindow]
|
|
64
|
+
);
|
|
65
|
+
const datasourceMessageHandler = (0, import_react.useCallback)(
|
|
66
|
+
(message) => {
|
|
67
|
+
if (message.type === "viewport-update") {
|
|
68
|
+
if (message.size !== void 0) {
|
|
69
|
+
dataWindow.setRowCount(message.size);
|
|
70
|
+
}
|
|
71
|
+
if (message.rows) {
|
|
72
|
+
setData(message.rows);
|
|
73
|
+
forceUpdate({});
|
|
74
|
+
} else if (message.size !== void 0) {
|
|
75
|
+
data.current = dataWindow.data.slice();
|
|
76
|
+
hasUpdated.current = true;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
[dataWindow, setData]
|
|
81
|
+
);
|
|
82
|
+
(0, import_react.useEffect)(
|
|
83
|
+
() => () => {
|
|
84
|
+
if (rafHandle.current) {
|
|
85
|
+
cancelAnimationFrame(rafHandle.current);
|
|
86
|
+
rafHandle.current = null;
|
|
87
|
+
}
|
|
88
|
+
isMounted.current = false;
|
|
89
|
+
},
|
|
90
|
+
[]
|
|
91
|
+
);
|
|
92
|
+
const setRange = (0, import_react.useCallback)(
|
|
93
|
+
(range) => {
|
|
94
|
+
rangeRef.current = range;
|
|
95
|
+
const fullRange = (0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize);
|
|
96
|
+
dataSource.range = fullRange;
|
|
97
|
+
dataWindow.setRange(fullRange.from, fullRange.to);
|
|
98
|
+
},
|
|
99
|
+
[dataSource, dataWindow, renderBufferSize]
|
|
100
|
+
);
|
|
101
|
+
(0, import_react.useMemo)(() => {
|
|
102
|
+
const { from, to } = rangeRef.current;
|
|
103
|
+
const fullRange = (0, import_vuu_utils.getFullRange)({ from, to }, renderBufferSize);
|
|
104
|
+
dataSource.range = fullRange;
|
|
105
|
+
dataWindow.setRange(fullRange.from, fullRange.to);
|
|
106
|
+
}, [dataSource, dataWindow, renderBufferSize]);
|
|
107
|
+
(0, import_react.useEffect)(() => {
|
|
108
|
+
const { from, to } = (0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize);
|
|
109
|
+
dataSource.subscribe(
|
|
110
|
+
{
|
|
111
|
+
range: { from, to }
|
|
112
|
+
},
|
|
113
|
+
datasourceMessageHandler
|
|
114
|
+
);
|
|
115
|
+
}, [dataSource, datasourceMessageHandler, renderBufferSize]);
|
|
116
|
+
(0, import_react.useEffect)(
|
|
117
|
+
() => () => {
|
|
118
|
+
dataSource.unsubscribe();
|
|
119
|
+
},
|
|
120
|
+
[dataSource]
|
|
121
|
+
);
|
|
122
|
+
return [
|
|
123
|
+
data.current,
|
|
124
|
+
dataWindow.rowCount,
|
|
125
|
+
(0, import_vuu_utils.getFullRange)(rangeRef.current, renderBufferSize),
|
|
126
|
+
setRange
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
var MovingWindow = class {
|
|
130
|
+
constructor({ from, to }) {
|
|
131
|
+
this.rowCount = 0;
|
|
132
|
+
this.setRowCount = (rowCount) => {
|
|
133
|
+
if (rowCount < this.data.length) {
|
|
134
|
+
this.data.length = rowCount;
|
|
135
|
+
}
|
|
136
|
+
this.rowCount = rowCount;
|
|
137
|
+
};
|
|
138
|
+
this.range = new import_vuu_utils.WindowRange(from, to);
|
|
139
|
+
this.data = new Array(to - from);
|
|
140
|
+
}
|
|
141
|
+
add(data) {
|
|
142
|
+
const [index] = data;
|
|
143
|
+
if (this.isWithinRange(index)) {
|
|
144
|
+
const internalIndex = index - this.range.from;
|
|
145
|
+
this.data[internalIndex] = data;
|
|
146
|
+
if (this.data[internalIndex - 1]) {
|
|
147
|
+
if (this.data[internalIndex - 1][SELECTED] === 1 && data[SELECTED] === 0) {
|
|
148
|
+
data[SELECTED] = 2;
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
if (index === this.rowCount - 1) {
|
|
152
|
+
this.data.length = internalIndex + 1;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
getAtIndex(index) {
|
|
157
|
+
return this.range.isWithin(index) && this.data[index - this.range.from] != null ? this.data[index - this.range.from] : void 0;
|
|
158
|
+
}
|
|
159
|
+
isWithinRange(index) {
|
|
160
|
+
return this.range.isWithin(index);
|
|
161
|
+
}
|
|
162
|
+
setRange(from, to) {
|
|
163
|
+
if (from !== this.range.from || to !== this.range.to) {
|
|
164
|
+
const [overlapFrom, overlapTo] = this.range.overlap(from, to);
|
|
165
|
+
const newData = new Array(to - from);
|
|
166
|
+
for (let i = overlapFrom; i < overlapTo; i++) {
|
|
167
|
+
const data = this.getAtIndex(i);
|
|
168
|
+
if (data) {
|
|
169
|
+
const index = i - from;
|
|
170
|
+
newData[index] = data;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
this.data = newData;
|
|
174
|
+
this.range.from = from;
|
|
175
|
+
this.range.to = to;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
// src/hooks/useLookupValues.ts
|
|
181
|
+
var import_vuu_data_remote = require("@vuu-ui/vuu-data-remote");
|
|
182
|
+
var import_vuu_shell = require("@vuu-ui/vuu-shell");
|
|
183
|
+
var import_vuu_utils2 = require("@vuu-ui/vuu-utils");
|
|
184
|
+
var import_react2 = require("react");
|
|
185
|
+
var NO_VALUES = [];
|
|
186
|
+
var lookupValueMap = /* @__PURE__ */ new Map();
|
|
187
|
+
var loadLookupValues = ({
|
|
188
|
+
labelColumn,
|
|
189
|
+
table,
|
|
190
|
+
valueColumn
|
|
191
|
+
}) => {
|
|
192
|
+
const tableKey = `${table.module}:${table.table}`;
|
|
193
|
+
const lookupValues = lookupValueMap.get(tableKey);
|
|
194
|
+
if (lookupValues) {
|
|
195
|
+
return lookupValues;
|
|
196
|
+
} else {
|
|
197
|
+
const promise = new Promise((resolve) => {
|
|
198
|
+
const columns = [valueColumn, labelColumn];
|
|
199
|
+
const columnMap = (0, import_vuu_utils2.buildColumnMap)(columns);
|
|
200
|
+
const dataSource = new import_vuu_data_remote.VuuDataSource({
|
|
201
|
+
bufferSize: 0,
|
|
202
|
+
table
|
|
203
|
+
});
|
|
204
|
+
dataSource.subscribe(
|
|
205
|
+
{
|
|
206
|
+
columns,
|
|
207
|
+
range: { from: 0, to: 100 }
|
|
208
|
+
},
|
|
209
|
+
(message) => {
|
|
210
|
+
if (message.type === "viewport-update") {
|
|
211
|
+
if (message.rows) {
|
|
212
|
+
const listOptions = message.rows.map((row) => ({
|
|
213
|
+
value: row[columnMap[valueColumn]],
|
|
214
|
+
label: row[columnMap[labelColumn]]
|
|
215
|
+
}));
|
|
216
|
+
resolve(listOptions);
|
|
217
|
+
dataSource.unsubscribe();
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
);
|
|
222
|
+
});
|
|
223
|
+
lookupValueMap.set(tableKey, promise);
|
|
224
|
+
return promise;
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
var getSelectedOption = (values, selectedValue) => {
|
|
228
|
+
var _a;
|
|
229
|
+
if (selectedValue === void 0) {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
return (_a = values.find((option) => option.value === selectedValue)) != null ? _a : null;
|
|
233
|
+
};
|
|
234
|
+
var getLookupDetails = ({ name, type }) => {
|
|
235
|
+
if ((0, import_vuu_utils2.isTypeDescriptor)(type) && (0, import_vuu_utils2.isLookupRenderer)(type.renderer)) {
|
|
236
|
+
return type.renderer.lookup;
|
|
237
|
+
} else {
|
|
238
|
+
throw Error(
|
|
239
|
+
`useLookupValues column ${name} is not configured to use lookup values`
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
var useLookupValues = (column, initialValueProp) => {
|
|
244
|
+
const lookupDetails = getLookupDetails(column);
|
|
245
|
+
const { getLookupValues } = (0, import_vuu_shell.useShellContext)();
|
|
246
|
+
const initialState = (0, import_react2.useMemo)(() => {
|
|
247
|
+
var _a;
|
|
248
|
+
const values2 = (_a = getLookupValues == null ? void 0 : getLookupValues(lookupDetails.table)) != null ? _a : NO_VALUES;
|
|
249
|
+
return {
|
|
250
|
+
initialValue: getSelectedOption(values2, initialValueProp),
|
|
251
|
+
values: values2
|
|
252
|
+
};
|
|
253
|
+
}, [getLookupValues, initialValueProp, lookupDetails.table]);
|
|
254
|
+
const [{ initialValue, values }, setLookupState] = (0, import_react2.useState)(initialState);
|
|
255
|
+
(0, import_react2.useMemo)(() => {
|
|
256
|
+
if (values === NO_VALUES) {
|
|
257
|
+
loadLookupValues(lookupDetails).then(
|
|
258
|
+
(values2) => setLookupState({
|
|
259
|
+
initialValue: getSelectedOption(values2, initialValueProp),
|
|
260
|
+
values: values2
|
|
261
|
+
})
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
}, [values, lookupDetails, initialValueProp]);
|
|
265
|
+
return {
|
|
266
|
+
initialValue,
|
|
267
|
+
values
|
|
268
|
+
};
|
|
269
|
+
};
|
|
270
|
+
|
|
271
|
+
// src/hooks/useServerConnectionStatus.ts
|
|
272
|
+
var import_react3 = require("react");
|
|
273
|
+
var import_vuu_data_remote2 = require("@vuu-ui/vuu-data-remote");
|
|
274
|
+
var useServerConnectionStatus = () => {
|
|
275
|
+
const [connectionStatus, setConnectionStatus] = (0, import_react3.useState)("disconnected");
|
|
276
|
+
const handleStatusChange = (0, import_react3.useCallback)(
|
|
277
|
+
({ status }) => {
|
|
278
|
+
setConnectionStatus(status);
|
|
279
|
+
},
|
|
280
|
+
[]
|
|
281
|
+
);
|
|
282
|
+
(0, import_react3.useEffect)(() => {
|
|
283
|
+
import_vuu_data_remote2.ConnectionManager.on("connection-status", handleStatusChange);
|
|
284
|
+
return () => {
|
|
285
|
+
import_vuu_data_remote2.ConnectionManager.removeListener("connection-status", handleStatusChange);
|
|
286
|
+
};
|
|
287
|
+
}, [handleStatusChange]);
|
|
288
|
+
return connectionStatus;
|
|
289
|
+
};
|
|
290
|
+
|
|
291
|
+
// src/hooks/useServerConnectionQuality.ts
|
|
292
|
+
var import_react4 = require("react");
|
|
293
|
+
var import_vuu_data_remote3 = require("@vuu-ui/vuu-data-remote");
|
|
294
|
+
var useServerConnectionQuality = () => {
|
|
295
|
+
const [messagesPerSecond, setMessagesPerSecond] = (0, import_react4.useState)(0);
|
|
296
|
+
const handleConnectivityMessage = (0, import_react4.useCallback)(({ messages }) => {
|
|
297
|
+
setMessagesPerSecond(messages.messagesLength);
|
|
298
|
+
}, []);
|
|
299
|
+
(0, import_react4.useEffect)(() => {
|
|
300
|
+
import_vuu_data_remote3.ConnectionManager.on("connection-metrics", handleConnectivityMessage);
|
|
301
|
+
return () => {
|
|
302
|
+
import_vuu_data_remote3.ConnectionManager.removeListener(
|
|
303
|
+
"connection-metrics",
|
|
304
|
+
handleConnectivityMessage
|
|
305
|
+
);
|
|
306
|
+
};
|
|
307
|
+
}, [handleConnectivityMessage]);
|
|
308
|
+
return messagesPerSecond;
|
|
309
|
+
};
|
|
310
|
+
|
|
311
|
+
// src/hooks/useTypeaheadSuggestions.ts
|
|
312
|
+
var import_vuu_data_remote4 = require("@vuu-ui/vuu-data-remote");
|
|
313
|
+
var import_react5 = require("react");
|
|
314
|
+
var TYPEAHEAD_MESSAGE_CONSTANTS = {
|
|
315
|
+
type: "RPC_CALL",
|
|
316
|
+
service: "TypeAheadRpcHandler"
|
|
317
|
+
};
|
|
318
|
+
var getTypeaheadParams = (table, column, text = "", selectedValues = []) => {
|
|
319
|
+
if (text !== "" && !selectedValues.includes(text.toLowerCase())) {
|
|
320
|
+
return [table, column, text];
|
|
321
|
+
}
|
|
322
|
+
return [table, column];
|
|
323
|
+
};
|
|
324
|
+
var useTypeaheadSuggestions = () => (0, import_react5.useCallback)(async (params) => {
|
|
325
|
+
const rpcMessage = params.length === 2 ? {
|
|
326
|
+
method: "getUniqueFieldValues",
|
|
327
|
+
params,
|
|
328
|
+
...TYPEAHEAD_MESSAGE_CONSTANTS
|
|
329
|
+
} : {
|
|
330
|
+
method: "getUniqueFieldValuesStartingWith",
|
|
331
|
+
params,
|
|
332
|
+
...TYPEAHEAD_MESSAGE_CONSTANTS
|
|
333
|
+
};
|
|
334
|
+
return (0, import_vuu_data_remote4.makeRpcCall)(rpcMessage);
|
|
335
|
+
}, []);
|
|
336
|
+
|
|
337
|
+
// src/hooks/useVuuMenuActions.ts
|
|
338
|
+
var import_vuu_filter_parser = require("@vuu-ui/vuu-filter-parser");
|
|
339
|
+
var import_vuu_utils3 = require("@vuu-ui/vuu-utils");
|
|
340
|
+
var import_react6 = require("react");
|
|
341
|
+
var addRowsFromInstruments = "addRowsFromInstruments";
|
|
342
|
+
var { KEY } = import_vuu_utils3.metadataKeys;
|
|
343
|
+
var NO_CONFIG = {};
|
|
344
|
+
var isMenuItem = (menu) => "rpcName" in menu;
|
|
345
|
+
var isGroupMenuItem = (menu) => "menus" in menu;
|
|
346
|
+
var isRoot = (menu) => menu.name === "ROOT";
|
|
347
|
+
var isCellMenu = (options) => options.context === "cell";
|
|
348
|
+
var isRowMenu = (options) => options.context === "row";
|
|
349
|
+
var isSelectionMenu = (options) => options.context === "selected-rows";
|
|
350
|
+
var vuuContextCompatibleWithTableLocation = (uiLocation, vuuContext, selectedRowCount = 0) => {
|
|
351
|
+
switch (uiLocation) {
|
|
352
|
+
case "grid":
|
|
353
|
+
if (vuuContext === "selected-rows") {
|
|
354
|
+
return selectedRowCount > 0;
|
|
355
|
+
} else {
|
|
356
|
+
return true;
|
|
357
|
+
}
|
|
358
|
+
case "header":
|
|
359
|
+
return vuuContext === "grid";
|
|
360
|
+
default:
|
|
361
|
+
return false;
|
|
362
|
+
}
|
|
363
|
+
};
|
|
364
|
+
var gridRowMeetsFilterCriteria = (context, row, selectedRows, filter, columnMap) => {
|
|
365
|
+
if (context === "cell" || context === "row") {
|
|
366
|
+
const filterPredicate = (0, import_vuu_filter_parser.getFilterPredicate)(columnMap, filter);
|
|
367
|
+
return filterPredicate(row);
|
|
368
|
+
} else if (context === "selected-rows") {
|
|
369
|
+
if (selectedRows.length === 0) {
|
|
370
|
+
return false;
|
|
371
|
+
} else {
|
|
372
|
+
const filterPredicate = (0, import_vuu_filter_parser.getFilterPredicate)(columnMap, filter);
|
|
373
|
+
return selectedRows.every(filterPredicate);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return true;
|
|
377
|
+
};
|
|
378
|
+
var getMenuRpcRequest = (options) => {
|
|
379
|
+
const { rpcName } = options;
|
|
380
|
+
if (isCellMenu(options)) {
|
|
381
|
+
return {
|
|
382
|
+
field: options.field,
|
|
383
|
+
rowKey: options.rowKey,
|
|
384
|
+
rpcName,
|
|
385
|
+
value: options.value,
|
|
386
|
+
type: "VIEW_PORT_MENU_CELL_RPC"
|
|
387
|
+
};
|
|
388
|
+
} else if (isRowMenu(options)) {
|
|
389
|
+
return {
|
|
390
|
+
rowKey: options.rowKey,
|
|
391
|
+
row: options.row,
|
|
392
|
+
rpcName,
|
|
393
|
+
type: "VIEW_PORT_MENU_ROW_RPC"
|
|
394
|
+
};
|
|
395
|
+
} else if (isSelectionMenu(options)) {
|
|
396
|
+
return {
|
|
397
|
+
rpcName,
|
|
398
|
+
type: "VIEW_PORT_MENUS_SELECT_RPC"
|
|
399
|
+
};
|
|
400
|
+
} else {
|
|
401
|
+
return {
|
|
402
|
+
rpcName,
|
|
403
|
+
type: "VIEW_PORT_MENU_TABLE_RPC"
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
};
|
|
407
|
+
var isTableLocation = (location) => ["grid", "header", "filter"].includes(location);
|
|
408
|
+
var hasFilter = ({ filter }) => typeof filter === "string" && filter.length > 0;
|
|
409
|
+
var getMenuItemOptions = (menu, options) => {
|
|
410
|
+
switch (menu.context) {
|
|
411
|
+
case "cell":
|
|
412
|
+
return {
|
|
413
|
+
...menu,
|
|
414
|
+
field: options.columnName,
|
|
415
|
+
rowKey: options.row[KEY],
|
|
416
|
+
value: options.row[options.columnMap[options.columnName]]
|
|
417
|
+
};
|
|
418
|
+
case "row":
|
|
419
|
+
return {
|
|
420
|
+
...menu,
|
|
421
|
+
row: (0, import_vuu_utils3.getRowRecord)(options.row, options.columnMap),
|
|
422
|
+
rowKey: options.row[KEY]
|
|
423
|
+
};
|
|
424
|
+
default:
|
|
425
|
+
return menu;
|
|
426
|
+
}
|
|
427
|
+
};
|
|
428
|
+
var menuShouldBeRenderedInThisContext = (menuItem, tableLocation, options) => {
|
|
429
|
+
var _a;
|
|
430
|
+
if (isGroupMenuItem(menuItem)) {
|
|
431
|
+
return menuItem.menus.some(
|
|
432
|
+
(childMenu) => menuShouldBeRenderedInThisContext(childMenu, tableLocation, options)
|
|
433
|
+
);
|
|
434
|
+
}
|
|
435
|
+
if (!vuuContextCompatibleWithTableLocation(
|
|
436
|
+
tableLocation,
|
|
437
|
+
menuItem.context,
|
|
438
|
+
(_a = options.selectedRows) == null ? void 0 : _a.length
|
|
439
|
+
)) {
|
|
440
|
+
return false;
|
|
441
|
+
}
|
|
442
|
+
if (tableLocation === "grid" && hasFilter(menuItem)) {
|
|
443
|
+
return gridRowMeetsFilterCriteria(
|
|
444
|
+
menuItem.context,
|
|
445
|
+
options.row,
|
|
446
|
+
options.selectedRows,
|
|
447
|
+
menuItem.filter,
|
|
448
|
+
options.columnMap
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
if (isCellMenu(menuItem) && menuItem.field !== "*") {
|
|
452
|
+
return menuItem.field === options.columnName;
|
|
453
|
+
}
|
|
454
|
+
return true;
|
|
455
|
+
};
|
|
456
|
+
var buildMenuDescriptor = (menu, tableLocation, options) => {
|
|
457
|
+
if (menuShouldBeRenderedInThisContext(menu, tableLocation, options)) {
|
|
458
|
+
if (isMenuItem(menu)) {
|
|
459
|
+
return {
|
|
460
|
+
label: menu.name,
|
|
461
|
+
action: "MENU_RPC_CALL",
|
|
462
|
+
options: getMenuItemOptions(menu, options)
|
|
463
|
+
};
|
|
464
|
+
} else {
|
|
465
|
+
const children = menu.menus.map(
|
|
466
|
+
(childMenu) => buildMenuDescriptor(childMenu, tableLocation, options)
|
|
467
|
+
).filter(
|
|
468
|
+
(childMenu) => childMenu !== void 0
|
|
469
|
+
);
|
|
470
|
+
if (children.length > 0) {
|
|
471
|
+
return {
|
|
472
|
+
label: menu.name,
|
|
473
|
+
children
|
|
474
|
+
};
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
var useVuuMenuActions = ({
|
|
480
|
+
clientSideMenuActionHandler,
|
|
481
|
+
dataSource,
|
|
482
|
+
menuActionConfig = NO_CONFIG,
|
|
483
|
+
onRpcResponse
|
|
484
|
+
}) => {
|
|
485
|
+
const buildViewserverMenuOptions = (0, import_react6.useCallback)(
|
|
486
|
+
(location, options) => {
|
|
487
|
+
const { links, menu } = dataSource;
|
|
488
|
+
const { visualLink } = menuActionConfig;
|
|
489
|
+
const descriptors = [];
|
|
490
|
+
if (location === "grid" && links && !visualLink) {
|
|
491
|
+
links.forEach((linkDescriptor) => {
|
|
492
|
+
const { link, label: linkLabel } = linkDescriptor;
|
|
493
|
+
const label = linkLabel ? linkLabel : link.toTable;
|
|
494
|
+
descriptors.push({
|
|
495
|
+
label: `Link to ${label}`,
|
|
496
|
+
action: "link-table",
|
|
497
|
+
options: linkDescriptor
|
|
498
|
+
});
|
|
499
|
+
});
|
|
500
|
+
}
|
|
501
|
+
if (menu && isTableLocation(location)) {
|
|
502
|
+
const menuDescriptor = buildMenuDescriptor(
|
|
503
|
+
menu,
|
|
504
|
+
location,
|
|
505
|
+
options
|
|
506
|
+
);
|
|
507
|
+
if (isRoot(menu) && (0, import_vuu_utils3.isGroupMenuItemDescriptor)(menuDescriptor)) {
|
|
508
|
+
descriptors.push(...menuDescriptor.children);
|
|
509
|
+
} else if (menuDescriptor) {
|
|
510
|
+
descriptors.push(menuDescriptor);
|
|
511
|
+
}
|
|
512
|
+
}
|
|
513
|
+
return descriptors;
|
|
514
|
+
},
|
|
515
|
+
[dataSource, menuActionConfig]
|
|
516
|
+
);
|
|
517
|
+
const handleMenuAction = (0, import_react6.useCallback)(
|
|
518
|
+
({ menuId, options }) => {
|
|
519
|
+
if (clientSideMenuActionHandler == null ? void 0 : clientSideMenuActionHandler(menuId, options)) {
|
|
520
|
+
return true;
|
|
521
|
+
} else if (menuId === "MENU_RPC_CALL") {
|
|
522
|
+
const rpcRequest = getMenuRpcRequest(options);
|
|
523
|
+
dataSource.menuRpcCall(rpcRequest).then((rpcResponse) => {
|
|
524
|
+
if (onRpcResponse && rpcResponse) {
|
|
525
|
+
onRpcResponse && onRpcResponse(rpcResponse);
|
|
526
|
+
}
|
|
527
|
+
});
|
|
528
|
+
return true;
|
|
529
|
+
} else if (menuId === "link-table") {
|
|
530
|
+
return dataSource.visualLink = options, true;
|
|
531
|
+
} else {
|
|
532
|
+
console.log(
|
|
533
|
+
`useViewServer handleMenuAction, can't handle action type ${menuId}`
|
|
534
|
+
);
|
|
535
|
+
}
|
|
536
|
+
return false;
|
|
537
|
+
},
|
|
538
|
+
[clientSideMenuActionHandler, dataSource, onRpcResponse]
|
|
539
|
+
);
|
|
540
|
+
return {
|
|
541
|
+
buildViewserverMenuOptions,
|
|
542
|
+
handleMenuAction
|
|
543
|
+
};
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
// src/hooks/useVuuTables.ts
|
|
547
|
+
var import_vuu_data_remote5 = require("@vuu-ui/vuu-data-remote");
|
|
548
|
+
var import_react7 = require("react");
|
|
549
|
+
var useVuuTables = () => {
|
|
550
|
+
const [tables, setTables] = (0, import_react7.useState)();
|
|
551
|
+
const buildTables = (0, import_react7.useCallback)((schemas) => {
|
|
552
|
+
const vuuTables = /* @__PURE__ */ new Map();
|
|
553
|
+
schemas.forEach((schema) => {
|
|
554
|
+
vuuTables.set(schema.table.table, schema);
|
|
555
|
+
});
|
|
556
|
+
return vuuTables;
|
|
557
|
+
}, []);
|
|
558
|
+
(0, import_react7.useEffect)(() => {
|
|
559
|
+
async function fetchTableMetadata() {
|
|
560
|
+
console.log("GET TABLE LIST");
|
|
561
|
+
const server = await (0, import_vuu_data_remote5.getServerAPI)();
|
|
562
|
+
const { tables: tables2 } = await server.getTableList();
|
|
563
|
+
const tableSchemas = buildTables(
|
|
564
|
+
await Promise.all(
|
|
565
|
+
tables2.map((vuuTable) => server.getTableSchema(vuuTable))
|
|
566
|
+
)
|
|
567
|
+
);
|
|
568
|
+
setTables(tableSchemas);
|
|
569
|
+
}
|
|
570
|
+
fetchTableMetadata();
|
|
571
|
+
}, [buildTables]);
|
|
572
|
+
return tables;
|
|
573
|
+
};
|
|
574
|
+
var getVuuTableSchema = (table) => (0, import_vuu_data_remote5.getServerAPI)().then((server) => server.getTableSchema(table));
|
|
447
575
|
//# sourceMappingURL=index.js.map
|